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
|
---|---|---|---|---|
software/driver/ublox8-protocol.ads | TUM-EI-RCS/StratoX | 12 | 21414 | -- Institution: Technische Universität München
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
--
-- Authors: <NAME> (<EMAIL>)
--
-- Description: U-Blox protocol definition. Following u-blox 6/7/8 Receiver Description
-- @author <NAME> <<EMAIL>>
-- @author <NAME> <<EMAIL>>
-- @author <NAME> <<EMAIL>>
--
-- @author <NAME>
-- (rework, add ubx7+ compatibility)
--
-- @author <NAME> (Ada Port)
-- Protocoll: https://de.wikipedia.org/wiki/NMEA_0183
with HIL; use HIL;
package ublox8.Protocol with SPARK_Mode is
UBX_SYNC1 : constant := 16#B5#;
UBX_SYNC2 : constant := 16#62#;
-- Message Classes
UBX_CLASS_NAV : constant := 16#01#;
UBX_CLASS_ACK : constant := 16#05#;
UBX_CLASS_CFG : constant := 16#06#;
UBX_CLASS_MON : constant := 16#0A#;
UBX_CLASS_RTCM3 : constant := 16#F5# ;--*< This is undocumented (?)
-- Message IDs
UBX_ID_NAV_POSLLH : constant := 16#02#;
UBX_ID_NAV_STATUS : constant := 16#03#;
UBX_ID_NAV_DOP : constant := 16#04#;
UBX_ID_NAV_SOL : constant := 16#06#;
UBX_ID_NAV_PVT : constant := 16#07#;
UBX_ID_NAV_VELNED : constant := 16#12#;
UBX_ID_NAV_TIMEUTC : constant := 16#21#;
UBX_ID_NAV_SVINFO : constant := 16#30#;
UBX_ID_NAV_SAT : constant := 16#35#;
UBX_ID_NAV_SVIN : constant := 16#3B#;
UBX_ID_NAV_RELPOSNED : constant := 16#3C#;
UBX_ID_ACK_NAK : constant := 16#00#;
UBX_ID_ACK_ACK : constant := 16#01#;
UBX_ID_CFG_PRT : constant := 16#00#;
UBX_ID_CFG_MSG : constant := 16#01#;
UBX_ID_CFG_RATE : constant := 16#08#;
UBX_ID_CFG_NAV5 : constant := 16#24#;
UBX_ID_CFG_SBAS : constant := 16#16#;
UBX_ID_CFG_TMODE3 : constant := 16#71#;
UBX_ID_MON_VER : constant := 16#04#;
UBX_ID_MON_HW : constant := 16#09#;
UBX_ID_RTCM31_005 : constant := 16#05#;
UBX_ID_RTCM31_077 : constant := 16#4D#;
UBX_ID_RTCM31_087 : constant := 16#57#;
-- lengths
UBX_LENGTH_CFG_PRT : constant := 20;
UBX_LENGTH_CFG_MSG : constant := 8;
UBX_LENGTH_NAV_PVT : constant := 92;
UBX_LENGTH_ACK_ACK : constant := 2;
-- Message Classes and IDs
-- UBX_MSG_NAV_POSLLH : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_POSLLH, 8));
-- UBX_MSG_NAV_SOL : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_SOL, 8));
-- UBX_MSG_NAV_DOP : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_DOP, 8));
-- UBX_MSG_NAV_PVT : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_PVT, 8));
-- UBX_MSG_NAV_VELNED : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_VELNED, 8));
-- UBX_MSG_NAV_TIMEUTC : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_TIMEUTC, 8));
-- UBX_MSG_NAV_SVINFO : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_SVINFO, 8));
-- UBX_MSG_NAV_SAT : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_SAT, 8));
-- UBX_MSG_NAV_SVIN : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_SVIN, 8));
-- UBX_MSG_NAV_RELPOSNED : constant := ((UBX_CLASS_NAV) or Shift_Left(UBX_ID_NAV_RELPOSNED, 8));
-- UBX_MSG_ACK_NAK : constant := ((UBX_CLASS_ACK) or Shift_Left(UBX_ID_ACK_NAK, 8));
-- UBX_MSG_ACK_ACK : constant := ((UBX_CLASS_ACK) or Shift_Left(UBX_ID_ACK_ACK, 8));
-- UBX_MSG_CFG_PRT : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_PRT, 8));
-- UBX_MSG_CFG_MSG : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_MSG, 8));
-- UBX_MSG_CFG_RATE : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_RATE, 8));
-- UBX_MSG_CFG_NAV5 : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_NAV5, 8));
-- UBX_MSG_CFG_SBAS : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_SBAS, 8));
-- UBX_MSG_CFG_TMODE3 : constant := ((UBX_CLASS_CFG) or Shift_Left(UBX_ID_CFG_TMODE3, 8));
-- UBX_MSG_MON_HW : constant := ((UBX_CLASS_MON) or Shift_Left(UBX_ID_MON_HW, 8));
-- UBX_MSG_MON_VER : constant := ((UBX_CLASS_MON) or Shift_Left(UBX_ID_MON_VER, 8));
-- UBX_MSG_RTCM31_005 : constant := ((UBX_CLASS_RTCM3) or Shift_Left(UBX_ID_RTCM31_005, 8));
-- UBX_MSG_RTCM31_077 : constant := ((UBX_CLASS_RTCM3) or Shift_Left(UBX_ID_RTCM31_077, 8));
-- UBX_MSG_RTCM31_087 : constant := ((UBX_CLASS_RTCM3) or Shift_Left(UBX_ID_RTCM31_087, 8));
-- RX NAV-PVT message content details
-- Bitfield "valid" masks
UBX_RX_NAV_PVT_VALIDVALIDDATE : constant := 16#01# ;--*< validDate (Valid UTC Date)
UBX_RX_NAV_PVT_VALIDVALIDTIME : constant := 16#02# ;--*< validTime (Valid UTC Time)
UBX_RX_NAV_PVT_VALIDFULLYRESOLVED : constant := 16#04# ;--*< fullyResolved (1 := UTC Time of Day has been fully resolved (no seconds uncertainty))
-- Bitfield "flags" masks
UBX_RX_NAV_PVT_FLAGSGNSSFIXOK : constant := 16#01# ;--*< gnssFixOK (A valid fix (i.e within DOP and accuracy masks))
UBX_RX_NAV_PVT_FLAGSDIFFSOLN : constant := 16#02# ;--*< diffSoln (1 if differential corrections were applied)
UBX_RX_NAV_PVT_FLAGSPSMSTATE : constant := 16#1C# ;--*< psmState (Power Save Mode state (see Power Management))
UBX_RX_NAV_PVT_FLAGSHEADVEHVALID : constant := 16#20# ;--*< headVehValid (Heading of vehicle is valid)
-- RX NAV-TIMEUTC message content details
-- Bitfield "valid" masks
UBX_RX_NAV_TIMEUTC_VALIDVALIDTOW : constant := 16#01# ;--*< validTOW (1 := Valid Time of Week)
UBX_RX_NAV_TIMEUTC_VALIDVALIDKWN : constant := 16#02# ;--*< validWKN (1 := Valid Week Number)
UBX_RX_NAV_TIMEUTC_VALIDVALIDUTC : constant := 16#04# ;--*< validUTC (1 := Valid UTC Time)
UBX_RX_NAV_TIMEUTC_VALIDUTCSTANDARD : constant := 16#F0# ;--*< utcStandard (0..15 := UTC standard identifier)
-- TX CFG-PRT message contents
UBX_TX_CFG_PRT_PORTID : constant := 16#01# ;--*< UART1
UBX_TX_CFG_PRT_PORTID_USB : constant := 16#03# ;--*< USB
UBX_TX_CFG_PRT_MODE : constant := 16#0000_008D0# ;--*< 2#0000100011010000#: 8N1
UBX_TX_CFG_PRT_BAUDRATE : constant :=38_400 ;--*< choose38_400 as GPS baudrate
--UBX_TX_CFG_PRT_INPROTOMASK : constant := (2**5) or (2**2) or 16#01# ;--*< RTCM3 in and RTCM2 in and UBX in
UBX_TX_CFG_PRT_OUTPROTOMASK_GPS : constant := (16#01#) ;--*< UBX out
--UBX_TX_CFG_PRT_OUTPROTOMASK_RTCM : constant := (2**5) or 16#01# ;--*< RTCM3 out and UBX out
-- TX CFG-RATE message contents
UBX_TX_CFG_RATE_MEASINTERVAL : constant := 200 ;--*< 200ms for 5Hz
UBX_TX_CFG_RATE_NAVRATE : constant := 1 ;--*< cannot be changed
UBX_TX_CFG_RATE_TIMEREF : constant := 0 ;--*< 0: UTC, 1: GPS time
-- TX CFG-NAV5 message contents
UBX_TX_CFG_NAV5_MASK : constant := 00_005 ;--*< Only update dynamic model and fix mode
UBX_TX_CFG_NAV5_DYNMODEL : constant := 7; --*< 0 Portable, 2 Stationary, 3 Pedestrian, 4 Automotive, 5 Sea, 6 Airborne <1g, 7 Airborne <2g, 8 Airborne <4g
UBX_TX_CFG_NAV5_DYNMODEL_RTCM : constant := 2;
UBX_TX_CFG_NAV5_FIXMODE : constant := 2 ;--*< 1 2D only, 2 3D only, 3 Auto 2D/3D
-- TX CFG-SBAS message contents
UBX_TX_CFG_SBAS_MODE_ENABLED : constant := 1 ;--*< SBAS enabled
UBX_TX_CFG_SBAS_MODE_DISABLED : constant := 0 ;--*< SBAS disabled
UBX_TX_CFG_SBAS_MODE : constant := UBX_TX_CFG_SBAS_MODE_DISABLED ;--*< SBAS enabled or disabled
-- TX CFG-MSG message contents
UBX_TX_CFG_MSG_RATE1_5HZ : constant := 16#01# ;--*< {16#00#, 16#01#, 16#00#, 16#00#, 16#00#, 16#00#} the second entry is for UART1
UBX_TX_CFG_MSG_RATE1_1HZ : constant := 16#05# ;--*< {16#00#, 16#05#, 16#00#, 16#00#, 16#00#, 16#00#} the second entry is for UART1
UBX_TX_CFG_MSG_RATE1_05HZ : constant := 10;
-- TX CFG-TMODE3 message contents
UBX_TX_CFG_TMODE3_FLAGS : constant := 1 ;--*< start survey-in
UBX_TX_CFG_TMODE3_SVINMINDUR : constant := (2*60) ;--*< survey-in: minimum duration [s] (higher:=higher precision)
UBX_TX_CFG_TMODE3_SVINACCLIMIT : constant := 10_000 ;--*< survey-in: position accuracy limit 0.1[mm]
-- RTCM3
RTCM3_PREAMBLE : constant := 16#D3#;
RTCM_BUFFER_LENGTH : constant := 110 ;--*< maximum message length of an RTCM message
subtype Header_Index_Type is Natural range 1 .. 6;
HEADER_SYNC_CHAR_1 : Header_Index_Type := 1;
HEADER_SYNC_CHAR_2 : Header_Index_Type := 2;
HEADER_MSG_CLASS : Header_Index_Type := 3;
HEADER_MSG_ID : Header_Index_Type := 4;
HEADER_LENGTH : Header_Index_Type := 5;
subtype UBX_Header_Array is Byte_Array(Header_Index_Type);
subtype Checksum_Index_Type is Natural range 1 .. 2;
CK_A : constant Checksum_Index_Type := 1;
CK_B : constant Checksum_Index_Type := 2;
subtype UBX_Checksum_Array is Byte_Array(Checksum_Index_Type);
-- type rtcm_message_t is
-- record
-- Unsigned_8 buffer(RTCM_BUFFER_LENGTH);
-- pos : Unsigned_16; --/< next position in buffer
-- message_length : Unsigned_16; --/< message length without header and CRC (both 3 bytes)
-- end record;
--
-- -- General: Header
-- type ubx_header_t is record
-- sync1 : Unsigned_8;
-- sync2 : Unsigned_8;
-- msg : Unsigned_16;
-- length : Unsigned_16;
-- end record;
--
--
--
--
-- -- General: Checksum
-- type ubx_checksum_t is record
-- ck_a : Unsigned_8;
-- ck_b : Unsigned_8;
-- end record;
--
-- -- Rx NAV-POSLLH
-- type ubx_payload_rx_nav_posllh_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- lon : Integer_32; --*< Longitude [1e-7 deg]
-- lat : Integer_32; --*< Latitude [1e-7 deg]
-- height : Integer_32; --*< Height above ellipsoid [mm]
-- hMSL : Integer_32; --*< Height above mean sea level [mm]
-- hAcc : Unsigned_32; --*< Horizontal accuracy estimate [mm]
-- vAcc : Unsigned_32; --*< Vertical accuracy estimate [mm]
-- end record;
--
-- -- Rx NAV-DOP
-- type ubx_payload_rx_nav_dop_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- gDOP : Unsigned_16; --*< Geometric DOP [0.01]
-- pDOP : Unsigned_16; --*< Position DOP [0.01]
-- tDOP : Unsigned_16; --*< Time DOP [0.01]
-- vDOP : Unsigned_16; --*< Vertical DOP [0.01]
-- hDOP : Unsigned_16; --*< Horizontal DOP [0.01]
-- nDOP : Unsigned_16; --*< Northing DOP [0.01]
-- eDOP : Unsigned_16; --*< Easting DOP [0.01]
-- end record;
--
-- -- Rx NAV-SOL
-- type ubx_payload_rx_nav_sol_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- fTOW : Integer_32; --*< Fractional part of iTOW (range: +/500_000) [ns]
-- week : Integer_16; --*< GPS week
-- gpsFix : Unsigned_8; --*< GPSfix type: 0 := No fix, 1 := Dead Reckoning only, 2 := 2D fix, 3 := 3d-fix, 4 := GPS + dead reckoning, 5 := time only fix
-- flags : Unsigned_8;
-- ecefX : Integer_32;
-- ecefY : Integer_32;
-- ecefZ : Integer_32;
-- pAcc : Unsigned_32;
-- ecefVX : Integer_32;
-- ecefVY : Integer_32;
-- ecefVZ : Integer_32;
-- sAcc : Unsigned_32;
-- pDOP : Unsigned_16; --*< Position DOP [0.01]
-- reserved1 : Unsigned_8;
-- numSV : Unsigned_8; --*< Number of SVs used in Nav Solution
-- reserved2 : Unsigned_32;
-- end record;
--
-- -- Rx NAV-PVT (ubx8)
-- type ubx_payload_rx_nav_pvt_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- year : Unsigned_16; --*< Year (UTC)
-- month : Unsigned_8; --*< Month, range 1..12 (UTC)
-- day : Unsigned_8; --*< Day of month, range 1..31 (UTC)
-- hour : Unsigned_8; --*< Hour of day, range 0..23 (UTC)
-- min : Unsigned_8; --*< Minute of hour, range 0..59 (UTC)
-- sec : Unsigned_8; --*< Seconds of minute, range 0..60 (UTC)
-- valid : Unsigned_8; --*< Validity flags (see UBX_RX_NAV_PVT_VALID...)
-- tAcc : Unsigned_32; --*< Time accuracy estimate (UTC) [ns]
-- nano : Integer_32; --*< Fraction of second (UTC) [-1e9...1e9 ns]
-- fixType : Unsigned_8; --*< GNSSfix type: 0 := No fix, 1 := Dead Reckoning only, 2 := 2D fix, 3 := 3d-fix, 4 := GNSS + dead reckoning, 5 := time only fix
-- flags : Unsigned_8; --*< Fix Status Flags (see UBX_RX_NAV_PVT_FLAGS...)
-- reserved1 : Unsigned_8;
-- numSV : Unsigned_8; --*< Number of SVs used in Nav Solution
-- lon : Integer_32; --*< Longitude [1e-7 deg]
-- lat : Integer_32; --*< Latitude [1e-7 deg]
-- height : Integer_32; --*< Height above ellipsoid [mm]
-- hMSL : Integer_32; --*< Height above mean sea level [mm]
-- hAcc : Unsigned_32; --*< Horizontal accuracy estimate [mm]
-- vAcc : Unsigned_32; --*< Vertical accuracy estimate [mm]
-- velN : Integer_32; --*< NED north velocity [mm/s]
-- velE : Integer_32; --*< NED east velocity [mm/s]
-- velD : Integer_32; --*< NED down velocity [mm/s]
-- gSpeed : Integer_32; --*< Ground Speed (2-D) [mm/s]
-- headMot : Integer_32; --*< Heading of motion (2-D) [1e-5 deg]
-- sAcc : Unsigned_32; --*< Speed accuracy estimate [mm/s]
-- headAcc : Unsigned_32; --*< Heading accuracy estimate (motion and vehicle) [1e-5 deg]
-- pDOP : Unsigned_16; --*< Position DOP [0.01]
-- reserved2 : Unsigned_16;
-- reserved3 : Unsigned_32;
-- headVeh : Integer_32; --*< (ubx8+ only) Heading of vehicle (2-D) [1e-5 deg]
-- reserved4 : Unsigned_32; --*< (ubx8+ only)
-- end record;
-- UBX_PAYLOAD_RX_NAV_PVT_SIZE_UBX7 : constant := (sizeof(ubx_payload_rx_nav_pvt_t) - 8);
-- UBX_PAYLOAD_RX_NAV_PVT_SIZE_UBX8 : constant := (sizeof(ubx_payload_rx_nav_pvt_t));
--
-- -- Rx NAV-TIMEUTC
-- type ubx_payload_rx_nav_timeutc_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- tAcc : Unsigned_32; --*< Time accuracy estimate (UTC) [ns]
-- nano : Integer_32; --*< Fraction of second, range -1e9 .. 1e9 (UTC) [ns]
-- year : Unsigned_16; --*< Year, range1_999..2099 (UTC)
-- month : Unsigned_8; --*< Month, range 1..12 (UTC)
-- day : Unsigned_8; --*< Day of month, range 1..31 (UTC)
-- hour : Unsigned_8; --*< Hour of day, range 0..23 (UTC)
-- min : Unsigned_8; --*< Minute of hour, range 0..59 (UTC)
-- sec : Unsigned_8; --*< Seconds of minute, range 0..60 (UTC)
-- valid : Unsigned_8; --*< Validity Flags (see UBX_RX_NAV_TIMEUTC_VALID...)
-- end record;
--
-- -- Rx NAV-SVINFO Part 1
-- type ubx_payload_rx_nav_svinfo_part1_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- numCh : Unsigned_8; --*< Number of channels
-- globalFlags : Unsigned_8;
-- reserved2 : Unsigned_16;
-- end record;
--
-- -- Rx NAV-SVINFO Part 2 (repeated)
-- type ubx_payload_rx_nav_svinfo_part2_t is record
-- chn : Unsigned_8; --*< Channel number, 255 for SVs not assigned to a channel
-- svid : Unsigned_8; --*< Satellite ID
-- flags : Unsigned_8;
-- quality : Unsigned_8;
-- Unsigned_8 cno; --*< Carrier to Noise Ratio (Strength : Signal) [dbHz]
-- elev : Integer_8; --*< Elevation [deg]
-- azim : Integer_16; --*< Azimuth [deg]
-- prRes : Integer_32; --*< Pseudo range residual [cm]
-- end record;
--
-- -- Rx NAV-SVIN (survey-in info)
-- type ubx_payload_rx_nav_svin_t is record
-- version : Unsigned_8;
-- Unsigned_8 reserved1(3);
-- iTOW : Unsigned_32;
-- dur : Unsigned_32;
-- meanX : Integer_32;
-- meanY : Integer_32;
-- meanZ : Integer_32;
-- meanXHP : Integer_8;
-- meanYHP : Integer_8;
-- meanZHP : Integer_8;
-- reserved2 : Integer_8;
-- meanAcc : Unsigned_32;
-- obs : Unsigned_32;
-- valid : Unsigned_8;
-- active : Unsigned_8;
-- Unsigned_8 reserved3(2);
-- end record;
--
-- -- Rx NAV-VELNED
-- type ubx_payload_rx_nav_velned_t is record
-- iTOW : Unsigned_32; --*< GPS Time of Week [ms]
-- velN : Integer_32; --*< North velocity component [cm/s]
-- velE : Integer_32; --*< East velocity component [cm/s]
-- velD : Integer_32; --*< Down velocity component [cm/s]
-- speed : Unsigned_32; --*< Speed (3-D) [cm/s]
-- gSpeed : Unsigned_32; --*< Ground speed (2-D) [cm/s]
-- heading : Integer_32; --*< Heading of motion 2-D [1e-5 deg]
-- sAcc : Unsigned_32; --*< Speed accuracy estimate [cm/s]
-- cAcc : Unsigned_32; --*< Course / Heading accuracy estimate [1e-5 deg]
-- end record;
--
-- -- Rx MON-HW (ubx6)
-- type ubx_payload_rx_mon_hw_ubx6_t is record
-- pinSel : Unsigned_32;
-- pinBank : Unsigned_32;
-- pinDir : Unsigned_32;
-- pinVal : Unsigned_32;
-- noisePerMS : Unsigned_16;
-- agcCnt : Unsigned_16;
-- aStatus : Unsigned_8;
-- aPower : Unsigned_8;
-- flags : Unsigned_8;
-- reserved1 : Unsigned_8;
-- usedMask : Unsigned_32;
-- Unsigned_8 VP(25);
-- jamInd : Unsigned_8;
-- reserved3 : Unsigned_16;
-- pinIrq : Unsigned_32;
-- pullH : Unsigned_32;
-- pullL : Unsigned_32;
-- end record;
--
-- -- Rx MON-HW (ubx7+)
-- type ubx_payload_rx_mon_hw_ubx7_t is record
-- pinSel : Unsigned_32;
-- pinBank : Unsigned_32;
-- pinDir : Unsigned_32;
-- pinVal : Unsigned_32;
-- noisePerMS : Unsigned_16;
-- agcCnt : Unsigned_16;
-- aStatus : Unsigned_8;
-- aPower : Unsigned_8;
-- flags : Unsigned_8;
-- reserved1 : Unsigned_8;
-- usedMask : Unsigned_32;
-- Unsigned_8 VP(17);
-- jamInd : Unsigned_8;
-- reserved3 : Unsigned_16;
-- pinIrq : Unsigned_32;
-- pullH : Unsigned_32;
-- pullL : Unsigned_32;
-- end record;
--
-- -- Rx MON-VER Part 1
-- type ubx_payload_rx_mon_ver_part1_t is record
-- Unsigned_8 swVersion(30);
-- Unsigned_8 hwVersion(10);
-- end record;
--
-- -- Rx MON-VER Part 2 (repeated)
-- type ubx_payload_rx_mon_ver_part2_t is record
-- Unsigned_8 extension(30);
-- end record;
--
-- -- Rx ACK-ACK
-- typedef union {
-- msg : Unsigned_16;
-- type is
-- record
-- clsID : Unsigned_8;
-- msgID : Unsigned_8;
-- end record;
-- } ubx_payload_rx_ack_ack_t;
--
-- -- Rx ACK-NAK
-- typedef union {
-- msg : Unsigned_16;
-- type is
-- record
-- clsID : Unsigned_8;
-- msgID : Unsigned_8;
-- end record;
-- } ubx_payload_rx_ack_nak_t;
--
-- -- Tx CFG-PRT
-- type is
-- record
-- portID : Unsigned_8;
-- reserved0 : Unsigned_8;
-- txReady : Unsigned_16;
-- mode : Unsigned_32;
-- baudRate : Unsigned_32;
-- inProtoMask : Unsigned_16;
-- outProtoMask : Unsigned_16;
-- flags : Unsigned_16;
-- reserved5 : Unsigned_16;
-- end record ubx_payload_tx_cfg_prt_t;
--
-- -- Tx CFG-RATE
-- type is
-- record
-- measRate : Unsigned_16; --*< Measurement Rate, GPS measurements are taken every measRate milliseconds
-- navRate : Unsigned_16; --*< Navigation Rate, in number of measurement cycles. This parameter cannot be changed, and must be set to 1
-- timeRef : Unsigned_16; --*< Alignment to reference time: 0 := UTC time, 1 := GPS time
-- end record ubx_payload_tx_cfg_rate_t;
--
-- -- Tx CFG-NAV5
-- type is
-- record
-- mask : Unsigned_16;
-- dynModel : Unsigned_8; --*< Dynamic Platform model: 0 Portable, 2 Stationary, 3 Pedestrian, 4 Automotive, 5 Sea, 6 Airborne <1g, 7 Airborne <2g, 8 Airborne <4g
-- fixMode : Unsigned_8; --*< Position Fixing Mode: 1 2D only, 2 3D only, 3 Auto 2D/3D
-- fixedAlt : Integer_32;
-- fixedAltVar : Unsigned_32;
-- minElev : Integer_8;
-- drLimit : Unsigned_8;
-- pDop : Unsigned_16;
-- tDop : Unsigned_16;
-- pAcc : Unsigned_16;
-- tAcc : Unsigned_16;
-- staticHoldThresh : Unsigned_8;
-- dgpsTimeOut : Unsigned_8;
-- cnoThreshNumSVs : Unsigned_8; --*< (ubx7+ only,else0)
-- cnoThresh : Unsigned_8; --*< (ubx7+ only,else0)
-- reserved : Unsigned_16;
-- staticHoldMaxDist : Unsigned_16; --*< (ubx8+ only,else0)
-- utcStandard : Unsigned_8; --*< (ubx8+ only,else0)
-- reserved3 : Unsigned_8;
-- reserved4 : Unsigned_32;
-- end record ubx_payload_tx_cfg_nav5_t;
--
-- -- tx cfg-sbas
-- type is
-- record
-- mode : Unsigned_8;
-- usage : Unsigned_8;
-- maxSBAS : Unsigned_8;
-- scanmode2 : Unsigned_8;
-- scanmode1 : Unsigned_32;
-- end record ubx_payload_tx_cfg_sbas_t;
--
-- -- Tx CFG-MSG
-- struct {
-- union {
-- msg : Unsigned_16;
-- type is
-- record
-- msgClass : Unsigned_8;
-- msgID : Unsigned_8;
-- end record;
-- };
-- rate : Unsigned_8;
-- } ubx_payload_tx_cfg_msg_t;
--
-- -- CFG-TMODE3 ublox 8 (protocol version >= 20)
-- type is
-- record
-- version : Unsigned_8;
-- reserved1 : Unsigned_8;
-- flags : Unsigned_16;
-- ecefXOrLat : Integer_32;
-- ecefYOrLon : Integer_32;
-- ecefZOrAlt : Integer_32;
-- ecefXOrLatHP : Integer_8;
-- ecefYOrLonHP : Integer_8;
-- ecefZOrAltHP : Integer_8;
-- reserved2 : Unsigned_8;
-- fixedPosAcc : Unsigned_32;
-- svinMinDur : Unsigned_32;
-- svinAccLimit : Unsigned_32;
-- Unsigned_8 reserved3(8);
-- end record ubx_payload_tx_cfg_tmode3_t;
--
-- -- General message and payload buffer union
-- union {
-- payload_rx_nav_pvt : ubx_payload_rx_nav_pvt_t;
-- payload_rx_nav_posllh : ubx_payload_rx_nav_posllh_t;
-- payload_rx_nav_sol : ubx_payload_rx_nav_sol_t;
-- payload_rx_nav_dop : ubx_payload_rx_nav_dop_t;
-- payload_rx_nav_timeutc : ubx_payload_rx_nav_timeutc_t;
-- payload_rx_nav_svinfo_part1 : ubx_payload_rx_nav_svinfo_part1_t;
-- payload_rx_nav_svinfo_part2 : ubx_payload_rx_nav_svinfo_part2_t;
-- payload_rx_nav_svin : ubx_payload_rx_nav_svin_t;
-- payload_rx_nav_velned : ubx_payload_rx_nav_velned_t;
-- payload_rx_mon_hw_ubx6 : ubx_payload_rx_mon_hw_ubx6_t;
-- payload_rx_mon_hw_ubx7 : ubx_payload_rx_mon_hw_ubx7_t;
-- payload_rx_mon_ver_part1 : ubx_payload_rx_mon_ver_part1_t;
-- payload_rx_mon_ver_part2 : ubx_payload_rx_mon_ver_part2_t;
-- payload_rx_ack_ack : ubx_payload_rx_ack_ack_t;
-- payload_rx_ack_nak : ubx_payload_rx_ack_nak_t;
-- payload_tx_cfg_prt : ubx_payload_tx_cfg_prt_t;
-- payload_tx_cfg_rate : ubx_payload_tx_cfg_rate_t;
-- payload_tx_cfg_nav5 : ubx_payload_tx_cfg_nav5_t;
-- payload_tx_cfg_sbas : ubx_payload_tx_cfg_sbas_t;
-- payload_tx_cfg_msg : ubx_payload_tx_cfg_msg_t;
-- payload_tx_cfg_tmode3 : ubx_payload_tx_cfg_tmode3_t;
-- } ubxbuf_t;
--
-- #pragma pack(pop)
-- --** END OF u-blox protocol binary message and payload definitions **
--
-- -- Decoder state
-- enum {
-- UBX_DECODE_SYNC1 := 0,
-- UBX_DECODE_SYNC2,
-- UBX_DECODE_CLASS,
-- UBX_DECODE_ID,
-- UBX_DECODE_LENGTH1,
-- UBX_DECODE_LENGTH2,
-- UBX_DECODE_PAYLOAD,
-- UBX_DECODE_CHKSUM1,
-- UBX_DECODE_CHKSUM2,
--
-- UBX_DECODE_RTCM3
-- } ubxdecode_state_t;
--
-- -- Rx message state
-- enum {
-- UBX_RXMSG_IGNORE := 0,
-- UBX_RXMSG_HANDLE,
-- UBX_RXMSG_DISABLE,
-- UBX_RXMSG_ERROR_LENGTH
-- } ubx_rxmsg_state_t;
--
-- -- ACK state
-- enum {
-- UBX_ACK_IDLE := 0,
-- UBX_ACK_WAITING,
-- UBX_ACK_GOT_ACK,
-- UBX_ACK_GOT_NAK
-- } ubxack_state_t;
--
--
-- class GPSDriverUBX : public GPSHelper
-- {
-- <<public>>
-- GPSDriverUBX(callback : GPSCallbackPtr, void *callback_user, struct vehiclegps_position_s *gps_position,
-- struct satellite_info_s *satellite_info);
-- virtual not GPSDriverUBX;
-- function receive(timeout : unsigned) return Integer;
-- function configure(unsigned &baudrate; output_mode : OutputMode) return Integer;
--
-- function restartSurveyIn return Integer;
-- <<private>>
--
-- --*
-- -- Parse the binary UBX packet
-- --
-- function parseChar(b : in Unsigned_8) return Integer;
--
-- --*
-- -- Start payload rx
-- --
-- function payloadRxInit return Integer;
--
-- --*
-- -- Add payload rx byte
-- --
-- function payloadRxAdd(b : in Unsigned_8) return Integer;
-- function payloadRxAddNavSvinfo(b : in Unsigned_8) return Integer;
-- function payloadRxAddMonVer(b : in Unsigned_8) return Integer;
--
-- --*
-- -- Finish payload rx
-- --
-- function payloadRxDone return Integer;
--
-- --*
-- -- Reset the parse state machine for a fresh start
-- --
-- procedure decodeInit;
--
-- --*
-- -- While parsing add every byte (except the sync bytes) to the checksum
-- --
-- procedure addByteToChecksum(const Unsigned_8);
--
-- --*
-- -- Send a message
-- -- @return true on success, false on write error (set : errno)
-- --
-- function sendMessage(msg : in Unsigned_16; const Unsigned_8 *payload; length : in Unsigned_16) return Boolean;
--
-- --*
-- -- Configure message rate
-- -- @return true on success, false on write error
-- --
-- function configureMessageRate(msg : in Unsigned_16; rate : in Unsigned_8) return Boolean;
--
-- --*
-- -- Calculate and add checksum for given buffer
-- --
-- procedure calcChecksum(const Unsigned_8 *buffer; length : in Unsigned_16; ubx_checksum_t *checksum);
--
-- --*
-- -- Wait for message acknowledge
-- --
-- function waitForAck(msg : in Unsigned_16; timeout : in unsigned; report : in Boolean) return Integer;
--
-- --*
-- -- combines the configure_message_rate and wait_for_ack calls
-- -- @return true on success
-- --
-- inline Boolean configureMessageRateAndAck(msg : Unsigned_16, rate : Unsigned_8, Boolean report_ack_error := false);
--
-- --*
-- -- Calculate FNV1 hash
-- --
-- function fnv1_32_str(Unsigned_8 *str; hval : Unsigned_32) return Unsigned_32;
--
-- struct vehiclegps_position_s *gps_position;
-- struct satellite_info_s *satellite_info;
-- configured : Boolean;
-- ack_state : ubxack_state_t;
-- got_posllh : Boolean;
-- got_velned : Boolean;
-- decode_state : ubxdecode_state_t;
-- rx_msg : Unsigned_16;
-- rx_state : ubx_rxmsg_state_t;
-- rx_payload_length : Unsigned_16;
-- rx_payload_index : Unsigned_16;
-- rx_ck_a : Unsigned_8;
-- rx_ck_b : Unsigned_8;
-- disable_cmd_last : gps_abstime;
-- ack_waiting_msg : Unsigned_16;
-- buf : ubxbuf_t;
-- ubx_version : Unsigned_32;
-- use_nav_pvt : Boolean;
-- output_mode : OutputMode := OutputMode::GPS;
--
-- rtcm_message_t *rtcm_message := nullptr;
-- };
end ublox8.Protocol;
|
prototype/command-response/Sodium.agda | stevana/haarss | 1 | 721 | module Sodium where
open import Category.Functor
open import Category.Applicative
open import Category.Monad
open import Data.Unit
open import Data.Bool
open import Data.Maybe
open import Data.Product
open import IO.Primitive
postulate
-- Core.
Reactive : Set → Set
sync : ∀ {A} → Reactive A → IO A
Event : Set → Set
Behaviour : Set → Set
listen : ∀ {A} → Event A → (A → IO ⊤) → Reactive (IO ⊤)
filterJust : ∀ {A} → Event (Maybe A) → Event A
hold : ∀ {A} → A → Event A → Reactive (Behaviour A)
updates value : ∀ {A} → Behaviour A → Event A
snapshot : ∀ {A B C} → (A → B → C) → Event A → Behaviour B → Event C
-- Derived.
gate : ∀ {A} → Event A → Behaviour Bool → Event A
filterE : ∀ {A} → (A → Bool) → Event A → Event A
collectE : ∀ {A B} {S : Set} → (A → S → (B × S)) → S →
Event A → Reactive (Event B)
collect : ∀ {A B} {S : Set} → (A → S → (B × S)) → S →
Behaviour A → Reactive (Behaviour B)
accum : ∀ {A} → A → Event (A → A) → Reactive (Behaviour A)
-- IO.
executeSyncIO executeAsyncIO : ∀ {A} → Event (IO A) → Event A
-- Instances.
reactiveMonad : RawMonad Reactive
behaviourApplicative : RawApplicative Behaviour
eventFunctor : RawFunctor Event
|
src/btt_channel_four.asm | Gegel85/BTTGB | 1 | 95033 | <filename>src/btt_channel_four.asm
;channel 4
bttIntroFour::
db $00, $00, $00, $C0, QUAVER * 2 ; NO SOUND
db $00, $00, $00, $C0, $FF ; NO SOUND
bttChannelFour::
;mesure 1
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 2
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 3
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 4
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $67, $07, $C0, QUAVER * 2 ; Tsssssss
;mesure 5
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 6
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 7
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 8
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 9
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 10
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 11
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 12
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 13
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $84, $7F, $C0, QUAVER / 2 ; KICK
db $00, $84, $7F, $C0, QUAVER / 2 ; KICK
db $00, $00, $00, $C0, QUAVER / 2 ; NO SOUND
db $00, $84, $7F, $C0, QUAVER / 2 ; KICK
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $00, $00, $C0, QUAVER / 2 ; NO SOUND
db $00, $82, $60, $C0, QUAVER / 2 ; Snare
db $00, $00, $00, $C0, QUAVER / 2 ; NO SOUND
;mesure 14
db $00, $67, $07, $C0, QUAVER ; Tsssssss
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 15
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 16
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 17
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $82, $60, $C0, QUAVER ; Snare
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 18
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 19
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 20
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
;mesure 21
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $C1, $7F, $C0, QUAVER ; KICK
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, QUAVER ; NO SOUND
db $00, $64, $02, $C0, QUAVER ; HiHat
db $00, $00, $00, $C0, $FF ; NO SOUND
|
source/nodes/program-nodes-discrete_simple_expression_ranges.ads | optikos/oasis | 0 | 21264 | <gh_stars>0
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Elements.Expressions;
with Program.Lexical_Elements;
with Program.Elements.Discrete_Simple_Expression_Ranges;
with Program.Element_Visitors;
package Program.Nodes.Discrete_Simple_Expression_Ranges is
pragma Preelaborate;
type Discrete_Simple_Expression_Range is
new Program.Nodes.Node
and Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range
and Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Text
with private;
function Create
(Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access;
Is_Discrete_Subtype_Definition : Boolean := False)
return Discrete_Simple_Expression_Range;
type Implicit_Discrete_Simple_Expression_Range is
new Program.Nodes.Node
and Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range
with private;
function Create
(Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False;
Is_Discrete_Subtype_Definition : Boolean := False)
return Implicit_Discrete_Simple_Expression_Range
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Discrete_Simple_Expression_Range is
abstract new Program.Nodes.Node
and Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range
with record
Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access;
Is_Discrete_Subtype_Definition : Boolean;
end record;
procedure Initialize
(Self : aliased in out Base_Discrete_Simple_Expression_Range'Class);
overriding procedure Visit
(Self : not null access Base_Discrete_Simple_Expression_Range;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Lower_Bound
(Self : Base_Discrete_Simple_Expression_Range)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Upper_Bound
(Self : Base_Discrete_Simple_Expression_Range)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Is_Discrete_Subtype_Definition
(Self : Base_Discrete_Simple_Expression_Range)
return Boolean;
overriding function Is_Discrete_Simple_Expression_Range_Element
(Self : Base_Discrete_Simple_Expression_Range)
return Boolean;
overriding function Is_Discrete_Range_Element
(Self : Base_Discrete_Simple_Expression_Range)
return Boolean;
overriding function Is_Definition_Element
(Self : Base_Discrete_Simple_Expression_Range)
return Boolean;
type Discrete_Simple_Expression_Range is
new Base_Discrete_Simple_Expression_Range
and Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Text
with record
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Discrete_Simple_Expression_Range_Text
(Self : aliased in out Discrete_Simple_Expression_Range)
return Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Text_Access;
overriding function Double_Dot_Token
(Self : Discrete_Simple_Expression_Range)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Discrete_Simple_Expression_Range is
new Base_Discrete_Simple_Expression_Range
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Discrete_Simple_Expression_Range_Text
(Self : aliased in out Implicit_Discrete_Simple_Expression_Range)
return Program.Elements.Discrete_Simple_Expression_Ranges
.Discrete_Simple_Expression_Range_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Discrete_Simple_Expression_Range)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Discrete_Simple_Expression_Range)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Discrete_Simple_Expression_Range)
return Boolean;
end Program.Nodes.Discrete_Simple_Expression_Ranges;
|
maybe-thms.agda | rfindler/ial | 29 | 4367 | <reponame>rfindler/ial
module maybe-thms where
open import eq
open import level
open import maybe
open import product
open import sum
maybe-dec : ∀ {ℓ}{A : Set ℓ}(x : maybe A) → x ≡ nothing ∨ Σ A (λ a → x ≡ just a)
maybe-dec nothing = inj₁ refl
maybe-dec (just a) = inj₂ (a , refl) |
mkbiosimg/bootsecs/boot32.asm | zylon-internet/BooterMicro | 18 | 95900 | <reponame>zylon-internet/BooterMicro
; +--------+
; | |
; | |
; |--------| 4000:0000
; | |
; | FAT |
; | |
; |--------| 2000:0000
; |BOOT SEC|
; |RELOCATE|
; |--------| 1FE0:0000
; | |
; | |
; | |
; | |
; |--------|
; |BOOT SEC|
; |ORIGIN | 07C0:0000
; |--------|
; | |
; | |
; | |
; |--------|
; |KERNEL |
; |LOADED |
; |--------| 0060:0000
; | |
; +--------+
;%define MULTI_SEC_READ 1
segment .text
%define BASE 0x7c00
org BASE
Entry: jmp short real_start
nop
; bp is initialized to 7c00h
%define bsOemName bp+0x03 ; OEM label
%define bsBytesPerSec bp+0x0b ; bytes/sector
%define bsSecPerClust bp+0x0d ; sectors/allocation unit
%define bsResSectors bp+0x0e ; # reserved sectors
%define bsFATs bp+0x10 ; # of fats
%define bsRootDirEnts bp+0x11 ; # of root dir entries
%define bsSectors bp+0x13 ; # sectors total in image
%define bsMedia bp+0x15 ; media descrip: fd=2side9sec, etc...
%define sectPerFat bp+0x16 ; # sectors in a fat
%define sectPerTrack bp+0x18 ; # sectors/track
%define nHeads bp+0x1a ; # heads
%define nHidden bp+0x1c ; # hidden sectors
%define nSectorHuge bp+0x20 ; # sectors if > 65536
%define xsectPerFat bp+0x24 ; Sectors/Fat
%define xrootClst bp+0x2c ; Starting cluster of root directory
%define drive bp+0x40 ; Drive number
times 0x5a-$+$$ db 0
%define LOADSEG 0x0060
%define FATSEG 0x2000
%define fat_sector bp+0x48 ; last accessed sector of the FAT
%define loadsegoff_60 bp+loadseg_off-Entry ; FAR pointer = 60:0
%define loadseg_60 bp+loadseg_seg-Entry
%define fat_start bp+0x5e ; first FAT sector
%define data_start bp+0x62 ; first data sector
%define fat_secmask bp+0x66 ; number of clusters in a FAT sector - 1
%define fat_secshift bp+0x68 ; fat_secmask+1 = 2^fat_secshift
;-----------------------------------------------------------------------
; ENTRY
;-----------------------------------------------------------------------
real_start: cld
cli
sub ax, ax
mov ds, ax
mov bp, 0x7c00
mov ax, 0x1FE0
mov es, ax
mov si, bp
mov di, bp
mov cx, 0x0100
rep movsw ; move boot code to the 0x1FE0:0x0000
jmp word 0x1FE0:cont
loadseg_off dw 0
loadseg_seg dw LOADSEG
cont: mov ds, ax
mov ss, ax
lea sp, [bp-0x20]
sti
mov [drive], dl ; BIOS passes drive number in DL
; call print
; db "Loading ",0
; Calc Params
; Fat_Start
mov si, word [nHidden]
mov di, word [nHidden+2]
add si, word [bsResSectors]
adc di, byte 0
mov word [fat_start], si
mov word [fat_start+2], di
; Data_Start
mov al, [bsFATs]
cbw
push ax
mul word [xsectPerFat+2]
add di, ax
pop ax
mul word [xsectPerFat]
add ax, si
adc dx, di
mov word[data_start], ax
mov word[data_start+2], dx
; fat_secmask
mov ax, word[bsBytesPerSec]
shr ax, 1
shr ax, 1
dec ax
mov word [fat_secmask], ax
; fat_secshift
; cx = temp
; ax = fat_secshift
xchg ax, cx ; cx = 0 after movsw
inc cx
secshift: inc ax
shr cx, 1
cmp cx, 1
jne secshift
mov byte [fat_secshift], al
dec cx
; FINDFILE: Searches for the file in the root directory.
;
; Returns:
; DX:AX = first cluster of file
mov word [fat_sector], cx ; CX is 0 after "dec"
mov word [fat_sector + 2], cx
mov ax, word [xrootClst]
mov dx, word [xrootClst + 2]
ff_next_cluster:
push dx ; save cluster
push ax
call convert_cluster
jc boot_error ; EOC encountered
ff_next_sector:
push bx ; save sector count
les bx, [loadsegoff_60]
call readDisk
push dx ; save sector
push ax
mov ax, [bsBytesPerSec]
; Search for KERNEL.SYS file name, and find start cluster.
ff_next_entry: mov cx, 11
mov si, filename
mov di, ax
sub di, 0x20
repe cmpsb
jz ff_done
sub ax, 0x20
jnz ff_next_entry
pop ax ; restore sector
pop dx
pop bx ; restore sector count
dec bx
jnz ff_next_sector
ff_find_next_cluster:
pop ax ; restore current cluster
pop dx
call next_cluster
jmp short ff_next_cluster
ff_done:
mov ax, [es:di+0x1A-11] ; get cluster number
mov dx, [es:di+0x14-11]
c4:
sub bx, bx ; ES points to LOADSEG
c5: push dx
push ax
push bx
call convert_cluster
jc boot_success
mov di, bx
pop bx
c6:
call readDisk
dec di
jnz c6
pop ax
pop dx
call next_cluster
jmp short c5
boot_error:
xor ah,ah
int 0x16 ; wait for a key
int 0x19 ; reboot the machine
; input:
; DX:AX - cluster
; output:
; DX:AX - next cluster
; CX = 0
; modify:
; DI
next_cluster:
push es
mov di, ax
and di, [fat_secmask]
mov cx, [fat_secshift]
cn_loop:
shr dx,1
rcr ax,1
dec cx
jnz cn_loop ; DX:AX fat sector where our
; cluster resides
; DI - cluster index in this
; sector
shl di,1 ; DI - offset in the sector
shl di,1
add ax, [fat_start]
adc dx, [fat_start+2] ; DX:AX absolute fat sector
push bx
mov bx, FATSEG
mov es, bx
sub bx, bx
cmp ax, [fat_sector]
jne cn1 ; if the last fat sector we
; read was this, than skip
cmp dx,[fat_sector+2]
je cn_exit
cn1:
mov [fat_sector],ax ; save the fat sector number,
mov [fat_sector+2],dx ; we are going to read
call readDisk
cn_exit:
pop bx
mov ax, [es:di] ; DX:AX - next cluster
mov dx, [es:di + 2] ;
pop es
ret
boot_success:
mov bl, [drive]
jmp far [loadsegoff_60]
; Convert cluster to the absolute sector
;input:
; DX:AX - target cluster
;output:
; DX:AX - absoulute sector
; BX - [bsSectPerClust]
;modify:
; CX
convert_cluster:
cmp dx,0x0fff
jne c3
cmp ax,0xfff8
jb c3 ; if cluster is EOC (carry is set), do ret
stc
ret
c3:
mov cx, dx ; sector = (cluster - 2)*clussize +
; + data_start
sub ax, 2
sbb cx, byte 0 ; CX:AX == cluster - 2
mov bl, [bsSecPerClust]
sub bh, bh
xchg cx, ax ; AX:CX == cluster - 2
mul bx ; first handle high word
; DX must be 0 here
xchg ax, cx ; then low word
mul bx
add dx, cx ; DX:AX target sector
add ax, [data_start]
adc dx, [data_start + 2]
ret
; prints text after call to this function.
print_1char:
xor bx, bx ; video page 0
mov ah, 0x0E ; else print it
int 0x10 ; via TTY mode
print: pop si ; this is the first character
print1: lodsb ; get token
push si ; stack up potential return address
cmp al, 0 ; end of string?
jne print_1char ; until done
ret ; and jump to it
;input:
; DX:AX - 32-bit DOS sector number
; ES:BX - destination buffer
;output:
; ES:BX points one byte after the last byte read.
; DX:AX - next sector
;modify:
; ES if DI * bsBytesPerSec >= 65536, CX
readDisk:
read_next: push dx
push ax
;
; translate sector number to BIOS parameters
;
;
; abs = sector offset in track
; + head * sectPerTrack offset in cylinder
; + track * sectPerTrack * nHeads offset in platter
;
xchg ax, cx
mov al, [sectPerTrack]
mul byte [nHeads]
xchg ax, cx
; cx = nHeads * sectPerTrack <= 255*63
; dx:ax = abs
div cx
; ax = track, dx = sector + head * sectPertrack
xchg ax, dx
; dx = track, ax = sector + head * sectPertrack
div byte [sectPerTrack]
; dx = track, al = head, ah = sector
mov cx, dx
; cx = track, al = head, ah = sector
; the following manipulations are necessary in order to
; properly place parameters into registers.
; ch = cylinder number low 8 bits
; cl = 7-6: cylinder high two bits
; 5-0: sector
mov dh, al ; save head into dh for bios
xchg ch, cl ; set cyl no low 8 bits
ror cl, 1 ; move track high bits into
ror cl, 1 ; bits 7-6 (assumes top = 0)
inc ah ; sector offset from 1
or cl, ah ; merge sector into cylinder
mov ax, 0x0201
mov dl, [drive]
int 0x13
pop ax
pop dx
jnc read_ok ; jump if no error
xor ah, ah ; else, reset floppy
int 0x13
jmp short read_next
read_ok:
add bx, word [bsBytesPerSec]
jnc no_incr_es ; if overflow...
mov cx, es
add ch, 0x10 ; ...add 1000h to ES
mov es, cx
no_incr_es:
add ax,byte 1
adc dx,byte 0
ret
times 0x01f1-$+$$ db 0
filename db "KERNEL SYS",0,0
sign dw 0xAA55
|
programs/oeis/095/A095815.asm | karttu/loda | 0 | 96771 | <gh_stars>0
; A095815: n + largest digit of n.
; 2,4,6,8,10,12,14,16,18,11,12,14,16,18,20,22,24,26,28,22,23,24,26,28,30,32,34,36,38,33,34,35,36,38,40,42,44,46,48,44,45,46,47,48,50,52,54,56,58,55,56,57,58,59,60,62,64,66,68,66,67,68,69,70,71,72,74,76,78,77,78,79,80,81,82,83,84,86,88,88,89,90,91,92,93,94,95,96,98,99,100,101,102,103,104,105,106,107,108,101,102,104,106,108,110,112,114,116,118,111,112,114,116,118,120,122,124,126,128,122,123,124,126,128,130,132,134,136,138,133,134,135,136,138,140,142,144,146,148,144,145,146,147,148,150,152,154,156,158,155,156,157,158,159,160,162,164,166,168,166,167,168,169,170,171,172,174,176,178,177,178,179,180,181,182,183,184,186,188,188,189,190,191,192,193,194,195,196,198,199,200,201,202,203,204,205,206,207,208,202,203,204,206,208,210,212,214,216,218,212,213,214,216,218,220,222,224,226,228,222,223,224,226,228,230,232,234,236,238,233,234,235,236,238,240,242,244,246,248,244,245,246,247,248,250,252,254,256,258,255
mov $3,$0
add $0,1
lpb $0,1
mov $2,$0
div $0,10
mod $2,10
trn $1,$2
add $1,$2
lpe
add $1,1
add $1,$3
|
libsrc/_DEVELOPMENT/target/rc2014/driver/ram/c/sdcc/shadow_relocate_fastcall.asm | ahjelm/z88dk | 4 | 12777 | <filename>libsrc/_DEVELOPMENT/target/rc2014/driver/ram/c/sdcc/shadow_relocate_fastcall.asm<gh_stars>1-10
; void shadow_relocate(void * address) __z88dk_fastcall
SECTION smc_lib
PUBLIC _shadow_relocate_fastcall
EXTERN asm_push_di
EXTERN asm_pop_ei_jp
EXTERN asm_shadow_relocate
._shadow_relocate_fastcall
call asm_push_di
call asm_shadow_relocate
jp asm_pop_ei_jp
|
oeis/040/A040955.asm | neoneye/loda-programs | 11 | 244148 | ; A040955: Continued fraction for sqrt(987).
; Submitted by <NAME>
; 31,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2,62,2,2,2
gcd $0,262156
mul $0,42
mod $0,13
mov $1,$0
sub $1,2
div $1,5
mul $1,36
trn $1,$0
mov $0,$1
add $0,2
|
PIM/TD1_Algorithmique/pour_tantque.adb | Hathoute/ENSEEIHT | 1 | 8163 | <reponame>Hathoute/ENSEEIHT<gh_stars>1-10
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Pour_TantQue is
Debut: Integer;
Fin: Integer;
begin
-- Demander les valeurs de Debut et Fin
Get (Debut);
Get (Fin);
-- Afficher les entiers de Début à Fin
while Debut <= Fin loop
Put(Debut);
New_Line;
Debut := Debut + 1;
end loop;
end Pour_TantQue;
|
scripts/SMS/models_20210203/sat_34_20_6_3_3_2.als | eskang/alloy-maxsat-benchmark | 0 | 1448 |
abstract sig Task {
frags: set Frag,
r: Int,
d: Int,
first: Frag,
final: Frag,
deps: set Task
}
sig Completed in Task {}
one sig T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33 extends Task {}
fact {
frags =
T0 -> T0_0 + T0 -> T0_1 +
T1 -> T1_0 +
T2 -> T2_0 +
T3 -> T3_0 +
T4 -> T4_0 +
T5 -> T5_0 +
T6 -> T6_0 + T6 -> T6_1 +
T7 -> T7_0 + T7 -> T7_1 + T7 -> T7_2 +
T8 -> T8_0 + T8 -> T8_1 + T8 -> T8_2 +
T9 -> T9_0 + T9 -> T9_1 +
T10 -> T10_0 +
T11 -> T11_0 + T11 -> T11_1 +
T12 -> T12_0 +
T13 -> T13_0 + T13 -> T13_1 +
T14 -> T14_0 + T14 -> T14_1 +
T15 -> T15_0 +
T16 -> T16_0 +
T17 -> T17_0 +
T18 -> T18_0 + T18 -> T18_1 + T18 -> T18_2 +
T19 -> T19_0 + T19 -> T19_1 +
T20 -> T20_0 +
T21 -> T21_0 +
T22 -> T22_0 + T22 -> T22_1 +
T23 -> T23_0 + T23 -> T23_1 + T23 -> T23_2 +
T24 -> T24_0 + T24 -> T24_1 + T24 -> T24_2 +
T25 -> T25_0 +
T26 -> T26_0 + T26 -> T26_1 + T26 -> T26_2 +
T27 -> T27_0 + T27 -> T27_1 + T27 -> T27_2 +
T28 -> T28_0 +
T29 -> T29_0 +
T30 -> T30_0 +
T31 -> T31_0 + T31 -> T31_1 + T31 -> T31_2 +
T32 -> T32_0 +
T33 -> T33_0 + T33 -> T33_1 + T33 -> T33_2
r = T0 -> 6 + T1 -> 3 + T2 -> 7 + T3 -> 8 + T4 -> 17 + T5 -> 4 + T6 -> 9 + T7 -> 18 + T8 -> 17 + T9 -> 16 + T10 -> 17 + T11 -> 12 + T12 -> 0 + T13 -> 1 + T14 -> 18 + T15 -> 18 + T16 -> 18 + T17 -> 2 + T18 -> 5 + T19 -> 5 + T20 -> 3 + T21 -> 2 + T22 -> 11 + T23 -> 15 + T24 -> 9 + T25 -> 18 + T26 -> 14 + T27 -> 18 + T28 -> 1 + T29 -> 1 + T30 -> 18 + T31 -> 6 + T32 -> 5 + T33 -> 8
d = T0 -> 8 + T1 -> 4 + T2 -> 8 + T3 -> 23 + T4 -> 21 + T5 -> 13 + T6 -> 18 + T7 -> 36 + T8 -> 27 + T9 -> 28 + T10 -> 32 + T11 -> 18 + T12 -> 2 + T13 -> 7 + T14 -> 21 + T15 -> 33 + T16 -> 20 + T17 -> 5 + T18 -> 23 + T19 -> 10 + T20 -> 18 + T21 -> 4 + T22 -> 17 + T23 -> 33 + T24 -> 24 + T25 -> 30 + T26 -> 32 + T27 -> 26 + T28 -> 3 + T29 -> 4 + T30 -> 22 + T31 -> 18 + T32 -> 6 + T33 -> 11
first = T0 -> T0_0 + T1 -> T1_0 + T2 -> T2_0 + T3 -> T3_0 + T4 -> T4_0 + T5 -> T5_0 + T6 -> T6_0 + T7 -> T7_0 + T8 -> T8_0 + T9 -> T9_0 + T10 -> T10_0 + T11 -> T11_0 + T12 -> T12_0 + T13 -> T13_0 + T14 -> T14_0 + T15 -> T15_0 + T16 -> T16_0 + T17 -> T17_0 + T18 -> T18_0 + T19 -> T19_0 + T20 -> T20_0 + T21 -> T21_0 + T22 -> T22_0 + T23 -> T23_0 + T24 -> T24_0 + T25 -> T25_0 + T26 -> T26_0 + T27 -> T27_0 + T28 -> T28_0 + T29 -> T29_0 + T30 -> T30_0 + T31 -> T31_0 + T32 -> T32_0 + T33 -> T33_0
final = T0 -> T0_1 + T1 -> T1_0 + T2 -> T2_0 + T3 -> T3_0 + T4 -> T4_0 + T5 -> T5_0 + T6 -> T6_1 + T7 -> T7_2 + T8 -> T8_2 + T9 -> T9_1 + T10 -> T10_0 + T11 -> T11_1 + T12 -> T12_0 + T13 -> T13_1 + T14 -> T14_1 + T15 -> T15_0 + T16 -> T16_0 + T17 -> T17_0 + T18 -> T18_2 + T19 -> T19_1 + T20 -> T20_0 + T21 -> T21_0 + T22 -> T22_1 + T23 -> T23_2 + T24 -> T24_2 + T25 -> T25_0 + T26 -> T26_2 + T27 -> T27_2 + T28 -> T28_0 + T29 -> T29_0 + T30 -> T30_0 + T31 -> T31_2 + T32 -> T32_0 + T33 -> T33_2
deps =
T8 -> T24 +
T32 -> T13
}
abstract sig Frag {
s: Int,
c: Int,
prev: lone Frag
} {
s < 36
}
one sig T0_0,T0_1 extends Frag {}
one sig T1_0 extends Frag {}
one sig T2_0 extends Frag {}
one sig T3_0 extends Frag {}
one sig T4_0 extends Frag {}
one sig T5_0 extends Frag {}
one sig T6_0,T6_1 extends Frag {}
one sig T7_0,T7_1,T7_2 extends Frag {}
one sig T8_0,T8_1,T8_2 extends Frag {}
one sig T9_0,T9_1 extends Frag {}
one sig T10_0 extends Frag {}
one sig T11_0,T11_1 extends Frag {}
one sig T12_0 extends Frag {}
one sig T13_0,T13_1 extends Frag {}
one sig T14_0,T14_1 extends Frag {}
one sig T15_0 extends Frag {}
one sig T16_0 extends Frag {}
one sig T17_0 extends Frag {}
one sig T18_0,T18_1,T18_2 extends Frag {}
one sig T19_0,T19_1 extends Frag {}
one sig T20_0 extends Frag {}
one sig T21_0 extends Frag {}
one sig T22_0,T22_1 extends Frag {}
one sig T23_0,T23_1,T23_2 extends Frag {}
one sig T24_0,T24_1,T24_2 extends Frag {}
one sig T25_0 extends Frag {}
one sig T26_0,T26_1,T26_2 extends Frag {}
one sig T27_0,T27_1,T27_2 extends Frag {}
one sig T28_0 extends Frag {}
one sig T29_0 extends Frag {}
one sig T30_0 extends Frag {}
one sig T31_0,T31_1,T31_2 extends Frag {}
one sig T32_0 extends Frag {}
one sig T33_0,T33_1,T33_2 extends Frag {}
fact {
c =
T0_0 -> 1 + T0_1 -> 1 +
T1_0 -> 1 +
T2_0 -> 1 +
T3_0 -> 5 +
T4_0 -> 2 +
T5_0 -> 3 +
T6_0 -> 2 + T6_1 -> 1 +
T7_0 -> 3 + T7_1 -> 2 + T7_2 -> 1 +
T8_0 -> 3 + T8_1 -> 1 + T8_2 -> 1 +
T9_0 -> 4 + T9_1 -> 2 +
T10_0 -> 5 +
T11_0 -> 3 + T11_1 -> 3 +
T12_0 -> 1 +
T13_0 -> 1 + T13_1 -> 2 +
T14_0 -> 1 + T14_1 -> 2 +
T15_0 -> 5 +
T16_0 -> 1 +
T17_0 -> 3 +
T18_0 -> 2 + T18_1 -> 3 + T18_2 -> 1 +
T19_0 -> 2 + T19_1 -> 3 +
T20_0 -> 5 +
T21_0 -> 1 +
T22_0 -> 2 + T22_1 -> 4 +
T23_0 -> 3 + T23_1 -> 2 + T23_2 -> 1 +
T24_0 -> 3 + T24_1 -> 1 + T24_2 -> 1 +
T25_0 -> 6 +
T26_0 -> 2 + T26_1 -> 1 + T26_2 -> 3 +
T27_0 -> 1 + T27_1 -> 1 + T27_2 -> 2 +
T28_0 -> 1 +
T29_0 -> 3 +
T30_0 -> 4 +
T31_0 -> 3 + T31_1 -> 1 + T31_2 -> 2 +
T32_0 -> 1 +
T33_0 -> 1 + T33_1 -> 1 + T33_2 -> 1
prev =
T0_1 -> T0_0 +
T6_1 -> T6_0 +
T7_1 -> T7_0 + T7_2 -> T7_1 +
T8_1 -> T8_0 + T8_2 -> T8_1 +
T9_1 -> T9_0 +
T11_1 -> T11_0 +
T13_1 -> T13_0 +
T14_1 -> T14_0 +
T18_1 -> T18_0 + T18_2 -> T18_1 +
T19_1 -> T19_0 +
T22_1 -> T22_0 +
T23_1 -> T23_0 + T23_2 -> T23_1 +
T24_1 -> T24_0 + T24_2 -> T24_1 +
T26_1 -> T26_0 + T26_2 -> T26_1 +
T27_1 -> T27_0 + T27_2 -> T27_1 +
T31_1 -> T31_0 + T31_2 -> T31_1 +
T33_1 -> T33_0 + T33_2 -> T33_1
}
pred StartAfterRelease {
all t: Completed | t.first.s >= t.r
}
pred StartAfterPrevFrag {
all t: Completed, f1, f2: t.frags | f1 -> f2 in prev implies
f1.s >= plus[f2.s, f2.c]
}
pred SingleFrag {
all disj t1, t2: Completed, f1: t1.frags, f2: t2.frags |
f2.s >= plus[f1.s, f1.c] or f1.s >= plus[f2.s, f2.c]
}
pred TaskDep {
all t1: Completed, t2: t1.deps {
t1.first.s >= plus[t2.final.s, t2.final.c]
t2 in Completed
}
}
pred Deadline {
all t: Completed | t.d >= plus[t.final.s, t.final.c]
}
run {
StartAfterRelease
StartAfterPrevFrag
SingleFrag
TaskDep
Deadline
some Completed
} for 7 Int
|
third_party/antlr_grammars_v4/databank/databank.g4 | mikhan808/rsyntaxtextarea-antlr4-extension | 127 | 542 | /*
BSD License
Copyright (c) 2018, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of Tom Everett 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.
*/
/*
* http://archive.li/m3fki#selection-1331.0-1331.26
*/
grammar databank;
databank
: EOL* (datedseries | undatedseries) sample +
;
datedseries
: datatype dateline dateline
;
undatedseries
: dateline dateline
;
datatype
: ('-1' | '-4' | '-12') EOL
;
dateline
: number EOL
;
sample
: (number | 'NA') EOL?
;
number
: FLOATINGPOINT
;
FLOATINGPOINT
: NUMBER (E SIGN? NUMBER)?
;
fragment NUMBER
: ('0' .. '9') + ('.' ('0' .. '9')*)?
;
fragment E
: 'E' | 'e'
;
fragment SIGN
: ('+' | '-')
;
COMMENT
: '"c' ~ ["]* '"' ' '* EOL -> skip
;
EOL
: [\r\n] +
;
WS
: [ \t\r\n] -> skip
;
|
programs/oeis/037/A037236.asm | neoneye/loda | 22 | 179543 | ; A037236: Expansion of (3+2*x^2)/(1-x)^4.
; 3,12,32,68,125,208,322,472,663,900,1188,1532,1937,2408,2950,3568,4267,5052,5928,6900,7973,9152,10442,11848,13375,15028,16812,18732,20793,23000,25358,27872,30547,33388
mov $4,$0
add $0,1
mov $1,$0
mul $0,2
add $4,1
mov $3,$4
lpb $1
sub $1,1
add $2,$3
add $0,$2
add $3,2
lpe
|
4 - array indexado (com tipagem opcional)/TParser.g4 | melchisedech333/antlr4-experiments | 1 | 2539 | <reponame>melchisedech333/antlr4-experiments<filename>4 - array indexado (com tipagem opcional)/TParser.g4<gh_stars>1-10
parser grammar TParser;
options {
tokenVocab = TLexer;
}
@parser::postinclude {
#ifndef _WIN32
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
}
// Gramática.
main
: sentence EOF
;
sentence
: sentence expression
|
;
expression
: VAR variables END
;
variables
: definition
| definition SEPARATOR variables
;
definition
: VARIABLE ATTR value
| VARIABLE TYPE ATTR value
;
array
: ARRAY_OPEN ARRAY_CLOSE
| ARRAY_OPEN elements ARRAY_CLOSE
;
elements
: value
| value TYPE
| value SEPARATOR elements
| value TYPE SEPARATOR elements
;
value
: VARIABLE
| STRING
| INTEGER
| array
;
|
oeis/040/A040700.asm | neoneye/loda-programs | 11 | 171058 | <gh_stars>10-100
; A040700: Continued fraction for sqrt(727).
; Submitted by <NAME>(s1)
; 26,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25,1,52,1,25
gcd $0,262156
mul $0,42
mod $0,13
mov $1,$0
div $1,5
mul $1,21
add $0,$1
sub $0,2
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/valid1.adb | best08618/asylo | 7 | 26983 | <reponame>best08618/asylo
-- { dg-do run }
-- { dg-options "-gnatVi" }
procedure valid1 is
type m is range 0 .. 10;
for m'size use 8;
type r is record
a, b : m;
c, d, e, f : boolean;
end record;
pragma Pack (r);
for R'size use 20;
type G is array (1 .. 3, 1 .. 3) of R;
pragma Pack (G);
procedure h (c : m) is begin null; end;
GG : G := (others => (others => (2, 3, true, true, true, true)));
begin
h (GG (3, 2).a);
end;
|
stdlib-exts/Data/String/Instance.agda | WhatisRT/meta-cedille | 35 | 9555 | module Data.String.Instance where
open import Agda.Builtin.String
open import Class.Equality
open import Class.Monoid
open import Class.Show
open import Data.String renaming (_≟_ to _≟S_)
instance
String-Eq : Eq String
String-Eq = record { _≟_ = _≟S_ }
String-EqB : EqB String
String-EqB = record { _≣_ = primStringEquality }
String-Monoid : Monoid String
String-Monoid = record { mzero = "" ; _+_ = _++_ }
String-Show : Show String
String-Show = record { show = λ x -> x }
|
externals/mpir-3.0.0/mpn/x86_64w/mulmid_basecase.asm | JaminChan/eos_win | 12 | 240077 | ; PROLOGUE(mpn_mulmid_basecase)
;
; AMD64 mpn_mulmid_basecase
;
; Based on mul_basecase.asm from GMP 4.3.1, modifications are copyright
; (C) 2009, <NAME>. The original mul_basecase.asm was released under
; LGPLv3+, license terms reproduced below. These modifications are hereby
; released under the same terms.
;
; Windows Conversion Copyright 2010 Dr <NAME>
;
; Contributed to the GNU project by <NAME> and <NAME>.
;
; Copyright 2008 Free Software Foundation, Inc.
;
; This file is part of the GNU MP Library.
;
; The GNU MP Library is free software; you can redistribute it and/or modify
; it under the terms of the GNU Lesser General Public License as published
; by the Free Software Foundation; either version 3 of the License, or (at
; your option) any later version.
;
; The GNU MP Library is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
; License for more details.
;
; You should have received a copy of the GNU Lesser General Public License
; //www.gnu.org/licenses/.
;
; void mpn_mulmid_basecase(mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t)
; rax rdi rsi rdx rcx r8
; rax rcx rdx r8 r9 [rsp+40]
%define reg_save_list rbx, rsi, rdi, rbp, r12, r13, r14, r15
%include 'yasm_mac.inc'
BITS 64
TEXT
xalign 16
WIN64_GCC_PROC mpn_mulmid_basecase, 5, frame
mov r15, rcx
lea r13, [rdx+1]
sub r13, r8
lea rdi, [rdi+r13*8]
cmp r13, 4
jc .29
lea rsi, [rsi+rdx*8]
test r8, 1
jz .10
.0: mov ebx, r13d
neg r13
mov rax, [rsi+r13*8]
mov r12, [r15]
mul r12
and r13, -4
mov r11, r13
and ebx, 3
jz .2
cmp ebx, 2
jc .3
jz .4
.1: mov r10, rax
mov rbx, rdx
lea r14, [rel .23]
jmp .8
xalign 16
.2: mov rbp, rax
mov r10, rdx
lea r14, [rel .20]
jmp .7
xalign 16
.3: add r11, 4
mov rcx, rax
mov rbp, rdx
mov r10d, 0
mov rax, [rsi+r11*8]
lea r14, [rel .21]
jmp .6
xalign 16
.4: mov rbx, rax
mov rcx, rdx
mov rax, [rsi+r11*8+24]
mov ebp, 0
mov r10d, 0
lea r14, [rel .22]
jmp .9
xalign 16
.5: mov [rdi+r11*8-16], rbx
add rcx, rax
mov rax, [rsi+r11*8]
adc rbp, rdx
.6: mov ebx, 0
mul r12
mov [rdi+r11*8-8], rcx
add rbp, rax
adc r10, rdx
.7: mov rax, [rsi+r11*8+8]
mul r12
mov [rdi+r11*8], rbp
add r10, rax
adc rbx, rdx
.8: mov rax, [rsi+r11*8+16]
mul r12
mov [rdi+r11*8+8], r10
mov ebp, 0
mov r10, rbp
add rbx, rax
mov rax, [rsi+r11*8+24]
mov rcx, rbp
adc rcx, rdx
.9: mul r12
add r11, 4
js .5
mov [rdi-16], rbx
add rcx, rax
mov [rdi-8], rcx
mov [rdi+8], rbp
adc rbp, rdx
mov [rdi], rbp
dec r8
jz .40
lea rsi, [rsi-8]
lea r15, [r15+8]
mov r11, r13
mov r12, [r15]
mov r9, [r15+8]
jmp r14
xalign 16
.10:mov ebx, r13d
neg r13
mov rax, [rsi+r13*8-8]
mov r12, [r15]
mov r9, [r15+8]
mul r9
and r13, -4
mov r11, r13
and ebx, 3
jz .12
cmp ebx, 2
jc .13
jz .14
.11:mov rcx, rax
mov rbp, rdx
lea r14, [rel .23]
jmp .17
xalign 16
.12:mov rbx, rax
mov rcx, rdx
lea r14, [rel .20]
jmp .16
xalign 16
.13:mov r10, rax
mov rbx, rdx
mov ecx, 0
lea r14, [rel .21]
jmp .19
xalign 16
.14:mov rbp, rax
mov r10, rdx
mov ebx, 0
mov rax, [rsi+r11*8+16]
lea r14, [rel .22]
jmp .18
xalign 16
.15:mov rax, [rsi+r11*8-8]
mul r9
add rbx, rax
adc rcx, rdx
.16:mov ebp, 0
mov rax, [rsi+r11*8]
mul r12
add rbx, rax
mov rax, [rsi+r11*8]
adc rcx, rdx
adc ebp, 0
mul r9
add rcx, rax
mov [rdi+r11*8], rbx
adc rbp, rdx
.17:mov rax, [rsi+r11*8+8]
mul r12
mov r10d, 0
add rcx, rax
adc rbp, rdx
mov ebx, 0
adc r10d, 0
mov rax, [rsi+r11*8+8]
mov [rdi+r11*8+8], rcx
mul r9
add rbp, rax
mov rax, [rsi+r11*8+16]
adc r10, rdx
.18:mov ecx, 0
mul r12
add rbp, rax
mov rax, [rsi+r11*8+16]
adc r10, rdx
adc ebx, 0
mul r9
add r10, rax
mov [rdi+r11*8+16], rbp
adc rbx, rdx
.19:mov rax, [rsi+r11*8+24]
mul r12
add r10, rax
adc rbx, rdx
adc ecx, 0
add r11, 4
mov [rdi+r11*8-8], r10
jnz .15
mov [rdi], rbx
mov [rdi+8], rcx
sub r8, 2
jz .40
lea r15, [r15+16]
lea rsi, [rsi-16]
mov r11, r13
mov r12, [r15]
mov r9, [r15+8]
jmp r14
xalign 16
.20:mov rax, [rsi+r11*8-8]
mul r9
mov rcx, rax
mov rbp, rdx
mov r10d, 0
jmp .25
xalign 16
.21:mov rax, [rsi+r11*8+16]
mul r9
mov rbx, rax
mov rcx, rdx
mov ebp, 0
mov rax, [rsi+r11*8+24]
jmp .28
xalign 16
.22:mov rax, [rsi+r11*8+8]
mul r9
mov r10, rax
mov rbx, rdx
mov ecx, 0
jmp .27
xalign 16
.23:mov rax, [rsi+r11*8]
mul r9
mov rbp, rax
mov r10, rdx
mov ebx, 0
mov ecx, 0
jmp .26
xalign 16
.24:mov r10d, 0
add rbx, rax
mov rax, [rsi+r11*8-8]
adc rcx, rdx
adc ebp, 0
mul r9
add [rdi+r11*8-8], rbx
adc rcx, rax
adc rbp, rdx
.25:mov rax, [rsi+r11*8]
mul r12
add rcx, rax
mov rax, [rsi+r11*8]
adc rbp, rdx
adc r10d, 0
mul r9
add [rdi+r11*8], rcx
mov ecx, 0
adc rbp, rax
mov ebx, 0
adc r10, rdx
.26:mov rax, [rsi+r11*8+8]
mul r12
add rbp, rax
mov rax, [rsi+r11*8+8]
adc r10, rdx
adc ebx, 0
mul r9
add [rdi+r11*8+8], rbp
adc r10, rax
adc rbx, rdx
.27:mov rax, [rsi+r11*8+16]
mul r12
add r10, rax
mov rax, [rsi+r11*8+16]
adc rbx, rdx
adc ecx, 0
mul r9
add [rdi+r11*8+16], r10
nop ; < not translated >
adc rbx, rax
mov ebp, 0
mov rax, [rsi+r11*8+24]
adc rcx, rdx
.28:mul r12
add r11, 4
jnz .24
add rbx, rax
adc rcx, rdx
adc ebp, 0
add [rdi-8], rbx
adc [rdi], rcx
adc [rdi+8], rbp
sub r8, 2
jz .40
lea r15, [r15+16]
lea rsi, [rsi-16]
mov r11, r13
mov r12, [r15]
mov r9, [r15+8]
jmp r14
xalign 16
.29:xor ebx, ebx
xor ecx, ecx
xor ebp, ebp
neg r13
mov eax, r8d
and eax, 3
jz .31
cmp eax, 2
jc .32
jz .33
.30:lea r15, [r15-8]
mov r10, r15
add r8, 1
mov r11, r8
lea r14, [rel .36]
jmp .36
.31:mov r10, r15
mov r11, r8
lea r14, [rip+0]
mov rax, [rsi+r11*8-8]
jmp .35
.32:lea r15, [r15+8]
mov r10, r15
add r8, 3
mov r11, r8
lea r14, [rip+0]
mov rax, [r10-8]
jmp .38
.33:lea r15, [r15-16]
mov r10, r15
add r8, 2
mov r11, r8
lea r14, [rip+0]
mov rax, [r10+16]
jmp .37
xalign 16
.34:add rbx, rax
adc rcx, rdx
mov rax, [rsi+r11*8-8]
adc rbp, 0
.35:mul qword [r10]
add rbx, rax
adc rcx, rdx
adc rbp, 0
.36:mov rax, [rsi+r11*8-16]
mul qword [r10+8]
add rbx, rax
mov rax, [r10+16]
adc rcx, rdx
adc rbp, 0
.37:mul qword [rsi+r11*8-24]
add rbx, rax
mov rax, [r10+24]
adc rcx, rdx
lea r10, [r10+32]
adc rbp, 0
.38:mul qword [rsi+r11*8-32]
sub r11, 4
jnz .34
add rbx, rax
adc rcx, rdx
adc rbp, 0
mov [rdi+r13*8], rbx
inc r13
jz .39
mov r11, r8
mov r10, r15
lea rsi, [rsi+8]
mov rbx, rcx
mov rcx, rbp
xor ebp, ebp
jmp r14
.39:mov [rdi], rcx
mov [rdi+8], rbp
.40:WIN64_GCC_END
end
|
ASM/src/mask_deequip.asm | kr3z/OoT-Randomizer | 0 | 170378 | <filename>ASM/src/mask_deequip.asm
; Check if equipped mask = item in child trade slot before de-equipping mask.
mask_check_trade_slot:
lui v1, 0x8012 ; Save Context pt. 1
lbu t7, 0x014F(t0) ; Equipped Mask Param
addiu v1, v1, 0xA5D0 ; Save Context pt. 2
addiu t7, t7, 0x23 ; Add 0x23 to equipped mask param to get item number.
lbu t8, 0x8B(v1) ; Item in Child Trade Slot
nop
beq t7, t8, @@return ; If they are equal, skip de-equipping the mask.
nop
jr ra
sb zero, 0x014F(t0) ; De-equip Mask
@@return:
jr ra
nop
|
oeis/163/A163605.asm | neoneye/loda-programs | 11 | 24986 | <reponame>neoneye/loda-programs
; A163605: a(n) = ((3+2*sqrt(2))*(5+sqrt(2))^n + (3-2*sqrt(2))*(5-sqrt(2))^n)/2.
; Submitted by <NAME>
; 3,19,121,773,4947,31691,203129,1302397,8352003,53564899,343552921,2203536533,14133648147,90655141211,581477504729,3729706799437,23923085385603,153447597468979,984245010820921,6313155366422693,40493918415345747,259736610725735531,1666005983704403129,10686117790352114077,68543040278319868803,439649693605100064259,2820007009649643660121,18088127143579135123253,116021110213849547049747,744184177836175362662651,4773356243443214044482329,30617326344200107103582317,196386069842807148012729603
mov $1,2
mov $3,3
lpb $0
sub $0,1
dif $1,2
mov $2,$3
mul $2,2
mul $3,6
add $3,$1
mul $1,8
add $1,$2
lpe
mov $0,$3
|
ScrollModus/_code/GlobalCode/enemyLogikLevelGlobal.asm | kosmonautdnb/TheLandsOfZador | 0 | 14054 | COLLECTABLE_DISAPPEAR_VELOCITY = $24
COLLECTABLE_TYPE_HEART = $00
COLLECTABLE_TYPE_DIAMOND = $01
COLLECTABLE_TYPE_STONE = $02
COLLECTABLE_TYPE_ITEM = $03
spritePointersForCollectables
dc.b SPRITEFRAMES_HEART
dc.b SPRITEFRAMES_DIAMOND
dc.b SPRITEFRAMES_SPARKLES
dc.b SPRITEFRAMES_ITEM
PLAYERSHOOT1_JUMP_VELOCITY = $0260
PLAYERSHOOT1_GRAVITY = $0020
PLAYERSHOOT1_FRAMES_DONE = $c0
;---------------------------------------------------------
;--- objects that can be collected ---
;---------------------------------------------------------
InitCollectable SUBROUTINE
ldy enemyAddPropertyIntern
lda spritePointersForCollectables,y
sta GameObjectSpriteImage,x
sta GameObjectSpriteValue,x
jsr enemyFlippedX
lda GameObjectFlags1,x
eor #$01
sta GameObjectSpriteFlippedX,x
tya
sta GameObjectVar1,x
lda #$00
sta GameObjectVar2,x ; off animation on/off
lda #$ff
sta GameObjectVar3,x ; off animation y move
sta GameObjectVar4,x ; off animation y move
lda #$1c
sta GameObjectVar5,x ; off animation duration
rts
HandleCollectable SUBROUTINE
lda GameObjectActiveCounter,x
clc
adc GameObjectXPosLo,x
lsr
lsr
lsr
and #$03
tay
lda threeFrameAnimation4,y
clc
adc GameObjectSpriteValue,x
sta GameObjectSpriteImage,x
lda GameObjectVar2,x
beq .notoffanimation
lda GameObjectYPosLoLo,x
clc
adc GameObjectVar3,x
sta GameObjectYPosLoLo,x
lda GameObjectYPosLo,x
adc GameObjectVar4,x
sta GameObjectYPosLo,x
lda GameObjectYPosHi,x
adc #$ff
sta GameObjectYPosHi,x
lda GameObjectVar3,x
sec
sbc #<COLLECTABLE_DISAPPEAR_VELOCITY
sta GameObjectVar3,x
lda GameObjectVar4,x
sbc #>COLLECTABLE_DISAPPEAR_VELOCITY
sta GameObjectVar4,x
lda GameObjectActiveCounter,x
lsr
lsr
lsr
lsr
and #$01
asl
sec
sbc #$01
jsr enemyMoveXNoCollision
dec GameObjectVar5,x
bne .notdone
txa
jsr removeEnemyFromLevel
.notdone
rts
.notoffanimation
lda GameObjectActiveCounter,x
and #31
clc
adc GameObjectXPosLo,x
clc
adc GameObjectXPosLo,x
and #31
lsr
lsr
lsr
lsr
and #$01
asl
sec
sbc #$01
jmp enemyMoveYNoCollision
;---------------------------------------------------------
;--- the shoot of the player ---
;---------------------------------------------------------
InitPlayerShot SUBROUTINE
lda #SPRITEFRAMES_PLAYERSHOT
sta GameObjectSpriteValue,x
sta GameObjectSpriteImage,x
lda GameObjectSpriteFlippedX + PLAYERGAMEOBJECT
and #$01
sta GameObjectFlags1,x
lda #GAMEOBJECT_COLLISIONTYPE_PLAYER_SHOT
sta GameObjectCollisionType,x
lda #<[-PLAYERSHOOT1_JUMP_VELOCITY]
sta GameObjectVar1,x
lda #>[-PLAYERSHOOT1_JUMP_VELOCITY]
sta GameObjectVar2,x
lda #$ff
sta GameObjectVar3,x
rts
;---------------------------------------------------------
;--- the player shot ---
;---------------------------------------------------------
HandlePlayerShot SUBROUTINE
lda #$01
sta playerShotActive
lda GameObjectActiveCounter,x
lsr
lsr
lsr
and #$01
clc
adc #SPRITEFRAMES_PLAYERSHOT
sta GameObjectSpriteImage,x
lda GameObjectActiveCounter,x
cmp #PLAYERSHOOT1_FRAMES_DONE
bne .dontdelete
lda enemyNr
jmp removeEnemyFromScreen
.dontdelete
; handle y movement
lda GameObjectYPosLoLo,x
clc
adc GameObjectVar1,x
sta GameObjectYPosLoLo,x
lda GameObjectYPosLo,x
adc GameObjectVar2,x
sta GameObjectYPosLo,x
lda GameObjectYPosHi,x
adc GameObjectVar3,x
sta GameObjectYPosHi,x
lda GameObjectVar1,x
clc
adc #<PLAYERSHOOT1_GRAVITY
sta GameObjectVar1,x
lda GameObjectVar2,x
adc #>PLAYERSHOOT1_GRAVITY
sta GameObjectVar2,x
lda GameObjectVar3,x
adc #$00
sta GameObjectVar3,x
jsr collisionEnemyDown
cmp #$00
beq .notcollidedDown
lda #SOUND_LITTLEJUMP
jsr triggerSound
lda #<[-PLAYERSHOOT1_JUMP_VELOCITY]
sta GameObjectVar1,x
lda #>[-PLAYERSHOOT1_JUMP_VELOCITY]
sta GameObjectVar2,x
lda #$ff
sta GameObjectVar3,x
.notcollidedDown
jsr collisionEnemyUp
cmp #$00
beq .notcollidedUp
lda #$00
sta GameObjectVar1,x
sta GameObjectVar2,x
sta GameObjectVar3,x
.notcollidedUp
lda GameObjectFlags1,x
bne .flipped
lda #$00
sta GameObjectSpriteFlippedX,x
lda #$01
jsr moveEnemyRightByAccu
jmp .checkFlip
.flipped
lda #$01
sta GameObjectSpriteFlippedX,x
lda #$01
jsr moveEnemyLeftByAccu
.checkFlip
cmp #$00
beq .notFlipped
lda #SOUND_LITTLEJUMP
jsr triggerSound
ldx enemyNr
lda GameObjectFlags1,x
eor #$01
sta GameObjectFlags1,x
.notFlipped
txa
tay
jmp eAddLazerParticlesY
;---------------------------------------------------------
;--- the explosion ---
;---------------------------------------------------------
HandleExplosion SUBROUTINE
lda #$03
jsr moveEnemyUpByAccu
ldx enemyNr
lda GameObjectVar1,x
;lsr
lsr
cmp #$04
bne .display
lda enemyNr
jmp removeEnemyFromLevel
.display
clc
adc #SPRITEFRAMES_EXPLOSION
sta GameObjectSpriteImage,x
inc GameObjectVar1,x
InitExplosion ; never called
rts
;---------------------------------------------------------
;--- the sparkles (for explosions) ---
;---------------------------------------------------------
InitSparkles SUBROUTINE
lda #SPRITEFRAMES_SPARKLES
sta GameObjectSpriteImage,x
sta GameObjectSpriteValue,x
lda enemyAddPropertyIntern
sta GameObjectVar1,x
rts
HandleSparkles SUBROUTINE
lda GameObjectActiveCounter,x
cmp #12
bne .notdeleted
lda #GAMEOBJECT_COLLISIONTYPE_FREE_ENEMY_SLOT
sta GameObjectCollisionType,x ; free enemy
rts
.notdeleted
lsr
lsr
and #$03
tay
lda threeFrameAnimation4,y
clc
adc GameObjectSpriteValue,x
sta GameObjectSpriteImage,x
lda GameObjectVar1,x
beq .normalfree
sta GameObjectSpriteImage,x
lda #$fe
jsr enemyMoveYNoCollision
.normalfree
lda #$fd
jmp enemyMoveYNoCollision
;---------------------------------------------------------
;--- initializes a schalter ---
;---------------------------------------------------------
InitSchalter SUBROUTINE
lda enemyAddPropertyIntern
sta GameObjectSpriteImage,x
sta GameObjectSpriteValue,x
lda enemyAddSpecialValue
sta GameObjectVar1,x
rts
HandleSchalter SUBROUTINE
lda GameObjectVar1,x
sec
sbc #SCHALTERENEMYTYPESTART
asl
tay
lda layers + 0,y
sta .read + 1
lda layers + 1,y
sta .read + 2
.read
lda $4444
and #$01
clc
adc GameObjectSpriteValue,x
sta GameObjectSpriteImage,x
rts
|
programs/oeis/056/A056864.asm | neoneye/loda | 22 | 105468 | <gh_stars>10-100
; A056864: Nearest integer to n^2/10.
; 0,0,0,1,2,3,4,5,6,8,10,12,14,17,20,23,26,29,32,36,40,44,48,53,58,63,68,73,78,84,90,96,102,109,116,123,130,137,144,152,160,168,176,185,194,203,212,221,230,240,250,260,270,281,292,303,314,325
pow $0,2
add $0,5
div $0,10
|
oeis/109/A109630.asm | neoneye/loda-programs | 11 | 98254 | ; A109630: The winning position when playing the "eeny meeny miny moe" game with n players and eliminating every 8th player.
; 1,1,3,3,1,3,4,4,3,1,9,5,13,7,15,7,15,5,13,1,9,17,2,10,18,26,7,15,23,1,9,17,25,33,6,14,22,30,38,6,14,22,30,38,1,9,17,25,33,41,49,5,13,21,29,37,45,53,2,10,18,26,34,42,50,58,66,6,14,22,30,38,46,54,62,70,1,9,17,25
mov $2,1
lpb $0
sub $0,1
add $1,8
add $2,1
mod $1,$2
lpe
mov $0,$1
add $0,1
|
samples/prime.asm | SohamMalakar/Intel-8085 | 0 | 178040 | <reponame>SohamMalakar/Intel-8085
MVI A, 00
STA f200
LDA f100 // input
MOV L, A
RRC
ANI 7f
MOV D, A
MVI E, 00 // flag
MVI B, 01 // iterator
MVI C, 00 // counter
LOOP:
CMP B
JC OUT // if A < B, jump out
MOV A, L
CALL REM
MOV A, D
INR B
JMP LOOP
OUT: MOV A, C
CPI 01
JNZ NOT
INR E
MOV A, E
STA f200
NOT: HLT
REM:
MOV H, B
LOOP1:
CMP H
JC END // if A < H, jump out
SUB H
JMP LOOP1
END: CPI 00
JNZ NO
INR C
NO: RET
|
day22/day22.adb | thorstel/Advent-of-Code-2018 | 2 | 14009 | <gh_stars>1-10
with Ada.Assertions; use Ada.Assertions;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers.Synchronized_Queue_Interfaces;
with Ada.Containers.Unbounded_Priority_Queues;
procedure Day22 is
Max_Dim : constant Natural := 800;
Grid : array
(Natural range 0 .. Max_Dim, Natural range 0 .. Max_Dim) of Natural :=
(others => (others => 0));
Depth : Natural;
Target_X : Natural;
Target_Y : Natural;
function Geological_Index (X, Y : Natural) return Natural is
begin
if X = Target_X and Y = Target_Y then
return 0;
elsif Y = 0 then
return X * 16807;
elsif X = 0 then
return Y * 48271;
else
return Grid (X - 1, Y) * Grid (X, Y - 1);
end if;
end Geological_Index;
function Erosion_Level (X, Y : Natural) return Natural is
((Geological_Index (X, Y) + Depth) mod 20183);
File : File_Type;
begin
-- Input Handling
Open (File, In_File, "input.txt");
declare
Line1 : constant String := Get_Line (File);
Line2 : constant String := Get_Line (File);
Comma : Positive := Line2'First;
begin
Depth := Natural'Value (Line1 (8 .. Line1'Last));
while Comma <= Line2'Last loop
exit when Line2 (Comma) = ',';
Comma := Comma + 1;
end loop;
Assert (Comma < Line2'Last, "Invalid input!");
Target_X := Natural'Value (Line2 (9 .. Comma - 1));
Target_Y := Natural'Value (Line2 (Comma + 1 .. Line2'Last));
end;
Close (File);
-- Calculating the erosion levels for the grid.
for Y in Grid'Range (2) loop
for X in Grid'Range (1) loop
Grid (X, Y) := Erosion_Level (X, Y);
end loop;
end loop;
-- Changing grid from erosion Levels to terrain & part 1
declare
Risk_Level : Natural := 0;
begin
for Y in Grid'Range (2) loop
for X in Grid'Range (1) loop
Grid (X, Y) := Grid (X, Y) mod 3;
if X <= Target_X and Y <= Target_Y then
Risk_Level := Risk_Level + Grid (X, Y);
end if;
end loop;
end loop;
Put_Line ("Part 1 =" & Natural'Image (Risk_Level));
end;
-- Part 2
Dijkstra_Algorithm :
declare
type Tool_Type is (Torch, Climbing_Gear, Neither);
type Position is record
X : Integer;
Y : Integer;
end record;
type Node_Type is record
Visited : Boolean;
Distance : Natural;
end record;
type Queue_Element is record
X : Natural;
Y : Natural;
Tool : Tool_Type;
Distance : Natural;
end record;
function Can_Use (Tool : Tool_Type; Terrain : Natural) return Boolean is
begin
case Terrain is
when 0 => return Tool = Climbing_Gear or Tool = Torch;
when 1 => return Tool = Climbing_Gear or Tool = Neither;
when 2 => return Tool = Torch or Tool = Neither;
when others =>
raise Constraint_Error
with "Illegal terrain type:" & Natural'Image (Terrain);
end case;
end Can_Use;
function Get_Priority (Element : Queue_Element) return Natural is
(Element.Distance);
function Before (Left, Right : Natural) return Boolean is (Left < Right);
package QI is new Ada.Containers.Synchronized_Queue_Interfaces
(Element_Type => Queue_Element);
package PQ is new Ada.Containers.Unbounded_Priority_Queues
(Queue_Interfaces => QI, Queue_Priority => Natural);
use PQ;
use Ada.Containers;
Directions : constant array (Positive range <>) of Position :=
((1, 0), (-1, 0), (0, 1), (0, -1));
Nodes : array
(Natural range 0 .. Max_Dim,
Natural range 0 .. Max_Dim,
Tool_Type'Range) of Node_Type :=
(others => (others => (others => (False, 0))));
E : Queue_Element;
Q : Queue;
begin
Q.Enqueue ((0, 0, Torch, 0)); -- Start with torch equipped
while Q.Current_Use > 0 and not Nodes (Target_X, Target_Y, Torch).Visited
loop
Q.Dequeue (E);
if not Nodes (E.X, E.Y, E.Tool).Visited then
Nodes (E.X, E.Y, E.Tool).Visited := True;
Nodes (E.X, E.Y, E.Tool).Distance := E.Distance;
for Dir of Directions loop
if (E.X > 0 or Dir.X >= 0) and
(E.Y > 0 or Dir.Y >= 0) and
(E.X < Max_Dim or Dir.X <= 0) and
(E.Y < Max_Dim or Dir.Y <= 0)
then
declare
New_X : constant Natural := E.X + Dir.X;
New_Y : constant Natural := E.Y + Dir.Y;
begin
if Can_Use (E.Tool, Grid (New_X, New_Y)) and
not Nodes (New_X, New_Y, E.Tool).Visited
then
Q.Enqueue ((New_X, New_Y, E.Tool, E.Distance + 1));
end if;
end;
end if;
end loop;
for Tool in Tool_Type'Range loop
if not Nodes (E.X, E.Y, Tool).Visited and
Can_Use (Tool, Grid (E.X, E.Y))
then
Q.Enqueue ((E.X, E.Y, Tool, E.Distance + 7));
end if;
end loop;
end if;
end loop;
Put_Line
("Part 2 =" &
Natural'Image (Nodes (Target_X, Target_Y, Torch).Distance));
end Dijkstra_Algorithm;
end Day22;
|
oldstuff/tigcc/PolySnd/sources/statique/_Ptridle_voice1.asm | bcherry/bcherry | 3 | 16876 | <reponame>bcherry/bcherry<filename>oldstuff/tigcc/PolySnd/sources/statique/_Ptridle_voice1.asm
section ".data"
xdef pSnd_Ptridle_voice1
pSnd_Ptridle_voice1:
move.l a0,d0
tst.l d0
beq.s return_ptr_voice1
move.l d0,ptridle_voice1
bsr pSnd_SkipData_voice1
suba.l a0,a0
rts
return_ptr_voice1:
move.l ptridle_voice1,a0
rts |
programs/oeis/209/A209116.asm | jmorken/loda | 1 | 29599 | <reponame>jmorken/loda<gh_stars>1-10
; A209116: Number of 4-bead necklaces labeled with numbers -n..n not allowing reversal, with sum zero and avoiding the patterns z z+1 z+2 and z z-1 z-2.
; 5,22,55,120,221,362,559,816,1137,1538,2023,2596,3273,4058,4955,5980,7137,8430,9875,11476,13237,15174,17291,19592,22093,24798,27711,30848,34213,37810,41655,45752,50105,54730,59631,64812,70289,76066,82147,88548
mov $2,$0
mov $4,$0
add $4,1
lpb $4
mov $0,$2
sub $4,1
sub $0,$4
mov $3,$0
add $0,2
add $3,$0
log $0,$0
mov $5,-3
gcd $5,$3
pow $3,2
sub $5,2
mul $5,2
add $5,1
sub $5,$3
mov $6,$0
trn $6,2
sub $6,$5
add $1,$6
lpe
|
code/5-S-6.asm | gdzhang2012/Assembly-Language-by-Wangshuang | 0 | 4899 | assume cs:code
code segment
mov ax,0ffffh
mov ds,ax
mov bx,0
mov dx,0
mov cx,12
s: mov al,[bx]
mov ah,0
add dx,ax
inc bx
loop s
mov ax,4c00h
int 21h
code ends
end
|
Student/examples/Correct/Subprograms/Hanoi.asm | SoftMoore/CPRL-Kt | 6 | 162659 | PROGRAM 4
BR L5
L0:
PROC 0
LDLADDR -10
LOADW
LDCINT 0
CMP
BLE L3
LDLADDR -10
LOADW
LDCINT 1
SUB
LDLADDR -6
LOAD2B
LDLADDR -2
LOAD2B
LDLADDR -4
LOAD2B
CALL L0
LDCSTR "Move a disk from "
PUTSTR
LDLADDR -6
LOAD2B
PUTCH
LDCSTR " to "
PUTSTR
LDLADDR -4
LOAD2B
PUTCH
PUTEOL
LDLADDR -10
LOADW
LDCINT 1
SUB
LDLADDR -2
LOAD2B
LDLADDR -4
LOAD2B
LDLADDR -6
LOAD2B
CALL L0
L3:
L4:
RET 10
L5:
LDCSTR "Enter number of disks to be moved: "
PUTSTR
LDGADDR 0
GETINT
STOREW
LDGADDR 0
LOADW
LDCCH 'A'
LDCCH 'B'
LDCCH 'C'
CALL L0
HALT
|
Lambda/Closure/Functional.agda | nad/codata | 1 | 12313 | ------------------------------------------------------------------------
-- Functional semantics for an untyped λ-calculus with constants
------------------------------------------------------------------------
module Lambda.Closure.Functional where
open import Category.Monad
open import Category.Monad.Partiality as Partiality
using (_⊥; never; OtherKind; other; steps)
open import Codata.Musical.Notation
open import Data.Empty using (⊥-elim)
open import Data.List hiding (lookup)
open import Data.Maybe hiding (_>>=_)
import Data.Maybe.Categorical as Maybe
open import Data.Nat
open import Data.Product
open import Data.Sum
open import Data.Vec using (Vec; []; _∷_; lookup)
open import Function
import Level
open import Relation.Binary using (module Preorder)
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open import Relation.Nullary
open import Relation.Nullary.Negation
open Partiality._⊥
private
open module E {A : Set} = Partiality.Equality (_≡_ {A = A})
open module R {A : Set} =
Partiality.Reasoning (P.isEquivalence {A = A})
open import Lambda.Syntax
open Closure Tm
open import Lambda.VirtualMachine
open Functional
private
module VM = Closure Code
------------------------------------------------------------------------
-- A monad with partiality and failure
PF : RawMonad {f = Level.zero} (_⊥ ∘ Maybe)
PF = Maybe.monadT Partiality.monad
module PF where
open RawMonad PF public
fail : {A : Set} → Maybe A ⊥
fail = now nothing
_>>=-cong_ :
∀ {k} {A B : Set} {x₁ x₂ : Maybe A ⊥} {f₁ f₂ : A → Maybe B ⊥} →
Rel k x₁ x₂ → (∀ x → Rel k (f₁ x) (f₂ x)) →
Rel k (x₁ >>= f₁) (x₂ >>= f₂)
_>>=-cong_ {k} {f₁ = f₁} {f₂} x₁≈x₂ f₁≈f₂ =
Partiality._>>=-cong_ x₁≈x₂ helper
where
helper : ∀ {x y} → x ≡ y →
Rel k (maybe f₁ fail x) (maybe f₂ fail y)
helper {x = nothing} P.refl = fail ∎
helper {x = just x} P.refl = f₁≈f₂ x
associative :
{A B C : Set}
(x : Maybe A ⊥) (f : A → Maybe B ⊥) (g : B → Maybe C ⊥) →
(x >>= f >>= g) ≅ (x >>= λ y → f y >>= g)
associative x f g =
(x >>= f >>= g) ≅⟨ Partiality.associative P.refl x _ _ ⟩
(x >>=′ λ y → maybe f fail y >>= g) ≅⟨ Partiality._>>=-cong_ (x ∎) helper ⟩
(x >>= λ y → f y >>= g) ∎
where
open RawMonad Partiality.monad renaming (_>>=_ to _>>=′_)
helper : ∀ {y₁ y₂} → y₁ ≡ y₂ →
(maybe f fail y₁ >>= g) ≅ maybe (λ z → f z >>= g) fail y₂
helper {y₁ = nothing} P.refl = fail ∎
helper {y₁ = just y} P.refl = (f y >>= g) ∎
>>=-inversion-⇓ :
∀ {k} {A B : Set} x {f : A → Maybe B ⊥} {y} →
(x>>=f⇓ : (x >>= f) ⇓[ k ] just y) →
∃ λ z → ∃₂ λ (x⇓ : x ⇓[ k ] just z)
(fz⇓ : f z ⇓[ k ] just y) →
steps x⇓ + steps fz⇓ ≡ steps x>>=f⇓
>>=-inversion-⇓ x {f} x>>=f⇓
with Partiality.>>=-inversion-⇓ {_∼A_ = _≡_} P.refl x x>>=f⇓
... | (nothing , x↯ , now () , _)
... | (just z , x⇓ , fz⇓ , eq) = (z , x⇓ , fz⇓ , eq)
>>=-inversion-⇑ :
∀ {k} {A B : Set} x {f : A → Maybe B ⊥} →
(x >>= f) ⇑[ other k ] →
¬ ¬ (x ⇑[ other k ] ⊎
∃ λ y → x ⇓[ other k ] just y × f y ⇑[ other k ])
>>=-inversion-⇑ {k} x {f} x>>=f⇑ =
helper ⟨$⟩ Partiality.>>=-inversion-⇑ P.isEquivalence x x>>=f⇑
where
open RawMonad ¬¬-Monad renaming (_<$>_ to _⟨$⟩_)
helper : (_ ⊎ ∃ λ (y : Maybe _) → _) → _
helper (inj₁ x⇑ ) = inj₁ x⇑
helper (inj₂ (just y , x⇓,fy⇑) ) = inj₂ (y , x⇓,fy⇑)
helper (inj₂ (nothing , x↯,now∼never)) =
⊥-elim (Partiality.now≉never (proj₂ x↯,now∼never))
------------------------------------------------------------------------
-- A workaround for the limitations of guardedness
module Workaround where
data Maybe_⊥P : Set → Set₁ where
fail : ∀ {A} → Maybe A ⊥P
return : ∀ {A} (x : A) → Maybe A ⊥P
later : ∀ {A} (x : ∞ (Maybe A ⊥P)) → Maybe A ⊥P
_>>=_ : ∀ {A B} (x : Maybe A ⊥P) (f : A → Maybe B ⊥P) → Maybe B ⊥P
private
data Maybe_⊥W : Set → Set₁ where
fail : ∀ {A} → Maybe A ⊥W
return : ∀ {A} (x : A) → Maybe A ⊥W
later : ∀ {A} (x : Maybe A ⊥P) → Maybe A ⊥W
mutual
_>>=W_ : ∀ {A B} → Maybe A ⊥W → (A → Maybe B ⊥P) → Maybe B ⊥W
fail >>=W f = fail
return x >>=W f = whnf (f x)
later x >>=W f = later (x >>= f)
whnf : ∀ {A} → Maybe A ⊥P → Maybe A ⊥W
whnf fail = fail
whnf (return x) = return x
whnf (later x) = later (♭ x)
whnf (x >>= f) = whnf x >>=W f
mutual
private
⟪_⟫W : ∀ {A} → Maybe A ⊥W → Maybe A ⊥
⟪ fail ⟫W = PF.fail
⟪ return x ⟫W = PF.return x
⟪ later x ⟫W = later (♯ ⟪ x ⟫P)
⟪_⟫P : ∀ {A} → Maybe A ⊥P → Maybe A ⊥
⟪ p ⟫P = ⟪ whnf p ⟫W
-- The definitions above make sense. ⟪_⟫P is homomorphic with respect
-- to fail, return, later and _>>=_.
fail-hom : ∀ {A} → ⟪ fail {A = A} ⟫P ≅ PF.fail
fail-hom = PF.fail ∎
return-hom : ∀ {A} (x : A) → ⟪ return x ⟫P ≅ PF.return x
return-hom x = PF.return x ∎
later-hom : ∀ {A} (x : ∞ Maybe A ⊥P) →
⟪ later x ⟫P ≅ later (♯ ⟪ ♭ x ⟫P)
later-hom x = later (♯ (⟪ ♭ x ⟫P ∎))
mutual
private
>>=-homW : ∀ {A B} (x : Maybe A ⊥W) (f : A → Maybe B ⊥P) →
⟪ x >>=W f ⟫W ≅ PF._>>=_ ⟪ x ⟫W (λ y → ⟪ f y ⟫P)
>>=-homW fail f = PF.fail ∎
>>=-homW (return x) f = ⟪ f x ⟫P ∎
>>=-homW (later x) f = later (♯ >>=-hom x f)
>>=-hom : ∀ {A B} (x : Maybe A ⊥P) (f : A → Maybe B ⊥P) →
⟪ x >>= f ⟫P ≅ PF._>>=_ ⟪ x ⟫P (λ y → ⟪ f y ⟫P)
>>=-hom x f = >>=-homW (whnf x) f
open Workaround hiding (_>>=_)
------------------------------------------------------------------------
-- Semantics
infix 5 _∙_
-- Note that this definition gives us determinism "for free".
mutual
⟦_⟧′ : ∀ {n} → Tm n → Env n → Maybe Value ⊥P
⟦ con i ⟧′ ρ = return (con i)
⟦ var x ⟧′ ρ = return (lookup ρ x)
⟦ ƛ t ⟧′ ρ = return (ƛ t ρ)
⟦ t₁ · t₂ ⟧′ ρ = ⟦ t₁ ⟧′ ρ >>= λ v₁ →
⟦ t₂ ⟧′ ρ >>= λ v₂ →
v₁ ∙ v₂
where open Workaround
_∙_ : Value → Value → Maybe Value ⊥P
con i ∙ v₂ = fail
ƛ t₁ ρ ∙ v₂ = later (♯ (⟦ t₁ ⟧′ (v₂ ∷ ρ)))
⟦_⟧ : ∀ {n} → Tm n → Env n → Maybe Value ⊥
⟦ t ⟧ ρ = ⟪ ⟦ t ⟧′ ρ ⟫P
------------------------------------------------------------------------
-- Example
Ω-loops : ⟦ Ω ⟧ [] ≈ never
Ω-loops = later (♯ Ω-loops)
------------------------------------------------------------------------
-- Some lemmas
open PF hiding (_>>=_)
-- An abbreviation.
infix 5 _⟦·⟧_
_⟦·⟧_ : Maybe Value ⊥ → Maybe Value ⊥ → Maybe Value ⊥
v₁ ⟦·⟧ v₂ = v₁ >>= λ v₁ → v₂ >>= λ v₂ → ⟪ v₁ ∙ v₂ ⟫P
where open PF
-- _⟦·⟧_ preserves equality.
_⟦·⟧-cong_ : ∀ {k v₁₁ v₁₂ v₂₁ v₂₂} →
Rel k v₁₁ v₂₁ → Rel k v₁₂ v₂₂ →
Rel k (v₁₁ ⟦·⟧ v₁₂) (v₂₁ ⟦·⟧ v₂₂)
v₁₁≈v₂₁ ⟦·⟧-cong v₁₂≈v₂₂ =
v₁₁≈v₂₁ >>=-cong λ v₁ →
v₁₂≈v₂₂ >>=-cong λ v₂ →
⟪ v₁ ∙ v₂ ⟫P ∎
-- The semantics of application is compositional (with respect to the
-- syntactic equality which is used).
·-comp : ∀ {n} (t₁ t₂ : Tm n) {ρ} →
⟦ t₁ · t₂ ⟧ ρ ≅ ⟦ t₁ ⟧ ρ ⟦·⟧ ⟦ t₂ ⟧ ρ
·-comp t₁ t₂ {ρ} =
⟦ t₁ · t₂ ⟧ ρ ≅⟨ >>=-hom (⟦ t₁ ⟧′ ρ) _ ⟩
PF._>>=_ (⟦ t₁ ⟧ ρ) (λ v₁ →
⟪ Workaround._>>=_ (⟦ t₂ ⟧′ ρ) (λ v₂ →
v₁ ∙ v₂) ⟫P) ≅⟨ ((⟦ t₁ ⟧ ρ ∎) >>=-cong λ _ →
>>=-hom (⟦ t₂ ⟧′ ρ) _) ⟩
⟦ t₁ ⟧ ρ ⟦·⟧ ⟦ t₂ ⟧ ρ ∎
open PF
------------------------------------------------------------------------
-- Compiler correctness
module Correctness {k : OtherKind} where
infix 4 _≈P_ _≈W_
infixr 2 _≡⟨_⟩W_ _≈⟨_⟩P_ _≈⟨_⟩W_
mutual
data _≈P_ : Maybe VM.Value ⊥ → Maybe VM.Value ⊥ → Set where
_≈⟨_⟩P_ : ∀ x {y z} (x≈y : x ≈P y) (y≅z : y ≅ z) → x ≈P z
correct :
∀ {n} t {ρ : Env n} {c s} {k : Value → Maybe VM.Value ⊥} →
(hyp : ∀ v → exec ⟨ c , val (comp-val v) ∷ s , comp-env ρ ⟩
≈W k v) →
exec ⟨ comp t c , s , comp-env ρ ⟩ ≈P (⟦ t ⟧ ρ >>= k)
data _≈W_ : Maybe VM.Value ⊥ → Maybe VM.Value ⊥ → Set where
⌈_⌉ : ∀ {x y} (x≈y : Rel (other k) x y) → x ≈W y
later : ∀ {x y} (x≈y : ♭ x ≈P ♭ y) → later x ≈W later y
laterˡ : ∀ {x y} (x≈y : ♭ x ≈W y) → later x ≈W y
_≡⟨_⟩W_ : ∀ x {y z} → x ≡ y → y ≈W z → x ≈W z
_ ≡⟨ P.refl ⟩W y≈z = y≈z
_≈⟨_⟩W_ : ∀ x {y z} → x ≈W y → y ≅ z → x ≈W z
._ ≈⟨ later x≈y ⟩W later y≅z = later (_ ≈⟨ x≈y ⟩P ♭ y≅z)
._ ≈⟨ laterˡ x≈y ⟩W y≅z = laterˡ (_ ≈⟨ x≈y ⟩W y≅z)
_ ≈⟨ ⌈ x≈y ⌉ ⟩W y≅z = ⌈ trans x≈y (Partiality.≅⇒ y≅z) ⌉
where trans = Preorder.trans (Partiality.preorder P.isPreorder _)
-- The relation _≈_ does not admit unrestricted use of transitivity
-- in corecursive proofs, so I have formulated the correctness proof
-- using a continuation. Note that the proof would perhaps be easier
-- if the semantics was also formulated in continuation-passing
-- style.
mutual
correctW :
∀ {n} t {ρ : Env n} {c s} {k : Value → Maybe VM.Value ⊥} →
(∀ v → exec ⟨ c , val (comp-val v) ∷ s , comp-env ρ ⟩ ≈W k v) →
exec ⟨ comp t c , s , comp-env ρ ⟩ ≈W (⟦ t ⟧ ρ >>= k)
correctW (con i) {ρ} {c} {s} {k} hyp = laterˡ (
exec ⟨ c , val (Lambda.Syntax.Closure.con i) ∷ s , comp-env ρ ⟩ ≈⟨ hyp (con i) ⟩W
k (con i) ∎)
correctW (var x) {ρ} {c} {s} {k} hyp = laterˡ (
exec ⟨ c , val (lookup (comp-env ρ) x) ∷ s , comp-env ρ ⟩ ≡⟨ P.cong (λ v → exec ⟨ c , val v ∷ s , comp-env ρ ⟩) $ lookup-hom x ρ ⟩W
exec ⟨ c , val (comp-val (lookup ρ x)) ∷ s , comp-env ρ ⟩ ≈⟨ hyp (lookup ρ x) ⟩W
k (lookup ρ x) ∎)
correctW (ƛ t) {ρ} {c} {s} {k} hyp = laterˡ (
exec ⟨ c , val (comp-val (ƛ t ρ)) ∷ s , comp-env ρ ⟩ ≈⟨ hyp (ƛ t ρ) ⟩W
k (ƛ t ρ) ∎)
correctW (t₁ · t₂) {ρ} {c} {s} {k} hyp =
exec ⟨ comp t₁ (comp t₂ (app ∷ c)) , s , comp-env ρ ⟩ ≈⟨ correctW t₁ (λ v₁ → correctW t₂ (λ v₂ → ∙-correctW v₁ v₂ hyp)) ⟩W
(⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦ t₂ ⟧ ρ >>= λ v₂ → ⟪ v₁ ∙ v₂ ⟫P >>= k) ≅⟨ ((⟦ t₁ ⟧ ρ ∎) >>=-cong λ _ → sym $ associative (⟦ t₂ ⟧ ρ) _ _) ⟩
(⟦ t₁ ⟧ ρ >>= λ v₁ → (⟦ t₂ ⟧ ρ >>= λ v₂ → ⟪ v₁ ∙ v₂ ⟫P) >>= k) ≅⟨ sym $ associative (⟦ t₁ ⟧ ρ) _ _ ⟩
(⟦ t₁ ⟧ ρ ⟦·⟧ ⟦ t₂ ⟧ ρ >>= k) ≅⟨ sym (·-comp t₁ t₂ >>=-cong λ v → k v ∎) ⟩
(⟦ t₁ · t₂ ⟧ ρ >>= k) ∎
∙-correctW :
∀ {n} v₁ v₂ {ρ : Env n} {c s} {k : Value → Maybe VM.Value ⊥} →
(∀ v → exec ⟨ c , val (comp-val v) ∷ s , comp-env ρ ⟩ ≈W k v) →
exec ⟨ app ∷ c , val (comp-val v₂) ∷ val (comp-val v₁) ∷ s , comp-env ρ ⟩ ≈W
(⟪ v₁ ∙ v₂ ⟫P >>= k)
∙-correctW (con i) v₂ _ = ⌈ PF.fail ∎ ⌉
∙-correctW (ƛ t₁ ρ₁) v₂ {ρ} {c} {s} {k} hyp =
exec ⟨ app ∷ c , val (comp-val v₂) ∷ val (comp-val (ƛ t₁ ρ₁)) ∷ s , comp-env ρ ⟩ ≈⟨ later (
exec ⟨ comp t₁ [ ret ] , ret c (comp-env ρ) ∷ s , comp-env (v₂ ∷ ρ₁) ⟩ ≈⟨ correct t₁ (λ v → laterˡ (hyp v)) ⟩P
(⟦ t₁ ⟧ (v₂ ∷ ρ₁) >>= k) ∎) ⟩W
(⟪ ƛ t₁ ρ₁ ∙ v₂ ⟫P >>= k) ∎
whnf : ∀ {x y} → x ≈P y → x ≈W y
whnf (x ≈⟨ x≈y ⟩P y≅z) = x ≈⟨ whnf x≈y ⟩W y≅z
whnf (correct t hyp) = correctW t hyp
mutual
soundW : ∀ {x y} → x ≈W y → Rel (other k) x y
soundW ⌈ x≈y ⌉ = x≈y
soundW (later x≈y) = later (♯ soundP x≈y)
soundW (laterˡ x≈y) = laterˡ (soundW x≈y)
soundP : ∀ {x y} → x ≈P y → Rel (other k) x y
soundP x≈y = soundW (whnf x≈y)
-- Note that the equality that is used here is syntactic.
correct : ∀ t →
exec ⟨ comp t [] , [] , [] ⟩ ≈
(⟦ t ⟧ [] >>= λ v → PF.return (comp-val v))
correct t =
soundP $ Correctness.correct t (λ v → ⌈ PF.return (comp-val v) ∎ ⌉)
where open Correctness
|
alloy4fun_models/trashltl/models/17/436HghZxBWMFo2ERm.als | Kaixi26/org.alloytools.alloy | 0 | 3013 | open main
pred id436HghZxBWMFo2ERm_prop18 {
all p: Protected | always p not in Protected implies p in Trash
}
pred __repair { id436HghZxBWMFo2ERm_prop18 }
check __repair { id436HghZxBWMFo2ERm_prop18 <=> prop18o } |
Cubical/ZCohomology/Groups/Connected.agda | thomas-lamiaux/cubical | 1 | 16337 | {-# OPTIONS --safe #-}
module Cubical.ZCohomology.Groups.Connected where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.GroupoidLaws
open import Cubical.Foundations.HLevels
open import Cubical.Data.Nat
open import Cubical.Data.Int renaming (_+_ to _+ℤ_; +Comm to +ℤ-comm ; +Assoc to +ℤ-assoc)
open import Cubical.Data.Sigma hiding (_×_)
open import Cubical.HITs.SetTruncation as ST
open import Cubical.HITs.PropositionalTruncation as PT
open import Cubical.HITs.Truncation as T
open import Cubical.HITs.Nullification
open import Cubical.Algebra.Group
open import Cubical.Algebra.Group.Instances.Int
open import Cubical.Algebra.Group.Morphisms
open import Cubical.Algebra.Group.MorphismProperties
open import Cubical.Homotopy.Connected
open import Cubical.ZCohomology.Base
open import Cubical.ZCohomology.GroupStructure
open import Cubical.ZCohomology.Groups.Unit
private
H⁰-connected-type : ∀ {ℓ} {A : Type ℓ} (a : A) → isConnected 2 A → Iso (coHom 0 A) ℤ
Iso.fun (H⁰-connected-type a con) = ST.rec isSetℤ λ f → f a
Iso.inv (H⁰-connected-type a con) b = ∣ (λ x → b) ∣₂
Iso.rightInv (H⁰-connected-type a con) b = refl
Iso.leftInv (H⁰-connected-type a con) =
ST.elim (λ _ → isOfHLevelPath 2 isSetSetTrunc _ _)
λ f → cong ∣_∣₂ (funExt λ x → T.rec₊ (isSetℤ _ _) (cong f) (isConnectedPath 1 con a x .fst))
open IsGroupHom
open Iso
H⁰-connected : ∀ {ℓ} {A : Type ℓ} (a : A) → ((x : A) → ∥ a ≡ x ∥₁) → GroupIso (coHomGr 0 A) ℤGroup
fun (fst (H⁰-connected a con)) = ST.rec isSetℤ (λ f → f a)
inv (fst (H⁰-connected a con)) b = ∣ (λ _ → b) ∣₂
rightInv (fst (H⁰-connected a con)) _ = refl
leftInv (fst (H⁰-connected a con)) =
ST.elim (λ _ → isProp→isSet (isSetSetTrunc _ _))
(λ f → cong ∣_∣₂ (funExt λ x → PT.rec (isSetℤ _ _) (cong f) (con x)))
snd (H⁰-connected a con) = makeIsGroupHom (ST.elim2 (λ _ _ → isProp→isSet (isSetℤ _ _)) λ x y → refl)
|
oeis/018/A018749.asm | neoneye/loda-programs | 11 | 90303 | ; A018749: Divisors of 968.
; Submitted by <NAME>
; 1,2,4,8,11,22,44,88,121,242,484,968
mov $1,1
lpb $0
sub $0,4
mul $1,11
lpe
lpb $0
sub $0,1
mul $1,2
lpe
mov $0,$1
|
oeis/028/A028057.asm | neoneye/loda-programs | 11 | 244016 | <reponame>neoneye/loda-programs
; A028057: Expansion of 1/((1-3x)(1-5x)(1-6x)(1-11x)).
; Submitted by <NAME>
; 1,25,408,5558,68999,813603,9315286,104854096,1168677477,12952000061,143075613044,1577575222314,17376397872835,191281848531799,2104964417048082,23159869359140612,254790508985373473,2802889182202991217,30832952040578234800,339169546346404999390
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
mul $1,6
sub $2,1
sub $0,$2
seq $0,17917 ; Expansion of 1/((1-3x)(1-5x)(1-11x)).
add $1,$0
lpe
mov $0,$1
|
programs/oeis/024/A024142.asm | neoneye/loda | 22 | 4070 | <filename>programs/oeis/024/A024142.asm<gh_stars>10-100
; A024142: 12^n-n^2.
; 1,11,140,1719,20720,248807,2985948,35831759,429981632,5159780271,61917364124,743008370567,8916100448112,106993205378903,1283918464548668,15407021574586143,184884258895036160,2218611106740436703,26623333280885243580,319479999370622926487,3833759992447475121776,46005119909369701465671,552061438912436417592860,6624737266949237011119599,79496847203390844133440960,953962166440690129601297807,11447545997288281555215580508,137370551967459378662586973479,1648446623609512543951043689712,19781359483314150527412524285111,237376313799769806328950291430524,2848515765597237675947403497176127,34182189187166852111368841966124032,410186270246002225336426103593499583
mov $1,12
pow $1,$0
pow $0,2
sub $1,$0
mov $0,$1
|
lab3/checkCondizioni.asm | samdsk/lab_arch2 | 0 | 81731 | <gh_stars>0
.data
msg_in: .asciiz "Inserisci un numero: "
msg_err: .asciiz "Errore"
.text
.globl main
main:
#A
la $a0 msg_in
li $v0 4
syscall
li $v0 5
syscall
add $s0 $zero $v0
#B
la $a0 msg_in
li $v0 4
syscall
li $v0 5
syscall
add $s1 $zero $v0
#C
la $a0 msg_in
li $v0 4
syscall
li $v0 5
syscall
add $s2 $zero $v0
#If ( (a>=b) && (c!=0) )
bne $s0 $s1 A_B
j A_B_eq
A_B: slt $t0 $s1 $s0
bne $t0 1 ELSE
A_B_eq: beqz $s2 ELSE
add $a0 $s0 $s1
mul $a0 $a0 $s2
li $v0 1
syscall
j exit
ELSE:
la $a0 msg_err
li $v0 4
syscall
exit: #EXIT
li $v0 10
syscall |
programs/oeis/281/A281814.asm | jmorken/loda | 1 | 162551 | <filename>programs/oeis/281/A281814.asm
; A281814: Expansion of f(x, x^8) in powers of x where f(, ) is Ramanujan's general theta function.
; 1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0
mul $0,9
add $0,1
lpb $0
add $2,1
trn $0,$2
sub $0,3
lpe
lpb $0
sub $0,1
add $1,1
lpe
|
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_324_1316.asm | ljhsiun2/medusa | 9 | 241928 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r9
push %rax
push %rbx
push %rdx
// Store
lea addresses_A+0x1cb69, %rax
nop
nop
nop
and %r11, %r11
mov $0x5152535455565758, %r9
movq %r9, (%rax)
nop
sub $52975, %rdx
// Faulty Load
lea addresses_A+0xbdb9, %r9
nop
cmp $64025, %rbx
movups (%r9), %xmm4
vpextrq $1, %xmm4, %rdx
lea oracles, %r9
and $0xff, %rdx
shlq $12, %rdx
mov (%r9,%rdx,1), %rdx
pop %rdx
pop %rbx
pop %rax
pop %r9
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'00': 324}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
STLC/Operational.agda | TypesLogicsCats/STLC | 1 | 13652 | <reponame>TypesLogicsCats/STLC<gh_stars>1-10
{-# OPTIONS --safe --sized-types #-}
module STLC.Operational where
open import STLC.Operational.Base
|
tier-1/xcb/applet/demo/simple/simple.adb | charlie5/cBound | 2 | 11766 | <gh_stars>1-10
with xcb.Binding; use xcb.Binding;
with xcb.Pointers; use xcb.Pointers;
with xcb.xcb_Screen_t;
with xcb.xcb_screen_Iterator_t;
with xcb.xcb_void_cookie_t;
with xcb.xcb_generic_event_t;
with Swig; use Swig;
with Swig.Pointers;
with interfaces.C.Strings; use Interfaces, interfaces.C, interfaces.C.Strings;
with ada.Text_IO; use ada.Text_IO;
with ada.unchecked_Deallocation;
with Ada.unchecked_Conversion;
procedure Simple
is
the_Connection : xcb_connection_t_Pointer;
the_Screen : xcb.xcb_screen_t.Pointer;
the_screen_Id : swig.Pointers.int_Pointer := new c.int;
the_Window : xcb.xcb_window_t;
void_Cookie : xcb.xcb_void_cookie_t.item;
Status : C.int;
Mask : swig.uint32_t;
Values : swig.uint32_t_array (1 .. 2);
E : xcb.xcb_generic_event_t.Pointer;
use type xcb.xcb_generic_event_t.Pointer;
procedure free is new ada.Unchecked_Deallocation (xcb.xcb_generic_event_t.item, xcb.xcb_generic_event_t.Pointer);
function to_Flag is new ada.Unchecked_Conversion (xcb.xcb_event_mask_t, swig.uint32_t);
function to_Flag is new ada.Unchecked_Conversion (xcb.xcb_cw_t, swig.uint32_t);
begin
-- Open the connection to the X server.
--
the_Connection := xcb_connect (c.strings.null_Ptr, -- Use the DISPLAY environment variable as the default display name.
the_screen_Id);
-- Get the screen id.
--
the_Screen := xcb_setup_roots_iterator (xcb_get_setup (the_Connection)).data.all'access;
-- Display some screen details.
--
new_Line;
put_Line ("Informations of screen:" & Unsigned_32'image (the_Screen.root));
new_Line;
put_Line (" width :" & Unsigned_16'image (the_Screen.width_in_pixels ));
put_Line (" height :" & Unsigned_16'image (the_Screen.height_in_pixels));
put_Line (" white pixel:" & Unsigned_32'image (the_Screen.white_pixel ));
put_Line (" black pixel:" & Unsigned_32'image (the_Screen.black_pixel ));
new_Line;
-- Create the window.
--
-- Ask for our window's Id.
--
the_Window := xcb_generate_id (the_Connection);
Mask := to_Flag (xcb.XCB_CW_BACK_PIXEL) or to_Flag (xcb.XCB_CW_EVENT_MASK);
put_Line ("FLAG: " & swig.uint32_t'Image (Mask));
Values := (1 => the_Screen.white_pixel, 2 => to_Flag (xcb.XCB_EVENT_MASK_EXPOSURE));
void_Cookie := xcb_create_window (the_Connection,
Unsigned_8 (xcb.XCB_COPY_FROM_PARENT),
the_Window,
the_screen.Root,
0, 0,
150, 150,
10,
xcb.xcb_window_class_t'Pos (xcb.XCB_WINDOW_CLASS_INPUT_OUTPUT),
the_Screen.root_Visual,
Mask,
Values (1)'Address);
-- Map the window on the screen.
--
void_Cookie := xcb_map_window (the_Connection, the_Window);
-- Make sure commands are sent before we pause, so window is shown.
--
Status := xcb_flush (the_Connection);
loop
put_Line ("fetch event:");
E := xcb_wait_for_event (the_Connection);
exit when E = null;
put_Line ("Got event:" & integer'image (Integer (E.response_type)));
free (E);
end loop;
-- Close the X server connection.
--
xcb_disconnect (the_Connection);
new_Line;
put_Line ("End.");
end Simple;
|
source/web-html.adb | ytomino/web-ada | 2 | 27578 | <gh_stars>1-10
with System;
package body Web.HTML is
use type String_Maps.Cursor;
procedure By_Stream (Item : in String; Params : in System.Address) is
function To_Pointer (Value : System.Address)
return access Ada.Streams.Root_Stream_Type'Class
with Import, Convention => Intrinsic;
begin
String'Write (To_Pointer (Params), Item);
end By_Stream;
Alt_Quot : aliased constant String := """;
Alt_Apos : aliased constant String := "'";
Alt_LF : aliased constant String := " ";
procedure Write_In_Attribute_Internal (
Version : in HTML_Version;
Item : in String;
Params : in System.Address;
Write : not null access procedure (
Item : in String;
Params : in System.Address))
is
Alt : access constant String;
First : Positive := Item'First;
Last : Natural := First - 1;
I : Positive := Item'First;
begin
while I <= Item'Last loop
case Item (I) is
when '"' =>
Alt := Alt_Quot'Access;
goto FLUSH;
when ''' =>
Alt := Alt_Apos'Access;
goto FLUSH;
when Ada.Characters.Latin_1.LF =>
goto NEW_LINE;
when Ada.Characters.Latin_1.CR =>
if I < Item'Last
and then Item (I + 1) = Ada.Characters.Latin_1.LF
then
goto CONTINUE; -- skip
else
goto NEW_LINE;
end if;
when others =>
Last := I;
goto CONTINUE;
end case;
<<NEW_LINE>>
case Version is
when HTML =>
Alt := Line_Break'Access;
when XHTML =>
Alt := Alt_LF'Access;
end case;
<<FLUSH>>
if First <= Last then
Write (Item (First .. Last), Params);
end if;
Write (Alt.all, Params);
First := I + 1;
goto CONTINUE;
<<CONTINUE>>
I := I + 1;
end loop;
if First <= Last then
Write (Item (First .. Last), Params);
end if;
end Write_In_Attribute_Internal;
Alt_Sp : aliased constant String := " ";
Alt_Amp : aliased constant String := "&";
Alt_LT : aliased constant String := "<";
Alt_GT : aliased constant String := ">";
Alt_BRO : aliased constant String := "<br>";
Alt_BRS : aliased constant String := "<br />";
procedure Write_In_HTML_Internal (
Version : in HTML_Version;
Item : in String;
Pre : in Boolean;
Params : in System.Address;
Write : not null access procedure (
Item : in String;
Params : in System.Address))
is
Alt : access constant String;
First : Positive := Item'First;
Last : Natural := First - 1;
In_Spaces : Boolean := True;
Previous_In_Spaces : Boolean;
I : Positive := Item'First;
begin
while I <= Item'Last loop
Previous_In_Spaces := In_Spaces;
In_Spaces := False;
case Item (I) is
when ' ' =>
if not Pre
and then (
Previous_In_Spaces or else (I < Item'Last and then Item (I + 1) = ' '))
then
In_Spaces := True;
Alt := Alt_Sp'Access;
goto FLUSH;
else
Last := I;
goto CONTINUE;
end if;
when '&' =>
Alt := Alt_Amp'Access;
goto FLUSH;
when '<' =>
Alt := Alt_LT'Access;
goto FLUSH;
when '>' =>
Alt := Alt_GT'Access;
goto FLUSH;
when Ada.Characters.Latin_1.LF =>
goto NEW_LINE;
when Ada.Characters.Latin_1.CR =>
if I < Item'Last and then Item (I + 1) = Ada.Characters.Latin_1.LF then
goto CONTINUE; -- skip
else
goto NEW_LINE;
end if;
when others =>
Last := I;
goto CONTINUE;
end case;
<<NEW_LINE>>
if Pre then
Alt := Line_Break'Access;
else
case Version is
when HTML =>
Alt := Alt_BRO'Access;
when XHTML =>
Alt := Alt_BRS'Access;
end case;
end if;
<<FLUSH>>
if First <= Last then
Write (Item (First .. Last), Params);
end if;
Write (Alt.all, Params);
First := I + 1;
goto CONTINUE;
<<CONTINUE>>
I := I + 1;
end loop;
if First <= Last then
Write (Item (First .. Last), Params);
end if;
end Write_In_HTML_Internal;
procedure Write_Query_In_Attribute_Internal (
Version : in HTML_Version;
Item : in Query_Strings;
Params : in System.Address;
Write : not null access procedure (
Item : in String;
Params : in System.Address)) is
begin
if not Item.Is_Empty then
declare
First : constant String_Maps.Cursor := Item.First;
Position : String_Maps.Cursor := First;
begin
while String_Maps.Has_Element (Position) loop
if Position = First then
Write ("?", Params);
else
Write ("&", Params);
end if;
Write_In_Attribute_Internal (Version, String_Maps.Key (Position), Params,
Write => Write);
Write ("=", Params);
Write_In_Attribute_Internal (Version, String_Maps.Element (Position), Params,
Write => Write);
String_Maps.Next (Position);
end loop;
end;
end if;
end Write_Query_In_Attribute_Internal;
procedure Write_Query_In_HTML_Internal (
Version : in HTML_Version;
Item : in Query_Strings;
Params : in System.Address;
Write : not null access procedure (
Item : in String;
Params : in System.Address))
is
Position : String_Maps.Cursor := Item.First;
begin
while String_Maps.Has_Element (Position) loop
Write ("<input type=""hidden"" name=""", Params);
Write_In_Attribute_Internal (Version, String_Maps.Key (Position), Params,
Write => Write);
Write (""" value=""", Params);
Write_In_Attribute_Internal (Version, String_Maps.Element (Position), Params,
Write => Write);
case Version is
when HTML =>
Write (""">", Params);
when XHTML =>
Write (""" />", Params);
end case;
String_Maps.Next (Position);
end loop;
end Write_Query_In_HTML_Internal;
Begin_Attribute : constant String := "=""";
End_Attribute : constant String := """";
-- implementation of input
function Checkbox_Value (S : String) return Boolean is
begin
return Equal_Case_Insensitive (S, L => "on");
end Checkbox_Value;
-- implementation of output
procedure Generic_Write_In_HTML (
Item : in String;
Pre : in Boolean := False)
is
procedure By_Callback (Item : in String; Params : in System.Address) is
pragma Unreferenced (Params);
begin
Write (Item);
end By_Callback;
begin
Write_In_HTML_Internal (Version, Item, Pre, System.Null_Address,
Write => By_Callback'Access);
end Generic_Write_In_HTML;
procedure Write_In_HTML (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Version : in HTML_Version;
Item : in String;
Pre : in Boolean := False)
is
function To_Address (Value : access Ada.Streams.Root_Stream_Type'Class)
return System.Address
with Import, Convention => Intrinsic;
begin
Write_In_HTML_Internal (Version, Item, Pre, To_Address (Stream),
Write => By_Stream'Access);
end Write_In_HTML;
procedure Generic_Write_Begin_Attribute (Name : in String) is
begin
Write (Name);
Write (Begin_Attribute);
end Generic_Write_Begin_Attribute;
procedure Write_Begin_Attribute (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Name : in String) is
begin
String'Write (Stream, Name);
String'Write (Stream, Begin_Attribute);
end Write_Begin_Attribute;
procedure Generic_Write_In_Attribute (Item : in String) is
procedure By_Callback (Item : in String; Params : in System.Address) is
pragma Unreferenced (Params);
begin
Write (Item);
end By_Callback;
begin
Write_In_Attribute_Internal (Version, Item, System.Null_Address,
Write => By_Callback'Access);
end Generic_Write_In_Attribute;
procedure Write_In_Attribute (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Version : in HTML_Version;
Item : in String)
is
function To_Address (Value : access Ada.Streams.Root_Stream_Type'Class)
return System.Address
with Import, Convention => Intrinsic;
begin
Write_In_Attribute_Internal (Version, Item, To_Address (Stream),
Write => By_Stream'Access);
end Write_In_Attribute;
procedure Generic_Write_End_Attribute is
begin
Write (End_Attribute);
end Generic_Write_End_Attribute;
procedure Write_End_Attribute (
Stream : not null access Ada.Streams.Root_Stream_Type'Class) is
begin
String'Write (Stream, End_Attribute);
end Write_End_Attribute;
procedure Generic_Write_Query_In_HTML (Item : in Query_Strings) is
procedure By_Callback (Item : in String; Params : in System.Address) is
pragma Unreferenced (Params);
begin
Write (Item);
end By_Callback;
begin
Write_Query_In_HTML_Internal (Version, Item, System.Null_Address,
Write => By_Callback'Access);
end Generic_Write_Query_In_HTML;
procedure Write_Query_In_HTML (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Version : in HTML_Version;
Item : in Query_Strings)
is
function To_Address (Value : access Ada.Streams.Root_Stream_Type'Class)
return System.Address
with Import, Convention => Intrinsic;
begin
Write_Query_In_HTML_Internal (Version, Item, To_Address (Stream),
Write => By_Stream'Access);
end Write_Query_In_HTML;
procedure Generic_Write_Query_In_Attribute (Item : in Query_Strings) is
procedure By_Callback (Item : in String; Params : in System.Address) is
pragma Unreferenced (Params);
begin
Write (Item);
end By_Callback;
begin
Write_Query_In_Attribute_Internal (Version, Item, System.Null_Address,
Write => By_Callback'Access);
end Generic_Write_Query_In_Attribute;
procedure Write_Query_In_Attribute (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Version : in HTML_Version;
Item : in Query_Strings)
is
function To_Address (Value : access Ada.Streams.Root_Stream_Type'Class)
return System.Address
with Import, Convention => Intrinsic;
begin
Write_Query_In_Attribute_Internal (Version, Item, To_Address (Stream),
Write => By_Stream'Access);
end Write_Query_In_Attribute;
end Web.HTML;
|
oeis/104/A104643.asm | neoneye/loda-programs | 11 | 101615 | ; A104643: Number of arrangements that can be formed by taking n distinct things out of 25.
; 1,25,600,13800,303600,6375600,127512000,2422728000,43609104000,741354768000,11861676288000,177925144320000,2490952020480000,32382376266240000,388588515194880000,4274473667143680000,42744736671436800000,384702630042931200000,3077621040343449600000,21543347282404147200000,129260083694424883200000,646300418472124416000000,2585201673888497664000000,7755605021665492992000000,15511210043330985984000000,15511210043330985984000000
add $0,1
mov $1,26
mov $4,2
lpb $0
sub $0,1
mov $3,$2
cmp $3,$2
cmp $3,0
sub $3,1
mul $4,$1
add $1,$3
lpe
mov $0,$4
div $0,52
|
oeis/121/A121627.asm | neoneye/loda-programs | 11 | 178046 | <filename>oeis/121/A121627.asm
; A121627: Real part of a complex operation analogous to the factorials.
; Submitted by <NAME>
; 1,0,-12,-96,-480,0,40320,645120,5806080,0,-1277337600,-30656102400,-398529331200,0,167382319104000,5356234211328000,91055981592576000,0,-62282291409321984000,-2491291656372879360000,-52317124783830466560000,0
mov $1,1
add $1,$0
mov $3,$0
lpb $3
mul $2,2
sub $2,$1
mul $1,$3
mul $2,$3
add $1,$2
sub $3,1
lpe
mov $0,$1
|
minibrainfuck.asm | DevAlone/BrainfuckMBR | 1 | 177588 | org 0x7C00; смещение, по которому будет лежать программа в оперативной памяти
; константы, описывающее место в памяти, куда пихаем данные для интерпретатора
bf_mem_seg equ 0x100
bf_mem_offset equ 0x0
bf_code_pos equ 0
bf_code_size equ 10000
bf_data_pos equ bf_code_size
bf_data_size equ 10000
VIDEO_PAGE equ 0
section .text
start:
mov ax, cs
mov ds, ax
%ifdef DEBUG
mov dx, 0
mov ax, 0000000011100011b
int 0x14
%endif
mov ax, 0x03; установить видео режим 0x0
int 0x10; вызываем прерывание
mov ax, 0x500; выбрать страницу видеопамяти 0x0
int 0x10
.main:
call clearScreen
;push word 0
mov dx, 0
call setCursor
;add sp, 2
; выводим стартовое сообщение
mov si, start_message
call print
; меняем сегменты данных
mov ax, bf_mem_seg
mov es, ax
mov ds, ax
; вводим программу
lea di, [bf_mem_offset +bf_code_pos]; куда пишем
xor cx, cx; счётчик записанных символов
.lp:
%ifdef DEBUG
; читаем из 0 serial port'а
mov ah, 0x02
mov dx, 0
int 0x14
%else
mov ah, 0x00; читаем символ
int 0x16
%endif
cmp al, 10; перенос строки
jz .endlp
cmp al, 13; возврат каретки
jz .endlp
; разрешаем только символы bf кода
; убрал т.к. это занимает аж 32 байта!
;cmp al, 43; +
;jz .print_sym
;cmp al, 45; -
;jz .print_sym
;cmp al, 46; .
;jz .print_sym
;cmp al, 44; ,
;jz .print_sym
;cmp al, 91; [
;jz .print_sym
;cmp al, 93; ]
;jz .print_sym
;cmp al, 60; <
;jz .print_sym
;cmp al, 62; >
;jz .print_sym
;jmp .do_not_print_sym
.print_sym:
mov ah, 0x0E; номер функции BIOS
mov bh, VIDEO_PAGE; страница видеопамяти
int 0x10; выводим символ
; в al ascii код символа
mov [di], byte al
inc di
inc cx
.do_not_print_sym:
cmp cx, bf_code_size
jng .lp
.endlp:
mov [di+1], byte 0; пишем конец строки
cmp cx, 0
;если пользователь ничего не ввёл, ошибка
je .end_with_error
;; проверяем баланс скобок
lea di, [bf_mem_offset +bf_code_pos]; куда пишем
xor cx, cx
.br_balance_lp:
mov al, [di]
cmp al, 0
jz .end_br_balance_lp
cmp al, '['
jnz .else_if
inc cx
.else_if:
cmp al, ']'
jnz .end_if
dec cx
.end_if:
inc di
cmp cx, 0
jl .end_with_error
jmp .br_balance_lp
.end_br_balance_lp:
cmp cx, 0
jnz .end_with_error
; создаём массив для хранения данных и зануляем его
lea di, [bf_mem_offset +bf_data_pos]; тут будет храниться массив с которым работает bf
mov cx, bf_data_size
.data_null_lp:
mov [di], byte 0
inc di
loop .data_null_lp
; интерпретируем
call clearScreen
;push word 0
mov dx, 0
call setCursor
;add sp, 2
lea di, [bf_mem_offset+bf_data_pos]; массив
xor bx, bx; указатель на ячейку массива
lea si, [bf_mem_offset +bf_code_pos] ; откуда берём команды
.interpreter:
mov al, byte [si]; загружаем символ
cmp al, 0;
je .end_interpreter
cmp al, 43; +
je .C0
cmp al, 45; -
je .C1
cmp al, 62; >
je .C2
cmp al, 60; <
je .C3
cmp al, 46; .
je .C4
cmp al, 44; ,
je .C5
cmp al, 91; [
je .C6
cmp al, 93; ]
je .C7
jmp .def
.C0:; +
inc byte [di+bx]
jmp .sw_end
.C1:; -
dec byte [di+bx]
jmp .sw_end
.C2:; >
cmp bx, bf_data_size-1
jnl .sw_end; если >= size-1
inc bx; иначе увеличиваем номер ячейки
jmp .sw_end
.C3:; <
cmp bx, 0
je .sw_end; если ноль выходим
dec bx; иначе уменьшаем номер ячейки
jmp .sw_end
.C4:; .
pusha; пушим всё в стек, чтоб случайно не поломать bx, cx и прочие нужные регистры
; делаем интерапт биоса
mov al, [di+bx]
mov ah, 0x0E; номер функции BIOS
mov bh, VIDEO_PAGE; страница видеопамяти
int 0x10; выводим символ
popa
jmp .sw_end
.C5:; ,
pusha
mov ah, 0x03; читаем позицию курсора
mov bh, VIDEO_PAGE; видео страница
int 0x10
;dh - строка
;dl - колонка
; положили в стек старые значения
push word dx
; перемещаем курсор в нижнюю строку экрана
;push word 0x1800; 24 строка 0 столбец
mov dx, 0x1800
call setCursor
;add sp, 2
push ds; запоминаем сегмент
mov ax, 0; меняем на нулевой, где хранятся все сообщения
;mov es, ax
mov ds, ax
;push word input_message
mov si, input_message
call print
;add sp, 2
pop ds
mov ah, 0x00; читаем символ
int 0x16
;cmp al, 0
;je .c5_end
;al
mov [di+bx], al; записываем в массив
; выводим его же
mov ah, 0x0E;
mov bh, VIDEO_PAGE;
int 0x10;
pop dx
call setCursor; исплользуются те значения, что были занесены в стек
;add sp, 2
.c5_end:
popa
jmp .sw_end
.C6:; [
cmp [di+bx], byte 0;
jnz .sw_end; если в текущей ячейке массива не ноль, выполняем то, что в теле цикла
; переходим на следующую ] с учётом вложенности
mov ax, 1; в прямом направлении
call loops_handler
dec si; на одну назад
jmp .sw_end
.C7:; ]
mov ax, -1; в обратном направлении
call loops_handler
jmp .sw_end
.def:
;jmp .error
.sw_end:
inc si
jmp .interpreter
.end_with_error:
mov bx, -1
jmp .end_prog
.end_interpreter:
mov bx, 0
.end_prog:
; возвращаем сегменты в прежнее состояние
push bx
mov ax, cs
mov es, ax; меняем сегмент памяти
mov ds, ax
; перемещаем курсор в нижнюю строку экрана
;push word 0x1800; 24 строка 0 столбец
mov dx, 0x1800
call setCursor
;add sp, 2
pop bx
cmp bx, 0
jz .no_error
;push word error_message
mov si, error_message
call print
;add sp, 2
.no_error:
;push finish_message
mov si, finish_message
call print
;add sp, 2
; ждём нажатия
mov ah, 0x00
int 0x16
jmp .main
.error:; пока не нужен
; handle error
;jmp .main
; end
; переходит на соответствующую скобку с учётом вложенности
; т.е. если в [si] находится '[', переходит на ']' и наоборот
; направление задаётся первым аргументом переданным через ax (1 или -1)
; меняет si
loops_handler:
;push bp
;mov bp, sp
enter 0, 0
push cx
xor cx, cx
.lp_br1:
cmp [si], byte '['
jnz .else_if1
inc cx
.else_if1:
cmp [si], byte ']'
jnz .end_if1
dec cx
.end_if1:
add si, ax
cmp cx, 0
jnz .lp_br1
pop cx
leave
;mov sp, bp
;pop bp
ret
; принимает адрес строки через si
print:
pusha
cld
mov ah, 0x0E; номер функции BIOS
mov bh, VIDEO_PAGE; страница видеопамяти
.puts_loop:
lodsb; загружаем очередной символ в al
test al, al; если 0, выходим
jz .exit_loop
int 0x10; иначе вызываем функцию bios
jmp .puts_loop
.exit_loop:
popa
ret
clearScreen:
pusha
;ah = 0x06; листать окно вверх
;al = 0; очистить окно
mov ax, 0x0600;
; левый верхний угол
xor cx, cx
; правый нижний угол
;dh = 25
;dl = 80
mov dx, 0x2580
mov bh, 00000010b; цвет
int 0x10
popa
ret
; void setCursor(dword xy)
; принимает координаты через dx
setCursor:
; enter 0, 0
pusha
; устанавливаем курсор в 0 0
mov ah, 0x02
mov bh, VIDEO_PAGE; страница видеопамяти
;mov dx, [bp+2+2]; первый аргумент
;dh line
;dl collumn
int 0x10
popa
; leave
ret
; просто функция для отладки
debug:
pusha
mov al, '&'
mov ah, 0x0E; номер функции BIOS
mov bh, VIDEO_PAGE; страница видеопамяти
int 0x10; выводим символ
jmp $
popa
ret
section .data
start_message db '$ ', 0
finish_message db 'press key to cont', 0
input_message db '> ', 0
error_message db 'err ', 0
;finish:
; times 512-finish-start db 0
; db 0x55, 0xAA; сигнатура загрузочного сектора
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-tasren.adb | djamal2727/Main-Bearing-Analytical-Model | 0 | 25543 | <gh_stars>0
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K I N G . R E N D E Z V O U S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 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. --
-- --
------------------------------------------------------------------------------
with System.Task_Primitives.Operations;
with System.Tasking.Entry_Calls;
with System.Tasking.Initialization;
with System.Tasking.Queuing;
with System.Tasking.Utilities;
with System.Tasking.Protected_Objects.Operations;
with System.Tasking.Debug;
with System.Restrictions;
package body System.Tasking.Rendezvous is
package STPO renames System.Task_Primitives.Operations;
package POO renames Protected_Objects.Operations;
package POE renames Protected_Objects.Entries;
use Task_Primitives.Operations;
type Select_Treatment is (
Accept_Alternative_Selected, -- alternative with non-null body
Accept_Alternative_Completed, -- alternative with null body
Else_Selected,
Terminate_Selected,
Accept_Alternative_Open,
No_Alternative_Open);
----------------
-- Local Data --
----------------
Default_Treatment : constant array (Select_Modes) of Select_Treatment :=
(Simple_Mode => No_Alternative_Open,
Else_Mode => Else_Selected,
Terminate_Mode => Terminate_Selected,
Delay_Mode => No_Alternative_Open);
New_State : constant array (Boolean, Entry_Call_State)
of Entry_Call_State :=
(True =>
(Never_Abortable => Never_Abortable,
Not_Yet_Abortable => Now_Abortable,
Was_Abortable => Now_Abortable,
Now_Abortable => Now_Abortable,
Done => Done,
Cancelled => Cancelled),
False =>
(Never_Abortable => Never_Abortable,
Not_Yet_Abortable => Not_Yet_Abortable,
Was_Abortable => Was_Abortable,
Now_Abortable => Now_Abortable,
Done => Done,
Cancelled => Cancelled)
);
-----------------------
-- Local Subprograms --
-----------------------
procedure Local_Defer_Abort (Self_Id : Task_Id) renames
System.Tasking.Initialization.Defer_Abort_Nestable;
procedure Local_Undefer_Abort (Self_Id : Task_Id) renames
System.Tasking.Initialization.Undefer_Abort_Nestable;
-- Florist defers abort around critical sections that make entry calls
-- to the Interrupt_Manager task, which violates the general rule about
-- top-level runtime system calls from abort-deferred regions. It is not
-- that this is unsafe, but when it occurs in "normal" programs it usually
-- means either the user is trying to do a potentially blocking operation
-- from within a protected object, or there is a runtime system/compiler
-- error that has failed to undefer an earlier abort deferral. Thus, for
-- debugging it may be wise to modify the above renamings to the
-- non-nestable forms.
procedure Local_Complete_Rendezvous (Ex : Ada.Exceptions.Exception_Id);
-- Internal version of Complete_Rendezvous, used to implement
-- Complete_Rendezvous and Exceptional_Complete_Rendezvous.
-- Should be called holding no locks, generally with abort
-- not yet deferred.
procedure Boost_Priority (Call : Entry_Call_Link; Acceptor : Task_Id);
pragma Inline (Boost_Priority);
-- Call this only with abort deferred and holding lock of Acceptor
procedure Call_Synchronous
(Acceptor : Task_Id;
E : Task_Entry_Index;
Uninterpreted_Data : System.Address;
Mode : Call_Modes;
Rendezvous_Successful : out Boolean);
pragma Inline (Call_Synchronous);
-- This call is used to make a simple or conditional entry call.
-- Called from Call_Simple and Task_Entry_Call.
procedure Setup_For_Rendezvous_With_Body
(Entry_Call : Entry_Call_Link;
Acceptor : Task_Id);
pragma Inline (Setup_For_Rendezvous_With_Body);
-- Call this only with abort deferred and holding lock of Acceptor. When
-- a rendezvous selected (ready for rendezvous) we need to save previous
-- caller and adjust the priority. Also we need to make this call not
-- Abortable (Cancellable) since the rendezvous has already been started.
procedure Wait_For_Call (Self_Id : Task_Id);
pragma Inline (Wait_For_Call);
-- Call this only with abort deferred and holding lock of Self_Id. An
-- accepting task goes into Sleep by calling this routine waiting for a
-- call from the caller or waiting for an abort. Make sure Self_Id is
-- locked before calling this routine.
-----------------
-- Accept_Call --
-----------------
procedure Accept_Call
(E : Task_Entry_Index;
Uninterpreted_Data : out System.Address)
is
Self_Id : constant Task_Id := STPO.Self;
Caller : Task_Id := null;
Open_Accepts : aliased Accept_List (1 .. 1);
Entry_Call : Entry_Call_Link;
begin
Initialization.Defer_Abort (Self_Id);
STPO.Write_Lock (Self_Id);
if not Self_Id.Callable then
pragma Assert (Self_Id.Pending_ATC_Level = Level_Completed_Task);
pragma Assert (Self_Id.Pending_Action);
STPO.Unlock (Self_Id);
Initialization.Undefer_Abort (Self_Id);
-- Should never get here ???
pragma Assert (False);
raise Standard'Abort_Signal;
end if;
Queuing.Dequeue_Head (Self_Id.Entry_Queues (E), Entry_Call);
if Entry_Call /= null then
Caller := Entry_Call.Self;
Setup_For_Rendezvous_With_Body (Entry_Call, Self_Id);
Uninterpreted_Data := Entry_Call.Uninterpreted_Data;
else
-- Wait for a caller
Open_Accepts (1).Null_Body := False;
Open_Accepts (1).S := E;
Self_Id.Open_Accepts := Open_Accepts'Unrestricted_Access;
-- Wait for normal call
pragma Debug
(Debug.Trace (Self_Id, "Accept_Call: wait", 'R'));
Wait_For_Call (Self_Id);
pragma Assert (Self_Id.Open_Accepts = null);
if Self_Id.Common.Call /= null then
Caller := Self_Id.Common.Call.Self;
pragma Assert (Caller.ATC_Nesting_Level > Level_No_ATC_Occurring);
Uninterpreted_Data :=
Caller.Entry_Calls (Caller.ATC_Nesting_Level).Uninterpreted_Data;
else
-- Case of an aborted task
Uninterpreted_Data := System.Null_Address;
end if;
end if;
-- Self_Id.Common.Call should already be updated by the Caller. On
-- return, we will start the rendezvous.
STPO.Unlock (Self_Id);
Initialization.Undefer_Abort (Self_Id);
end Accept_Call;
--------------------
-- Accept_Trivial --
--------------------
procedure Accept_Trivial (E : Task_Entry_Index) is
Self_Id : constant Task_Id := STPO.Self;
Caller : Task_Id := null;
Open_Accepts : aliased Accept_List (1 .. 1);
Entry_Call : Entry_Call_Link;
begin
Initialization.Defer_Abort_Nestable (Self_Id);
STPO.Write_Lock (Self_Id);
if not Self_Id.Callable then
pragma Assert (Self_Id.Pending_ATC_Level = Level_Completed_Task);
pragma Assert (Self_Id.Pending_Action);
STPO.Unlock (Self_Id);
Initialization.Undefer_Abort_Nestable (Self_Id);
-- Should never get here ???
pragma Assert (False);
raise Standard'Abort_Signal;
end if;
Queuing.Dequeue_Head (Self_Id.Entry_Queues (E), Entry_Call);
if Entry_Call = null then
-- Need to wait for entry call
Open_Accepts (1).Null_Body := True;
Open_Accepts (1).S := E;
Self_Id.Open_Accepts := Open_Accepts'Unrestricted_Access;
pragma Debug
(Debug.Trace (Self_Id, "Accept_Trivial: wait", 'R'));
Wait_For_Call (Self_Id);
pragma Assert (Self_Id.Open_Accepts = null);
-- No need to do anything special here for pending abort.
-- Abort_Signal will be raised by Undefer on exit.
STPO.Unlock (Self_Id);
-- Found caller already waiting
else
pragma Assert (Entry_Call.State < Done);
STPO.Unlock (Self_Id);
Caller := Entry_Call.Self;
STPO.Write_Lock (Caller);
Initialization.Wakeup_Entry_Caller (Self_Id, Entry_Call, Done);
STPO.Unlock (Caller);
end if;
Initialization.Undefer_Abort_Nestable (Self_Id);
end Accept_Trivial;
--------------------
-- Boost_Priority --
--------------------
procedure Boost_Priority (Call : Entry_Call_Link; Acceptor : Task_Id) is
Caller : constant Task_Id := Call.Self;
Caller_Prio : constant System.Any_Priority := Get_Priority (Caller);
Acceptor_Prio : constant System.Any_Priority := Get_Priority (Acceptor);
begin
if Caller_Prio > Acceptor_Prio then
Call.Acceptor_Prev_Priority := Acceptor_Prio;
Set_Priority (Acceptor, Caller_Prio);
else
Call.Acceptor_Prev_Priority := Priority_Not_Boosted;
end if;
end Boost_Priority;
-----------------
-- Call_Simple --
-----------------
procedure Call_Simple
(Acceptor : Task_Id;
E : Task_Entry_Index;
Uninterpreted_Data : System.Address)
is
Rendezvous_Successful : Boolean;
pragma Unreferenced (Rendezvous_Successful);
begin
-- If pragma Detect_Blocking is active then Program_Error must be
-- raised if this potentially blocking operation is called from a
-- protected action.
if System.Tasking.Detect_Blocking
and then STPO.Self.Common.Protected_Action_Nesting > 0
then
raise Program_Error with
"potentially blocking operation";
end if;
Call_Synchronous
(Acceptor, E, Uninterpreted_Data, Simple_Call, Rendezvous_Successful);
end Call_Simple;
----------------------
-- Call_Synchronous --
----------------------
procedure Call_Synchronous
(Acceptor : Task_Id;
E : Task_Entry_Index;
Uninterpreted_Data : System.Address;
Mode : Call_Modes;
Rendezvous_Successful : out Boolean)
is
Self_Id : constant Task_Id := STPO.Self;
Level : ATC_Level;
Entry_Call : Entry_Call_Link;
begin
pragma Assert (Mode /= Asynchronous_Call);
Local_Defer_Abort (Self_Id);
Self_Id.ATC_Nesting_Level := Self_Id.ATC_Nesting_Level + 1;
pragma Debug
(Debug.Trace (Self_Id, "CS: entered ATC level: " &
ATC_Level'Image (Self_Id.ATC_Nesting_Level), 'A'));
Level := Self_Id.ATC_Nesting_Level;
Entry_Call := Self_Id.Entry_Calls (Level)'Access;
Entry_Call.Next := null;
Entry_Call.Mode := Mode;
Entry_Call.Cancellation_Attempted := False;
-- If this is a call made inside of an abort deferred region,
-- the call should be never abortable.
Entry_Call.State :=
(if Self_Id.Deferral_Level > 1
then Never_Abortable
else Now_Abortable);
Entry_Call.E := Entry_Index (E);
Entry_Call.Prio := Get_Priority (Self_Id);
Entry_Call.Uninterpreted_Data := Uninterpreted_Data;
Entry_Call.Called_Task := Acceptor;
Entry_Call.Exception_To_Raise := Ada.Exceptions.Null_Id;
Entry_Call.With_Abort := True;
-- Note: the caller will undefer abort on return (see WARNING above)
if not Task_Do_Or_Queue (Self_Id, Entry_Call) then
STPO.Write_Lock (Self_Id);
Utilities.Exit_One_ATC_Level (Self_Id);
STPO.Unlock (Self_Id);
Local_Undefer_Abort (Self_Id);
raise Tasking_Error;
end if;
STPO.Write_Lock (Self_Id);
pragma Debug
(Debug.Trace (Self_Id, "Call_Synchronous: wait", 'R'));
Entry_Calls.Wait_For_Completion (Entry_Call);
pragma Debug
(Debug.Trace (Self_Id, "Call_Synchronous: done waiting", 'R'));
Rendezvous_Successful := Entry_Call.State = Done;
STPO.Unlock (Self_Id);
Local_Undefer_Abort (Self_Id);
Entry_Calls.Check_Exception (Self_Id, Entry_Call);
end Call_Synchronous;
--------------
-- Callable --
--------------
function Callable (T : Task_Id) return Boolean is
Result : Boolean;
Self_Id : constant Task_Id := STPO.Self;
begin
Initialization.Defer_Abort_Nestable (Self_Id);
STPO.Write_Lock (T);
Result := T.Callable;
STPO.Unlock (T);
Initialization.Undefer_Abort_Nestable (Self_Id);
return Result;
end Callable;
----------------------------
-- Cancel_Task_Entry_Call --
----------------------------
procedure Cancel_Task_Entry_Call (Cancelled : out Boolean) is
begin
Entry_Calls.Try_To_Cancel_Entry_Call (Cancelled);
end Cancel_Task_Entry_Call;
-------------------------
-- Complete_Rendezvous --
-------------------------
procedure Complete_Rendezvous is
begin
Local_Complete_Rendezvous (Ada.Exceptions.Null_Id);
end Complete_Rendezvous;
-------------------------------------
-- Exceptional_Complete_Rendezvous --
-------------------------------------
procedure Exceptional_Complete_Rendezvous
(Ex : Ada.Exceptions.Exception_Id)
is
procedure Internal_Reraise;
pragma No_Return (Internal_Reraise);
pragma Import (C, Internal_Reraise, "__gnat_reraise");
begin
Local_Complete_Rendezvous (Ex);
Internal_Reraise;
-- ??? Do we need to give precedence to Program_Error that might be
-- raised due to failure of finalization, over Tasking_Error from
-- failure of requeue?
end Exceptional_Complete_Rendezvous;
-------------------------------
-- Local_Complete_Rendezvous --
-------------------------------
procedure Local_Complete_Rendezvous (Ex : Ada.Exceptions.Exception_Id) is
Self_Id : constant Task_Id := STPO.Self;
Entry_Call : Entry_Call_Link := Self_Id.Common.Call;
Caller : Task_Id;
Called_PO : STPE.Protection_Entries_Access;
Acceptor_Prev_Priority : Integer;
Ceiling_Violation : Boolean;
use type Ada.Exceptions.Exception_Id;
procedure Transfer_Occurrence
(Target : Ada.Exceptions.Exception_Occurrence_Access;
Source : Ada.Exceptions.Exception_Occurrence);
pragma Import (C, Transfer_Occurrence, "__gnat_transfer_occurrence");
begin
-- The deferral level is critical here, since we want to raise an
-- exception or allow abort to take place, if there is an exception or
-- abort pending.
pragma Debug
(Debug.Trace (Self_Id, "Local_Complete_Rendezvous", 'R'));
if Ex = Ada.Exceptions.Null_Id then
-- The call came from normal end-of-rendezvous, so abort is not yet
-- deferred.
Initialization.Defer_Abort (Self_Id);
elsif ZCX_By_Default then
-- With ZCX, aborts are not automatically deferred in handlers
Initialization.Defer_Abort (Self_Id);
end if;
-- We need to clean up any accepts which Self may have been serving when
-- it was aborted.
if Ex = Standard'Abort_Signal'Identity then
while Entry_Call /= null loop
Entry_Call.Exception_To_Raise := Tasking_Error'Identity;
-- All forms of accept make sure that the acceptor is not
-- completed, before accepting further calls, so that we
-- can be sure that no further calls are made after the
-- current calls are purged.
Caller := Entry_Call.Self;
-- Take write lock. This follows the lock precedence rule that
-- Caller may be locked while holding lock of Acceptor. Complete
-- the call abnormally, with exception.
STPO.Write_Lock (Caller);
Initialization.Wakeup_Entry_Caller (Self_Id, Entry_Call, Done);
STPO.Unlock (Caller);
Entry_Call := Entry_Call.Acceptor_Prev_Call;
end loop;
else
Caller := Entry_Call.Self;
if Entry_Call.Needs_Requeue then
-- We dare not lock Self_Id at the same time as Caller, for fear
-- of deadlock.
Entry_Call.Needs_Requeue := False;
Self_Id.Common.Call := Entry_Call.Acceptor_Prev_Call;
if Entry_Call.Called_Task /= null then
-- Requeue to another task entry
if not Task_Do_Or_Queue (Self_Id, Entry_Call) then
Initialization.Undefer_Abort (Self_Id);
raise Tasking_Error;
end if;
else
-- Requeue to a protected entry
Called_PO := POE.To_Protection (Entry_Call.Called_PO);
STPE.Lock_Entries_With_Status (Called_PO, Ceiling_Violation);
if Ceiling_Violation then
pragma Assert (Ex = Ada.Exceptions.Null_Id);
Entry_Call.Exception_To_Raise := Program_Error'Identity;
STPO.Write_Lock (Caller);
Initialization.Wakeup_Entry_Caller
(Self_Id, Entry_Call, Done);
STPO.Unlock (Caller);
else
POO.PO_Do_Or_Queue (Self_Id, Called_PO, Entry_Call);
POO.PO_Service_Entries (Self_Id, Called_PO);
end if;
end if;
Entry_Calls.Reset_Priority
(Self_Id, Entry_Call.Acceptor_Prev_Priority);
else
-- The call does not need to be requeued
Self_Id.Common.Call := Entry_Call.Acceptor_Prev_Call;
Entry_Call.Exception_To_Raise := Ex;
STPO.Write_Lock (Caller);
-- Done with Caller locked to make sure that Wakeup is not lost
if Ex /= Ada.Exceptions.Null_Id then
Transfer_Occurrence
(Caller.Common.Compiler_Data.Current_Excep'Access,
Self_Id.Common.Compiler_Data.Current_Excep);
end if;
Acceptor_Prev_Priority := Entry_Call.Acceptor_Prev_Priority;
Initialization.Wakeup_Entry_Caller (Self_Id, Entry_Call, Done);
STPO.Unlock (Caller);
Entry_Calls.Reset_Priority (Self_Id, Acceptor_Prev_Priority);
end if;
end if;
Initialization.Undefer_Abort (Self_Id);
end Local_Complete_Rendezvous;
-------------------------------------
-- Requeue_Protected_To_Task_Entry --
-------------------------------------
procedure Requeue_Protected_To_Task_Entry
(Object : STPE.Protection_Entries_Access;
Acceptor : Task_Id;
E : Task_Entry_Index;
With_Abort : Boolean)
is
Entry_Call : constant Entry_Call_Link := Object.Call_In_Progress;
begin
pragma Assert (STPO.Self.Deferral_Level > 0);
Entry_Call.E := Entry_Index (E);
Entry_Call.Called_Task := Acceptor;
Entry_Call.Called_PO := Null_Address;
Entry_Call.With_Abort := With_Abort;
Object.Call_In_Progress := null;
end Requeue_Protected_To_Task_Entry;
------------------------
-- Requeue_Task_Entry --
------------------------
procedure Requeue_Task_Entry
(Acceptor : Task_Id;
E : Task_Entry_Index;
With_Abort : Boolean)
is
Self_Id : constant Task_Id := STPO.Self;
Entry_Call : constant Entry_Call_Link := Self_Id.Common.Call;
begin
Initialization.Defer_Abort (Self_Id);
Entry_Call.Needs_Requeue := True;
Entry_Call.With_Abort := With_Abort;
Entry_Call.E := Entry_Index (E);
Entry_Call.Called_Task := Acceptor;
Initialization.Undefer_Abort (Self_Id);
end Requeue_Task_Entry;
--------------------
-- Selective_Wait --
--------------------
procedure Selective_Wait
(Open_Accepts : Accept_List_Access;
Select_Mode : Select_Modes;
Uninterpreted_Data : out System.Address;
Index : out Select_Index)
is
Self_Id : constant Task_Id := STPO.Self;
Entry_Call : Entry_Call_Link;
Treatment : Select_Treatment;
Caller : Task_Id;
Selection : Select_Index;
Open_Alternative : Boolean;
begin
Initialization.Defer_Abort (Self_Id);
STPO.Write_Lock (Self_Id);
if not Self_Id.Callable then
pragma Assert (Self_Id.Pending_ATC_Level = Level_Completed_Task);
pragma Assert (Self_Id.Pending_Action);
STPO.Unlock (Self_Id);
-- ??? In some cases abort is deferred more than once. Need to
-- figure out why this happens.
if Self_Id.Deferral_Level > 1 then
Self_Id.Deferral_Level := 1;
end if;
Initialization.Undefer_Abort (Self_Id);
-- Should never get here ???
pragma Assert (False);
raise Standard'Abort_Signal;
end if;
pragma Assert (Open_Accepts /= null);
Uninterpreted_Data := Null_Address;
Queuing.Select_Task_Entry_Call
(Self_Id, Open_Accepts, Entry_Call, Selection, Open_Alternative);
-- Determine the kind and disposition of the select
Treatment := Default_Treatment (Select_Mode);
Self_Id.Chosen_Index := No_Rendezvous;
if Open_Alternative then
if Entry_Call /= null then
if Open_Accepts (Selection).Null_Body then
Treatment := Accept_Alternative_Completed;
else
Setup_For_Rendezvous_With_Body (Entry_Call, Self_Id);
Treatment := Accept_Alternative_Selected;
end if;
Self_Id.Chosen_Index := Selection;
elsif Treatment = No_Alternative_Open then
Treatment := Accept_Alternative_Open;
end if;
end if;
-- Handle the select according to the disposition selected above
case Treatment is
when Accept_Alternative_Selected =>
-- Ready to rendezvous
Uninterpreted_Data := Self_Id.Common.Call.Uninterpreted_Data;
-- In this case the accept body is not Null_Body. Defer abort
-- until it gets into the accept body. The compiler has inserted
-- a call to Abort_Undefer as part of the entry expansion.
pragma Assert (Self_Id.Deferral_Level = 1);
Initialization.Defer_Abort_Nestable (Self_Id);
STPO.Unlock (Self_Id);
when Accept_Alternative_Completed =>
-- Accept body is null, so rendezvous is over immediately
STPO.Unlock (Self_Id);
Caller := Entry_Call.Self;
STPO.Write_Lock (Caller);
Initialization.Wakeup_Entry_Caller (Self_Id, Entry_Call, Done);
STPO.Unlock (Caller);
when Accept_Alternative_Open =>
-- Wait for caller
Self_Id.Open_Accepts := Open_Accepts;
pragma Debug
(Debug.Trace (Self_Id, "Selective_Wait: wait", 'R'));
Wait_For_Call (Self_Id);
pragma Assert (Self_Id.Open_Accepts = null);
-- Self_Id.Common.Call should already be updated by the Caller if
-- not aborted. It might also be ready to do rendezvous even if
-- this wakes up due to an abort. Therefore, if the call is not
-- empty we need to do the rendezvous if the accept body is not
-- Null_Body.
-- Aren't the first two conditions below redundant???
if Self_Id.Chosen_Index /= No_Rendezvous
and then Self_Id.Common.Call /= null
and then not Open_Accepts (Self_Id.Chosen_Index).Null_Body
then
Uninterpreted_Data := Self_Id.Common.Call.Uninterpreted_Data;
pragma Assert
(Self_Id.Deferral_Level = 1
or else
(Self_Id.Deferral_Level = 0
and then not Restrictions.Abort_Allowed));
Initialization.Defer_Abort_Nestable (Self_Id);
-- Leave abort deferred until the accept body
-- The compiler has inserted a call to Abort_Undefer as part of
-- the entry expansion.
end if;
STPO.Unlock (Self_Id);
when Else_Selected =>
pragma Assert (Self_Id.Open_Accepts = null);
STPO.Unlock (Self_Id);
when Terminate_Selected =>
-- Terminate alternative is open
Self_Id.Open_Accepts := Open_Accepts;
Self_Id.Common.State := Acceptor_Sleep;
-- Notify ancestors that this task is on a terminate alternative
STPO.Unlock (Self_Id);
Utilities.Make_Passive (Self_Id, Task_Completed => False);
STPO.Write_Lock (Self_Id);
-- Wait for normal entry call or termination
Wait_For_Call (Self_Id);
pragma Assert (Self_Id.Open_Accepts = null);
if Self_Id.Terminate_Alternative then
-- An entry call should have reset this to False, so we must be
-- aborted. We cannot be in an async. select, since that is not
-- legal, so the abort must be of the entire task. Therefore,
-- we do not need to cancel the terminate alternative. The
-- cleanup will be done in Complete_Master.
pragma Assert
(Self_Id.Pending_ATC_Level = Level_Completed_Task);
pragma Assert (Self_Id.Awake_Count = 0);
STPO.Unlock (Self_Id);
Index := Self_Id.Chosen_Index;
Initialization.Undefer_Abort_Nestable (Self_Id);
if Self_Id.Pending_Action then
Initialization.Do_Pending_Action (Self_Id);
end if;
return;
else
-- Self_Id.Common.Call and Self_Id.Chosen_Index
-- should already be updated by the Caller.
if Self_Id.Chosen_Index /= No_Rendezvous
and then not Open_Accepts (Self_Id.Chosen_Index).Null_Body
then
Uninterpreted_Data := Self_Id.Common.Call.Uninterpreted_Data;
pragma Assert (Self_Id.Deferral_Level = 1);
-- We need an extra defer here, to keep abort
-- deferred until we get into the accept body
-- The compiler has inserted a call to Abort_Undefer as part
-- of the entry expansion.
Initialization.Defer_Abort_Nestable (Self_Id);
end if;
end if;
STPO.Unlock (Self_Id);
when No_Alternative_Open =>
-- In this case, Index will be No_Rendezvous on return, which
-- should cause a Program_Error if it is not a Delay_Mode.
-- If delay alternative exists (Delay_Mode) we should suspend
-- until the delay expires.
Self_Id.Open_Accepts := null;
if Select_Mode = Delay_Mode then
Self_Id.Common.State := Delay_Sleep;
loop
exit when
Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level;
Sleep (Self_Id, Delay_Sleep);
end loop;
Self_Id.Common.State := Runnable;
STPO.Unlock (Self_Id);
else
STPO.Unlock (Self_Id);
Initialization.Undefer_Abort (Self_Id);
raise Program_Error with "entry call not a delay mode";
end if;
end case;
-- Caller has been chosen
-- Self_Id.Common.Call should already be updated by the Caller.
-- Self_Id.Chosen_Index should either be updated by the Caller
-- or by Test_Selective_Wait.
-- On return, we sill start rendezvous unless the accept body is
-- null. In the latter case, we will have already completed the RV.
Index := Self_Id.Chosen_Index;
Initialization.Undefer_Abort_Nestable (Self_Id);
end Selective_Wait;
------------------------------------
-- Setup_For_Rendezvous_With_Body --
------------------------------------
procedure Setup_For_Rendezvous_With_Body
(Entry_Call : Entry_Call_Link;
Acceptor : Task_Id) is
begin
Entry_Call.Acceptor_Prev_Call := Acceptor.Common.Call;
Acceptor.Common.Call := Entry_Call;
if Entry_Call.State = Now_Abortable then
Entry_Call.State := Was_Abortable;
end if;
Boost_Priority (Entry_Call, Acceptor);
end Setup_For_Rendezvous_With_Body;
----------------
-- Task_Count --
----------------
function Task_Count (E : Task_Entry_Index) return Natural is
Self_Id : constant Task_Id := STPO.Self;
Return_Count : Natural;
begin
Initialization.Defer_Abort (Self_Id);
STPO.Write_Lock (Self_Id);
Return_Count := Queuing.Count_Waiting (Self_Id.Entry_Queues (E));
STPO.Unlock (Self_Id);
Initialization.Undefer_Abort (Self_Id);
return Return_Count;
end Task_Count;
----------------------
-- Task_Do_Or_Queue --
----------------------
function Task_Do_Or_Queue
(Self_ID : Task_Id;
Entry_Call : Entry_Call_Link) return Boolean
is
E : constant Task_Entry_Index :=
Task_Entry_Index (Entry_Call.E);
Old_State : constant Entry_Call_State := Entry_Call.State;
Acceptor : constant Task_Id := Entry_Call.Called_Task;
Parent : constant Task_Id := Acceptor.Common.Parent;
Null_Body : Boolean;
begin
-- Find out whether Entry_Call can be accepted immediately
-- If the Acceptor is not callable, return False.
-- If the rendezvous can start, initiate it.
-- If the accept-body is trivial, also complete the rendezvous.
-- If the acceptor is not ready, enqueue the call.
-- This should have a special case for Accept_Call and Accept_Trivial,
-- so that we don't have the loop setup overhead, below.
-- The call state Done is used here and elsewhere to include both the
-- case of normal successful completion, and the case of an exception
-- being raised. The difference is that if an exception is raised no one
-- will pay attention to the fact that State = Done. Instead the
-- exception will be raised in Undefer_Abort, and control will skip past
-- the place where we normally would resume from an entry call.
pragma Assert (not Queuing.Onqueue (Entry_Call));
-- We rely that the call is off-queue for protection, that the caller
-- will not exit the Entry_Caller_Sleep, and so will not reuse the call
-- record for another call. We rely on the Caller's lock for call State
-- mod's.
-- If Acceptor.Terminate_Alternative is True, we need to lock Parent and
-- Acceptor, in that order; otherwise, we only need a lock on Acceptor.
-- However, we can't check Acceptor.Terminate_Alternative until Acceptor
-- is locked. Therefore, we need to lock both. Attempts to avoid locking
-- Parent tend to result in race conditions. It would work to unlock
-- Parent immediately upon finding Acceptor.Terminate_Alternative to be
-- False, but that violates the rule of properly nested locking (see
-- System.Tasking).
STPO.Write_Lock (Parent);
STPO.Write_Lock (Acceptor);
-- If the acceptor is not callable, abort the call and return False
if not Acceptor.Callable then
STPO.Unlock (Acceptor);
STPO.Unlock (Parent);
pragma Assert (Entry_Call.State < Done);
-- In case we are not the caller, set up the caller
-- to raise Tasking_Error when it wakes up.
STPO.Write_Lock (Entry_Call.Self);
Entry_Call.Exception_To_Raise := Tasking_Error'Identity;
Initialization.Wakeup_Entry_Caller (Self_ID, Entry_Call, Done);
STPO.Unlock (Entry_Call.Self);
return False;
end if;
-- Try to serve the call immediately
if Acceptor.Open_Accepts /= null then
for J in Acceptor.Open_Accepts'Range loop
if Entry_Call.E = Entry_Index (Acceptor.Open_Accepts (J).S) then
-- Commit acceptor to rendezvous with us
Acceptor.Chosen_Index := J;
Null_Body := Acceptor.Open_Accepts (J).Null_Body;
Acceptor.Open_Accepts := null;
-- Prevent abort while call is being served
if Entry_Call.State = Now_Abortable then
Entry_Call.State := Was_Abortable;
end if;
if Acceptor.Terminate_Alternative then
-- Cancel terminate alternative. See matching code in
-- Selective_Wait and Vulnerable_Complete_Master.
Acceptor.Terminate_Alternative := False;
Acceptor.Awake_Count := Acceptor.Awake_Count + 1;
if Acceptor.Awake_Count = 1 then
-- Notify parent that acceptor is awake
pragma Assert (Parent.Awake_Count > 0);
Parent.Awake_Count := Parent.Awake_Count + 1;
if Parent.Common.State = Master_Completion_Sleep
and then Acceptor.Master_Of_Task = Parent.Master_Within
then
Parent.Common.Wait_Count :=
Parent.Common.Wait_Count + 1;
end if;
end if;
end if;
if Null_Body then
-- Rendezvous is over immediately
STPO.Wakeup (Acceptor, Acceptor_Sleep);
STPO.Unlock (Acceptor);
STPO.Unlock (Parent);
STPO.Write_Lock (Entry_Call.Self);
Initialization.Wakeup_Entry_Caller
(Self_ID, Entry_Call, Done);
STPO.Unlock (Entry_Call.Self);
else
Setup_For_Rendezvous_With_Body (Entry_Call, Acceptor);
-- For terminate_alternative, acceptor may not be asleep
-- yet, so we skip the wakeup
if Acceptor.Common.State /= Runnable then
STPO.Wakeup (Acceptor, Acceptor_Sleep);
end if;
STPO.Unlock (Acceptor);
STPO.Unlock (Parent);
end if;
return True;
end if;
end loop;
-- The acceptor is accepting, but not this entry
end if;
-- If the acceptor was ready to accept this call,
-- we would not have gotten this far, so now we should
-- (re)enqueue the call, if the mode permits that.
-- If the call is timed, it may have timed out before the requeue,
-- in the unusual case where the current accept has taken longer than
-- the given delay. In that case the requeue is cancelled, and the
-- outer timed call will be aborted.
if Entry_Call.Mode = Conditional_Call
or else
(Entry_Call.Mode = Timed_Call
and then Entry_Call.With_Abort
and then Entry_Call.Cancellation_Attempted)
then
STPO.Unlock (Acceptor);
STPO.Unlock (Parent);
STPO.Write_Lock (Entry_Call.Self);
pragma Assert (Entry_Call.State >= Was_Abortable);
Initialization.Wakeup_Entry_Caller (Self_ID, Entry_Call, Cancelled);
STPO.Unlock (Entry_Call.Self);
else
-- Timed_Call, Simple_Call, or Asynchronous_Call
Queuing.Enqueue (Acceptor.Entry_Queues (E), Entry_Call);
-- Update abortability of call
pragma Assert (Old_State < Done);
Entry_Call.State :=
New_State (Entry_Call.With_Abort, Entry_Call.State);
STPO.Unlock (Acceptor);
STPO.Unlock (Parent);
if Old_State /= Entry_Call.State
and then Entry_Call.State = Now_Abortable
and then Entry_Call.Mode /= Simple_Call
and then Entry_Call.Self /= Self_ID
-- Asynchronous_Call or Conditional_Call
then
-- Because of ATCB lock ordering rule
STPO.Write_Lock (Entry_Call.Self);
if Entry_Call.Self.Common.State = Async_Select_Sleep then
-- Caller may not yet have reached wait-point
STPO.Wakeup (Entry_Call.Self, Async_Select_Sleep);
end if;
STPO.Unlock (Entry_Call.Self);
end if;
end if;
return True;
end Task_Do_Or_Queue;
---------------------
-- Task_Entry_Call --
---------------------
procedure Task_Entry_Call
(Acceptor : Task_Id;
E : Task_Entry_Index;
Uninterpreted_Data : System.Address;
Mode : Call_Modes;
Rendezvous_Successful : out Boolean)
is
Self_Id : constant Task_Id := STPO.Self;
Entry_Call : Entry_Call_Link;
begin
-- If pragma Detect_Blocking is active then Program_Error must be
-- raised if this potentially blocking operation is called from a
-- protected action.
if System.Tasking.Detect_Blocking
and then Self_Id.Common.Protected_Action_Nesting > 0
then
raise Program_Error with
"potentially blocking operation";
end if;
if Mode = Simple_Call or else Mode = Conditional_Call then
Call_Synchronous
(Acceptor, E, Uninterpreted_Data, Mode, Rendezvous_Successful);
else
-- This is an asynchronous call
-- Abort must already be deferred by the compiler-generated code.
-- Without this, an abort that occurs between the time that this
-- call is made and the time that the abortable part's cleanup
-- handler is set up might miss the cleanup handler and leave the
-- call pending.
Self_Id.ATC_Nesting_Level := Self_Id.ATC_Nesting_Level + 1;
pragma Debug
(Debug.Trace (Self_Id, "TEC: entered ATC level: " &
ATC_Level'Image (Self_Id.ATC_Nesting_Level), 'A'));
Entry_Call := Self_Id.Entry_Calls (Self_Id.ATC_Nesting_Level)'Access;
Entry_Call.Next := null;
Entry_Call.Mode := Mode;
Entry_Call.Cancellation_Attempted := False;
Entry_Call.State := Not_Yet_Abortable;
Entry_Call.E := Entry_Index (E);
Entry_Call.Prio := Get_Priority (Self_Id);
Entry_Call.Uninterpreted_Data := Uninterpreted_Data;
Entry_Call.Called_Task := Acceptor;
Entry_Call.Called_PO := Null_Address;
Entry_Call.Exception_To_Raise := Ada.Exceptions.Null_Id;
Entry_Call.With_Abort := True;
if not Task_Do_Or_Queue (Self_Id, Entry_Call) then
STPO.Write_Lock (Self_Id);
Utilities.Exit_One_ATC_Level (Self_Id);
STPO.Unlock (Self_Id);
Initialization.Undefer_Abort (Self_Id);
raise Tasking_Error;
end if;
-- The following is special for async. entry calls. If the call was
-- not queued abortably, we need to wait until it is before
-- proceeding with the abortable part.
-- Wait_Until_Abortable can be called unconditionally here, but it is
-- expensive.
if Entry_Call.State < Was_Abortable then
Entry_Calls.Wait_Until_Abortable (Self_Id, Entry_Call);
end if;
-- Note: following assignment needs to be atomic
Rendezvous_Successful := Entry_Call.State = Done;
end if;
end Task_Entry_Call;
-----------------------
-- Task_Entry_Caller --
-----------------------
function Task_Entry_Caller (D : Task_Entry_Nesting_Depth) return Task_Id is
Self_Id : constant Task_Id := STPO.Self;
Entry_Call : Entry_Call_Link;
begin
Entry_Call := Self_Id.Common.Call;
for Depth in 1 .. D loop
Entry_Call := Entry_Call.Acceptor_Prev_Call;
pragma Assert (Entry_Call /= null);
end loop;
return Entry_Call.Self;
end Task_Entry_Caller;
--------------------------
-- Timed_Selective_Wait --
--------------------------
procedure Timed_Selective_Wait
(Open_Accepts : Accept_List_Access;
Select_Mode : Select_Modes;
Uninterpreted_Data : out System.Address;
Timeout : Duration;
Mode : Delay_Modes;
Index : out Select_Index)
is
Self_Id : constant Task_Id := STPO.Self;
Treatment : Select_Treatment;
Entry_Call : Entry_Call_Link;
Caller : Task_Id;
Selection : Select_Index;
Open_Alternative : Boolean;
Timedout : Boolean := False;
Yielded : Boolean := True;
begin
pragma Assert (Select_Mode = Delay_Mode);
Initialization.Defer_Abort (Self_Id);
-- If we are aborted here, the effect will be pending
STPO.Write_Lock (Self_Id);
if not Self_Id.Callable then
pragma Assert (Self_Id.Pending_ATC_Level = Level_Completed_Task);
pragma Assert (Self_Id.Pending_Action);
STPO.Unlock (Self_Id);
Initialization.Undefer_Abort (Self_Id);
-- Should never get here ???
pragma Assert (False);
raise Standard'Abort_Signal;
end if;
Uninterpreted_Data := Null_Address;
pragma Assert (Open_Accepts /= null);
Queuing.Select_Task_Entry_Call
(Self_Id, Open_Accepts, Entry_Call, Selection, Open_Alternative);
-- Determine the kind and disposition of the select
Treatment := Default_Treatment (Select_Mode);
Self_Id.Chosen_Index := No_Rendezvous;
if Open_Alternative then
if Entry_Call /= null then
if Open_Accepts (Selection).Null_Body then
Treatment := Accept_Alternative_Completed;
else
Setup_For_Rendezvous_With_Body (Entry_Call, Self_Id);
Treatment := Accept_Alternative_Selected;
end if;
Self_Id.Chosen_Index := Selection;
elsif Treatment = No_Alternative_Open then
Treatment := Accept_Alternative_Open;
end if;
end if;
-- Handle the select according to the disposition selected above
case Treatment is
when Accept_Alternative_Selected =>
-- Ready to rendezvous. In this case the accept body is not
-- Null_Body. Defer abort until it gets into the accept body.
Uninterpreted_Data := Self_Id.Common.Call.Uninterpreted_Data;
Initialization.Defer_Abort_Nestable (Self_Id);
STPO.Unlock (Self_Id);
when Accept_Alternative_Completed =>
-- Rendezvous is over
STPO.Unlock (Self_Id);
Caller := Entry_Call.Self;
STPO.Write_Lock (Caller);
Initialization.Wakeup_Entry_Caller (Self_Id, Entry_Call, Done);
STPO.Unlock (Caller);
when Accept_Alternative_Open =>
-- Wait for caller
Self_Id.Open_Accepts := Open_Accepts;
-- Wait for a normal call and a pending action until the
-- Wakeup_Time is reached.
Self_Id.Common.State := Acceptor_Delay_Sleep;
-- Try to remove calls to Sleep in the loop below by letting the
-- caller a chance of getting ready immediately, using Unlock
-- Yield. See similar action in Wait_For_Completion/Wait_For_Call.
Unlock (Self_Id);
if Self_Id.Open_Accepts /= null then
Yield;
end if;
Write_Lock (Self_Id);
-- Check if this task has been aborted while the lock was released
if Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level then
Self_Id.Open_Accepts := null;
end if;
loop
exit when Self_Id.Open_Accepts = null;
if Timedout then
Sleep (Self_Id, Acceptor_Delay_Sleep);
else
STPO.Timed_Sleep (Self_Id, Timeout, Mode,
Acceptor_Delay_Sleep, Timedout, Yielded);
end if;
if Timedout then
Self_Id.Open_Accepts := null;
end if;
end loop;
Self_Id.Common.State := Runnable;
-- Self_Id.Common.Call should already be updated by the Caller if
-- not aborted. It might also be ready to do rendezvous even if
-- this wakes up due to an abort. Therefore, if the call is not
-- empty we need to do the rendezvous if the accept body is not
-- Null_Body.
if Self_Id.Chosen_Index /= No_Rendezvous
and then Self_Id.Common.Call /= null
and then not Open_Accepts (Self_Id.Chosen_Index).Null_Body
then
Uninterpreted_Data := Self_Id.Common.Call.Uninterpreted_Data;
pragma Assert (Self_Id.Deferral_Level = 1);
Initialization.Defer_Abort_Nestable (Self_Id);
-- Leave abort deferred until the accept body
end if;
STPO.Unlock (Self_Id);
when No_Alternative_Open =>
-- In this case, Index will be No_Rendezvous on return. We sleep
-- for the time we need to.
-- Wait for a signal or timeout. A wakeup can be made
-- for several reasons:
-- 1) Delay is expired
-- 2) Pending_Action needs to be checked
-- (Abort, Priority change)
-- 3) Spurious wakeup
Self_Id.Open_Accepts := null;
Self_Id.Common.State := Acceptor_Delay_Sleep;
STPO.Timed_Sleep (Self_Id, Timeout, Mode, Acceptor_Delay_Sleep,
Timedout, Yielded);
Self_Id.Common.State := Runnable;
STPO.Unlock (Self_Id);
when others =>
-- Should never get here
pragma Assert (False);
null;
end case;
if not Yielded then
Yield;
end if;
-- Caller has been chosen
-- Self_Id.Common.Call should already be updated by the Caller
-- Self_Id.Chosen_Index should either be updated by the Caller
-- or by Test_Selective_Wait
Index := Self_Id.Chosen_Index;
Initialization.Undefer_Abort_Nestable (Self_Id);
-- Start rendezvous, if not already completed
end Timed_Selective_Wait;
---------------------------
-- Timed_Task_Entry_Call --
---------------------------
procedure Timed_Task_Entry_Call
(Acceptor : Task_Id;
E : Task_Entry_Index;
Uninterpreted_Data : System.Address;
Timeout : Duration;
Mode : Delay_Modes;
Rendezvous_Successful : out Boolean)
is
Self_Id : constant Task_Id := STPO.Self;
Level : ATC_Level;
Entry_Call : Entry_Call_Link;
Yielded : Boolean;
pragma Unreferenced (Yielded);
begin
-- If pragma Detect_Blocking is active then Program_Error must be
-- raised if this potentially blocking operation is called from a
-- protected action.
if System.Tasking.Detect_Blocking
and then Self_Id.Common.Protected_Action_Nesting > 0
then
raise Program_Error with
"potentially blocking operation";
end if;
Initialization.Defer_Abort (Self_Id);
Self_Id.ATC_Nesting_Level := Self_Id.ATC_Nesting_Level + 1;
pragma Debug
(Debug.Trace (Self_Id, "TTEC: entered ATC level: " &
ATC_Level'Image (Self_Id.ATC_Nesting_Level), 'A'));
Level := Self_Id.ATC_Nesting_Level;
Entry_Call := Self_Id.Entry_Calls (Level)'Access;
Entry_Call.Next := null;
Entry_Call.Mode := Timed_Call;
Entry_Call.Cancellation_Attempted := False;
-- If this is a call made inside of an abort deferred region,
-- the call should be never abortable.
Entry_Call.State :=
(if Self_Id.Deferral_Level > 1
then Never_Abortable
else Now_Abortable);
Entry_Call.E := Entry_Index (E);
Entry_Call.Prio := Get_Priority (Self_Id);
Entry_Call.Uninterpreted_Data := Uninterpreted_Data;
Entry_Call.Called_Task := Acceptor;
Entry_Call.Called_PO := Null_Address;
Entry_Call.Exception_To_Raise := Ada.Exceptions.Null_Id;
Entry_Call.With_Abort := True;
-- Note: the caller will undefer abort on return (see WARNING above)
if not Task_Do_Or_Queue (Self_Id, Entry_Call) then
STPO.Write_Lock (Self_Id);
Utilities.Exit_One_ATC_Level (Self_Id);
STPO.Unlock (Self_Id);
Initialization.Undefer_Abort (Self_Id);
raise Tasking_Error;
end if;
Write_Lock (Self_Id);
Entry_Calls.Wait_For_Completion_With_Timeout
(Entry_Call, Timeout, Mode, Yielded);
Unlock (Self_Id);
-- ??? Do we need to yield in case Yielded is False
Rendezvous_Successful := Entry_Call.State = Done;
Initialization.Undefer_Abort (Self_Id);
Entry_Calls.Check_Exception (Self_Id, Entry_Call);
end Timed_Task_Entry_Call;
-------------------
-- Wait_For_Call --
-------------------
procedure Wait_For_Call (Self_Id : Task_Id) is
begin
Self_Id.Common.State := Acceptor_Sleep;
-- Try to remove calls to Sleep in the loop below by letting the caller
-- a chance of getting ready immediately, using Unlock & Yield.
-- See similar action in Wait_For_Completion & Timed_Selective_Wait.
Unlock (Self_Id);
if Self_Id.Open_Accepts /= null then
Yield;
end if;
Write_Lock (Self_Id);
-- Check if this task has been aborted while the lock was released
if Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level then
Self_Id.Open_Accepts := null;
end if;
loop
exit when Self_Id.Open_Accepts = null;
Sleep (Self_Id, Acceptor_Sleep);
end loop;
Self_Id.Common.State := Runnable;
end Wait_For_Call;
end System.Tasking.Rendezvous;
|
third-party/gmp/gmp-src/mpn/arm64/bdiv_dbm1c.asm | jhh67/chapel | 1,602 | 492 | dnl ARM64 mpn_bdiv_dbm1c.
dnl Copyright 2008, 2011, 2012, 2014 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C Cortex-A53 8
C Cortex-A57 7
C X-Gene 4.25
define(`qp', `x0')
define(`up', `x1')
define(`n', `x2')
define(`bd', `x3')
define(`cy', `x4')
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_bdiv_dbm1c)
ldr x5, [up], #8
ands x6, n, #3
b.eq L(fi0)
cmp x6, #2
b.cc L(fi1)
b.eq L(fi2)
L(fi3): mul x12, x5, bd
umulh x13, x5, bd
ldr x5, [up], #8
b L(lo3)
L(fi0): mul x10, x5, bd
umulh x11, x5, bd
ldr x5, [up], #8
b L(lo0)
L(fi1): subs n, n, #1
mul x12, x5, bd
umulh x13, x5, bd
b.ls L(wd1)
ldr x5, [up], #8
b L(lo1)
L(fi2): mul x10, x5, bd
umulh x11, x5, bd
ldr x5, [up], #8
b L(lo2)
L(top): ldr x5, [up], #8
subs x4, x4, x10
str x4, [qp], #8
sbc x4, x4, x11
L(lo1): mul x10, x5, bd
umulh x11, x5, bd
ldr x5, [up], #8
subs x4, x4, x12
str x4, [qp], #8
sbc x4, x4, x13
L(lo0): mul x12, x5, bd
umulh x13, x5, bd
ldr x5, [up], #8
subs x4, x4, x10
str x4, [qp], #8
sbc x4, x4, x11
L(lo3): mul x10, x5, bd
umulh x11, x5, bd
ldr x5, [up], #8
subs x4, x4, x12
str x4, [qp], #8
sbc x4, x4, x13
L(lo2): subs n, n, #4
mul x12, x5, bd
umulh x13, x5, bd
b.hi L(top)
L(wd2): subs x4, x4, x10
str x4, [qp], #8
sbc x4, x4, x11
L(wd1): subs x4, x4, x12
str x4, [qp]
sbc x0, x4, x13
ret
EPILOGUE()
|
libsrc/_DEVELOPMENT/stdio/c/sccz80/vsnprintf_callee.asm | meesokim/z88dk | 0 | 95795 | <filename>libsrc/_DEVELOPMENT/stdio/c/sccz80/vsnprintf_callee.asm
; int vsnprintf(char *s, size_t n, const char *format, void *arg)
SECTION code_stdio
PUBLIC vsnprintf_callee
EXTERN asm_vsnprintf
vsnprintf_callee:
pop af
pop bc
pop de
exx
pop bc
pop de
exx
push af
jp asm_vsnprintf
|
libsrc/_DEVELOPMENT/adt/b_vector/c/sccz80/b_vector_capacity.asm | teknoplop/z88dk | 8 | 25490 | <gh_stars>1-10
; size_t b_vector_capacity(b_vector_t *v)
SECTION code_clib
SECTION code_adt_b_vector
PUBLIC b_vector_capacity
EXTERN asm_b_vector_capacity
defc b_vector_capacity = asm_b_vector_capacity
|
data/baseStats/venomoth.asm | etdv-thevoid/pokemon-rgb-enhanced | 1 | 177673 | db VENOMOTH ; pokedex id
db 70 ; base hp
db 65 ; base attack
db 60 ; base defense
db 90 ; base speed
db 90 ; base special
db BUG ; species type 1
db POISON ; species type 2
db 75 ; catch rate
db 138 ; base exp yield
INCBIN "pic/gsmon/venomoth.pic",0,1 ; 77, sprite dimensions
dw VenomothPicFront
dw VenomothPicBack
; attacks known at lvl 0
db TACKLE
db 0
db 0
db 0
db 0 ; growth rate
; learnset
tmlearn 2,4,6
tmlearn 9,10,12,15
tmlearn 20,21,22
tmlearn 29,31,32
tmlearn 33,34,37,39
tmlearn 44,46
tmlearn 50,55
db BANK(VenomothPicFront)
|
source/amf/mof/cmof/amf-internals-cmof_packages.ads | svn2github/matreshka | 24 | 1145 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.CMOF.Elements.Collections;
with AMF.CMOF.Named_Elements;
with AMF.CMOF.Namespaces;
with AMF.CMOF.Package_Merges.Collections;
with AMF.CMOF.Packageable_Elements.Collections;
with AMF.CMOF.Packages.Collections;
with AMF.CMOF.Types.Collections;
with AMF.Internals.CMOF_Named_Elements;
with AMF.Internals.CMOF_Namespaces;
pragma Elaborate (AMF.Internals.CMOF_Namespaces);
with AMF.String_Collections;
with AMF.Visitors;
package AMF.Internals.CMOF_Packages is
package CMOF_Namespace_Proxies is
new AMF.Internals.CMOF_Namespaces
(AMF.Internals.CMOF_Named_Elements.CMOF_Named_Element_Proxy);
type CMOF_Package_Proxy is
limited new CMOF_Namespace_Proxies.CMOF_Namespace_Proxy
and AMF.CMOF.Packages.CMOF_Package with null record;
-- XXX These subprograms are stubs
overriding function All_Owned_Elements
(Self : not null access constant CMOF_Package_Proxy)
return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element;
overriding function Must_Be_Owned
(Self : not null access constant CMOF_Package_Proxy)
return Boolean;
-- Operation Element::mustBeOwned.
--
-- The query mustBeOwned() indicates whether elements of this type must
-- have an owner. Subclasses of Element that do not require an owner must
-- override this operation.
overriding function Get_Qualified_Name
(Self : not null access constant CMOF_Package_Proxy)
return Optional_String;
overriding function Is_Distinguishable_From
(Self : not null access constant CMOF_Package_Proxy;
N : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access;
Ns : AMF.CMOF.Namespaces.CMOF_Namespace_Access)
return Boolean;
overriding function Imported_Member
(Self : not null access constant CMOF_Package_Proxy)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Get_Names_Of_Member
(Self : not null access constant CMOF_Package_Proxy;
Element : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access)
return AMF.String_Collections.Set_Of_String;
overriding function Import_Members
(Self : not null access constant CMOF_Package_Proxy;
Imps : AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Exclude_Collisions
(Self : not null access constant CMOF_Package_Proxy;
Imps : AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Members_Are_Distinguishable
(Self : not null access constant CMOF_Package_Proxy)
return Boolean;
overriding function Get_Packaged_Element
(Self : not null access constant CMOF_Package_Proxy)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Get_Owned_Type
(Self : not null access constant CMOF_Package_Proxy)
return AMF.CMOF.Types.Collections.Set_Of_CMOF_Type;
overriding function Get_Nested_Package
(Self : not null access constant CMOF_Package_Proxy)
return AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package;
overriding function Get_Nesting_Package
(Self : not null access constant CMOF_Package_Proxy)
return AMF.CMOF.Packages.CMOF_Package_Access;
overriding procedure Set_Nesting_Package
(Self : not null access CMOF_Package_Proxy;
To : AMF.CMOF.Packages.CMOF_Package_Access);
overriding function Get_Package_Merge
(Self : not null access constant CMOF_Package_Proxy)
return AMF.CMOF.Package_Merges.Collections.Set_Of_CMOF_Package_Merge;
-- Getter of Package::packageMerge.
--
-- References the PackageMerges that are owned by this Package.
overriding function Get_Uri
(Self : not null access constant CMOF_Package_Proxy)
return Optional_String;
overriding procedure Set_Uri
(Self : not null access CMOF_Package_Proxy;
To : Optional_String);
overriding function Visible_Members
(Self : not null access constant CMOF_Package_Proxy)
return AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element;
overriding function Makes_Visible
(Self : not null access constant CMOF_Package_Proxy;
El : AMF.CMOF.Named_Elements.CMOF_Named_Element_Access)
return Boolean;
overriding procedure Enter_Element
(Self : not null access constant CMOF_Package_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant CMOF_Package_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant CMOF_Package_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.CMOF_Packages;
|
source/tasking/required/s-parame.ads | ytomino/drake | 33 | 24807 | pragma License (Unrestricted);
-- implementation unit required by compiler
package System.Parameters is
pragma Pure;
-- required for task by compiler (s-parame.ads)
type Size_Type is new Integer;
Unspecified_Size : constant := Size_Type'First;
-- required for 'Storage_Size by compiler (s-parame.ads)
function Adjust_Storage_Size (Size : Size_Type) return Size_Type
renames "+"; -- no effect
-- required by compiler ??? (s-parame.ads)
-- function Default_Stack_Size return Size_Type;
-- Garbage_Collected : constant Boolean := False;
end System.Parameters;
|
libsrc/_DEVELOPMENT/font/fzx/fonts/dkud1/Edice13/_ff_dkud1_Edice13.asm | jpoikela/z88dk | 640 | 101633 |
SECTION rodata_font
SECTION rodata_font_fzx
PUBLIC _ff_dkud1_Edice13
_ff_dkud1_Edice13:
BINARY "font/fzx/fonts/dkud1/Edice13/edice13.fzx"
|
samples/beans/countries.adb | jquorning/ada-asf | 12 | 2589 | -----------------------------------------------------------------------
-- countries - A simple bean example
-- Copyright (C) 2012 <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 ASF.Models.Selects;
package body Countries is
-- ------------------------------
-- Get a select item list which contains a list of countries.
-- ------------------------------
function Create_Country_List return Util.Beans.Basic.Readonly_Bean_Access is
use ASF.Models.Selects;
Result : constant Select_Item_List_Access := new Select_Item_List;
begin
Result.Append (Label => "Andorra", Value => "AD");
Result.Append (Label => "Belgium", Value => "BE");
Result.Append (Label => "Canada", Value => "CA");
Result.Append (Label => "Denmark", Value => "DK");
Result.Append (Label => "Estonia", Value => "EE");
Result.Append (Label => "France", Value => "fr");
Result.Append (Label => "Germany", Value => "DE");
Result.Append (Label => "Hungary", Value => "HU");
Result.Append (Label => "Italy", Value => "IT");
Result.Append (Label => "Japan", Value => "JP");
Result.Append (Label => "Kosovo", Value => "XK");
Result.Append (Label => "Luxembourg", Value => "LT");
Result.Append (Label => "Martinique", Value => "MQ");
Result.Append (Label => "Netherlands", Value => "NL");
Result.Append (Label => "Oman", Value => "OM");
Result.Append (Label => "Portugal", Value => "PT");
Result.Append (Label => "Qatar", Value => "QA");
Result.Append (Label => "Russia", Value => "RU");
Result.Append (Label => "Spain", Value => "ES");
Result.Append (Label => "Taiwan", Value => "TW");
Result.Append (Label => "United States", Value => "US");
Result.Append (Label => "Vietnam", Value => "VN");
Result.Append (Label => "Western Sahara", Value => "EH");
Result.Append (Label => "Yemen", Value => "YE");
Result.Append (Label => "Zambia", Value => "ZM");
return Result.all'Access;
end Create_Country_List;
end Countries;
|
Transynther/x86/_processed/NC/_ht_/i7-8650U_0xd2.log_254_816.asm | ljhsiun2/medusa | 9 | 171759 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xc381, %rsi
nop
xor $43178, %r13
movw $0x6162, (%rsi)
nop
nop
nop
nop
nop
and %r15, %r15
lea addresses_D_ht+0x58f1, %rsi
lea addresses_WC_ht+0x109, %rdi
clflush (%rsi)
nop
and $52133, %rbp
mov $86, %rcx
rep movsw
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_A_ht+0x1b9f1, %rsi
lea addresses_normal_ht+0x25b1, %rdi
nop
nop
cmp $32819, %r15
mov $63, %rcx
rep movsw
nop
nop
dec %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r8
push %rax
push %rbx
push %rcx
push %rsi
// Load
lea addresses_RW+0x192e1, %rbx
clflush (%rbx)
nop
and %rsi, %rsi
movb (%rbx), %r14b
nop
nop
nop
add %r14, %r14
// Load
lea addresses_A+0x182f1, %rbx
clflush (%rbx)
xor $25871, %r10
vmovntdqa (%rbx), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rsi
nop
nop
nop
nop
nop
add %rbx, %rbx
// Store
lea addresses_D+0x126a1, %r8
nop
nop
add $2470, %rax
movb $0x51, (%r8)
nop
nop
inc %rbx
// Faulty Load
mov $0x5ed5ba00000004f1, %r8
nop
nop
nop
sub $63056, %rsi
vmovups (%r8), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $1, %xmm2, %r14
lea oracles, %rbx
and $0xff, %r14
shlq $12, %r14
mov (%rbx,%r14,1), %r14
pop %rsi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}}
{'46': 238, '45': 16}
46 46 46 46 46 46 46 46 46 46 46 46 46 45 46 46 46 46 45 46 46 46 46 45 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 45 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 45 46 46 46 46 46 45 45 46 46 46 46 46 46 46 46 46 45 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 45 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 45 46 46 46 45 46 46 46 46 46 46 46 46 46 45 46 46 46 46 46 46 46 46 46 46 46 46 46 45 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 45 46 46 46 45 46 46 46 46 46 46 46 46 46 46 45 46 46 46 46 46 46 46 46
*/
|
programs/oeis/021/A021841.asm | neoneye/loda | 22 | 23138 | ; A021841: Decimal expansion of 1/837.
; 0,0,1,1,9,4,7,4,3,1,3,0,2,2,7,0,0,1,1,9,4,7,4,3,1,3,0,2,2,7,0,0,1,1,9,4,7,4,3,1,3,0,2,2,7,0,0,1,1,9,4,7,4,3,1,3,0,2,2,7,0,0,1,1,9,4,7,4,3,1,3,0,2,2,7,0,0,1,1,9,4,7,4,3,1,3,0,2,2,7,0,0,1,1,9,4,7,4,3
add $0,1
mov $1,10
pow $1,$0
mul $1,4
div $1,3348
mod $1,10
mov $0,$1
|
Task/Pangram-checker/AppleScript/pangram-checker-2.applescript | LaudateCorpus1/RosettaCodeData | 1 | 217 | {false, true}
|
oeis/110/A110517.asm | neoneye/loda-programs | 11 | 98610 | <filename>oeis/110/A110517.asm
; A110517: Riordan array (1,x(1-3x)).
; Submitted by <NAME>
; 1,0,1,0,-3,1,0,0,-6,1,0,0,9,-9,1,0,0,0,27,-12,1,0,0,0,-27,54,-15,1,0,0,0,0,-108,90,-18,1,0,0,0,0,81,-270,135,-21,1,0,0,0,0,0,405,-540,189,-24,1,0,0,0,0,0,-243,1215,-945,252,-27,1,0,0,0,0,0,0,-1458,2835,-1512,324,-30,1,0,0,0,0,0,0,729,-5103,5670,-2268,405,-33,1,0,0,0,0,0,0,0,5103,-13608
lpb $0
add $1,1
sub $0,$1
mov $2,$1
sub $2,$0
lpe
mov $1,$0
mov $0,-3
pow $0,$2
bin $1,$2
mul $1,$0
mov $0,$1
|
programs/oeis/025/A025727.asm | neoneye/loda | 22 | 170031 | <reponame>neoneye/loda
; A025727: Index of 7^n within sequence of numbers of form 7^i*10^j.
; 1,2,4,7,11,16,22,28,35,43,52,62,73,84,96,109,123,138,154,171,188,206,225,245,266,288,310,333,357,382,408,435,463,491,520,550,581,613,646,679,713,748,784,821,859,898,937,977,1018,1060,1103,1147,1191,1236,1282,1329
lpb $0
mov $2,$0
sub $0,1
seq $2,210062 ; Number of digits in 7^n.
add $1,$2
lpe
add $1,1
mov $0,$1
|
commands/apps/amphetamine/amphetamine-on.applescript | tanaynistala/script-commands | 5 | 1708 | <filename>commands/apps/amphetamine/amphetamine-on.applescript<gh_stars>1-10
#!/usr/bin/osascript
# @raycast.title Start Default Session
# @raycast.author <NAME>
# @raycast.authorURL https://github.com/jamesjlyons
# @raycast.description Start Default Amphetamine Session
# @raycast.icon images/amphetamine.png
# @raycast.mode silent
# @raycast.packageName Amphetamine
# @raycast.schemaVersion 1
tell application "Amphetamine" to start new session
log "Started default session" |
regtests/util-streams-buffered-lzma-tests.adb | RREE/ada-util | 60 | 1406 | <filename>regtests/util-streams-buffered-lzma-tests.adb<gh_stars>10-100
-----------------------------------------------------------------------
-- util-streams-buffered-lzma-tests -- Unit tests for encoding buffered streams
-- Copyright (C) 2018, 2019, 2021 <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 Util.Test_Caller;
with Util.Streams.Files;
with Util.Streams.Texts;
with Util.Streams.AES;
with Util.Encoders.AES;
with Ada.Streams.Stream_IO;
package body Util.Streams.Buffered.Lzma.Tests is
use Util.Streams.Files;
use Ada.Streams.Stream_IO;
procedure Test_Stream_File (T : in out Test;
Item : in String;
Count : in Positive;
Encrypt : in Boolean;
Mode : in Util.Encoders.AES.AES_Mode;
Label : in String);
package Caller is new Util.Test_Caller (Test, "Streams.Buffered.Lzma");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Util.Streams.Buffered.Lzma.Write",
Test_Compress_Stream'Access);
Caller.Add_Test (Suite, "Test Util.Streams.Buffered.Lzma.Write (2)",
Test_Compress_File_Stream'Access);
Caller.Add_Test (Suite, "Test Util.Streams.Buffered.Lzma.Read+Write",
Test_Compress_Decompress_Stream'Access);
Caller.Add_Test (Suite, "Test Util.Streams.Buffered.Lzma.Read+Write+AES-CBC",
Test_Compress_Encrypt_Decompress_Decrypt_Stream'Access);
end Add_Tests;
procedure Test_Compress_Stream (T : in out Test) is
Stream : aliased File_Stream;
Buffer : aliased Util.Streams.Buffered.Lzma.Compress_Stream;
Print : Util.Streams.Texts.Print_Stream;
Path : constant String := Util.Tests.Get_Test_Path ("test-stream.lzma");
Expect : constant String := Util.Tests.Get_Path ("regtests/expect/test-stream.lzma");
begin
Stream.Create (Mode => Out_File, Name => Path);
Buffer.Initialize (Output => Stream'Unchecked_Access,
Size => 1024);
Print.Initialize (Output => Buffer'Unchecked_Access, Size => 5);
for I in 1 .. 32 loop
Print.Write ("abcd");
Print.Write (" fghij");
Print.Write (ASCII.LF);
end loop;
Print.Flush;
Stream.Close;
Util.Tests.Assert_Equal_Files (T => T,
Expect => Expect,
Test => Path,
Message => "LZMA stream");
end Test_Compress_Stream;
procedure Test_Compress_File_Stream (T : in out Test) is
Stream : aliased File_Stream;
In_Stream : aliased File_Stream;
Buffer : aliased Util.Streams.Buffered.Lzma.Compress_Stream;
Path : constant String
:= Util.Tests.Get_Test_Path ("test-big-stream.lzma");
Expect : constant String
:= Util.Tests.Get_Path ("regtests/expect/test-big-stream.lzma");
begin
In_Stream.Open (Ada.Streams.Stream_IO.In_File,
Util.Tests.Get_Path ("regtests/files/test-big-stream.bin"));
Stream.Create (Mode => Out_File, Name => Path);
Buffer.Initialize (Output => Stream'Unchecked_Access,
Size => 32768);
Util.Streams.Copy (From => In_Stream, Into => Buffer);
Buffer.Flush;
Buffer.Close;
Util.Tests.Assert_Equal_Files (T => T,
Expect => Expect,
Test => Path,
Message => "LZMA stream");
end Test_Compress_File_Stream;
procedure Test_Stream_File (T : in out Test;
Item : in String;
Count : in Positive;
Encrypt : in Boolean;
Mode : in Util.Encoders.AES.AES_Mode;
Label : in String) is
use Ada.Strings.Unbounded;
Path : constant String
:= Util.Tests.Get_Test_Path ("stream-lzma-aes-" & Label & ".aes");
Key : constant Util.Encoders.Secret_Key
:= Util.Encoders.Create ("<KEY>");
File : aliased File_Stream;
Decipher : aliased Util.Streams.AES.Decoding_Stream;
Cipher : aliased Util.Streams.AES.Encoding_Stream;
Compress : aliased Util.Streams.Buffered.Lzma.Compress_Stream;
Decompress : aliased Util.Streams.Buffered.Lzma.Decompress_Stream;
Print : Util.Streams.Texts.Print_Stream;
Reader : Util.Streams.Texts.Reader_Stream;
begin
-- Print -> Compress -> Cipher -> File
File.Create (Mode => Out_File, Name => Path);
if Encrypt then
Cipher.Produces (File'Unchecked_Access, 64);
Cipher.Set_Key (Key, Mode);
Compress.Initialize (Cipher'Unchecked_Access, 1024);
else
Compress.Initialize (File'Unchecked_Access, 1024);
end if;
Print.Initialize (Compress'Unchecked_Access);
for I in 1 .. Count loop
Print.Write (Item & ASCII.LF);
end loop;
Print.Close;
-- File -> Decipher -> Decompress -> Reader
File.Open (Mode => In_File, Name => Path);
if Encrypt then
Decipher.Consumes (File'Unchecked_Access, 128);
Decipher.Set_Key (Key, Mode);
Decompress.Initialize (Decipher'Unchecked_Access, 1024);
else
Decompress.Initialize (File'Unchecked_Access, 1024);
end if;
Reader.Initialize (From => Decompress'Unchecked_Access);
declare
Line_Count : Natural := 0;
begin
while not Reader.Is_Eof loop
declare
Line : Unbounded_String;
begin
Reader.Read_Line (Line);
exit when Length (Line) = 0;
if Item & ASCII.LF /= Line then
Util.Tests.Assert_Equals (T, Item & ASCII.LF, To_String (Line));
end if;
Line_Count := Line_Count + 1;
end;
end loop;
File.Close;
Util.Tests.Assert_Equals (T, Count, Line_Count);
end;
end Test_Stream_File;
procedure Test_Compress_Decompress_Stream (T : in out Test) is
begin
Test_Stream_File (T, "abcdefgh", 1000, False, Util.Encoders.AES.CBC, "NONE");
end Test_Compress_Decompress_Stream;
procedure Test_Compress_Encrypt_Decompress_Decrypt_Stream (T : in out Test) is
begin
Test_Stream_File (T, "abcdefgh", 1000, True, Util.Encoders.AES.CBC, "AES-CBC");
end Test_Compress_Encrypt_Decompress_Decrypt_Stream;
end Util.Streams.Buffered.Lzma.Tests;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_19218_1420.asm | ljhsiun2/medusa | 9 | 92449 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r13
push %r14
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xde7, %rsi
lea addresses_WC_ht+0x12ae7, %rdi
nop
nop
nop
nop
nop
sub $8898, %r10
mov $48, %rcx
rep movsb
nop
nop
nop
nop
nop
add %r13, %r13
lea addresses_A_ht+0x1e5e7, %r14
nop
nop
nop
xor %r12, %r12
movw $0x6162, (%r14)
nop
nop
nop
cmp %r10, %r10
lea addresses_WT_ht+0x33e7, %r12
nop
nop
nop
nop
cmp %rsi, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, (%r12)
nop
nop
nop
add $18661, %r13
lea addresses_WT_ht+0x19287, %r12
nop
nop
add $8712, %rdi
mov (%r12), %r14
nop
nop
nop
add $29357, %r14
lea addresses_WC_ht+0x74e7, %rcx
nop
xor %rdi, %rdi
mov $0x6162636465666768, %rsi
movq %rsi, %xmm5
vmovups %ymm5, (%rcx)
add $6660, %r12
lea addresses_UC_ht+0x16139, %rsi
lea addresses_normal_ht+0x33cf, %rdi
nop
nop
nop
dec %r11
mov $3, %rcx
rep movsl
nop
nop
nop
dec %r13
lea addresses_UC_ht+0x3fa7, %rsi
lea addresses_WT_ht+0xeae7, %rdi
nop
nop
nop
nop
nop
xor %r10, %r10
mov $56, %rcx
rep movsl
cmp %r14, %r14
lea addresses_normal_ht+0x1cc3f, %rsi
nop
nop
nop
nop
cmp %r10, %r10
movb $0x61, (%rsi)
nop
nop
nop
add $48027, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r14
pop %r13
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r8
push %r9
push %rax
push %rbx
push %rcx
push %rdi
// Load
lea addresses_RW+0x1b297, %rcx
nop
nop
nop
nop
add $16121, %r8
vmovups (%rcx), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %rdi
nop
nop
nop
dec %rax
// Store
mov $0x5c85b9000000020f, %rbx
nop
nop
xor %r12, %r12
mov $0x5152535455565758, %r9
movq %r9, %xmm5
vmovaps %ymm5, (%rbx)
nop
dec %rcx
// Store
lea addresses_UC+0xe7e7, %rax
sub $24863, %r8
movw $0x5152, (%rax)
sub $41607, %r8
// Faulty Load
lea addresses_PSE+0x1dde7, %rax
nop
nop
nop
sub $35095, %rcx
mov (%rax), %r9
lea oracles, %rax
and $0xff, %r9
shlq $12, %r9
mov (%rax,%r9,1), %r9
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_PSE', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_RW', 'congruent': 4}}
{'dst': {'same': False, 'NT': True, 'AVXalign': True, 'size': 32, 'type': 'addresses_NC', 'congruent': 2}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_UC', 'congruent': 9}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_PSE', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A_ht', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 7}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 4}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 7}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_normal_ht', 'congruent': 1}, 'OP': 'STOR'}
{'33': 19218}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sccz80/esx_f_trunc.asm | Toysoft/z88dk | 0 | 246229 | ; unsigned char esx_f_trunc(unsigned char *filename,uint32_t size)
SECTION code_esxdos
PUBLIC esx_f_trunc
EXTERN asm_esx_f_trunc
esx_f_trunc:
pop af
pop de
pop bc
pop hl
push hl
push bc
push de
push af
jp asm_esx_f_trunc
|
src/day-4/adventofcode-day_4.adb | persan/advent-of-code-2020 | 0 | 24651 | pragma Ada_2012;
with Ada.Strings.Fixed;
with Adventofcode.File_Line_Readers;
with GNAT.String_Split;
package body Adventofcode.Day_4 is
use Ada.Strings.Fixed;
------------
-- Adjust --
------------
overriding procedure Adjust (P : in out Passport) is
begin
P.Hair_Color := (if P.Hair_Color /= null then new String'(P.Hair_Color.all) else null);
P.Eye_Color := (if P.Eye_Color /= null then new String'(P.Eye_Color.all) else null);
P.Passport_ID := (if P.Passport_ID /= null then new String'(P.Passport_ID.all) else null);
P.Height := (if P.Height /= null then new String'(P.Height.all) else null);
end Adjust;
--------------
-- Finalize --
--------------
overriding procedure Finalize (P : in out Passport) is
begin
Free (P.Hair_Color);
Free (P.Eye_Color);
Free (P.Passport_ID);
Free (P.Height);
end Finalize;
procedure Check_Validty (P : in out Passport) is
begin
null;
end Check_Validty;
----------
-- Read --
----------
procedure Read (Passports : in out Passport_Vector; From_Path : String) is
Temp : Passport;
begin
Temp := Null_Passport;
for Line of Adventofcode.File_Line_Readers.Read_Lines (From_Path) loop
if Line'Length > 0 then
Temp.Append (Line);
else
Temp.Check_Validty;
Passports.Append (Temp);
Temp := Null_Passport;
end if;
end loop;
if Temp /= Null_Passport then
Temp.Check_Validty;
Passports.Append (Temp);
end if;
end Read;
procedure Append (Self : in out Passport; Fields : String) is
begin
-- for F of GNAT.String_Split.Create (Fields, " " & ASCII.LF & ASCII.CR) loop
-- declare
-- Separator_Index : constant Natural := Index (F, ":");
-- Key : constant String := F (F'First .. Separator_Index - 1);
-- Value : constant String := F (Separator_Index + 1 .. F'Last);
-- begin
-- if Key = "byr" then
-- Self.Birth_Year := Year_Type'Value (Value);
--
-- elsif Key = "iyr" then
-- Self.Issue_Year := Year_Type'Value (Value);
--
-- elsif Key = "eyr" then
-- Self.Expiration_Year := Year_Type'Value (Value);
--
-- elsif Key = "hgt" then
-- Self.Height := new String'(Value);
--
-- elsif Key = "hcl" then
-- Self.Hair_Color := new String'(Value);
--
-- elsif Key = "ecl" then
-- Self.Eye_Color := new String'(Value);
--
-- elsif Key = "pid" then
-- Self.Passport_ID := new String'(Value);
--
-- elsif Key = "cid" then
-- Self.Country_ID := Country_ID_Type'Value (Value);
--
-- else
-- raise Constraint_Error with "invalid Key:" & Key;
-- end if;
-- end;
-- end loop;
null;
end;
function Count_Valid (Passports : Passport_Vector) return Natural is
begin
return Valid_Passports : Natural := 0 do
for Passport of Passports loop
if Passport.Is_Valid then
Valid_Passports := Valid_Passports + 1;
end if;
end loop;
end return;
end;
end Adventofcode.Day_4;
|
F0xC_i8086/include/util/sleep.asm | Pusty/F0xC | 0 | 24716 | %ifndef SLEEP
%define SLEEP
sleep:; input si: delay in 1.024*ms
xor ax,ax ;clear eax for using it as nanosec storeage
mov ax,si
push cx
mov cl, 10
shl ax, cl
pop cx
;shl eax,10
;eax=2^10*si
mov dx,ax
;shr eax,16
push cx
mov cl, 16
shr ax, cl
pop cx
mov cx,ax
;dx,cx=eax
mov ah, 86h
int 15h;CX,DX interval in microseconds (1,000,000ths of a second) - CX is high word, DX is low word
ret
%endif
|
coverage/IN_CTS/0490-COVERAGE-nir-split-vars-1199/work/variant/1_spirv_asm/shader.frag.asm | asuonpaa/ShaderTests | 0 | 82693 | ; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 10
; Bound: 112
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main" %93
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 320
OpName %4 "main"
OpName %7 "S"
OpMemberName %7 0 "data"
OpName %13 "func(struct-S-i11;i1;"
OpName %11 "s"
OpName %12 "x"
OpName %18 "buf0"
OpMemberName %18 0 "_GLF_uniform_int_values"
OpName %20 ""
OpName %35 "i"
OpName %47 "arr"
OpName %59 "index"
OpName %61 "param"
OpName %64 "param"
OpName %72 "param"
OpName %75 "param"
OpName %93 "_GLF_color"
OpDecorate %17 ArrayStride 16
OpMemberDecorate %18 0 Offset 0
OpDecorate %18 Block
OpDecorate %20 DescriptorSet 0
OpDecorate %20 Binding 0
OpDecorate %93 Location 0
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeInt 32 1
%7 = OpTypeStruct %6
%8 = OpTypePointer Function %7
%9 = OpTypePointer Function %6
%10 = OpTypeFunction %2 %8 %9
%15 = OpTypeInt 32 0
%16 = OpConstant %15 3
%17 = OpTypeArray %6 %16
%18 = OpTypeStruct %17
%19 = OpTypePointer Uniform %18
%20 = OpVariable %19 Uniform
%21 = OpConstant %6 0
%22 = OpConstant %6 1
%23 = OpTypePointer Uniform %6
%28 = OpTypeBool
%42 = OpConstant %6 10
%44 = OpConstant %15 10
%45 = OpTypeArray %7 %44
%46 = OpTypePointer Function %45
%90 = OpTypeFloat 32
%91 = OpTypeVector %90 4
%92 = OpTypePointer Output %91
%93 = OpVariable %92 Output
%4 = OpFunction %2 None %3
%5 = OpLabel
%35 = OpVariable %9 Function
%47 = OpVariable %46 Function
%59 = OpVariable %9 Function
%61 = OpVariable %8 Function
%64 = OpVariable %9 Function
%72 = OpVariable %8 Function
%75 = OpVariable %9 Function
OpStore %35 %21
OpBranch %36
%36 = OpLabel
OpLoopMerge %38 %39 None
OpBranch %40
%40 = OpLabel
%41 = OpLoad %6 %35
%43 = OpSLessThan %28 %41 %42
OpBranchConditional %43 %37 %38
%37 = OpLabel
%48 = OpLoad %6 %35
%49 = OpAccessChain %9 %47 %48 %21
OpStore %49 %21
OpBranch %39
%39 = OpLabel
%50 = OpLoad %6 %35
%51 = OpIAdd %6 %50 %22
OpStore %35 %51
OpBranch %36
%38 = OpLabel
%52 = OpAccessChain %23 %20 %21 %22
%53 = OpLoad %6 %52
%54 = OpAccessChain %23 %20 %21 %21
%55 = OpLoad %6 %54
%56 = OpIEqual %28 %53 %55
OpSelectionMerge %58 None
OpBranchConditional %56 %57 %69
%57 = OpLabel
%60 = OpLoad %6 %59
%62 = OpAccessChain %8 %47 %60
%63 = OpLoad %7 %62
OpStore %61 %63
%65 = OpLoad %6 %59
OpStore %64 %65
%66 = OpFunctionCall %2 %13 %61 %64
%67 = OpLoad %7 %61
%68 = OpAccessChain %8 %47 %60
OpStore %68 %67
OpBranch %58
%69 = OpLabel
%70 = OpAccessChain %23 %20 %21 %21
%71 = OpLoad %6 %70
%73 = OpAccessChain %8 %47 %71
%74 = OpLoad %7 %73
OpStore %72 %74
%76 = OpAccessChain %23 %20 %21 %22
%77 = OpLoad %6 %76
OpStore %75 %77
%78 = OpFunctionCall %2 %13 %72 %75
%79 = OpLoad %7 %72
%80 = OpAccessChain %8 %47 %71
OpStore %80 %79
OpBranch %58
%58 = OpLabel
%81 = OpAccessChain %23 %20 %21 %21
%82 = OpLoad %6 %81
%83 = OpAccessChain %9 %47 %82 %21
%84 = OpLoad %6 %83
%85 = OpAccessChain %23 %20 %21 %22
%86 = OpLoad %6 %85
%87 = OpIEqual %28 %84 %86
OpSelectionMerge %89 None
OpBranchConditional %87 %88 %107
%88 = OpLabel
%94 = OpAccessChain %23 %20 %21 %22
%95 = OpLoad %6 %94
%96 = OpConvertSToF %90 %95
%97 = OpAccessChain %23 %20 %21 %21
%98 = OpLoad %6 %97
%99 = OpConvertSToF %90 %98
%100 = OpAccessChain %23 %20 %21 %21
%101 = OpLoad %6 %100
%102 = OpConvertSToF %90 %101
%103 = OpAccessChain %23 %20 %21 %22
%104 = OpLoad %6 %103
%105 = OpConvertSToF %90 %104
%106 = OpCompositeConstruct %91 %96 %99 %102 %105
OpStore %93 %106
OpBranch %89
%107 = OpLabel
%108 = OpAccessChain %23 %20 %21 %21
%109 = OpLoad %6 %108
%110 = OpConvertSToF %90 %109
%111 = OpCompositeConstruct %91 %110 %110 %110 %110
OpStore %93 %111
OpBranch %89
%89 = OpLabel
OpReturn
OpFunctionEnd
%13 = OpFunction %2 None %10
%11 = OpFunctionParameter %8
%12 = OpFunctionParameter %9
%14 = OpLabel
%24 = OpAccessChain %23 %20 %21 %22
%25 = OpLoad %6 %24
%26 = OpAccessChain %23 %20 %21 %21
%27 = OpLoad %6 %26
%29 = OpIEqual %28 %25 %27
OpSelectionMerge %31 None
OpBranchConditional %29 %30 %31
%30 = OpLabel
OpReturn
%31 = OpLabel
%33 = OpLoad %6 %12
%34 = OpAccessChain %9 %11 %21
OpStore %34 %33
OpReturn
OpFunctionEnd
|
programs/oeis/006/A006130.asm | karttu/loda | 0 | 6280 | ; A006130: a(n) = a(n-1) + 3*a(n-2) for n > 1, a(0) = a(1) = 1.
; 1,1,4,7,19,40,97,217,508,1159,2683,6160,14209,32689,75316,173383,399331,919480,2117473,4875913,11228332,25856071,59541067,137109280,315732481,727060321,1674257764,3855438727,8878212019,20444528200,47079164257,108412748857,249650241628,574888488199,1323839213083,3048504677680,7020022316929,16165536349969,37225603300756,85722212350663,197399022252931,454565659304920,1046762726063713,2410459703978473,5550747882169612
mov $1,1
mov $3,1
lpb $0,1
sub $0,1
mov $2,$1
mul $2,2
add $2,$1
mov $1,$3
add $3,$2
lpe
|
alloy4fun_models/trashltl/models/8/PgyjBLWpjQWYhHnzC.als | Kaixi26/org.alloytools.alloy | 0 | 1628 | open main
pred idPgyjBLWpjQWYhHnzC_prop9 {
always Protected not in Trash
}
pred __repair { idPgyjBLWpjQWYhHnzC_prop9 }
check __repair { idPgyjBLWpjQWYhHnzC_prop9 <=> prop9o } |
data/mapObjects/CopycatsHouse1F.asm | AmateurPanda92/pokemon-rby-dx | 9 | 22200 | CopycatsHouse1F_Object:
db $a ; border block
db 3 ; warps
warp 2, 7, 0, -1
warp 3, 7, 0, -1
warp 7, 1, 0, COPYCATS_HOUSE_2F
db 0 ; signs
db 3 ; objects
object SPRITE_MOM_GEISHA, 2, 2, STAY, DOWN, 1 ; person
object SPRITE_FAT_BALD_GUY, 5, 4, STAY, LEFT, 2 ; person
object SPRITE_CLEFAIRY, 1, 4, WALK, 1, 3 ; person
; warp-to
warp_to 2, 7, COPYCATS_HOUSE_1F_WIDTH
warp_to 3, 7, COPYCATS_HOUSE_1F_WIDTH
warp_to 7, 1, COPYCATS_HOUSE_1F_WIDTH ; COPYCATS_HOUSE_2F
|
src/ay3.asm | howprice/specnext-invaders | 17 | 90270 | ; http://www.cpcwiki.eu/index.php/Datasheet_AY-8913
; The AY-3-8912 Programmable Sound Generator was first featured in the 128K Spectrums.
; Unlike the Beeper, the AY-3 can continue to produce sound independently of the CPU.
; It has three channel output with 4-bit amplitude (16 levels of loudness)
; - 3 Tone Generators produce the basic square wave tone frequencies for each channel (A,B,C)
; - Noise Generator produces a frequency modulated pseudo random pulse width square wave output.
; - Mixers combine the outputs of the Tone Generators and the Noise Generator. One for each channel (A,B,C)
; - Amplitude Control provides the D/A Converters with either a fixed or variable amplitude pattern. The
; fixed amplitude is under direct CPU control; the variable amplitude is accomplished by using, the output
; of the Envelope Generator.
; - Envelope Generator produces an evelope pattern which can be used to amplitude modulate the output of each Mixer.
; - D/A Converters the three D/A Converters each produce up to a 16 level output signal as determined by
; the Amplitude Control.
;
; The AY-3 has 16 registers:
;
; Register Function
; 0 Channel A fine Tone Period (8-bit)
; 1 Channel A coarse Tone Period (4-bit)
; 2 Channel B fine Tone Period (8-bit)
; 3 Channel B coarse Tone Period (4-bit)
; 4 Channel C fine Tone Period (8-bit)
; 5 Channel C coarse Tone Period (4-bit)
; 6 Noise Period (5 bits, max value $1F)
; 7 Tone enable flags a.k.a. "Mixer flags"
; Bits 0-2 enable tone on channels A, B, C respectively, but are inverted - 0 is enabled.
; Bits 3-5 enable noise on A, B, C are are likewise inverted.
; 8 Channel A Amplitude.
; If bit 4 is 0, bits 0-3 set the fixed amplitude which is used.
; If bit 4 is 1, the Envelope Generator is used instead, and bits 0-3 are ignored.
; 9 Channel B Amplitude, same as above.
; 10 Channel C Amplitude, same as above.
; 11 Envelope Period fine (8 bits)
; 12 Envelope Period coarse (b bits)
; 13 Envelope Shape/Cycle
; Bits 0-3 alter the behavior of the envelope generator:
; Bit 0: "Hold" If 1 the envelope generator performs one cycle then holds at the end value.
; If 0, it cycles continuously.
; Bit 1: "Alternate" If 1 the envelope generator alters direction after each cycle.
; If 0, it resets after each cycle. If Hold is set, this instead chooses if
; the value held is the final value (0) or the initial value (1).
; Bit 2: "Attack" if 1 the generator counts up.
; If 0 the generator counts down.
; Bit 3: "Continue" if 0, the envelope generator performs one cycle then drops amplitude to 0 and
; stays there, overriding Hold.
; If 1, Hold is followed.
; 14 Unused
; 15 Unused
AY3_CHANNEL_A_TONE_PERIOD_FINE EQU $0
AY3_CHANNEL_A_TONE_PERIOD_COARSE EQU $1
AY3_CHANNEL_B_TONE_PERIOD_FINE EQU $2
AY3_CHANNEL_B_TONE_PERIOD_COARSE EQU $3
AY3_CHANNEL_C_TONE_PERIOD_FINE EQU $4
AY3_CHANNEL_C_TONE_PERIOD_COARSE EQU $5
AY3_NOISE_PERIOD EQU $6
AY3_MIXER EQU $7
AY3_CHANNEL_A_AMPLITUDE EQU $8
AY3_CHANNEL_B_AMPLITUDE EQU $9
AY3_CHANNEL_C_AMPLITUDE EQU $a
AY3_ENVELOPE_PERIOD_FINE EQU $b
AY3_ENVELOPE_PERIOD_COARSE EQU $c
AY3_ENVELOPE_SHAPE_CYCLE EQU $d
; Calculating Tone Period
; -----------------------
;
; The Datasheet says: "The frequency of each square wave generated by the three Tone Generators (one
; each for Channels A,B and C) is obtained in the PSG by first counting down the input clock by 16,
; then by furthur counting down the result by the programmed 12-bit Tone Period value."
; "Counting down" means dividing, so this means:
;
; Tone frequency = (AY clock frequency) / (16 * Tone Period)
;
; where for the ZX Spectrum the AY clock frequncy is 1.7735MHz. So to calculate the Tone Period for
; a given frequency:
;
; Tone Period = (AY clock frequency) / (16 * tone frequency)
;
; Unfortunately the assembler cannot be used for floating point calculations but we can precalculate the
; AY clock frequency / 16 = 1.7735MHz / 16 = 1773500 Hz / 16 = 110844
;
; So TP = 110844 / F
;
; e.g. Middle C (aka C4), Frequency = 261.63Hz Tone Period = 110844 / 261.63 = 423.666 = 424 = $1a8
;
; Turbo Sound Next
; ----------------
;
; Turbo Sound Next is the audio system integrated on the Spectrum Next. It features
; 3 AY-3-8912 sound chips as used in the Spectrum 128K.
; https://wiki.specnext.dev/Turbo_Sound_Next
; https://wiki.specnext.dev/Turbo_Sound_Next_Control
; https://wiki.specnext.dev/Sound_Chip_Register_Write
;
; http://www.breakintoprogram.co.uk/computers/zx-spectrum/sound
;
|
oeis/348/A348044.asm | neoneye/loda-programs | 11 | 244442 | ; A348044: The nearest common ancestor of n and n^2 in the Doudna tree (A005940).
; Submitted by <NAME>
; 1,2,2,4,2,2,2,8,4,2,2,2,2,2,2,16,2,4,2,2,2,2,2,2,4,2,8,2,2,2,2,32,2,2,2,4,2,2,2,2,2,2,2,2,2,2,2,2,4,4,2,2,2,8,2,2,2,2,2,2,2,2,2,64,2,2,2,2,2,2,2,4,2,2,4,2,2,2,2,2,16,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,2,4
seq $0,71178 ; Exponent of the largest prime factor of n.
mov $1,2
pow $1,$0
mov $0,$1
|
dv3/dv3/sbloc.asm | olifink/smsqe | 0 | 160501 | <reponame>olifink/smsqe
; DV3 Locate Slave Block V3.00 1992 <NAME>
section dv3
xdef dv3_sbloc
include 'dev8_keys_sys'
include 'dev8_keys_err'
include 'dev8_dv3_keys'
include 'dev8_mac_assert'
;+++
; DV3 Locate slave block
;
; d0 r 0, positive (not found) or err.nc (awaiting read)
; d5 c p sector required
; d6 c p file ID
; d7 c p drive id / number
; a2 cr ptr to ptr to current sb / pointer to slave block contents
; a4 c p pointer to drive definition
;
; error status 0 OK, negative not complete or error, positive not found
;---
dv3_sbloc
dsl.reg reg d1/d2/d3/d6/d7/a0/a1
movem.l dsl.reg,-(sp)
swap d6
move.w d5,d6 ; file ID / file sector
swap d7
lsl.w #4,d7 ; drive id in msnibble of lsbyte
bset #sbt..fsb,d7
move.l (a2),a1 ; current slave block
move.l a1,d3
bne.s dsl_ckc ; ... ok
move.l sys_sbrp(a6),a1 ; ... not OK, start at current sb
move.w ddf_xslv(a4),d0
assert sbt.len,8
lsl.w #3,d0
sub.w d0,a1 ; ... rather at start of group of sbs
dsl_ckc
assert sbt_file,sbt_sect-2
cmp.l sbt_file(a1),d6 ; right file / block?
bne.s dsl_look ; ... no
moveq #sbt.driv,d3
and.b sbt_stat(a1),d3
cmp.b d3,d7 ; the right drive?
bne.s dsl_look ; ... no
btst #sbt..vld,sbt_stat(a1) ; valid?
bne.l dsl_chkx ; ... yes
btst #sbt..rrq,sbt_stat(a1) ; read requested?
bne.s dsl_nc ; ... yes
dsl_look
move.l sys_sbtb(a6),d0 ; base of slave block table
move.l sys_sbab(a6),d2 ; top of slave block area
sub.l a6,d2
lsr.l #sbt.shft,d2
add.l d0,d2 ; top of area to look
move.l sys_fsbb(a6),d1 ; first fssb
sub.l a6,d1
lsr.l #sbt.shft,d1
add.l d0,d1 ; first vacant sbt entry
cmp.l d1,a1 ; our start is below bottom?
blt.s dsl_bot ; ... yes, start at bottom
cmp.l d2,a1 ; off top?
blt.s dsl_start ; ... no
dsl_bot
move.l d1,a1 ; start at bottom
dsl_start
move.l a1,a0 ; start both up and down here
dsl_loop
addq.l #8,a1 ; next one up
cmp.l d2,a1 ; at top?
blt.s dsl_ckup
move.l d1,a1 ; start again at the bottom
dsl_ckup
cmp.l a1,a0 ; all the way round?
beq.l dsl_nf ; ... yes
assert sbt_file,sbt_sect-2
cmp.l sbt_file(a1),d6 ; right file / block?
bne.s dsl_down ; ... no
moveq #sbt.driv,d3 ; mask of drive bits
and.b sbt_stat(a1),d3
cmp.b d3,d7 ; right drive?
bne.s dsl_down ; ... no
btst #sbt..vld,sbt_stat(a1) ; valid?
bne.s dsl_chkx ; ... yes
btst #sbt..rrq,sbt_stat(a1) ; read requested?
bne.s dsl_nc ; ... yes
dsl_down
cmp.l d1,a0 ; at bottom?
bgt.s dsl_ckdn ; ... no
move.l d2,a0
dsl_ckdn
subq.l #8,a0
cmp.l a1,a0 ; all the way round?
beq.s dsl_nf ; ... yes
assert sbt_file,sbt_sect-2
cmp.l sbt_file(a0),d6 ; right file / block?
bne.s dsl_loop ; ... no
moveq #sbt.driv,d3 ; mask of drive bits
and.b sbt_stat(a0),d3
cmp.b d3,d7 ; right drive?
bne.s dsl_loop ; ... no
btst #sbt..vld,sbt_stat(a0) ; valid?
bne.s dsl_chkx0 ; ... yes
btst #sbt..rrq,sbt_stat(a0) ; read requested?
beq.s dsl_loop ; ... no
dsl_nc
moveq #err.nc,d0 ; not complete
bra.s dsl_exit
dsl_chkx0
move.l a0,a1 ; it's this one
move.w ddf_xslv(a4),d0
beq.s dsl_done
move.l (a1),d1 ; physical description
assert sbt.len,8
move.w d0,d2
lsl.w #3,d2
sub.w d2,a1 ; back to start of group
bra.s dsl_chkn
dsl_chkx
move.w ddf_xslv(a4),d0
beq.s dsl_done
move.l (a1),d1 ; physical description
dsl_chkn
subq.w #1,d0 ; 2 or 4 slave blocks?
beq.s dsl_chk2
cmp.l 3*sbt.len(a1),d1 ; 4th the same?
bne.s dsl_scrub
cmp.l 2*sbt.len(a1),d1 ; 3th the same?
bne.s dsl_scrub
dsl_chk2
cmp.l 1*sbt.len(a1),d1 ; 2nd the same?
bne.s dsl_scrub
cmp.l 0*sbt.len(a1),d1 ; 1st the same?
bne.s dsl_scrub
dsl_done
move.l a1,(a2) ; current slave block
move.l a1,d0
sub.l sys_sbtb(a6),d0
lsl.l #sbt.shft,d0
move.l d0,a2
add.l a6,a2 ; actual slave block pointer
moveq #0,d0 ; zero return
dsl_exit
movem.l (sp)+,dsl.reg
rts
dsl_scrub
addq.w #1,d0
dsl_sclp
cmp.l (a1),d1 ; is this a matching SB?
bne.s dsl_scnxt
move.b #sbt.mpty,(a1) ; mark it as empty
dsl_scnxt
addq.l #8,a1
dbra d0,dsl_sclp
dsl_nf
moveq #1,d0 ; +ve return
bra.s dsl_exit
end
|
src/minimap_crash.asm | mvdhout1992/ts-patches | 33 | 243000 | ; Minimap crash because of stale pointer
; For some yet unknown reason, infantry sometimes enters harvesters. When this
; happens, the infantry is removed from the map, unlinking itself from the
; radar. Before being destroyed, it might be added back again, but it's not
; removed when actually destroyed later on. This fixes only the symptom.
; Author: AlexB
; Date: 2016-07-21
%include "macros/patch.inc"
%include "macros/hack.inc"
section .text
hack 0x0063A440
_MinimapCrash:
mov al, [esi+2Fh]; ObjectClass::InLimbo
test al, al
jz .Ok
xor bl, bl
.Ok:
mov al, [esi+207h]; TechnoClass::IsRadarTracked
jmp 0x0063A446
|
simh_tapes.adb | SMerrony/dgemua | 2 | 147 | -- MIT License
-- Copyright (c) 2021 <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.
-- TODO Error Handling
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Simh_Tapes is
function Reverse_Dword_Bytes (In_Dw : in Dword_T) return Dword_T is
begin
return Shift_Left (In_Dw and 16#0000_00ff#, 24) or
Shift_Left (In_Dw and 16#0000_ff00#, 8) or
Shift_Right (In_Dw and 16#00ff_0000#, 8) or
Shift_Right (In_Dw and 16#ff00_0000#, 24);
end Reverse_Dword_Bytes;
-- Read_Meta_Data reads a four byte (one doubleword) header, trailer, or other metadata record
-- from the supplied tape image file
procedure Read_Meta_Data
(Img_Stream : in out Stream_Access; Meta_Data : out Dword_T)
is
Tmp_Dw : Dword_T;
begin
Dword_T'Read (Img_Stream, Tmp_Dw);
-- Meta_Data := Reverse_Dword_Bytes (Tmp_Dw);
Meta_Data := Tmp_Dw;
end Read_Meta_Data;
-- Write_Meta_Data writes a 4-byte header/trailer or other metadata
procedure Write_Meta_Data (Img_Stream : in out Stream_Access; Meta_Data : in Dword_T) is
-- Tmp_Dw : Dword_T;
begin
-- Tmp_Dw := Reverse_Dword_Bytes (Meta_Data);
-- Dword_T'Write (Img_Stream, Tmp_Dw);
Dword_T'Write (Img_Stream, Meta_Data);
end Write_Meta_Data;
-- Read_Record_Data attempts to read a data record from SimH tape image, fails if wrong number of bytes read
-- N.B. does not read the header and trailer
procedure Read_Record_Data (Img_Stream : in out Stream_Access; Num_Bytes : in Natural; Rec : out Mt_Rec) is
Tmp_Rec : Mt_Rec (1..Num_Bytes);
Out_Rec_Ix : Integer := Rec'First;
begin
for C in 1 .. Num_Bytes loop
Byte_T'Read (Img_Stream, Tmp_Rec(C));
Rec(Out_Rec_Ix) := Tmp_Rec(C);
Out_Rec_Ix := Out_Rec_Ix + 1;
end loop;
end Read_Record_Data;
-- Write_Record_Data writes the actual data - not the header/trailer
procedure Write_Record_Data (Img_Stream : in out Stream_Access; Rec : in Mt_Rec) is
begin
for C in Rec'Range loop
Byte_T'Write( Img_Stream, Rec(C));
end loop;
end Write_Record_Data;
procedure Rewind (Img_File : in out File_Type) is
begin
Set_Index (Img_File, 1);
end Rewind;
-- internal function
function Space_Forward_1_Rec (Img_Stream : in out Stream_Access) return Mt_Stat is
Hdr, Trailer : Dword_T;
begin
Read_Meta_Data (Img_Stream , Hdr);
if Hdr = Mtr_Tmk then
return Tmk;
end if;
-- read and discard 1 record
declare
Rec : Mt_Rec(1..Natural(Hdr));
begin
Read_Record_Data (Img_Stream , Natural(Hdr), Rec);
end;
-- check trailer
Read_Meta_Data (Img_Stream , Trailer);
if Hdr /= Trailer then
return InvRec;
end if;
return OK;
end Space_Forward_1_Rec;
-- SpaceFwd advances the virtual tape by the specified amount (N.B. 0 means 1 whole file)
function Space_Forward (Img_Stream : in out Stream_Access; Num_Recs : in Integer) return Mt_Stat is
Simh_Stat : Mt_Stat := IOerr;
Done : Boolean := false;
Hdr, Trailer : Dword_T;
Rec_Cnt : Integer := Num_Recs;
begin
if Num_Recs = 0 then
-- one whole file
while not Done loop
Read_Meta_Data (Img_Stream , Hdr);
if Hdr = Mtr_Tmk then
Simh_Stat := OK;
Done := true;
else
-- read and discard 1 record
declare
Rec : Mt_Rec(1..Natural(Hdr));
begin
Read_Record_Data (Img_Stream , Natural(Hdr), Rec);
end;
-- check trailer
Read_Meta_Data (Img_Stream , Trailer);
if Hdr /= Trailer then
return InvRec;
end if;
end if;
end loop;
else
-- otherwise word count is a negative number and we space fwd that many records
while Rec_Cnt /= 0 loop
Rec_Cnt := Rec_Cnt + 1;
Simh_Stat := Space_Forward_1_Rec (Img_Stream);
if Simh_Stat /= OK then
return Simh_Stat;
end if;
end loop;
end if;
return Simh_Stat;
end Space_Forward;
-- Scan_Image - attempt to read a whole tape image ensuring headers, record sizes, and trailers match
-- TODO if csv is true then output is in CSV format
function Scan_Image (Img_Filename : in String) return String is
Result : Unbounded_String;
Img_File : File_Type;
Img_Stream : Stream_Access;
Hdr, Trailer : Dword_T;
File_Count : Integer := -1;
File_Size, Mark_Count, Record_Num : Integer := 0;
Dummy_Rec : Mt_Rec(1..32768);
begin
Open (File => Img_File, Mode => In_File, Name => Img_Filename);
Img_Stream := stream(Img_File);
Record_Loop :
loop
Read_Meta_Data (Img_Stream , Hdr);
case Hdr is
when Mtr_Tmk =>
if File_Size > 0 then
File_Count := File_Count + 1;
Result := Result & Dasher_NL & "File " & Integer'Image(File_Count) &
" : " & Integer'Image(File_Size) & " bytes in " &
Integer'Image(Record_Num) & " blocks";
File_Size := 0;
Record_Num := 0;
end if;
Mark_Count := Mark_Count + 1;
if Mark_Count = 3 then
Result := Result & Dasher_NL & "Triple Mark (old End-of-Tape indicator)";
exit Record_Loop;
end if;
when Mtr_EOM =>
Result := Result & Dasher_NL & "End of Medium";
exit Record_Loop;
when Mtr_Gap =>
Result := Result & Dasher_NL & "Erase Gap";
Mark_Count := 0;
when others =>
Record_Num := Record_Num + 1;
Mark_Count := 0;
Read_Record_Data (Img_Stream, Natural(Hdr), Dummy_Rec);
Read_Meta_Data (Img_Stream , Trailer);
if Hdr = Trailer then
File_Size := File_Size + Integer(Hdr);
else
Result := Result & Dasher_NL & "Non-matching trailer found.";
end if;
end case;
end loop Record_Loop;
Close (Img_File);
return To_String(Result);
end Scan_Image;
end Simh_Tapes;
|
test/Fail/MatchingOnCoinductiveRecord.agda | alhassy/agda | 3 | 14257 | <reponame>alhassy/agda
{-# OPTIONS --copatterns #-}
-- 2013-05-30 Andreas, Oury's counterexample to subject reduction in Coq
-- 2014-11-04 Andreas: simplified (removed force)
module MatchingOnCoinductiveRecord where
open import Common.Equality
record U : Set where
coinductive
constructor inn
field
out : U
open U
u : U
out u = u
eq : (x : U) → x ≡ inn (out x)
eq (inn y) = refl
-- should fail, as internally this is just
-- eq x = refl
-- and we do not have η for coinductive records
equ : u ≡ inn u
equ = eq u
-- normalizes to refl, which does not have type u ≡ inn u
|
src/results/adabase-results-generic_converters.adb | jrmarino/AdaBase | 30 | 11763 | <filename>src/results/adabase-results-generic_converters.adb
-- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../../License.txt
with Ada.Strings.Fixed;
with Ada.Strings.Wide_Fixed;
with Ada.Strings.Wide_Wide_Fixed;
with Ada.Characters.Conversions;
with Ada.Strings.UTF_Encoding.Strings;
package body AdaBase.Results.Generic_Converters is
package AS renames Ada.Strings;
package ACC renames Ada.Characters.Conversions;
--------------------------
-- GENERIC convertstr --
--------------------------
function convertstr (nv : Textual) return IntType
is
nverr : constant String := CT.USS (nv);
begin
return IntType'Value (nverr);
exception
when others =>
raise CONVERSION_FAILED with "Tried to convert '" & nverr & "' (S/I)";
end convertstr;
--------------------------
-- GENERIC convertst2 --
--------------------------
function convertst2 (nv : Textual) return RealType
is
nverr : constant String := CT.USS (nv);
begin
return RealType'Value (nverr);
exception
when others =>
raise CONVERSION_FAILED with "Tried to convert '" & nverr & "' (S/R)";
end convertst2;
--------------------------
-- GENERIC convertst3 --
--------------------------
function convertst3 (nv : Textwide) return IntType
is
wstr : constant Wide_String := SUW.To_Wide_String (Source => nv);
str : constant String := ACC.To_String (Item => wstr);
begin
return IntType'Value (str);
exception
when others =>
raise CONVERSION_FAILED with "Tried to convert '" & str & "' (WS/I)";
end convertst3;
--------------------------
-- GENERIC convertst4 --
--------------------------
function convertst4 (nv : Textwide) return RealType
is
wstr : constant Wide_String := SUW.To_Wide_String (Source => nv);
str : constant String := ACC.To_String (Item => wstr);
begin
return RealType'Value (str);
exception
when others =>
raise CONVERSION_FAILED with "Tried to convert '" & str & "' (WS/R)";
end convertst4;
--------------------------
-- GENERIC convertst5 --
--------------------------
function convertst5 (nv : Textsuper) return IntType
is
wwstr : constant Wide_Wide_String := SUWW.To_Wide_Wide_String (nv);
str : constant String := ACC.To_String (Item => wwstr);
begin
return IntType'Value (str);
exception
when others =>
raise CONVERSION_FAILED with "Tried to convert '" & str & "' (WWS/I)";
end convertst5;
--------------------------
-- GENERIC convertst6 --
--------------------------
function convertst6 (nv : Textsuper) return RealType
is
wwstr : constant Wide_Wide_String := SUWW.To_Wide_Wide_String (nv);
str : constant String := ACC.To_String (Item => wwstr);
begin
return RealType'Value (str);
exception
when others =>
raise CONVERSION_FAILED with "Tried to convert '" & str & "' (WWS/R)";
end convertst6;
--------------------
-- convert2utf8 --
--------------------
function convert2utf8 (nv : IntType) return Text_UTF8 is
begin
return SUTF.Strings.Encode (Item => ctrim (nv'Img));
end convert2utf8;
----------------------------
-- GENERIC convert2str1 --
----------------------------
function convert2str1 (nv : IntType) return String is
begin
return ctrim (nv'Img);
end convert2str1;
----------------------------
-- GENERIC convert2str2 --
----------------------------
function convert2str2 (nv : IntType) return Wide_String is
begin
return wtrim (nv'Img);
end convert2str2;
----------------------------
-- GENERIC convert2str3 --
----------------------------
function convert2str3 (nv : IntType) return Wide_Wide_String is
begin
return strim (nv'Img);
end convert2str3;
--------------------
-- convert3utf8 --
--------------------
function convert3utf8 (nv : RealType) return Text_UTF8 is
begin
return SUTF.Strings.Encode (Item => ctrim (nv'Img));
end convert3utf8;
----------------------------
-- GENERIC convert3str1 --
----------------------------
function convert3str1 (nv : RealType) return String is
begin
return ctrim (nv'Img);
end convert3str1;
----------------------------
-- GENERIC convert3str2 --
----------------------------
function convert3str2 (nv : RealType) return Wide_String is
begin
return wtrim (nv'Img);
end convert3str2;
----------------------------
-- GENERIC convert3str3 --
----------------------------
function convert3str3 (nv : RealType) return Wide_Wide_String is
begin
return strim (nv'Img);
end convert3str3;
---------------------------
-- GENERIC convert4str --
---------------------------
function convert4str (nv : String) return IntType is
begin
return IntType'Value (nv);
exception
when others =>
raise CONVERSION_FAILED with "Tried to convert '" & nv & "' (ST/I)";
end convert4str;
---------------------------
-- GENERIC convert4st2 --
---------------------------
function convert4st2 (nv : String) return RealType is
begin
return RealType'Value (nv);
exception
when others =>
raise CONVERSION_FAILED with "Tried to convert '" & nv & "' (ST/R)";
end convert4st2;
--------------------
-- convert2bits --
--------------------
function convert2bits (nv : ModType) return Bits
is
result : Bits (0 .. width) := (others => 0);
mask : ModType;
begin
for x in result'Range loop
mask := 2 ** x;
if (nv and mask) > 0 then
result (x) := 1;
end if;
end loop;
return result;
end convert2bits;
---------------------
-- convert2chain --
---------------------
function convert2chain (nv : ModType) return Chain
is
bitwidth : constant Natural := (width * 8) - 1;
result : Chain (1 .. width) := (others => 0);
asbits : Bits (0 .. bitwidth) := (others => 0);
arrow : Natural := 0;
mask : ModType;
submask : constant array (0 .. 7) of NByte1 := (2 ** 0, 2 ** 1,
2 ** 2, 2 ** 3,
2 ** 4, 2 ** 5,
2 ** 6, 2 ** 7);
begin
-- convert to bits first
for x in asbits'Range loop
mask := 2 ** x;
if (nv and mask) > 0 then
result (x) := 1;
end if;
end loop;
-- convert from bits to nbyte1
for x in result'Range loop
for y in submask'Range loop
if asbits (arrow + y) = 1 then
result (x) := result (x) + submask (y);
end if;
end loop;
arrow := arrow + 8;
end loop;
return result;
end convert2chain;
--------------------
-- convert_bits --
--------------------
function convert_bits (nv : Bits) return ModType
is
numbits : Natural := nv'Length;
asbits : Bits (0 .. numbits - 1) := nv;
result : ModType := 0;
begin
if asbits'Last > MSB then
raise TARGET_TYPE_TOO_NARROW;
end if;
for x in asbits'Range loop
if asbits (x) > 0 then
result := result + (2 ** x);
end if;
end loop;
return result;
end convert_bits;
---------------------
-- convert_chain --
---------------------
function convert_chain (nv : Chain) return ModType
is
link : NByte1;
counter : Natural := 0;
result : ModType := 0;
begin
if nv'Length > width then
raise TARGET_TYPE_TOO_NARROW;
end if;
for x in nv'Range loop
link := nv (x);
result := result + ModType (link * (2 ** counter));
counter := counter + 8;
end loop;
return result;
end convert_chain;
------------------------------
-- PRIVATE TRIM FUNCTIONS --
------------------------------
function ctrim (raw : String) return String is
begin
return AS.Fixed.Trim (raw, AS.Left);
end ctrim;
function wtrim (raw : String) return Wide_String is
begin
return ACC.To_Wide_String (AS.Fixed.Trim (raw, AS.Left));
end wtrim;
function strim (raw : String) return Wide_Wide_String is
begin
return ACC.To_Wide_Wide_String (AS.Fixed.Trim (raw, AS.Left));
end strim;
end AdaBase.Results.Generic_Converters;
|
src/natools-time_keys.adb | faelys/natools | 0 | 8391 | <filename>src/natools-time_keys.adb
------------------------------------------------------------------------------
-- Copyright (c) 2015, <NAME> --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Ada.Calendar.Arithmetic;
package body Natools.Time_Keys is
function Extract_Sub_Second (Key : String) return Duration;
-- Read the end of Buffer and compute the Sub_Second part
------------------------------
-- Local Helper Subprograms --
------------------------------
function Extract_Sub_Second (Key : String) return Duration is
Sub_Second : Duration := 0.0;
begin
for I in reverse Key'First + 7 .. Key'Last loop
Sub_Second := (Sub_Second + Duration (Value (Key (I)))) / 32;
Sub_Second := (Sub_Second + Duration'Small) / 2;
end loop;
return Sub_Second;
end Extract_Sub_Second;
-----------------------
-- Publoic Interface --
-----------------------
function To_Key
(Time : Ada.Calendar.Time;
Max_Sub_Second_Digits : in Natural := 120)
return String
is
Year : Ada.Calendar.Year_Number;
Month : Ada.Calendar.Month_Number;
Day : Ada.Calendar.Day_Number;
Hour : Ada.Calendar.Formatting.Hour_Number;
Minute : Ada.Calendar.Formatting.Minute_Number;
Second : Ada.Calendar.Formatting.Second_Number;
Sub_Second : Ada.Calendar.Formatting.Second_Duration;
Leap_Second : Boolean;
begin
Ada.Calendar.Formatting.Split
(Time,
Year, Month, Day, Hour, Minute, Second, Sub_Second,
Leap_Second);
return To_Key
(Year, Month, Day,
Hour, Minute, Second, Sub_Second,
Leap_Second,
Max_Sub_Second_Digits);
end To_Key;
function To_Key
(Year : Ada.Calendar.Year_Number;
Month : Ada.Calendar.Month_Number;
Day : Ada.Calendar.Day_Number;
Hour : Ada.Calendar.Formatting.Hour_Number := 0;
Minute : Ada.Calendar.Formatting.Minute_Number := 0;
Second : Ada.Calendar.Formatting.Second_Number := 0;
Sub_Second : Ada.Calendar.Formatting.Second_Duration := 0.0;
Leap_Second : Boolean := False;
Max_Sub_Second_Digits : Natural := 120)
return String
is
procedure Increment_Buffer;
Buffer : String (1 .. 7 + Max_Sub_Second_Digits);
Last : Positive;
procedure Increment_Buffer is
begin
while Last > 7 and then Buffer (Last) = '~' loop
Last := Last - 1;
end loop;
if Last > 7 then
Buffer (Last) := Image (Value (Buffer (Last)) + 1);
return;
end if;
if Second <= 58 then
Buffer (7) := I_Image (Second + 1);
Last := 7;
elsif Minute <= 58 then
Buffer (6) := I_Image (Minute + 1);
Last := 6;
elsif Hour <= 22 then
Buffer (5) := I_Image (Hour + 1);
Last := 5;
else
Buffer (1 .. 4) := To_Key (Ada.Calendar.Arithmetic."+"
(Ada.Calendar.Formatting.Time_Of (Year, Month, Day), 1));
Last := 4;
end if;
end Increment_Buffer;
N : Natural;
D, Base : Duration;
begin
Buffer (1) := I_Image (Year / 64);
Buffer (2) := I_Image (Year mod 64);
Buffer (3) := I_Image (Month);
Buffer (4) := I_Image (Day);
Buffer (5) := I_Image (Hour);
Buffer (6) := I_Image (Minute);
if Leap_Second then
pragma Assert (Second = 59);
Buffer (7) := I_Image (60);
else
Buffer (7) := I_Image (Second);
end if;
if Sub_Second = 0.0 then
if Second = 0 then
if Minute = 0 then
if Hour = 0 then
return Buffer (1 .. 4);
else
return Buffer (1 .. 5);
end if;
else
return Buffer (1 .. 6);
end if;
else
return Buffer (1 .. 7);
end if;
end if;
Last := 7;
D := Sub_Second * 64;
Base := 1.0;
loop
Last := Last + 1;
Base := Base / 64.0;
N := Natural (D);
if Last = Buffer'Last or Base = 0.0 then
if N < 64 then
Buffer (Last) := I_Image (N);
else
Last := Last - 1;
Increment_Buffer;
end if;
exit;
end if;
if Duration (N) > D then
N := N - 1;
pragma Assert (Duration (N) <= D);
end if;
D := (D - Duration (N)) * 64;
Buffer (Last) := I_Image (N);
exit when D = 0.0;
end loop;
return Buffer (1 .. Last);
end To_Key;
function To_Time (Key : String) return Ada.Calendar.Time is
Leap_Second : constant Boolean
:= Key'First + 6 in Key'Range and then Key (Key'First + 6) = 'x';
begin
return Ada.Calendar.Formatting.Time_Of
(Year => I_Value (Key (Key'First)) * 64
+ I_Value (Key (Key'First + 1)),
Month => I_Value (Key (Key'First + 2)),
Day => I_Value (Key (Key'First + 3)),
Hour => (if Key'First + 4 in Key'Range
then I_Value (Key (Key'First + 4)) else 0),
Minute => (if Key'First + 5 in Key'Range
then I_Value (Key (Key'First + 5)) else 0),
Second => (if Key'First + 6 in Key'Range
then (if Leap_Second then 59
else I_Value (Key (Key'First + 6)))
else 0),
Sub_Second => Extract_Sub_Second (Key),
Leap_Second => Leap_Second);
end To_Time;
end Natools.Time_Keys;
|
software/hal/boards/common/tools/generic_types.adb | TUM-EI-RCS/StratoX | 12 | 19919 | <filename>software/hal/boards/common/tools/generic_types.adb
package body Generic_Types with SPARK_Mode is
------------------------
-- Saturated_Cast_Int
------------------------
function Saturated_Cast_Int (f : Float) return T is
ret : T;
ff : constant Float := Float'Floor (f);
begin
if ff >= Float (T'Last) then
ret := T'Last;
elsif ff < Float (T'First) then
ret := T'First;
else
ret := T (ff);
end if;
return ret;
end Saturated_Cast_Int;
------------------------
-- Saturated_Cast_Mod
------------------------
function Saturated_Cast_Mod (f : Float) return T is
ret : T;
ff : constant Float := Float'Floor (f);
begin
if ff >= Float (T'Last) then
ret := T'Last;
elsif ff < Float (T'First) then
ret := T'First;
else
ret := T (ff);
end if;
return ret;
end Saturated_Cast_Mod;
------------------
-- Saturate_Mod
------------------
function Saturate_Mod (val : T; min : T; max : T) return T is
ret : T;
begin
if val < min then
ret := min;
elsif val > max then
ret := max;
else
ret := val;
end if;
return ret;
end Saturate_Mod;
end Generic_Types;
|
programs/oeis/118/A118417.asm | neoneye/loda | 22 | 171886 | <reponame>neoneye/loda
; A118417: a(n) = (2*n + 1) * 2^(n + 1).
; 2,12,40,112,288,704,1664,3840,8704,19456,43008,94208,204800,442368,950272,2031616,4325376,9175040,19398656,40894464,85983232,180355072,377487360,788529152,1644167168,3422552064,7113539584,14763950080,30601641984,63350767616,130996502528,270582939648,558345748480,1151051235328,2370821947392,4879082848256,10033043603456,20615843020800,42331197669376,86861418594304,178120883699712,365037860421632,747667906887680,1530520185864192,3131409115906048,6403555720167424,13088586417045504,26740122787512320,54606145481867264,111464090777419776,227431781182210048,463870761619161088,945755921747804160,1927540640514572288,3927138875067072512,7998392938210000896,16285016252571713536,33146493257446850560,67445908019500548096,137197659048214790144,279007004114856968192,567237380266568712192,1152921504606846976000,2342736497361113055232,4759259971017064316928,9666093894623805046784,19627335694426962919424,39844967199212631490560,80870526019142674284544,164102235279720171175936,332926837042309987565568,675298407050359265558528,1369486280032197111971840,2776751491927351385653248,5629060847580617094725632,11409237422613062836289536,23120706300129782966255616,46845875510066880519864320,94900676839748390214434816,192219205318726038778281984,389274113915910594255388672,788219634388738221908426752,1595782081891310510612152320,3230249790010289154814902272,6537870832475914576810999808,13230484169862501687984390144,26770453349546348444693561344,54159876718735387026836684800,109557693476756154328572493824,221591267032083069206943236096,448134294221307659513482969088,906172108756898361226158931968,1832151258142362806850703851520,3703916597541857782498179678208,7487061357597979902589903306752,15132579040224488480366894514176,30582070730506034311107964829696,61797966761126183322964281262080,124863584122480596047425265729536,252262469445417650897843937869824
mov $1,$0
mul $0,2
add $0,1
mov $2,2
pow $2,$1
mul $0,$2
mul $0,2
|
samples/sms/tilemap_render/multidir_scroll/data/sprite/image.asm | 0x8BitDev/MAPeD-SPReD | 23 | 82073 | ;#######################################################
;
; Generated by SPReD-SMS Copyright 2017-2020 0x8BitDev
;
;#######################################################
.define SPR_MODE_8X16 0
.define SPR_CHR_BPP 4
.define SPR_CHRS_OFFSET 0 ; first CHR index in a CHR bank
;chr0: .incbin "image_chr0.bin" ; 1280 bytes
;image_CHR_arr:
; .word 1280, chr0
image_palette:
.byte $00, $30, $20, $20, $00, $34, $04, $3F, $0B, $3A, $25, $15, $3A, $03, $02, $15
image_num_frames:
.byte $01
image_frames_data:
sonic_frame:
.word sonic
.byte sonic_end - sonic ; data size
.byte 0 ; CHR bank index (chr0)
; #1: Y pos, #2: X pos, #3: CHR index
sonic:
.byte $00, $10, $00
.byte $00, $18, $01
.byte $00, $20, $02
.byte $08, $00, $03
.byte $08, $08, $04
.byte $08, $10, $05
.byte $08, $18, $06
.byte $08, $20, $07
.byte $08, $28, $08
.byte $10, $00, $09
.byte $10, $08, $0A
.byte $10, $10, $0B
.byte $10, $18, $0C
.byte $10, $20, $0D
.byte $10, $28, $0E
.byte $10, $30, $0F
.byte $18, $00, $10
.byte $18, $08, $11
.byte $18, $10, $12
.byte $18, $18, $13
.byte $18, $20, $14
.byte $18, $28, $15
.byte $20, $00, $16
.byte $20, $08, $17
.byte $20, $10, $18
.byte $20, $18, $19
.byte $20, $20, $1A
.byte $20, $28, $1B
.byte $28, $00, $1C
.byte $28, $08, $1D
.byte $28, $10, $1E
.byte $28, $18, $1F
.byte $28, $20, $20
.byte $28, $28, $21
.byte $30, $00, $22
.byte $30, $08, $23
.byte $30, $10, $24
.byte $30, $18, $25
.byte $38, $10, $26
.byte $38, $18, $27
sonic_end:
|
extern/gnat_sdl/gnat_sdl/src/sdl_sdl_timer_h.ads | AdaCore/training_material | 15 | 13965 | <filename>extern/gnat_sdl/gnat_sdl/src/sdl_sdl_timer_h.ads
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with SDL_SDL_stdinc_h;
with System;
package SDL_SDL_timer_h is
SDL_TIMESLICE : constant := 10; -- ../include/SDL/SDL_timer.h:40
TIMER_RESOLUTION : constant := 10; -- ../include/SDL/SDL_timer.h:43
function SDL_GetTicks return SDL_SDL_stdinc_h.Uint32; -- ../include/SDL/SDL_timer.h:49
pragma Import (C, SDL_GetTicks, "SDL_GetTicks");
procedure SDL_Delay (ms : SDL_SDL_stdinc_h.Uint32); -- ../include/SDL/SDL_timer.h:52
pragma Import (C, SDL_Delay, "SDL_Delay");
type SDL_TimerCallback is access function (arg1 : SDL_SDL_stdinc_h.Uint32) return SDL_SDL_stdinc_h.Uint32;
pragma Convention (C, SDL_TimerCallback); -- ../include/SDL/SDL_timer.h:55
function SDL_SetTimer (interval : SDL_SDL_stdinc_h.Uint32; callback : SDL_TimerCallback) return int; -- ../include/SDL/SDL_timer.h:86
pragma Import (C, SDL_SetTimer, "SDL_SetTimer");
type SDL_NewTimerCallback is access function (arg1 : SDL_SDL_stdinc_h.Uint32; arg2 : System.Address) return SDL_SDL_stdinc_h.Uint32;
pragma Convention (C, SDL_NewTimerCallback); -- ../include/SDL/SDL_timer.h:101
-- skipped empty struct u_SDL_TimerID
type SDL_TimerID is new System.Address; -- ../include/SDL/SDL_timer.h:104
function SDL_AddTimer
(interval : SDL_SDL_stdinc_h.Uint32;
callback : SDL_NewTimerCallback;
param : System.Address) return SDL_TimerID; -- ../include/SDL/SDL_timer.h:109
pragma Import (C, SDL_AddTimer, "SDL_AddTimer");
function SDL_RemoveTimer (t : SDL_TimerID) return SDL_SDL_stdinc_h.SDL_bool; -- ../include/SDL/SDL_timer.h:115
pragma Import (C, SDL_RemoveTimer, "SDL_RemoveTimer");
end SDL_SDL_timer_h;
|
Task/Generic-swap/Ada/generic-swap-1.ada | djgoku/RosettaCodeData | 0 | 18368 | generic
type Swap_Type is private; -- Generic parameter
procedure Generic_Swap(Left : in out Swap_Type; Right : in out Swap_Type);
procedure Generic_Swap(Left : in out Swap_Type; Right : in out Swap_Type) is
Temp : Swap_Type := Left;
begin
Left := Right;
Right := Temp;
end Generic_Swap;
|
base/mvdm/wow16/kernel31/lacheck.asm | npocmaka/Windows-Server-2003 | 17 | 165410 |
.xlist
include kernel.inc
include gpfix.inc
.list
externW pLocalHeap
DataBegin
externB kernel_flags
;externW MyCSDS
DataEnd
sBegin CODE
assumes CS,CODE
if KDEBUG
;-----------------------------------------------------------------------;
; CheckLocalHeap ;
; ;
; ;
; Arguments: ;
; ;
; Returns: ;
; ;
; Error Returns: ;
; ;
; Registers Preserved: ;
; ;
; Registers Destroyed: ;
; ;
; Calls: ;
; ;
; History: ;
; ;
; Tue Jan 01, 1980 10:58:28p -by- <NAME> [davidw] ;
; ReWrote it from C into assembly. ;
;-----------------------------------------------------------------------;
cProc CheckLocalHeap,<PUBLIC,NEAR>,<di,si>
localW nrefhandles
localW nhandles
localW nfreehandles
localW nusedhandles
localW ndishandles
localW pbottom
cBegin
beg_fault_trap clh_trap
xor di,di
xor dx,dx ; For error codes.
mov bx,[di].pLocalHeap
or bx,bx
jnz have_a_heap
jmp clh_ret
have_a_heap:
cmp di,[bx].hi_check
jnz do_heap_check
jmp clh_ret
do_heap_check:
mov cx,[bx].hi_count
mov si,[bx].hi_first
test [si].la_prev,LA_BUSY
jnz first_should_be_busy
or dx,1 ; Forward links invalid.
first_should_be_busy:
check_forward_links:
mov ax,[si].la_next
cmp ax,si
jbe end_of_line
mov si,ax
loop check_forward_links
end_of_line:
cmp ax,[bx].hi_last
jnz forward_bad
cmp cx,1
jz forward_good
; jcxz forward_good
forward_bad:
or dx,1 ; Forward links invalid.
forward_good:
mov cx,[bx].hi_count
mov si,[bx].hi_last
test [si].la_prev,LA_BUSY
jnz last_should_be_busy
or dx,2 ; Backward links invalid.
last_should_be_busy:
check_backward_links:
mov ax,[si].la_prev
and ax,0FFFCh
cmp ax,si
jae begin_of_line
mov si,ax
loop check_backward_links
begin_of_line:
cmp ax,[bx].hi_first
jnz backward_bad
cmp cx,1
jz backward_good
; jcxz backward_good
backward_bad:
or dx,2 ; Backward links invalid.
backward_good:
mov cx,[bx].hi_count
mov si,[bx].hi_first
mov nrefhandles,0
count_referenced_handles:
test [si].la_prev,LA_BUSY
jz no_handle
test [si].la_prev,LA_MOVEABLE
jz no_handle
mov di,[si].la_handle
cmp [di].lhe_free,LHE_FREEHANDLE
jnz handle_not_free
or dx,4 ; Block points to free handle.
jmps no_handle
handle_not_free:
mov ax,si
add ax,SIZE LocalArena
cmp ax,[di].lhe_address
jz handle_points_back
or dx,8 ; Block -> handle but not vice versa
jmps no_handle
handle_points_back:
inc nrefhandles
no_handle:
mov si,[si].la_next
loop count_referenced_handles
mov di,[bx].hi_htable
mov nhandles,0
mov ndishandles,0
mov nusedhandles,0
mov nfreehandles,0
handle_block_loop:
or di,di
jz no_more_handle_blocks
lea si,[di].ht_entry[0]
mov cx,[di].ht_count
add nhandles,cx
handle_entry_loop:
jcxz next_handle_block
dec cx
cmp [si].lhe_free,LHE_FREEHANDLE
jnz not_free
inc nfreehandles
jmps next_handle_entry
not_free:
test [si].lhe_flags,LHE_DISCARDED
jz not_discarded
inc ndishandles
jmps next_handle_entry
not_discarded:
inc nusedhandles
next_handle_entry:
add si,SIZE LocalHandleEntry
jmp handle_entry_loop
next_handle_block:
mov di,[si].lhe_address
jmp handle_block_loop
no_more_handle_blocks:
mov ax,nusedhandles
cmp ax,nrefhandles
jz handles_match
or dx,10h ; allocated handles != used handles
handles_match:
add ax,nfreehandles
add ax,ndishandles
cmp ax,nhandles
jz total_number_okay
or dx,20h ; total number of handles dont add up
total_number_okay:
xor cx,cx
mov si,[bx].hi_hfree
count_free:
or si,si
jz counted_free
inc cx
mov si,[si].lhe_link
jmp count_free
counted_free:
cmp cx,nfreehandles
jz free_add_up
or dx,40h ; total # of free handles dont add up
free_add_up:
; now check the free block list
mov si,[bx].hi_first
mov si,[si].la_free_next ; Sentinals not free.
mov ax,[bx].hi_last
mov pbottom,ax
check_free_list:
cmp si,[si].la_free_next
jz check_free_list_done
mov ax,[si].la_next
sub ax,si
cmp ax,[si].la_size
jnz free_list_corrupted ; invalid block size
cmp [bx].hi_check,2 ; if hi_check >= 2, check free.
jb dont_check_free
mov di,si
add di,SIZE LocalArenaFree
mov cx,[si].la_next
sub cx,di
mov al,DBGFILL_FREE
smov es,ds
repz scasb
jnz free_list_corrupted ; free block corrupted
dont_check_free:
mov ax,[si].la_free_next
cmp ax,si
jbe free_list_corrupted
mov si,ax
cmp ax,pbottom
jbe check_free_list
free_list_corrupted:
krDebugOut DEB_FERROR, "Local free memory overwritten at #ES:#DI"
or dx,80h
end_fault_trap
check_free_list_done:
clh_ret:
mov ax,dx
cEnd
clh_trap:
fault_fix_stack
mov dx, 80h
jmp clh_ret
endif
sEnd CODE
end
|
tests/beyond/DataByRecursion.agda | andrejtokarcik/agda-semantics | 3 | 1958 |
-- When defining types by recursion it is sometimes difficult to infer implicit
-- arguments. This module illustrates the problem and shows how to get around
-- it for the example of vectors of a given length.
module DataByRecursion where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
data Nil : Set where
nil' : Nil
data Cons (A As : Set) : Set where
_::'_ : A -> As -> Cons A As
mutual
Vec' : Set -> Nat -> Set
Vec' A zero = Nil
Vec' A (suc n) = Cons A (Vec A n)
data Vec (A : Set)(n : Nat) : Set where
vec : Vec' A n -> Vec A n
nil : {A : Set} -> Vec A zero
nil = vec nil'
_::_ : {A : Set}{n : Nat} -> A -> Vec A n -> Vec A (suc n)
x :: xs = vec (x ::' xs)
map : {n : Nat}{A B : Set} -> (A -> B) -> Vec A n -> Vec B n
map {zero} f (vec nil') = nil
map {suc n} f (vec (x ::' xs)) = f x :: map f xs
|
resources/lw-test.asm | GeorgeBernard/350assembler | 1 | 81669 | <reponame>GeorgeBernard/350assembler
# Set up while
addi $1 $0 0 # v_addr = 0;
addi $10 $0 5000 # limit = 5000;
addi $4 $0 44
lw $3 3($0) # addr_44 = vmem(3);
nop
nop
bne $3 $4 1 # if ($4 != $5) print to screen
jump end
while: nop
nop
lp $2 0($1) # pixel = p_mem(v_addr);
nop
nop
nop
sv $2 0($1) # vmem(v_addr) = pixel;
addi $1 $1 1 # v_addr++;
nop
nop
nop
blt $10 $1 1 # if (limit < v_addr) break;
j while
end:
j end |
src/asis/asis-ada_environments.adb | My-Colaborations/dynamo | 15 | 24315 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A S I S . A D A _ E N V I R O N M E N T S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2008, Free Software Foundation, Inc. --
-- --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adaccore.com). --
-- --
------------------------------------------------------------------------------
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Asis.Errors; use Asis.Errors;
with Asis.Exceptions; use Asis.Exceptions;
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Debug; use A4G.A_Debug;
with A4G.A_Opt; use A4G.A_Opt;
with A4G.A_Output; use A4G.A_Output;
with A4G.Contt; use A4G.Contt;
with A4G.Contt.TT; use A4G.Contt.TT;
with A4G.Contt.UT; use A4G.Contt.UT;
with A4G.Vcheck; use A4G.Vcheck;
with Output; use Output;
package body Asis.Ada_Environments is
Package_Name : constant String := "Asis.Ada_Environments.";
---------------
-- Associate --
---------------
procedure Associate
(The_Context : in out Asis.Context;
Name : Wide_String;
Parameters : Wide_String := Default_Parameters)
is
S_Parameters : constant String := Trim (To_String (Parameters), Both);
Cont : Context_Id;
begin
Cont := Get_Cont_Id (The_Context);
if not A4G.A_Opt.Is_Initialized then
Set_Error_Status
(Status => Initialization_Error,
Diagnosis => Package_Name & "Associate: "
& "called for non-initialized ASIS");
raise ASIS_Failed;
end if;
if Is_Opened (Cont) then
Set_Error_Status
(Status => Value_Error,
Diagnosis => Package_Name & "Associate: "
& "the Context has already been opened");
raise ASIS_Inappropriate_Context;
end if;
if Cont = Non_Associated then
-- this is the first association for a given Context
Cont := Allocate_New_Context;
Set_Cont (The_Context, Cont);
else
Erase_Old (Cont);
end if;
Verify_Context_Name (To_String (Name), Cont);
Process_Context_Parameters (S_Parameters, Cont);
Set_Is_Associated (Cont, True);
Save_Context (Cont);
Set_Current_Cont (Nil_Context_Id);
exception
when ASIS_Inappropriate_Context =>
Set_Is_Associated (Cont, False);
raise;
when ASIS_Failed =>
Set_Is_Associated (Cont, False);
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information (Outer_Call => Package_Name & "Associate");
end if;
raise;
when Ex : others =>
Set_Is_Associated (Cont, False);
Report_ASIS_Bug
(Query_Name => Package_Name & "Associate",
Ex => Ex);
end Associate;
-----------
-- Close --
-----------
procedure Close (The_Context : in out Asis.Context) is
Cont : Context_Id;
begin
Cont := Get_Cont_Id (The_Context);
Reset_Context (Cont);
if not Is_Opened (Cont) then
Set_Error_Status (Status => Value_Error,
Diagnosis => Package_Name & "Close: " &
"the Context is not open");
raise ASIS_Inappropriate_Context;
end if;
if Debug_Flag_C or else
Debug_Lib_Model or else
Debug_Mode
then
Write_Str ("Closing Context ");
Write_Int (Int (Cont));
Write_Eol;
Print_Units (Cont);
Print_Trees (Cont);
end if;
Set_Is_Opened (Cont, False);
Set_Current_Cont (Nil_Context_Id);
Reset_Cache;
exception
when ASIS_Inappropriate_Context =>
raise;
when ASIS_Failed =>
Set_Current_Cont (Nil_Context_Id);
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information (Outer_Call => Package_Name & "Close");
end if;
raise;
when Ex : others =>
Set_Current_Cont (Nil_Context_Id);
Report_ASIS_Bug
(Query_Name => Package_Name & "Associate",
Ex => Ex);
end Close;
-----------------
-- Debug_Image --
-----------------
function Debug_Image
(The_Context : Asis.Context)
return Wide_String
is
Arg_Cont : Context_Id;
LT : Wide_String renames A4G.A_Types.Asis_Wide_Line_Terminator;
begin
Arg_Cont := Get_Cont_Id (The_Context);
Reset_Context (Arg_Cont);
return LT & "Context Debug_Image: " &
LT & "Context Id is" &
Context_Id'Wide_Image (Arg_Cont) &
LT & To_Wide_String (Debug_String (The_Context));
exception
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Debug_Image",
Ex => Ex);
end Debug_Image;
------------------
-- Default_Name --
------------------
function Default_Name return Wide_String is
begin
return Nil_Asis_Wide_String;
end Default_Name;
------------------------
-- Default_Parameters --
------------------------
function Default_Parameters return Wide_String is
begin
return Nil_Asis_Wide_String;
end Default_Parameters;
----------------
-- Dissociate --
----------------
procedure Dissociate (The_Context : in out Asis.Context) is
Cont : Context_Id;
begin
Cont := Get_Cont_Id (The_Context);
if Is_Opened (Cont) then
Set_Error_Status (Status => Value_Error,
Diagnosis => Package_Name & "Dissociate: "
& "the Context is open");
raise ASIS_Inappropriate_Context;
end if;
if Debug_Flag_C or else
Debug_Lib_Model or else
Debug_Mode
then
Write_Str ("Dissociating Context ");
Write_Int (Int (Cont));
Write_Eol;
Print_Context_Parameters (Cont);
end if;
if Is_Associated (Cont) then
Erase_Old (Cont);
Set_Is_Associated (Cont, False);
end if;
exception
when ASIS_Inappropriate_Context =>
raise;
when ASIS_Failed =>
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information (Outer_Call => Package_Name & "Dissociate");
end if;
raise;
when Ex : others =>
Report_ASIS_Bug
(Query_Name => Package_Name & "Dissociate",
Ex => Ex);
end Dissociate;
------------
-- Exists --
------------
function Exists (The_Context : Asis.Context) return Boolean is
Cont : Context_Id;
begin
Cont := Get_Cont_Id (The_Context);
return Is_Associated (Cont);
end Exists;
----------------------
-- Has_Associations --
----------------------
function Has_Associations
(The_Context : Asis.Context)
return Boolean
is
Cont : Context_Id;
begin
Cont := Get_Cont_Id (The_Context);
return Is_Associated (Cont);
end Has_Associations;
--------------
-- Is_Equal --
--------------
function Is_Equal
(Left : Asis.Context;
Right : Asis.Context)
return Boolean
is
begin
return Get_Cont_Id (Left) = Get_Cont_Id (Right);
-- Should be revised
end Is_Equal;
------------------
-- Is_Identical --
------------------
function Is_Identical
(Left : Asis.Context;
Right : Asis.Context)
return Boolean
is
begin
return Get_Cont_Id (Left) = Get_Cont_Id (Right);
end Is_Identical;
-------------
-- Is_Open --
-------------
function Is_Open (The_Context : Asis.Context) return Boolean is
Cont : Context_Id;
begin
Cont := Get_Cont_Id (The_Context);
return Is_Opened (Cont);
end Is_Open;
----------
-- Name --
----------
function Name (The_Context : Asis.Context) return Wide_String is
Cont : Context_Id;
begin
Cont := Get_Cont_Id (The_Context);
return To_Wide_String (Get_Context_Name (Cont));
end Name;
----------
-- Open --
----------
procedure Open (The_Context : in out Asis.Context) is
Cont : Context_Id;
Context_Tree_Mode : Tree_Mode;
begin
Cont := Get_Cont_Id (The_Context);
if not Is_Associated (Cont) then
Set_Error_Status (Status => Value_Error,
Diagnosis => Package_Name & "Open: " &
"the Context does not have association");
raise ASIS_Inappropriate_Context;
elsif Is_Opened (Cont) then
Set_Error_Status (Status => Value_Error,
Diagnosis => Package_Name & "Open: " &
"the Context has already been opened");
raise ASIS_Inappropriate_Context;
end if;
Reset_Context (Cont);
Context_Tree_Mode := Tree_Processing_Mode (Cont);
if Tree_Processing_Mode (Cont) = GNSA then
Set_Error_Status (Status => Use_Error,
Diagnosis => Package_Name & "Open: " &
"GNSA Context mode is not allowed");
raise ASIS_Inappropriate_Context;
end if;
Increase_ASIS_OS_Time;
Pre_Initialize (Cont);
A4G.Contt.Initialize (Cont);
-- Having these two Pre_Initialize and A4G.Contt.Initialize calling
-- one after another is a kind of junk, but there are some problems
-- with multi-context processing which have not been completely
-- detected and which does not allow to get rid of this definitely
-- redundunt "initialization"
case Context_Tree_Mode is
when Pre_Created | Mixed =>
Scan_Trees_New (Cont);
when Incremental =>
-- Not the best approach, unfortunately
begin
Scan_Trees_New (Cont);
exception
when Inconsistent_Incremental_Context =>
-- Setting empty incremental context:
Pre_Initialize (Cont);
A4G.Contt.Initialize (Cont);
end;
when others =>
null;
end case;
Set_Is_Opened (Cont, True);
Save_Context (Cont);
Set_Current_Cont (Nil_Context_Id);
exception
when Program_Error =>
raise;
when ASIS_Inappropriate_Context =>
raise;
when ASIS_Failed =>
Set_Is_Opened (Cont, False);
Set_Current_Cont (Nil_Context_Id);
if Status_Indicator = Unhandled_Exception_Error then
Add_Call_Information (Outer_Call => Package_Name & "Open");
end if;
raise;
when Ex : others =>
Set_Is_Opened (Cont, False);
Set_Current_Cont (Nil_Context_Id);
Report_ASIS_Bug
(Query_Name => Package_Name & "Open",
Ex => Ex);
end Open;
----------------
-- Parameters --
----------------
function Parameters (The_Context : Asis.Context) return Wide_String is
Cont : Context_Id;
begin
Cont := Get_Cont_Id (The_Context);
return To_Wide_String (Get_Context_Parameters (Cont));
end Parameters;
end Asis.Ada_Environments;
|
MacPaint 1.3 Source/MyTools.asm | Computer-history-Museum/MacPaint | 2 | 82948 | <reponame>Computer-history-Museum/MacPaint
;MyTools.text, subset of ToolTraps.Text sufficient for MacPaint
;--------------------------------------------------------------------
;
; ToolTraps is the Pascal/QuickDraw-ToolBox trap interface.
; It defines all the names declared external in the interface
; code, and implements them by trapping with the "auto-pop" bit
; set to remove the extra return address on the stack
; before dispatching. Most of this file was generated by the
; program "MakeTTraps".
;
; "written" by <NAME> 31-Oct-82
;
; MODIFICATION HISTORY:
;
; 21-Nov-82 AJH regenerated for ROM 1.8
; 01-Dec-82 AJH changes for ROM 1.9
; 13-Feb-83 AJH regenerated for ROM 2.0
; 16-Mar-83 AJH updated for ROM 2.4
; 20-Apr-83 BLH Changed dialog proc names for ROM 3.0
; 4-May-83 BLH Added new resource procs for ROM 3.0
; 28-May-83 SC Added text edit stuff and changed dialog
; 03-Jun-83 AJH Regenerated for ROM 4.0
; 08-Jun-83 SC Changed AlertSound to ErrorSound
; 13-Jun-83 AJH Added InsertResMenu, OpenDeskAcc
; 04-Aug-83 SC Added TEInsert, TEGetText, TESetJust
; 04-Aug-83 SC Added SystemBeep, DrawGrow
; 06-Aug-83 SC Added HandAndHand, PtrAndHand
; 06-Aug-83 BLH Removed EndSubResource. Changed BeginSubResource to
; HomeResFile. Added GetFinderInfo, SetFinderInfo
; at the end.
; 12-Aug-83 AJH Added DragGrayRgn
; 16-Aug-83 SC Added scrap stuff
; 18-Aug-83 BLH Removed GetFinderInfo, SetFinderInfo.
; 2-Sep-83 SC Removed Bytes stuff (It should be an OS).
;
;--------------------------------------------------------------------
.PROC TTraps,0
;
.DEF InitCurs
InitCurs .WORD $AC50
.DEF SetCurso
SetCurso .WORD $AC51
.DEF HideCurs
HideCurs .WORD $AC52
.DEF ShowCurs
ShowCurs .WORD $AC53
.DEF ShieldCu
ShieldCu .WORD $AC55
.DEF ObscureC
ObscureC .WORD $AC56
.DEF BitAnd
BitAnd .WORD $AC58
.DEF BitShift
BitShift .WORD $AC5C
.DEF BitTst
BitTst .WORD $AC5D
.DEF BitSet
BitSet .WORD $AC5E
.DEF BitClr
BitClr .WORD $AC5F
.DEF GetPixel
GetPixel .WORD $AC65
.DEF FixRatio
FixRatio .WORD $AC69
.DEF HiWord
HiWord .WORD $AC6A
.DEF LoWord
LoWord .WORD $AC6B
.DEF InitGraf
InitGraf .WORD $AC6E
.DEF OpenPort
OpenPort .WORD $AC6F
.DEF LocalToG
LocalToG .WORD $AC70
.DEF GlobalTo
GlobalTo .WORD $AC71
.DEF SetPort
SetPort .WORD $AC73
.DEF GetPort
GetPort .WORD $AC74
.DEF SetPortB
SetPortB .WORD $AC75
.DEF SetOrigi
SetOrigi .WORD $AC78
.DEF ClipRect
ClipRect .WORD $AC7B
.DEF ClosePor
ClosePor .WORD $AC7D
.DEF AddPt
AddPt .WORD $AC7E
.DEF SubPt
SubPt .WORD $AC7F
.DEF SetPt
SetPt .WORD $AC80
.DEF EqualPt
EqualPt .WORD $AC81
.DEF DrawChar
DrawChar .WORD $AC83
.DEF DrawStri
DrawStri .WORD $AC84
.DEF TextFont
TextFont .WORD $AC87
.DEF TextMode
TextMode .WORD $AC89
.DEF TextSize
TextSize .WORD $AC8A
.DEF GetFontI
GetFontI .WORD $AC8B
.DEF StringWi
StringWi .WORD $AC8C
.DEF CharWidt
CharWidt .WORD $AC8D
.DEF LineTo
LineTo .WORD $AC91
.DEF Line
Line .WORD $AC92
.DEF MoveTo
MoveTo .WORD $AC93
.DEF Moov
Moov .WORD $AC94
.DEF HidePen
HidePen .WORD $AC96
.DEF ShowPen
ShowPen .WORD $AC97
.DEF PenSize
PenSize .WORD $AC9B
.DEF PenMode
PenMode .WORD $AC9C
.DEF PenPat
PenPat .WORD $AC9D
.DEF PenNorma
PenNorma .WORD $AC9E
.DEF FrameRec
FrameRec .WORD $ACA1
.DEF PaintRec
PaintRec .WORD $ACA2
.DEF EraseRec
EraseRec .WORD $ACA3
.DEF InvertRe
InvertRe .WORD $ACA4
.DEF FillRect
FillRect .WORD $ACA5
.DEF EqualRec
EqualRec .WORD $ACA6
.DEF SetRect
SetRect .WORD $ACA7
.DEF OffSetRe
OffSetRe .WORD $ACA8
.DEF InSetRec
InSetRec .WORD $ACA9
.DEF SectRect
SectRect .WORD $ACAA
.DEF Pt2Rect
Pt2Rect .WORD $ACAC
.DEF PtInRect
PtInRect .WORD $ACAD
.DEF EmptyRec
EmptyRec .WORD $ACAE
.DEF FrameRou
FrameRou .WORD $ACB0
.DEF PaintRou
PaintRou .WORD $ACB1
.DEF FrameOva
FrameOva .WORD $ACB7
.DEF PaintOva
PaintOva .WORD $ACB8
.DEF PackBits
PackBits .WORD $ACCF
.DEF UnpackBi
UnpackBi .WORD $ACD0
.DEF PaintRgn
PaintRgn .WORD $ACD3
.DEF NewRgn
NewRgn .WORD $ACD8
.DEF DisposeR
DisposeR .WORD $ACD9
.DEF OpenRgn
OpenRgn .WORD $ACDA
.DEF CloseRgn
CloseRgn .WORD $ACDB
.DEF RectRgn
RectRgn .WORD $ACDF
.DEF OffSetRg
OffSetRg .WORD $ACE0
.DEF EmptyRgn
EmptyRgn .WORD $ACE2
.DEF PtInRgn
PtInRgn .WORD $ACE8
.DEF RectInRg
RectInRg .WORD $ACE9
.DEF CopyBits
CopyBits .WORD $ACEC
.DEF ScrollRe
ScrollRe .WORD $ACEF
.DEF SetStdPr
SetStdPr .WORD $ACEA
.DEF StdText
StdText .WORD $AC82
.DEF PicComme
PicComme .WORD $ACF2
.DEF OpenPict
OpenPict .WORD $ACF3
.DEF ClosePic
ClosePic .WORD $ACF4
.DEF KillPict
KillPict .WORD $ACF5
.DEF DrawPict
DrawPict .WORD $ACF6
.DEF MapPt
MapPt .WORD $ACF9
.DEF MapRect
MapRect .WORD $ACFA
.DEF InitFont
InitFont .WORD $ACFE
.DEF GetFontN
GetFontN .WORD $ACFF
.DEF GetFNum
GetFNum .WORD $AD00
.DEF RealFont
RealFont .WORD $AD02
.DEF SetFontL
SetFontL .WORD $AD03
.DEF InitWind
InitWind .WORD $AD12
.DEF NewWindo
NewWindo .WORD $AD13
.DEF ShowWind
ShowWind .WORD $AD15
.DEF HideWind
HideWind .WORD $AD16
.DEF SetWTitl
SetWTitl .WORD $AD1A
.DEF TrackGoA
TrackGoA .WORD $AD1E
.DEF SelectWi
SelectWi .WORD $AD1F
.DEF BeginUpD
BeginUpD .WORD $AD22
.DEF EndUpDat
EndUpDat .WORD $AD23
.DEF ValidRec
ValidRec .WORD $AD2A
.DEF FindWind
FindWind .WORD $AD2C
.DEF InitMenu
InitMenu .WORD $AD30
.DEF InsertMe
InsertMe .WORD $AD35
.DEF DrawMenu
DrawMenu .WORD $AD37
.DEF HiliteMe
HiliteMe .WORD $AD38
.DEF EnableIt
EnableIt .WORD $AD39
.DEF DisableI
DisableI .WORD $AD3A
.DEF MenuSele
MenuSele .WORD $AD3D
.DEF MenuKey
MenuKey .WORD $AD3E
.DEF SetItemS
SetItemS .WORD $AD42
.DEF CheckIte
CheckIte .WORD $AD45
.DEF GetItem
GetItem .WORD $AD46
.DEF AddResMe
AddResMe .WORD $AD4D
.DEF CountMIt
CountMIt .WORD $AD50
.DEF ShowCont
ShowCont .WORD $AD57
.DEF HideCont
HideCont .WORD $AD58
.DEF TrackCon
TrackCon .WORD $AD68
.DEF FindCont
FindCont .WORD $AD6C
.DEF GetNextE
GetNextE .WORD $AD70
.DEF GetMouse
GetMouse .WORD $AD72
.DEF StillDow
StillDow .WORD $AD73
.DEF TickCoun
TickCoun .WORD $AD75
.DEF GetKeys
GetKeys .WORD $AD76
.DEF InitDial
InitDial .WORD $AD7B
.DEF GetNewDi
GetNewDi .WORD $AD7C
.DEF DisposDi
DisposDi .WORD $AD83
.DEF Alert
Alert .WORD $AD85
.DEF ModalDia
ModalDia .WORD $AD91
.DEF GetResou
GetResou .WORD $ADA0
.DEF SystemCl
SystemCl .WORD $ADB3
.DEF SystemTa
SystemTa .WORD $ADB4
.DEF OpenDeskAcc
OpenDeskAcc .WORD $ADB6
.DEF GetCurso
GetCurso .WORD $ADB9
.DEF GetStrin
GetStrin .WORD $ADBA
.DEF GetPictu
GetPictu .WORD $ADBC
.DEF GetNewCo
GetNewCo .WORD $ADBE
.DEF GetMenu
GetMenu .WORD $ADBF
.DEF SystemEdit
SystemEdit .WORD $ADC2
.DEF SystemBe
SystemBe .WORD $ADC8
.DEF TEInit
TEInit .WORD $ADCC
.DEF TextBox
TextBox .WORD $ADCE
.DEF UnLoadSe
UnLoadSe .WORD $ADF1
.DEF ExitToSh
ExitToSh .WORD $ADF4
.DEF InfoScra
InfoScra .WORD $ADF9
.DEF UnloadSc
UnloadSc .WORD $ADFA
.DEF ZeroScra
ZeroScra .WORD $ADFC
.DEF GetScrap
GetScrap .WORD $ADFD
.END
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/varsize3_pkg2.ads | best08618/asylo | 7 | 6748 | package Varsize3_Pkg2 is
function Last_Index return Positive;
end Varsize3_Pkg2;
|
programs/oeis/130/A130723.asm | neoneye/loda | 22 | 242665 | <filename>programs/oeis/130/A130723.asm
; A130723: Least common multiple of 3 and n^2+n+1.
; 3,3,21,39,21,93,129,57,219,273,111,399,471,183,633,723,273,921,1029,381,1263,1389,507,1659,1803,651,2109,2271,813,2613,2793,993,3171,3369,1191,3783,3999,1407,4449,4683,1641,5169,5421,1893,5943,6213,2163,6771,7059,2451,7653,7959,2757,8589,8913,3081,9579,9921,3423,10623,10983,3783,11721,12099,4161,12873,13269,4557,14079,14493,4971,15339,15771,5403,16653,17103,5853,18021,18489,6321,19443,19929,6807,20919,21423,7311,22449,22971,7833,24033,24573,8373,25671,26229,8931,27363,27939,9507,29109,29703
mul $0,2
add $0,1
pow $0,2
dif $0,3
div $0,24
mul $0,18
add $0,3
|
oeis/000/A000005.asm | neoneye/loda-programs | 11 | 6119 | <filename>oeis/000/A000005.asm
; A000005: d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n.
; Submitted by <NAME>
; 1,2,2,3,2,4,2,4,3,4,2,6,2,4,4,5,2,6,2,6,4,4,2,8,3,4,4,6,2,8,2,6,4,4,4,9,2,4,4,8,2,8,2,6,6,4,2,10,3,6,4,6,2,8,4,8,4,4,2,12,2,4,6,7,4,8,2,6,4,8,2,12,2,4,6,6,4,8,2,10,5,4,2,12,4,4,4,8,2,12,4,6,4,4,4,12,2,6,6,9
add $0,1
mov $1,1
mov $2,2
lpb $0
mov $3,$0
lpb $3
mov $4,$0
mod $4,$2
add $2,1
cmp $4,0
cmp $4,0
sub $3,$4
lpe
mov $5,1
lpb $0
dif $0,$2
add $5,1
lpe
mul $1,$5
lpe
mov $0,$1
|
programs/oeis/025/A025719.asm | karttu/loda | 1 | 84682 | <filename>programs/oeis/025/A025719.asm
; A025719: Index of 6^n within sequence of numbers of form 6^i*10^j.
; 1,2,4,7,11,15,20,26,33,41,49,58,68,79,90,102,115,129,144,159,175,192,210,228,247,267,288,310,332,355,379,404,429,455,482,510,539,568,598,629,661,693,726,760,795,831,867,904,942,981,1020,1060,1101,1143,1186,1229
mov $1,$0
mul $1,7
mul $1,$0
sub $1,$0
div $1,6
add $1,6
div $1,3
sub $1,1
add $1,$0
|
SimpleExpressionInterpreter/AntlrDefine/Expr.g4 | whoisfpc/SimpleExpressionInterpreter | 0 | 1269 | grammar Expr;
prog: expr EOF ;
expr:
ID LP exprList? RP # funcExpr
| expr (MUL | DIV) expr # binaryExpr
| expr (ADD | SUB) expr # binaryExpr
| term # termExpr
| LP expr RP #singleExpr
;
exprList: expr (COMMA expr)* ;
term:
NUM
| PREVAR
;
fragment DIGIT: [0-9] ;
fragment LETTER : [a-zA-Z] ;
WS: [ \t\r\n]+ -> skip ;
NUM: DIGIT+ ('.' DIGIT+)? ;
ID: LETTER (LETTER | DIGIT)* ;
// predefine variable, fetch from out of context
PREVAR: '$' DIGIT+ ;
ADD: '+' ;
SUB: '-' ;
MUL: '*' ;
DIV: '/' ;
LP: '(' ;
RP: ')' ;
COMMA: ',' ; |
BasicIS4/Syntax/Translation.agda | mietek/hilbert-gentzen | 29 | 17257 | <filename>BasicIS4/Syntax/Translation.agda
-- Basic intuitionistic modal logic S4, without ∨, ⊥, or ◇.
-- Translation between different formalisations of syntax.
module BasicIS4.Syntax.Translation where
open import BasicIS4.Syntax.Common public
import BasicIS4.Syntax.ClosedHilbertSequential as CHS
import BasicIS4.Syntax.ClosedHilbert as CH
import BasicIS4.Syntax.HilbertSequential as HS
import BasicIS4.Syntax.Hilbert as H
import BasicIS4.Syntax.Gentzen as G
import BasicIS4.Syntax.DyadicHilbertSequential as DHS
import BasicIS4.Syntax.DyadicHilbert as DH
import BasicIS4.Syntax.DyadicGentzen as DG
import BasicIS4.Syntax.LabelledGentzen as LG
open HS using () renaming (_⊦⊢_ to HS⟨_⊦⊢_⟩ ; _⊢_ to HS⟨_⊢_⟩) public
open H using () renaming (_⊢_ to H⟨_⊢_⟩ ; _⊢⋆_ to H⟨_⊢⋆_⟩) public
open G using () renaming (_⊢_ to G⟨_⊢_⟩ ; _⊢⋆_ to G⟨_⊢⋆_⟩) public
open DHS using () renaming (_⊦⊢_ to DHS⟨_⊦⊢_⟩ ; _⊢_ to DHS⟨_⊢_⟩) public
open DH using () renaming (_⊢_ to DH⟨_⊢_⟩) public
open DG using () renaming (_⊢_ to DG⟨_⊢_⟩ ; _⊢⋆_ to DG⟨_⊢⋆_⟩) public
open LG using (_↝_ ; _◎_ ; _◎⋆_) renaming (_⊢_ to LG⟨_⊢_⟩ ; _⊢⋆_ to LG⟨_⊢⋆_⟩) public
-- Available translations.
--
-- ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
-- │ CHS │ CH │ HS │ H │ G │ DHS │ DH │ DG │ LG │
-- ┌─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
-- │ CHS │ │ d │ d │ ∘ │ ∘ │ ∘ │ ∘ │ ∘ │ ∘ │
-- ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
-- │ CH │ d │ │ ∘ │ d │ ∘ │ ∘ │ ∘ │ ∘ │ ∘ │
-- ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
-- │ HS │ d │ ∘ │ │ d │ ∘ │ d │ ∘ │ ∘ │ ∘ │
-- ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
-- │ H │ ∘ │ d │ d │ │ d │ ∘ │ d │ ∘ │ ∘ │
-- ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
-- │ G │ ∘ │ ∘ │ ∘ │ d │ │ ∘ │ ∘ │ d │ d │
-- ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
-- │ DHS │ ∘ │ ∘ │ d │ ∘ │ ∘ │ │ d │ ∘ │ ∘ │
-- ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
-- │ DH │ ∘ │ ∘ │ ∘ │ d │ ∘ │ d │ │ d │ ∘ │
-- ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
-- │ DG │ ∘ │ ∘ │ ∘ │ ∘ │ ∘! │ ∘ │ d │ │ ∘ │
-- ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
-- │ LG │ ∘ │ ∘ │ ∘ │ WIP │ WIP │ ∘ │ ∘ │ ∘ │ │
-- └─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘
--
-- d : Direct translation.
-- ∘ : Composition of translations.
-- ∘! : Composition; direct translation fails the termination check.
-- WIP : Work in progress.
-- Translation from closed Hilbert-style sequential to closed Hilbert-style.
chs→ch : ∀ {A} → CHS.⊢ A → CH.⊢ A
chs→ch (Ξ , ts) = chs⊦→ch ts top
where
chs⊦→ch : ∀ {A Ξ} → CHS.⊦⊢ Ξ → A ∈ Ξ → CH.⊢ A
chs⊦→ch (CHS.mp i j ts) top = CH.app (chs⊦→ch ts i) (chs⊦→ch ts j)
chs⊦→ch (CHS.ci ts) top = CH.ci
chs⊦→ch (CHS.ck ts) top = CH.ck
chs⊦→ch (CHS.cs ts) top = CH.cs
chs⊦→ch (CHS.nec ss ts) top = CH.box (chs⊦→ch ss top)
chs⊦→ch (CHS.cdist ts) top = CH.cdist
chs⊦→ch (CHS.cup ts) top = CH.cup
chs⊦→ch (CHS.cdown ts) top = CH.cdown
chs⊦→ch (CHS.cpair ts) top = CH.cpair
chs⊦→ch (CHS.cfst ts) top = CH.cfst
chs⊦→ch (CHS.csnd ts) top = CH.csnd
chs⊦→ch (CHS.unit ts) top = CH.unit
chs⊦→ch (CHS.mp i j ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.ci ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.ck ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.cs ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.nec ss ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.cdist ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.cup ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.cdown ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.cpair ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.cfst ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.csnd ts) (pop k) = chs⊦→ch ts k
chs⊦→ch (CHS.unit ts) (pop k) = chs⊦→ch ts k
-- Translation from closed Hilbert-style to closed Hilbert-style sequential.
ch→chs : ∀ {A} → CH.⊢ A → CHS.⊢ A
ch→chs (CH.app t u) = CHS.app (ch→chs t) (ch→chs u)
ch→chs CH.ci = ∅ , CHS.ci CHS.nil
ch→chs CH.ck = ∅ , CHS.ck CHS.nil
ch→chs CH.cs = ∅ , CHS.cs CHS.nil
ch→chs (CH.box t) = CHS.box (ch→chs t)
ch→chs CH.cdist = ∅ , CHS.cdist CHS.nil
ch→chs CH.cup = ∅ , CHS.cup CHS.nil
ch→chs CH.cdown = ∅ , CHS.cdown CHS.nil
ch→chs CH.cpair = ∅ , CHS.cpair CHS.nil
ch→chs CH.cfst = ∅ , CHS.cfst CHS.nil
ch→chs CH.csnd = ∅ , CHS.csnd CHS.nil
ch→chs CH.unit = ∅ , CHS.unit CHS.nil
-- Translation from Hilbert-style sequential to Hilbert-style.
hs→h : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → H⟨ Γ ⊢ A ⟩
hs→h (Ξ , ts) = hs⊦→h ts top
where
hs⊦→h : ∀ {A Ξ Γ} → HS⟨ Γ ⊦⊢ Ξ ⟩ → A ∈ Ξ → H⟨ Γ ⊢ A ⟩
hs⊦→h (HS.var i ts) top = H.var i
hs⊦→h (HS.mp i j ts) top = H.app (hs⊦→h ts i) (hs⊦→h ts j)
hs⊦→h (HS.ci ts) top = H.ci
hs⊦→h (HS.ck ts) top = H.ck
hs⊦→h (HS.cs ts) top = H.cs
hs⊦→h (HS.nec ss ts) top = H.box (hs⊦→h ss top)
hs⊦→h (HS.cdist ts) top = H.cdist
hs⊦→h (HS.cup ts) top = H.cup
hs⊦→h (HS.cdown ts) top = H.cdown
hs⊦→h (HS.cpair ts) top = H.cpair
hs⊦→h (HS.cfst ts) top = H.cfst
hs⊦→h (HS.csnd ts) top = H.csnd
hs⊦→h (HS.unit ts) top = H.unit
hs⊦→h (HS.var i ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.mp i j ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.ci ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.ck ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.cs ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.nec ss ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.cdist ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.cup ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.cdown ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.cpair ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.cfst ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.csnd ts) (pop k) = hs⊦→h ts k
hs⊦→h (HS.unit ts) (pop k) = hs⊦→h ts k
-- Translation from Hilbert-style to Hilbert-style sequential.
h→hs : ∀ {A Γ} → H⟨ Γ ⊢ A ⟩ → HS⟨ Γ ⊢ A ⟩
h→hs (H.var i) = ∅ , HS.var i HS.nil
h→hs (H.app t u) = HS.app (h→hs t) (h→hs u)
h→hs H.ci = ∅ , HS.ci HS.nil
h→hs H.ck = ∅ , HS.ck HS.nil
h→hs H.cs = ∅ , HS.cs HS.nil
h→hs (H.box t) = HS.box (h→hs t)
h→hs H.cdist = ∅ , HS.cdist HS.nil
h→hs H.cup = ∅ , HS.cup HS.nil
h→hs H.cdown = ∅ , HS.cdown HS.nil
h→hs H.cpair = ∅ , HS.cpair HS.nil
h→hs H.cfst = ∅ , HS.cfst HS.nil
h→hs H.csnd = ∅ , HS.csnd HS.nil
h→hs H.unit = ∅ , HS.unit HS.nil
-- Translation from dyadic Hilbert-style sequential to dyadic Hilbert-style.
dhs→dh : ∀ {A Γ Δ} → DHS⟨ Γ ⁏ Δ ⊢ A ⟩ → DH⟨ Γ ⁏ Δ ⊢ A ⟩
dhs→dh (Ξ , ts) = dhs⊦→dh ts top
where
dhs⊦→dh : ∀ {A Ξ Γ Δ} → DHS⟨ Γ ⁏ Δ ⊦⊢ Ξ ⟩ → A ∈ Ξ → DH⟨ Γ ⁏ Δ ⊢ A ⟩
dhs⊦→dh (DHS.var i ts) top = DH.var i
dhs⊦→dh (DHS.mp i j ts) top = DH.app (dhs⊦→dh ts i) (dhs⊦→dh ts j)
dhs⊦→dh (DHS.ci ts) top = DH.ci
dhs⊦→dh (DHS.ck ts) top = DH.ck
dhs⊦→dh (DHS.cs ts) top = DH.cs
dhs⊦→dh (DHS.mvar i ts) top = DH.mvar i
dhs⊦→dh (DHS.nec ss ts) top = DH.box (dhs⊦→dh ss top)
dhs⊦→dh (DHS.cdist ts) top = DH.cdist
dhs⊦→dh (DHS.cup ts) top = DH.cup
dhs⊦→dh (DHS.cdown ts) top = DH.cdown
dhs⊦→dh (DHS.cpair ts) top = DH.cpair
dhs⊦→dh (DHS.cfst ts) top = DH.cfst
dhs⊦→dh (DHS.csnd ts) top = DH.csnd
dhs⊦→dh (DHS.unit ts) top = DH.unit
dhs⊦→dh (DHS.var i ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.mp i j ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.ci ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.ck ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.cs ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.mvar i ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.nec ss ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.cdist ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.cup ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.cdown ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.cpair ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.cfst ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.csnd ts) (pop k) = dhs⊦→dh ts k
dhs⊦→dh (DHS.unit ts) (pop k) = dhs⊦→dh ts k
-- Translation from dyadic Hilbert-style to dyadic Hilbert-style sequential
dh→dhs : ∀ {A Γ Δ} → DH⟨ Γ ⁏ Δ ⊢ A ⟩ → DHS⟨ Γ ⁏ Δ ⊢ A ⟩
dh→dhs (DH.var i) = ∅ , DHS.var i DHS.nil
dh→dhs (DH.app t u) = DHS.app (dh→dhs t) (dh→dhs u)
dh→dhs DH.ci = ∅ , DHS.ci DHS.nil
dh→dhs DH.ck = ∅ , DHS.ck DHS.nil
dh→dhs DH.cs = ∅ , DHS.cs DHS.nil
dh→dhs (DH.mvar i) = ∅ , DHS.mvar i DHS.nil
dh→dhs (DH.box t) = DHS.box (dh→dhs t)
dh→dhs DH.cdist = ∅ , DHS.cdist DHS.nil
dh→dhs DH.cup = ∅ , DHS.cup DHS.nil
dh→dhs DH.cdown = ∅ , DHS.cdown DHS.nil
dh→dhs DH.cpair = ∅ , DHS.cpair DHS.nil
dh→dhs DH.cfst = ∅ , DHS.cfst DHS.nil
dh→dhs DH.csnd = ∅ , DHS.csnd DHS.nil
dh→dhs DH.unit = ∅ , DHS.unit DHS.nil
-- Deduction and detachment theorems for Hilbert-style sequential.
hs-lam : ∀ {A B Γ} → HS⟨ Γ , A ⊢ B ⟩ → HS⟨ Γ ⊢ A ▻ B ⟩
hs-lam = h→hs ∘ H.lam ∘ hs→h
hs-lam⋆₀ : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → HS⟨ ∅ ⊢ Γ ▻⋯▻ A ⟩
hs-lam⋆₀ = h→hs ∘ H.lam⋆₀ ∘ hs→h
hs-det : ∀ {A B Γ} → HS⟨ Γ ⊢ A ▻ B ⟩ → HS⟨ Γ , A ⊢ B ⟩
hs-det = h→hs ∘ H.det ∘ hs→h
hs-det⋆₀ : ∀ {A Γ} → HS⟨ ∅ ⊢ Γ ▻⋯▻ A ⟩ → HS⟨ Γ ⊢ A ⟩
hs-det⋆₀ = h→hs ∘ H.det⋆₀ ∘ hs→h
-- Deduction and detachment theorems for dyadic Hilbert-style sequential.
dhs-lam : ∀ {A B Γ Δ} → DHS⟨ Γ , A ⁏ Δ ⊢ B ⟩ → DHS⟨ Γ ⁏ Δ ⊢ A ▻ B ⟩
dhs-lam = dh→dhs ∘ DH.lam ∘ dhs→dh
dhs-lam⋆₀ : ∀ {A Γ Δ} → DHS⟨ Γ ⁏ Δ ⊢ A ⟩ → DHS⟨ ∅ ⁏ Δ ⊢ Γ ▻⋯▻ A ⟩
dhs-lam⋆₀ = dh→dhs ∘ DH.lam⋆₀ ∘ dhs→dh
dhs-mlam : ∀ {A B Γ Δ} → DHS⟨ Γ ⁏ Δ , A ⊢ B ⟩ → DHS⟨ Γ ⁏ Δ ⊢ □ A ▻ B ⟩
dhs-mlam = dh→dhs ∘ DH.mlam ∘ dhs→dh
dhs-mlam⋆₀ : ∀ {Δ A Γ} → DHS⟨ Γ ⁏ Δ ⊢ A ⟩ → DHS⟨ Γ ⁏ ∅ ⊢ □⋆ Δ ▻⋯▻ A ⟩
dhs-mlam⋆₀ = dh→dhs ∘ DH.mlam⋆₀ ∘ dhs→dh
dhs-det : ∀ {A B Γ Δ} → DHS⟨ Γ ⁏ Δ ⊢ A ▻ B ⟩ → DHS⟨ Γ , A ⁏ Δ ⊢ B ⟩
dhs-det = dh→dhs ∘ DH.det ∘ dhs→dh
dhs-det⋆₀ : ∀ {A Γ Δ} → DHS⟨ ∅ ⁏ Δ ⊢ Γ ▻⋯▻ A ⟩ → DHS⟨ Γ ⁏ Δ ⊢ A ⟩
dhs-det⋆₀ = dh→dhs ∘ DH.det⋆₀ ∘ dhs→dh
dhs-mdet : ∀ {A B Γ Δ} → DHS⟨ Γ ⁏ Δ ⊢ □ A ▻ B ⟩ → DHS⟨ Γ ⁏ Δ , A ⊢ B ⟩
dhs-mdet = dh→dhs ∘ DH.mdet ∘ dhs→dh
dhs-mdet⋆₀ : ∀ {Δ A Γ} → DHS⟨ Γ ⁏ ∅ ⊢ □⋆ Δ ▻⋯▻ A ⟩ → DHS⟨ Γ ⁏ Δ ⊢ A ⟩
dhs-mdet⋆₀ = dh→dhs ∘ DH.mdet⋆₀ ∘ dhs→dh
-- Context manipulation for dyadic Hilbert-style sequential.
dhs-merge : ∀ {Δ A Γ} → DHS⟨ Γ ⁏ Δ ⊢ A ⟩ → DHS⟨ Γ ⧺ (□⋆ Δ) ⁏ ∅ ⊢ A ⟩
dhs-merge {Δ} = dh→dhs ∘ DH.merge ∘ dhs→dh
dhs-split : ∀ {Δ A Γ} → DHS⟨ Γ ⧺ (□⋆ Δ) ⁏ ∅ ⊢ A ⟩ → DHS⟨ Γ ⁏ Δ ⊢ A ⟩
dhs-split {Δ} = dh→dhs ∘ DH.split ∘ dhs→dh
-- Translation from closed Hilbert-style sequential to Hilbert-style sequential.
chs→hs₀ : ∀ {A} → CHS.⊢ A → HS⟨ ∅ ⊢ A ⟩
chs→hs₀ (Ξ , ts) = Ξ , chs⊦→hs⊦ ts
where
chs⊦→hs⊦ : ∀ {Ξ} → CHS.⊦⊢ Ξ → HS⟨ ∅ ⊦⊢ Ξ ⟩
chs⊦→hs⊦ CHS.nil = HS.nil
chs⊦→hs⊦ (CHS.mp i j ts) = HS.mp i j (chs⊦→hs⊦ ts)
chs⊦→hs⊦ (CHS.ci ts) = HS.ci (chs⊦→hs⊦ ts)
chs⊦→hs⊦ (CHS.ck ts) = HS.ck (chs⊦→hs⊦ ts)
chs⊦→hs⊦ (CHS.cs ts) = HS.cs (chs⊦→hs⊦ ts)
chs⊦→hs⊦ (CHS.cpair ts) = HS.cpair (chs⊦→hs⊦ ts)
chs⊦→hs⊦ (CHS.cfst ts) = HS.cfst (chs⊦→hs⊦ ts)
chs⊦→hs⊦ (CHS.csnd ts) = HS.csnd (chs⊦→hs⊦ ts)
chs⊦→hs⊦ (CHS.unit ts) = HS.unit (chs⊦→hs⊦ ts)
chs⊦→hs⊦ (CHS.nec ss ts) = HS.nec (chs⊦→hs⊦ ss) (chs⊦→hs⊦ ts)
chs⊦→hs⊦ (CHS.cdist ts) = HS.cdist (chs⊦→hs⊦ ts)
chs⊦→hs⊦ (CHS.cup ts) = HS.cup (chs⊦→hs⊦ ts)
chs⊦→hs⊦ (CHS.cdown ts) = HS.cdown (chs⊦→hs⊦ ts)
chs→hs : ∀ {A Γ} → CHS.⊢ Γ ▻⋯▻ A → HS⟨ Γ ⊢ A ⟩
chs→hs t = hs-det⋆₀ (chs→hs₀ t)
-- Translation from Hilbert-style sequential to closed Hilbert-style sequential.
hs₀→chs : ∀ {A} → HS⟨ ∅ ⊢ A ⟩ → CHS.⊢ A
hs₀→chs (Ξ , ts) = Ξ , hs₀⊦→chs⊦ ts
where
hs₀⊦→chs⊦ : ∀ {Ξ} → HS⟨ ∅ ⊦⊢ Ξ ⟩ → CHS.⊦⊢ Ξ
hs₀⊦→chs⊦ HS.nil = CHS.nil
hs₀⊦→chs⊦ (HS.var () ts)
hs₀⊦→chs⊦ (HS.mp i j ts) = CHS.mp i j (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.ci ts) = CHS.ci (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.ck ts) = CHS.ck (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.cs ts) = CHS.cs (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.cpair ts) = CHS.cpair (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.cfst ts) = CHS.cfst (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.csnd ts) = CHS.csnd (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.unit ts) = CHS.unit (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.nec ss ts) = CHS.nec (hs₀⊦→chs⊦ ss) (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.cdist ts) = CHS.cdist (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.cup ts) = CHS.cup (hs₀⊦→chs⊦ ts)
hs₀⊦→chs⊦ (HS.cdown ts) = CHS.cdown (hs₀⊦→chs⊦ ts)
hs→chs : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → CHS.⊢ Γ ▻⋯▻ A
hs→chs t = hs₀→chs (hs-lam⋆₀ t)
-- Translation from dyadic Hilbert-style sequential to Hilbert-style sequential.
dhs₀→hs : ∀ {A Γ} → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩ → HS⟨ Γ ⊢ A ⟩
dhs₀→hs (Ξ , ts) = Ξ , dhs₀⊦→hs⊦ ts
where
dhs₀⊦→hs⊦ : ∀ {Ξ Γ} → DHS⟨ Γ ⁏ ∅ ⊦⊢ Ξ ⟩ → HS⟨ Γ ⊦⊢ Ξ ⟩
dhs₀⊦→hs⊦ DHS.nil = HS.nil
dhs₀⊦→hs⊦ (DHS.var i ts) = HS.var i (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.mp i j ts) = HS.mp i j (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.ci ts) = HS.ci (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.ck ts) = HS.ck (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.cs ts) = HS.cs (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.mvar () ts)
dhs₀⊦→hs⊦ (DHS.nec ss ts) = HS.nec (dhs₀⊦→hs⊦ ss) (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.cdist ts) = HS.cdist (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.cup ts) = HS.cup (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.cdown ts) = HS.cdown (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.cpair ts) = HS.cpair (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.cfst ts) = HS.cfst (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.csnd ts) = HS.csnd (dhs₀⊦→hs⊦ ts)
dhs₀⊦→hs⊦ (DHS.unit ts) = HS.unit (dhs₀⊦→hs⊦ ts)
dhs→hs : ∀ {A Γ Δ} → DHS⟨ Γ ⁏ Δ ⊢ A ⟩ → HS⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩
dhs→hs = dhs₀→hs ∘ dhs-merge
-- Translation from Hilbert-style sequential to dyadic Hilbert-style sequential.
hs→dhs₀ : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩
hs→dhs₀ (Ξ , ts) = Ξ , hs⊦→dhs₀⊦ ts
where
hs⊦→dhs₀⊦ : ∀ {Ξ Γ} → HS⟨ Γ ⊦⊢ Ξ ⟩ → DHS⟨ Γ ⁏ ∅ ⊦⊢ Ξ ⟩
hs⊦→dhs₀⊦ HS.nil = DHS.nil
hs⊦→dhs₀⊦ (HS.var i ts) = DHS.var i (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.mp i j ts) = DHS.mp i j (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.ci ts) = DHS.ci (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.ck ts) = DHS.ck (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.cs ts) = DHS.cs (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.nec ss ts) = DHS.nec (hs⊦→dhs₀⊦ ss) (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.cdist ts) = DHS.cdist (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.cup ts) = DHS.cup (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.cdown ts) = DHS.cdown (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.cpair ts) = DHS.cpair (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.cfst ts) = DHS.cfst (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.csnd ts) = DHS.csnd (hs⊦→dhs₀⊦ ts)
hs⊦→dhs₀⊦ (HS.unit ts) = DHS.unit (hs⊦→dhs₀⊦ ts)
hs→dhs : ∀ {A Γ Δ} → HS⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩ → DHS⟨ Γ ⁏ Δ ⊢ A ⟩
hs→dhs = dhs-split ∘ hs→dhs₀
-- Translation from closed Hilbert-style to Hilbert-style.
ch→h₀ : ∀ {A} → CH.⊢ A → H⟨ ∅ ⊢ A ⟩
ch→h₀ (CH.app t u) = H.app (ch→h₀ t) (ch→h₀ u)
ch→h₀ CH.ci = H.ci
ch→h₀ CH.ck = H.ck
ch→h₀ CH.cs = H.cs
ch→h₀ CH.cpair = H.cpair
ch→h₀ CH.cfst = H.cfst
ch→h₀ CH.csnd = H.csnd
ch→h₀ CH.unit = H.unit
ch→h₀ (CH.box t) = H.box (ch→h₀ t)
ch→h₀ CH.cdist = H.cdist
ch→h₀ CH.cup = H.cup
ch→h₀ CH.cdown = H.cdown
ch→h : ∀ {A Γ} → CH.⊢ Γ ▻⋯▻ A → H⟨ Γ ⊢ A ⟩
ch→h t = H.det⋆₀ (ch→h₀ t)
-- Translation from Hilbert-style to closed Hilbert-style.
h₀→ch : ∀ {A} → H⟨ ∅ ⊢ A ⟩ → CH.⊢ A
h₀→ch (H.var ())
h₀→ch (H.app t u) = CH.app (h₀→ch t) (h₀→ch u)
h₀→ch H.ci = CH.ci
h₀→ch H.ck = CH.ck
h₀→ch H.cs = CH.cs
h₀→ch H.cpair = CH.cpair
h₀→ch H.cfst = CH.cfst
h₀→ch H.csnd = CH.csnd
h₀→ch H.unit = CH.unit
h₀→ch (H.box t) = CH.box (h₀→ch t)
h₀→ch H.cdist = CH.cdist
h₀→ch H.cup = CH.cup
h₀→ch H.cdown = CH.cdown
h→ch : ∀ {A Γ} → H⟨ Γ ⊢ A ⟩ → CH.⊢ Γ ▻⋯▻ A
h→ch t = h₀→ch (H.lam⋆₀ t)
-- Translation from dyadic Hilbert-style to Hilbert-style.
dh₀→h : ∀ {A Γ} → DH⟨ Γ ⁏ ∅ ⊢ A ⟩ → H⟨ Γ ⊢ A ⟩
dh₀→h (DH.var i) = H.var i
dh₀→h (DH.app t u) = H.app (dh₀→h t) (dh₀→h u)
dh₀→h DH.ci = H.ci
dh₀→h DH.ck = H.ck
dh₀→h DH.cs = H.cs
dh₀→h (DH.mvar ())
dh₀→h (DH.box t) = H.box (dh₀→h t)
dh₀→h DH.cdist = H.cdist
dh₀→h DH.cup = H.cup
dh₀→h DH.cdown = H.cdown
dh₀→h DH.cpair = H.cpair
dh₀→h DH.cfst = H.cfst
dh₀→h DH.csnd = H.csnd
dh₀→h DH.unit = H.unit
dh→h : ∀ {A Γ Δ} → DH⟨ Γ ⁏ Δ ⊢ A ⟩ → H⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩
dh→h = dh₀→h ∘ DH.merge
-- Translation from Hilbert-style to dyadic Hilbert-style.
h→dh₀ : ∀ {A Γ} → H⟨ Γ ⊢ A ⟩ → DH⟨ Γ ⁏ ∅ ⊢ A ⟩
h→dh₀ (H.var i) = DH.var i
h→dh₀ (H.app t u) = DH.app (h→dh₀ t) (h→dh₀ u)
h→dh₀ H.ci = DH.ci
h→dh₀ H.ck = DH.ck
h→dh₀ H.cs = DH.cs
h→dh₀ (H.box t) = DH.box (h→dh₀ t)
h→dh₀ H.cdist = DH.cdist
h→dh₀ H.cup = DH.cup
h→dh₀ H.cdown = DH.cdown
h→dh₀ H.cpair = DH.cpair
h→dh₀ H.cfst = DH.cfst
h→dh₀ H.csnd = DH.csnd
h→dh₀ H.unit = DH.unit
h→dh : ∀ {A Γ Δ} → H⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩ → DH⟨ Γ ⁏ Δ ⊢ A ⟩
h→dh = DH.split ∘ h→dh₀
-- Translation from Hilbert-style to Gentzen-style.
h→g : ∀ {A Γ} → H⟨ Γ ⊢ A ⟩ → G⟨ Γ ⊢ A ⟩
h→g (H.var i) = G.var i
h→g (H.app t u) = G.app (h→g t) (h→g u)
h→g H.ci = G.ci
h→g H.ck = G.ck
h→g H.cs = G.cs
h→g (H.box t) = G.box (h→g t)
h→g H.cdist = G.cdist
h→g H.cup = G.cup
h→g H.cdown = G.cdown
h→g H.cpair = G.cpair
h→g H.cfst = G.cfst
h→g H.csnd = G.csnd
h→g H.unit = G.unit
-- Translation from Gentzen-style to Hilbert-style.
mutual
g→h : ∀ {A Γ} → G⟨ Γ ⊢ A ⟩ → H⟨ Γ ⊢ A ⟩
g→h (G.var i) = H.var i
g→h (G.lam t) = H.lam (g→h t)
g→h (G.app t u) = H.app (g→h t) (g→h u)
g→h (G.multibox ts u) = H.multibox (g→h⋆ ts) (g→h u)
g→h (G.down t) = H.down (g→h t)
g→h (G.pair t u) = H.pair (g→h t) (g→h u)
g→h (G.fst t) = H.fst (g→h t)
g→h (G.snd t) = H.snd (g→h t)
g→h G.unit = H.unit
g→h⋆ : ∀ {Ξ Γ} → G⟨ Γ ⊢⋆ Ξ ⟩ → H⟨ Γ ⊢⋆ Ξ ⟩
g→h⋆ {∅} ∙ = ∙
g→h⋆ {Ξ , A} (ts , t) = g→h⋆ ts , g→h t
-- Translation from dyadic Hilbert-style to dyadic Gentzen-style.
dh→dg : ∀ {A Γ Δ} → DH⟨ Γ ⁏ Δ ⊢ A ⟩ → DG⟨ Γ ⁏ Δ ⊢ A ⟩
dh→dg (DH.var i) = DG.var i
dh→dg (DH.app t u) = DG.app (dh→dg t) (dh→dg u)
dh→dg DH.ci = DG.ci
dh→dg DH.ck = DG.ck
dh→dg DH.cs = DG.cs
dh→dg (DH.mvar i) = DG.mvar i
dh→dg (DH.box t) = DG.box (dh→dg t)
dh→dg DH.cdist = DG.cdist
dh→dg DH.cup = DG.cup
dh→dg DH.cdown = DG.cdown
dh→dg DH.cpair = DG.cpair
dh→dg DH.cfst = DG.cfst
dh→dg DH.csnd = DG.csnd
dh→dg DH.unit = DG.unit
-- Translation from dyadic Gentzen-style to dyadic Hilbert-style.
dg→dh : ∀ {A Γ Δ} → DG⟨ Γ ⁏ Δ ⊢ A ⟩ → DH⟨ Γ ⁏ Δ ⊢ A ⟩
dg→dh (DG.var i) = DH.var i
dg→dh (DG.lam t) = DH.lam (dg→dh t)
dg→dh (DG.app t u) = DH.app (dg→dh t) (dg→dh u)
dg→dh (DG.mvar i) = DH.mvar i
dg→dh (DG.box t) = DH.box (dg→dh t)
dg→dh (DG.unbox t u) = DH.unbox (dg→dh t) (dg→dh u)
dg→dh (DG.pair t u) = DH.pair (dg→dh t) (dg→dh u)
dg→dh (DG.fst t) = DH.fst (dg→dh t)
dg→dh (DG.snd t) = DH.snd (dg→dh t)
dg→dh DG.unit = DH.unit
-- Translation from Gentzen-style to dyadic Gentzen-style.
mutual
g→dg₀ : ∀ {A Γ} → G⟨ Γ ⊢ A ⟩ → DG⟨ Γ ⁏ ∅ ⊢ A ⟩
g→dg₀ (G.var i) = DG.var i
g→dg₀ (G.lam t) = DG.lam (g→dg₀ t)
g→dg₀ (G.app t u) = DG.app (g→dg₀ t) (g→dg₀ u)
g→dg₀ (G.multibox ts u) = DG.multibox (g→dg₀⋆ ts) (g→dg₀ u)
g→dg₀ (G.down t) = DG.down (g→dg₀ t)
g→dg₀ (G.pair t u) = DG.pair (g→dg₀ t) (g→dg₀ u)
g→dg₀ (G.fst t) = DG.fst (g→dg₀ t)
g→dg₀ (G.snd t) = DG.snd (g→dg₀ t)
g→dg₀ G.unit = DG.unit
g→dg₀⋆ : ∀ {Ξ Γ} → G⟨ Γ ⊢⋆ Ξ ⟩ → DG⟨ Γ ⁏ ∅ ⊢⋆ Ξ ⟩
g→dg₀⋆ {∅} ∙ = ∙
g→dg₀⋆ {Ξ , A} (ts , t) = g→dg₀⋆ ts , g→dg₀ t
g→dg : ∀ {A Γ Δ} → G⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩ → DG⟨ Γ ⁏ Δ ⊢ A ⟩
g→dg = DG.split ∘ g→dg₀
-- Translation from Hilbert-style to labelled Gentzen-style.
h→lg : ∀ {x A Γ Λ} → H⟨ Γ ⊢ A ⟩ → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩
h→lg (H.var i) = LG.var i
h→lg (H.app t u) = LG.app (h→lg t) (h→lg u)
h→lg H.ci = LG.ci
h→lg H.ck = LG.ck
h→lg H.cs = LG.cs
h→lg (H.box t) = LG.box (h→lg t)
h→lg H.cdist = LG.cdist
h→lg H.cup = LG.cup
h→lg H.cdown = LG.cdown
h→lg H.cpair = LG.cpair
h→lg H.cfst = LG.cfst
h→lg H.csnd = LG.csnd
h→lg H.unit = LG.unit
-- Translation from labelled Gentzen-style to Hilbert-style.
-- FIXME: Stronger hypothesis?
postulate
h-oops : ∀ {x A Γ Λ} → (∀ {y} → LG⟨ Γ ⁏ Λ , x ↝ y ⊢ A ◎ y ⟩) → H⟨ Γ ⊢ □ A ⟩
lg→h : ∀ {x A Γ Λ} → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩ → H⟨ Γ ⊢ A ⟩
lg→h (LG.var i) = H.var i
lg→h (LG.lam t) = H.lam (lg→h t)
lg→h (LG.app t u) = H.app (lg→h t) (lg→h u)
lg→h (LG.scan t) = h-oops t
lg→h (LG.move t u) = H.down (lg→h t)
lg→h (LG.pair t u) = H.pair (lg→h t) (lg→h u)
lg→h (LG.fst t) = H.fst (lg→h t)
lg→h (LG.snd t) = H.snd (lg→h t)
lg→h LG.unit = H.unit
-- Translation from Gentzen-style to labelled Gentzen-style.
mutual
g→lg : ∀ {x A Γ Λ} → G⟨ Γ ⊢ A ⟩ → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩
g→lg (G.var i) = LG.var i
g→lg (G.lam t) = LG.lam (g→lg t)
g→lg (G.app t u) = LG.app (g→lg t) (g→lg u)
g→lg (G.multibox ts u) = LG.multibox (g→lg⋆ ts) (g→lg u)
g→lg (G.down t) = LG.move (g→lg t) LG.rrefl
g→lg (G.pair t u) = LG.pair (g→lg t) (g→lg u)
g→lg (G.fst t) = LG.fst (g→lg t)
g→lg (G.snd t) = LG.snd (g→lg t)
g→lg G.unit = LG.unit
g→lg⋆ : ∀ {x Ξ Γ Λ} → G⟨ Γ ⊢⋆ Ξ ⟩ → LG⟨ Γ ⁏ Λ ⊢⋆ Ξ ◎⋆ x ⟩
g→lg⋆ {x} {∅} ∙ = ∙
g→lg⋆ {x} {Ξ , A} (ts , t) = g→lg⋆ ts , g→lg t
-- Translation from labelled Gentzen-style to Gentzen-style.
-- FIXME: Stronger hypothesis?
postulate
g-oops : ∀ {x A Γ Λ} → (∀ {y} → LG⟨ Γ ⁏ Λ , x ↝ y ⊢ A ◎ y ⟩) → G⟨ Γ ⊢ □ A ⟩
lg→g : ∀ {x A Γ Λ} → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩ → G⟨ Γ ⊢ A ⟩
lg→g (LG.var i) = G.var i
lg→g (LG.lam t) = G.lam (lg→g t)
lg→g (LG.app t u) = G.app (lg→g t) (lg→g u)
lg→g (LG.scan t) = g-oops t
lg→g (LG.move t u) = G.down (lg→g t)
lg→g (LG.pair t u) = G.pair (lg→g t) (lg→g u)
lg→g (LG.fst t) = G.fst (lg→g t)
lg→g (LG.snd t) = G.snd (lg→g t)
lg→g LG.unit = G.unit
-- Additional translations from closed Hilbert-style sequential.
chs→h₀ : ∀ {A} → CHS.⊢ A → H⟨ ∅ ⊢ A ⟩
chs→h₀ = ch→h₀ ∘ chs→ch
chs→h : ∀ {A Γ} → CHS.⊢ Γ ▻⋯▻ A → H⟨ Γ ⊢ A ⟩
chs→h = ch→h ∘ chs→ch
chs→g₀ : ∀ {A} → CHS.⊢ A → G⟨ ∅ ⊢ A ⟩
chs→g₀ = h→g ∘ chs→h₀
chs→g : ∀ {A Γ} → CHS.⊢ Γ ▻⋯▻ A → G⟨ Γ ⊢ A ⟩
chs→g = h→g ∘ chs→h
chs→dhs₀₀ : ∀ {A} → CHS.⊢ A → DHS⟨ ∅ ⁏ ∅ ⊢ A ⟩
chs→dhs₀₀ = hs→dhs₀ ∘ chs→hs₀
chs→dhs₀ : ∀ {A Γ} → CHS.⊢ Γ ▻⋯▻ A → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩
chs→dhs₀ = hs→dhs₀ ∘ chs→hs
chs→dhs : ∀ {A Γ Δ} → CHS.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A → DHS⟨ Γ ⁏ Δ ⊢ A ⟩
chs→dhs = hs→dhs ∘ chs→hs
chs→dh₀₀ : ∀ {A} → CHS.⊢ A → DH⟨ ∅ ⁏ ∅ ⊢ A ⟩
chs→dh₀₀ = h→dh₀ ∘ chs→h₀
chs→dh₀ : ∀ {A Γ} → CHS.⊢ Γ ▻⋯▻ A → DH⟨ Γ ⁏ ∅ ⊢ A ⟩
chs→dh₀ = h→dh₀ ∘ chs→h
chs→dh : ∀ {A Γ Δ} → CHS.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A → DH⟨ Γ ⁏ Δ ⊢ A ⟩
chs→dh = h→dh ∘ chs→h
chs→dg₀₀ : ∀ {A} → CHS.⊢ A → DG⟨ ∅ ⁏ ∅ ⊢ A ⟩
chs→dg₀₀ = g→dg₀ ∘ chs→g₀
chs→dg₀ : ∀ {A Γ} → CHS.⊢ Γ ▻⋯▻ A → DG⟨ Γ ⁏ ∅ ⊢ A ⟩
chs→dg₀ = g→dg₀ ∘ chs→g
chs→dg : ∀ {A Γ Δ} → CHS.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A → DG⟨ Γ ⁏ Δ ⊢ A ⟩
chs→dg = g→dg ∘ chs→g
chs→lg₀ : ∀ {x A Λ} → CHS.⊢ A → LG⟨ ∅ ⁏ Λ ⊢ A ◎ x ⟩
chs→lg₀ = g→lg ∘ chs→g₀
chs→lg : ∀ {x A Γ Λ} → CHS.⊢ Γ ▻⋯▻ A → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩
chs→lg = g→lg ∘ chs→g
-- Additional translations from closed Hilbert-style.
ch→hs₀ : ∀ {A} → CH.⊢ A → HS⟨ ∅ ⊢ A ⟩
ch→hs₀ = chs→hs ∘ ch→chs
ch→hs : ∀ {A Γ} → CH.⊢ Γ ▻⋯▻ A → HS⟨ Γ ⊢ A ⟩
ch→hs = chs→hs ∘ ch→chs
ch→g₀ : ∀ {A} → CH.⊢ A → G⟨ ∅ ⊢ A ⟩
ch→g₀ = h→g ∘ ch→h₀
ch→g : ∀ {A Γ} → CH.⊢ Γ ▻⋯▻ A → G⟨ Γ ⊢ A ⟩
ch→g = h→g ∘ ch→h
ch→dhs₀₀ : ∀ {A} → CH.⊢ A → DHS⟨ ∅ ⁏ ∅ ⊢ A ⟩
ch→dhs₀₀ = hs→dhs₀ ∘ ch→hs₀
ch→dhs₀ : ∀ {A Γ} → CH.⊢ Γ ▻⋯▻ A → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩
ch→dhs₀ = hs→dhs₀ ∘ ch→hs
ch→dhs : ∀ {A Γ Δ} → CH.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A → DHS⟨ Γ ⁏ Δ ⊢ A ⟩
ch→dhs = hs→dhs ∘ ch→hs
ch→dh₀₀ : ∀ {A} → CH.⊢ A → DH⟨ ∅ ⁏ ∅ ⊢ A ⟩
ch→dh₀₀ = h→dh₀ ∘ ch→h₀
ch→dh₀ : ∀ {A Γ} → CH.⊢ Γ ▻⋯▻ A → DH⟨ Γ ⁏ ∅ ⊢ A ⟩
ch→dh₀ = h→dh₀ ∘ ch→h
ch→dh : ∀ {A Γ Δ} → CH.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A → DH⟨ Γ ⁏ Δ ⊢ A ⟩
ch→dh = h→dh ∘ ch→h
ch→dg₀₀ : ∀ {A} → CH.⊢ A → DG⟨ ∅ ⁏ ∅ ⊢ A ⟩
ch→dg₀₀ = g→dg₀ ∘ ch→g₀
ch→dg₀ : ∀ {A Γ} → CH.⊢ Γ ▻⋯▻ A → DG⟨ Γ ⁏ ∅ ⊢ A ⟩
ch→dg₀ = g→dg₀ ∘ ch→g
ch→dg : ∀ {A Γ Δ} → CH.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A → DG⟨ Γ ⁏ Δ ⊢ A ⟩
ch→dg = g→dg ∘ ch→g
ch→lg₀ : ∀ {x A Λ} → CH.⊢ A → LG⟨ ∅ ⁏ Λ ⊢ A ◎ x ⟩
ch→lg₀ = g→lg ∘ ch→g₀
ch→lg : ∀ {x A Γ Λ} → CH.⊢ Γ ▻⋯▻ A → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩
ch→lg = g→lg ∘ ch→g
-- Additional translations from Hilbert-style sequential.
hs₀→ch : ∀ {A} → HS⟨ ∅ ⊢ A ⟩ → CH.⊢ A
hs₀→ch = chs→ch ∘ hs₀→chs
hs→ch : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → CH.⊢ Γ ▻⋯▻ A
hs→ch = chs→ch ∘ hs→chs
hs→g : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → G⟨ Γ ⊢ A ⟩
hs→g = h→g ∘ hs→h
hs→dh₀ : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → DH⟨ Γ ⁏ ∅ ⊢ A ⟩
hs→dh₀ = h→dh₀ ∘ hs→h
hs→dh : ∀ {A Γ Δ} → HS⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩ → DH⟨ Γ ⁏ Δ ⊢ A ⟩
hs→dh = h→dh ∘ hs→h
hs→dg₀ : ∀ {A Γ} → HS⟨ Γ ⊢ A ⟩ → DG⟨ Γ ⁏ ∅ ⊢ A ⟩
hs→dg₀ = dh→dg ∘ hs→dh₀
hs→dg : ∀ {A Γ Δ} → HS⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩ → DG⟨ Γ ⁏ Δ ⊢ A ⟩
hs→dg = dh→dg ∘ hs→dh
hs→lg : ∀ {x A Γ Λ} → HS⟨ Γ ⊢ A ⟩ → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩
hs→lg = h→lg ∘ hs→h
-- Additional translations from Hilbert-style.
h₀→chs : ∀ {A} → H⟨ ∅ ⊢ A ⟩ → CHS.⊢ A
h₀→chs = ch→chs ∘ h₀→ch
h→chs : ∀ {A Γ} → H⟨ Γ ⊢ A ⟩ → CHS.⊢ Γ ▻⋯▻ A
h→chs = ch→chs ∘ h→ch
h→dhs₀ : ∀ {A Γ} → H⟨ Γ ⊢ A ⟩ → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩
h→dhs₀ = hs→dhs₀ ∘ h→hs
h→dhs : ∀ {A Γ Δ} → H⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩ → DHS⟨ Γ ⁏ Δ ⊢ A ⟩
h→dhs = hs→dhs ∘ h→hs
h→dg₀ : ∀ {A Γ} → H⟨ Γ ⊢ A ⟩ → DG⟨ Γ ⁏ ∅ ⊢ A ⟩
h→dg₀ = dh→dg ∘ h→dh₀
h→dg : ∀ {A Γ Δ} → H⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩ → DG⟨ Γ ⁏ Δ ⊢ A ⟩
h→dg = dh→dg ∘ h→dh
-- Additional translations from Gentzen-style.
g₀→chs : ∀ {A} → G⟨ ∅ ⊢ A ⟩ → CHS.⊢ A
g₀→chs = h₀→chs ∘ g→h
g→chs : ∀ {A Γ} → G⟨ Γ ⊢ A ⟩ → CHS.⊢ Γ ▻⋯▻ A
g→chs = h→chs ∘ g→h
g₀→ch : ∀ {A} → G⟨ ∅ ⊢ A ⟩ → CH.⊢ A
g₀→ch = h₀→ch ∘ g→h
g→ch : ∀ {A Γ} → G⟨ Γ ⊢ A ⟩ → CH.⊢ Γ ▻⋯▻ A
g→ch = h→ch ∘ g→h
g→hs : ∀ {A Γ} → G⟨ Γ ⊢ A ⟩ → HS⟨ Γ ⊢ A ⟩
g→hs = h→hs ∘ g→h
g→dhs₀ : ∀ {A Γ} → G⟨ Γ ⊢ A ⟩ → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩
g→dhs₀ = h→dhs₀ ∘ g→h
g→dhs : ∀ {A Γ Δ} → G⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩ → DHS⟨ Γ ⁏ Δ ⊢ A ⟩
g→dhs = h→dhs ∘ g→h
g→dh₀ : ∀ {A Γ} → G⟨ Γ ⊢ A ⟩ → DH⟨ Γ ⁏ ∅ ⊢ A ⟩
g→dh₀ = h→dh₀ ∘ g→h
g→dh : ∀ {A Γ Δ} → G⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩ → DH⟨ Γ ⁏ Δ ⊢ A ⟩
g→dh = h→dh ∘ g→h
-- Additional translations from dyadic Hilbert-style sequential.
dhs₀₀→chs : ∀ {A} → DHS⟨ ∅ ⁏ ∅ ⊢ A ⟩ → CHS.⊢ A
dhs₀₀→chs = hs₀→chs ∘ dhs₀→hs
dhs₀→chs : ∀ {A Γ} → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩ → CHS.⊢ Γ ▻⋯▻ A
dhs₀→chs = hs→chs ∘ dhs₀→hs
dhs→chs : ∀ {A Γ Δ} → DHS⟨ Γ ⁏ Δ ⊢ A ⟩ → CHS.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A
dhs→chs = hs→chs ∘ dhs→hs
dhs₀₀→ch : ∀ {A} → DHS⟨ ∅ ⁏ ∅ ⊢ A ⟩ → CH.⊢ A
dhs₀₀→ch = hs₀→ch ∘ dhs₀→hs
dhs₀→ch : ∀ {A Γ} → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩ → CH.⊢ Γ ▻⋯▻ A
dhs₀→ch = hs→ch ∘ dhs₀→hs
dhs→ch : ∀ {A Γ Δ} → DHS⟨ Γ ⁏ Δ ⊢ A ⟩ → CH.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A
dhs→ch = hs→ch ∘ dhs→hs
dhs₀→h : ∀ {A Γ} → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩ → H⟨ Γ ⊢ A ⟩
dhs₀→h = hs→h ∘ dhs₀→hs
dhs→h : ∀ {A Γ Δ} → DHS⟨ Γ ⁏ Δ ⊢ A ⟩ → H⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩
dhs→h = hs→h ∘ dhs→hs
dhs₀→g : ∀ {A Γ} → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩ → G⟨ Γ ⊢ A ⟩
dhs₀→g = hs→g ∘ dhs₀→hs
dhs→g : ∀ {A Γ Δ} → DHS⟨ Γ ⁏ Δ ⊢ A ⟩ → G⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩
dhs→g = hs→g ∘ dhs→hs
dhs→dg : ∀ {A Γ Δ} → DHS⟨ Γ ⁏ Δ ⊢ A ⟩ → DG⟨ Γ ⁏ Δ ⊢ A ⟩
dhs→dg = dh→dg ∘ dhs→dh
dhs₀→lg : ∀ {x A Γ Λ} → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩ → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩
dhs₀→lg = hs→lg ∘ dhs₀→hs
dhs→lg : ∀ {x A Γ Δ Λ} → DHS⟨ Γ ⁏ Δ ⊢ A ⟩ → LG⟨ Γ ⧺ (□⋆ Δ) ⁏ Λ ⊢ A ◎ x ⟩
dhs→lg = hs→lg ∘ dhs→hs
-- Additional translations from dyadic Hilbert-style.
dh₀₀→chs : ∀ {A} → DH⟨ ∅ ⁏ ∅ ⊢ A ⟩ → CHS.⊢ A
dh₀₀→chs = h₀→chs ∘ dh₀→h
dh₀→chs : ∀ {A Γ} → DH⟨ Γ ⁏ ∅ ⊢ A ⟩ → CHS.⊢ Γ ▻⋯▻ A
dh₀→chs = h→chs ∘ dh₀→h
dh→chs : ∀ {A Γ Δ} → DH⟨ Γ ⁏ Δ ⊢ A ⟩ → CHS.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A
dh→chs = h→chs ∘ dh→h
dh₀₀→ch : ∀ {A} → DH⟨ ∅ ⁏ ∅ ⊢ A ⟩ → CH.⊢ A
dh₀₀→ch = h₀→ch ∘ dh₀→h
dh₀→ch : ∀ {A Γ} → DH⟨ Γ ⁏ ∅ ⊢ A ⟩ → CH.⊢ Γ ▻⋯▻ A
dh₀→ch = h→ch ∘ dh₀→h
dh→ch : ∀ {A Γ Δ} → DH⟨ Γ ⁏ Δ ⊢ A ⟩ → CH.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A
dh→ch = h→ch ∘ dh→h
dh₀→hs : ∀ {A Γ} → DH⟨ Γ ⁏ ∅ ⊢ A ⟩ → HS⟨ Γ ⊢ A ⟩
dh₀→hs = h→hs ∘ dh₀→h
dh→hs : ∀ {A Γ Δ} → DH⟨ Γ ⁏ Δ ⊢ A ⟩ → HS⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩
dh→hs = h→hs ∘ dh→h
dh₀→g : ∀ {A Γ} → DH⟨ Γ ⁏ ∅ ⊢ A ⟩ → G⟨ Γ ⊢ A ⟩
dh₀→g = h→g ∘ dh₀→h
dh→g : ∀ {A Γ Δ} → DH⟨ Γ ⁏ Δ ⊢ A ⟩ → G⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩
dh→g = h→g ∘ dh→h
dh₀→lg : ∀ {x A Γ Λ} → DH⟨ Γ ⁏ ∅ ⊢ A ⟩ → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩
dh₀→lg = h→lg ∘ dh₀→h
dh→lg : ∀ {x A Γ Δ Λ} → DH⟨ Γ ⁏ Δ ⊢ A ⟩ → LG⟨ Γ ⧺ (□⋆ Δ) ⁏ Λ ⊢ A ◎ x ⟩
dh→lg = h→lg ∘ dh→h
-- Additional translations from dyadic Gentzen-style.
dg₀₀→chs : ∀ {A} → DG⟨ ∅ ⁏ ∅ ⊢ A ⟩ → CHS.⊢ A
dg₀₀→chs = dh₀→chs ∘ dg→dh
dg₀→chs : ∀ {A Γ} → DG⟨ Γ ⁏ ∅ ⊢ A ⟩ → CHS.⊢ Γ ▻⋯▻ A
dg₀→chs = dh→chs ∘ dg→dh
dg→chs : ∀ {A Γ Δ} → DG⟨ Γ ⁏ Δ ⊢ A ⟩ → CHS.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A
dg→chs = dh→chs ∘ dg→dh
dg₀₀→ch : ∀ {A} → DG⟨ ∅ ⁏ ∅ ⊢ A ⟩ → CH.⊢ A
dg₀₀→ch = dh₀→ch ∘ dg→dh
dg₀→ch : ∀ {A Γ} → DG⟨ Γ ⁏ ∅ ⊢ A ⟩ → CH.⊢ Γ ▻⋯▻ A
dg₀→ch = dh→ch ∘ dg→dh
dg→ch : ∀ {A Γ Δ} → DG⟨ Γ ⁏ Δ ⊢ A ⟩ → CH.⊢ Γ ⧺ (□⋆ Δ) ▻⋯▻ A
dg→ch = dh→ch ∘ dg→dh
dg₀→hs : ∀ {A Γ} → DG⟨ Γ ⁏ ∅ ⊢ A ⟩ → HS⟨ Γ ⊢ A ⟩
dg₀→hs = dh₀→hs ∘ dg→dh
dg→hs : ∀ {A Γ Δ} → DG⟨ Γ ⁏ Δ ⊢ A ⟩ → HS⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩
dg→hs = dh→hs ∘ dg→dh
dg₀→h : ∀ {A Γ} → DG⟨ Γ ⁏ ∅ ⊢ A ⟩ → H⟨ Γ ⊢ A ⟩
dg₀→h = dh₀→h ∘ dg→dh
dg→h : ∀ {A Γ Δ} → DG⟨ Γ ⁏ Δ ⊢ A ⟩ → H⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩
dg→h = dh→h ∘ dg→dh
-- NOTE: Direct translation fails the termination check.
dg₀→g : ∀ {A Γ} → DG⟨ Γ ⁏ ∅ ⊢ A ⟩ → G⟨ Γ ⊢ A ⟩
dg₀→g = h→g ∘ dg₀→h
dg→g : ∀ {A Γ Δ} → DG⟨ Γ ⁏ Δ ⊢ A ⟩ → G⟨ Γ ⧺ (□⋆ Δ) ⊢ A ⟩
dg→g = h→g ∘ dg→h
dg→dhs : ∀ {A Γ Δ} → DG⟨ Γ ⁏ Δ ⊢ A ⟩ → DHS⟨ Γ ⁏ Δ ⊢ A ⟩
dg→dhs = dh→dhs ∘ dg→dh
dg₀→lg : ∀ {x A Γ Λ} → DG⟨ Γ ⁏ ∅ ⊢ A ⟩ → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩
dg₀→lg = g→lg ∘ dg₀→g
dg→lg : ∀ {x A Γ Δ Λ} → DG⟨ Γ ⁏ Δ ⊢ A ⟩ → LG⟨ Γ ⧺ (□⋆ Δ) ⁏ Λ ⊢ A ◎ x ⟩
dg→lg = g→lg ∘ dg→g
-- Additional translations from labelled Gentzen-style.
lg₀→chs : ∀ {x A Λ} → LG⟨ ∅ ⁏ Λ ⊢ A ◎ x ⟩ → CHS.⊢ A
lg₀→chs = h₀→chs ∘ lg→h
lg→chs : ∀ {x A Γ Λ} → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩ → CHS.⊢ Γ ▻⋯▻ A
lg→chs = h→chs ∘ lg→h
lg₀→ch : ∀ {x A Λ} → LG⟨ ∅ ⁏ Λ ⊢ A ◎ x ⟩ → CH.⊢ A
lg₀→ch = h₀→ch ∘ lg→h
lg→ch : ∀ {x A Γ Λ} → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩ → CH.⊢ Γ ▻⋯▻ A
lg→ch = h→ch ∘ lg→h
lg→hs : ∀ {x A Γ Λ} → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩ → HS⟨ Γ ⊢ A ⟩
lg→hs = h→hs ∘ lg→h
lg→dhs₀ : ∀ {x A Γ Λ} → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩ → DHS⟨ Γ ⁏ ∅ ⊢ A ⟩
lg→dhs₀ = h→dhs₀ ∘ lg→h
lg→dhs : ∀ {x A Γ Δ Λ} → LG⟨ Γ ⧺ (□⋆ Δ) ⁏ Λ ⊢ A ◎ x ⟩ → DHS⟨ Γ ⁏ Δ ⊢ A ⟩
lg→dhs = h→dhs ∘ lg→h
lg→dh₀ : ∀ {x A Γ Λ} → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩ → DH⟨ Γ ⁏ ∅ ⊢ A ⟩
lg→dh₀ = h→dh₀ ∘ lg→h
lg→dh : ∀ {x A Γ Δ Λ} → LG⟨ Γ ⧺ (□⋆ Δ) ⁏ Λ ⊢ A ◎ x ⟩ → DH⟨ Γ ⁏ Δ ⊢ A ⟩
lg→dh = h→dh ∘ lg→h
lg→dg₀ : ∀ {x A Γ Λ} → LG⟨ Γ ⁏ Λ ⊢ A ◎ x ⟩ → DG⟨ Γ ⁏ ∅ ⊢ A ⟩
lg→dg₀ = h→dg₀ ∘ lg→h
lg→dg : ∀ {x A Γ Δ Λ} → LG⟨ Γ ⧺ (□⋆ Δ) ⁏ Λ ⊢ A ◎ x ⟩ → DG⟨ Γ ⁏ Δ ⊢ A ⟩
lg→dg = h→dg ∘ lg→h
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_710.asm | ljhsiun2/medusa | 9 | 89836 | <filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_710.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x2218, %rbx
nop
nop
nop
nop
nop
add %r9, %r9
movups (%rbx), %xmm3
vpextrq $0, %xmm3, %r10
nop
nop
nop
nop
nop
and $19491, %rbx
lea addresses_normal_ht+0x12898, %rsi
lea addresses_A_ht+0x4a98, %rdi
nop
sub %r11, %r11
mov $10, %rcx
rep movsq
add %r11, %r11
lea addresses_WT_ht+0x5f0c, %rsi
lea addresses_UC_ht+0x666b, %rdi
nop
nop
nop
nop
nop
cmp %r13, %r13
mov $15, %rcx
rep movsl
nop
nop
nop
nop
nop
and $45261, %rdi
lea addresses_A_ht+0x147d8, %r10
nop
nop
inc %rbx
movw $0x6162, (%r10)
nop
nop
nop
nop
nop
add $55162, %r10
lea addresses_WT_ht+0x29f6, %rcx
nop
nop
nop
nop
nop
sub $58414, %r9
movw $0x6162, (%rcx)
nop
nop
nop
nop
nop
sub %r11, %r11
lea addresses_D_ht+0x2f06, %r11
nop
nop
nop
nop
nop
sub %rdi, %rdi
and $0xffffffffffffffc0, %r11
vmovntdqa (%r11), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %r9
nop
nop
and %r10, %r10
lea addresses_normal_ht+0x8230, %rsi
lea addresses_WC_ht+0x16648, %rdi
lfence
mov $43, %rcx
rep movsb
nop
nop
nop
nop
nop
and $2200, %rcx
lea addresses_WC_ht+0x187a8, %rsi
lea addresses_UC_ht+0x121f8, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
mfence
mov $120, %rcx
rep movsl
nop
nop
inc %rbx
lea addresses_WC_ht+0x19eda, %rsi
lea addresses_UC_ht+0xaa98, %rdi
inc %r13
mov $79, %rcx
rep movsw
nop
and $38375, %r10
lea addresses_WC_ht+0x49f7, %r10
nop
nop
nop
nop
nop
inc %r13
movups (%r10), %xmm3
vpextrq $1, %xmm3, %rcx
nop
nop
cmp $37188, %r13
lea addresses_UC_ht+0x1b6a8, %rsi
lea addresses_UC_ht+0x580, %rdi
nop
nop
nop
nop
add $32262, %r9
mov $18, %rcx
rep movsw
nop
inc %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %rax
push %rcx
push %rdi
push %rdx
// Load
lea addresses_RW+0x8e98, %rcx
nop
nop
nop
add %rdi, %rdi
movups (%rcx), %xmm2
vpextrq $0, %xmm2, %rax
nop
nop
nop
nop
nop
add $5724, %rcx
// Faulty Load
lea addresses_RW+0x698, %rcx
nop
nop
and $56003, %rdx
mov (%rcx), %rdi
lea oracles, %rdx
and $0xff, %rdi
shlq $12, %rdi
mov (%rdx,%rdi,1), %rdi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_RW', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_RW', 'same': False, 'size': 16, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_RW', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': True, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 1, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'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
*/
|
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/risc.lzh/risc/join/Pole-p.asm | prismotizm/gigaleak | 0 | 23377 | Name: Pole-p.asm
Type: file
Size: 33015
Last-Modified: '1992-07-30T05:00:33Z'
SHA-1: 28EF0BDB667690289B858E9BAFC8B572ED0426C7
Description: null
|
oeis/018/A018904.asm | neoneye/loda-programs | 11 | 3092 | <gh_stars>10-100
; A018904: Define the sequence S(a(0),a(1)) by a(n+2) is the least integer such that a(n+2)/a(n+1) > a(n+1)/a(n) for n >= 0. This is S(1,6).
; 1,6,37,229,1418,8781,54377,336734,2085253,12913101,79965442,495192589,3066520913,18989683446,117595179557,728217839669,4509548979898,27925753660941,172932530727097,1070898946784974,6631629973859333,41066915083090461,254310255712336562,1574837214570903629,9752309223434642593,60391978491187980006,373982303321142647077,2315916230792058629509,14341502098938697171178,88810933538610587050701,549969024275580623499017,3405728502236011429239614,21090254394274176887182213,130603138248739181064077421
mov $1,1
lpb $0
sub $0,1
add $2,$1
mul $1,5
add $1,$2
lpe
mov $0,$1
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_850.asm | ljhsiun2/medusa | 9 | 105503 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xdbc1, %rsi
lea addresses_normal_ht+0x5e49, %rdi
nop
nop
add $40194, %r14
mov $116, %rcx
rep movsq
xor %r15, %r15
lea addresses_normal_ht+0x7b51, %rsi
lea addresses_normal_ht+0x1ac61, %rdi
nop
nop
cmp $62313, %r10
mov $55, %rcx
rep movsq
nop
nop
nop
nop
cmp $48374, %r10
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %rax
push %rbp
push %rbx
push %rsi
// Faulty Load
lea addresses_PSE+0x7249, %rax
nop
nop
add %r12, %r12
vmovups (%rax), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %rbp
lea oracles, %rbx
and $0xff, %rbp
shlq $12, %rbp
mov (%rbx,%rbp,1), %rbp
pop %rsi
pop %rbx
pop %rbp
pop %rax
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'dst': {'same': True, 'congruent': 9, 'type': 'addresses_normal_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
src/phrases.adb | zdimension/tdinfo302 | 0 | 3593 | with Ada.Text_IO; use Ada.Text_IO;
procedure phrases is
function Maju (c : Character) return Character is
begin
if c in 'a'..'z' then
return Character'Val(Character'Pos(c) - 32);
else
return c;
end if;
end Maju;
ch : Character;
nb_a, nb_ne : Integer := 0;
n : Boolean := False;
begin
loop
Get(ch);
exit when ch = '.';
if ch = 'a' then
nb_a := nb_a + 1;
end if;
if n and ch = 'e' then
nb_ne := nb_ne + 1;
end if;
n := ch = 'n';
Put(Maju(ch));
end loop;
Put_Line("Nombre 'a' : " & Integer'Image(nb_a));
Put_Line("Nombre 'ne' : " & Integer'Image(nb_ne));
end phrases;
|
Data/ships/Cougar.asm | TinfoilAsteroid/EliteNext | 9 | 174946 | <gh_stars>1-10
Cougar: DB $03
DW $1324
DW CougarEdges
DB CougarEdgesSize
DB $00, $2A
DB CougarVertSize /6
DB CougarVertSize
DB CougarEdgesCnt
DB $00, $00
DB CougarNormalsSize
DB $22, $FC, $28
DW CougarNormals
DB $02, $34
DW CougarVertices
DB 0,0 ; Type and Tactics
DB ShipCanAnger
CougarVertices: DB $00, $05, $43, $1F, $02, $44
DB $14, $00, $28, $9F, $01, $22
DB $28, $00, $28, $BF, $01, $55
DB $00, $0E, $28, $3E, $04, $55
DB $00, $0E, $28, $7E, $12, $35
DB $14, $00, $28, $1F, $23, $44
DB $28, $00, $28, $3F, $34, $55
DB $24, $00, $38, $9F, $01, $11
DB $3C, $00, $14, $BF, $01, $11
DB $24, $00, $38, $1F, $34, $44
DB $3C, $00, $14, $3F, $34, $44
DB $00, $07, $23, $12, $00, $44
DB $00, $08, $19, $14, $00, $44
DB $0C, $02, $2D, $94, $00, $00
DB $0C, $02, $2D, $14, $44, $44
DB $0A, $06, $28, $B4, $55, $55
DB $0A, $06, $28, $F4, $55, $55
DB $0A, $06, $28, $74, $55, $55
DB $0A, $06, $28, $34, $55, $55
CougarVertSize: equ $ - CougarVertices
CougarEdges: DB $1F, $02, $00, $04
DB $1F, $01, $04, $1C
DB $1F, $01, $1C, $20
DB $1F, $01, $20, $08
DB $1E, $05, $08, $0C
DB $1E, $45, $0C, $18
DB $1E, $15, $08, $10
DB $1E, $35, $10, $18
DB $1F, $34, $18, $28
DB $1F, $34, $28, $24
DB $1F, $34, $24, $14
DB $1F, $24, $14, $00
DB $1B, $04, $00, $0C
DB $1B, $12, $04, $10
DB $1B, $23, $14, $10
DB $1A, $01, $04, $08
DB $1A, $34, $14, $18
DB $14, $00, $30, $34
DB $12, $00, $34, $2C
DB $12, $44, $2C, $38
DB $14, $44, $38, $30
DB $12, $55, $3C, $40
DB $14, $55, $40, $48
DB $12, $55, $48, $44
DB $14, $55, $44, $3C
CougarEdgesSize: equ $ - CougarEdges
CougarEdgesCnt: equ CougarEdgesSize/4
CougarNormals: DB $9F, $10, $2E, $04
DB $DF, $10, $2E, $04
DB $5F, $00, $1B, $05
DB $5F, $10, $2E, $04
DB $1F, $10, $2E, $04
DB $3E, $00, $00, $A0
CougarNormalsSize: equ $ - CougarNormals
CougarLen: equ $ - Cougar
|
oeis/006/A006633.asm | neoneye/loda-programs | 11 | 168922 | <gh_stars>10-100
; A006633: From generalized Catalan numbers.
; Submitted by <NAME>
; 1,6,39,272,1995,15180,118755,949344,7721604,63698830,531697881,4482448656,38111876530,326439471960,2814095259675,24397023508416,212579132600076
mov $2,$0
mul $2,3
add $2,5
add $0,$2
bin $0,$2
mul $0,12
mov $1,$2
add $1,1
div $0,$1
div $0,2
|
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_854.asm | ljhsiun2/medusa | 9 | 2381 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x5e08, %rsi
lea addresses_WC_ht+0x71c7, %rdi
nop
nop
nop
nop
nop
inc %r13
mov $97, %rcx
rep movsq
nop
xor %rsi, %rsi
lea addresses_UC_ht+0x10808, %rsi
lea addresses_A_ht+0x7a18, %rdi
nop
nop
nop
nop
nop
add $15209, %r14
mov $108, %rcx
rep movsl
cmp $50607, %rdi
lea addresses_normal_ht+0x19470, %rsi
lea addresses_WC_ht+0x3c18, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
sub $38628, %r10
mov $78, %rcx
rep movsq
nop
sub %r14, %r14
lea addresses_WC_ht+0x10abd, %rdi
sub %rsi, %rsi
movups (%rdi), %xmm5
vpextrq $0, %xmm5, %r10
nop
nop
nop
nop
xor %r14, %r14
lea addresses_normal_ht+0xc124, %r14
nop
nop
and %r8, %r8
mov (%r14), %r13
nop
dec %rcx
lea addresses_UC_ht+0x6118, %rsi
lea addresses_D_ht+0x1111c, %rdi
nop
nop
nop
nop
nop
dec %rdx
mov $78, %rcx
rep movsl
sub %rdx, %rdx
lea addresses_UC_ht+0x15778, %rdi
clflush (%rdi)
nop
sub %rdx, %rdx
movl $0x61626364, (%rdi)
nop
nop
nop
nop
nop
and $35392, %r14
lea addresses_A_ht+0x1c718, %rdi
clflush (%rdi)
nop
nop
cmp $59310, %r8
movw $0x6162, (%rdi)
nop
add %rsi, %rsi
lea addresses_A_ht+0x1b718, %rsi
lea addresses_normal_ht+0x1c7b8, %rdi
xor %rdx, %rdx
mov $71, %rcx
rep movsq
inc %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %rax
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WT+0x5c98, %r12
nop
nop
dec %rdi
movl $0x51525354, (%r12)
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %r10
nop
nop
nop
nop
cmp $50147, %r10
// Faulty Load
lea addresses_A+0x16f18, %rdx
xor %rax, %rax
mov (%rdx), %si
lea oracles, %r10
and $0xff, %rsi
shlq $12, %rsi
mov (%r10,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_WT', 'AVXalign': False, 'size': 4}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}}
{'src': {'same': True, 'congruent': 3, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}}
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 5, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}}
{'src': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}}
{'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
*/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.