max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
src/SingleSorted/Model.agda | cilinder/formaltt | 21 | 52 | open import Agda.Primitive using (_⊔_)
import Categories.Category as Category
import Categories.Category.Cartesian as Cartesian
import SingleSorted.Interpretation as Interpretation
open import SingleSorted.AlgebraicTheory
open import SingleSorted.Substitution
import SingleSorted.Power as Power
module SingleSorted.Model {o ℓ e ℓt}
{Σ : Signature}
(T : Theory ℓt Σ)
{𝒞 : Category.Category o ℓ e}
(cartesian-𝒞 : Cartesian.Cartesian 𝒞) where
-- Model of a theory
record Model (I : Interpretation.Interpretation Σ cartesian-𝒞) : Set (ℓt ⊔ o ⊔ ℓ ⊔ e) where
open Theory T
open Category.Category 𝒞
open Interpretation.Interpretation I
open HomReasoning
field
model-eq : ∀ (ε : ax) → interp-term (ax-lhs ε) ≈ interp-term (ax-rhs ε)
-- Soundness of semantics
module _ where
open Power.Powered interp-pow
-- first we show that substitution preserves validity
model-resp-[]s : ∀ {Γ Δ} {u v : Term Γ} {σ : Δ ⇒s Γ} →
interp-term u ≈ interp-term v → interp-term (u [ σ ]s) ≈ interp-term (v [ σ ]s)
model-resp-[]s {u = u} {v = v} {σ = σ} ξ =
begin
interp-term (u [ σ ]s) ≈⟨ interp-[]s {t = u} ⟩
(interp-term u ∘ interp-subst σ) ≈⟨ ξ ⟩∘⟨refl ⟩
(interp-term v ∘ interp-subst σ) ≈˘⟨ interp-[]s {t = v} ⟩
interp-term (v [ σ ]s) ∎
-- the soundness statement
model-⊢-≈ : ∀ {Γ} {s t : Term Γ} → Γ ⊢ s ≈ t → interp-term s ≈ interp-term t
model-⊢-≈ eq-refl = Equiv.refl
model-⊢-≈ (eq-symm ξ) = ⟺ (model-⊢-≈ ξ)
model-⊢-≈ (eq-tran ξ θ) = (model-⊢-≈ ξ) ○ (model-⊢-≈ θ)
model-⊢-≈ (eq-congr ξ) = ∘-resp-≈ʳ (unique (λ i → project ○ model-⊢-≈ (eq-symm (ξ i))))
model-⊢-≈ (eq-axiom ε σ) = model-resp-[]s {u = ax-lhs ε} {v = ax-rhs ε} (model-eq ε)
-- Every theory has the trivial model, whose carrier is the terminal object
Trivial : Model (Interpretation.Trivial Σ cartesian-𝒞)
Trivial =
let open Cartesian.Cartesian cartesian-𝒞 in
record { model-eq = λ ε → !-unique₂ }
|
Testing/PropEqTest.agda | VictorCMiraldo/agda-rw | 16 | 11503 | open import Prelude
open import Relation.Binary.PropositionalEquality
open import RW.Language.RTerm using (Name)
open import RW.Strategy.PropEq
open import RW.RW (≡-strat ∷ [])
open import Data.Nat.Properties.Simple
using (+-comm; +-right-identity; +-assoc)
module PropEqTest where
++-assoc : ∀{a}{A : Set a}(xs ys zs : List A) →
(xs ++ ys) ++ zs ≡ xs ++ (ys ++ zs)
++-assoc [] ys zs = refl
++-assoc (x ∷ xs) ys zs = tactic (by (quote ++-assoc))
open ≡-Reasoning
++-assocH : ∀{a}{A : Set a}(xs ys zs : List A) →
(xs ++ ys) ++ zs ≡ xs ++ (ys ++ zs)
++-assocH [] ys zs =
begin
([] ++ ys) ++ zs
≡⟨ refl ⟩
ys ++ zs
≡⟨ refl ⟩
[] ++ (ys ++ zs)
∎
++-assocH {A = A} (x ∷ xs) ys zs =
begin
((x ∷ xs) ++ ys) ++ zs
≡⟨ refl ⟩
x ∷ (xs ++ ys) ++ zs
≡⟨ refl ⟩
x ∷ ((xs ++ ys) ++ zs)
≡⟨ (tactic (by (quote ++-assocH))) ⟩
x ∷ (xs ++ (ys ++ zs))
≡⟨ refl ⟩
(x ∷ xs) ++ (ys ++ zs)
∎
[]-++-neutral : ∀{a}{A : Set a}(xs : List A)
→ xs ++ [] ≡ xs
[]-++-neutral [] = refl
[]-++-neutral (x ∷ xs) = tactic (by (quote []-++-neutral))
test1 : (x y : ℕ) → (x + y) + 0 ≡ y + (x + 0)
test1 x y
= begin
(x + y) + 0
≡⟨ (tactic (by+ acts)) ⟩
x + y
≡⟨ (tactic (by+ acts)) ⟩
y + x
≡⟨ (tactic (by+ acts)) ⟩
(y + x) + 0
≡⟨ (tactic (by+ acts)) ⟩
y + (x + 0)
∎
where
acts : List Name
acts = quote +-right-identity ∷ quote +-assoc ∷ quote +-comm ∷ []
|
arch/ARM/NXP/svd/lpc55s6x/nxp_svd-spi.ads | morbos/Ada_Drivers_Library | 2 | 16527 | <gh_stars>1-10
-- Copyright 2016-2019 NXP
-- All rights reserved.SPDX-License-Identifier: BSD-3-Clause
-- This spec has been automatically generated from LPC55S6x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NXP_SVD.SPI is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- SPI enable.
type CFG_ENABLE_Field is
(
-- Disabled. The SPI is disabled and the internal state machine and
-- counters are reset.
Disabled,
-- Enabled. The SPI is enabled for operation.
Enabled)
with Size => 1;
for CFG_ENABLE_Field use
(Disabled => 0,
Enabled => 1);
-- Master mode select.
type CFG_MASTER_Field is
(
-- Slave mode. The SPI will operate in slave mode. SCK, MOSI, and the
-- SSEL signals are inputs, MISO is an output.
Slave_Mode,
-- Master mode. The SPI will operate in master mode. SCK, MOSI, and the
-- SSEL signals are outputs, MISO is an input.
Master_Mode)
with Size => 1;
for CFG_MASTER_Field use
(Slave_Mode => 0,
Master_Mode => 1);
-- LSB First mode enable.
type CFG_LSBF_Field is
(
-- Standard. Data is transmitted and received in standard MSB first
-- order.
Standard,
-- Reverse. Data is transmitted and received in reverse order (LSB
-- first).
Reverse_k)
with Size => 1;
for CFG_LSBF_Field use
(Standard => 0,
Reverse_k => 1);
-- Clock Phase select.
type CFG_CPHA_Field is
(
-- Change. The SPI captures serial data on the first clock transition of
-- the transfer (when the clock changes away from the rest state). Data
-- is changed on the following edge.
Change,
-- Capture. The SPI changes serial data on the first clock transition of
-- the transfer (when the clock changes away from the rest state). Data
-- is captured on the following edge.
Capture)
with Size => 1;
for CFG_CPHA_Field use
(Change => 0,
Capture => 1);
-- Clock Polarity select.
type CFG_CPOL_Field is
(
-- Low. The rest state of the clock (between transfers) is low.
Low,
-- High. The rest state of the clock (between transfers) is high.
High)
with Size => 1;
for CFG_CPOL_Field use
(Low => 0,
High => 1);
-- Loopback mode enable. Loopback mode applies only to Master mode, and
-- connects transmit and receive data connected together to allow simple
-- software testing.
type CFG_LOOP_Field is
(
-- Disabled.
Disabled,
-- Enabled.
Enabled)
with Size => 1;
for CFG_LOOP_Field use
(Disabled => 0,
Enabled => 1);
-- SSEL0 Polarity select.
type CFG_SPOL0_Field is
(
-- Low. The SSEL0 pin is active low.
Low,
-- High. The SSEL0 pin is active high.
High)
with Size => 1;
for CFG_SPOL0_Field use
(Low => 0,
High => 1);
-- SSEL1 Polarity select.
type CFG_SPOL1_Field is
(
-- Low. The SSEL1 pin is active low.
Low,
-- High. The SSEL1 pin is active high.
High)
with Size => 1;
for CFG_SPOL1_Field use
(Low => 0,
High => 1);
-- SSEL2 Polarity select.
type CFG_SPOL2_Field is
(
-- Low. The SSEL2 pin is active low.
Low,
-- High. The SSEL2 pin is active high.
High)
with Size => 1;
for CFG_SPOL2_Field use
(Low => 0,
High => 1);
-- SSEL3 Polarity select.
type CFG_SPOL3_Field is
(
-- Low. The SSEL3 pin is active low.
Low,
-- High. The SSEL3 pin is active high.
High)
with Size => 1;
for CFG_SPOL3_Field use
(Low => 0,
High => 1);
-- SPI Configuration register
type CFG_Register is record
-- SPI enable.
ENABLE : CFG_ENABLE_Field := NXP_SVD.SPI.Disabled;
-- unspecified
Reserved_1_1 : HAL.Bit := 16#0#;
-- Master mode select.
MASTER : CFG_MASTER_Field := NXP_SVD.SPI.Slave_Mode;
-- LSB First mode enable.
LSBF : CFG_LSBF_Field := NXP_SVD.SPI.Standard;
-- Clock Phase select.
CPHA : CFG_CPHA_Field := NXP_SVD.SPI.Change;
-- Clock Polarity select.
CPOL : CFG_CPOL_Field := NXP_SVD.SPI.Low;
-- unspecified
Reserved_6_6 : HAL.Bit := 16#0#;
-- Loopback mode enable. Loopback mode applies only to Master mode, and
-- connects transmit and receive data connected together to allow simple
-- software testing.
LOOP_k : CFG_LOOP_Field := NXP_SVD.SPI.Disabled;
-- SSEL0 Polarity select.
SPOL0 : CFG_SPOL0_Field := NXP_SVD.SPI.Low;
-- SSEL1 Polarity select.
SPOL1 : CFG_SPOL1_Field := NXP_SVD.SPI.Low;
-- SSEL2 Polarity select.
SPOL2 : CFG_SPOL2_Field := NXP_SVD.SPI.Low;
-- SSEL3 Polarity select.
SPOL3 : CFG_SPOL3_Field := NXP_SVD.SPI.Low;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CFG_Register use record
ENABLE at 0 range 0 .. 0;
Reserved_1_1 at 0 range 1 .. 1;
MASTER at 0 range 2 .. 2;
LSBF at 0 range 3 .. 3;
CPHA at 0 range 4 .. 4;
CPOL at 0 range 5 .. 5;
Reserved_6_6 at 0 range 6 .. 6;
LOOP_k at 0 range 7 .. 7;
SPOL0 at 0 range 8 .. 8;
SPOL1 at 0 range 9 .. 9;
SPOL2 at 0 range 10 .. 10;
SPOL3 at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype DLY_PRE_DELAY_Field is HAL.UInt4;
subtype DLY_POST_DELAY_Field is HAL.UInt4;
subtype DLY_FRAME_DELAY_Field is HAL.UInt4;
subtype DLY_TRANSFER_DELAY_Field is HAL.UInt4;
-- SPI Delay register
type DLY_Register is record
-- Controls the amount of time between SSEL assertion and the beginning
-- of a data transfer. There is always one SPI clock time between SSEL
-- assertion and the first clock edge. This is not considered part of
-- the pre-delay. 0x0 = No additional time is inserted. 0x1 = 1 SPI
-- clock time is inserted. 0x2 = 2 SPI clock times are inserted. 0xF =
-- 15 SPI clock times are inserted.
PRE_DELAY : DLY_PRE_DELAY_Field := 16#0#;
-- Controls the amount of time between the end of a data transfer and
-- SSEL deassertion. 0x0 = No additional time is inserted. 0x1 = 1 SPI
-- clock time is inserted. 0x2 = 2 SPI clock times are inserted. 0xF =
-- 15 SPI clock times are inserted.
POST_DELAY : DLY_POST_DELAY_Field := 16#0#;
-- If the EOF flag is set, controls the minimum amount of time between
-- the current frame and the next frame (or SSEL deassertion if EOT).
-- 0x0 = No additional time is inserted. 0x1 = 1 SPI clock time is
-- inserted. 0x2 = 2 SPI clock times are inserted. 0xF = 15 SPI clock
-- times are inserted.
FRAME_DELAY : DLY_FRAME_DELAY_Field := 16#0#;
-- Controls the minimum amount of time that the SSEL is deasserted
-- between transfers. 0x0 = The minimum time that SSEL is deasserted is
-- 1 SPI clock time. (Zero added time.) 0x1 = The minimum time that SSEL
-- is deasserted is 2 SPI clock times. 0x2 = The minimum time that SSEL
-- is deasserted is 3 SPI clock times. 0xF = The minimum time that SSEL
-- is deasserted is 16 SPI clock times.
TRANSFER_DELAY : DLY_TRANSFER_DELAY_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DLY_Register use record
PRE_DELAY at 0 range 0 .. 3;
POST_DELAY at 0 range 4 .. 7;
FRAME_DELAY at 0 range 8 .. 11;
TRANSFER_DELAY at 0 range 12 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- SPI Status. Some status flags can be cleared by writing a 1 to that bit
-- position.
type STAT_Register is record
-- unspecified
Reserved_0_3 : HAL.UInt4 := 16#0#;
-- Write-only. Slave Select Assert. This flag is set whenever any slave
-- select transitions from deasserted to asserted, in both master and
-- slave modes. This allows determining when the SPI transmit/receive
-- functions become busy, and allows waking up the device from reduced
-- power modes when a slave mode access begins. This flag is cleared by
-- software.
SSA : Boolean := False;
-- Write-only. Slave Select Deassert. This flag is set whenever any
-- asserted slave selects transition to deasserted, in both master and
-- slave modes. This allows determining when the SPI transmit/receive
-- functions become idle. This flag is cleared by software.
SSD : Boolean := False;
-- Read-only. Stalled status flag. This indicates whether the SPI is
-- currently in a stall condition.
STALLED : Boolean := False;
-- End Transfer control bit. Software can set this bit to force an end
-- to the current transfer when the transmitter finishes any activity
-- already in progress, as if the EOT flag had been set prior to the
-- last transmission. This capability is included to support cases where
-- it is not known when transmit data is written that it will be the end
-- of a transfer. The bit is cleared when the transmitter becomes idle
-- as the transfer comes to an end. Forcing an end of transfer in this
-- manner causes any specified FRAME_DELAY and TRANSFER_DELAY to be
-- inserted.
ENDTRANSFER : Boolean := False;
-- Read-only. Master idle status flag. This bit is 1 whenever the SPI
-- master function is fully idle. This means that the transmit holding
-- register is empty and the transmitter is not in the process of
-- sending data.
MSTIDLE : Boolean := True;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for STAT_Register use record
Reserved_0_3 at 0 range 0 .. 3;
SSA at 0 range 4 .. 4;
SSD at 0 range 5 .. 5;
STALLED at 0 range 6 .. 6;
ENDTRANSFER at 0 range 7 .. 7;
MSTIDLE at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-- Slave select assert interrupt enable. Determines whether an interrupt
-- occurs when the Slave Select is asserted.
type INTENSET_SSAEN_Field is
(
-- Disabled. No interrupt will be generated when any Slave Select
-- transitions from deasserted to asserted.
Disabled,
-- Enabled. An interrupt will be generated when any Slave Select
-- transitions from deasserted to asserted.
Enabled)
with Size => 1;
for INTENSET_SSAEN_Field use
(Disabled => 0,
Enabled => 1);
-- Slave select deassert interrupt enable. Determines whether an interrupt
-- occurs when the Slave Select is deasserted.
type INTENSET_SSDEN_Field is
(
-- Disabled. No interrupt will be generated when all asserted Slave
-- Selects transition to deasserted.
Disabled,
-- Enabled. An interrupt will be generated when all asserted Slave
-- Selects transition to deasserted.
Enabled)
with Size => 1;
for INTENSET_SSDEN_Field use
(Disabled => 0,
Enabled => 1);
-- Master idle interrupt enable.
type INTENSET_MSTIDLEEN_Field is
(
-- No interrupt will be generated when the SPI master function is idle.
Disabled,
-- An interrupt will be generated when the SPI master function is fully
-- idle.
Enabled)
with Size => 1;
for INTENSET_MSTIDLEEN_Field use
(Disabled => 0,
Enabled => 1);
-- SPI Interrupt Enable read and Set. A complete value may be read from
-- this register. Writing a 1 to any implemented bit position causes that
-- bit to be set.
type INTENSET_Register is record
-- unspecified
Reserved_0_3 : HAL.UInt4 := 16#0#;
-- Slave select assert interrupt enable. Determines whether an interrupt
-- occurs when the Slave Select is asserted.
SSAEN : INTENSET_SSAEN_Field := NXP_SVD.SPI.Disabled;
-- Slave select deassert interrupt enable. Determines whether an
-- interrupt occurs when the Slave Select is deasserted.
SSDEN : INTENSET_SSDEN_Field := NXP_SVD.SPI.Disabled;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Master idle interrupt enable.
MSTIDLEEN : INTENSET_MSTIDLEEN_Field := NXP_SVD.SPI.Disabled;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for INTENSET_Register use record
Reserved_0_3 at 0 range 0 .. 3;
SSAEN at 0 range 4 .. 4;
SSDEN at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
MSTIDLEEN at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-- SPI Interrupt Enable Clear. Writing a 1 to any implemented bit position
-- causes the corresponding bit in INTENSET to be cleared.
type INTENCLR_Register is record
-- unspecified
Reserved_0_3 : HAL.UInt4 := 16#0#;
-- Write-only. Writing 1 clears the corresponding bit in the INTENSET
-- register.
SSAEN : Boolean := False;
-- Write-only. Writing 1 clears the corresponding bit in the INTENSET
-- register.
SSDEN : Boolean := False;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
-- Write-only. Writing 1 clears the corresponding bit in the INTENSET
-- register.
MSTIDLE : Boolean := False;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for INTENCLR_Register use record
Reserved_0_3 at 0 range 0 .. 3;
SSAEN at 0 range 4 .. 4;
SSDEN at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
MSTIDLE at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
subtype DIV_DIVVAL_Field is HAL.UInt16;
-- SPI clock Divider
type DIV_Register is record
-- Rate divider value. Specifies how the Flexcomm clock (FCLK) is
-- divided to produce the SPI clock rate in master mode. DIVVAL is -1
-- encoded such that the value 0 results in FCLK/1, the value 1 results
-- in FCLK/2, up to the maximum possible divide value of 0xFFFF, which
-- results in FCLK/65536.
DIVVAL : DIV_DIVVAL_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DIV_Register use record
DIVVAL at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-- SPI Interrupt Status
type INTSTAT_Register is record
-- unspecified
Reserved_0_3 : HAL.UInt4;
-- Read-only. Slave Select Assert.
SSA : Boolean;
-- Read-only. Slave Select Deassert.
SSD : Boolean;
-- unspecified
Reserved_6_7 : HAL.UInt2;
-- Read-only. Master Idle status flag.
MSTIDLE : Boolean;
-- unspecified
Reserved_9_31 : HAL.UInt23;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for INTSTAT_Register use record
Reserved_0_3 at 0 range 0 .. 3;
SSA at 0 range 4 .. 4;
SSD at 0 range 5 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
MSTIDLE at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-- Enable the transmit FIFO.
type FIFOCFG_ENABLETX_Field is
(
-- The transmit FIFO is not enabled.
Disabled,
-- The transmit FIFO is enabled.
Enabled)
with Size => 1;
for FIFOCFG_ENABLETX_Field use
(Disabled => 0,
Enabled => 1);
-- Enable the receive FIFO.
type FIFOCFG_ENABLERX_Field is
(
-- The receive FIFO is not enabled.
Disabled,
-- The receive FIFO is enabled.
Enabled)
with Size => 1;
for FIFOCFG_ENABLERX_Field use
(Disabled => 0,
Enabled => 1);
subtype FIFOCFG_SIZE_Field is HAL.UInt2;
-- DMA configuration for transmit.
type FIFOCFG_DMATX_Field is
(
-- DMA is not used for the transmit function.
Disabled,
-- Trigger DMA for the transmit function if the FIFO is not full.
-- Generally, data interrupts would be disabled if DMA is enabled.
Enabled)
with Size => 1;
for FIFOCFG_DMATX_Field use
(Disabled => 0,
Enabled => 1);
-- DMA configuration for receive.
type FIFOCFG_DMARX_Field is
(
-- DMA is not used for the receive function.
Disabled,
-- Trigger DMA for the receive function if the FIFO is not empty.
-- Generally, data interrupts would be disabled if DMA is enabled.
Enabled)
with Size => 1;
for FIFOCFG_DMARX_Field use
(Disabled => 0,
Enabled => 1);
-- Wake-up for transmit FIFO level. This allows the device to be woken from
-- reduced power modes (up to power-down, as long as the peripheral
-- function works in that power mode) without enabling the TXLVL interrupt.
-- Only DMA wakes up, processes data, and goes back to sleep. The CPU will
-- remain stopped until woken by another cause, such as DMA completion. See
-- Hardware Wake-up control register.
type FIFOCFG_WAKETX_Field is
(
-- Only enabled interrupts will wake up the device form reduced power
-- modes.
Disabled,
-- A device wake-up for DMA will occur if the transmit FIFO level
-- reaches the value specified by TXLVL in FIFOTRIG, even when the TXLVL
-- interrupt is not enabled.
Enabled)
with Size => 1;
for FIFOCFG_WAKETX_Field use
(Disabled => 0,
Enabled => 1);
-- Wake-up for receive FIFO level. This allows the device to be woken from
-- reduced power modes (up to power-down, as long as the peripheral
-- function works in that power mode) without enabling the TXLVL interrupt.
-- Only DMA wakes up, processes data, and goes back to sleep. The CPU will
-- remain stopped until woken by another cause, such as DMA completion. See
-- Hardware Wake-up control register.
type FIFOCFG_WAKERX_Field is
(
-- Only enabled interrupts will wake up the device form reduced power
-- modes.
Disabled,
-- A device wake-up for DMA will occur if the receive FIFO level reaches
-- the value specified by RXLVL in FIFOTRIG, even when the RXLVL
-- interrupt is not enabled.
Enabled)
with Size => 1;
for FIFOCFG_WAKERX_Field use
(Disabled => 0,
Enabled => 1);
-- FIFO configuration and enable register.
type FIFOCFG_Register is record
-- Enable the transmit FIFO.
ENABLETX : FIFOCFG_ENABLETX_Field := NXP_SVD.SPI.Disabled;
-- Enable the receive FIFO.
ENABLERX : FIFOCFG_ENABLERX_Field := NXP_SVD.SPI.Disabled;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Read-only. FIFO size configuration. This is a read-only field. 0x0 =
-- FIFO is configured as 16 entries of 8 bits. 0x1, 0x2, 0x3 = not
-- applicable to USART.
SIZE : FIFOCFG_SIZE_Field := 16#0#;
-- unspecified
Reserved_6_11 : HAL.UInt6 := 16#0#;
-- DMA configuration for transmit.
DMATX : FIFOCFG_DMATX_Field := NXP_SVD.SPI.Disabled;
-- DMA configuration for receive.
DMARX : FIFOCFG_DMARX_Field := NXP_SVD.SPI.Disabled;
-- Wake-up for transmit FIFO level. This allows the device to be woken
-- from reduced power modes (up to power-down, as long as the peripheral
-- function works in that power mode) without enabling the TXLVL
-- interrupt. Only DMA wakes up, processes data, and goes back to sleep.
-- The CPU will remain stopped until woken by another cause, such as DMA
-- completion. See Hardware Wake-up control register.
WAKETX : FIFOCFG_WAKETX_Field := NXP_SVD.SPI.Disabled;
-- Wake-up for receive FIFO level. This allows the device to be woken
-- from reduced power modes (up to power-down, as long as the peripheral
-- function works in that power mode) without enabling the TXLVL
-- interrupt. Only DMA wakes up, processes data, and goes back to sleep.
-- The CPU will remain stopped until woken by another cause, such as DMA
-- completion. See Hardware Wake-up control register.
WAKERX : FIFOCFG_WAKERX_Field := NXP_SVD.SPI.Disabled;
-- Empty command for the transmit FIFO. When a 1 is written to this bit,
-- the TX FIFO is emptied.
EMPTYTX : Boolean := False;
-- Empty command for the receive FIFO. When a 1 is written to this bit,
-- the RX FIFO is emptied.
EMPTYRX : Boolean := False;
-- unspecified
Reserved_18_31 : HAL.UInt14 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FIFOCFG_Register use record
ENABLETX at 0 range 0 .. 0;
ENABLERX at 0 range 1 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
SIZE at 0 range 4 .. 5;
Reserved_6_11 at 0 range 6 .. 11;
DMATX at 0 range 12 .. 12;
DMARX at 0 range 13 .. 13;
WAKETX at 0 range 14 .. 14;
WAKERX at 0 range 15 .. 15;
EMPTYTX at 0 range 16 .. 16;
EMPTYRX at 0 range 17 .. 17;
Reserved_18_31 at 0 range 18 .. 31;
end record;
subtype FIFOSTAT_TXLVL_Field is HAL.UInt5;
subtype FIFOSTAT_RXLVL_Field is HAL.UInt5;
-- FIFO status register.
type FIFOSTAT_Register is record
-- TX FIFO error. Will be set if a transmit FIFO error occurs. This
-- could be an overflow caused by pushing data into a full FIFO, or by
-- an underflow if the FIFO is empty when data is needed. Cleared by
-- writing a 1 to this bit.
TXERR : Boolean := False;
-- RX FIFO error. Will be set if a receive FIFO overflow occurs, caused
-- by software or DMA not emptying the FIFO fast enough. Cleared by
-- writing a 1 to this bit.
RXERR : Boolean := False;
-- unspecified
Reserved_2_2 : HAL.Bit := 16#0#;
-- Read-only. Peripheral interrupt. When 1, this indicates that the
-- peripheral function has asserted an interrupt. The details can be
-- found by reading the peripheral's STAT register.
PERINT : Boolean := False;
-- Read-only. Transmit FIFO empty. When 1, the transmit FIFO is empty.
-- The peripheral may still be processing the last piece of data.
TXEMPTY : Boolean := True;
-- Read-only. Transmit FIFO not full. When 1, the transmit FIFO is not
-- full, so more data can be written. When 0, the transmit FIFO is full
-- and another write would cause it to overflow.
TXNOTFULL : Boolean := True;
-- Read-only. Receive FIFO not empty. When 1, the receive FIFO is not
-- empty, so data can be read. When 0, the receive FIFO is empty.
RXNOTEMPTY : Boolean := False;
-- Read-only. Receive FIFO full. When 1, the receive FIFO is full. Data
-- needs to be read out to prevent the peripheral from causing an
-- overflow.
RXFULL : Boolean := False;
-- Read-only. Transmit FIFO current level. A 0 means the TX FIFO is
-- currently empty, and the TXEMPTY and TXNOTFULL flags will be 1. Other
-- values tell how much data is actually in the TX FIFO at the point
-- where the read occurs. If the TX FIFO is full, the TXEMPTY and
-- TXNOTFULL flags will be 0.
TXLVL : FIFOSTAT_TXLVL_Field := 16#0#;
-- unspecified
Reserved_13_15 : HAL.UInt3 := 16#0#;
-- Read-only. Receive FIFO current level. A 0 means the RX FIFO is
-- currently empty, and the RXFULL and RXNOTEMPTY flags will be 0. Other
-- values tell how much data is actually in the RX FIFO at the point
-- where the read occurs. If the RX FIFO is full, the RXFULL and
-- RXNOTEMPTY flags will be 1.
RXLVL : FIFOSTAT_RXLVL_Field := 16#0#;
-- unspecified
Reserved_21_31 : HAL.UInt11 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FIFOSTAT_Register use record
TXERR at 0 range 0 .. 0;
RXERR at 0 range 1 .. 1;
Reserved_2_2 at 0 range 2 .. 2;
PERINT at 0 range 3 .. 3;
TXEMPTY at 0 range 4 .. 4;
TXNOTFULL at 0 range 5 .. 5;
RXNOTEMPTY at 0 range 6 .. 6;
RXFULL at 0 range 7 .. 7;
TXLVL at 0 range 8 .. 12;
Reserved_13_15 at 0 range 13 .. 15;
RXLVL at 0 range 16 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
-- Transmit FIFO level trigger enable. This trigger will become an
-- interrupt if enabled in FIFOINTENSET, or a DMA trigger if DMATX in
-- FIFOCFG is set.
type FIFOTRIG_TXLVLENA_Field is
(
-- Transmit FIFO level does not generate a FIFO level trigger.
Disabled,
-- An trigger will be generated if the transmit FIFO level reaches the
-- value specified by the TXLVL field in this register.
Enabled)
with Size => 1;
for FIFOTRIG_TXLVLENA_Field use
(Disabled => 0,
Enabled => 1);
-- Receive FIFO level trigger enable. This trigger will become an interrupt
-- if enabled in FIFOINTENSET, or a DMA trigger if DMARX in FIFOCFG is set.
type FIFOTRIG_RXLVLENA_Field is
(
-- Receive FIFO level does not generate a FIFO level trigger.
Disabled,
-- An trigger will be generated if the receive FIFO level reaches the
-- value specified by the RXLVL field in this register.
Enabled)
with Size => 1;
for FIFOTRIG_RXLVLENA_Field use
(Disabled => 0,
Enabled => 1);
subtype FIFOTRIG_TXLVL_Field is HAL.UInt4;
subtype FIFOTRIG_RXLVL_Field is HAL.UInt4;
-- FIFO trigger settings for interrupt and DMA request.
type FIFOTRIG_Register is record
-- Transmit FIFO level trigger enable. This trigger will become an
-- interrupt if enabled in FIFOINTENSET, or a DMA trigger if DMATX in
-- FIFOCFG is set.
TXLVLENA : FIFOTRIG_TXLVLENA_Field := NXP_SVD.SPI.Disabled;
-- Receive FIFO level trigger enable. This trigger will become an
-- interrupt if enabled in FIFOINTENSET, or a DMA trigger if DMARX in
-- FIFOCFG is set.
RXLVLENA : FIFOTRIG_RXLVLENA_Field := NXP_SVD.SPI.Disabled;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
-- Transmit FIFO level trigger point. This field is used only when
-- TXLVLENA = 1. If enabled to do so, the FIFO level can wake up the
-- device just enough to perform DMA, then return to the reduced power
-- mode. See Hardware Wake-up control register. 0 = trigger when the TX
-- FIFO becomes empty. 1 = trigger when the TX FIFO level decreases to
-- one entry. 15 = trigger when the TX FIFO level decreases to 15
-- entries (is no longer full).
TXLVL : FIFOTRIG_TXLVL_Field := 16#0#;
-- unspecified
Reserved_12_15 : HAL.UInt4 := 16#0#;
-- Receive FIFO level trigger point. The RX FIFO level is checked when a
-- new piece of data is received. This field is used only when RXLVLENA
-- = 1. If enabled to do so, the FIFO level can wake up the device just
-- enough to perform DMA, then return to the reduced power mode. See
-- Hardware Wake-up control register. 0 = trigger when the RX FIFO has
-- received one entry (is no longer empty). 1 = trigger when the RX FIFO
-- has received two entries. 15 = trigger when the RX FIFO has received
-- 16 entries (has become full).
RXLVL : FIFOTRIG_RXLVL_Field := 16#0#;
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FIFOTRIG_Register use record
TXLVLENA at 0 range 0 .. 0;
RXLVLENA at 0 range 1 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
TXLVL at 0 range 8 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
RXLVL at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- Determines whether an interrupt occurs when a transmit error occurs,
-- based on the TXERR flag in the FIFOSTAT register.
type FIFOINTENSET_TXERR_Field is
(
-- No interrupt will be generated for a transmit error.
Disabled,
-- An interrupt will be generated when a transmit error occurs.
Enabled)
with Size => 1;
for FIFOINTENSET_TXERR_Field use
(Disabled => 0,
Enabled => 1);
-- Determines whether an interrupt occurs when a receive error occurs,
-- based on the RXERR flag in the FIFOSTAT register.
type FIFOINTENSET_RXERR_Field is
(
-- No interrupt will be generated for a receive error.
Disabled,
-- An interrupt will be generated when a receive error occurs.
Enabled)
with Size => 1;
for FIFOINTENSET_RXERR_Field use
(Disabled => 0,
Enabled => 1);
-- Determines whether an interrupt occurs when a the transmit FIFO reaches
-- the level specified by the TXLVL field in the FIFOTRIG register.
type FIFOINTENSET_TXLVL_Field is
(
-- No interrupt will be generated based on the TX FIFO level.
Disabled,
-- If TXLVLENA in the FIFOTRIG register = 1, an interrupt will be
-- generated when the TX FIFO level decreases to the level specified by
-- TXLVL in the FIFOTRIG register.
Enabled)
with Size => 1;
for FIFOINTENSET_TXLVL_Field use
(Disabled => 0,
Enabled => 1);
-- Determines whether an interrupt occurs when a the receive FIFO reaches
-- the level specified by the TXLVL field in the FIFOTRIG register.
type FIFOINTENSET_RXLVL_Field is
(
-- No interrupt will be generated based on the RX FIFO level.
Disabled,
-- If RXLVLENA in the FIFOTRIG register = 1, an interrupt will be
-- generated when the when the RX FIFO level increases to the level
-- specified by RXLVL in the FIFOTRIG register.
Enabled)
with Size => 1;
for FIFOINTENSET_RXLVL_Field use
(Disabled => 0,
Enabled => 1);
-- FIFO interrupt enable set (enable) and read register.
type FIFOINTENSET_Register is record
-- Determines whether an interrupt occurs when a transmit error occurs,
-- based on the TXERR flag in the FIFOSTAT register.
TXERR : FIFOINTENSET_TXERR_Field := NXP_SVD.SPI.Disabled;
-- Determines whether an interrupt occurs when a receive error occurs,
-- based on the RXERR flag in the FIFOSTAT register.
RXERR : FIFOINTENSET_RXERR_Field := NXP_SVD.SPI.Disabled;
-- Determines whether an interrupt occurs when a the transmit FIFO
-- reaches the level specified by the TXLVL field in the FIFOTRIG
-- register.
TXLVL : FIFOINTENSET_TXLVL_Field := NXP_SVD.SPI.Disabled;
-- Determines whether an interrupt occurs when a the receive FIFO
-- reaches the level specified by the TXLVL field in the FIFOTRIG
-- register.
RXLVL : FIFOINTENSET_RXLVL_Field := NXP_SVD.SPI.Disabled;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FIFOINTENSET_Register use record
TXERR at 0 range 0 .. 0;
RXERR at 0 range 1 .. 1;
TXLVL at 0 range 2 .. 2;
RXLVL at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- FIFO interrupt enable clear (disable) and read register.
type FIFOINTENCLR_Register is record
-- Writing one clears the corresponding bits in the FIFOINTENSET
-- register.
TXERR : Boolean := False;
-- Writing one clears the corresponding bits in the FIFOINTENSET
-- register.
RXERR : Boolean := False;
-- Writing one clears the corresponding bits in the FIFOINTENSET
-- register.
TXLVL : Boolean := False;
-- Writing one clears the corresponding bits in the FIFOINTENSET
-- register.
RXLVL : Boolean := False;
-- unspecified
Reserved_4_31 : HAL.UInt28 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FIFOINTENCLR_Register use record
TXERR at 0 range 0 .. 0;
RXERR at 0 range 1 .. 1;
TXLVL at 0 range 2 .. 2;
RXLVL at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- FIFO interrupt status register.
type FIFOINTSTAT_Register is record
-- Read-only. TX FIFO error.
TXERR : Boolean;
-- Read-only. RX FIFO error.
RXERR : Boolean;
-- Read-only. Transmit FIFO level interrupt.
TXLVL : Boolean;
-- Read-only. Receive FIFO level interrupt.
RXLVL : Boolean;
-- Read-only. Peripheral interrupt.
PERINT : Boolean;
-- unspecified
Reserved_5_31 : HAL.UInt27;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FIFOINTSTAT_Register use record
TXERR at 0 range 0 .. 0;
RXERR at 0 range 1 .. 1;
TXLVL at 0 range 2 .. 2;
RXLVL at 0 range 3 .. 3;
PERINT at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
subtype FIFOWR_TXDATA_Field is HAL.UInt16;
-- Transmit slave select. This field asserts SSEL0 in master mode. The
-- output on the pin is active LOW by default.
type FIFOWR_TXSSEL0_N_Field is
(
-- SSEL0 asserted.
Asserted,
-- SSEL0 not asserted.
Not_Asserted)
with Size => 1;
for FIFOWR_TXSSEL0_N_Field use
(Asserted => 0,
Not_Asserted => 1);
-- Transmit slave select. This field asserts SSEL1 in master mode. The
-- output on the pin is active LOW by default.
type FIFOWR_TXSSEL1_N_Field is
(
-- SSEL1 asserted.
Asserted,
-- SSEL1 not asserted.
Not_Asserted)
with Size => 1;
for FIFOWR_TXSSEL1_N_Field use
(Asserted => 0,
Not_Asserted => 1);
-- Transmit slave select. This field asserts SSEL2 in master mode. The
-- output on the pin is active LOW by default.
type FIFOWR_TXSSEL2_N_Field is
(
-- SSEL2 asserted.
Asserted,
-- SSEL2 not asserted.
Not_Asserted)
with Size => 1;
for FIFOWR_TXSSEL2_N_Field use
(Asserted => 0,
Not_Asserted => 1);
-- Transmit slave select. This field asserts SSEL3 in master mode. The
-- output on the pin is active LOW by default.
type FIFOWR_TXSSEL3_N_Field is
(
-- SSEL3 asserted.
Asserted,
-- SSEL3 not asserted.
Not_Asserted)
with Size => 1;
for FIFOWR_TXSSEL3_N_Field use
(Asserted => 0,
Not_Asserted => 1);
-- End of transfer. The asserted SSEL will be deasserted at the end of a
-- transfer and remain so far at least the time specified by the
-- Transfer_delay value in the DLY register.
type FIFOWR_EOT_Field is
(
-- SSEL not deasserted. This piece of data is not treated as the end of
-- a transfer. SSEL will not be deasserted at the end of this data.
Not_Deasserted,
-- SSEL deasserted. This piece of data is treated as the end of a
-- transfer. SSEL will be deasserted at the end of this piece of data.
Deasserted)
with Size => 1;
for FIFOWR_EOT_Field use
(Not_Deasserted => 0,
Deasserted => 1);
-- End of frame. Between frames, a delay may be inserted, as defined by the
-- Frame_delay value in the DLY register. The end of a frame may not be
-- particularly meaningful if the Frame_delay value = 0. This control can
-- be used as part of the support for frame lengths greater than 16 bits.
type FIFOWR_EOF_Field is
(
-- Data not EOF. This piece of data transmitted is not treated as the
-- end of a frame.
Not_Eof,
-- Data EOF. This piece of data is treated as the end of a frame,
-- causing the Frame_delay time to be inserted before subsequent data is
-- transmitted.
Eof)
with Size => 1;
for FIFOWR_EOF_Field use
(Not_Eof => 0,
Eof => 1);
-- Receive Ignore. This allows data to be transmitted using the SPI without
-- the need to read unneeded data from the receiver. Setting this bit
-- simplifies the transmit process and can be used with the DMA.
type FIFOWR_RXIGNORE_Field is
(
-- Read received data. Received data must be read in order to allow
-- transmission to progress. SPI transmit will halt when the receive
-- data FIFO is full. In slave mode, an overrun error will occur if
-- received data is not read before new data is received.
Read,
-- Ignore received data. Received data is ignored, allowing transmission
-- without reading unneeded received data. No receiver flags are
-- generated.
Ignore)
with Size => 1;
for FIFOWR_RXIGNORE_Field use
(Read => 0,
Ignore => 1);
subtype FIFOWR_LEN_Field is HAL.UInt4;
-- FIFO write data.
type FIFOWR_Register is record
-- Write-only. Transmit data to the FIFO.
TXDATA : FIFOWR_TXDATA_Field := 16#0#;
-- Write-only. Transmit slave select. This field asserts SSEL0 in master
-- mode. The output on the pin is active LOW by default.
TXSSEL0_N : FIFOWR_TXSSEL0_N_Field := NXP_SVD.SPI.Asserted;
-- Write-only. Transmit slave select. This field asserts SSEL1 in master
-- mode. The output on the pin is active LOW by default.
TXSSEL1_N : FIFOWR_TXSSEL1_N_Field := NXP_SVD.SPI.Asserted;
-- Write-only. Transmit slave select. This field asserts SSEL2 in master
-- mode. The output on the pin is active LOW by default.
TXSSEL2_N : FIFOWR_TXSSEL2_N_Field := NXP_SVD.SPI.Asserted;
-- Write-only. Transmit slave select. This field asserts SSEL3 in master
-- mode. The output on the pin is active LOW by default.
TXSSEL3_N : FIFOWR_TXSSEL3_N_Field := NXP_SVD.SPI.Asserted;
-- Write-only. End of transfer. The asserted SSEL will be deasserted at
-- the end of a transfer and remain so far at least the time specified
-- by the Transfer_delay value in the DLY register.
EOT : FIFOWR_EOT_Field := NXP_SVD.SPI.Not_Deasserted;
-- Write-only. End of frame. Between frames, a delay may be inserted, as
-- defined by the Frame_delay value in the DLY register. The end of a
-- frame may not be particularly meaningful if the Frame_delay value =
-- 0. This control can be used as part of the support for frame lengths
-- greater than 16 bits.
EOF : FIFOWR_EOF_Field := NXP_SVD.SPI.Not_Eof;
-- Write-only. Receive Ignore. This allows data to be transmitted using
-- the SPI without the need to read unneeded data from the receiver.
-- Setting this bit simplifies the transmit process and can be used with
-- the DMA.
RXIGNORE : FIFOWR_RXIGNORE_Field := NXP_SVD.SPI.Read;
-- unspecified
Reserved_23_23 : HAL.Bit := 16#0#;
-- Write-only. Data Length. Specifies the data length from 4 to 16 bits.
-- Note that transfer lengths greater than 16 bits are supported by
-- implementing multiple sequential transmits. 0x0-2 = Reserved. 0x3 =
-- Data transfer is 4 bits in length. 0x4 = Data transfer is 5 bits in
-- length. 0xF = Data transfer is 16 bits in length.
LEN : FIFOWR_LEN_Field := 16#0#;
-- unspecified
Reserved_28_31 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FIFOWR_Register use record
TXDATA at 0 range 0 .. 15;
TXSSEL0_N at 0 range 16 .. 16;
TXSSEL1_N at 0 range 17 .. 17;
TXSSEL2_N at 0 range 18 .. 18;
TXSSEL3_N at 0 range 19 .. 19;
EOT at 0 range 20 .. 20;
EOF at 0 range 21 .. 21;
RXIGNORE at 0 range 22 .. 22;
Reserved_23_23 at 0 range 23 .. 23;
LEN at 0 range 24 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
subtype FIFORD_RXDATA_Field is HAL.UInt16;
-- FIFO read data.
type FIFORD_Register is record
-- Read-only. Received data from the FIFO.
RXDATA : FIFORD_RXDATA_Field;
-- Read-only. Slave Select for receive. This field allows the state of
-- the SSEL0 pin to be saved along with received data. The value will
-- reflect the SSEL0 pin for both master and slave operation. A zero
-- indicates that a slave select is active. The actual polarity of each
-- slave select pin is configured by the related SPOL bit in CFG.
RXSSEL0_N : Boolean;
-- Read-only. Slave Select for receive. This field allows the state of
-- the SSEL1 pin to be saved along with received data. The value will
-- reflect the SSEL1 pin for both master and slave operation. A zero
-- indicates that a slave select is active. The actual polarity of each
-- slave select pin is configured by the related SPOL bit in CFG.
RXSSEL1_N : Boolean;
-- Read-only. Slave Select for receive. This field allows the state of
-- the SSEL2 pin to be saved along with received data. The value will
-- reflect the SSEL2 pin for both master and slave operation. A zero
-- indicates that a slave select is active. The actual polarity of each
-- slave select pin is configured by the related SPOL bit in CFG.
RXSSEL2_N : Boolean;
-- Read-only. Slave Select for receive. This field allows the state of
-- the SSEL3 pin to be saved along with received data. The value will
-- reflect the SSEL3 pin for both master and slave operation. A zero
-- indicates that a slave select is active. The actual polarity of each
-- slave select pin is configured by the related SPOL bit in CFG.
RXSSEL3_N : Boolean;
-- Read-only. Start of Transfer flag. This flag will be 1 if this is the
-- first data after the SSELs went from deasserted to asserted (i.e.,
-- any previous transfer has ended). This information can be used to
-- identify the first piece of data in cases where the transfer length
-- is greater than 16 bits.
SOT : Boolean;
-- unspecified
Reserved_21_31 : HAL.UInt11;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FIFORD_Register use record
RXDATA at 0 range 0 .. 15;
RXSSEL0_N at 0 range 16 .. 16;
RXSSEL1_N at 0 range 17 .. 17;
RXSSEL2_N at 0 range 18 .. 18;
RXSSEL3_N at 0 range 19 .. 19;
SOT at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
subtype FIFORDNOPOP_RXDATA_Field is HAL.UInt16;
-- FIFO data read with no FIFO pop.
type FIFORDNOPOP_Register is record
-- Read-only. Received data from the FIFO.
RXDATA : FIFORDNOPOP_RXDATA_Field;
-- Read-only. Slave Select for receive.
RXSSEL0_N : Boolean;
-- Read-only. Slave Select for receive.
RXSSEL1_N : Boolean;
-- Read-only. Slave Select for receive.
RXSSEL2_N : Boolean;
-- Read-only. Slave Select for receive.
RXSSEL3_N : Boolean;
-- Read-only. Start of transfer flag.
SOT : Boolean;
-- unspecified
Reserved_21_31 : HAL.UInt11;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FIFORDNOPOP_Register use record
RXDATA at 0 range 0 .. 15;
RXSSEL0_N at 0 range 16 .. 16;
RXSSEL1_N at 0 range 17 .. 17;
RXSSEL2_N at 0 range 18 .. 18;
RXSSEL3_N at 0 range 19 .. 19;
SOT at 0 range 20 .. 20;
Reserved_21_31 at 0 range 21 .. 31;
end record;
subtype ID_APERTURE_Field is HAL.UInt8;
subtype ID_MINOR_REV_Field is HAL.UInt4;
subtype ID_MAJOR_REV_Field is HAL.UInt4;
subtype ID_ID_Field is HAL.UInt16;
-- Peripheral identification register.
type ID_Register is record
-- Read-only. Aperture: encoded as (aperture size/4K) -1, so 0x00 means
-- a 4K aperture.
APERTURE : ID_APERTURE_Field;
-- Read-only. Minor revision of module implementation.
MINOR_REV : ID_MINOR_REV_Field;
-- Read-only. Major revision of module implementation.
MAJOR_REV : ID_MAJOR_REV_Field;
-- Read-only. Module identifier for the selected function.
ID : ID_ID_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ID_Register use record
APERTURE at 0 range 0 .. 7;
MINOR_REV at 0 range 8 .. 11;
MAJOR_REV at 0 range 12 .. 15;
ID at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Serial Peripheral Interfaces (SPI)
type SPI_Peripheral is record
-- SPI Configuration register
CFG : aliased CFG_Register;
-- SPI Delay register
DLY : aliased DLY_Register;
-- SPI Status. Some status flags can be cleared by writing a 1 to that
-- bit position.
STAT : aliased STAT_Register;
-- SPI Interrupt Enable read and Set. A complete value may be read from
-- this register. Writing a 1 to any implemented bit position causes
-- that bit to be set.
INTENSET : aliased INTENSET_Register;
-- SPI Interrupt Enable Clear. Writing a 1 to any implemented bit
-- position causes the corresponding bit in INTENSET to be cleared.
INTENCLR : aliased INTENCLR_Register;
-- SPI clock Divider
DIV : aliased DIV_Register;
-- SPI Interrupt Status
INTSTAT : aliased INTSTAT_Register;
-- FIFO configuration and enable register.
FIFOCFG : aliased FIFOCFG_Register;
-- FIFO status register.
FIFOSTAT : aliased FIFOSTAT_Register;
-- FIFO trigger settings for interrupt and DMA request.
FIFOTRIG : aliased FIFOTRIG_Register;
-- FIFO interrupt enable set (enable) and read register.
FIFOINTENSET : aliased FIFOINTENSET_Register;
-- FIFO interrupt enable clear (disable) and read register.
FIFOINTENCLR : aliased FIFOINTENCLR_Register;
-- FIFO interrupt status register.
FIFOINTSTAT : aliased FIFOINTSTAT_Register;
-- FIFO write data.
FIFOWR : aliased FIFOWR_Register;
-- FIFO read data.
FIFORD : aliased FIFORD_Register;
-- FIFO data read with no FIFO pop.
FIFORDNOPOP : aliased FIFORDNOPOP_Register;
-- Peripheral identification register.
ID : aliased ID_Register;
end record
with Volatile;
for SPI_Peripheral use record
CFG at 16#400# range 0 .. 31;
DLY at 16#404# range 0 .. 31;
STAT at 16#408# range 0 .. 31;
INTENSET at 16#40C# range 0 .. 31;
INTENCLR at 16#410# range 0 .. 31;
DIV at 16#424# range 0 .. 31;
INTSTAT at 16#428# range 0 .. 31;
FIFOCFG at 16#E00# range 0 .. 31;
FIFOSTAT at 16#E04# range 0 .. 31;
FIFOTRIG at 16#E08# range 0 .. 31;
FIFOINTENSET at 16#E10# range 0 .. 31;
FIFOINTENCLR at 16#E14# range 0 .. 31;
FIFOINTSTAT at 16#E18# range 0 .. 31;
FIFOWR at 16#E20# range 0 .. 31;
FIFORD at 16#E30# range 0 .. 31;
FIFORDNOPOP at 16#E40# range 0 .. 31;
ID at 16#FFC# range 0 .. 31;
end record;
-- Serial Peripheral Interfaces (SPI)
SPI0_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40086000#);
-- Serial Peripheral Interfaces (SPI)
SPI1_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40087000#);
-- Serial Peripheral Interfaces (SPI)
SPI2_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40088000#);
-- Serial Peripheral Interfaces (SPI)
SPI3_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40089000#);
-- Serial Peripheral Interfaces (SPI)
SPI4_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#4008A000#);
-- Serial Peripheral Interfaces (SPI)
SPI5_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40096000#);
-- Serial Peripheral Interfaces (SPI)
SPI6_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40097000#);
-- Serial Peripheral Interfaces (SPI)
SPI7_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#40098000#);
-- Serial Peripheral Interfaces (SPI)
SPI8_Periph : aliased SPI_Peripheral
with Import, Address => System'To_Address (16#4009F000#);
end NXP_SVD.SPI;
|
jpl_string.asm | JacobLaney/x86-Assembly-Practice | 0 | 162347 | ; <NAME>
; January 2016
;
; 32 Bit NASM x86 for macOS Sierra
;
; Objective: Write a library in NASM x86 similar to the
; C library string.h
global _jpl_strcmp
section .data
section .text
syscall:
int 80h
ret
; int jpl_strcmp(const char * str1, const char * str2);
_jpl_strcmp:
push ebp
mov ebp, esp
push esi
push edi
mov esi, [ebp + 8] ; str 1
mov edi, [ebp + 12] ; str2
L1:
mov al, byte [edi]
cmp byte [esi], al
jne END_L1
cmp byte[edi], 0
je Equal
inc esi
inc edi
jmp L1
END_L1:
ja Greater
je Equal
jb Less
Greater:
mov eax, 100
jmp Return
Equal:
mov eax, 0
jmp Return
Less:
mov eax, -9
jmp Return
Return:
pop edi
pop esi
mov esp, ebp
pop ebp
ret
|
test/succeed/Issue292.agda | asr/agda-kanso | 1 | 6783 | <reponame>asr/agda-kanso<gh_stars>1-10
-- Fixed on AIM XIV 2011-09-09 AA, UN
-- {-# OPTIONS -v tc.lhs.unify:50 #-}
module Issue292 where
data ⊥ : Set where
infix 3 ¬_
¬_ : Set → Set
¬ P = P → ⊥
infix 4 _≅_
data _≅_ {A : Set} (x : A) : ∀ {B : Set} → B → Set where
refl : x ≅ x
record Σ (A : Set) (B : A → Set) : Set where
constructor _,_
field
proj₁ : A
proj₂ : B proj₁
open Σ public
data Bool : Set where true false : Bool
data D : Bool -> Set where
tt : D true
ff : D false
P : Set -> Set
P S = Σ S (\s → s ≅ tt)
pbool : P (D true)
pbool = tt , refl
¬pbool2 : ¬ P (D false)
¬pbool2 ( ff , () )
-- Andreas, 2011-09-13 fix of fix: should work again
{- WAS: expected error
ff ≅ tt should be empty, but that's not obvious to me
when checking that the clause ¬pbool2 (ff , ()) has type
¬ P (D false)
-}
|
src/Sigma/Subst/Base.agda | johnyob/agda-sigma | 0 | 7023 | -- ----------------------------------------------------------------------
-- The Agda σ-library
--
-- Substitutions
-- ----------------------------------------------------------------------
-- A substitution on T is defined as a mapping from
-- indices to T (w/ explicit bounds).
--
-- Since the domain is bounded, we may think
-- of substitutions as vectors.
module Sigma.Subst.Base where
open import Data.Nat using (ℕ; suc; zero; _+_)
open import Data.Fin using (Fin; zero; suc)
open import Function using (_∘_)
open import Data.Product using (_×_) renaming ( _,_ to ⟨_,_⟩ )
-- ----------------------------------------------------------------------
-- A subsitution σ : 𝕀ⁿ → T is denoted { i ↦ x : i ∈ 𝕀ⁿ, x ∈ T }
Sub : Set → ℕ → Set
Sub T m = Fin m → T
-- The empty subsitution.
-- Note that 𝕀⁰ ≡ ⊥. We note σ : 𝕀⁰ → T by []
-- Intuitively, this mimics an empty vector.
[] : ∀ { T } → Sub T 0
[] = λ ()
infixr 5 _∷_
-- The σ-cons operator ∷ ∶ T → (𝕀ⁿ → T) → (𝕀¹⁺ⁿ → T)
--
-- Intuitively, the σ-cons operator mimics the
-- semantics of cons operator on vectors.
--
-- x ∷ σ = { 0 ↦ x } ∪ { 1 + i ↦ σ i : i ∈ 𝕀ⁿ }
_∷_ : ∀ { n } { T } → T → Sub T n → Sub T (1 + n)
(x ∷ σ) zero = x
(x ∷ σ) (suc n) = σ n
[_] : ∀ { T } → T → Sub T 1
[ x ] = x ∷ []
head : ∀ { n } { T } → Sub T (1 + n) → T
head σ = σ zero
tail : ∀ { n } { T } → Sub T (1 + n) → Sub T n
tail σ = σ ∘ suc
map : ∀ { n } { T U } → (T → U) → Sub T n → Sub U n
map f σ = f ∘ σ
uncons : ∀ { n } { T } → Sub T (1 + n) → T × Sub T n
uncons σ = ⟨ head σ , tail σ ⟩
infixr 5 _++_
-- The σ-append operator ++ : (𝕀ᵐ → T) → (𝕀ⁿ → T) → (𝕀ᵐ⁺ⁿ → T)
--
-- σ₁ ++ σ₂ = { i ↦ σ₁ i : i ∈ 𝕀ᵐ⁺ⁿ, i < m } ∪ { i ↦ σ₂ i : i ∈ 𝕀ᵐ⁺ⁿ, i ≥ m }
_++_ : ∀ { m n } { T } → Sub T m → Sub T n → Sub T (m + n)
_++_ {zero} σ₁ σ₂ = σ₂
_++_ {suc m} σ₁ σ₂ = σ₁ zero ∷ (σ₁ ∘ suc) ++ σ₂
|
oeis/349/A349191.asm | neoneye/loda-programs | 11 | 104941 | ; A349191: a(n) = A000720(A348907(n+1)).
; Submitted by <NAME>
; 1,2,1,3,2,4,1,3,2,5,4,6,1,3,2,7,5,8,4,6,1,9,3,2,7,5,8,10,4,11,6,1,9,3,2,12,7,5,8,13,10,14,4,11,6,15,1,9,3,2,12,16,7,5,8,13,10,17,14,18,4,11,6,15,1,19,9,3,2,20,12,21,16,7,5,8,13,22,10,17,14,23,18,4,11,6,15,24,1,19,9,3,2,20,12,25,21,16,7,26
seq $0,348907 ; If n is prime, a(n) = n, else a(n) = a(n-pi(n)), n >= 2; where pi is the prime counting function A000720.
seq $0,230980 ; Number of primes <= n, starting at n=0.
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_2438.asm | ljhsiun2/medusa | 9 | 89428 | <filename>Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_2438.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1d519, %rsi
lea addresses_A_ht+0x879, %rdi
nop
nop
add $10861, %rbp
mov $39, %rcx
rep movsq
nop
nop
nop
nop
xor $15829, %r14
lea addresses_D_ht+0xb5f9, %r10
nop
nop
nop
add $41277, %rcx
movw $0x6162, (%r10)
nop
nop
nop
cmp %rsi, %rsi
lea addresses_normal_ht+0x18479, %rsi
lea addresses_UC_ht+0x20ba, %rdi
clflush (%rsi)
nop
nop
and $53283, %r14
mov $89, %rcx
rep movsl
nop
nop
xor $55052, %r10
lea addresses_normal_ht+0x1bf39, %rsi
lea addresses_WC_ht+0x1cc39, %rdi
nop
add %rbx, %rbx
mov $33, %rcx
rep movsl
dec %rdi
lea addresses_D_ht+0x12f1, %rdi
dec %r10
mov (%rdi), %cx
cmp $57897, %rbp
lea addresses_WT_ht+0x199a7, %r10
nop
nop
nop
cmp %rdi, %rdi
mov (%r10), %esi
nop
cmp %rcx, %rcx
lea addresses_UC_ht+0x1361, %rsi
lea addresses_UC_ht+0x10e79, %rdi
clflush (%rsi)
nop
nop
nop
nop
xor $47119, %r11
mov $38, %rcx
rep movsl
nop
nop
nop
nop
xor %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %r8
push %r9
push %rbp
// Load
lea addresses_D+0x138a9, %rbp
clflush (%rbp)
nop
nop
xor %r12, %r12
movups (%rbp), %xmm7
vpextrq $1, %xmm7, %r14
nop
add %r8, %r8
// Store
lea addresses_UC+0x2279, %r13
nop
nop
nop
cmp $52844, %r8
mov $0x5152535455565758, %r14
movq %r14, %xmm0
movups %xmm0, (%r13)
nop
nop
nop
nop
xor $45553, %r11
// Store
lea addresses_PSE+0x1a899, %r8
nop
nop
nop
nop
and %r9, %r9
mov $0x5152535455565758, %r12
movq %r12, %xmm3
movups %xmm3, (%r8)
add %r9, %r9
// Faulty Load
lea addresses_WT+0x14879, %r11
nop
cmp $51903, %r9
mov (%r11), %r12w
lea oracles, %r9
and $0xff, %r12
shlq $12, %r12
mov (%r9,%r12,1), %r12
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 7, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 5, 'size': 16, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
setup.asm | RevolutionSoftware/Juego | 1 | 7643 | di
ld hl,12000
bcall(_EnoughMem)
jr nc,$+5
bjump(_JForceCmdNoChar) ;chau!
ex de,hl ;hl = RAM to insert
ld de,$9D95
bcall(_InsertMem)
ld h,d
ld l,e
inc de
ld (hl),0
ld bc,11999
ldir
ld hl,salirDelPrograma
push hl ;el último ret nos mandará a salirDelPrograma
;cargar rutinas en RAM
ld hl,copy_to_ram
ld de,ramRoutines
ld bc,copy_to_ram_end-copy_to_ram_start
ldir
;vaciar inventorio
ld hl,playerInventory
ld (hl),$FF
ld de,playerInventory+1
ld bc,184
ldir
ld hl,playerInventory
ld a,8
ld (hl),a ;4 items
inc hl
ld (hl),0
inc hl
ld (hl),99
inc hl
ld (hl),1
inc hl
ld (hl),4
inc hl
ld (hl),2
inc hl
ld (hl),40
inc hl
ld (hl),3
inc hl
ld (hl),50
inc hl
ld (hl),4
inc hl
ld (hl),5
inc hl
ld (hl),5
inc hl
ld (hl),7
inc hl
ld (hl),6
inc hl
ld (hl),19
inc hl
ld (hl),7
inc hl
ld (hl),2
ld a,$3
ld (playerGold),a
ld hl,$FF70
ld (playerGold+1),hl ;playerGold = $3FFFF
;default values
xor a
ld b,6
ld hl,bigNumberString
ld (hl),a
inc hl
djnz $-2
ld (hl),a ;0 terminate the string
ld (playerDir),a
;default stats
xor a
call loadPlayer ;load player ID 0 (franci)
xor a
ld hl,playerAnimation
ld (hl),a
ld hl,mapOverDraw ;variable to know which pass through the mapper we're at (si hay que dibujar el suelo o las mascaras)
ld (hl),1
ld hl,animationCounter
ld (hl),32
inc hl ;animation frame
ld (hl),a ;frame 0
ld (secondPulsado),a
ld a,MAP_START
ld de,(PLAY_Y_START*256)+PLAY_X_START
call changeMap
|
alloy4fun_models/trashltl/models/5/rouvA4qTCLEKGqAv5.als | Kaixi26/org.alloytools.alloy | 0 | 2066 | open main
pred idrouvA4qTCLEKGqAv5_prop6 {
some f:File | f in Trash implies always f in Trash
}
pred __repair { idrouvA4qTCLEKGqAv5_prop6 }
check __repair { idrouvA4qTCLEKGqAv5_prop6 <=> prop6o } |
src/tests/bintoasc_suite-base64_tests.ads | jhumphry/Ada_BinToAsc | 0 | 1352 | <filename>src/tests/bintoasc_suite-base64_tests.ads
-- BinToAsc_Suite.Base64_Tests
-- Unit tests for BinToAsc
-- Copyright (c) 2015, <NAME> - see LICENSE file for details
with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
with RFC4648;
with BinToAsc_Suite.Utils;
package BinToAsc_Suite.Base64_Tests is
Base64_Test_Vectors : constant Test_Vector_Array := ((TBS(""), TBS("")),
(TBS("f"), TBS("Zg==")),
(TBS("fo"), TBS("Zm8=")),
(TBS("foo"), TBS("Zm9v")),
(TBS("foob"), TBS("Zm9vYg==")),
(TBS("fooba"), TBS("Zm9vYmE=")),
(TBS("foobar"), TBS("Zm9vYmFy")));
type Base64_Test is new Test_Cases.Test_Case with null record;
procedure Register_Tests (T: in out Base64_Test);
function Name (T : Base64_Test) return Test_String;
procedure Set_Up (T : in out Base64_Test);
procedure Check_Symmetry is
new BinToAsc_Suite.Utils.Check_Symmetry(BToA => RFC4648.BToA,
Codec_To_String => RFC4648.Base64.Base64_To_String,
Codec_To_Bin => RFC4648.Base64.Base64_To_Bin);
procedure Check_Length is
new BinToAsc_Suite.Utils.Check_Length(BToA => RFC4648.BToA,
Codec_To_String => RFC4648.Base64.Base64_To_String,
Codec_To_Bin => RFC4648.Base64.Base64_To_Bin);
procedure Check_Test_Vectors_To_String is
new BinToAsc_Suite.Utils.Check_Test_Vectors_To_String(Test_Vectors => Base64_Test_Vectors,
Codec_To_String => RFC4648.Base64.Base64_To_String);
procedure Check_Test_Vectors_To_Bin is
new BinToAsc_Suite.Utils.Check_Test_Vectors_To_Bin(Test_Vectors => Base64_Test_Vectors,
Codec_To_Bin => RFC4648.Base64.Base64_To_Bin);
procedure Check_Test_Vectors_Incremental_To_String is
new BinToAsc_Suite.Utils.Check_Test_Vectors_Incremental_To_String(Test_Vectors => Base64_Test_Vectors,
Codec_To_String => RFC4648.Base64.Base64_To_String,
Max_Buffer_Length => 20);
procedure Check_Test_Vectors_Incremental_To_Bin is
new BinToAsc_Suite.Utils.Check_Test_Vectors_Incremental_To_Bin(Test_Vectors => Base64_Test_Vectors,
Codec_To_Bin => RFC4648.Base64.Base64_To_Bin,
Max_Buffer_Length => 20);
procedure Check_Test_Vectors_By_Char_To_String is
new BinToAsc_Suite.Utils.Check_Test_Vectors_By_Char_To_String(Test_Vectors => Base64_Test_Vectors,
Codec_To_String => RFC4648.Base64.Base64_To_String,
Max_Buffer_Length => 20);
procedure Check_Test_Vectors_By_Char_To_Bin is
new BinToAsc_Suite.Utils.Check_Test_Vectors_By_Char_To_Bin(Test_Vectors => Base64_Test_Vectors,
Codec_To_Bin => RFC4648.Base64.Base64_To_Bin,
Max_Buffer_Length => 20);
procedure Check_Padding (T : in out Test_Cases.Test_Case'Class);
procedure Check_Junk_Rejection (T : in out Test_Cases.Test_Case'Class);
procedure Check_Junk_Rejection_By_Char (T : in out Test_Cases.Test_Case'Class);
end BinToAsc_Suite.Base64_Tests;
|
source/league/ucd/matreshka-internals-unicode-ucd-core_0030.ads | svn2github/matreshka | 24 | 14759 | <filename>source/league/ucd/matreshka-internals-unicode-ucd-core_0030.ads
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, <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$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_0030 is
pragma Preelaborate;
Group_0030 : aliased constant Core_Second_Stage
:= (16#00# => -- 3000
(Space_Separator, Fullwidth,
Other, Other, Sp, Break_After,
(White_Space
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#01# => -- 3001
(Other_Punctuation, Wide,
Other, Other, S_Continue, Close_Punctuation,
(Pattern_Syntax
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#02# => -- 3002
(Other_Punctuation, Wide,
Other, Other, S_Term, Close_Punctuation,
(Pattern_Syntax
| STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#03# => -- 3003
(Other_Punctuation, Wide,
Other, Other, Other, Ideographic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#04# => -- 3004
(Other_Symbol, Wide,
Other, Other, Other, Ideographic,
(Grapheme_Base => True,
others => False)),
16#05# => -- 3005
(Modifier_Letter, Wide,
Other, A_Letter, O_Letter, Nonstarter,
(Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#06# => -- 3006
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Ideographic
| Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#07# => -- 3007
(Letter_Number, Wide,
Other, Other, O_Letter, Ideographic,
(Ideographic
| Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#08# => -- 3008
(Open_Punctuation, Wide,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#09# => -- 3009
(Close_Punctuation, Wide,
Other, Other, Close, Close_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#0A# => -- 300A
(Open_Punctuation, Wide,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#0B# => -- 300B
(Close_Punctuation, Wide,
Other, Other, Close, Close_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#0C# => -- 300C
(Open_Punctuation, Wide,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Quotation_Mark
| Grapheme_Base => True,
others => False)),
16#0D# => -- 300D
(Close_Punctuation, Wide,
Other, Other, Close, Close_Punctuation,
(Pattern_Syntax
| Quotation_Mark
| Grapheme_Base => True,
others => False)),
16#0E# => -- 300E
(Open_Punctuation, Wide,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Quotation_Mark
| Grapheme_Base => True,
others => False)),
16#0F# => -- 300F
(Close_Punctuation, Wide,
Other, Other, Close, Close_Punctuation,
(Pattern_Syntax
| Quotation_Mark
| Grapheme_Base => True,
others => False)),
16#10# => -- 3010
(Open_Punctuation, Wide,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#11# => -- 3011
(Close_Punctuation, Wide,
Other, Other, Close, Close_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#12# .. 16#13# => -- 3012 .. 3013
(Other_Symbol, Wide,
Other, Other, Other, Ideographic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#14# => -- 3014
(Open_Punctuation, Wide,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#15# => -- 3015
(Close_Punctuation, Wide,
Other, Other, Close, Close_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#16# => -- 3016
(Open_Punctuation, Wide,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#17# => -- 3017
(Close_Punctuation, Wide,
Other, Other, Close, Close_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#18# => -- 3018
(Open_Punctuation, Wide,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#19# => -- 3019
(Close_Punctuation, Wide,
Other, Other, Close, Close_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#1A# => -- 301A
(Open_Punctuation, Wide,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#1B# => -- 301B
(Close_Punctuation, Wide,
Other, Other, Close, Close_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#1C# => -- 301C
(Dash_Punctuation, Wide,
Other, Other, Other, Nonstarter,
(Dash
| Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#1D# => -- 301D
(Open_Punctuation, Wide,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Quotation_Mark
| Grapheme_Base => True,
others => False)),
16#1E# .. 16#1F# => -- 301E .. 301F
(Close_Punctuation, Wide,
Other, Other, Close, Close_Punctuation,
(Pattern_Syntax
| Quotation_Mark
| Grapheme_Base => True,
others => False)),
16#20# => -- 3020
(Other_Symbol, Wide,
Other, Other, Other, Ideographic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#21# .. 16#29# => -- 3021 .. 3029
(Letter_Number, Wide,
Other, Other, O_Letter, Ideographic,
(Ideographic
| Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#2A# .. 16#2D# => -- 302A .. 302D
(Nonspacing_Mark, Wide,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#2E# .. 16#2F# => -- 302E .. 302F
(Spacing_Mark, Wide,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Other_Grapheme_Extend
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#30# => -- 3030
(Dash_Punctuation, Wide,
Other, Other, Other, Ideographic,
(Dash
| Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#31# .. 16#34# => -- 3031 .. 3034
(Modifier_Letter, Wide,
Other, Katakana, O_Letter, Ideographic,
(Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#35# => -- 3035
(Modifier_Letter, Wide,
Other, Katakana, O_Letter, Combining_Mark,
(Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#36# => -- 3036
(Other_Symbol, Wide,
Other, Other, Other, Ideographic,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#37# => -- 3037
(Other_Symbol, Wide,
Other, Other, Other, Ideographic,
(Grapheme_Base => True,
others => False)),
16#38# .. 16#3A# => -- 3038 .. 303A
(Letter_Number, Wide,
Other, Other, O_Letter, Ideographic,
(Ideographic
| Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#3B# => -- 303B
(Modifier_Letter, Wide,
Other, A_Letter, O_Letter, Nonstarter,
(Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#3C# => -- 303C
(Other_Letter, Wide,
Other, A_Letter, O_Letter, Nonstarter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#3D# => -- 303D
(Other_Punctuation, Wide,
Other, Other, Other, Ideographic,
(Grapheme_Base => True,
others => False)),
16#3E# => -- 303E
(Other_Symbol, Wide,
Other, Other, Other, Ideographic,
(Grapheme_Base => True,
others => False)),
16#3F# => -- 303F
(Other_Symbol, Neutral,
Other, Other, Other, Ideographic,
(Grapheme_Base => True,
others => False)),
16#40# => -- 3040
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#41# => -- 3041
(Other_Letter, Wide,
Other, Other, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#42# => -- 3042
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#43# => -- 3043
(Other_Letter, Wide,
Other, Other, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#44# => -- 3044
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#45# => -- 3045
(Other_Letter, Wide,
Other, Other, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#46# => -- 3046
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#47# => -- 3047
(Other_Letter, Wide,
Other, Other, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#48# => -- 3048
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#49# => -- 3049
(Other_Letter, Wide,
Other, Other, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#4A# .. 16#62# => -- 304A .. 3062
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#63# => -- 3063
(Other_Letter, Wide,
Other, Other, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#64# .. 16#82# => -- 3064 .. 3082
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#83# => -- 3083
(Other_Letter, Wide,
Other, Other, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#84# => -- 3084
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#85# => -- 3085
(Other_Letter, Wide,
Other, Other, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#86# => -- 3086
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#87# => -- 3087
(Other_Letter, Wide,
Other, Other, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#88# .. 16#8D# => -- 3088 .. 308D
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#8E# => -- 308E
(Other_Letter, Wide,
Other, Other, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#8F# .. 16#94# => -- 308F .. 3094
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#95# .. 16#96# => -- 3095 .. 3096
(Other_Letter, Wide,
Other, Other, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#97# .. 16#98# => -- 3097 .. 3098
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)),
16#99# .. 16#9A# => -- 3099 .. 309A
(Nonspacing_Mark, Wide,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#9B# .. 16#9C# => -- 309B .. 309C
(Modifier_Symbol, Wide,
Other, Katakana, Other, Nonstarter,
(Diacritic
| Other_ID_Start
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#9D# .. 16#9E# => -- 309D .. 309E
(Modifier_Letter, Wide,
Other, Other, O_Letter, Nonstarter,
(Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#9F# => -- 309F
(Other_Letter, Wide,
Other, Other, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#A0# => -- 30A0
(Dash_Punctuation, Wide,
Other, Katakana, Other, Nonstarter,
(Dash
| Grapheme_Base => True,
others => False)),
16#A1# => -- 30A1
(Other_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#A3# => -- 30A3
(Other_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#A5# => -- 30A5
(Other_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#A7# => -- 30A7
(Other_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#A9# => -- 30A9
(Other_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#C3# => -- 30C3
(Other_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#E3# => -- 30E3
(Other_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#E5# => -- 30E5
(Other_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#E7# => -- 30E7
(Other_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#EE# => -- 30EE
(Other_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#F5# .. 16#F6# => -- 30F5 .. 30F6
(Other_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#FB# => -- 30FB
(Other_Punctuation, Wide,
Other, Other, Other, Nonstarter,
(Hyphen
| Grapheme_Base => True,
others => False)),
16#FC# => -- 30FC
(Modifier_Letter, Wide,
Other, Katakana, O_Letter, Conditional_Japanese_Starter,
(Diacritic
| Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#FD# .. 16#FE# => -- 30FD .. 30FE
(Modifier_Letter, Wide,
Other, Katakana, O_Letter, Nonstarter,
(Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#FF# => -- 30FF
(Other_Letter, Wide,
Other, Katakana, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
others =>
(Other_Letter, Wide,
Other, Katakana, O_Letter, Ideographic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_0030;
|
src/giza-colors.ads | Fabien-Chouteau/Giza | 7 | 5218 | ------------------------------------------------------------------------------
-- --
-- Giza --
-- --
-- Copyright (C) 2015 <NAME> (<EMAIL>) --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package Giza.Colors is
type RGB_Component is new Natural range 0 .. 255;
type Color is record
R, G, B : RGB_Component := 0;
end record with Pack;
function Dark_Red return Color is ((139, 000, 000));
function Brown return Color is ((165, 042, 042));
function Firebrick return Color is ((178, 034, 034));
function Crimson return Color is ((220, 020, 060));
function Red return Color is ((255, 000, 000));
function Tomato return Color is ((255, 099, 071));
function Coral return Color is ((255, 127, 080));
function Indian_Red return Color is ((205, 092, 092));
function Light_Coral return Color is ((240, 128, 128));
function Dark_Salmon return Color is ((233, 150, 122));
function Salmon return Color is ((250, 128, 114));
function Light_Salmon return Color is ((255, 160, 122));
function Orange_Red return Color is ((255, 069, 000));
function Dark_Orange return Color is ((255, 140, 000));
function Orange return Color is ((255, 165, 000));
function Gold return Color is ((255, 215, 000));
function Dark_Golden_Rod return Color is ((184, 134, 011));
function Golden_Rod return Color is ((218, 165, 032));
function Pale_Golden_Rod return Color is ((238, 232, 170));
function Dark_Khaki return Color is ((189, 183, 107));
function Khaki return Color is ((240, 230, 140));
function Olive return Color is ((128, 128, 000));
function Yellow return Color is ((255, 255, 000));
function Yellow_Green return Color is ((154, 205, 050));
function Dark_Olive_Green return Color is ((085, 107, 047));
function Olive_Drab return Color is ((107, 142, 035));
function Lawn_Green return Color is ((124, 252, 000));
function Chart_Reuse return Color is ((127, 255, 000));
function Green_Yellow return Color is ((173, 255, 047));
function Dark_Green return Color is ((000, 100, 000));
function Green return Color is ((000, 128, 000));
function Maroon return Color is ((128, 000, 000));
function Forest_Green return Color is ((034, 139, 034));
function Lime return Color is ((000, 255, 000));
function Lime_Green return Color is ((050, 205, 050));
function Light_Green return Color is ((144, 238, 144));
function Pale_Green return Color is ((152, 251, 152));
function Dark_Sea_Green return Color is ((143, 188, 143));
function Medium_Spring_Green return Color is ((000, 250, 154));
function Spring_Green return Color is ((000, 255, 127));
function Sea_Green return Color is ((046, 139, 087));
function Medium_Aqua_Marine return Color is ((102, 205, 170));
function Medium_Sea_Green return Color is ((060, 179, 113));
function Light_Sea_Green return Color is ((032, 178, 170));
function Dark_Slate_Gray return Color is ((047, 079, 079));
function Teal return Color is ((000, 128, 128));
function Dark_Cyan return Color is ((000, 139, 139));
function Aqua return Color is ((000, 255, 255));
function Cyan return Color is ((000, 255, 255));
function Light_Cyan return Color is ((224, 255, 255));
function Dark_Turquoise return Color is ((000, 206, 209));
function Turquoise return Color is ((064, 224, 208));
function Medium_Turquoise return Color is ((072, 209, 204));
function Pale_Turquoise return Color is ((175, 238, 238));
function Aqua_Marine return Color is ((127, 255, 212));
function Powder_Blue return Color is ((176, 224, 230));
function Cadet_Blue return Color is ((095, 158, 160));
function Steel_Blue return Color is ((070, 130, 180));
function Corn_Flower_Blue return Color is ((100, 149, 237));
function Deep_Sky_Blue return Color is ((000, 191, 255));
function Dodger_Blue return Color is ((030, 144, 255));
function Light_Blue return Color is ((173, 216, 230));
function Sky_Blue return Color is ((135, 206, 235));
function Light_Sky_Blue return Color is ((135, 206, 250));
function Midnight_Blue return Color is ((025, 025, 112));
function Navy return Color is ((000, 000, 128));
function Dark_Blue return Color is ((000, 000, 139));
function Medium_Blue return Color is ((000, 000, 205));
function Blue return Color is ((000, 000, 255));
function Royal_Blue return Color is ((065, 105, 225));
function Blue_Violet return Color is ((138, 043, 226));
function Indigo return Color is ((075, 000, 130));
function Dark_Slate_Blue return Color is ((072, 061, 139));
function Slate_Blue return Color is ((106, 090, 205));
function Medium_Slate_Blue return Color is ((123, 104, 238));
function Medium_Purple return Color is ((147, 112, 219));
function Dark_Magenta return Color is ((139, 000, 139));
function Dark_Violet return Color is ((148, 000, 211));
function Dark_Orchid return Color is ((153, 050, 204));
function Medium_Orchid return Color is ((186, 085, 211));
function Purple return Color is ((128, 000, 128));
function Thistle return Color is ((216, 191, 216));
function Plum return Color is ((221, 160, 221));
function Violet return Color is ((238, 130, 238));
function Magenta return Color is ((255, 000, 255));
function Orchid return Color is ((218, 112, 214));
function Medium_Violet_Red return Color is ((199, 021, 133));
function Pale_Violet_Red return Color is ((219, 112, 147));
function Deep_Pink return Color is ((255, 020, 147));
function Hot_Pink return Color is ((255, 105, 180));
function Light_Pink return Color is ((255, 182, 193));
function Pink return Color is ((255, 192, 203));
function Antique_White return Color is ((250, 235, 215));
function Beige return Color is ((245, 245, 220));
function Bisque return Color is ((255, 228, 196));
function Blanched_Almond return Color is ((255, 235, 205));
function Wheat return Color is ((245, 222, 179));
function Corn_Silk return Color is ((255, 248, 220));
function Lemon_Chiffon return Color is ((255, 250, 205));
function Light_Yellow return Color is ((255, 255, 224));
function Saddle_Brown return Color is ((139, 069, 019));
function Sienna return Color is ((160, 082, 045));
function Chocolate return Color is ((210, 105, 030));
function Peru return Color is ((205, 133, 063));
function Sandy_Brown return Color is ((244, 164, 096));
function Burly_Wood return Color is ((222, 184, 135));
function Tan return Color is ((210, 180, 140));
function Rosy_Brown return Color is ((188, 143, 143));
function Moccasin return Color is ((255, 228, 181));
function Navajo_White return Color is ((255, 222, 173));
function Peach_Puff return Color is ((255, 218, 185));
function Misty_Rose return Color is ((255, 228, 225));
function Lavender_Blush return Color is ((255, 240, 245));
function Linen return Color is ((250, 240, 230));
function Old_Lace return Color is ((253, 245, 230));
function Papaya_Whip return Color is ((255, 239, 213));
function Sea_Shell return Color is ((255, 245, 238));
function Mint_Cream return Color is ((245, 255, 250));
function Slate_Gray return Color is ((112, 128, 144));
function Light_Slate_Gray return Color is ((119, 136, 153));
function Light_Steel_Blue return Color is ((176, 196, 222));
function Lavender return Color is ((230, 230, 250));
function Floral_White return Color is ((255, 250, 240));
function Alice_Blue return Color is ((240, 248, 255));
function Ghost_White return Color is ((248, 248, 255));
function Honeydew return Color is ((240, 255, 240));
function Ivory return Color is ((255, 255, 240));
function Azure return Color is ((240, 255, 255));
function Snow return Color is ((255, 250, 250));
function Black return Color is ((000, 000, 000));
function Dim_Grey return Color is ((105, 105, 105));
function Grey return Color is ((128, 128, 128));
function Dark_Grey return Color is ((169, 169, 169));
function Silver return Color is ((192, 192, 192));
function Light_Grey return Color is ((211, 211, 211));
function Gainsboro return Color is ((220, 220, 220));
function White_Smoke return Color is ((245, 245, 245));
function White return Color is ((255, 255, 255));
end Giza.Colors;
|
target/cos_117/disasm/iop_overlay1/STOP.asm | jrrk2/cray-sim | 49 | 18572 | 0x0000 (0x000000) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0001 (0x000002) 0x291B- f:00024 d: 283 | OR[283] = A
0x0002 (0x000004) 0x1800-0x004C f:00014 d: 0 | A = 76 (0x004C)
0x0004 (0x000008) 0x2403- f:00022 d: 3 | A = A + OR[3]
0x0005 (0x00000A) 0x291A- f:00024 d: 282 | OR[282] = A
0x0006 (0x00000C) 0x1800-0x005E f:00014 d: 0 | A = 94 (0x005E)
0x0008 (0x000010) 0x2403- f:00022 d: 3 | A = A + OR[3]
0x0009 (0x000012) 0x2908- f:00024 d: 264 | OR[264] = A
0x000A (0x000014) 0x211A- f:00020 d: 282 | A = OR[282]
0x000B (0x000016) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x000C (0x000018) 0x8226- f:00101 d: 38 | P = P + 38 (0x0032), C = 1
0x000D (0x00001A) 0x2118- f:00020 d: 280 | A = OR[280]
0x000E (0x00001C) 0x371A- f:00033 d: 282 | A = A - (OR[282])
0x000F (0x00001E) 0x8402- f:00102 d: 2 | P = P + 2 (0x0011), A = 0
0x0010 (0x000020) 0x701E- f:00070 d: 30 | P = P + 30 (0x002E)
0x0011 (0x000022) 0x211A- f:00020 d: 282 | A = OR[282]
0x0012 (0x000024) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0013 (0x000026) 0x2908- f:00024 d: 264 | OR[264] = A
0x0014 (0x000028) 0x2119- f:00020 d: 281 | A = OR[281]
0x0015 (0x00002A) 0x3708- f:00033 d: 264 | A = A - (OR[264])
0x0016 (0x00002C) 0x8402- f:00102 d: 2 | P = P + 2 (0x0018), A = 0
0x0017 (0x00002E) 0x7017- f:00070 d: 23 | P = P + 23 (0x002E)
0x0018 (0x000030) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0019 (0x000032) 0x291A- f:00024 d: 282 | OR[282] = A
0x001A (0x000034) 0x100F- f:00010 d: 15 | A = 15 (0x000F)
0x001B (0x000036) 0x271B- f:00023 d: 283 | A = A - OR[283]
0x001C (0x000038) 0x120F- f:00011 d: 15 | A = A & 15 (0x000F)
0x001D (0x00003A) 0x5800- f:00054 d: 0 | B = A
0x001E (0x00003C) 0x211A- f:00020 d: 282 | A = OR[282]
0x001F (0x00003E) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0020 (0x000040) 0x290D- f:00024 d: 269 | OR[269] = A
0x0021 (0x000042) 0x211B- f:00020 d: 283 | A = OR[283]
0x0022 (0x000044) 0x0804- f:00004 d: 4 | A = A > 4 (0x0004)
0x0023 (0x000046) 0x1C00-0x0E0D f:00016 d: 0 | A = A + 3597 (0x0E0D)
0x0025 (0x00004A) 0x290E- f:00024 d: 270 | OR[270] = A
0x0026 (0x00004C) 0x310E- f:00030 d: 270 | A = (OR[270])
0x0027 (0x00004E) 0x4C00- f:00046 d: 0 | A = A >> B
0x0028 (0x000050) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x0029 (0x000052) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001)
0x002A (0x000054) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x002B (0x000056) 0x4E00- f:00047 d: 0 | A = A << B
0x002C (0x000058) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x002D (0x00005A) 0x7012- f:00070 d: 18 | P = P + 18 (0x003F)
0x002E (0x00005C) 0x1002- f:00010 d: 2 | A = 2 (0x0002)
0x002F (0x00005E) 0x2B1A- f:00025 d: 282 | OR[282] = A + OR[282]
0x0030 (0x000060) 0x2D1B- f:00026 d: 283 | OR[283] = OR[283] + 1
0x0031 (0x000062) 0x722B- f:00071 d: 43 | P = P - 43 (0x0006)
0x0032 (0x000064) 0x2003- f:00020 d: 3 | A = OR[3]
0x0033 (0x000066) 0x1C00-0x005E f:00016 d: 0 | A = A + 94 (0x005E)
0x0035 (0x00006A) 0x291A- f:00024 d: 282 | OR[282] = A
0x0036 (0x00006C) 0x1010- f:00010 d: 16 | A = 16 (0x0010)
0x0037 (0x00006E) 0x291C- f:00024 d: 284 | OR[284] = A
0x0038 (0x000070) 0x211A- f:00020 d: 282 | A = OR[282]
0x0039 (0x000072) 0x291D- f:00024 d: 285 | OR[285] = A
0x003A (0x000074) 0x111C- f:00010 d: 284 | A = 284 (0x011C)
0x003B (0x000076) 0x5800- f:00054 d: 0 | B = A
0x003C (0x000078) 0x1800-0x0918 f:00014 d: 0 | A = 2328 (0x0918)
0x003E (0x00007C) 0x7C09- f:00076 d: 9 | R = OR[9]
0x003F (0x00007E) 0x102A- f:00010 d: 42 | A = 42 (0x002A)
0x0040 (0x000080) 0x291C- f:00024 d: 284 | OR[284] = A
0x0041 (0x000082) 0x111C- f:00010 d: 284 | A = 284 (0x011C)
0x0042 (0x000084) 0x5800- f:00054 d: 0 | B = A
0x0043 (0x000086) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0044 (0x000088) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0045 (0x00008A) 0x0000- f:00000 d: 0 | PASS
0x0046 (0x00008C) 0x4348- f:00041 d: 328 | C = 1, io 0510 = BZ
0x0047 (0x00008E) 0x4E54- f:00047 d: 84 | A = A << B | **** non-standard encoding with D:0x0054 ****
0x0048 (0x000090) 0x4350- f:00041 d: 336 | C = 1, io 0520 = BZ
0x0049 (0x000092) 0x5445- f:00052 d: 69 | A = A + B | **** non-standard encoding with D:0x0045 ****
0x004A (0x000094) 0x4543- f:00042 d: 323 | C = 1, IOB = DN | **** non-standard encoding with D:0x0143 ****
0x004B (0x000096) 0x484F- f:00044 d: 79 | A = A > B | **** non-standard encoding with D:0x004F ****
0x004C (0x000098) 0x4853- f:00044 d: 83 | A = A > B | **** non-standard encoding with D:0x0053 ****
0x004D (0x00009A) 0x5054- f:00050 d: 84 | A = B | **** non-standard encoding with D:0x0054 ****
0x004E (0x00009C) 0x4D4F- f:00046 d: 335 | A = A >> B | **** non-standard encoding with D:0x014F ****
0x004F (0x00009E) 0x5354- f:00051 d: 340 | A = A & B | **** non-standard encoding with D:0x0154 ****
0x0050 (0x0000A0) 0x5353- f:00051 d: 339 | A = A & B | **** non-standard encoding with D:0x0153 ****
0x0051 (0x0000A2) 0x4454- f:00042 d: 84 | C = 1, IOB = DN | **** non-standard encoding with D:0x0054 ****
0x0052 (0x0000A4) 0x5844- f:00054 d: 68 | B = A | **** non-standard encoding with D:0x0044 ****
0x0053 (0x0000A6) 0x4B00- f:00045 d: 256 | A = A < B | **** non-standard encoding with D:0x0100 ****
0x0054 (0x0000A8) 0x584D- f:00054 d: 77 | B = A | **** non-standard encoding with D:0x004D ****
0x0055 (0x0000AA) 0x5400- f:00052 d: 0 | A = A + B
0x0056 (0x0000AC) 0x5850- f:00054 d: 80 | B = A | **** non-standard encoding with D:0x0050 ****
0x0057 (0x0000AE) 0x5200- f:00051 d: 0 | A = A & B
0x0058 (0x0000B0) 0x5354- f:00051 d: 340 | A = A & B | **** non-standard encoding with D:0x0154 ****
0x0059 (0x0000B2) 0x4F50- f:00047 d: 336 | A = A << B | **** non-standard encoding with D:0x0150 ****
0x005A (0x0000B4) 0x3A20- f:00035 d: 32 | (OR[32]) = A + (OR[32])
0x005B (0x0000B6) 0x5445- f:00052 d: 69 | A = A + B | **** non-standard encoding with D:0x0045 ****
0x005C (0x0000B8) 0x5354- f:00051 d: 340 | A = A & B | **** non-standard encoding with D:0x0154 ****
0x005D (0x0000BA) 0x204E- f:00020 d: 78 | A = OR[78]
0x005E (0x0000BC) 0x4F54- f:00047 d: 340 | A = A << B | **** non-standard encoding with D:0x0154 ****
0x005F (0x0000BE) 0x2046- f:00020 d: 70 | A = OR[70]
0x0060 (0x0000C0) 0x4F55- f:00047 d: 341 | A = A << B | **** non-standard encoding with D:0x0155 ****
0x0061 (0x0000C2) 0x4E44- f:00047 d: 68 | A = A << B | **** non-standard encoding with D:0x0044 ****
0x0062 (0x0000C4) 0x0000- f:00000 d: 0 | PASS
0x0063 (0x0000C6) 0x0000- f:00000 d: 0 | PASS
0x0064 (0x0000C8) 0x0000- f:00000 d: 0 | PASS
0x0065 (0x0000CA) 0x0000- f:00000 d: 0 | PASS
0x0066 (0x0000CC) 0x0000- f:00000 d: 0 | PASS
0x0067 (0x0000CE) 0x0000- f:00000 d: 0 | PASS
|
disorderly/gcd_6bytes_2.adb | jscparker/math_packages | 30 | 23600 | <reponame>jscparker/math_packages
with Disorderly.Basic_Rand; use Disorderly.Basic_Rand;
with Disorderly.Basic_Rand.Clock_Entropy;
with Ada.Numerics.Discrete_Random;
with Chi_Gaussian_CDF;
with text_io; use text_io;
-- translated from Marsaglia, Tsang diehard suite.
procedure gcd_6bytes_2 is
Bits_per_Random_Word : constant := 48;
-- Must set this correctly here. There's no way to check this.
Stream_1 : Disorderly.Basic_Rand.State;
-- Create a stream of Random numbers.
-- Initializing this after the begin, w/ a call to Reset_with_Calendar
subtype gnat_Random_Int is Random_Int range 0 .. 2**Bits_per_Random_Word-1;
package rnd is new ada.numerics.Discrete_Random (gnat_Random_Int);
g : rnd.generator;
-- Call rnd.Reset (g); to initialize.
type Real is digits 15;
package Chi_Analysis is new Chi_Gaussian_CDF (Real); use Chi_Analysis;
type Unsigned_64 is mod 2**64;
type Statistical_Data is array (Unsigned_64 range <>) of Real;
-- Greatest Common Divisor Count test.
--
-- 1st test counts No of occurances of GCD's calculated for pairs of Rands:
Span_of_GCD_Count_Test : constant := 100;
subtype GCD_Count_Test_Range is Unsigned_64 range 1 .. Span_of_GCD_Count_Test;
subtype GCD_Counts is Statistical_Data (GCD_Count_Test_Range);
True_DOF_for_GCD_Count_Test : constant := Span_of_GCD_Count_Test - 1;
-- Greatest Common Divisor Iterations test.
--
-- 2nd test counts No of Iterations required to find GCD of a pair of Rands:
subtype GCD_Iterations_Test_Range is Unsigned_64 range 5..53;
subtype GCD_Iterations_Stats is Statistical_Data (GCD_Iterations_Test_Range);
True_DOF_for_Iterations_Test : constant := 48;
Probability_of_GCD_Iterations : constant GCD_Iterations_Stats :=
(
1.82133747963399E-09,
9.58898969998596E-09, 4.95900373562431E-08, 2.27481731154183E-07,
9.28626032480111E-07, 3.40040609676470E-06, 1.12699881420596E-05,
3.40712181596310E-05, 9.44518676549460E-05, 2.41209404024540E-04,
5.69742894566334E-04, 1.24896390954733E-03, 2.54813052386917E-03,
4.85060876606904E-03, 8.63352069814511E-03, 1.43949377324915E-02,
2.25197150861574E-02, 3.31014969046822E-02, 4.57718000608556E-02,
5.96024363457740E-02, 7.31521241333012E-02, 8.46879485357183E-02,
9.25374818484444E-02, 9.54841741832165E-02, 9.30779824121723E-02,
8.57414430641431E-02, 7.46531672639515E-02, 6.14429557739744E-02,
4.78042557873558E-02, 3.51559583569137E-02, 2.44342786072529E-02,
1.60456052696471E-02, 9.95230933086590E-03, 5.82790566428320E-03,
3.22011217073676E-03, 1.67784031979238E-03, 8.23785205774590E-04,
3.80796274659059E-04, 1.65557171340292E-04, 6.76216404052808E-05,
2.59157200839291E-05, 9.30882508186161E-06, 3.12834803067835E-06,
9.80931601705069E-07, 2.86878314503330E-07, 7.78360272500109E-08,
1.97336355105359E-08, 4.56083856575878E-09, 1.23887369078947E-09
);
-- distr based on 141 * 2^34 sample size
---------------------------------
-- Get_Chi_Statistic_and_P_val --
---------------------------------
procedure Get_Chi_Statistic_and_P_val
(Probability_Distribution : in Statistical_Data;
Observed_Count : in Statistical_Data;
True_Degrees_of_Freedom : in Positive;
Sample_Size : in Unsigned_64;
Chi_squared : out Real;
P_val, P_val_Variance : out Real)
is
Expected_Count, Sum : Real;
begin
Sum := 0.0;
for i in Probability_Distribution'Range loop
Expected_Count := Probability_Distribution(i) * Real (Sample_Size);
Sum := Sum + (Observed_Count(i) - Expected_Count)**2 / Expected_Count;
end loop;
Chi_squared := Sum;
P_val := Chi_Squared_CDF (Real (True_Degrees_of_Freedom), Chi_squared);
P_val_Variance := (P_val-0.5)**2;
end Get_Chi_Statistic_and_P_val;
------------------------------
-- Greatest_Common_Divisors --
------------------------------
-- translated from Marsaglia's diehard suite.
-- GCD Test, uses pairs of Rand's: u and v
-- where pairs = Sample_Size.
-- ***Requires uniform rands on 0..2**Bits_per_Random_Word-1.***
procedure Greatest_Common_Divisors
(Sample_Size : in Unsigned_64;
Count_of_GCD_Iterations : out GCD_Iterations_Stats) is
Observed_Count_of_GCDs : GCD_Counts;
s, e : Real;
p99, chi99,variance_p99 : Real;
ave_chi99, ave_p99, ave_variance_p99 : Real := 0.0;
p, chi, variance_p : Real;
ave_p, ave_chi, ave_variance_p : Real := 0.0;
k : Unsigned_64;
u, v, w : Unsigned_64;
u0, v0 : Random_Int;
No_of_Samples : constant Integer := 2**16;
begin
Observed_Count_of_GCDs := (others => 0.0);
Count_of_GCD_Iterations := (others => 0.0);
Outer: for j in 1..No_of_Samples loop
Observed_Count_of_GCDs := (others => 0.0);
Count_of_GCD_Iterations := (others => 0.0);
for i in Unsigned_64 range 1 .. Sample_Size loop
Get_Pair: loop
--Get_Random(u0, Stream_1);
--Get_Random(v0, Stream_1);
--u := Unsigned_64 (u0 mod 2**Bits_per_Random_Word);
--v := Unsigned_64 (v0 mod 2**Bits_per_Random_Word);
u := Unsigned_64 (rnd.Random (g));
v := Unsigned_64 (rnd.Random (g));
exit Get_Pair when (u > 0 and then v > 0);
end loop Get_Pair;
k := 0;
Euclid: loop
w := u mod v;
u := v;
v := w;
k := k + 1;
exit Euclid when v = 0;
end loop Euclid;
-- k is Observed number of Iterations to obtain greatest common divisor (GCD).
-- u is the greatest common divisor (GCD).
if k < Count_of_GCD_Iterations'First then
k := Count_of_GCD_Iterations'First;
end if;
if k > Count_of_GCD_Iterations'Last then
k := Count_of_GCD_Iterations'Last;
end if;
Count_of_GCD_Iterations(k) := Count_of_GCD_Iterations(k)+1.0;
if u > Observed_Count_of_GCDs'Last then
u := Observed_Count_of_GCDs'Last;
end if;
if u < Observed_Count_of_GCDs'First then
u := Observed_Count_of_GCDs'First;
end if;
Observed_Count_of_GCDs(u) := Observed_Count_of_GCDs(u) + 1.0;
end loop;
Get_Chi_Statistic_and_P_val
(Probability_Distribution => Probability_of_GCD_Iterations,
Observed_Count => Count_of_GCD_Iterations,
True_Degrees_of_Freedom => True_DOF_for_Iterations_Test,
Sample_Size => Sample_Size,
Chi_squared => chi,
P_val => p,
P_val_Variance => variance_p);
ave_chi := ave_chi + chi;
ave_p := ave_p + p;
ave_variance_p := ave_variance_p + variance_p;
-- on range 1..99 distribution seems to be: (0.607926 + 6.0e-8 * i) / i^2
-- theoretical value, with inf number of bits: 0.60792710 / i^2
--
-- e := Real (Sample_Size) * 0.6081842 / Real (i)**2;--asymptotically, i = 5410
p99 := 0.0;
variance_p99 := 0.0;
--e := Real (Sample_Size) * 0.61097691e-2; -- in theory, p >> 2**32
e := Real (Sample_Size) * 0.61097e-2; -- I get 0.61097e-2
chi99 := (Observed_Count_of_GCDs(GCD_Count_Test_Range'Last) - e)**2 / e;
for i in GCD_Count_Test_Range'First .. GCD_Count_Test_Range'Last-1 loop
e := Real (Sample_Size) * (0.607926 + 6.0E-8 * Real (i)) / Real (i)**2;
s := (Observed_Count_of_GCDs(i) - e)**2 / e;
chi99 := chi99 + s;
end loop;
p99 := Chi_Squared_CDF (Real(True_DOF_for_GCD_Count_Test), chi99);
variance_p99 := (p99-0.5)**2;
ave_chi99 := ave_chi99 + chi99;
ave_p99 := ave_p99 + p99;
ave_variance_p99 := ave_variance_p99 + variance_p99;
new_line(1);
put("Test"); put (Integer'Image(j));
put(". Chi^2 (48 dof), ave p-val, and ave normalized variance of GCD iterations:");
new_line;
put(" ");
put (Real'Image (chi));
put (Real'Image (ave_p / Real(j)));
put (Real'Image (ave_variance_p / (Real(j)*(0.25/3.0)))); -- should -> 1.0
new_line(1);
put(" Chi^2 (99 dof), ave p-val, and ave normalized variance of GCD's:");
new_line;
put(" ");
put (Real'Image (chi99));
put (Real'Image (ave_p99 / Real(j)));
put (Real'Image (ave_variance_p99 / (Real(j)*(0.25/3.0))));
end loop Outer;
end Greatest_Common_Divisors;
begin
rnd.Reset (g);
Disorderly.Basic_Rand.Clock_Entropy.Reset (Stream_1);
-- The state of the generator is Stream_1. (Starts up a random stream.)
test: declare
Sample_Size : constant Unsigned_64 := 2**40; -- turn way up to best see failure
-- 2**32 Sample_Size is OK, chi squared wise.
-- 2**37 Sample_Size is gd stnd tst. Tks a day at least (2+ for gnat etc)!
Full_Sample_Size : Real;
Sample_Iteration_Stats : GCD_Iterations_Stats;
Full_Iteration_Stats : GCD_Iterations_Stats := (others => 0.0);
begin
for i in 1..2**16 loop
Greatest_Common_Divisors (Sample_Size, Sample_Iteration_Stats);
Full_Sample_Size := Real(i)*Real(Sample_Size);
for k in Full_Iteration_Stats'Range loop
Full_Iteration_Stats(k) := Full_Iteration_Stats(k) + Sample_Iteration_Stats(k);
end loop;
new_line;
put (Integer'Image (i)); put ("Total Sample_Size:");
put (Real'Image (Real(i)*Real(Sample_Size)));
new_line;
for k in Full_Iteration_Stats'Range loop
if (Integer(k)-Integer(Full_Iteration_Stats'First)) mod 3 = 0 then
new_line;
end if;
put (Real'Image (Full_Iteration_Stats(k) / Full_Sample_Size)); put (",");
end loop;
new_line;
end loop;
end test;
end;
|
source/adam-raw_source.ads | charlie5/aIDE | 3 | 16055 | <filename>source/adam-raw_source.ads
with
AdaM.Entity,
Ada.Streams;
package AdaM.raw_source
is
type Item is new Entity.item with private;
type View is access all Item'Class;
-- Forge
--
function new_Source return raw_Source.view;
procedure free (Self : in out raw_Source.view);
procedure destruct (Self : in out Item);
-- Attributes
--
function Lines (Self : in Item) return text_Lines;
procedure Lines_are (Self : in out Item; Now : in text_Lines);
overriding
function Id (Self : access Item) return AdaM.Id;
overriding
function to_Source (Self : in Item) return text_Vectors.Vector;
overriding
function Name (Self : in Item) return Identifier;
private
type Item is new Entity.item with
record
Lines : text_Lines;
end record;
-- Streams
--
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View);
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View);
for View'write use View_write;
for View'read use View_read;
end AdaM.raw_source;
|
old/Structure/Logic/Classical/SetTheory/Structure/Relator.agda | Lolirofle/stuff-in-agda | 6 | 4449 |
module Structure where
-- Structures in meta-functions.
module Function' where -- TODO: Temporary naming fix with tick
module Properties ⦃ signature : Signature ⦄ where
Type : Domain → Domain → Function → Formula
Type(X)(Y)(f) = ∀ₛ(X)(x ↦ f(x) ∈ Y)
Closed : Domain → Function → Formula
Closed(S)(f) = Type(S)(S)(f)
Injective'' : Domain → Function → Formula
Injective''(A)(f) = ∀ₛ(A)(x ↦ ∀ₛ(A)(y ↦ (f(x) ≡ f(y)) ⟶ (x ≡ y)))
Surjective'' : Domain → Domain → Function → Formula
Surjective''(A)(B)(f) = ∀ₛ(B)(y ↦ ∃ₛ(A)(x ↦ f(x) ≡ y))
Bijective'' : Domain → Domain → Function → Formula
Bijective''(A)(B)(f) =
Injective''(A)(f)
∧ Surjective''(A)(B)(f)
Preserving₁'' : Domain → Function → Function → Function → Formula
Preserving₁''(A)(f)(g₁)(g₂) = ∀ₛ(A)(x ↦ f(g₁(x)) ≡ g₂(f(x)))
Preserving₂'' : Domain → Domain → Function → BinaryOperator → BinaryOperator → Formula
Preserving₂''(A)(B)(f)(_▫₁_)(_▫₂_) = ∀ₛ(A)(x ↦ ∀ₛ(B)(y ↦ f(x ▫₁ y) ≡ (f(x) ▫₂ f(y))))
module Relator where
module Properties where
Reflexivity : Domain → BinaryRelator → Formula
Reflexivity(S)(_▫_) = ∀ₛ(S)(x ↦ x ▫ x)
Irreflexivity : Domain → BinaryRelator → Formula
Irreflexivity(S)(_▫_) = ∀ₛ(S)(x ↦ ¬(x ▫ x))
Symmetry : Domain → BinaryRelator → Formula
Symmetry(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x ▫ y) ⟶ (y ▫ x)))
Asymmetry : Domain → BinaryRelator → Formula
Asymmetry(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x ▫ y) ⟶ ¬(y ▫ x)))
Antisymmetry : Domain → BinaryRelator → Formula
Antisymmetry(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x ▫ y)∧(y ▫ x) ⟶ (x ≡ y)))
Transitivity : Domain → BinaryRelator → Formula
Transitivity(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ ∀ₛ(S)(z ↦ (x ▫ y)∧(y ▫ z) ⟶ (x ▫ z))))
Equivalence : Domain → BinaryRelator → Formula
Equivalence(S)(_▫_) =
Reflexivity(S)(_▫_)
∧ Symmetry(S)(_▫_)
∧ Transitivity(S)(_▫_)
SymmetricallyTotal : Domain → BinaryRelator → Formula
SymmetricallyTotal(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x ▫ y) ∨ (y ▫ x)))
module Ordering where
open Relator.Properties
Minima : Domain → BinaryRelator → Domain → Formula
Minima(S)(_≤_)(min) = ∀ₛ(S)(x ↦ min ≤ x)
Maxima : Domain → BinaryRelator → Domain → Formula
Maxima(S)(_≤_)(max) = ∀ₛ(S)(x ↦ x ≤ max)
module _ ⦃ signature : Signature ⦄ where
open Signature ⦃ ... ⦄
lowerBounds : Domain → BinaryRelator → Domain → Domain
lowerBounds(S)(_≤_)(Sₛ) = filter(S)(Minima(S)(_≤_))
upperBounds : Domain → BinaryRelator → Domain → Domain
upperBounds(S)(_≤_)(Sₛ) = filter(S)(Maxima(S)(_≤_))
interval : Domain → BinaryRelator → Domain → Domain → Domain
interval(S)(_≤_) (a)(b) = filter(S)(s ↦ (a ≤ s) ∧ (s ≤ b))
Bounded : Domain → BinaryRelator → Domain → Domain → Formula
Bounded(S)(_≤_) (a)(b) = ∀ₛ(S)(s ↦ (a ≤ s) ∧ (s ≤ b))
Infima : Domain → BinaryRelator → Domain → Domain → Formula
Infima(S)(_≤_)(Sₛ)(inf) = Maxima(lowerBounds(S)(_≤_)(Sₛ))(_≤_)(inf)
Suprema : Domain → BinaryRelator → Domain → Domain → Formula
Suprema(S)(_≤_)(Sₛ)(sup) = Minima(upperBounds(S)(_≤_)(Sₛ))(_≤_)(sup)
module Weak where
PartialOrder : Domain → BinaryRelator → Formula
PartialOrder(S)(_≤_) =
Reflexivity(S)(_≤_)
∧ Antisymmetry(S)(_≤_)
∧ Transitivity(S)(_≤_)
TotalOrder : Domain → BinaryRelator → Formula
TotalOrder(S)(_≤_) =
PartialOrder(S)(_≤_)
∧ SymmetricallyTotal(S)(_≤_)
module Strict where
Order : Domain → BinaryRelator → Formula
Order(S)(_<_) =
Irreflexivity(S)(_<_)
∧ Asymmetry(S)(_<_)
∧ Transitivity(S)(_<_)
Dense : Domain → BinaryRelator → Formula
Dense(S)(_<_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x < y) ⟶ ∃ₛ(S)(z ↦ (x < z)∧(z < y))))
module Operator where
module Properties where
AssociativityPattern : Domain → Domain → Domain → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → Formula
AssociativityPattern(x)(y)(z)(_▫₁_)(_▫₂_)(_▫₃_)(_▫₄_) = (((x ▫₁ y) ▫₂ z) ≡ (x ▫₃ (y ▫₄ z)))
DistributivityₗPattern : Domain → Domain → Domain → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → Formula
DistributivityₗPattern(x)(y)(z)(_▫₁_)(_▫₂_)(_▫₃_)(_▫₄_)(_▫₅_) = (x ▫₁ (y ▫₂ z)) ≡ ((x ▫₃ y) ▫₄ (x ▫₅ z))
DistributivityᵣPattern : Domain → Domain → Domain → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → Formula
DistributivityᵣPattern(x)(y)(z)(_▫₁_)(_▫₂_)(_▫₃_)(_▫₄_)(_▫₅_) = ((x ▫₂ y) ▫₁ z) ≡ ((x ▫₃ z) ▫₄ (y ▫₅ z))
Type : BinaryOperator → Domain → Domain → Domain → Formula
Type(_▫_)(X)(Y)(Z) = ∀ₛ(X)(x ↦ ∀ₛ(Y)(y ↦ (x ▫ y) ∈ Z))
Closed : Domain → BinaryOperator → Formula
Closed(S)(_▫_) = Type(_▫_)(S)(S)(S)
Commutativity : Domain → BinaryOperator → Formula
Commutativity(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ (x ▫ y) ≡ (y ▫ x)))
Associativity : Domain → BinaryOperator → Formula
Associativity(S)(_▫_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ ∀ₛ(S)(z ↦ AssociativityPattern(x)(y)(z)(_▫_)(_▫_)(_▫_)(_▫_))))
Identityₗ : Domain → BinaryOperator → Domain → Formula
Identityₗ(S)(_▫_)(id) = ∀ₛ(S)(x ↦ (id ▫ x) ≡ x)
Identityᵣ : Domain → BinaryOperator → Domain → Formula
Identityᵣ(S)(_▫_)(id) = ∀ₛ(S)(x ↦ (x ▫ id) ≡ x)
Identity : Domain → BinaryOperator → Domain → Formula
Identity(S)(_▫_)(id) = Identityₗ(S)(_▫_)(id) ∧ Identityᵣ(S)(_▫_)(id)
Invertibleₗ : Domain → BinaryOperator → Domain → Formula
Invertibleₗ(S)(_▫_)(id) = ∀ₛ(S)(x ↦ ∃ₛ(S)(x⁻¹ ↦ (x⁻¹ ▫ x) ≡ id))
Invertibleᵣ : Domain → BinaryOperator → Domain → Formula
Invertibleᵣ(S)(_▫_)(id) = ∀ₛ(S)(x ↦ ∃ₛ(S)(x⁻¹ ↦ (x ▫ x⁻¹) ≡ id))
Invertible : Domain → BinaryOperator → Domain → Formula
Invertible(S)(_▫_)(id) = ∀ₛ(S)(x ↦ ∃ₛ(S)(x⁻¹ ↦ ((x⁻¹ ▫ x) ≡ id) ∧ ((x ▫ x⁻¹) ≡ id)))
Distributivityₗ : Domain → BinaryOperator → BinaryOperator → Formula
Distributivityₗ(S)(_▫₁_)(_▫₂_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ ∀ₛ(S)(z ↦ DistributivityₗPattern(x)(y)(z)(_▫₁_)(_▫₂_)(_▫₁_)(_▫₂_)(_▫₁_))))
Distributivityᵣ : Domain → BinaryOperator → BinaryOperator → Formula
Distributivityᵣ(S)(_▫₁_)(_▫₂_) = ∀ₛ(S)(x ↦ ∀ₛ(S)(y ↦ ∀ₛ(S)(z ↦ DistributivityᵣPattern(x)(y)(z)(_▫₁_)(_▫₂_)(_▫₁_)(_▫₂_)(_▫₁_))))
Distributivity : Domain → BinaryOperator → BinaryOperator → Formula
Distributivity(S)(_▫₁_)(_▫₂_) = Distributivityₗ(S)(_▫₁_)(_▫₂_) ∧ Distributivityᵣ(S)(_▫₁_)(_▫₂_)
Compatibility : Domain → Domain → BinaryOperator → BinaryOperator → Formula
Compatibility(A)(B)(_▫₁_)(_▫₂_) = ∀ₛ(A)(a₁ ↦ ∀ₛ(A)(a₂ ↦ ∀ₛ(B)(b ↦ AssociativityPattern(a₁)(a₂)(b)(_▫₁_)(_▫₁_)(_▫₂_)(_▫₁_))))
Semigroup : Domain → BinaryOperator → Formula
Semigroup(S)(_▫_) =
Closed(S)(_▫_)
∧ Associativity(S)(_▫_)
Monoid : Domain → BinaryOperator → Formula
Monoid(S)(_▫_) =
Semigroup(S)(_▫_)
∧ ∃ₛ(S)(Identity(S)(_▫_))
Group : Domain → BinaryOperator → Formula
Group(S)(_▫_) =
Monoid(S)(_▫_)
∧ ∀ₛ(S)(id ↦ Identity(S)(_▫_)(id) ⟶ Invertible(S)(_▫_)(id))
CommutativeGroup : Domain → BinaryOperator → Formula
CommutativeGroup(S)(_▫_) =
Group(S)(_▫_)
∧ Commutativity(S)(_▫_)
Rng : Domain → BinaryOperator → BinaryOperator → Formula
Rng(S)(_▫₁_)(_▫₂_) =
CommutativeGroup(S)(_▫₁_)
∧ Semigroup(S)(_▫₂_)
∧ Distributivity(S)(_▫₂_)(_▫₁_)
Ring : Domain → BinaryOperator → BinaryOperator → Formula
Ring(S)(_▫₁_)(_▫₂_) =
CommutativeGroup(S)(_▫₁_)
∧ Monoid(S)(_▫₂_)
∧ Distributivity(S)(_▫₂_)(_▫₁_)
module _ ⦃ signature : Signature ⦄ where
open Signature ⦃ ... ⦄
Field : Domain → BinaryOperator → BinaryOperator → Formula
Field(S)(_▫₁_)(_▫₂_) =
CommutativeGroup(S)(_▫₁_)
∧ ∀ₛ(S)(id₁ ↦ Identity(S)(_▫₁_)(id₁) ⟶ CommutativeGroup(S ∖ singleton(id₁))(_▫₂_))
∧ Distributivity(S)(_▫₂_)(_▫₁_)
VectorSpace : Domain → Domain → BinaryOperator → BinaryOperator → BinaryOperator → BinaryOperator → Formula
VectorSpace(V)(S)(_+ᵥ_)(_⋅ₛᵥ_)(_+ₛ_)(_⋅ₛ_) =
CommutativeGroup(V)(_+ᵥ_)
∧ Field(S)(_+ₛ_)(_⋅ₛ_)
∧ ∀ₛ(S)(id ↦ Identity(S)(_⋅ₛ_)(id) ⟶ Identityₗ(V)(_⋅ₛᵥ_)(id))
∧ Compatibility(S)(V)(_⋅ₛᵥ_)(_⋅ₛ_)
∧ ∀ₛ(S)(s ↦ ∀ₛ(V)(v₁ ↦ ∀ₛ(V)(v₂ ↦ DistributivityₗPattern(s)(v₁)(v₂)(_⋅ₛᵥ_)(_+ᵥ_)(_⋅ₛᵥ_)(_+ᵥ_)(_⋅ₛᵥ_))))
∧ ∀ₛ(S)(s₁ ↦ ∀ₛ(S)(s₂ ↦ ∀ₛ(V)(v ↦ DistributivityᵣPattern(s₁)(s₂)(v)(_⋅ₛᵥ_)(_+ᵥ_)(_⋅ₛᵥ_)(_+ᵥ_)(_⋅ₛᵥ_))))
module Numeral where
module Natural ⦃ signature : Signature ⦄ where
open Signature ⦃ ... ⦄
FormulaInduction : Domain → Domain → Function → (Domain → Formula) → Formula
FormulaInduction(ℕ)(𝟎)(𝐒) (φ) = (φ(𝟎) ∧ ∀ₛ(ℕ)(n ↦ φ(n) ⟶ φ(𝐒(n)))) ⟶ ∀ₛ(ℕ)(φ)
SetInduction : Domain → Domain → Function → Formula
SetInduction(ℕ)(𝟎)(𝐒) = ∀ₗ(X ↦ ((𝟎 ∈ X) ∧ ∀ₛ(ℕ)(n ↦ (n ∈ X) ⟶ (𝐒(n) ∈ X))) ⟶ (ℕ ⊆ X))
-- TODO: Can be expressed as ∀ₗ(X ↦ Inductive(X) ⟶ (ℕ ⊆ X))
-- A set ℕ which can be constructed ℕ-inductively.
Peano : Domain → Domain → Function → Formula
Peano(ℕ)(𝟎)(𝐒) =
(𝟎 ∈ ℕ)
∧ Function'.Properties.Closed(ℕ)(𝐒)
∧ Function'.Properties.Injective''(ℕ)(𝐒)
∧ ∀ₛ(ℕ)(n ↦ 𝐒(n) ≢ 𝟎)
∧ SetInduction(ℕ)(𝟎)(𝐒)
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48_notsx.log_21829_768.asm | ljhsiun2/medusa | 9 | 247865 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %r8
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x1ad3a, %rax
nop
nop
nop
nop
xor $2891, %r8
mov $0x6162636465666768, %r14
movq %r14, %xmm0
vmovups %ymm0, (%rax)
nop
nop
nop
nop
dec %r11
lea addresses_D_ht+0x893a, %rcx
nop
nop
nop
nop
nop
cmp %r8, %r8
movl $0x61626364, (%rcx)
nop
nop
nop
nop
nop
add %rax, %rax
lea addresses_WT_ht+0x152, %r8
nop
nop
and %r13, %r13
mov (%r8), %r14d
nop
nop
dec %rcx
lea addresses_A_ht+0x1393a, %r14
nop
nop
nop
nop
dec %rax
mov (%r14), %r13
nop
add %rax, %rax
lea addresses_UC_ht+0xf63a, %r14
nop
cmp $13307, %r13
vmovups (%r14), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %r11
nop
nop
cmp %rcx, %rcx
lea addresses_UC_ht+0x1ab7a, %r13
nop
nop
dec %rdx
mov $0x6162636465666768, %r8
movq %r8, (%r13)
nop
inc %r8
lea addresses_WC_ht+0xdcba, %r13
nop
xor %rdx, %rdx
movb (%r13), %r8b
add $12696, %rax
lea addresses_WC_ht+0xc75e, %rcx
nop
nop
sub $49467, %r14
movb (%rcx), %r13b
nop
nop
nop
nop
cmp $62069, %r13
lea addresses_WC_ht+0x180ca, %r13
nop
nop
xor $560, %r11
and $0xffffffffffffffc0, %r13
movaps (%r13), %xmm5
vpextrq $0, %xmm5, %rcx
nop
nop
nop
nop
add %r13, %r13
lea addresses_WT_ht+0x1693a, %rsi
lea addresses_normal_ht+0x1673a, %rdi
nop
nop
nop
nop
nop
dec %r13
mov $37, %rcx
rep movsl
nop
nop
nop
inc %rcx
lea addresses_WC_ht+0x1dd3a, %rsi
lea addresses_D_ht+0x1d73a, %rdi
nop
nop
nop
and %rax, %rax
mov $63, %rcx
rep movsq
nop
nop
nop
add $18845, %r11
lea addresses_A_ht+0xbb7a, %rsi
lea addresses_D_ht+0x139a, %rdi
nop
cmp %r13, %r13
mov $118, %rcx
rep movsq
nop
nop
nop
add %rdx, %rdx
lea addresses_A_ht+0x13d0a, %r14
nop
nop
nop
add %rsi, %rsi
mov (%r14), %eax
nop
nop
nop
cmp $3025, %rax
lea addresses_D_ht+0xdf3a, %r14
nop
nop
nop
nop
nop
sub $10348, %rsi
movb $0x61, (%r14)
nop
nop
nop
nop
sub $61685, %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r15
push %r8
push %rdx
push %rsi
// Load
lea addresses_US+0xba92, %r8
nop
nop
cmp $40773, %rdx
vmovups (%r8), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %r13
nop
nop
add %r15, %r15
// Store
lea addresses_UC+0xddec, %r12
nop
inc %r10
mov $0x5152535455565758, %r8
movq %r8, %xmm3
movups %xmm3, (%r12)
nop
nop
nop
sub %r8, %r8
// Store
lea addresses_D+0x1f5fa, %r12
nop
nop
nop
nop
add $59407, %rsi
mov $0x5152535455565758, %r10
movq %r10, %xmm0
vmovups %ymm0, (%r12)
nop
nop
nop
add %r13, %r13
// Faulty Load
mov $0x426082000000013a, %r8
nop
nop
xor $11620, %r15
mov (%r8), %r10d
lea oracles, %r15
and $0xff, %r10
shlq $12, %r10
mov (%r15,%r10,1), %r10
pop %rsi
pop %rdx
pop %r8
pop %r15
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_NC', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_US', 'congruent': 2}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC', 'congruent': 1}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D', 'congruent': 6}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_NC', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 10}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT_ht', 'congruent': 3}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 8}}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_UC_ht', 'congruent': 5}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 1, 'type': 'addresses_WC_ht', 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC_ht', 'congruent': 2}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_WC_ht', 'congruent': 4}}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 2}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 8}, 'OP': 'STOR'}
{'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
*/
|
non_regression/other_x64_linux_13.o.asm | LRGH/plasmasm | 1 | 14098 | .file "b0.c"
.section .text.startup,"ax",@progbits
.globl main
.type main, @function
main:
rep; ret
.size main, .-main
# ----------------------
.text
.globl I
.type I, @function
I:
jmp .LTHUNK7
.size I, .-I
# ----------------------
.L00000002:
.p2align 4
# ----------------------
.globl H
.type H, @function
H:
jmp .LTHUNK8
.size H, .-H
# ----------------------
.set .LTHUNK7,I
.set .LTHUNK8,H
.ident "GCC: (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4"
.section .note.GNU-stack,"",@progbits
|
oeis/328/A328353.asm | neoneye/loda-programs | 11 | 19442 | <reponame>neoneye/loda-programs<filename>oeis/328/A328353.asm
; A328353: a(n)*S is the sum of all positive integers whose decimal expansion is up to n digits and uses six distinct nonzero digits d1,d2,d3,d4,d5,d6 such that d1+d2+d3+d4+d5+d6=S.
; 0,1,67,4063,244039,14643895,878643031,52718637847,3163118606743,189787118420119,11387227117300375,683233627110581911,40994017627070271127,2459641057626828406423,147578463457625377218199,8854707807457616670088855,531282468447457564427312791,31876948106847457250970656407,1912616886410847455370230718103,114757013184650847444085791088279,6885420791079050847376379153309335,413125247464743050846970139326635671,24787514847884583050844532700366593687,1487250890873074983050829908066606341783
lpb $0
mov $2,$0
sub $0,1
seq $2,86578 ; a(n) = 7*(10^n - 1).
add $3,$2
mul $3,6
lpe
mov $0,$3
div $0,378
|
apps/hbios/hbios.asm | vipoo/RomWBW-Env | 1 | 9969 | <reponame>vipoo/RomWBW-Env<filename>apps/hbios/hbios.asm
;===============================================================================
; Util to invoke a HBIOS function
; Usage B C ....
;
stksiz .equ $200 ; Working stack size
restart .equ $0000 ; CP/M restart vector
bdos .equ $0005 ; BDOS invocation vector
#DEFINE PRTS(S) CALL prtstrd \ .TEXT S
;===============================================================================
; Entry
;===============================================================================
.org $100
; setup stack
LD (stksav), sp ; save stack
LD sp, stack ; set new stack
PRTS( "HBIOS Test Utility v0.3\r\n$")
CALL parse ; parse command line
LD iy, bcValue
LD B, 'B'
LD C, 'C'
CALL prtregs
LD iy, deValue
LD B, 'D'
LD C, 'E'
CALL prtregs
LD iy, hlValue
LD B, 'H'
LD C, 'L'
CALL prtregs
CALL invokehbios
PRTS( "Ret AF: 0x$")
LD IY, afResult
CALL prtreg
PRTS( "\r\nRet BC: 0x$")
LD IY, bcResult
CALL prtreg
PRTS( "\r\nRet DE: 0x$")
LD IY, deResult
CALL prtreg
PRTS( "\r\nRet HL: 0x$")
LD IY, hlResult
CALL prtreg
PRTS( "\r\nRet DE:HL: 0x$")
LD IY, deResult
CALL prtreg
LD IY, hlResult
CALL prtreg
PRTS( "\r\nReturned registers\r\n$")
exit:
CALL crlf ; formatting
LD sp, (stksav) ; restore stack
RET ; return to CP/M
prtregs: ; iy is location of data to print
LD a, b
call prtchr
PRTS( ": 0x$")
LD a, (iy+1) ; b is chr of 1st register
call prthex
CALL crlf
LD a, c
call prtchr
PRTS( ": 0x$")
LD a, (iy) ; b is chr of 1st register
call prthex
call crlf
RET
;===============================================================================
prtreg: ; print 16 bit value at IY
LD E, (IY)
LD d, (IY + 1)
LD a, d
CALL prthex
LD a, e
JP prthex
invokehbios:
LD bc, (bcValue)
LD de, (deValue)
LD hl, (hlValue)
RST 08
LD (bcResult), bc
LD (deResult), de
LD (hlResult), hl
PUSH AF
POP BC
LD (afResult), BC
RET
;===============================================================================
; convert char in A to a number from 0-15 based on it HEX string value
fromchar: ; value is returned in B
SUB '0' ;
CP 10 ; greater than 9
JR c, numchar
SUB 'A' - '0'
CP 7 ; greater than F
JP nc, errprm
ADD a, 10
numchar:
LD b, a
RET
;===============================================================================
readhexbyte: ; Read 2 chars - and convert to a byte - returned in A
LD a, (hl)
OR a
JP z, errprm
CALL fromchar
LD a, b
RLCA
RLCA
RLCA
RLCA
LD c, a
INC hl
LD a, (hl)
OR a
JP z, errprm
CALL fromchar
LD a, b
INC hl
OR c
LD c, a
RET
;===============================================================================
; Parse command line
; if parse error, writes error string and then jp to exit
parse:
LD hl, $81 ; point to start of command tail (after length byte)
LD IY, bcValue
CALL parsehexbyte
LD a, (hl) ; if no more args
OR a
RET z
LD IY, deValue ; D and E values
CALL parsehexbyte
LD a, (hl) ; if no more args
OR a
RET z
LD IY, hlValue ; H and L values
CALL parsehexbyte
RET
parsehexbyte:
CALL nonblank ; skip blanks
CALL readhexbyte ; read value for register B
LD a, c
LD (IY + 1), a
CALL nonblank ; skip blanks
CALL readhexbyte ; read value for register C
LD a, c
LD (IY), a
RET
;===============================================================================
; Print character in A without destroying any registers
prtchr:
PUSH bc ; save registers
PUSH de
PUSH hl
LD e, a ; character to print in E
LD c, $02 ; BDOS function to output a character
CALL bdos ; do it
POP hl ; restore registers
POP de
POP bc
RET
;===============================================================================
; Print a $ terminated string at (HL) without destroying any registers
prtstrz:
LD a, (hl) ; get next char
INC hl
CP '$'
RET z
CALL prtchr
JR prtstrz
;===============================================================================
; Print the value in A in hex without destroying any registers
prthex:
PUSH af ; save AF
PUSH de ; save DE
CALL hexascii ; convert value in A to hex chars in DE
LD a, d ; get the high order hex char
CALL prtchr ; print it
LD a, e ; get the low order hex char
CALL prtchr ; print it
POP de ; restore DE
POP af ; restore AF
RET ; done
;===============================================================================
; Convert binary value in A to ascii hex characters in DE
hexascii:
LD d, a ; save A in D
CALL hexconv ; convert low nibble of A to hex
LD e, a ; save it in E
LD a, d ; get original value back
RLCA ; rotate high order nibble to low bits
RLCA
RLCA
RLCA
CALL hexconv ; convert nibble
LD d, a ; save it in D
RET ; done
;===============================================================================
; Convert low nibble of A to ascii hex
hexconv:
AND $0F ; low nibble only
ADD a, $90
DAA
ADC a, $40
DAA
RET
;===============================================================================
; Start a new line
crlf:
LD a, 13 ; <CR>
CALL prtchr ; print it
LD a, 10 ; <LF>
JR prtchr ; print it
;===============================================================================
; Get the next non-blank character from (HL).
nonblank:
LD a, (hl) ; load next character
OR a
JP z, erruse
cp ' ' ; string ends with a null
JR nz, errprm ; if no blank found as expected, return error to user
skipblank:
INC hl ; if blank, increment character pointer
LD a, (hl) ; load next character
OR a ; string ends with a null
RET z ; if null, return pointing to null
CP ' ' ; check for blank
RET nz ; return if not blank
JR skipblank ; and loop
;===============================================================================
; Errors
erruse: ; command usage error (syntax)
LD hl, msguse
JR err
errprm: ; command parameter error (syntax)
LD hl, msgprm
err: ; print error string and return error signal
CALL crlf ; print newline
CALL prtstrz ; print error string
JP exit
;===============================================================================
; PRINT A STRING DIRECT: REFERENCED BY POINTER AT TOP OF STACK
; STRING MUST BE TERMINATED BY '$'
; USAGE:
; CALL PRTSTR
; .DB "HELLO$"
prtstrd:
EX (SP), HL
CALL prtstrz
EX (SP), HL
RET
;===============================================================================
; Storage Section
;===============================================================================
stksav .dw 0 ; stack pointer saved at start
.fill stksiz, 0 ; stack
stack .equ $ ; stack top
;===============================================================================
; Messages
msguse .db "Usage: HBIOS BB CC [DD EE] [HH LL]$"
msgprm .db "Parameter error$"
;===============================================================================
; Register values to supply to hbios
bcValue .dw 0
deValue .dw 0
hlValue .dw 0
;===============================================================================
; Captured register returned by hbios call
afResult .dw 0
bcResult .dw 0
deResult .dw 0
hlResult .dw 0
.end |
programs/oeis/033/A033116.asm | neoneye/loda | 22 | 8959 | ; A033116: Base-6 digits are, in order, the first n terms of the periodic sequence with initial period 1,0.
; 1,6,37,222,1333,7998,47989,287934,1727605,10365630,62193781,373162686,2238976117,13433856702,80603140213,483618841278,2901713047669,17410278286014,104461669716085,626770018296510,3760620109779061,22563720658674366,135382323952046197,812293943712277182,4873763662273663093,29242581973641978558,175455491841851871349,1052732951051111228094,6316397706306667368565,37898386237840004211390,227390317427040025268341,1364341904562240151610046,8186051427373440909660277,49116308564240645457961662,294697851385443872747769973,1768187108312663236486619838,10609122649875979418919719029,63654735899255876513518314174,381928415395535259081109885045,2291570492373211554486659310270,13749422954239269326919955861621,82496537725435615961519735169726,494979226352613695769118411018357,2969875358115682174614710466110142,17819252148694093047688262796660853,106915512892164558286129576779965118,641493077352987349716777460679790709
add $0,2
mov $1,6
pow $1,$0
div $1,7
sub $1,5
div $1,5
add $1,1
mov $0,$1
|
alloy4fun_models/trashltl/models/19/XS52JDeBZCebX9EN6.als | Kaixi26/org.alloytools.alloy | 0 | 4659 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idXS52JDeBZCebX9EN6_prop20 {
always all t: Trash | t not in Protected since t in Protected
}
pred __repair { idXS52JDeBZCebX9EN6_prop20 }
check __repair { idXS52JDeBZCebX9EN6_prop20 <=> prop20o } |
programs/oeis/233/A233036.asm | neoneye/loda | 22 | 101387 | <reponame>neoneye/loda
; A233036: The maximum number of I-tetrominoes that can be packed into an n X n array of squares when rotation is allowed.
; 0,0,0,4,6,8,12,16,20,24,30,36,42,48,56,64,72,80,90,100,110,120,132,144,156,168,182,196,210,224,240,256,272,288,306,324,342,360,380,400,420,440,462,484,506,528,552,576,600,624,650,676,702,728,756,784,812,840,870,900,930,960,992,1024,1056
add $0,1
pow $0,2
div $0,4
mov $2,2
lpb $0
div $0,$2
mov $1,$0
mov $0,2
lpe
mul $1,2
mov $0,$1
|
libsrc/_DEVELOPMENT/stdlib/c/sccz80/ftog.asm | meesokim/z88dk | 0 | 170119 | <filename>libsrc/_DEVELOPMENT/stdlib/c/sccz80/ftog.asm
; size_t ftog(float x, char *buf, uint16_t prec, uint16_t flag)
SECTION code_stdlib
PUBLIC ftog
EXTERN dtog
defc ftog = dtog
|
ada/src/cameras.adb | alkalinin/raytracer | 45 | 27664 | <reponame>alkalinin/raytracer
--
-- Raytracer implementation in Ada
-- by <NAME> (github: johnperry-math)
-- 2021
--
-- implementation for Cameras, that view the scene
--
-- local packages
with RayTracing_Constants; use RayTracing_Constants;
package body Cameras is
function Create_Camera(Position, Target: Vector) return Camera_Type is
Result: Camera_Type;
Down: Vector := Create_Vector(0.0, -1.0, 0.0);
Forward: Vector := Target - Position;
-- computed later
Right_Norm, Up_Norm: Vector;
begin
Result.Position := Position;
Result.Forward := Normal(Forward);
Result.Right := Cross_Product(Result.Forward, Down);
Result.Up := Cross_Product(Result.Forward, Result.Right);
Right_Norm := Normal(Result.Right);
Up_Norm := Normal(Result.Up);
Result.Right := Right_Norm * 1.5;
Result.Up := Up_Norm * 1.5;
return Result;
end Create_Camera;
end Cameras;
|
programs/oeis/028/A028566.asm | karttu/loda | 1 | 166021 | ; A028566: a(n) = n*(n+8).
; 0,9,20,33,48,65,84,105,128,153,180,209,240,273,308,345,384,425,468,513,560,609,660,713,768,825,884,945,1008,1073,1140,1209,1280,1353,1428,1505,1584,1665,1748,1833,1920,2009,2100,2193,2288,2385,2484,2585,2688,2793,2900,3009,3120,3233,3348,3465,3584,3705,3828,3953,4080,4209,4340,4473,4608,4745,4884,5025,5168,5313,5460,5609,5760,5913,6068,6225,6384,6545,6708,6873,7040,7209,7380,7553,7728,7905,8084,8265,8448,8633,8820,9009,9200,9393,9588,9785,9984,10185,10388,10593,10800,11009,11220,11433,11648,11865,12084,12305,12528,12753,12980,13209,13440,13673,13908,14145,14384,14625,14868,15113,15360,15609,15860,16113,16368,16625,16884,17145,17408,17673,17940,18209,18480,18753,19028,19305,19584,19865,20148,20433,20720,21009,21300,21593,21888,22185,22484,22785,23088,23393,23700,24009,24320,24633,24948,25265,25584,25905,26228,26553,26880,27209,27540,27873,28208,28545,28884,29225,29568,29913,30260,30609,30960,31313,31668,32025,32384,32745,33108,33473,33840,34209,34580,34953,35328,35705,36084,36465,36848,37233,37620,38009,38400,38793,39188,39585,39984,40385,40788,41193,41600,42009,42420,42833,43248,43665,44084,44505,44928,45353,45780,46209,46640,47073,47508,47945,48384,48825,49268,49713,50160,50609,51060,51513,51968,52425,52884,53345,53808,54273,54740,55209,55680,56153,56628,57105,57584,58065,58548,59033,59520,60009,60500,60993,61488,61985,62484,62985,63488,63993
mov $1,$0
add $1,8
mul $1,$0
|
Task/Averages-Mean-angle/Ada/averages-mean-angle.ada | LaudateCorpus1/RosettaCodeData | 1 | 722 | with Ada.Text_IO, Ada.Numerics.Generic_Elementary_Functions;
procedure Mean_Angles is
type X_Real is digits 4; -- or more digits for improved precision
subtype Real is X_Real range 0.0 .. 360.0; -- the range of interest
type Angles is array(Positive range <>) of Real;
procedure Put(R: Real) is
package IO is new Ada.Text_IO.Float_IO(Real);
begin
IO.Put(R, Fore => 3, Aft => 2, Exp => 0);
end Put;
function Mean_Angle(A: Angles) return Real is
Sin_Sum, Cos_Sum: X_Real := 0.0; -- X_Real since sums might exceed 360.0
package Math is new Ada.Numerics.Generic_Elementary_Functions(Real);
use Math;
begin
for I in A'Range loop
Sin_Sum := Sin_Sum + Sin(A(I), Cycle => 360.0);
Cos_Sum := Cos_Sum + Cos(A(I), Cycle => 360.0);
end loop;
return Arctan(Sin_Sum / X_Real(A'Length), Cos_Sum / X_Real(A'Length),
Cycle => 360.0);
-- may raise Ada.Numerics.Argument_Error if inputs are
-- numerically instable, e.g., when Cos_Sum is 0.0
end Mean_Angle;
begin
Put(Mean_Angle((10.0, 20.0, 30.0))); Ada.Text_IO.New_Line; -- 20.00
Put(Mean_Angle((10.0, 350.0))); Ada.Text_IO.New_Line; -- 0.00
Put(Mean_Angle((90.0, 180.0, 270.0, 360.0))); -- Ada.Numerics.Argument_Error!
end Mean_Angles;
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/exp_dbug.adb | djamal2727/Main-Bearing-Analytical-Model | 0 | 22120 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ D B U G --
-- --
-- B o d y --
-- --
-- Copyright (C) 1996-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Alloc;
with Atree; use Atree;
with Debug; use Debug;
with Einfo; use Einfo;
with Exp_Util; use Exp_Util;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
with Output; use Output;
with Sem_Aux; use Sem_Aux;
with Sem_Eval; use Sem_Eval;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Stand; use Stand;
with Stringt; use Stringt;
with Table;
with Tbuild; use Tbuild;
with Urealp; use Urealp;
package body Exp_Dbug is
-- The following table is used to queue up the entities passed as
-- arguments to Qualify_Entity_Names for later processing when
-- Qualify_All_Entity_Names is called.
package Name_Qualify_Units is new Table.Table (
Table_Component_Type => Node_Id,
Table_Index_Type => Nat,
Table_Low_Bound => 1,
Table_Initial => Alloc.Name_Qualify_Units_Initial,
Table_Increment => Alloc.Name_Qualify_Units_Increment,
Table_Name => "Name_Qualify_Units");
--------------------------------
-- Use of Qualification Flags --
--------------------------------
-- There are two flags used to keep track of qualification of entities
-- Has_Fully_Qualified_Name
-- Has_Qualified_Name
-- The difference between these is as follows. Has_Qualified_Name is
-- set to indicate that the name has been qualified as required by the
-- spec of this package. As described there, this may involve the full
-- qualification for the name, but for some entities, notably procedure
-- local variables, this full qualification is not required.
-- The flag Has_Fully_Qualified_Name is set if indeed the name has been
-- fully qualified in the Ada sense. If Has_Fully_Qualified_Name is set,
-- then Has_Qualified_Name is also set, but the other way round is not
-- the case.
-- Consider the following example:
-- with ...
-- procedure X is
-- B : Ddd.Ttt;
-- procedure Y is ..
-- Here B is a procedure local variable, so it does not need fully
-- qualification. The flag Has_Qualified_Name will be set on the
-- first attempt to qualify B, to indicate that the job is done
-- and need not be redone.
-- But Y is qualified as x__y, since procedures are always fully
-- qualified, so the first time that an attempt is made to qualify
-- the name y, it will be replaced by x__y, and both flags are set.
-- Why the two flags? Well there are cases where we derive type names
-- from object names. As noted in the spec, type names are always
-- fully qualified. Suppose for example that the backend has to build
-- a padded type for variable B. then it will construct the PAD name
-- from B, but it requires full qualification, so the fully qualified
-- type name will be x__b___PAD. The two flags allow the circuit for
-- building this name to realize efficiently that b needs further
-- qualification.
--------------------
-- Homonym_Suffix --
--------------------
-- The string defined here (and its associated length) is used to gather
-- the homonym string that will be appended to Name_Buffer when the name
-- is complete. Strip_Suffixes appends to this string as does
-- Append_Homonym_Number, and Output_Homonym_Numbers_Suffix appends the
-- string to the end of Name_Buffer.
Homonym_Numbers : String (1 .. 256);
Homonym_Len : Natural := 0;
----------------------
-- Local Procedures --
----------------------
procedure Add_Uint_To_Buffer (U : Uint);
-- Add image of universal integer to Name_Buffer, updating Name_Len
procedure Add_Real_To_Buffer (U : Ureal);
-- Add nnn_ddd to Name_Buffer, where nnn and ddd are integer values of
-- the normalized numerator and denominator of the given real value.
procedure Append_Homonym_Number (E : Entity_Id);
-- If the entity E has homonyms in the same scope, then make an entry
-- in the Homonym_Numbers array, bumping Homonym_Count accordingly.
function Bounds_Match_Size (E : Entity_Id) return Boolean;
-- Determine whether the bounds of E match the size of the type. This is
-- used to determine whether encoding is required for a discrete type.
function Is_Handled_Scale_Factor (U : Ureal) return Boolean;
-- The argument U is the Small_Value of a fixed-point type. This function
-- determines whether the back-end can handle this scale factor. When it
-- cannot, we have to output a GNAT encoding for the corresponding type.
procedure Output_Homonym_Numbers_Suffix;
-- If homonym numbers are stored, then output them into Name_Buffer
procedure Prepend_String_To_Buffer (S : String);
-- Prepend given string to the contents of the string buffer, updating
-- the value in Name_Len (i.e. string is added at start of buffer).
procedure Prepend_Uint_To_Buffer (U : Uint);
-- Prepend image of universal integer to Name_Buffer, updating Name_Len
procedure Qualify_Entity_Name (Ent : Entity_Id);
-- If not already done, replaces the Chars field of the given entity
-- with the appropriate fully qualified name.
procedure Reset_Buffers;
-- Reset the contents of Name_Buffer and Homonym_Numbers by setting their
-- respective lengths to zero.
procedure Strip_Suffixes (BNPE_Suffix_Found : in out Boolean);
-- Given an qualified entity name in Name_Buffer, remove any plain X or
-- X{nb} qualification suffix. The contents of Name_Buffer is not changed
-- but Name_Len may be adjusted on return to remove the suffix. If a
-- BNPE suffix is found and stripped, then BNPE_Suffix_Found is set to
-- True. If no suffix is found, then BNPE_Suffix_Found is not modified.
-- This routine also searches for a homonym suffix, and if one is found
-- it is also stripped, and the entries are added to the global homonym
-- list (Homonym_Numbers) so that they can later be put back.
------------------------
-- Add_Real_To_Buffer --
------------------------
procedure Add_Real_To_Buffer (U : Ureal) is
begin
Add_Uint_To_Buffer (Norm_Num (U));
Add_Str_To_Name_Buffer ("_");
Add_Uint_To_Buffer (Norm_Den (U));
end Add_Real_To_Buffer;
------------------------
-- Add_Uint_To_Buffer --
------------------------
procedure Add_Uint_To_Buffer (U : Uint) is
begin
if U < 0 then
Add_Uint_To_Buffer (-U);
Add_Char_To_Name_Buffer ('m');
else
UI_Image (U, Decimal);
Add_Str_To_Name_Buffer (UI_Image_Buffer (1 .. UI_Image_Length));
end if;
end Add_Uint_To_Buffer;
---------------------------
-- Append_Homonym_Number --
---------------------------
procedure Append_Homonym_Number (E : Entity_Id) is
procedure Add_Nat_To_H (Nr : Nat);
-- Little procedure to append Nr to Homonym_Numbers
------------------
-- Add_Nat_To_H --
------------------
procedure Add_Nat_To_H (Nr : Nat) is
begin
if Nr >= 10 then
Add_Nat_To_H (Nr / 10);
end if;
Homonym_Len := Homonym_Len + 1;
Homonym_Numbers (Homonym_Len) :=
Character'Val (Nr mod 10 + Character'Pos ('0'));
end Add_Nat_To_H;
-- Start of processing for Append_Homonym_Number
begin
if Has_Homonym (E) then
if Homonym_Len > 0 then
Homonym_Len := Homonym_Len + 1;
Homonym_Numbers (Homonym_Len) := '_';
end if;
Add_Nat_To_H (Homonym_Number (E));
end if;
end Append_Homonym_Number;
-----------------------
-- Bounds_Match_Size --
-----------------------
function Bounds_Match_Size (E : Entity_Id) return Boolean is
Siz : Uint;
begin
if not Is_OK_Static_Subtype (E) then
return False;
elsif Is_Integer_Type (E)
and then Subtypes_Statically_Match (E, Base_Type (E))
then
return True;
-- Here we check if the static bounds match the natural size, which is
-- the size passed through with the debugging information. This is the
-- Esize rounded up to 8, 16, 32 or 64 as appropriate.
else
declare
Umark : constant Uintp.Save_Mark := Uintp.Mark;
Result : Boolean;
begin
if Esize (E) <= 8 then
Siz := Uint_8;
elsif Esize (E) <= 16 then
Siz := Uint_16;
elsif Esize (E) <= 32 then
Siz := Uint_32;
else
Siz := Uint_64;
end if;
if Is_Modular_Integer_Type (E) or else Is_Enumeration_Type (E) then
Result :=
Expr_Rep_Value (Type_Low_Bound (E)) = 0
and then
2 ** Siz - Expr_Rep_Value (Type_High_Bound (E)) = 1;
else
Result :=
Expr_Rep_Value (Type_Low_Bound (E)) + 2 ** (Siz - 1) = 0
and then
2 ** (Siz - 1) - Expr_Rep_Value (Type_High_Bound (E)) = 1;
end if;
Release (Umark);
return Result;
end;
end if;
end Bounds_Match_Size;
--------------------------------
-- Debug_Renaming_Declaration --
--------------------------------
function Debug_Renaming_Declaration (N : Node_Id) return Node_Id is
Loc : constant Source_Ptr := Sloc (N);
Ent : constant Node_Id := Defining_Entity (N);
Nam : constant Node_Id := Name (N);
Ren : Node_Id;
Typ : Entity_Id;
Obj : Entity_Id;
Res : Node_Id;
Enable : Boolean := Nkind (N) = N_Package_Renaming_Declaration;
-- By default, we do not generate an encoding for renaming. This is
-- however done (in which case this is set to True) in a few cases:
-- - when a package is renamed,
-- - when the renaming involves a packed array,
-- - when the renaming involves a packed record.
Last_Is_Indexed_Comp : Boolean := False;
-- Whether the last subscript value was an indexed component access (XS)
procedure Enable_If_Packed_Array (N : Node_Id);
-- Enable encoding generation if N is a packed array
function Output_Subscript (N : Node_Id; S : String) return Boolean;
-- Outputs a single subscript value as ?nnn (subscript is compile time
-- known value with value nnn) or as ?e (subscript is local constant
-- with name e), where S supplies the proper string to use for ?.
-- Returns False if the subscript is not of an appropriate type to
-- output in one of these two forms. The result is prepended to the
-- name stored in Name_Buffer.
function Scope_Contains (Sc : Node_Id; Ent : Entity_Id) return Boolean;
-- Return whether Ent belong to the Sc scope
----------------------------
-- Enable_If_Packed_Array --
----------------------------
procedure Enable_If_Packed_Array (N : Node_Id) is
T : constant Entity_Id := Underlying_Type (Etype (N));
begin
Enable :=
Enable
or else
(Ekind (T) in Array_Kind
and then Present (Packed_Array_Impl_Type (T)));
end Enable_If_Packed_Array;
----------------------
-- Output_Subscript --
----------------------
function Output_Subscript (N : Node_Id; S : String) return Boolean is
begin
if Compile_Time_Known_Value (N) then
Prepend_Uint_To_Buffer (Expr_Value (N));
elsif Nkind (N) = N_Identifier
and then Scope_Contains (Scope (Entity (N)), Ent)
and then (Ekind (Entity (N)) = E_Constant
or else Ekind (Entity (N)) = E_In_Parameter)
then
Prepend_String_To_Buffer (Get_Name_String (Chars (Entity (N))));
else
return False;
end if;
Prepend_String_To_Buffer (S);
return True;
end Output_Subscript;
--------------------
-- Scope_Contains --
--------------------
function Scope_Contains (Sc : Node_Id; Ent : Entity_Id) return Boolean is
Cur : Node_Id := Scope (Ent);
begin
while Present (Cur) loop
if Cur = Sc then
return True;
end if;
Cur := Scope (Cur);
end loop;
return False;
end Scope_Contains;
-- Start of processing for Debug_Renaming_Declaration
begin
if not Comes_From_Source (N) and then not Needs_Debug_Info (Ent) then
return Empty;
end if;
-- Get renamed entity and compute suffix
Name_Len := 0;
Ren := Nam;
loop
-- The expression that designates the renamed object is sometimes
-- expanded into bit-wise operations. We want to work instead on
-- array/record components accesses, so try to analyze the unexpanded
-- forms.
Ren := Original_Node (Ren);
case Nkind (Ren) is
when N_Expanded_Name
| N_Identifier
=>
if not Present (Renamed_Object (Entity (Ren))) then
exit;
end if;
-- This is a renaming of a renaming: traverse until the final
-- renaming to see if anything is packed along the way.
Ren := Renamed_Object (Entity (Ren));
when N_Selected_Component =>
declare
Sel_Id : constant Entity_Id :=
Entity (Selector_Name (Ren));
First_Bit : Uint;
begin
-- If the renaming involves a call to a primitive function,
-- we are out of the scope of renaming encodings. We will
-- very likely create a variable to hold the renamed value
-- anyway, so the renaming entity will be available in
-- debuggers.
exit when Ekind (Sel_Id) not in E_Component | E_Discriminant;
First_Bit := Normalized_First_Bit (Sel_Id);
Enable :=
Enable
or else Is_Packed
(Underlying_Type (Etype (Prefix (Ren))))
or else (First_Bit /= No_Uint
and then First_Bit /= Uint_0);
end;
Prepend_String_To_Buffer
(Get_Name_String (Chars (Selector_Name (Ren))));
Prepend_String_To_Buffer ("XR");
Ren := Prefix (Ren);
Last_Is_Indexed_Comp := False;
when N_Indexed_Component =>
declare
X : Node_Id;
begin
Enable_If_Packed_Array (Prefix (Ren));
X := Last (Expressions (Ren));
while Present (X) loop
if not Output_Subscript (X, "XS") then
Set_Materialize_Entity (Ent);
return Empty;
end if;
Prev (X);
Last_Is_Indexed_Comp := True;
end loop;
end;
Ren := Prefix (Ren);
when N_Slice =>
-- Assuming X is an array:
-- X (Y1 .. Y2) (Y3)
-- is equivalent to:
-- X (Y3)
-- GDB cannot handle packed array slices, so avoid describing
-- the slice if we can avoid it.
if not Last_Is_Indexed_Comp then
Enable_If_Packed_Array (Prefix (Ren));
Typ := Etype (First_Index (Etype (Ren)));
if not Output_Subscript (Type_High_Bound (Typ), "XS") then
Set_Materialize_Entity (Ent);
return Empty;
end if;
if not Output_Subscript (Type_Low_Bound (Typ), "XL") then
Set_Materialize_Entity (Ent);
return Empty;
end if;
Last_Is_Indexed_Comp := False;
end if;
Ren := Prefix (Ren);
when N_Explicit_Dereference =>
Prepend_String_To_Buffer ("XA");
Ren := Prefix (Ren);
Last_Is_Indexed_Comp := False;
-- For now, anything else simply results in no translation
when others =>
Set_Materialize_Entity (Ent);
return Empty;
end case;
end loop;
-- If we found no reason here to emit an encoding, stop now
if not Enable then
Set_Materialize_Entity (Ent);
return Empty;
end if;
Prepend_String_To_Buffer ("___XE");
-- Include the designation of the form of renaming
case Nkind (N) is
when N_Object_Renaming_Declaration =>
Prepend_String_To_Buffer ("___XR");
when N_Exception_Renaming_Declaration =>
Prepend_String_To_Buffer ("___XRE");
when N_Package_Renaming_Declaration =>
Prepend_String_To_Buffer ("___XRP");
when others =>
return Empty;
end case;
-- Add the name of the renaming entity to the front
Prepend_String_To_Buffer (Get_Name_String (Chars (Ent)));
-- If it is a child unit create a fully qualified name, to disambiguate
-- multiple child units with the same name and different parents.
if Nkind (N) = N_Package_Renaming_Declaration
and then Is_Child_Unit (Ent)
then
Prepend_String_To_Buffer ("__");
Prepend_String_To_Buffer
(Get_Name_String (Chars (Scope (Ent))));
end if;
-- Create the special object whose name is the debug encoding for the
-- renaming declaration.
-- For now, the object name contains the suffix encoding for the renamed
-- object, but not the name of the leading entity. The object is linked
-- the renamed entity using the Debug_Renaming_Link field. Then the
-- Qualify_Entity_Name procedure uses this link to create the proper
-- fully qualified name.
-- The reason we do things this way is that we really need to copy the
-- qualification of the renamed entity, and it is really much easier to
-- do this after the renamed entity has itself been fully qualified.
Obj := Make_Defining_Identifier (Loc, Chars => Name_Enter);
Res :=
Make_Object_Declaration (Loc,
Defining_Identifier => Obj,
Object_Definition => New_Occurrence_Of
(Standard_Debug_Renaming_Type, Loc));
Set_Debug_Renaming_Link (Obj, Entity (Ren));
Set_Debug_Info_Needed (Obj);
-- The renamed entity may be a temporary, e.g. the result of an
-- implicit dereference in an iterator. Indicate that the temporary
-- itself requires debug information. If the renamed entity comes
-- from source this is a no-op.
Set_Debug_Info_Needed (Entity (Ren));
-- Mark the object as internal so that it won't be initialized when
-- pragma Initialize_Scalars or Normalize_Scalars is in use.
Set_Is_Internal (Obj);
return Res;
-- If we get an exception, just figure it is a case that we cannot
-- successfully handle using our current approach, since this is
-- only for debugging, no need to take the compilation with us.
exception
when others =>
return Make_Null_Statement (Loc);
end Debug_Renaming_Declaration;
-----------------------------
-- Is_Handled_Scale_Factor --
-----------------------------
function Is_Handled_Scale_Factor (U : Ureal) return Boolean is
begin
-- Keep in sync with gigi (see E_*_Fixed_Point_Type handling in
-- decl.c:gnat_to_gnu_entity).
if UI_Eq (Numerator (U), Uint_1) then
if Rbase (U) = 2 or else Rbase (U) = 10 then
return True;
end if;
end if;
return
(UI_Is_In_Int_Range (Norm_Num (U))
and then
UI_Is_In_Int_Range (Norm_Den (U)));
end Is_Handled_Scale_Factor;
----------------------
-- Get_Encoded_Name --
----------------------
-- Note: see spec for details on encodings
procedure Get_Encoded_Name (E : Entity_Id) is
Has_Suffix : Boolean;
begin
-- If not generating code, there is no need to create encoded names, and
-- problems when the back-end is called to annotate types without full
-- code generation. See comments in Get_External_Name for additional
-- details.
-- However we do create encoded names if the back end is active, even
-- if Operating_Mode got reset. Otherwise any serious error reported
-- by the backend calling Error_Msg changes the Compilation_Mode to
-- Check_Semantics, which disables the functionality of this routine,
-- causing the generation of spurious additional errors.
-- Couldn't we just test Original_Operating_Mode here? ???
if Operating_Mode /= Generate_Code and then not Generating_Code then
return;
end if;
Get_Name_String (Chars (E));
-- Nothing to do if we do not have a type
if not Is_Type (E)
-- Or if this is an enumeration base type
or else (Is_Enumeration_Type (E) and then Is_Base_Type (E))
-- Or if this is a dummy type for a renaming
or else (Name_Len >= 3 and then
Name_Buffer (Name_Len - 2 .. Name_Len) = "_XR")
or else (Name_Len >= 4 and then
(Name_Buffer (Name_Len - 3 .. Name_Len) = "_XRE"
or else
Name_Buffer (Name_Len - 3 .. Name_Len) = "_XRP"))
-- For all these cases, just return the name unchanged
then
Name_Buffer (Name_Len + 1) := ASCII.NUL;
return;
end if;
Has_Suffix := True;
-- Fixed-point case: generate GNAT encodings when asked to or when we
-- know the back-end will not be able to handle the scale factor.
if Is_Fixed_Point_Type (E)
and then (GNAT_Encodings /= DWARF_GNAT_Encodings_Minimal
or else not Is_Handled_Scale_Factor (Small_Value (E)))
then
Get_External_Name (E, True, "XF_");
Add_Real_To_Buffer (Delta_Value (E));
if Small_Value (E) /= Delta_Value (E) then
Add_Str_To_Name_Buffer ("_");
Add_Real_To_Buffer (Small_Value (E));
end if;
-- Discrete case where bounds do not match size. Not necessary if we can
-- emit standard DWARF.
elsif GNAT_Encodings /= DWARF_GNAT_Encodings_Minimal
and then Is_Discrete_Type (E)
and then not Bounds_Match_Size (E)
then
declare
Lo : constant Node_Id := Type_Low_Bound (E);
Hi : constant Node_Id := Type_High_Bound (E);
Lo_Con : constant Boolean := Compile_Time_Known_Value (Lo);
Hi_Con : constant Boolean := Compile_Time_Known_Value (Hi);
Lo_Discr : constant Boolean :=
Nkind (Lo) = N_Identifier
and then Ekind (Entity (Lo)) = E_Discriminant;
Hi_Discr : constant Boolean :=
Nkind (Hi) = N_Identifier
and then Ekind (Entity (Hi)) = E_Discriminant;
Lo_Encode : constant Boolean := Lo_Con or Lo_Discr;
Hi_Encode : constant Boolean := Hi_Con or Hi_Discr;
Biased : constant Boolean := Has_Biased_Representation (E);
begin
if Biased then
Get_External_Name (E, True, "XB");
else
Get_External_Name (E, True, "XD");
end if;
if Lo_Encode or Hi_Encode then
if Biased then
Add_Str_To_Name_Buffer ("_");
else
if Lo_Encode then
if Hi_Encode then
Add_Str_To_Name_Buffer ("LU_");
else
Add_Str_To_Name_Buffer ("L_");
end if;
else
Add_Str_To_Name_Buffer ("U_");
end if;
end if;
if Lo_Con then
Add_Uint_To_Buffer (Expr_Rep_Value (Lo));
elsif Lo_Discr then
Get_Name_String_And_Append (Chars (Entity (Lo)));
end if;
if Lo_Encode and Hi_Encode then
Add_Str_To_Name_Buffer ("__");
end if;
if Hi_Con then
Add_Uint_To_Buffer (Expr_Rep_Value (Hi));
elsif Hi_Discr then
Get_Name_String_And_Append (Chars (Entity (Hi)));
end if;
end if;
end;
-- For all other cases, the encoded name is the normal type name
else
Has_Suffix := False;
Get_External_Name (E);
end if;
if Debug_Flag_B and then Has_Suffix then
Write_Str ("**** type ");
Write_Name (Chars (E));
Write_Str (" is encoded as ");
Write_Str (Name_Buffer (1 .. Name_Len));
Write_Eol;
end if;
Name_Buffer (Name_Len + 1) := ASCII.NUL;
end Get_Encoded_Name;
-----------------------
-- Get_External_Name --
-----------------------
procedure Get_External_Name
(Entity : Entity_Id;
Has_Suffix : Boolean := False;
Suffix : String := "")
is
procedure Get_Qualified_Name_And_Append (Entity : Entity_Id);
-- Appends fully qualified name of given entity to Name_Buffer
-----------------------------------
-- Get_Qualified_Name_And_Append --
-----------------------------------
procedure Get_Qualified_Name_And_Append (Entity : Entity_Id) is
begin
-- If the entity is a compilation unit, its scope is Standard,
-- there is no outer scope, and the no further qualification
-- is required.
-- If the front end has already computed a fully qualified name,
-- then it is also the case that no further qualification is
-- required.
if Present (Scope (Scope (Entity)))
and then not Has_Fully_Qualified_Name (Entity)
then
Get_Qualified_Name_And_Append (Scope (Entity));
Add_Str_To_Name_Buffer ("__");
Get_Name_String_And_Append (Chars (Entity));
Append_Homonym_Number (Entity);
else
Get_Name_String_And_Append (Chars (Entity));
end if;
end Get_Qualified_Name_And_Append;
-- Local variables
E : Entity_Id := Entity;
-- Start of processing for Get_External_Name
begin
-- If we are not in code generation mode, this procedure may still be
-- called from Back_End (more specifically - from gigi for doing type
-- representation annotation or some representation-specific checks).
-- But in this mode there is no need to mess with external names.
-- Furthermore, the call causes difficulties in this case because the
-- string representing the homonym number is not correctly reset as a
-- part of the call to Output_Homonym_Numbers_Suffix (which is not
-- called in gigi).
if Operating_Mode /= Generate_Code then
return;
end if;
Reset_Buffers;
-- If this is a child unit, we want the child
if Nkind (E) = N_Defining_Program_Unit_Name then
E := Defining_Identifier (Entity);
end if;
-- Case of interface name being used
if Ekind (E) in E_Constant
| E_Exception
| E_Function
| E_Procedure
| E_Variable
and then Present (Interface_Name (E))
and then No (Address_Clause (E))
and then not Has_Suffix
then
Append (Global_Name_Buffer, Strval (Interface_Name (E)));
-- All other cases besides the interface name case
else
-- If this is a library level subprogram (i.e. a subprogram that is a
-- compilation unit other than a subunit), then we prepend _ada_ to
-- ensure distinctions required as described in the spec.
-- Check explicitly for child units, because those are not flagged
-- as Compilation_Units by lib. Should they be ???
if Is_Subprogram (E)
and then (Is_Compilation_Unit (E) or Is_Child_Unit (E))
and then not Has_Suffix
then
Add_Str_To_Name_Buffer ("_ada_");
end if;
-- If the entity is a subprogram instance that is not a compilation
-- unit, generate the name of the original Ada entity, which is the
-- one gdb needs.
if Is_Generic_Instance (E)
and then Is_Subprogram (E)
and then not Is_Compilation_Unit (Scope (E))
and then Ekind (Scope (E)) in E_Package | E_Package_Body
and then Present (Related_Instance (Scope (E)))
then
E := Related_Instance (Scope (E));
end if;
Get_Qualified_Name_And_Append (E);
end if;
if Has_Suffix then
Add_Str_To_Name_Buffer ("___");
Add_Str_To_Name_Buffer (Suffix);
end if;
-- Add a special prefix to distinguish Ghost entities. In Ignored Ghost
-- mode, these entities should not leak in the "living" space and they
-- should be removed by the compiler in a post-processing pass. Thus,
-- the prefix allows anyone to check that the final executable indeed
-- does not contain such entities, in such a case. Do not insert this
-- prefix for compilation units, whose name is used as a basis for the
-- name of the generated elaboration procedure and (when appropriate)
-- the executable produced. Only insert this prefix once, for Ghost
-- entities declared inside other Ghost entities. Three leading
-- underscores are used so that "___ghost_" is a unique substring of
-- names produced for Ghost entities, while "__ghost_" can appear in
-- names of entities inside a child/local package called "Ghost".
-- The compiler-generated finalizer for an enabled Ghost unit is treated
-- specially, as its name must be known to the binder, which has no
-- knowledge of Ghost status. In that case, the finalizer is not marked
-- as Ghost so that no prefix is added. Note that the special ___ghost_
-- prefix is retained when the Ghost unit is ignored, which still allows
-- inspecting the final executable for the presence of an ignored Ghost
-- finalizer procedure.
if Is_Ghost_Entity (E)
and then not Is_Compilation_Unit (E)
and then (Name_Len < 9
or else Name_Buffer (1 .. 9) /= "___ghost_")
then
Insert_Str_In_Name_Buffer ("___ghost_", 1);
end if;
Name_Buffer (Name_Len + 1) := ASCII.NUL;
end Get_External_Name;
--------------------------
-- Get_Variant_Encoding --
--------------------------
procedure Get_Variant_Encoding (V : Node_Id) is
Choice : Node_Id;
procedure Choice_Val (Typ : Character; Choice : Node_Id);
-- Output encoded value for a single choice value. Typ is the key
-- character ('S', 'F', or 'T') that precedes the choice value.
----------------
-- Choice_Val --
----------------
procedure Choice_Val (Typ : Character; Choice : Node_Id) is
begin
if Nkind (Choice) = N_Integer_Literal then
Add_Char_To_Name_Buffer (Typ);
Add_Uint_To_Buffer (Intval (Choice));
-- Character literal with no entity present (this is the case
-- Standard.Character or Standard.Wide_Character as root type)
elsif Nkind (Choice) = N_Character_Literal
and then No (Entity (Choice))
then
Add_Char_To_Name_Buffer (Typ);
Add_Uint_To_Buffer (Char_Literal_Value (Choice));
else
declare
Ent : constant Entity_Id := Entity (Choice);
begin
if Ekind (Ent) = E_Enumeration_Literal then
Add_Char_To_Name_Buffer (Typ);
Add_Uint_To_Buffer (Enumeration_Rep (Ent));
else
pragma Assert (Ekind (Ent) = E_Constant);
Choice_Val (Typ, Constant_Value (Ent));
end if;
end;
end if;
end Choice_Val;
-- Start of processing for Get_Variant_Encoding
begin
Name_Len := 0;
Choice := First (Discrete_Choices (V));
while Present (Choice) loop
if Nkind (Choice) = N_Others_Choice then
Add_Char_To_Name_Buffer ('O');
elsif Nkind (Choice) = N_Range then
Choice_Val ('R', Low_Bound (Choice));
Choice_Val ('T', High_Bound (Choice));
elsif Is_Entity_Name (Choice)
and then Is_Type (Entity (Choice))
then
Choice_Val ('R', Type_Low_Bound (Entity (Choice)));
Choice_Val ('T', Type_High_Bound (Entity (Choice)));
elsif Nkind (Choice) = N_Subtype_Indication then
declare
Rang : constant Node_Id :=
Range_Expression (Constraint (Choice));
begin
Choice_Val ('R', Low_Bound (Rang));
Choice_Val ('T', High_Bound (Rang));
end;
else
Choice_Val ('S', Choice);
end if;
Next (Choice);
end loop;
Name_Buffer (Name_Len + 1) := ASCII.NUL;
if Debug_Flag_B then
declare
VP : constant Node_Id := Parent (V); -- Variant_Part
CL : constant Node_Id := Parent (VP); -- Component_List
RD : constant Node_Id := Parent (CL); -- Record_Definition
FT : constant Node_Id := Parent (RD); -- Full_Type_Declaration
begin
Write_Str ("**** variant for type ");
Write_Name (Chars (Defining_Identifier (FT)));
Write_Str (" is encoded as ");
Write_Str (Name_Buffer (1 .. Name_Len));
Write_Eol;
end;
end if;
end Get_Variant_Encoding;
-----------------------------------------
-- Build_Subprogram_Instance_Renamings --
-----------------------------------------
procedure Build_Subprogram_Instance_Renamings
(N : Node_Id;
Wrapper : Entity_Id)
is
Loc : Source_Ptr;
Decl : Node_Id;
E : Entity_Id;
begin
E := First_Entity (Wrapper);
while Present (E) loop
if Nkind (Parent (E)) = N_Object_Declaration
and then Is_Elementary_Type (Etype (E))
then
Loc := Sloc (Expression (Parent (E)));
Decl := Make_Object_Renaming_Declaration (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Chars (E)),
Subtype_Mark => New_Occurrence_Of (Etype (E), Loc),
Name => New_Occurrence_Of (E, Loc));
Append (Decl, Declarations (N));
Set_Debug_Info_Needed (Defining_Identifier (Decl));
end if;
Next_Entity (E);
end loop;
end Build_Subprogram_Instance_Renamings;
------------------------------------
-- Get_Secondary_DT_External_Name --
------------------------------------
procedure Get_Secondary_DT_External_Name
(Typ : Entity_Id;
Ancestor_Typ : Entity_Id;
Suffix_Index : Int)
is
begin
Get_External_Name (Typ);
if Ancestor_Typ /= Typ then
declare
Len : constant Natural := Name_Len;
Save_Str : constant String (1 .. Name_Len)
:= Name_Buffer (1 .. Name_Len);
begin
Get_External_Name (Ancestor_Typ);
-- Append the extended name of the ancestor to the
-- extended name of Typ
Name_Buffer (Len + 2 .. Len + Name_Len + 1) :=
Name_Buffer (1 .. Name_Len);
Name_Buffer (1 .. Len) := Save_Str;
Name_Buffer (Len + 1) := '_';
Name_Len := Len + Name_Len + 1;
end;
end if;
Add_Nat_To_Name_Buffer (Suffix_Index);
end Get_Secondary_DT_External_Name;
---------------------------------
-- Make_Packed_Array_Impl_Type_Name --
---------------------------------
function Make_Packed_Array_Impl_Type_Name
(Typ : Entity_Id;
Csize : Uint)
return Name_Id
is
begin
Get_Name_String (Chars (Typ));
Add_Str_To_Name_Buffer ("___XP");
Add_Uint_To_Buffer (Csize);
return Name_Find;
end Make_Packed_Array_Impl_Type_Name;
-----------------------------------
-- Output_Homonym_Numbers_Suffix --
-----------------------------------
procedure Output_Homonym_Numbers_Suffix is
J : Natural;
begin
if Homonym_Len > 0 then
-- Check for all 1's, in which case we do not output
J := 1;
loop
exit when Homonym_Numbers (J) /= '1';
-- If we reached end of string we do not output
if J = Homonym_Len then
Homonym_Len := 0;
return;
end if;
exit when Homonym_Numbers (J + 1) /= '_';
J := J + 2;
end loop;
-- If we exit the loop then suffix must be output
Add_Str_To_Name_Buffer ("__");
Add_Str_To_Name_Buffer (Homonym_Numbers (1 .. Homonym_Len));
Homonym_Len := 0;
end if;
end Output_Homonym_Numbers_Suffix;
------------------------------
-- Prepend_String_To_Buffer --
------------------------------
procedure Prepend_String_To_Buffer (S : String) is
N : constant Integer := S'Length;
begin
Name_Buffer (1 + N .. Name_Len + N) := Name_Buffer (1 .. Name_Len);
Name_Buffer (1 .. N) := S;
Name_Len := Name_Len + N;
end Prepend_String_To_Buffer;
----------------------------
-- Prepend_Uint_To_Buffer --
----------------------------
procedure Prepend_Uint_To_Buffer (U : Uint) is
begin
if U < 0 then
Prepend_String_To_Buffer ("m");
Prepend_Uint_To_Buffer (-U);
else
UI_Image (U, Decimal);
Prepend_String_To_Buffer (UI_Image_Buffer (1 .. UI_Image_Length));
end if;
end Prepend_Uint_To_Buffer;
------------------------------
-- Qualify_All_Entity_Names --
------------------------------
procedure Qualify_All_Entity_Names is
E : Entity_Id;
Ent : Entity_Id;
Nod : Node_Id;
begin
for J in Name_Qualify_Units.First .. Name_Qualify_Units.Last loop
Nod := Name_Qualify_Units.Table (J);
-- When a scoping construct is ignored Ghost, it is rewritten as
-- a null statement. Skip such constructs as they no longer carry
-- names.
if Nkind (Nod) = N_Null_Statement then
goto Continue;
end if;
E := Defining_Entity (Nod);
Reset_Buffers;
Qualify_Entity_Name (E);
-- Normally entities in the qualification list are scopes, but in the
-- case of a library-level package renaming there is an associated
-- variable that encodes the debugger name and that variable is
-- entered in the list since it occurs in the Aux_Decls list of the
-- compilation and doesn't have a normal scope.
if Ekind (E) /= E_Variable then
Ent := First_Entity (E);
while Present (Ent) loop
Reset_Buffers;
Qualify_Entity_Name (Ent);
Next_Entity (Ent);
-- There are odd cases where Last_Entity (E) = E. This happens
-- in the case of renaming of packages. This test avoids
-- getting stuck in such cases.
exit when Ent = E;
end loop;
end if;
<<Continue>>
null;
end loop;
end Qualify_All_Entity_Names;
-------------------------
-- Qualify_Entity_Name --
-------------------------
procedure Qualify_Entity_Name (Ent : Entity_Id) is
Full_Qualify_Name : String (1 .. Name_Buffer'Length);
Full_Qualify_Len : Natural := 0;
-- Used to accumulate fully qualified name of subprogram
procedure Fully_Qualify_Name (E : Entity_Id);
-- Used to qualify a subprogram or type name, where full
-- qualification up to Standard is always used. Name is set
-- in Full_Qualify_Name with the length in Full_Qualify_Len.
-- Note that this routine does not prepend the _ada_ string
-- required for library subprograms (this is done in the back end).
function Is_BNPE (S : Entity_Id) return Boolean;
-- Determines if S is a BNPE, i.e. Body-Nested Package Entity, which
-- is defined to be a package which is immediately nested within a
-- package body.
function Qualify_Needed (S : Entity_Id) return Boolean;
-- Given a scope, determines if the scope is to be included in the
-- fully qualified name, True if so, False if not. Blocks and loops
-- are excluded from a qualified name.
procedure Set_BNPE_Suffix (E : Entity_Id);
-- Recursive routine to append the BNPE qualification suffix. Works
-- from right to left with E being the current entity in the list.
-- The result does NOT have the trailing n's and trailing b stripped.
-- The caller must do this required stripping.
procedure Set_Entity_Name (E : Entity_Id);
-- Internal recursive routine that does most of the work. This routine
-- leaves the result sitting in Name_Buffer and Name_Len.
BNPE_Suffix_Needed : Boolean := False;
-- Set true if a body-nested package entity suffix is required
Save_Chars : constant Name_Id := Chars (Ent);
-- Save original name
------------------------
-- Fully_Qualify_Name --
------------------------
procedure Fully_Qualify_Name (E : Entity_Id) is
Discard : Boolean := False;
begin
-- Ignore empty entry (can happen in error cases)
if No (E) then
return;
-- If this we are qualifying entities local to a generic instance,
-- use the name of the original instantiation, not that of the
-- anonymous subprogram in the wrapper package, so that gdb doesn't
-- have to know about these.
elsif Is_Generic_Instance (E)
and then Is_Subprogram (E)
and then not Comes_From_Source (E)
and then not Is_Compilation_Unit (Scope (E))
then
Fully_Qualify_Name (Related_Instance (Scope (E)));
return;
end if;
-- If we reached fully qualified name, then just copy it
if Has_Fully_Qualified_Name (E) then
Get_Name_String (Chars (E));
Strip_Suffixes (Discard);
Full_Qualify_Name (1 .. Name_Len) := Name_Buffer (1 .. Name_Len);
Full_Qualify_Len := Name_Len;
Set_Has_Fully_Qualified_Name (Ent);
-- Case of non-fully qualified name
else
if Scope (E) = Standard_Standard then
Set_Has_Fully_Qualified_Name (Ent);
else
Fully_Qualify_Name (Scope (E));
Full_Qualify_Name (Full_Qualify_Len + 1) := '_';
Full_Qualify_Name (Full_Qualify_Len + 2) := '_';
Full_Qualify_Len := Full_Qualify_Len + 2;
end if;
if Has_Qualified_Name (E) then
Get_Unqualified_Name_String (Chars (E));
else
Get_Name_String (Chars (E));
end if;
-- Here we do one step of the qualification
Full_Qualify_Name
(Full_Qualify_Len + 1 .. Full_Qualify_Len + Name_Len) :=
Name_Buffer (1 .. Name_Len);
Full_Qualify_Len := Full_Qualify_Len + Name_Len;
Append_Homonym_Number (E);
end if;
if Is_BNPE (E) then
BNPE_Suffix_Needed := True;
end if;
end Fully_Qualify_Name;
-------------
-- Is_BNPE --
-------------
function Is_BNPE (S : Entity_Id) return Boolean is
begin
return Ekind (S) = E_Package and then Is_Package_Body_Entity (S);
end Is_BNPE;
--------------------
-- Qualify_Needed --
--------------------
function Qualify_Needed (S : Entity_Id) return Boolean is
begin
-- If we got all the way to Standard, then we have certainly
-- fully qualified the name, so set the flag appropriately,
-- and then return False, since we are most certainly done.
if S = Standard_Standard then
Set_Has_Fully_Qualified_Name (Ent, True);
return False;
-- Otherwise figure out if further qualification is required
else
return Is_Subprogram (Ent)
or else Ekind (Ent) = E_Subprogram_Body
or else (Ekind (S) /= E_Block
and then Ekind (S) /= E_Loop
and then not Is_Dynamic_Scope (S));
end if;
end Qualify_Needed;
---------------------
-- Set_BNPE_Suffix --
---------------------
procedure Set_BNPE_Suffix (E : Entity_Id) is
S : constant Entity_Id := Scope (E);
begin
if Qualify_Needed (S) then
Set_BNPE_Suffix (S);
if Is_BNPE (E) then
Add_Char_To_Name_Buffer ('b');
else
Add_Char_To_Name_Buffer ('n');
end if;
else
Add_Char_To_Name_Buffer ('X');
end if;
end Set_BNPE_Suffix;
---------------------
-- Set_Entity_Name --
---------------------
procedure Set_Entity_Name (E : Entity_Id) is
S : constant Entity_Id := Scope (E);
begin
-- If we reach an already qualified name, just take the encoding
-- except that we strip the package body suffixes, since these
-- will be separately put on later.
if Has_Qualified_Name (E) then
Get_Name_String_And_Append (Chars (E));
Strip_Suffixes (BNPE_Suffix_Needed);
-- If the top level name we are adding is itself fully
-- qualified, then that means that the name that we are
-- preparing for the Fully_Qualify_Name call will also
-- generate a fully qualified name.
if Has_Fully_Qualified_Name (E) then
Set_Has_Fully_Qualified_Name (Ent);
end if;
-- Case where upper level name is not encoded yet
else
-- Recurse if further qualification required
if Qualify_Needed (S) then
Set_Entity_Name (S);
Add_Str_To_Name_Buffer ("__");
end if;
-- Otherwise get name and note if it is a BNPE
Get_Name_String_And_Append (Chars (E));
if Is_BNPE (E) then
BNPE_Suffix_Needed := True;
end if;
Append_Homonym_Number (E);
end if;
end Set_Entity_Name;
-- Start of processing for Qualify_Entity_Name
begin
if Has_Qualified_Name (Ent) then
return;
-- If the entity is a variable encoding the debug name for an object
-- renaming, then the qualified name of the entity associated with the
-- renamed object can now be incorporated in the debug name.
elsif Ekind (Ent) = E_Variable
and then Present (Debug_Renaming_Link (Ent))
then
Name_Len := 0;
Qualify_Entity_Name (Debug_Renaming_Link (Ent));
Get_Name_String (Chars (Ent));
-- Retrieve the now-qualified name of the renamed entity and insert
-- it in the middle of the name, just preceding the suffix encoding
-- describing the renamed object.
declare
Renamed_Id : constant String :=
Get_Name_String (Chars (Debug_Renaming_Link (Ent)));
Insert_Len : constant Integer := Renamed_Id'Length + 1;
Index : Natural := Name_Len - 3;
begin
-- Loop backwards through the name to find the start of the "___"
-- sequence associated with the suffix.
while Index >= Name_Buffer'First
and then (Name_Buffer (Index + 1) /= '_'
or else Name_Buffer (Index + 2) /= '_'
or else Name_Buffer (Index + 3) /= '_')
loop
Index := Index - 1;
end loop;
pragma Assert (Name_Buffer (Index + 1 .. Index + 3) = "___");
-- Insert an underscore separator and the entity name just in
-- front of the suffix.
Name_Buffer (Index + 1 + Insert_Len .. Name_Len + Insert_Len) :=
Name_Buffer (Index + 1 .. Name_Len);
Name_Buffer (Index + 1) := '_';
Name_Buffer (Index + 2 .. Index + Insert_Len) := Renamed_Id;
Name_Len := Name_Len + Insert_Len;
end;
-- Reset the name of the variable to the new name that includes the
-- name of the renamed entity.
Set_Chars (Ent, Name_Enter);
-- If the entity needs qualification by its scope then develop it
-- here, add the variable's name, and again reset the entity name.
if Qualify_Needed (Scope (Ent)) then
Name_Len := 0;
Set_Entity_Name (Scope (Ent));
Add_Str_To_Name_Buffer ("__");
Get_Name_String_And_Append (Chars (Ent));
Set_Chars (Ent, Name_Enter);
end if;
Set_Has_Qualified_Name (Ent);
return;
elsif Is_Subprogram (Ent)
or else Ekind (Ent) = E_Subprogram_Body
or else Is_Type (Ent)
or else Ekind (Ent) = E_Exception
then
Fully_Qualify_Name (Ent);
Name_Len := Full_Qualify_Len;
Name_Buffer (1 .. Name_Len) := Full_Qualify_Name (1 .. Name_Len);
-- Qualification needed for enumeration literals when generating C code
-- (to simplify their management in the backend).
elsif Modify_Tree_For_C
and then Ekind (Ent) = E_Enumeration_Literal
and then Scope (Ultimate_Alias (Ent)) /= Standard_Standard
then
Fully_Qualify_Name (Ent);
Name_Len := Full_Qualify_Len;
Name_Buffer (1 .. Name_Len) := Full_Qualify_Name (1 .. Name_Len);
elsif Qualify_Needed (Scope (Ent)) then
Name_Len := 0;
Set_Entity_Name (Ent);
else
Set_Has_Qualified_Name (Ent);
-- If a variable is hidden by a subsequent loop variable, qualify
-- the name of that loop variable to prevent visibility issues when
-- translating to C. Note that gdb probably never handled properly
-- this accidental hiding, given that loops are not scopes at
-- runtime. We also qualify a name if it hides an outer homonym,
-- and both are declared in blocks.
if Modify_Tree_For_C and then Ekind (Ent) = E_Variable then
if Present (Hiding_Loop_Variable (Ent)) then
declare
Var : constant Entity_Id := Hiding_Loop_Variable (Ent);
begin
Set_Entity_Name (Var);
Add_Str_To_Name_Buffer ("L");
Set_Chars (Var, Name_Enter);
end;
elsif Present (Homonym (Ent))
and then Ekind (Scope (Ent)) = E_Block
and then Ekind (Scope (Homonym (Ent))) = E_Block
then
Set_Entity_Name (Ent);
Add_Str_To_Name_Buffer ("B");
Set_Chars (Ent, Name_Enter);
end if;
end if;
return;
end if;
-- Fall through with a fully qualified name in Name_Buffer/Name_Len
Output_Homonym_Numbers_Suffix;
-- Add body-nested package suffix if required
if BNPE_Suffix_Needed
and then Ekind (Ent) /= E_Enumeration_Literal
then
Set_BNPE_Suffix (Ent);
-- Strip trailing n's and last trailing b as required. note that
-- we know there is at least one b, or no suffix would be generated.
while Name_Buffer (Name_Len) = 'n' loop
Name_Len := Name_Len - 1;
end loop;
Name_Len := Name_Len - 1;
end if;
Set_Chars (Ent, Name_Enter);
Set_Has_Qualified_Name (Ent);
if Debug_Flag_BB then
Write_Str ("*** ");
Write_Name (Save_Chars);
Write_Str (" qualified as ");
Write_Name (Chars (Ent));
Write_Eol;
end if;
end Qualify_Entity_Name;
--------------------------
-- Qualify_Entity_Names --
--------------------------
procedure Qualify_Entity_Names (N : Node_Id) is
begin
Name_Qualify_Units.Append (N);
end Qualify_Entity_Names;
-------------------
-- Reset_Buffers --
-------------------
procedure Reset_Buffers is
begin
Name_Len := 0;
Homonym_Len := 0;
end Reset_Buffers;
--------------------
-- Strip_Suffixes --
--------------------
procedure Strip_Suffixes (BNPE_Suffix_Found : in out Boolean) is
SL : Natural;
pragma Warnings (Off, BNPE_Suffix_Found);
-- Since this procedure only ever sets the flag
begin
-- Search for and strip BNPE suffix
for J in reverse 2 .. Name_Len loop
if Name_Buffer (J) = 'X' then
Name_Len := J - 1;
BNPE_Suffix_Found := True;
exit;
end if;
exit when Name_Buffer (J) /= 'b' and then Name_Buffer (J) /= 'n';
end loop;
-- Search for and strip homonym numbers suffix
for J in reverse 2 .. Name_Len - 2 loop
if Name_Buffer (J) = '_'
and then Name_Buffer (J + 1) = '_'
then
if Name_Buffer (J + 2) in '0' .. '9' then
if Homonym_Len > 0 then
Homonym_Len := Homonym_Len + 1;
Homonym_Numbers (Homonym_Len) := '-';
end if;
SL := Name_Len - (J + 1);
Homonym_Numbers (Homonym_Len + 1 .. Homonym_Len + SL) :=
Name_Buffer (J + 2 .. Name_Len);
Name_Len := J - 1;
Homonym_Len := Homonym_Len + SL;
end if;
exit;
end if;
end loop;
end Strip_Suffixes;
end Exp_Dbug;
|
test/Fail/Issue2927.agda | shlevy/agda | 2 | 6056 | <gh_stars>1-10
open import Agda.Builtin.Equality
open import Agda.Builtin.Size
postulate
P : (A : Set₁) → A → Set₁
p : (i : Size) (f : {_ : Size< i} → Set) (x : _) →
P ({_ : Size< i} → Set) f
|
PJ Grammar/Literals.g4 | Diolor/PJ | 0 | 4728 | lexer grammar Literals;
// Literals
// NULL LITERAL
NullLiteral
: 'null'
;
// BOOLEAN LITERALS
BooleanLiteral
: 'true'
| 'false'
;
// CHARACTER LITERALS
CharacterLiteral
: '\'' SingleCharacter '\''
| '\'' EscapeSequence '\''
;
fragment
SingleCharacter
: ~['\\]
;
// STRING LITERALS
StringLiteral
: '"' StringCharacters? '"'
;
fragment
StringCharacters
: StringCharacter+
;
fragment
StringCharacter
: ~["\\]
| EscapeSequence
;
// ESCAPES
fragment
EscapeSequence
: '\\' [btnfr"'\\]
| OctalEscape
| UnicodeEscape
;
fragment
OctalEscape
: '\\' OctalDigit
| '\\' OctalDigit OctalDigit
| '\\' ZeroToThree OctalDigit OctalDigit
;
fragment
UnicodeEscape
: '\\' 'u' HexDigit HexDigit HexDigit HexDigit
;
fragment
ZeroToThree
: [0-3]
;
// INTEGER LITERALS
IntegerLiteral
: DecimalIntegerLiteral
| HexIntegerLiteral
| OctalIntegerLiteral
| BinaryIntegerLiteral
;
fragment
DecimalIntegerLiteral
: DecimalNumeral IntegerTypeSuffix?
;
fragment
HexIntegerLiteral
: HexNumeral IntegerTypeSuffix?
;
fragment
OctalIntegerLiteral
: OctalNumeral IntegerTypeSuffix?
;
fragment
BinaryIntegerLiteral
: BinaryNumeral IntegerTypeSuffix?
;
fragment
IntegerTypeSuffix
: [lL]
;
fragment
DecimalNumeral
: '0'
| NonZeroDigit (Digits? | Underscores Digits)
;
fragment
Digits
: Digit (DigitOrUnderscore* Digit)?
;
fragment
Digit
: '0'
| NonZeroDigit
;
fragment
NonZeroDigit
: [1-9]
;
fragment
DigitOrUnderscore
: Digit
| '_'
;
fragment
Underscores
: '_'+
;
fragment
HexNumeral
: '0' [xX] HexDigits
;
fragment
HexDigits
: HexDigit (HexDigitOrUnderscore* HexDigit)?
;
fragment
HexDigit
: [0-9a-fA-F]
;
fragment
HexDigitOrUnderscore
: HexDigit
| '_'
;
fragment
OctalNumeral
: '0' Underscores? OctalDigits
;
fragment
OctalDigits
: OctalDigit (OctalDigitOrUnderscore* OctalDigit)?
;
fragment
OctalDigit
: [0-7]
;
fragment
OctalDigitOrUnderscore
: OctalDigit
| '_'
;
fragment
BinaryNumeral
: '0' [bB] BinaryDigits
;
fragment
BinaryDigits
: BinaryDigit (BinaryDigitOrUnderscore* BinaryDigit)?
;
fragment
BinaryDigit
: [01]
;
fragment
BinaryDigitOrUnderscore
: BinaryDigit
| '_'
;
// FLOATING-POINT LITERALS
FloatingPointLiteral
: DecimalFloatingPointLiteral
| HexadecimalFloatingPointLiteral
;
fragment
DecimalFloatingPointLiteral
: Digits '.' Digits? ExponentPart? FloatTypeSuffix?
| '.' Digits ExponentPart? FloatTypeSuffix?
| Digits ExponentPart FloatTypeSuffix?
| Digits FloatTypeSuffix
;
fragment
ExponentPart
: ExponentIndicator SignedInteger
;
fragment
ExponentIndicator
: [eE]
;
fragment
SignedInteger
: Sign? Digits
;
fragment
Sign
: [+-]
;
fragment
FloatTypeSuffix
: [fFdD]
;
fragment
HexadecimalFloatingPointLiteral
: HexSignificand BinaryExponent FloatTypeSuffix?
;
fragment
HexSignificand
: HexNumeral '.'?
| '0' [xX] HexDigits? '.' HexDigits
;
fragment
BinaryExponent
: BinaryExponentIndicator SignedInteger
;
fragment
BinaryExponentIndicator
: [pP]
;
|
Exploit-Dev/reverse_engineering/Reverse Engineering and Exploit Development - Working Files/Chapter 4/simple32.asm | bbhunter/Security-Guide | 98 | 174007 | <filename>Exploit-Dev/reverse_engineering/Reverse Engineering and Exploit Development - Working Files/Chapter 4/simple32.asm
; hello world in 32-bit assembly for Linux
global _start
section .text
_start:
; write is system call 4
mov eax, 4 ; system call 4 is write
mov ebx, 1 ; file handle 1 is stdout
mov ecx, message ; address of string to output
mov edx, len ; number of bytes
int 0x80 ; invoke syscall
; exit(0)
mov eax, 1 ; system call 1 is exit
xor ebx, ebx ; exit code 0
int 0x80 ; invoke operating system to exit
message:
db "Hello, Reverser!", 10 ; 10 is a newline
len: equ $ - message
|
alloy4fun_models/trashltl/models/9/KM9jNZWwMywpGYES7.als | Kaixi26/org.alloytools.alloy | 0 | 1136 | open main
pred idKM9jNZWwMywpGYES7_prop10 {
Protected in Protected'
}
pred __repair { idKM9jNZWwMywpGYES7_prop10 }
check __repair { idKM9jNZWwMywpGYES7_prop10 <=> prop10o } |
bin/JWASM/Samples/owfc16.asm | Abd-Beltaji/ASMEMU | 3 | 104890 |
;--- 16-bit sample: using Open Watcom's register calling convention
;--- assemble: jwasm -zf1 owfc16.asm
;--- link DOS: wlink sys dos file owfc16.obj
;--- link OS/2: wlink sys os2 file owfc16.obj
.286
.model compact, fastcall
include owfchlp.inc ;defines macro @StoreArg
includelib clibc.lib
includelib math87c.lib
includelib emu87.lib;without emulator link errors will occur
extern _cstart:near
extern _fltused:near;to make wlink include floating-point support
assume ds:nothing ;OW compact model doesnt ensure that DS==DGROUP!
UINT typedef WORD
CStr macro text:VARARG
local x
.const
x db text,0
.code
exitm <addr x>
endm
printf proto :ptr, :VARARG
strcpy proto :ptr, :ptr
memcpy proto :ptr, :ptr, len:UINT
.data?
buffer db 32 dup (?)
.code
szText db "abc",0
fl64 real8 2.5
testproc proc a1:UINT, a2:ptr, a3:UINT
invoke printf, CStr("testproc arguments: 1=%u 2=%p 3=%u",10), a1, a2, a3
ret
testproc endp
testdbl proc a1:REAL8
local dbl:real8
;--- the @StoreArg macro must be used here, because the
;--- a1 parameter is a register quadruplet (ax::bx::cx::dx),
;--- that INVOKE cannot handle.
@StoreArg dbl, a1 ;store argument in memory location
invoke printf, CStr("double argument: %f",10), dbl
ret
testdbl endp
main proc argc:UINT,argv:ptr,argenv:ptr
LOCAL dst[32]:byte,src[32]:byte
mov src, 0
invoke strcpy, addr dst, addr src
invoke memcpy, addr buffer, addr szText, sizeof szText
invoke printf, CStr("string argument: '%s'",10,"integer argument: '%d'",10),
addr buffer, 12345
invoke testproc, 1, 2, 3
invoke testdbl, fl64
ret
main endp
end
|
test/fail/Issue818.agda | larrytheliquid/agda | 1 | 273 | -- {-# OPTIONS -v tc.with:100 #-}
module Issue818 where
data ⊤ : Set where
tt : ⊤
Foo : {x : ⊤} → Set₁
Foo with tt
Foo {x = _} | tt = Set
-- Panic: wrong number of arguments in with clause: given 1, expected
-- 0
-- when checking that the clause
-- Foo with tt
-- Foo {x = _} | tt = Set
-- has type {⊤} → Set₁
-- The code above type-checks using Agda 2.3.0.1, but not with Agda
-- 2.3.2.
-- Andreas, 2013-03-08: same error thrown by
-- foo : ⊤ → Set₁
-- foo with tt
-- foo x | tt = Set
-- Implicit arguments are no longer eagerly introduced (see release notes
-- for 2.3.2, text for issue 679).
-- Should now throw a proper error message (not a panic).
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c35507o.ada | best08618/asylo | 7 | 5334 | <reponame>best08618/asylo<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c35507o.ada
-- C35507O.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT THE ATTRIBUTES 'FIRST' AND 'LAST' YIELD THE CORRECT
-- RESULTS WHEN THE PREFIX IS A CHARACTER TYPE.
-- RJW 6/03/86
-- PWN 11/30/94 SUBTYPE QUALIFIED LITERALS FOR ADA 9X.
-- REMOVED PART OF TEST INVALID FOR ADA 9X.
WITH REPORT; USE REPORT;
PROCEDURE C35507O IS
TYPE CHAR IS ('A', B);
TYPE NEWCHAR IS NEW CHAR;
SPACE : CONSTANT CHARACTER := CHARACTER'(' ');
SUBTYPE NOCHAR IS CHARACTER RANGE CHARACTER'('Z') .. CHARACTER'('A');
SUBTYPE GRAPHIC IS CHARACTER RANGE SPACE .. ASCII.TILDE;
SUBTYPE NONGRAPHIC IS CHARACTER RANGE ASCII.NUL .. ASCII.US;
FUNCTION IDENT (CH : CHAR) RETURN CHAR IS
BEGIN
RETURN CHAR'VAL (IDENT_INT (CHAR'POS (CH)));
END IDENT;
FUNCTION IDENT (CH : NEWCHAR) RETURN NEWCHAR IS
BEGIN
RETURN NEWCHAR'VAL (IDENT_INT (NEWCHAR'POS (CH)));
END IDENT;
BEGIN
TEST( "C35507O" , "CHECK THAT THE ATTRIBUTES 'FIRST' AND " &
"'LAST' YIELD THE CORRECT RESULTS WHEN THE " &
"PREFIX IS A CHARACTER TYPE" );
BEGIN
IF IDENT (CHAR'FIRST) /= 'A' THEN
FAILED ( "INCORRECT VALUE FOR CHAR'FIRST" );
END IF;
IF CHAR'LAST /= B THEN
FAILED ( "INCORRECT VALUE FOR CHAR'LAST" );
END IF;
END;
BEGIN
IF NEWCHAR'FIRST /= 'A' THEN
FAILED ( "INCORRECT VALUE FOR NEWCHAR'FIRST" );
END IF;
IF NEWCHAR'LAST /= IDENT (B) THEN
FAILED ( "INCORRECT VALUE FOR NEWCHAR'LAST" );
END IF;
END;
BEGIN
IF NOCHAR'FIRST /= CHARACTER'('Z') THEN
FAILED ( "INCORRECT VALUE FOR NOCHAR'FIRST" );
END IF;
IF NOCHAR'LAST /= CHARACTER'('A') THEN
FAILED ( "INCORRECT VALUE FOR NOCHAR'LAST" );
END IF;
END;
BEGIN
IF CHARACTER'FIRST /= ASCII.NUL THEN
FAILED ( "INCORRECT VALUE FOR CHARACTER'FIRST" );
END IF;
END;
BEGIN
IF NONGRAPHIC'FIRST /= IDENT_CHAR (ASCII.NUL) THEN
FAILED ( "INCORRECT VALUE FOR NONGRAPHIC'FIRST" );
END IF;
IF NONGRAPHIC'LAST /= ASCII.US THEN
FAILED ( "INCORRECT VALUE FOR NONGRAPHIC'LAST" );
END IF;
END;
BEGIN
IF GRAPHIC'FIRST /= SPACE THEN
FAILED ( "INCORRECT VALUE FOR GRAPHIC'FIRST" );
END IF;
IF GRAPHIC'LAST /= ASCII.TILDE THEN
FAILED ( "INCORRECT VALUE FOR GRAPHIC'LAST" );
END IF;
END;
RESULT;
END C35507O;
|
programs/oeis/198/A198586.asm | neoneye/loda | 22 | 241430 | <reponame>neoneye/loda<filename>programs/oeis/198/A198586.asm<gh_stars>10-100
; A198586: a(n) = (4^A001651(n+1) - 1)/3: numbers (4^k-1)/3 for k > 1, not multiples of 3.
; 5,85,341,5461,21845,349525,1398101,22369621,89478485,1431655765,5726623061,91625968981,366503875925,5864062014805,23456248059221,375299968947541,1501199875790165,24019198012642645,96076792050570581,1537228672809129301,6148914691236517205,98382635059784275285,393530540239137101141,6296488643826193618261,25185954575304774473045,402975273204876391568725,1611901092819505566274901,25790417485112089060398421,103161669940448356241593685,1650586719047173699865498965,6602346876188694799461995861,105637550019019116791391933781,422550200076076467165567735125,6760803201217223474649083762005,27043212804868893898596335048021,432691404877902302377541360768341,1730765619511609209510165443073365,27692249912185747352162647089173845,110768999648742989408650588356695381
mul $0,3
mov $1,3
lpb $0
trn $0,2
add $1,1
mul $1,4
lpe
div $1,13
mul $1,16
add $1,5
mov $0,$1
|
formalization/agda/Spire/Examples/PropLev.agda | spire/spire | 43 | 7360 | {-# OPTIONS --type-in-type #-}
open import Data.Unit
open import Data.Product hiding ( curry ; uncurry )
open import Data.List hiding ( concat )
open import Data.String
open import Relation.Binary.PropositionalEquality
open import Function
module Spire.Examples.PropLev where
----------------------------------------------------------------------
Label : Set
Label = String
Enum : Set
Enum = List Label
data Tag : Enum → Set where
here : ∀{l E} → Tag (l ∷ E)
there : ∀{l E} → Tag E → Tag (l ∷ E)
Branches : (E : Enum) (P : Tag E → Set) → Set
Branches [] P = ⊤
Branches (l ∷ E) P = P here × Branches E (λ t → P (there t))
case : {E : Enum} (P : Tag E → Set) (cs : Branches E P) (t : Tag E) → P t
case P (c , cs) here = c
case P (c , cs) (there t) = case (λ t → P (there t)) cs t
UncurriedBranches : (E : Enum) (P : Tag E → Set) (X : Set)
→ Set
UncurriedBranches E P X = Branches E P → X
CurriedBranches : (E : Enum) (P : Tag E → Set) (X : Set)
→ Set
CurriedBranches [] P X = X
CurriedBranches (l ∷ E) P X = P here → CurriedBranches E (λ t → P (there t)) X
curryBranches : {E : Enum} {P : Tag E → Set} {X : Set}
→ UncurriedBranches E P X → CurriedBranches E P X
curryBranches {[]} f = f tt
curryBranches {l ∷ E} f = λ c → curryBranches (λ cs → f (c , cs))
uncurryBranches : {E : Enum} {P : Tag E → Set} {X : Set}
→ CurriedBranches E P X → UncurriedBranches E P X
uncurryBranches {[]} x tt = x
uncurryBranches {l ∷ E} f (c , cs) = uncurryBranches (f c) cs
----------------------------------------------------------------------
data Desc (I : Set) : Set₁ where
End : (i : I) → Desc I
Rec : (i : I) (D : Desc I) → Desc I
Arg : (A : Set) (B : A → Desc I) → Desc I
elimDesc : {I : Set} (P : Desc I → Set)
(pend : (i : I) → P (End i))
(prec : (i : I) (D : Desc I) (pd : P D) → P (Rec i D))
(parg : (A : Set) (B : A → Desc I) (pb : (a : A) → P (B a)) → P (Arg A B))
(D : Desc I) → P D
elimDesc P pend prec parg (End i) = pend i
elimDesc P pend prec parg (Rec i D) = prec i D (elimDesc P pend prec parg D)
elimDesc P pend prec parg (Arg A B) = parg A B (λ a → elimDesc P pend prec parg (B a))
----------------------------------------------------------------------
ISet : Set → Set₁
ISet I = I → Set
El : {I : Set} (D : Desc I) → ISet I → ISet I
El (End j) X i = j ≡ i
El (Rec j D) X i = X j × El D X i
El (Arg A B) X i = Σ A (λ a → El (B a) X i)
Hyps : {I : Set} (D : Desc I) (X : ISet I) (P : (i : I) → X i → Set) (i : I) (xs : El D X i) → Set
Hyps (End j) X P i q = ⊤
Hyps (Rec j D) X P i (x , xs) = P j x × Hyps D X P i xs
Hyps (Arg A B) X P i (a , b) = Hyps (B a) X P i b
----------------------------------------------------------------------
UncurriedEl : {I : Set} (D : Desc I) (X : ISet I) → Set
UncurriedEl D X = ∀{i} → El D X i → X i
CurriedEl : {I : Set} (D : Desc I) (X : ISet I) → Set
CurriedEl (End i) X = X i
CurriedEl (Rec i D) X = (x : X i) → CurriedEl D X
CurriedEl (Arg A B) X = (a : A) → CurriedEl (B a) X
curryEl : {I : Set} (D : Desc I) (X : ISet I)
→ UncurriedEl D X → CurriedEl D X
curryEl (End i) X cn = cn refl
curryEl (Rec i D) X cn = λ x → curryEl D X (λ xs → cn (x , xs))
curryEl (Arg A B) X cn = λ a → curryEl (B a) X (λ xs → cn (a , xs))
uncurryEl : {I : Set} (D : Desc I) (X : ISet I)
→ CurriedEl D X → UncurriedEl D X
uncurryEl (End i) X cn refl = cn
uncurryEl (Rec i D) X cn (x , xs) = uncurryEl D X (cn x) xs
uncurryEl (Arg A B) X cn (a , xs) = uncurryEl (B a) X (cn a) xs
----------------------------------------------------------------------
UncurriedHyps : {I : Set} (D : Desc I) (X : ISet I)
(P : (i : I) → X i → Set)
(cn : UncurriedEl D X)
→ Set
UncurriedHyps D X P cn =
∀ i (xs : El D X i) (ihs : Hyps D X P i xs) → P i (cn xs)
CurriedHyps : {I : Set} (D : Desc I) (X : ISet I)
(P : (i : I) → X i → Set)
(cn : UncurriedEl D X)
→ Set
CurriedHyps (End i) X P cn =
P i (cn refl)
CurriedHyps (Rec i D) X P cn =
(x : X i) → P i x → CurriedHyps D X P (λ xs → cn (x , xs))
CurriedHyps (Arg A B) X P cn =
(a : A) → CurriedHyps (B a) X P (λ xs → cn (a , xs))
curryHyps : {I : Set} (D : Desc I) (X : ISet I)
(P : (i : I) → X i → Set)
(cn : UncurriedEl D X)
→ UncurriedHyps D X P cn
→ CurriedHyps D X P cn
curryHyps (End i) X P cn pf =
pf i refl tt
curryHyps (Rec i D) X P cn pf =
λ x ih → curryHyps D X P (λ xs → cn (x , xs)) (λ i xs ihs → pf i (x , xs) (ih , ihs))
curryHyps (Arg A B) X P cn pf =
λ a → curryHyps (B a) X P (λ xs → cn (a , xs)) (λ i xs ihs → pf i (a , xs) ihs)
uncurryHyps : {I : Set} (D : Desc I) (X : ISet I)
(P : (i : I) → X i → Set)
(cn : UncurriedEl D X)
→ CurriedHyps D X P cn
→ UncurriedHyps D X P cn
uncurryHyps (End .i) X P cn pf i refl tt =
pf
uncurryHyps (Rec j D) X P cn pf i (x , xs) (ih , ihs) =
uncurryHyps D X P (λ ys → cn (x , ys)) (pf x ih) i xs ihs
uncurryHyps (Arg A B) X P cn pf i (a , xs) ihs =
uncurryHyps (B a) X P (λ ys → cn (a , ys)) (pf a) i xs ihs
----------------------------------------------------------------------
data μ {I : Set} (D : Desc I) : ISet I where
init : UncurriedEl D (μ D)
----------------------------------------------------------------------
Data : Set
Data =
Σ Set λ I →
Σ Enum λ E →
Branches E (λ _ → Desc I)
DataI : Data → Set
DataI (I , E , B) = I
DataE : Data → Enum
DataE (I , E , B) = E
DataT : Data → Set
DataT R = Tag (DataE R)
DataB : (R : Data) → Branches (DataE R) (λ _ → Desc (DataI R))
DataB (I , E , B) = B
DataD : (R : Data) → Desc (DataI R)
DataD R = Arg (DataT R) (case (λ _ → Desc (DataI R)) (DataB R))
caseR : (R : Data) → DataT R → Desc (DataI R)
caseR R = case (λ _ → Desc (DataI R)) (DataB R)
----------------------------------------------------------------------
inj : (R : Data)
→ let D = DataD R
in CurriedEl D (μ D)
inj R = let D = DataD R
in curryEl D (μ D) init
----------------------------------------------------------------------
ind : {I : Set} (D : Desc I)
(P : (i : I) → μ D i → Set)
(α : UncurriedHyps D (μ D) P init)
(i : I)
(x : μ D i)
→ P i x
prove : {I : Set} (D E : Desc I)
(P : (i : I) → μ E i → Set)
(α : UncurriedHyps E (μ E) P init)
(i : I) (xs : El D (μ E) i) → Hyps D (μ E) P i xs
ind D P α i (init xs) = α i xs (prove D D P α i xs)
prove (End j) E P α i q = tt
prove (Rec j D) E P α i (x , xs) = ind E P α j x , prove D E P α i xs
prove (Arg A B) E P α i (a , xs) = prove (B a) E P α i xs
----------------------------------------------------------------------
indCurried : {I : Set} (D : Desc I)
(P : (i : I) → μ D i → Set)
(f : CurriedHyps D (μ D) P init)
(i : I)
(x : μ D i)
→ P i x
indCurried D P f i x = ind D P (uncurryHyps D (μ D) P init f) i x
SumCurriedHyps : (R : Data)
→ let D = DataD R in
(P : ∀ i → μ D i → Set)
→ DataT R → Set
SumCurriedHyps R P t =
CurriedHyps (caseR R t) (μ (DataD R)) P (λ xs → init (t , xs))
elimUncurried : (R : Data)
→ let D = DataD R in
(P : ∀ i → μ D i → Set)
→ UncurriedBranches (DataE R)
(SumCurriedHyps R P)
(∀ i (x : μ D i) → P i x)
elimUncurried R P cs i x =
indCurried (DataD R) P
(case (SumCurriedHyps R P) cs)
i x
elim : (R : Data)
→ let D = DataD R in
(P : ∀ i → μ D i → Set)
→ CurriedBranches (DataE R)
(SumCurriedHyps R P)
(∀ i (x : μ D i) → P i x)
elim R P = curryBranches (elimUncurried R P)
----------------------------------------------------------------------
ℕE : Enum
ℕE = "zero" ∷ "suc" ∷ []
VecE : Enum
VecE = "nil" ∷ "cons" ∷ []
ℕT : Set
ℕT = Tag ℕE
VecT : Set
VecT = Tag VecE
zeroT : ℕT
zeroT = here
sucT : ℕT
sucT = there here
nilT : VecT
nilT = here
consT : VecT
consT = there here
ℕR : Data
ℕR = ⊤ , ℕE
, End tt
, Rec tt (End tt)
, tt
ℕD : Desc ⊤
ℕD = DataD ℕR
ℕ : ⊤ → Set
ℕ = μ ℕD
zero : ℕ tt
zero = init (zeroT , refl)
suc : ℕ tt → ℕ tt
suc n = init (sucT , n , refl)
VecR : (A : Set) → Data
VecR A = (ℕ tt) , VecE
, End zero
, Arg (ℕ tt) (λ n → Arg A λ _ → Rec n (End (suc n)))
, tt
nilD : (A : Set) → Desc (ℕ tt)
nilD A = End zero
consD : (A : Set) → Desc (ℕ tt)
consD A = Arg (ℕ tt) (λ n → Arg A (λ _ → Rec n (End (suc n))))
VecD : (A : Set) → Desc (ℕ tt)
VecD A = DataD (VecR A)
Vec : (A : Set) → ℕ tt → Set
Vec A = μ (VecD A)
NilEl : (A : Set) (n : ℕ tt) → Set
NilEl A n = El (nilD A) (Vec A) n
ConsEl : (A : Set) → ℕ tt → Set
ConsEl A n = El (consD A) (Vec A) n
VecEl : (A : Set) → ℕ tt → Set
VecEl A n = El (VecD A) (Vec A) n
NilHyps : (A : Set) (P : (n : ℕ tt) → Vec A n → Set) (n : ℕ tt) (xs : NilEl A n) → Set
NilHyps A P n xs = Hyps (nilD A) (Vec A) P n xs
ConsHyps : (A : Set) (P : (n : ℕ tt) → Vec A n → Set) (n : ℕ tt) (xs : ConsEl A n) → Set
ConsHyps A P n xs = Hyps (consD A) (Vec A) P n xs
VecHyps : (A : Set) (P : (n : ℕ tt) → Vec A n → Set) (n : ℕ tt) (xs : VecEl A n) → Set
VecHyps A P n xs = Hyps (VecD A) (Vec A) P n xs
ConsUncurriedHyps : (A : Set)
(P : (n : ℕ tt) → Vec A n → Set)
(cn : UncurriedEl (consD A) (Vec A)) → Set
ConsUncurriedHyps A P cn = UncurriedHyps (consD A) (Vec A) P cn
nil : (A : Set) → Vec A zero
nil A = init (nilT , refl)
cons : (A : Set) (n : ℕ tt) (x : A) (xs : Vec A n) → Vec A (suc n)
cons A n x xs = init (consT , n , x , xs , refl)
nil2 : (A : Set) → Vec A zero
nil2 A = inj (VecR A) nilT
cons2 : (A : Set) (n : ℕ tt) (x : A) (xs : Vec A n) → Vec A (suc n)
cons2 A = inj (VecR A) consT
----------------------------------------------------------------------
add : ℕ tt → ℕ tt → ℕ tt
add = elim ℕR (λ u n → ℕ tt → ℕ tt)
(λ n → n)
(λ m ih n → suc (ih n))
tt
mult : ℕ tt → ℕ tt → ℕ tt
mult = elim ℕR (λ u n → ℕ tt → ℕ tt)
(λ n → zero)
(λ m ih n → add n (ih n))
tt
append : (A : Set) (m : ℕ tt) (xs : Vec A m) (n : ℕ tt) (ys : Vec A n) → Vec A (add m n)
append A = elim (VecR A) (λ m xs → (n : ℕ tt) (ys : Vec A n) → Vec A (add m n))
(λ n ys → ys)
(λ m x xs ih n ys → cons A (add m n) x (ih n ys))
concat : (A : Set) (m n : ℕ tt) (xss : Vec (Vec A m) n) → Vec A (mult n m)
concat A m = elim (VecR (Vec A m)) (λ n xss → Vec A (mult n m))
(nil A)
(λ n xs xss ih → append A m xs (mult n m) ih)
----------------------------------------------------------------------
|
support/template.applescript | Benitoite/rt-create-dmg | 0 | 2646 | <filename>support/template.applescript
on run (volumeName)
tell application "Finder"
tell disk (volumeName as string)
open
set theXOrigin to WINX
set theYOrigin to WINY
set theWidth to WINW
set theHeight to WINH
set theBottomRightX to (theXOrigin + theWidth)
set theBottomRightY to (theYOrigin + theHeight)
set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\""
tell container window
set current view to icon view
set toolbar visible to false
set statusbar visible to false
set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
set statusbar visible to false
end tell
set opts to the icon view options of container window
tell opts
set icon size to ICON_SIZE
set text size to TEXT_SIZE
set arrangement to not arranged
end tell
delay 5
-- Positioning
set position of item "RawTherapee.app" to {266, 185}
set position of item "Applications" to {720, 185}
set position of item "Website.webloc" to {320, 432}
set position of item "Documentation.webloc" to {442, 432}
set position of item "Report Bug.webloc" to {570, 432}
set position of item "Forum.webloc" to {680, 432}
set position of item ".background" to {1200, 1200}
set position of item ".VolumeIcon.icns" to {1200, 1200}
set position of item "LICENSE.txt" to {800, 2}
set extension hidden of item "LICENSE.txt" to true
set extension hidden of item "Website.webloc" to true
set extension hidden of item "Documentation.webloc" to true
set extension hidden of item "Report Bug.webloc" to true
set extension hidden of item "Forum.webloc" to true
-- Application and QL Link Clauses
APPLICATION_CLAUSE
QL_CLAUSE
close
open
-- Force saving of the size
delay 5
tell container window
set statusbar visible to false
set the bounds to {theXOrigin, theYOrigin, theBottomRightX - 10, theBottomRightY - 10}
end tell
end tell
delay 5
tell disk (volumeName as string)
tell container window
set statusbar visible to false
set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
set current view to icon view
end tell
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 72
-- Settings background
set background picture of theViewOptions to file ".background:background.png"
end tell
--give the finder some time to write the .DS_Store file
delay 5
set waitTime to 0
set ejectMe to false
repeat while ejectMe is false
delay 5
set waitTime to waitTime + 1
if (do shell script "[ -f " & dsStore & " ]; echo $?") = "0" then set ejectMe to true
end repeat
log "waited " & waitTime & " seconds for .DS_STORE to be created."
end tell
end run
|
src/main/antlr/org/clyze/jimple/Jimple.g4 | mkotyk/doop | 0 | 2242 | grammar Jimple;
@header {
package org.clyze.jimple;
}
program
: klass ;
klass
: modifier* ('class'|'interface') IDENTIFIER ('extends' IDENTIFIER)? ('implements' identifierList)? '{' (field|method)* '}' ;
modifier
: 'public'
| 'protected'
| 'private'
| 'static'
| 'abstract'
| 'final'
| 'transient'
| 'synchronized'
| 'volatile'
| 'native'
| 'enum'
| 'strictfp'
| IDENTIFIER // IDENTIFIER added to support the 'annotation' keyword which can be used as a method name etc as well
;
field
: modifier* IDENTIFIER '[]'? IDENTIFIER ';' ;
method
: modifier* IDENTIFIER IDENTIFIER '(' identifierList? ')' throwsExceptions? (methodBody | ';') ;
throwsExceptions
: 'throws' identifierList ;
identifierList
: IDENTIFIER MARKER?
| identifierList ',' IDENTIFIER MARKER?
;
methodBody
: '{' ( ('(' INTEGER ')')? statement ';' | IDENTIFIER ':')+ '}' ;
statement
: declarationStmt
| complexAssignmentStmt
| assignmentStmt
| returnStmt
| invokeStmt
| allocationStmt
| jumpStmt
| switchStmt
| catchStmt
| monitorStmt
| nopStmt
;
declarationStmt
: IDENTIFIER identifierList ;
complexAssignmentStmt
: IDENTIFIER '[' value ']' '=' value ('[' value ']')?
| (IDENTIFIER '.')? fieldSig '=' value
;
assignmentStmt
: IDENTIFIER ':=' IDENTIFIER ':' IDENTIFIER
| IDENTIFIER ':=' '@caughtexception'
| IDENTIFIER '=' value
| IDENTIFIER '=' '(' IDENTIFIER ')' value
| IDENTIFIER '=' ('lengthof'|'class'|'neg') value
| IDENTIFIER '=' value (OP|'cmp'|'cmpl'|'cmpg'|'instanceof') value
| IDENTIFIER '=' value '[' value ']'
| IDENTIFIER '=' (IDENTIFIER '.')? fieldSig
| IDENTIFIER '=' 'Phi' '(' identifierList ')'
;
returnStmt
: 'return' value? ;
invokeStmt
: (IDENTIFIER '=')? ('specialinvoke'|'virtualinvoke'|'interfaceinvoke') IDENTIFIER '.' methodSig '(' valueList? ')'
| (IDENTIFIER '=')? 'staticinvoke' methodSig '(' valueList? ')'
| (IDENTIFIER '=')? 'dynamicinvoke' STRING dynamicMethodSig '(' valueList? ')' methodSig '(' bootValueList? ')'
;
allocationStmt
: IDENTIFIER '=' 'new' IDENTIFIER
| IDENTIFIER '=' 'newarray' '(' IDENTIFIER ')' '[' value ']'
| IDENTIFIER '=' 'newmultiarray' '(' IDENTIFIER ')' ('[' value? ']')+ '[]'?
;
methodSig
: '<' IDENTIFIER ':' IDENTIFIER IDENTIFIER '(' identifierList? ')' '>' ;
methodHandle
: STRING methodSig ;
methodType
: IDENTIFIER IDENTIFIER? '(' identifierList? ')' ;
dynamicMethodSig
: '<' IDENTIFIER '(' identifierList? ')' '>' ;
fieldSig
: '<' IDENTIFIER ':' IDENTIFIER IDENTIFIER '>' ;
value
: IDENTIFIER
| INTEGER
| REAL
| STRING
| 'class' STRING
| 'handle:' methodSig
| 'methodhandle:' methodHandle
| 'methodtype:' methodType
;
valueList
: value
| valueList ',' value
;
bootValueList
: valueList;
// Used to be 'if' instead of IDENTIFIER, but Uber has fields named `if`
jumpStmt
: (IDENTIFIER value ('==' | '!=' | '<' | '<=' | '>' | '>=') value)? 'goto' IDENTIFIER ;
switchStmt
: ('tableswitch'|'lookupswitch') '(' value ')' '{' caseStmt* '}' ;
caseStmt
: ('case' INTEGER|'default') ':' 'goto' IDENTIFIER ';' ;
catchStmt
: 'catch' IDENTIFIER 'from' IDENTIFIER 'to' IDENTIFIER 'with' IDENTIFIER ;
monitorStmt
: 'entermonitor' 'class' STRING
| 'exitmonitor' 'class' STRING
| 'entermonitor' IDENTIFIER
| 'exitmonitor' IDENTIFIER
;
nopStmt
: 'nop' ;
// Lexer
INTEGER
: '-'?[0-9]+'L'?
| '-'?'0'[0-7]+'L'?
| '-'?'0'[xX][0-9a-fA-F]+'L'?
;
MARKER
: '#'INTEGER ;
fragment
EXPONENT
: [eE][-+]?INTEGER ;
REAL
: INTEGER EXPONENT
| INTEGER EXPONENT? [fF]
| (INTEGER)? '.' INTEGER EXPONENT? [fF]?
| '#Infinity'
| '#-Infinity'
| '#InfinityF'
| '#-InfinityF'
| '#NaN'
| '#NaNF'
;
BOOLEAN
: 'true' | 'false' ;
STRING
: '"' STRING_CHAR* '"' ;
fragment
STRING_CHAR
: ~["\\]
| '\\' [ubtnfr"'\\]
;
fragment
IDENTIFIER_BASE
: [$@a-zA-Z0-9_][$@a-zA-Z0-9_-]*
| '-'[$@a-zA-Z0-9_-]+ // Added for Uber that has class names starting with '-'
;
fragment
IDENTIFIER_SUF
: ['#''_'0-9]+
| '_$$A_'
;
fragment
PACKAGE_PART
: '.' IDENTIFIER_BASE
| '.' '\'' IDENTIFIER_BASE '\''
;
IDENTIFIER
: IDENTIFIER_BASE PACKAGE_PART* IDENTIFIER_SUF* '[]'*
| '<' IDENTIFIER_BASE '>'
| '\'' IDENTIFIER_BASE '\''
;
OP
: '+' | '-' | '*' | '/' | '%' | '&' | '|' | '^' | '<<' | '>>' | '>>>' ;
WHITE_SPACE
: [ \t\r\n]+ -> skip ;
|
Transynther/x86/_processed/US/_zr_/i3-7100_9_0x84_notsx.log_21829_1534.asm | ljhsiun2/medusa | 9 | 97427 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x7240, %rsi
lea addresses_normal_ht+0x64b8, %rdi
nop
nop
add %rax, %rax
mov $30, %rcx
rep movsl
nop
nop
sub $56373, %r10
lea addresses_WC_ht+0x1630, %r9
and %rbp, %rbp
movb (%r9), %al
sub %rdi, %rdi
lea addresses_A_ht+0x10f70, %rsi
nop
nop
sub $43993, %rax
and $0xffffffffffffffc0, %rsi
movaps (%rsi), %xmm0
vpextrq $0, %xmm0, %rcx
nop
nop
nop
nop
and %r10, %r10
lea addresses_WC_ht+0x13630, %rsi
clflush (%rsi)
nop
nop
nop
cmp $40670, %rax
movl $0x61626364, (%rsi)
nop
nop
and $3819, %rbp
lea addresses_D_ht+0x8e30, %rsi
lea addresses_D_ht+0x19e30, %rdi
nop
nop
add %r12, %r12
mov $41, %rcx
rep movsl
nop
and $28567, %rsi
lea addresses_normal_ht+0x410, %rsi
lea addresses_normal_ht+0x11a30, %rdi
nop
nop
nop
nop
nop
and %rbp, %rbp
mov $57, %rcx
rep movsw
nop
nop
nop
and %rax, %rax
lea addresses_WT_ht+0x1390, %rbp
nop
add $36379, %r10
mov $0x6162636465666768, %r12
movq %r12, (%rbp)
nop
nop
add %r9, %r9
lea addresses_UC_ht+0x1e70, %r12
nop
nop
nop
dec %rcx
mov (%r12), %r10d
and $16637, %rax
lea addresses_UC_ht+0x149bf, %rbp
nop
nop
nop
sub $14496, %rdi
movb $0x61, (%rbp)
and %r10, %r10
lea addresses_WT_ht+0x194b0, %r12
nop
nop
nop
add $36444, %rsi
movl $0x61626364, (%r12)
nop
xor $58955, %r12
lea addresses_WC_ht+0x19030, %rsi
lea addresses_WC_ht+0xa630, %rdi
xor $46498, %rbp
mov $100, %rcx
rep movsw
nop
nop
nop
nop
nop
inc %rdi
lea addresses_A_ht+0x3730, %rsi
lea addresses_normal_ht+0xb5bc, %rdi
nop
nop
nop
nop
add $30770, %r10
mov $109, %rcx
rep movsb
inc %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %rax
push %rbx
push %rcx
// Faulty Load
lea addresses_US+0x7e30, %rbx
nop
nop
nop
cmp $1946, %rax
movups (%rbx), %xmm3
vpextrq $1, %xmm3, %r13
lea oracles, %r11
and $0xff, %r13
shlq $12, %r13
mov (%r11,%r13,1), %r13
pop %rcx
pop %rbx
pop %rax
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_US', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': True, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'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
*/
|
3-mid/impact/source/2d/collision/shapes/impact-d2-shape.adb | charlie5/lace | 20 | 10637 |
package body impact.d2.Shape
is
function getKind (Self : in b2Shape'Class) return shape.Kind
is
begin
return self.m_Kind;
end getKind;
end impact.d2.Shape;
|
programs/oeis/040/A040858.asm | neoneye/loda | 22 | 169451 | <gh_stars>10-100
; A040858: Continued fraction for sqrt(888).
; 29,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1,58,1,3,1
seq $0,40867 ; Continued fraction for sqrt(897).
dif $0,6
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/packed_subtype.adb | best08618/asylo | 7 | 22021 | <gh_stars>1-10
-- { dg-do run }
procedure Packed_Subtype is
subtype Ubyte is Integer range 0 .. 255;
type Packet (Id : Ubyte) is record
A, B : Ubyte;
end record;
pragma Pack (Packet);
subtype My_Packet is Packet (Id => 1);
MP : My_Packet;
begin
MP.A := 1;
MP.B := 2;
if MP.A /= 1 or else MP.B /= 2 then
raise Program_Error;
end if;
end;
|
Kernel/src/Arch/x86_64/SMPTrampoline.asm | adi-g15/LemonOS | 685 | 8708 | <reponame>adi-g15/LemonOS
BITS 16
%include "smpdefines.inc"
cli
cld
mov ax, SMP_MAGIC
mov word [SMP_TRAMPOLINE_DATA_START_FLAG], ax
mov eax, cr4
or eax, 1 << 5 ; Set PAE bit
mov cr4, eax
mov eax, dword [SMP_TRAMPOLINE_CR3]
mov cr3, eax
mov ecx, 0xC0000080 ; EFER Model Specific Register
rdmsr ; Read from the MSR
or eax, 1 << 8
wrmsr
mov eax, cr0
or eax, 0x80000001 ; Paging, Protected Mode
mov cr0, eax
lgdt [SMP_TRAMPOLINE_GDT_PTR]
jmp 0x08:(smpentry64 + SMP_TRAMPOLINE_ENTRY)
hlt
BITS 64
smpentry64:
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov rsp, [SMP_TRAMPOLINE_STACK]
mov rax, cr0
and ax, 0xFFFB ; Clear coprocessor emulation
or ax, 0x2 ; Set coprocessor monitoring
mov cr0, rax
;Enable SSE
mov rax, cr4
or ax, 3 << 9 ; Set flags for SSE
mov cr4, rax
xor rbp, rbp
mov rdi, [SMP_TRAMPOLINE_CPU_ID]
call [SMP_TRAMPOLINE_ENTRY2]
cli
hlt |
programs/oeis/025/A025839.asm | neoneye/loda | 22 | 4821 | ; A025839: Expansion of 1/((1-x^3)(1-x^5)(1-x^11)).
; 1,0,0,1,0,1,1,0,1,1,1,2,1,1,2,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,6,5,6,7,6,7,7,7,8,8,8,9,9,9,10,10,10,11,11,11,12,12,13,13,13,14,14,15,15,15,16,16,17,18,17,18,19
mov $3,2
mov $5,$0
lpb $3
sub $3,1
add $0,$3
sub $0,1
mov $2,$3
mov $4,$0
max $4,0
seq $4,29043 ; Expansion of 1/((1-x)(1-x^3)(1-x^5)(1-x^11)).
mul $2,$4
add $1,$2
lpe
min $5,1
mul $5,$4
sub $1,$5
mov $0,$1
|
a/assembler_6502.asm | zackarhino/hello-world | 3 | 9433 | ; goodbyeworld.s for C= 8-bit machines, ca65 assembler format.
; String printing limited to strings of 256 characters or less.
a_cr = $0d ; Carriage return.
bsout = $ffd2 ; KERNAL ROM, output a character to current device.
.code
ldx #0 ; Starting index 0 in X register.
printnext:
lda text,x ; Get character from string.
beq done ; If we read a 0 we're done.
jsr bsout ; Output character.
inx ; Increment index to next character.
bne printnext ; Repeat if index doesn't overflow to 0.
done:
rts ; Return from subroutine.
.rodata
text:
.byte "Hello world!", a_cr, 0
|
eurasia/eurasiacon/android/graphicshal/blitops.asm | shaqfu786/GFX_Linux_DDK | 3 | 10001 | /*!****************************************************************************
@File blitops.use
@Title Hardware Composer (hwcomposer) HAL component (blit USE)
@Author Imagination Technologies
@Date 2011/06/03
@Copyright Copyright (C) Imagination Technologies Limited.
All rights reserved. No part of this software, either material
or conceptual may be copied or distributed, transmitted,
transcribed, stored in a retrieval system or translated into
any human or computer language in any form by any means,
electronic, mechanical, manual or otherwise, or disclosed
to third parties without the express written permission of
Imagination Technologies Limited, Home Park Estate,
Kings Langley, Hertfordshire, WD4 8LZ, U.K.
@Platform linux
******************************************************************************/
/* Registers for custom usse blt (8 bits per channel):
* Inputs:
* pa0 - source pixel
* pa1 - dest pixel
* pa2 - source2 pixel (optional)
* sa0 - UseParams[0] (per-blt constant)
* sa1 - UseParams[1]
* Outputs :
* o0 - dest pixel
*/
.export AlphaToFF;
.export AlphaToFFEnd;
AlphaToFF:
{
or.skipinv.end o0, pa0, #0xFF000000;
}
AlphaToFFEnd:
|
libsrc/_DEVELOPMENT/adt/b_vector/c/sccz80/b_vector_init.asm | jpoikela/z88dk | 640 | 7812 | <reponame>jpoikela/z88dk
; void *b_vector_init(void *p, size_t capacity, size_t max_size)
SECTION code_clib
SECTION code_adt_b_vector
PUBLIC b_vector_init
EXTERN asm_b_vector_init
b_vector_init:
pop af
pop hl
pop bc
pop de
push de
push bc
push hl
push af
jp asm_b_vector_init
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _b_vector_init
defc _b_vector_init = b_vector_init
ENDIF
|
compiler/find_zero.asm | vanashimko/microprogram-control-devices | 2 | 161788 | <reponame>vanashimko/microprogram-control-devices
LOAD 000001
JNZ 000101
LOAD 000110
INC
STORE 000110
LOAD 000010
JNZ 001010
LOAD 000110
INC
STORE 000110
LOAD 000011
JNZ 001111
LOAD 000110
INC
STORE 000110
LOAD 000100
JNZ 010100
LOAD 000110
INC
STORE 000110
LOAD 000101
JNZ 011001
LOAD 000110
INC
STORE 000110
HALT |
oeis/348/A348132.asm | neoneye/loda-programs | 11 | 2053 | ; A348132: a(n) is the denominator of the relativistic sum of n velocities of 1/n, in units where the speed of light is 1.
; Submitted by <NAME>(s2)
; 1,5,9,353,275,66637,18571,24405761,2215269,14712104501,411625181,13218256749601,109949704423,16565151205544957,39931933598775,27614800115689879553,18928981513351817,59095217374989483261925,11350851717672992089,157904201452248753415276001
add $0,1
seq $0,62024 ; a(n) = ((n+1)^n + (n-1)^n)/2.
lpb $0
dif $0,4
lpe
|
Categories/Adjoint.agda | Taneb/agda-categories | 0 | 5261 | <gh_stars>0
{-# OPTIONS --without-K --safe #-}
module Categories.Adjoint where
-- Adjoints
open import Level
open import Data.Product using (_,_; _×_)
open import Function using (_$_) renaming (_∘_ to _∙_)
open import Function.Equality using (Π; _⟶_)
import Function.Inverse as FI
open import Relation.Binary using (Rel; IsEquivalence; Setoid)
-- be explicit in imports to 'see' where the information comes from
open import Categories.Category using (Category)
open import Categories.Category.Product using (Product; _⁂_)
open import Categories.Category.Instance.Setoids
open import Categories.Morphism
open import Categories.Functor using (Functor; _∘F_) renaming (id to idF)
open import Categories.Functor.Bifunctor using (Bifunctor)
open import Categories.Functor.Hom using (Hom[_][-,-])
open import Categories.Functor.Construction.LiftSetoids
open import Categories.NaturalTransformation using (NaturalTransformation; ntHelper; _∘ₕ_; _∘ᵥ_; _∘ˡ_; _∘ʳ_)
renaming (id to idN)
open import Categories.NaturalTransformation.NaturalIsomorphism
using (NaturalIsomorphism; unitorˡ; unitorʳ; associator; _≃_)
import Categories.Morphism.Reasoning as MR
private
variable
o o′ o″ ℓ ℓ′ ℓ″ e e′ e″ : Level
C D E : Category o ℓ e
record Adjoint (L : Functor C D) (R : Functor D C) : Set (levelOfTerm L ⊔ levelOfTerm R) where
private
module C = Category C
module D = Category D
module L = Functor L
module R = Functor R
field
unit : NaturalTransformation idF (R ∘F L)
counit : NaturalTransformation (L ∘F R) idF
module unit = NaturalTransformation unit
module counit = NaturalTransformation counit
field
zig : ∀ {A : C.Obj} → counit.η (L.F₀ A) D.∘ L.F₁ (unit.η A) D.≈ D.id
zag : ∀ {B : D.Obj} → R.F₁ (counit.η B) C.∘ unit.η (R.F₀ B) C.≈ C.id
private
variable
A : C.Obj
B : D.Obj
Ladjunct : L.F₀ A D.⇒ B → A C.⇒ R.F₀ B
Ladjunct f = R.F₁ f C.∘ unit.η _
Radjunct : A C.⇒ R.F₀ B → L.F₀ A D.⇒ B
Radjunct f = counit.η _ D.∘ L.F₁ f
RLadjunct≈id : ∀ {f : L.F₀ A D.⇒ B} → Radjunct (Ladjunct f) D.≈ f
RLadjunct≈id {f = f} = begin
Radjunct (Ladjunct f) ≈⟨ refl⟩∘⟨ L.homomorphism ⟩
counit.η _ D.∘ L.F₁ (R.F₁ f) D.∘ L.F₁ (unit.η _) ≈⟨ pullˡ (counit.commute f) ⟩
(f D.∘ counit.η _) D.∘ L.F₁ (unit.η _) ≈⟨ pullʳ zig ⟩
f D.∘ D.id ≈⟨ D.identityʳ ⟩
f ∎
where open D.HomReasoning
open MR D
LRadjunct≈id : ∀ {f : A C.⇒ R.F₀ B} → Ladjunct (Radjunct f) C.≈ f
LRadjunct≈id {f = f} = begin
Ladjunct (Radjunct f) ≈⟨ R.homomorphism ⟩∘⟨refl ⟩
(R.F₁ (counit.η _) C.∘ R.F₁ (L.F₁ f)) C.∘ unit.η _ ≈˘⟨ pushʳ (unit.commute f) ⟩
R.F₁ (counit.η _) C.∘ unit.η _ C.∘ f ≈⟨ pullˡ zag ⟩
C.id C.∘ f ≈⟨ C.identityˡ ⟩
f ∎
where open C.HomReasoning
open MR C
Hom[L-,-] : Bifunctor C.op D (Setoids _ _)
Hom[L-,-] = Hom[ D ][-,-] ∘F (L.op ⁂ idF)
Hom[-,R-] : Bifunctor C.op D (Setoids _ _)
Hom[-,R-] = Hom[ C ][-,-] ∘F (idF ⁂ R)
module Hom[L-,-] = Functor Hom[L-,-]
module Hom[-,R-] = Functor Hom[-,R-]
-- Inverse is more 'categorical' than bijection defined via injection/surjection
Hom-inverse : ∀ A B → FI.Inverse (Hom[L-,-].F₀ (A , B)) (Hom[-,R-].F₀ (A , B))
Hom-inverse A B = record
{ to = record
{ _⟨$⟩_ = Ladjunct {A} {B}
; cong = C.∘-resp-≈ˡ ∙ R.F-resp-≈
}
; from = record
{ _⟨$⟩_ = Radjunct {A} {B}
; cong = D.∘-resp-≈ʳ ∙ L.F-resp-≈
}
; inverse-of = record
{ left-inverse-of = λ _ → RLadjunct≈id
; right-inverse-of = λ _ → LRadjunct≈id
}
}
module Hom-inverse {A} {B} = FI.Inverse (Hom-inverse A B)
op : Adjoint R.op L.op
op = record
{ unit = counit.op
; counit = unit.op
; zig = zag
; zag = zig
}
-- naturality condition on the two hom functors.
-- these conditions are separated out because a complication due to the
-- universe level in Agda.
module _ where
open C
open HomReasoning
open MR C
Ladjunct-comm : ∀ {X Y A B} {h i : L.F₀ X D.⇒ Y} {f : A ⇒ X} {g : Y D.⇒ B} →
h D.≈ i →
R.F₁ (g D.∘ h D.∘ L.F₁ f) ∘ unit.η A ≈ R.F₁ g ∘ (R.F₁ i ∘ unit.η X) ∘ f
Ladjunct-comm {X} {Y} {A} {B} {h} {i} {f} {g} eq = begin
R.F₁ (g D.∘ h D.∘ L.F₁ f) ∘ unit.η A ≈⟨ R.homomorphism ⟩∘⟨refl ⟩
(R.F₁ g ∘ R.F₁ (h D.∘ L.F₁ f)) ∘ unit.η A ≈⟨ (refl⟩∘⟨ R.homomorphism) ⟩∘⟨refl ⟩
(R.F₁ g ∘ R.F₁ h ∘ R.F₁ (L.F₁ f)) ∘ unit.η A ≈⟨ pullʳ assoc ⟩
R.F₁ g ∘ R.F₁ h ∘ R.F₁ (L.F₁ f) ∘ unit.η A ≈˘⟨ refl⟩∘⟨ ⟺ (R.F-resp-≈ eq) ⟩∘⟨ unit.commute f ⟩
R.F₁ g ∘ R.F₁ i ∘ unit.η X ∘ f ≈˘⟨ refl⟩∘⟨ assoc ⟩
R.F₁ g ∘ (R.F₁ i ∘ unit.η X) ∘ f ∎
Ladjunct-comm′ : ∀ {X A B} {f : A ⇒ X} {g : L.F₀ X D.⇒ B} →
Ladjunct (g D.∘ L.F₁ f) ≈ Ladjunct g ∘ f
Ladjunct-comm′ = ∘-resp-≈ˡ R.homomorphism ○ (pullʳ (⟺ (unit.commute _))) ○ ⟺ assoc
Ladjunct-resp-≈ : ∀ {A B} {f g : L.F₀ A D.⇒ B} → f D.≈ g → Ladjunct f ≈ Ladjunct g
Ladjunct-resp-≈ eq = ∘-resp-≈ˡ (R.F-resp-≈ eq)
module _ where
open D
open HomReasoning
open MR D
Radjunct-comm : ∀ {X Y A B} {h i : X C.⇒ R.F₀ Y} {f : A C.⇒ X} {g : Y ⇒ B} →
h C.≈ i →
counit.η B ∘ L.F₁ (R.F₁ g C.∘ h C.∘ f) ≈ g ∘ (counit.η Y ∘ L.F₁ i) ∘ L.F₁ f
Radjunct-comm {X} {Y} {A} {B} {h} {i} {f} {g} eq = begin
counit.η B ∘ L.F₁ (R.F₁ g C.∘ h C.∘ f) ≈⟨ refl⟩∘⟨ L.homomorphism ⟩
counit.η B ∘ L.F₁ (R.F₁ g) ∘ L.F₁ (h C.∘ f) ≈⟨ pullˡ (counit.commute g) ⟩
(g ∘ counit.η Y) ∘ L.F₁ (h C.∘ f) ≈⟨ refl⟩∘⟨ L.homomorphism ⟩
(g ∘ counit.η Y) ∘ L.F₁ h ∘ L.F₁ f ≈⟨ refl ⟩∘⟨ L.F-resp-≈ eq ⟩∘⟨ refl ⟩
(g ∘ counit.η Y) ∘ L.F₁ i ∘ L.F₁ f ≈⟨ pullʳ (⟺ assoc) ⟩
g ∘ (counit.η Y ∘ L.F₁ i) ∘ L.F₁ f ∎
Radjunct-comm′ : ∀ {Y A B} {f : A C.⇒ R.F₀ Y} {g : Y ⇒ B} →
Radjunct (R.F₁ g C.∘ f) ≈ g ∘ Radjunct f
Radjunct-comm′ = ∘-resp-≈ʳ L.homomorphism ○ pullˡ (counit.commute _) ○ assoc
Radjunct-resp-≈ : ∀ {A B} {f g : A C.⇒ R.F₀ B} → f C.≈ g → Radjunct f ≈ Radjunct g
Radjunct-resp-≈ eq = ∘-resp-≈ʳ (L.F-resp-≈ eq)
-- a complication: the two hom functors do not live in the same Setoids,
-- so they need to be mapped to the same Setoids first before establishing
-- natural isomorphism!
module _ where
private
levelℓ : Category o ℓ e → Level
levelℓ {ℓ = ℓ} _ = ℓ
levele : Category o ℓ e → Level
levele {e = e} _ = e
Hom[L-,-]′ : Bifunctor C.op D (Setoids _ _)
Hom[L-,-]′ = LiftSetoids (levelℓ C) (levele C) ∘F Hom[ D ][-,-] ∘F (L.op ⁂ idF)
Hom[-,R-]′ : Bifunctor C.op D (Setoids _ _)
Hom[-,R-]′ = LiftSetoids (levelℓ D) (levele D) ∘F Hom[ C ][-,-] ∘F (idF ⁂ R)
Hom-NI : NaturalIsomorphism Hom[L-,-]′ Hom[-,R-]′
Hom-NI = record
{ F⇒G = ntHelper record
{ η = λ _ → record
{ _⟨$⟩_ = λ f → lift (Ladjunct (lower f))
; cong = λ eq → lift (Ladjunct-resp-≈ (lower eq))
}
; commute = λ _ eq → lift $ Ladjunct-comm (lower eq)
}
; F⇐G = ntHelper record
{ η = λ _ → record
{ _⟨$⟩_ = λ f → lift (Radjunct (lower f))
; cong = λ eq → lift (Radjunct-resp-≈ (lower eq))
}
; commute = λ _ eq → lift $ Radjunct-comm (lower eq)
}
; iso = λ X → record
{ isoˡ = λ eq → let open D.HomReasoning in lift (RLadjunct≈id ○ lower eq)
; isoʳ = λ eq → let open C.HomReasoning in lift (LRadjunct≈id ○ lower eq)
}
}
module Hom-NI = NaturalIsomorphism Hom-NI
infix 5 _⊣_
_⊣_ = Adjoint
-- a special case of the natural isomorphism in which homsets in C and D have the same
-- universe level. therefore there is no need to lift Setoids to the saem level.
-- this is helpful when combining with Yoneda lemma.
module _ {C : Category o ℓ e} {D : Category o′ ℓ e} {L : Functor C D} {R : Functor D C} where
private
module C = Category C
module D = Category D
module L = Functor L
module R = Functor R
module _ (adjoint : L ⊣ R) where
open Adjoint adjoint
-- in this case, the hom functors are naturally isomorphism directly
Hom-NI′ : NaturalIsomorphism Hom[L-,-] Hom[-,R-]
Hom-NI′ = record
{ F⇒G = ntHelper record
{ η = λ _ → Hom-inverse.to
; commute = λ _ eq → Ladjunct-comm eq
}
; F⇐G = ntHelper record
{ η = λ _ → Hom-inverse.from
; commute = λ _ eq → Radjunct-comm eq
}
; iso = λ _ → record
{ isoˡ = λ eq → let open D.HomReasoning in RLadjunct≈id ○ eq
; isoʳ = λ eq → let open C.HomReasoning in LRadjunct≈id ○ eq
}
}
-- now goes from natural isomorphism back to adjoint.
-- for simplicity, just construct the case in which homsetoids of C and D
-- are compatible.
private
Hom[L-,-] : Bifunctor C.op D (Setoids _ _)
Hom[L-,-] = Hom[ D ][-,-] ∘F (L.op ⁂ idF)
Hom[-,R-] : Bifunctor C.op D (Setoids _ _)
Hom[-,R-] = Hom[ C ][-,-] ∘F (idF ⁂ R)
module _ (Hni : NaturalIsomorphism Hom[L-,-] Hom[-,R-]) where
open NaturalIsomorphism Hni
open NaturalTransformation
open Functor
open Π
private
unitη : ∀ X → F₀ Hom[L-,-] (X , L.F₀ X) ⟶ F₀ Hom[-,R-] (X , L.F₀ X)
unitη X = ⇒.η (X , L.F₀ X)
unit : NaturalTransformation idF (R ∘F L)
unit = ntHelper record
{ η = λ X → unitη X ⟨$⟩ D.id
; commute = λ {X} {Y} f → begin
(unitη Y ⟨$⟩ D.id) ∘ f ≈⟨ introˡ R.identity ⟩
R.F₁ D.id ∘ (unitη Y ⟨$⟩ D.id) ∘ f ≈˘⟨ ⇒.commute (f , D.id) D.Equiv.refl ⟩
⇒.η (X , L.F₀ Y) ⟨$⟩ (D.id D.∘ D.id D.∘ L.F₁ f) ≈⟨ cong (⇒.η (X , L.F₀ Y)) (D.Equiv.trans D.identityˡ D.identityˡ) ⟩
⇒.η (X , L.F₀ Y) ⟨$⟩ L.F₁ f ≈⟨ cong (⇒.η (X , L.F₀ Y)) (MR.introʳ D (MR.elimʳ D L.identity)) ⟩
⇒.η (X , L.F₀ Y) ⟨$⟩ (L.F₁ f D.∘ D.id D.∘ L.F₁ id) ≈⟨ ⇒.commute (C.id , L.F₁ f) D.Equiv.refl ⟩
R.F₁ (L.F₁ f) ∘ (unitη X ⟨$⟩ D.id) ∘ id ≈⟨ refl⟩∘⟨ identityʳ ⟩
R.F₁ (L.F₁ f) ∘ (unitη X ⟨$⟩ D.id) ∎
}
where open C
open HomReasoning
open MR C
counitη : ∀ X → F₀ Hom[-,R-] (R.F₀ X , X) ⟶ F₀ Hom[L-,-] (R.F₀ X , X)
counitη X = ⇐.η (R.F₀ X , X)
counit : NaturalTransformation (L ∘F R) idF
counit = ntHelper record
{ η = λ X → counitη X ⟨$⟩ C.id
; commute = λ {X} {Y} f → begin
(counitη Y ⟨$⟩ C.id) ∘ L.F₁ (R.F₁ f) ≈˘⟨ identityˡ ⟩
id ∘ (counitη Y ⟨$⟩ C.id) ∘ L.F₁ (R.F₁ f) ≈˘⟨ ⇐.commute (R.F₁ f , D.id) C.Equiv.refl ⟩
⇐.η (R.F₀ X , Y) ⟨$⟩ (R.F₁ id C.∘ C.id C.∘ R.F₁ f) ≈⟨ cong (⇐.η (R.F₀ X , Y)) (C.Equiv.trans (MR.elimˡ C R.identity) C.identityˡ) ⟩
⇐.η (R.F₀ X , Y) ⟨$⟩ R.F₁ f ≈⟨ cong (⇐.η (R.F₀ X , Y)) (MR.introʳ C C.identityˡ) ⟩
⇐.η (R.F₀ X , Y) ⟨$⟩ (R.F₁ f C.∘ C.id C.∘ C.id) ≈⟨ ⇐.commute (C.id , f) C.Equiv.refl ⟩
f ∘ (counitη X ⟨$⟩ C.id) ∘ L.F₁ C.id ≈⟨ refl⟩∘⟨ elimʳ L.identity ⟩
f ∘ (counitη X ⟨$⟩ C.id) ∎
}
where open D
open HomReasoning
open MR D
Hom-NI⇒Adjoint : L ⊣ R
Hom-NI⇒Adjoint = record
{ unit = unit
; counit = counit
; zig = λ {A} →
let open D
open HomReasoning
open MR D
in begin
η counit (L.F₀ A) ∘ L.F₁ (η unit A) ≈˘⟨ identityˡ ⟩
id ∘ η counit (L.F₀ A) ∘ L.F₁ (η unit A) ≈˘⟨ ⇐.commute (η unit A , id) C.Equiv.refl ⟩
⇐.η (A , L.F₀ A) ⟨$⟩ (R.F₁ id C.∘ C.id C.∘ η unit A)
≈⟨ cong (⇐.η (A , L.F₀ A)) (C.Equiv.trans (MR.elimˡ C R.identity) C.identityˡ) ⟩
⇐.η (A , L.F₀ A) ⟨$⟩ η unit A ≈⟨ isoˡ refl ⟩
id
∎
; zag = λ {B} →
let open C
open HomReasoning
open MR C
in begin
R.F₁ (η counit B) ∘ η unit (R.F₀ B) ≈˘⟨ refl⟩∘⟨ identityʳ ⟩
R.F₁ (η counit B) ∘ η unit (R.F₀ B) ∘ id ≈˘⟨ ⇒.commute (id , η counit B) D.Equiv.refl ⟩
⇒.η (R.F₀ B , B) ⟨$⟩ (η counit B D.∘ D.id D.∘ L.F₁ id)
≈⟨ cong (⇒.η (R.F₀ B , B)) (MR.elimʳ D (MR.elimʳ D L.identity)) ⟩
⇒.η (R.F₀ B , B) ⟨$⟩ η counit B ≈⟨ isoʳ refl ⟩
id ∎
}
where module i {X} = Iso (iso X)
open i
-- the general case from isomorphic Hom setoids to adjoint functors
module _ {C : Category o ℓ e} {D : Category o′ ℓ′ e′} {L : Functor C D} {R : Functor D C} where
private
module C = Category C
module D = Category D
module L = Functor L
module R = Functor R
open Functor
open Π
Hom[L-,-] : Bifunctor C.op D (Setoids _ _)
Hom[L-,-] = LiftSetoids ℓ e ∘F Hom[ D ][-,-] ∘F (L.op ⁂ idF)
Hom[-,R-] : Bifunctor C.op D (Setoids _ _)
Hom[-,R-] = LiftSetoids ℓ′ e′ ∘F Hom[ C ][-,-] ∘F (idF ⁂ R)
module _ (Hni : Hom[L-,-] ≃ Hom[-,R-]) where
open NaturalIsomorphism Hni
private
unitη : ∀ X → F₀ Hom[L-,-] (X , L.F₀ X) ⟶ F₀ Hom[-,R-] (X , L.F₀ X)
unitη X = ⇒.η (X , L.F₀ X)
unit : NaturalTransformation idF (R ∘F L)
unit = ntHelper record
{ η = λ X → lower (unitη X ⟨$⟩ lift D.id)
; commute = λ {X Y} f → begin
lower (unitη Y ⟨$⟩ lift D.id) ∘ f
≈⟨ introˡ R.identity ⟩
R.F₁ D.id ∘ lower (unitη Y ⟨$⟩ lift D.id) ∘ f
≈˘⟨ lower (⇒.commute (f , D.id) (lift D.Equiv.refl)) ⟩
lower (⇒.η (X , L.F₀ Y) ⟨$⟩ lift (D.id D.∘ D.id D.∘ L.F₁ f))
≈⟨ lower (cong (⇒.η (X , L.F₀ Y)) (lift (D.Equiv.trans D.identityˡ D.identityˡ))) ⟩
lower (⇒.η (X , L.F₀ Y) ⟨$⟩ lift (L.F₁ f))
≈⟨ lower (cong (⇒.η (X , L.F₀ Y)) (lift (MR.introʳ D (MR.elimʳ D L.identity)))) ⟩
lower (⇒.η (X , L.F₀ Y) ⟨$⟩ lift (L.F₁ f D.∘ D.id D.∘ L.F₁ id))
≈⟨ lower (⇒.commute (C.id , L.F₁ f) (lift D.Equiv.refl)) ⟩
R.F₁ (L.F₁ f) ∘ lower (⇒.η (X , L.F₀ X) ⟨$⟩ lift D.id) ∘ id
≈⟨ refl⟩∘⟨ identityʳ ⟩
F₁ (R ∘F L) f ∘ lower (unitη X ⟨$⟩ lift D.id) ∎
}
where open C
open HomReasoning
open MR C
counitη : ∀ X → F₀ Hom[-,R-] (R.F₀ X , X) ⟶ F₀ Hom[L-,-] (R.F₀ X , X)
counitη X = ⇐.η (R.F₀ X , X)
counit : NaturalTransformation (L ∘F R) idF
counit = ntHelper record
{ η = λ X → lower (counitη X ⟨$⟩ lift C.id)
; commute = λ {X} {Y} f → begin
lower (⇐.η (R.F₀ Y , Y) ⟨$⟩ lift C.id) ∘ L.F₁ (R.F₁ f)
≈˘⟨ identityˡ ⟩
id ∘ lower (⇐.η (R.F₀ Y , Y) ⟨$⟩ lift C.id) ∘ L.F₁ (R.F₁ f)
≈˘⟨ lower (⇐.commute (R.F₁ f , D.id) (lift C.Equiv.refl)) ⟩
lower (⇐.η (R.F₀ X , Y) ⟨$⟩ lift (R.F₁ id C.∘ C.id C.∘ R.F₁ f))
≈⟨ lower (cong (⇐.η (R.F₀ X , Y)) (lift (C.Equiv.trans (MR.elimˡ C R.identity) C.identityˡ))) ⟩
lower (⇐.η (R.F₀ X , Y) ⟨$⟩ lift (R.F₁ f))
≈⟨ lower (cong (⇐.η (R.F₀ X , Y)) (lift (MR.introʳ C C.identityˡ))) ⟩
lower (⇐.η (R.F₀ X , Y) ⟨$⟩ lift (R.F₁ f C.∘ C.id C.∘ C.id))
≈⟨ lower (⇐.commute (C.id , f) (lift C.Equiv.refl)) ⟩
f ∘ lower (⇐.η (R.F₀ X , X) ⟨$⟩ lift C.id) ∘ L.F₁ C.id
≈⟨ refl⟩∘⟨ elimʳ L.identity ⟩
f ∘ lower (⇐.η (R.F₀ X , X) ⟨$⟩ lift C.id)
∎
}
where open D
open HomReasoning
open MR D
Hom-NI′⇒Adjoint : L ⊣ R
Hom-NI′⇒Adjoint = record
{ unit = unit
; counit = counit
; zig = λ {A} →
let open D
open HomReasoning
open MR D
in begin
lower (counitη (L.F₀ A) ⟨$⟩ lift C.id) ∘ L.F₁ (η unit A)
≈˘⟨ identityˡ ⟩
id ∘ lower (counitη (L.F₀ A) ⟨$⟩ lift C.id) ∘ L.F₁ (η unit A)
≈˘⟨ lower (⇐.commute (η unit A , id) (lift C.Equiv.refl)) ⟩
lower (⇐.η (A , L.F₀ A) ⟨$⟩ lift (R.F₁ id C.∘ C.id C.∘ lower (⇒.η (A , L.F₀ A) ⟨$⟩ lift id)))
≈⟨ lower (cong (⇐.η (A , L.F₀ A)) (lift (C.Equiv.trans (MR.elimˡ C R.identity) C.identityˡ))) ⟩
lower (⇐.η (A , L.F₀ A) ⟨$⟩ (⇒.η (A , L.F₀ A) ⟨$⟩ lift id))
≈⟨ lower (isoˡ (lift refl)) ⟩
id ∎
; zag = λ {B} →
let open C
open HomReasoning
open MR C
in begin
R.F₁ (lower (⇐.η (R.F₀ B , B) ⟨$⟩ lift id)) ∘ lower (⇒.η (R.F₀ B , L.F₀ (R.F₀ B)) ⟨$⟩ lift D.id)
≈˘⟨ refl⟩∘⟨ identityʳ ⟩
R.F₁ (lower (⇐.η (R.F₀ B , B) ⟨$⟩ lift id)) ∘ lower (⇒.η (R.F₀ B , L.F₀ (R.F₀ B)) ⟨$⟩ lift D.id) ∘ id
≈˘⟨ lower (⇒.commute (id , η counit B) (lift D.Equiv.refl)) ⟩
lower (⇒.η (R.F₀ B , B) ⟨$⟩ lift (lower (⇐.η (R.F₀ B , B) ⟨$⟩ lift id) D.∘ D.id D.∘ L.F₁ id))
≈⟨ lower (cong (⇒.η (R.F₀ B , B)) (lift (MR.elimʳ D (MR.elimʳ D L.identity)))) ⟩
lower (⇒.η (R.F₀ B , B) ⟨$⟩ lift (lower (⇐.η (R.F₀ B , B) ⟨$⟩ lift id)))
≈⟨ lower (isoʳ (lift refl)) ⟩
id ∎
}
where open NaturalTransformation
module _ {X} where
open Iso (iso X) public
⊣-id : idF {C = C} ⊣ idF {C = C}
⊣-id {C = C} = record
{ unit = F⇐G unitorˡ
; counit = F⇒G unitorʳ
; zig = identityˡ
; zag = identityʳ
}
where open Category C
open NaturalIsomorphism
-- Adjoints compose; we can't be sloppy, so associators and unitors must be inserted.
-- Use single letters in pairs, so L & M on the left, and R & S on the right
_∘⊣_ : {L : Functor C D} {R : Functor D C} {M : Functor D E} {S : Functor E D} →
L ⊣ R → M ⊣ S → (M ∘F L) ⊣ (R ∘F S)
_∘⊣_ {C = C} {D = D} {E = E} {L = L} {R} {M} {S} LR MS = record
{ unit = ((F⇐G (associator _ S R) ∘ᵥ R ∘ˡ (F⇒G (associator L M S))) ∘ᵥ
(R ∘ˡ (MSη′ ∘ʳ L)) ∘ᵥ (R ∘ˡ (F⇐G unitorˡ))) ∘ᵥ LRη′
; counit = MSε′ ∘ᵥ (((F⇒G (unitorʳ {F = M}) ∘ʳ S) ∘ᵥ ((M ∘ˡ LRε′) ∘ʳ S)) ∘ᵥ
(F⇒G (associator R L M) ∘ʳ S) ) ∘ᵥ F⇐G (associator S R (M ∘F L) )
; zig = λ {A} → zig′ {A}
; zag = λ {B} → zag′ {B}
}
where
open Functor
open NaturalTransformation
open NaturalIsomorphism
module LR = Adjoint LR renaming (unit to LRη′; counit to LRε′)
module MS = Adjoint MS renaming (unit to MSη′; counit to MSε′)
module LRη = NaturalTransformation (Adjoint.unit LR) renaming (η to ηLR)
module MSη = NaturalTransformation (Adjoint.unit MS) renaming (η to ηMS)
module LRε = NaturalTransformation (Adjoint.counit LR) renaming (η to εLR)
module MSε = NaturalTransformation (Adjoint.counit MS) renaming (η to εMS)
module C = Category C
module D = Category D
module E = Category E
module L = Functor L renaming (F₀ to L₀; F₁ to L₁)
module M = Functor M renaming (F₀ to M₀; F₁ to M₁)
module R = Functor R renaming (F₀ to R₀; F₁ to R₁)
module S = Functor S renaming (F₀ to S₀; F₁ to S₁)
open LR; open MS; open LRη; open LRε; open MSε; open MSη; open L; open M; open R; open S
zig′ : {A : C.Obj} → (εMS (M₀ (L₀ A)) E.∘
((E.id E.∘ M₁ (εLR (S₀ (M₀ (L₀ A))))) E.∘ E.id) E.∘ E.id)
E.∘ M₁ (L₁ (((C.id C.∘ R₁ D.id) C.∘ R₁ (ηMS (L₀ A)) C.∘ R₁ D.id) C.∘ ηLR A))
E.≈ E.id
-- use "inverted" format here, where rules are out-dented
zig′ {A} = begin
(εMS (M₀ (L₀ A)) E.∘ ((E.id E.∘ M₁ (εLR (S₀ (M₀ (L₀ A))))) E.∘ E.id) E.∘ E.id)
E.∘ M₁ (L₁ (((C.id C.∘ R₁ D.id) C.∘ R₁ (ηMS (L₀ A)) C.∘ R₁ D.id) C.∘ ηLR A))
≈⟨ ( refl⟩∘⟨ (E.identityʳ ○ E.identityʳ ○ E.identityˡ)) ⟩∘⟨refl ⟩ -- get rid of those pesky E.id
(εMS (M₀ (L₀ A)) E.∘ M₁ (εLR (S₀ (M₀ (L₀ A)))))
E.∘ M₁ (L₁ (((C.id C.∘ R₁ D.id) C.∘ R₁ (ηMS (L₀ A)) C.∘ R₁ D.id) C.∘ ηLR A))
≈⟨ E.assoc ○ E.∘-resp-≈ʳ (⟺ M.homomorphism) ⟩
εMS (M₀ (L₀ A)) E.∘
M₁ (εLR (S₀ (M₀ (L₀ A))) D.∘ L₁ (((C.id C.∘ R₁ D.id) C.∘ R₁ (ηMS (L₀ A)) C.∘ R₁ D.id) C.∘ ηLR A))
-- below: get rid of lots of pesky id. Nasty bit of nested equational reasoning, but nothing deep
≈⟨ refl⟩∘⟨ M.F-resp-≈ (D.∘-resp-≈ʳ (L.F-resp-≈
(C.∘-resp-≈ˡ (C.∘-resp-≈ C.identityˡ (C.∘-resp-≈ʳ R.identity) C.HomReasoning.○
let _⊚_ = C.HomReasoning._○_ in C.∘-resp-≈ R.identity C.identityʳ ⊚ C.identityˡ)))) ⟩
εMS (M₀ (L₀ A)) E.∘ M₁ (εLR (S₀ (M₀ (L₀ A))) D.∘ L₁ ((R₁ (ηMS (L₀ A))) C.∘ ηLR A))
≈⟨ refl⟩∘⟨ M.F-resp-≈ (D.∘-resp-≈ʳ L.homomorphism) ⟩
εMS (M₀ (L₀ A)) E.∘ M₁ (εLR (S₀ (M₀ (L₀ A))) D.∘ L₁ (R₁ (ηMS (L₀ A))) D.∘ L₁ (ηLR A))
≈˘⟨ refl⟩∘⟨ M.F-resp-≈ D.assoc ⟩
εMS (M₀ (L₀ A)) E.∘ M₁ ((εLR (S₀ (M₀ (L₀ A))) D.∘ L₁ (R₁ (ηMS (L₀ A)))) D.∘ L₁ (ηLR A))
≈⟨ refl⟩∘⟨ M.F-resp-≈ (D.∘-resp-≈ˡ (LRε.commute _)) ⟩
εMS (M₀ (L₀ A)) E.∘ M₁ ( (_ D.∘ εLR _) D.∘ L₁ (ηLR A))
≈⟨ refl⟩∘⟨ M.homomorphism ⟩
εMS (M₀ (L₀ A)) E.∘ M₁ (_ D.∘ εLR _) E.∘ M₁ (L₁ (ηLR A))
≈⟨ refl⟩∘⟨ ( M.homomorphism ⟩∘⟨refl ) ⟩
εMS (M₀ (L₀ A)) E.∘ (M₁ (ηMS (L₀ A)) E.∘ M₁ (εLR _)) E.∘ M₁ (L₁ (ηLR A))
≈˘⟨ E.assoc ○ E.∘-resp-≈ʳ (⟺ E.assoc) ⟩
(εMS (M₀ (L₀ A)) E.∘ M₁ (ηMS (L₀ A))) E.∘ (M₁ (εLR _) E.∘ M₁ (L₁ (ηLR A)))
≈⟨ MS.zig ⟩∘⟨refl ⟩
E.id E.∘ (M₁ (εLR _) E.∘ M₁ (L₁ (ηLR A)))
≈⟨ E.identityˡ ⟩
M₁ (εLR _) E.∘ M₁ (L₁ (ηLR A))
≈˘⟨ M.homomorphism ⟩
M₁ (εLR _ D.∘ L₁ (ηLR A))
≈⟨ M.F-resp-≈ LR.zig ○ M.identity ⟩
E.id ∎
where open E.HomReasoning
zag′ : {B : E.Obj} → R₁ (S₁ (εMS B E.∘ ((E.id E.∘ M₁ (εLR (S₀ B))) E.∘ E.id) E.∘ E.id))
C.∘ ((C.id C.∘ R₁ D.id) C.∘ R₁ (ηMS (L₀ (R₀ (S₀ B)))) C.∘ R₁ D.id) C.∘
ηLR (R₀ (S₀ B)) C.≈ C.id
zag′ {B} =
let _⊚_ = E.HomReasoning._○_ in
begin
R₁ (S₁ (εMS B E.∘ ((E.id E.∘ M₁ (εLR (S₀ B))) E.∘ E.id) E.∘ E.id))
C.∘ ((C.id C.∘ R₁ D.id) C.∘ R₁ (ηMS (L₀ (R₀ (S₀ B)))) C.∘ R₁ D.id) C.∘
ηLR (R₀ (S₀ B)) -- get rid of all those id
≈⟨ R.F-resp-≈ (S.F-resp-≈ (E.∘-resp-≈ʳ (E.identityʳ ⊚ (E.identityʳ ⊚ E.identityˡ)))) ⟩∘⟨
C.∘-resp-≈ˡ (C.∘-resp-≈ C.identityˡ (C.∘-resp-≈ʳ R.identity) ○
C.∘-resp-≈ R.identity C.identityʳ ○ C.identityˡ) ⟩
R₁ (S₁ (εMS B E.∘ M₁ (εLR (S₀ B)))) C.∘ R₁ (ηMS (L₀ (R₀ (S₀ B)))) C.∘ ηLR (R₀ (S₀ B))
≈˘⟨ C.assoc ⟩
(R₁ (S₁ (εMS B E.∘ M₁ (εLR (S₀ B)))) C.∘ R₁ (ηMS (L₀ (R₀ (S₀ B))))) C.∘ ηLR (R₀ (S₀ B))
≈˘⟨ R.homomorphism ⟩∘⟨refl ⟩
R₁ (S₁ (εMS B E.∘ M₁ (εLR (S₀ B))) D.∘ ηMS (L₀ (R₀ (S₀ B)))) C.∘ ηLR (R₀ (S₀ B))
≈⟨ R.F-resp-≈ (D.∘-resp-≈ˡ S.homomorphism) ⟩∘⟨refl ⟩
R₁ ((S₁ (εMS B) D.∘ (S₁ (M₁ (εLR (S₀ B))))) D.∘ ηMS (L₀ (R₀ (S₀ B)))) C.∘ ηLR (R₀ (S₀ B))
≈⟨ R.F-resp-≈ D.assoc ⟩∘⟨refl ⟩
R₁ (S₁ (εMS B) D.∘ S₁ (M₁ (εLR (S₀ B))) D.∘ ηMS (L₀ (R₀ (S₀ B)))) C.∘ ηLR (R₀ (S₀ B))
≈⟨ R.F-resp-≈ (D.∘-resp-≈ʳ (D.HomReasoning.⟺ (MSη.commute (εLR (S₀ B))))) ⟩∘⟨refl ⟩
R₁ (S₁ (εMS B) D.∘ ηMS (S₀ B) D.∘ εLR (S₀ B)) C.∘ ηLR (R₀ (S₀ B))
≈˘⟨ R.F-resp-≈ D.assoc ⟩∘⟨refl ⟩
R₁ ((S₁ (εMS B) D.∘ ηMS (S₀ B)) D.∘ εLR (S₀ B)) C.∘ ηLR (R₀ (S₀ B))
≈⟨ R.F-resp-≈ (D.∘-resp-≈ˡ MS.zag) ⟩∘⟨refl ⟩
R₁ (D.id D.∘ εLR (S₀ B)) C.∘ ηLR (R₀ (S₀ B))
≈⟨ C.∘-resp-≈ˡ (R.F-resp-≈ D.identityˡ) ⟩
R₁ (εLR (S₀ B)) C.∘ ηLR (R₀ (S₀ B))
≈⟨ LR.zag ⟩
C.id ∎
where open C.HomReasoning
|
src/natools-web-backends-filesystem.ads | faelys/natools-web | 1 | 18480 | <gh_stars>1-10
------------------------------------------------------------------------------
-- 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. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Natools.Web.Backends.Filesystem provides a very simple filesystem-based --
-- implementation of Natools.Web.Backends.Backend. --
------------------------------------------------------------------------------
with Natools.S_Expressions.Lockable;
private with Natools.S_Expressions.Atom_Refs;
package Natools.Web.Backends.Filesystem is
type File_Backend is new Backend with private;
overriding function Create
(Self : in out File_Backend;
Directory, Name : in S_Expressions.Atom)
return Ada.Streams.Root_Stream_Type'Class;
-- Create a new file, which must not exist previously
overriding procedure Delete
(Self : in out File_Backend;
Directory, Name : in S_Expressions.Atom);
-- Destroy a file, which must exist previously
overriding function Read
(Self : in File_Backend;
Directory, Name : in S_Expressions.Atom)
return Ada.Streams.Root_Stream_Type'Class;
-- Read the contents of an existing file
overriding function Append
(Self : in out File_Backend;
Directory, Name : in S_Expressions.Atom)
return Ada.Streams.Root_Stream_Type'Class;
-- Return a stream to append data to the given file
overriding function Overwrite
(Self : in out File_Backend;
Directory, Name : in S_Expressions.Atom)
return Ada.Streams.Root_Stream_Type'Class;
-- Reset the given file to empty and return a stream to write on it
overriding procedure Iterate
(Self : in File_Backend;
Directory : in S_Expressions.Atom;
Process : not null access procedure (Name : in S_Expressions.Atom));
-- Iterate over all the existing file names in Directory
not overriding function Create (Root : in String) return File_Backend;
function Create
(Arguments : in out S_Expressions.Lockable.Descriptor'Class)
return Backend'Class;
private
type File_Backend is new Backend with record
Root : S_Expressions.Atom_Refs.Immutable_Reference;
end record;
end Natools.Web.Backends.Filesystem;
|
source/league/ucd/matreshka-internals-unicode-ucd-core_0000.ads | svn2github/matreshka | 24 | 1117 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, <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$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_0000 is
pragma Preelaborate;
Group_0000 : aliased constant Core_Second_Stage
:= (16#09# => -- 0009
(Control, Neutral,
Control, Other, Sp, Break_After,
(Pattern_White_Space
| White_Space => True,
others => False)),
16#0A# => -- 000A
(Control, Neutral,
LF, LF, LF, Line_Feed,
(Pattern_White_Space
| White_Space => True,
others => False)),
16#0B# .. 16#0C# => -- 000B .. 000C
(Control, Neutral,
Control, Newline, Sp, Mandatory_Break,
(Pattern_White_Space
| White_Space => True,
others => False)),
16#0D# => -- 000D
(Control, Neutral,
CR, CR, CR, Carriage_Return,
(Pattern_White_Space
| White_Space => True,
others => False)),
16#20# => -- 0020
(Space_Separator, Narrow,
Other, Other, Sp, Space,
(Pattern_White_Space
| White_Space
| Grapheme_Base => True,
others => False)),
16#21# => -- 0021
(Other_Punctuation, Narrow,
Other, Other, S_Term, Exclamation,
(Pattern_Syntax
| STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#22# => -- 0022
(Other_Punctuation, Narrow,
Other, Double_Quote, Close, Quotation,
(Pattern_Syntax
| Quotation_Mark
| Grapheme_Base => True,
others => False)),
16#23# => -- 0023
(Other_Punctuation, Narrow,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#24# => -- 0024
(Currency_Symbol, Narrow,
Other, Other, Other, Prefix_Numeric,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#25# => -- 0025
(Other_Punctuation, Narrow,
Other, Other, Other, Postfix_Numeric,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#26# => -- 0026
(Other_Punctuation, Narrow,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#27# => -- 0027
(Other_Punctuation, Narrow,
Other, Single_Quote, Close, Quotation,
(Pattern_Syntax
| Quotation_Mark
| Case_Ignorable
| Grapheme_Base => True,
others => False)),
16#28# => -- 0028
(Open_Punctuation, Narrow,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#29# => -- 0029
(Close_Punctuation, Narrow,
Other, Other, Close, Close_Parenthesis,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#2A# => -- 002A
(Other_Punctuation, Narrow,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#2B# => -- 002B
(Math_Symbol, Narrow,
Other, Other, Other, Prefix_Numeric,
(Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#2C# => -- 002C
(Other_Punctuation, Narrow,
Other, Mid_Num, S_Continue, Infix_Numeric,
(Pattern_Syntax
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#2D# => -- 002D
(Dash_Punctuation, Narrow,
Other, Other, S_Continue, Hyphen,
(Dash
| Hyphen
| Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#2E# => -- 002E
(Other_Punctuation, Narrow,
Other, Mid_Num_Let, A_Term, Infix_Numeric,
(Pattern_Syntax
| STerm
| Terminal_Punctuation
| Case_Ignorable
| Grapheme_Base => True,
others => False)),
16#2F# => -- 002F
(Other_Punctuation, Narrow,
Other, Other, Other, Break_Symbols,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#30# .. 16#39# => -- 0030 .. 0039
(Decimal_Number, Narrow,
Other, Numeric, Numeric, Numeric,
(ASCII_Hex_Digit
| Hex_Digit
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#3A# => -- 003A
(Other_Punctuation, Narrow,
Other, Mid_Letter, S_Continue, Infix_Numeric,
(Pattern_Syntax
| Terminal_Punctuation
| Case_Ignorable
| Grapheme_Base => True,
others => False)),
16#3B# => -- 003B
(Other_Punctuation, Narrow,
Other, Mid_Num, Other, Infix_Numeric,
(Pattern_Syntax
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#3C# .. 16#3E# => -- 003C .. 003E
(Math_Symbol, Narrow,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#3F# => -- 003F
(Other_Punctuation, Narrow,
Other, Other, S_Term, Exclamation,
(Pattern_Syntax
| STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#40# => -- 0040
(Other_Punctuation, Narrow,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#41# .. 16#46# => -- 0041 .. 0046
(Uppercase_Letter, Narrow,
Other, A_Letter, Upper, Alphabetic,
(ASCII_Hex_Digit
| Hex_Digit
| Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#47# .. 16#5A# => -- 0047 .. 005A
(Uppercase_Letter, Narrow,
Other, A_Letter, Upper, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#5B# => -- 005B
(Open_Punctuation, Narrow,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#5C# => -- 005C
(Other_Punctuation, Narrow,
Other, Other, Other, Prefix_Numeric,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#5D# => -- 005D
(Close_Punctuation, Narrow,
Other, Other, Close, Close_Parenthesis,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#5E# => -- 005E
(Modifier_Symbol, Narrow,
Other, Other, Other, Alphabetic,
(Diacritic
| Other_Math
| Pattern_Syntax
| Case_Ignorable
| Grapheme_Base
| Math => True,
others => False)),
16#5F# => -- 005F
(Connector_Punctuation, Narrow,
Other, Extend_Num_Let, Other, Alphabetic,
(Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#60# => -- 0060
(Modifier_Symbol, Narrow,
Other, Other, Other, Alphabetic,
(Diacritic
| Pattern_Syntax
| Case_Ignorable
| Grapheme_Base => True,
others => False)),
16#61# .. 16#66# => -- 0061 .. 0066
(Lowercase_Letter, Narrow,
Other, A_Letter, Lower, Alphabetic,
(ASCII_Hex_Digit
| Hex_Digit
| Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#67# .. 16#68# => -- 0067 .. 0068
(Lowercase_Letter, Narrow,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#69# .. 16#6A# => -- 0069 .. 006A
(Lowercase_Letter, Narrow,
Other, A_Letter, Lower, Alphabetic,
(Soft_Dotted
| Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#6B# .. 16#7A# => -- 006B .. 007A
(Lowercase_Letter, Narrow,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#7B# => -- 007B
(Open_Punctuation, Narrow,
Other, Other, Close, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#7C# => -- 007C
(Math_Symbol, Narrow,
Other, Other, Other, Break_After,
(Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#7D# => -- 007D
(Close_Punctuation, Narrow,
Other, Other, Close, Close_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#7E# => -- 007E
(Math_Symbol, Narrow,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#85# => -- 0085
(Control, Neutral,
Control, Newline, Sep, Next_Line,
(Pattern_White_Space
| White_Space => True,
others => False)),
16#A0# => -- 00A0
(Space_Separator, Neutral,
Other, Other, Sp, Glue,
(White_Space
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#A1# => -- 00A1
(Other_Punctuation, Ambiguous,
Other, Other, Other, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#A2# => -- 00A2
(Currency_Symbol, Narrow,
Other, Other, Other, Postfix_Numeric,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#A3# => -- 00A3
(Currency_Symbol, Narrow,
Other, Other, Other, Prefix_Numeric,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#A4# => -- 00A4
(Currency_Symbol, Ambiguous,
Other, Other, Other, Prefix_Numeric,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#A5# => -- 00A5
(Currency_Symbol, Narrow,
Other, Other, Other, Prefix_Numeric,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#A6# => -- 00A6
(Other_Symbol, Narrow,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#A7# => -- 00A7
(Other_Punctuation, Ambiguous,
Other, Other, Other, Ambiguous,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#A8# => -- 00A8
(Modifier_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Diacritic
| Case_Ignorable
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#A9# => -- 00A9
(Other_Symbol, Neutral,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#AA# => -- 00AA
(Other_Letter, Ambiguous,
Other, A_Letter, Lower, Ambiguous,
(Other_Lowercase
| Alphabetic
| Cased
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#AB# => -- 00AB
(Initial_Punctuation, Neutral,
Other, Other, Close, Quotation,
(Pattern_Syntax
| Quotation_Mark
| Grapheme_Base => True,
others => False)),
16#AC# => -- 00AC
(Math_Symbol, Narrow,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#AD# => -- 00AD
(Format, Ambiguous,
Control, Format, Format, Break_After,
(Hyphen
| Case_Ignorable
| Default_Ignorable_Code_Point
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#AE# => -- 00AE
(Other_Symbol, Ambiguous,
Other, Other, Other, Alphabetic,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#AF# => -- 00AF
(Modifier_Symbol, Narrow,
Other, Other, Other, Alphabetic,
(Diacritic
| Case_Ignorable
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#B0# => -- 00B0
(Other_Symbol, Ambiguous,
Other, Other, Other, Postfix_Numeric,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#B1# => -- 00B1
(Math_Symbol, Ambiguous,
Other, Other, Other, Prefix_Numeric,
(Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#B2# .. 16#B3# => -- 00B2 .. 00B3
(Other_Number, Ambiguous,
Other, Other, Other, Ambiguous,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#B4# => -- 00B4
(Modifier_Symbol, Ambiguous,
Other, Other, Other, Break_Before,
(Diacritic
| Case_Ignorable
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#B5# => -- 00B5
(Lowercase_Letter, Neutral,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#B6# => -- 00B6
(Other_Punctuation, Ambiguous,
Other, Other, Other, Ambiguous,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#B7# => -- 00B7
(Other_Punctuation, Ambiguous,
Other, Mid_Letter, Other, Ambiguous,
(Diacritic
| Extender
| Other_ID_Continue
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#B8# => -- 00B8
(Modifier_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Diacritic
| Case_Ignorable
| Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#B9# => -- 00B9
(Other_Number, Ambiguous,
Other, Other, Other, Ambiguous,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#BA# => -- 00BA
(Other_Letter, Ambiguous,
Other, A_Letter, Lower, Ambiguous,
(Other_Lowercase
| Alphabetic
| Cased
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#BB# => -- 00BB
(Final_Punctuation, Neutral,
Other, Other, Close, Quotation,
(Pattern_Syntax
| Quotation_Mark
| Grapheme_Base => True,
others => False)),
16#BC# .. 16#BE# => -- 00BC .. 00BE
(Other_Number, Ambiguous,
Other, Other, Other, Ambiguous,
(Grapheme_Base
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#BF# => -- 00BF
(Other_Punctuation, Ambiguous,
Other, Other, Other, Open_Punctuation,
(Pattern_Syntax
| Grapheme_Base => True,
others => False)),
16#C0# .. 16#C5# => -- 00C0 .. 00C5
(Uppercase_Letter, Neutral,
Other, A_Letter, Upper, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#C6# => -- 00C6
(Uppercase_Letter, Ambiguous,
Other, A_Letter, Upper, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#C7# .. 16#CF# => -- 00C7 .. 00CF
(Uppercase_Letter, Neutral,
Other, A_Letter, Upper, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#D0# => -- 00D0
(Uppercase_Letter, Ambiguous,
Other, A_Letter, Upper, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#D1# .. 16#D6# => -- 00D1 .. 00D6
(Uppercase_Letter, Neutral,
Other, A_Letter, Upper, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#D7# => -- 00D7
(Math_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#D8# => -- 00D8
(Uppercase_Letter, Ambiguous,
Other, A_Letter, Upper, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#D9# .. 16#DD# => -- 00D9 .. 00DD
(Uppercase_Letter, Neutral,
Other, A_Letter, Upper, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#DE# => -- 00DE
(Uppercase_Letter, Ambiguous,
Other, A_Letter, Upper, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Lowercased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Uppercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#DF# => -- 00DF
(Lowercase_Letter, Ambiguous,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casefolded
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start
| Changes_When_NFKC_Casefolded => True,
others => False)),
16#E0# .. 16#E1# => -- 00E0 .. 00E1
(Lowercase_Letter, Ambiguous,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#E2# .. 16#E5# => -- 00E2 .. 00E5
(Lowercase_Letter, Neutral,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#E6# => -- 00E6
(Lowercase_Letter, Ambiguous,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#E7# => -- 00E7
(Lowercase_Letter, Neutral,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#E8# .. 16#EA# => -- 00E8 .. 00EA
(Lowercase_Letter, Ambiguous,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#EB# => -- 00EB
(Lowercase_Letter, Neutral,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#EC# .. 16#ED# => -- 00EC .. 00ED
(Lowercase_Letter, Ambiguous,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#EE# .. 16#EF# => -- 00EE .. 00EF
(Lowercase_Letter, Neutral,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#F0# => -- 00F0
(Lowercase_Letter, Ambiguous,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#F1# => -- 00F1
(Lowercase_Letter, Neutral,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#F2# .. 16#F3# => -- 00F2 .. 00F3
(Lowercase_Letter, Ambiguous,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#F4# .. 16#F6# => -- 00F4 .. 00F6
(Lowercase_Letter, Neutral,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#F7# => -- 00F7
(Math_Symbol, Ambiguous,
Other, Other, Other, Ambiguous,
(Pattern_Syntax
| Grapheme_Base
| Math => True,
others => False)),
16#F8# .. 16#FA# => -- 00F8 .. 00FA
(Lowercase_Letter, Ambiguous,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#FB# => -- 00FB
(Lowercase_Letter, Neutral,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#FC# => -- 00FC
(Lowercase_Letter, Ambiguous,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#FD# => -- 00FD
(Lowercase_Letter, Neutral,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#FE# => -- 00FE
(Lowercase_Letter, Ambiguous,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
16#FF# => -- 00FF
(Lowercase_Letter, Neutral,
Other, A_Letter, Lower, Alphabetic,
(Alphabetic
| Cased
| Changes_When_Uppercased
| Changes_When_Titlecased
| Changes_When_Casemapped
| Grapheme_Base
| ID_Continue
| ID_Start
| Lowercase
| XID_Continue
| XID_Start => True,
others => False)),
others =>
(Control, Neutral,
Control, Other, Other, Combining_Mark,
(others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_0000;
|
005.BootSectorFuncStrings/main.asm | mukeshmike9/AssemblyBootSector | 1 | 5904 | [org 0x7c00]
mov bx, OS_NAME
call print
call print_nl
mov bx, AUTHOR_NAME
call print
call print_nl
mov dx, 0x12fe
call print_hex
call print_nl
jmp $
; Subroutines inclusion
%include "boot_sect_print.asm"
%include "boot_sect_print_hex.asm"
; Data Segment
OS_NAME:
db 'TindaOS', 0
AUTHOR_NAME:
db '<NAME>', 0
; Padding and magic number
times 510 - ($ - $$) db 0
dw 0xAA55
|
Univalence/OldUnivalence/UnivalenceFiniteTypes.agda | JacquesCarette/pi-dual | 14 | 13310 | <filename>Univalence/OldUnivalence/UnivalenceFiniteTypes.agda
{-# OPTIONS --without-K #-}
module UnivalenceFiniteTypes where
open import Data.Empty
open import Data.Unit
open import Data.Unit.Core
open import Data.Nat renaming (_⊔_ to _⊔ℕ_)
open import Data.Sum renaming (map to _⊎→_)
open import Data.Product renaming (map to _×→_)
open import Function renaming (_∘_ to _○_)
open import FT
open import SimpleHoTT
open import Equivalences
open import TypeEquivalences
open import Path2Equiv
open import FT-Nat
open import Inspect
open import LeftCancellation
open import Equiv2Path
-- univalence
{- This does not typecheck in reasonable time.
univalence₁ : {B₁ B₂ : FT} →
(e : ⟦ B₁ ⟧ ≃ ⟦ B₂ ⟧) → path2equiv (equiv2path e) ≡ e
univalence₁ {B₁} {B₂} (f , feq) with equiv₂ feq
... | mkqinv g α β = {!!}
-}
-- and this can't possibly be true!
-- note that even the "normal form" of equiv2path idequiv (ctrl-C ctrl-N)
-- is an absolutely enormous term.
univalence₂ : {B₁ B₂ : FT} → (p : B₁ ⇛ B₂) → equiv2path (path2equiv p) ≡ p
univalence₂ unite₊⇛ = {!!}
univalence₂ uniti₊⇛ = {!!}
univalence₂ swap₊⇛ = {!!}
univalence₂ assocl₊⇛ = {!!}
univalence₂ assocr₊⇛ = {!!}
univalence₂ unite⋆⇛ = {!!}
univalence₂ uniti⋆⇛ = {!!}
univalence₂ swap⋆⇛ = {!!}
univalence₂ assocl⋆⇛ = {!!}
univalence₂ assocr⋆⇛ = {!!}
univalence₂ distz⇛ = {!!}
univalence₂ factorz⇛ = {!!}
univalence₂ dist⇛ = {!!}
univalence₂ factor⇛ = {!!}
univalence₂ id⇛ = {!!}
univalence₂ (sym⇛ p) = {!!}
univalence₂ (p ◎ q) = {!!}
univalence₂ (p ⊕ q) = {!!}
univalence₂ (p ⊗ q) = {!!}
{-
univalence : {B₁ B₂ : FT} → (B₁ ⇛ B₂) ≃ (⟦ B₁ ⟧ ≃ ⟦ B₂ ⟧)
univalence =
(path2equiv , equiv₁ (mkqinv equiv2path univalence₁ univalence₂))
-} |
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_56.asm | ljhsiun2/medusa | 9 | 242928 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x2aa4, %rsi
lea addresses_UC_ht+0x199a4, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
mfence
mov $75, %rcx
rep movsq
sub $11239, %r9
lea addresses_D_ht+0x22a4, %r12
xor %rdi, %rdi
mov (%r12), %ecx
nop
nop
cmp %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r15
push %r9
push %rax
// Faulty Load
lea addresses_RW+0x17da4, %r11
cmp %r14, %r14
vmovups (%r11), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %rax
lea oracles, %r13
and $0xff, %rax
shlq $12, %rax
mov (%r13,%rax,1), %rax
pop %rax
pop %r9
pop %r15
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': True, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 8, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'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
*/
|
libsrc/graphics/ticalc/bksave.asm | meesokim/z88dk | 0 | 103806 | ;
; Fast background save
;
; TI calculators version
;
;
; $Id: bksave.asm,v 1.6 2015/01/19 01:32:51 pauloscustodio Exp $
;
PUBLIC bksave
EXTERN pixeladdress
INCLUDE "graphics/grafix.inc"
.bksave
ld hl,2
add hl,sp
ld e,(hl)
inc hl
ld d,(hl) ;sprite address
push de
pop ix
inc hl
ld e,(hl)
inc hl
inc hl
ld d,(hl) ; x and y coords
ld h,d
ld l,e
call pixeladdress
xor 7
ld h,d
ld l,e
ld (ix+2),h ; we save the current sprite position
ld (ix+3),l
ld a,(ix+0)
ld b,(ix+1)
dec a
srl a
srl a
srl a
inc a
inc a ; INT ((Xsize-1)/8+2)
ld (rbytes+1),a
._sloop
push bc
push hl
.rbytes
ld b,0
.rloop
ld a,(hl)
ld (ix+4),a
inc hl
inc ix
djnz rloop
pop hl
ld bc,row_bytes ;Go to next line
add hl,bc
pop bc
djnz _sloop
ret
|
wc.asm | shahendahamdy/xv6 | 0 | 23102 | <reponame>shahendahamdy/xv6
_wc: file format elf32-i386
Disassembly of section .text:
00001000 <main>:
printf(1, "%d %d %d %s\n", l, w, c, name);
}
int
main(int argc, char *argv[])
{
1000: f3 0f 1e fb endbr32
1004: 8d 4c 24 04 lea 0x4(%esp),%ecx
1008: 83 e4 f0 and $0xfffffff0,%esp
100b: ff 71 fc pushl -0x4(%ecx)
100e: 55 push %ebp
100f: 89 e5 mov %esp,%ebp
1011: 57 push %edi
1012: 56 push %esi
1013: be 01 00 00 00 mov $0x1,%esi
1018: 53 push %ebx
1019: 51 push %ecx
101a: 83 ec 18 sub $0x18,%esp
101d: 8b 01 mov (%ecx),%eax
101f: 8b 59 04 mov 0x4(%ecx),%ebx
1022: 89 45 e4 mov %eax,-0x1c(%ebp)
1025: 83 c3 04 add $0x4,%ebx
int fd, i;
if(argc <= 1){
1028: 83 f8 01 cmp $0x1,%eax
102b: 7e 52 jle 107f <main+0x7f>
102d: 8d 76 00 lea 0x0(%esi),%esi
wc(0, "");
exit();
}
for(i = 1; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
1030: 83 ec 08 sub $0x8,%esp
1033: 6a 00 push $0x0
1035: ff 33 pushl (%ebx)
1037: e8 41 06 00 00 call 167d <open>
103c: 83 c4 10 add $0x10,%esp
103f: 89 c7 mov %eax,%edi
1041: 85 c0 test %eax,%eax
1043: 78 26 js 106b <main+0x6b>
printf(1, "wc: cannot open %s\n", argv[i]);
exit();
}
wc(fd, argv[i]);
1045: 83 ec 08 sub $0x8,%esp
1048: ff 33 pushl (%ebx)
for(i = 1; i < argc; i++){
104a: 83 c6 01 add $0x1,%esi
104d: 83 c3 04 add $0x4,%ebx
wc(fd, argv[i]);
1050: 50 push %eax
1051: e8 4a 00 00 00 call 10a0 <wc>
close(fd);
1056: 89 3c 24 mov %edi,(%esp)
1059: e8 07 06 00 00 call 1665 <close>
for(i = 1; i < argc; i++){
105e: 83 c4 10 add $0x10,%esp
1061: 39 75 e4 cmp %esi,-0x1c(%ebp)
1064: 75 ca jne 1030 <main+0x30>
}
exit();
1066: e8 d2 05 00 00 call 163d <exit>
printf(1, "wc: cannot open %s\n", argv[i]);
106b: 50 push %eax
106c: ff 33 pushl (%ebx)
106e: 68 bb 19 00 00 push $0x19bb
1073: 6a 01 push $0x1
1075: e8 56 07 00 00 call 17d0 <printf>
exit();
107a: e8 be 05 00 00 call 163d <exit>
wc(0, "");
107f: 52 push %edx
1080: 52 push %edx
1081: 68 ad 19 00 00 push $0x19ad
1086: 6a 00 push $0x0
1088: e8 13 00 00 00 call 10a0 <wc>
exit();
108d: e8 ab 05 00 00 call 163d <exit>
1092: 66 90 xchg %ax,%ax
1094: 66 90 xchg %ax,%ax
1096: 66 90 xchg %ax,%ax
1098: 66 90 xchg %ax,%ax
109a: 66 90 xchg %ax,%ax
109c: 66 90 xchg %ax,%ax
109e: 66 90 xchg %ax,%ax
000010a0 <wc>:
{
10a0: f3 0f 1e fb endbr32
10a4: 55 push %ebp
10a5: 89 e5 mov %esp,%ebp
10a7: 57 push %edi
10a8: 56 push %esi
10a9: 53 push %ebx
l = w = c = 0;
10aa: 31 db xor %ebx,%ebx
{
10ac: 83 ec 1c sub $0x1c,%esp
inword = 0;
10af: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
l = w = c = 0;
10b6: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
10bd: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
10c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while((n = read(fd, buf, sizeof(buf))) > 0){
10c8: 83 ec 04 sub $0x4,%esp
10cb: 68 00 02 00 00 push $0x200
10d0: 68 80 1d 00 00 push $0x1d80
10d5: ff 75 08 pushl 0x8(%ebp)
10d8: e8 78 05 00 00 call 1655 <read>
10dd: 83 c4 10 add $0x10,%esp
10e0: 89 c6 mov %eax,%esi
10e2: 85 c0 test %eax,%eax
10e4: 7e 62 jle 1148 <wc+0xa8>
for(i=0; i<n; i++){
10e6: 31 ff xor %edi,%edi
10e8: eb 14 jmp 10fe <wc+0x5e>
10ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
inword = 0;
10f0: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
for(i=0; i<n; i++){
10f7: 83 c7 01 add $0x1,%edi
10fa: 39 fe cmp %edi,%esi
10fc: 74 42 je 1140 <wc+0xa0>
if(buf[i] == '\n')
10fe: 0f be 87 80 1d 00 00 movsbl 0x1d80(%edi),%eax
l++;
1105: 31 c9 xor %ecx,%ecx
1107: 3c 0a cmp $0xa,%al
1109: 0f 94 c1 sete %cl
if(strchr(" \r\t\n\v", buf[i]))
110c: 83 ec 08 sub $0x8,%esp
110f: 50 push %eax
l++;
1110: 01 cb add %ecx,%ebx
if(strchr(" \r\t\n\v", buf[i]))
1112: 68 98 19 00 00 push $0x1998
1117: e8 54 01 00 00 call 1270 <strchr>
111c: 83 c4 10 add $0x10,%esp
111f: 85 c0 test %eax,%eax
1121: 75 cd jne 10f0 <wc+0x50>
else if(!inword){
1123: 8b 55 e4 mov -0x1c(%ebp),%edx
1126: 85 d2 test %edx,%edx
1128: 75 cd jne 10f7 <wc+0x57>
for(i=0; i<n; i++){
112a: 83 c7 01 add $0x1,%edi
w++;
112d: 83 45 e0 01 addl $0x1,-0x20(%ebp)
inword = 1;
1131: c7 45 e4 01 00 00 00 movl $0x1,-0x1c(%ebp)
for(i=0; i<n; i++){
1138: 39 fe cmp %edi,%esi
113a: 75 c2 jne 10fe <wc+0x5e>
113c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1140: 01 75 dc add %esi,-0x24(%ebp)
1143: eb 83 jmp 10c8 <wc+0x28>
1145: 8d 76 00 lea 0x0(%esi),%esi
if(n < 0){
1148: 75 24 jne 116e <wc+0xce>
printf(1, "%d %d %d %s\n", l, w, c, name);
114a: 83 ec 08 sub $0x8,%esp
114d: ff 75 0c pushl 0xc(%ebp)
1150: ff 75 dc pushl -0x24(%ebp)
1153: ff 75 e0 pushl -0x20(%ebp)
1156: 53 push %ebx
1157: 68 ae 19 00 00 push $0x19ae
115c: 6a 01 push $0x1
115e: e8 6d 06 00 00 call 17d0 <printf>
}
1163: 83 c4 20 add $0x20,%esp
1166: 8d 65 f4 lea -0xc(%ebp),%esp
1169: 5b pop %ebx
116a: 5e pop %esi
116b: 5f pop %edi
116c: 5d pop %ebp
116d: c3 ret
printf(1, "wc: read error\n");
116e: 50 push %eax
116f: 50 push %eax
1170: 68 9e 19 00 00 push $0x199e
1175: 6a 01 push $0x1
1177: e8 54 06 00 00 call 17d0 <printf>
exit();
117c: e8 bc 04 00 00 call 163d <exit>
1181: 66 90 xchg %ax,%ax
1183: 66 90 xchg %ax,%ax
1185: 66 90 xchg %ax,%ax
1187: 66 90 xchg %ax,%ax
1189: 66 90 xchg %ax,%ax
118b: 66 90 xchg %ax,%ax
118d: 66 90 xchg %ax,%ax
118f: 90 nop
00001190 <strcpy>:
};
char*
strcpy(char *s, const char *t)
{
1190: f3 0f 1e fb endbr32
1194: 55 push %ebp
char *os;
os = s;
while((*s++ = *t++) != 0)
1195: 31 c0 xor %eax,%eax
{
1197: 89 e5 mov %esp,%ebp
1199: 53 push %ebx
119a: 8b 4d 08 mov 0x8(%ebp),%ecx
119d: 8b 5d 0c mov 0xc(%ebp),%ebx
while((*s++ = *t++) != 0)
11a0: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx
11a4: 88 14 01 mov %dl,(%ecx,%eax,1)
11a7: 83 c0 01 add $0x1,%eax
11aa: 84 d2 test %dl,%dl
11ac: 75 f2 jne 11a0 <strcpy+0x10>
;
return os;
}
11ae: 89 c8 mov %ecx,%eax
11b0: 5b pop %ebx
11b1: 5d pop %ebp
11b2: c3 ret
11b3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
11ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000011c0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
11c0: f3 0f 1e fb endbr32
11c4: 55 push %ebp
11c5: 89 e5 mov %esp,%ebp
11c7: 53 push %ebx
11c8: 8b 4d 08 mov 0x8(%ebp),%ecx
11cb: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
11ce: 0f b6 01 movzbl (%ecx),%eax
11d1: 0f b6 1a movzbl (%edx),%ebx
11d4: 84 c0 test %al,%al
11d6: 75 19 jne 11f1 <strcmp+0x31>
11d8: eb 26 jmp 1200 <strcmp+0x40>
11da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
11e0: 0f b6 41 01 movzbl 0x1(%ecx),%eax
p++, q++;
11e4: 83 c1 01 add $0x1,%ecx
11e7: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
11ea: 0f b6 1a movzbl (%edx),%ebx
11ed: 84 c0 test %al,%al
11ef: 74 0f je 1200 <strcmp+0x40>
11f1: 38 d8 cmp %bl,%al
11f3: 74 eb je 11e0 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
11f5: 29 d8 sub %ebx,%eax
}
11f7: 5b pop %ebx
11f8: 5d pop %ebp
11f9: c3 ret
11fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1200: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
1202: 29 d8 sub %ebx,%eax
}
1204: 5b pop %ebx
1205: 5d pop %ebp
1206: c3 ret
1207: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
120e: 66 90 xchg %ax,%ax
00001210 <strlen>:
uint
strlen(const char *s)
{
1210: f3 0f 1e fb endbr32
1214: 55 push %ebp
1215: 89 e5 mov %esp,%ebp
1217: 8b 55 08 mov 0x8(%ebp),%edx
int n;
for(n = 0; s[n]; n++)
121a: 80 3a 00 cmpb $0x0,(%edx)
121d: 74 21 je 1240 <strlen+0x30>
121f: 31 c0 xor %eax,%eax
1221: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1228: 83 c0 01 add $0x1,%eax
122b: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
122f: 89 c1 mov %eax,%ecx
1231: 75 f5 jne 1228 <strlen+0x18>
;
return n;
}
1233: 89 c8 mov %ecx,%eax
1235: 5d pop %ebp
1236: c3 ret
1237: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
123e: 66 90 xchg %ax,%ax
for(n = 0; s[n]; n++)
1240: 31 c9 xor %ecx,%ecx
}
1242: 5d pop %ebp
1243: 89 c8 mov %ecx,%eax
1245: c3 ret
1246: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
124d: 8d 76 00 lea 0x0(%esi),%esi
00001250 <memset>:
void*
memset(void *dst, int c, uint n)
{
1250: f3 0f 1e fb endbr32
1254: 55 push %ebp
1255: 89 e5 mov %esp,%ebp
1257: 57 push %edi
1258: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
125b: 8b 4d 10 mov 0x10(%ebp),%ecx
125e: 8b 45 0c mov 0xc(%ebp),%eax
1261: 89 d7 mov %edx,%edi
1263: fc cld
1264: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
1266: 89 d0 mov %edx,%eax
1268: 5f pop %edi
1269: 5d pop %ebp
126a: c3 ret
126b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
126f: 90 nop
00001270 <strchr>:
char*
strchr(const char *s, char c)
{
1270: f3 0f 1e fb endbr32
1274: 55 push %ebp
1275: 89 e5 mov %esp,%ebp
1277: 8b 45 08 mov 0x8(%ebp),%eax
127a: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
127e: 0f b6 10 movzbl (%eax),%edx
1281: 84 d2 test %dl,%dl
1283: 75 16 jne 129b <strchr+0x2b>
1285: eb 21 jmp 12a8 <strchr+0x38>
1287: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
128e: 66 90 xchg %ax,%ax
1290: 0f b6 50 01 movzbl 0x1(%eax),%edx
1294: 83 c0 01 add $0x1,%eax
1297: 84 d2 test %dl,%dl
1299: 74 0d je 12a8 <strchr+0x38>
if(*s == c)
129b: 38 d1 cmp %dl,%cl
129d: 75 f1 jne 1290 <strchr+0x20>
return (char*)s;
return 0;
}
129f: 5d pop %ebp
12a0: c3 ret
12a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return 0;
12a8: 31 c0 xor %eax,%eax
}
12aa: 5d pop %ebp
12ab: c3 ret
12ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000012b0 <gets>:
char*
gets(char *buf, int max)
{
12b0: f3 0f 1e fb endbr32
12b4: 55 push %ebp
12b5: 89 e5 mov %esp,%ebp
12b7: 57 push %edi
12b8: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
12b9: 31 f6 xor %esi,%esi
{
12bb: 53 push %ebx
12bc: 89 f3 mov %esi,%ebx
12be: 83 ec 1c sub $0x1c,%esp
12c1: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
12c4: eb 33 jmp 12f9 <gets+0x49>
12c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
12cd: 8d 76 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
12d0: 83 ec 04 sub $0x4,%esp
12d3: 8d 45 e7 lea -0x19(%ebp),%eax
12d6: 6a 01 push $0x1
12d8: 50 push %eax
12d9: 6a 00 push $0x0
12db: e8 75 03 00 00 call 1655 <read>
if(cc < 1)
12e0: 83 c4 10 add $0x10,%esp
12e3: 85 c0 test %eax,%eax
12e5: 7e 1c jle 1303 <gets+0x53>
break;
buf[i++] = c;
12e7: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
12eb: 83 c7 01 add $0x1,%edi
12ee: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
12f1: 3c 0a cmp $0xa,%al
12f3: 74 23 je 1318 <gets+0x68>
12f5: 3c 0d cmp $0xd,%al
12f7: 74 1f je 1318 <gets+0x68>
for(i=0; i+1 < max; ){
12f9: 83 c3 01 add $0x1,%ebx
12fc: 89 fe mov %edi,%esi
12fe: 3b 5d 0c cmp 0xc(%ebp),%ebx
1301: 7c cd jl 12d0 <gets+0x20>
1303: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
1305: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
1308: c6 03 00 movb $0x0,(%ebx)
}
130b: 8d 65 f4 lea -0xc(%ebp),%esp
130e: 5b pop %ebx
130f: 5e pop %esi
1310: 5f pop %edi
1311: 5d pop %ebp
1312: c3 ret
1313: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1317: 90 nop
1318: 8b 75 08 mov 0x8(%ebp),%esi
131b: 8b 45 08 mov 0x8(%ebp),%eax
131e: 01 de add %ebx,%esi
1320: 89 f3 mov %esi,%ebx
buf[i] = '\0';
1322: c6 03 00 movb $0x0,(%ebx)
}
1325: 8d 65 f4 lea -0xc(%ebp),%esp
1328: 5b pop %ebx
1329: 5e pop %esi
132a: 5f pop %edi
132b: 5d pop %ebp
132c: c3 ret
132d: 8d 76 00 lea 0x0(%esi),%esi
00001330 <stat>:
int
stat(const char *n, struct stat *st)
{
1330: f3 0f 1e fb endbr32
1334: 55 push %ebp
1335: 89 e5 mov %esp,%ebp
1337: 56 push %esi
1338: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
1339: 83 ec 08 sub $0x8,%esp
133c: 6a 00 push $0x0
133e: ff 75 08 pushl 0x8(%ebp)
1341: e8 37 03 00 00 call 167d <open>
if(fd < 0)
1346: 83 c4 10 add $0x10,%esp
1349: 85 c0 test %eax,%eax
134b: 78 2b js 1378 <stat+0x48>
return -1;
r = fstat(fd, st);
134d: 83 ec 08 sub $0x8,%esp
1350: ff 75 0c pushl 0xc(%ebp)
1353: 89 c3 mov %eax,%ebx
1355: 50 push %eax
1356: e8 3a 03 00 00 call 1695 <fstat>
close(fd);
135b: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
135e: 89 c6 mov %eax,%esi
close(fd);
1360: e8 00 03 00 00 call 1665 <close>
return r;
1365: 83 c4 10 add $0x10,%esp
}
1368: 8d 65 f8 lea -0x8(%ebp),%esp
136b: 89 f0 mov %esi,%eax
136d: 5b pop %ebx
136e: 5e pop %esi
136f: 5d pop %ebp
1370: c3 ret
1371: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
1378: be ff ff ff ff mov $0xffffffff,%esi
137d: eb e9 jmp 1368 <stat+0x38>
137f: 90 nop
00001380 <atoi>:
int
atoi(const char *s)
{
1380: f3 0f 1e fb endbr32
1384: 55 push %ebp
1385: 89 e5 mov %esp,%ebp
1387: 53 push %ebx
1388: 8b 55 08 mov 0x8(%ebp),%edx
int n;
n = 0;
while('0' <= *s && *s <= '9')
138b: 0f be 02 movsbl (%edx),%eax
138e: 8d 48 d0 lea -0x30(%eax),%ecx
1391: 80 f9 09 cmp $0x9,%cl
n = 0;
1394: b9 00 00 00 00 mov $0x0,%ecx
while('0' <= *s && *s <= '9')
1399: 77 1a ja 13b5 <atoi+0x35>
139b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
139f: 90 nop
n = n*10 + *s++ - '0';
13a0: 83 c2 01 add $0x1,%edx
13a3: 8d 0c 89 lea (%ecx,%ecx,4),%ecx
13a6: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx
while('0' <= *s && *s <= '9')
13aa: 0f be 02 movsbl (%edx),%eax
13ad: 8d 58 d0 lea -0x30(%eax),%ebx
13b0: 80 fb 09 cmp $0x9,%bl
13b3: 76 eb jbe 13a0 <atoi+0x20>
return n;
}
13b5: 89 c8 mov %ecx,%eax
13b7: 5b pop %ebx
13b8: 5d pop %ebp
13b9: c3 ret
13ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000013c0 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
13c0: f3 0f 1e fb endbr32
13c4: 55 push %ebp
13c5: 89 e5 mov %esp,%ebp
13c7: 57 push %edi
13c8: 8b 45 10 mov 0x10(%ebp),%eax
13cb: 8b 55 08 mov 0x8(%ebp),%edx
13ce: 56 push %esi
13cf: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
13d2: 85 c0 test %eax,%eax
13d4: 7e 0f jle 13e5 <memmove+0x25>
13d6: 01 d0 add %edx,%eax
dst = vdst;
13d8: 89 d7 mov %edx,%edi
13da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
*dst++ = *src++;
13e0: a4 movsb %ds:(%esi),%es:(%edi)
while(n-- > 0)
13e1: 39 f8 cmp %edi,%eax
13e3: 75 fb jne 13e0 <memmove+0x20>
return vdst;
}
13e5: 5e pop %esi
13e6: 89 d0 mov %edx,%eax
13e8: 5f pop %edi
13e9: 5d pop %ebp
13ea: c3 ret
13eb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
13ef: 90 nop
000013f0 <thread_join>:
void* stack;
stack =malloc(4096); //pgsize
return clone(start_routine,arg1,arg2,stack);
}
int thread_join()
{
13f0: f3 0f 1e fb endbr32
13f4: 55 push %ebp
13f5: 89 e5 mov %esp,%ebp
13f7: 83 ec 24 sub $0x24,%esp
void * stackPtr;
int x = join(&stackPtr);
13fa: 8d 45 f4 lea -0xc(%ebp),%eax
13fd: 50 push %eax
13fe: e8 0a 03 00 00 call 170d <join>
return x;
}
1403: c9 leave
1404: c3 ret
1405: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
140c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00001410 <lock_init>:
void lock_init(struct lock_t *lk){
1410: f3 0f 1e fb endbr32
1414: 55 push %ebp
1415: 89 e5 mov %esp,%ebp
lk->locked=0; //intialize as unnlocked
1417: 8b 45 08 mov 0x8(%ebp),%eax
141a: c7 00 00 00 00 00 movl $0x0,(%eax)
}
1420: 5d pop %ebp
1421: c3 ret
1422: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1429: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001430 <lock_acquire>:
void lock_acquire(struct lock_t *lk){
1430: f3 0f 1e fb endbr32
1434: 55 push %ebp
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
1435: b9 01 00 00 00 mov $0x1,%ecx
143a: 89 e5 mov %esp,%ebp
143c: 8b 55 08 mov 0x8(%ebp),%edx
143f: 90 nop
1440: 89 c8 mov %ecx,%eax
1442: f0 87 02 lock xchg %eax,(%edx)
while(xchg(&lk->locked,1) != 0);
1445: 85 c0 test %eax,%eax
1447: 75 f7 jne 1440 <lock_acquire+0x10>
}
1449: 5d pop %ebp
144a: c3 ret
144b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
144f: 90 nop
00001450 <lock_release>:
void lock_release(struct lock_t *lk){
1450: f3 0f 1e fb endbr32
1454: 55 push %ebp
1455: 31 c0 xor %eax,%eax
1457: 89 e5 mov %esp,%ebp
1459: 8b 55 08 mov 0x8(%ebp),%edx
145c: f0 87 02 lock xchg %eax,(%edx)
xchg(&lk->locked,0) ;
}
145f: 5d pop %ebp
1460: c3 ret
1461: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1468: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
146f: 90 nop
00001470 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
1470: f3 0f 1e fb endbr32
1474: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
1475: a1 60 1d 00 00 mov 0x1d60,%eax
{
147a: 89 e5 mov %esp,%ebp
147c: 57 push %edi
147d: 56 push %esi
147e: 53 push %ebx
147f: 8b 5d 08 mov 0x8(%ebp),%ebx
1482: 8b 10 mov (%eax),%edx
bp = (Header*)ap - 1;
1484: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
1487: 39 c8 cmp %ecx,%eax
1489: 73 15 jae 14a0 <free+0x30>
148b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
148f: 90 nop
1490: 39 d1 cmp %edx,%ecx
1492: 72 14 jb 14a8 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
1494: 39 d0 cmp %edx,%eax
1496: 73 10 jae 14a8 <free+0x38>
{
1498: 89 d0 mov %edx,%eax
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
149a: 8b 10 mov (%eax),%edx
149c: 39 c8 cmp %ecx,%eax
149e: 72 f0 jb 1490 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
14a0: 39 d0 cmp %edx,%eax
14a2: 72 f4 jb 1498 <free+0x28>
14a4: 39 d1 cmp %edx,%ecx
14a6: 73 f0 jae 1498 <free+0x28>
break;
if(bp + bp->s.size == p->s.ptr){
14a8: 8b 73 fc mov -0x4(%ebx),%esi
14ab: 8d 3c f1 lea (%ecx,%esi,8),%edi
14ae: 39 fa cmp %edi,%edx
14b0: 74 1e je 14d0 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
14b2: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
14b5: 8b 50 04 mov 0x4(%eax),%edx
14b8: 8d 34 d0 lea (%eax,%edx,8),%esi
14bb: 39 f1 cmp %esi,%ecx
14bd: 74 28 je 14e7 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
14bf: 89 08 mov %ecx,(%eax)
freep = p;
}
14c1: 5b pop %ebx
freep = p;
14c2: a3 60 1d 00 00 mov %eax,0x1d60
}
14c7: 5e pop %esi
14c8: 5f pop %edi
14c9: 5d pop %ebp
14ca: c3 ret
14cb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
14cf: 90 nop
bp->s.size += p->s.ptr->s.size;
14d0: 03 72 04 add 0x4(%edx),%esi
14d3: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
14d6: 8b 10 mov (%eax),%edx
14d8: 8b 12 mov (%edx),%edx
14da: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
14dd: 8b 50 04 mov 0x4(%eax),%edx
14e0: 8d 34 d0 lea (%eax,%edx,8),%esi
14e3: 39 f1 cmp %esi,%ecx
14e5: 75 d8 jne 14bf <free+0x4f>
p->s.size += bp->s.size;
14e7: 03 53 fc add -0x4(%ebx),%edx
freep = p;
14ea: a3 60 1d 00 00 mov %eax,0x1d60
p->s.size += bp->s.size;
14ef: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
14f2: 8b 53 f8 mov -0x8(%ebx),%edx
14f5: 89 10 mov %edx,(%eax)
}
14f7: 5b pop %ebx
14f8: 5e pop %esi
14f9: 5f pop %edi
14fa: 5d pop %ebp
14fb: c3 ret
14fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00001500 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
1500: f3 0f 1e fb endbr32
1504: 55 push %ebp
1505: 89 e5 mov %esp,%ebp
1507: 57 push %edi
1508: 56 push %esi
1509: 53 push %ebx
150a: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
150d: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
1510: 8b 3d 60 1d 00 00 mov 0x1d60,%edi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
1516: 8d 70 07 lea 0x7(%eax),%esi
1519: c1 ee 03 shr $0x3,%esi
151c: 83 c6 01 add $0x1,%esi
if((prevp = freep) == 0){
151f: 85 ff test %edi,%edi
1521: 0f 84 a9 00 00 00 je 15d0 <malloc+0xd0>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
1527: 8b 07 mov (%edi),%eax
if(p->s.size >= nunits){
1529: 8b 48 04 mov 0x4(%eax),%ecx
152c: 39 f1 cmp %esi,%ecx
152e: 73 6d jae 159d <malloc+0x9d>
1530: 81 fe 00 10 00 00 cmp $0x1000,%esi
1536: bb 00 10 00 00 mov $0x1000,%ebx
153b: 0f 43 de cmovae %esi,%ebx
p = sbrk(nu * sizeof(Header));
153e: 8d 0c dd 00 00 00 00 lea 0x0(,%ebx,8),%ecx
1545: 89 4d e4 mov %ecx,-0x1c(%ebp)
1548: eb 17 jmp 1561 <malloc+0x61>
154a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
1550: 8b 10 mov (%eax),%edx
if(p->s.size >= nunits){
1552: 8b 4a 04 mov 0x4(%edx),%ecx
1555: 39 f1 cmp %esi,%ecx
1557: 73 4f jae 15a8 <malloc+0xa8>
1559: 8b 3d 60 1d 00 00 mov 0x1d60,%edi
155f: 89 d0 mov %edx,%eax
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
1561: 39 c7 cmp %eax,%edi
1563: 75 eb jne 1550 <malloc+0x50>
p = sbrk(nu * sizeof(Header));
1565: 83 ec 0c sub $0xc,%esp
1568: ff 75 e4 pushl -0x1c(%ebp)
156b: e8 55 01 00 00 call 16c5 <sbrk>
if(p == (char*)-1)
1570: 83 c4 10 add $0x10,%esp
1573: 83 f8 ff cmp $0xffffffff,%eax
1576: 74 1b je 1593 <malloc+0x93>
hp->s.size = nu;
1578: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
157b: 83 ec 0c sub $0xc,%esp
157e: 83 c0 08 add $0x8,%eax
1581: 50 push %eax
1582: e8 e9 fe ff ff call 1470 <free>
return freep;
1587: a1 60 1d 00 00 mov 0x1d60,%eax
if((p = morecore(nunits)) == 0)
158c: 83 c4 10 add $0x10,%esp
158f: 85 c0 test %eax,%eax
1591: 75 bd jne 1550 <malloc+0x50>
return 0;
}
}
1593: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
1596: 31 c0 xor %eax,%eax
}
1598: 5b pop %ebx
1599: 5e pop %esi
159a: 5f pop %edi
159b: 5d pop %ebp
159c: c3 ret
if(p->s.size >= nunits){
159d: 89 c2 mov %eax,%edx
159f: 89 f8 mov %edi,%eax
15a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p->s.size == nunits)
15a8: 39 ce cmp %ecx,%esi
15aa: 74 54 je 1600 <malloc+0x100>
p->s.size -= nunits;
15ac: 29 f1 sub %esi,%ecx
15ae: 89 4a 04 mov %ecx,0x4(%edx)
p += p->s.size;
15b1: 8d 14 ca lea (%edx,%ecx,8),%edx
p->s.size = nunits;
15b4: 89 72 04 mov %esi,0x4(%edx)
freep = prevp;
15b7: a3 60 1d 00 00 mov %eax,0x1d60
}
15bc: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
15bf: 8d 42 08 lea 0x8(%edx),%eax
}
15c2: 5b pop %ebx
15c3: 5e pop %esi
15c4: 5f pop %edi
15c5: 5d pop %ebp
15c6: c3 ret
15c7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
15ce: 66 90 xchg %ax,%ax
base.s.ptr = freep = prevp = &base;
15d0: c7 05 60 1d 00 00 64 movl $0x1d64,0x1d60
15d7: 1d 00 00
base.s.size = 0;
15da: bf 64 1d 00 00 mov $0x1d64,%edi
base.s.ptr = freep = prevp = &base;
15df: c7 05 64 1d 00 00 64 movl $0x1d64,0x1d64
15e6: 1d 00 00
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
15e9: 89 f8 mov %edi,%eax
base.s.size = 0;
15eb: c7 05 68 1d 00 00 00 movl $0x0,0x1d68
15f2: 00 00 00
if(p->s.size >= nunits){
15f5: e9 36 ff ff ff jmp 1530 <malloc+0x30>
15fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
prevp->s.ptr = p->s.ptr;
1600: 8b 0a mov (%edx),%ecx
1602: 89 08 mov %ecx,(%eax)
1604: eb b1 jmp 15b7 <malloc+0xb7>
1606: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
160d: 8d 76 00 lea 0x0(%esi),%esi
00001610 <thread_create>:
{
1610: f3 0f 1e fb endbr32
1614: 55 push %ebp
1615: 89 e5 mov %esp,%ebp
1617: 83 ec 14 sub $0x14,%esp
stack =malloc(4096); //pgsize
161a: 68 00 10 00 00 push $0x1000
161f: e8 dc fe ff ff call 1500 <malloc>
return clone(start_routine,arg1,arg2,stack);
1624: 50 push %eax
1625: ff 75 10 pushl 0x10(%ebp)
1628: ff 75 0c pushl 0xc(%ebp)
162b: ff 75 08 pushl 0x8(%ebp)
162e: e8 d2 00 00 00 call 1705 <clone>
}
1633: c9 leave
1634: c3 ret
00001635 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
1635: b8 01 00 00 00 mov $0x1,%eax
163a: cd 40 int $0x40
163c: c3 ret
0000163d <exit>:
SYSCALL(exit)
163d: b8 02 00 00 00 mov $0x2,%eax
1642: cd 40 int $0x40
1644: c3 ret
00001645 <wait>:
SYSCALL(wait)
1645: b8 03 00 00 00 mov $0x3,%eax
164a: cd 40 int $0x40
164c: c3 ret
0000164d <pipe>:
SYSCALL(pipe)
164d: b8 04 00 00 00 mov $0x4,%eax
1652: cd 40 int $0x40
1654: c3 ret
00001655 <read>:
SYSCALL(read)
1655: b8 05 00 00 00 mov $0x5,%eax
165a: cd 40 int $0x40
165c: c3 ret
0000165d <write>:
SYSCALL(write)
165d: b8 10 00 00 00 mov $0x10,%eax
1662: cd 40 int $0x40
1664: c3 ret
00001665 <close>:
SYSCALL(close)
1665: b8 15 00 00 00 mov $0x15,%eax
166a: cd 40 int $0x40
166c: c3 ret
0000166d <kill>:
SYSCALL(kill)
166d: b8 06 00 00 00 mov $0x6,%eax
1672: cd 40 int $0x40
1674: c3 ret
00001675 <exec>:
SYSCALL(exec)
1675: b8 07 00 00 00 mov $0x7,%eax
167a: cd 40 int $0x40
167c: c3 ret
0000167d <open>:
SYSCALL(open)
167d: b8 0f 00 00 00 mov $0xf,%eax
1682: cd 40 int $0x40
1684: c3 ret
00001685 <mknod>:
SYSCALL(mknod)
1685: b8 11 00 00 00 mov $0x11,%eax
168a: cd 40 int $0x40
168c: c3 ret
0000168d <unlink>:
SYSCALL(unlink)
168d: b8 12 00 00 00 mov $0x12,%eax
1692: cd 40 int $0x40
1694: c3 ret
00001695 <fstat>:
SYSCALL(fstat)
1695: b8 08 00 00 00 mov $0x8,%eax
169a: cd 40 int $0x40
169c: c3 ret
0000169d <link>:
SYSCALL(link)
169d: b8 13 00 00 00 mov $0x13,%eax
16a2: cd 40 int $0x40
16a4: c3 ret
000016a5 <mkdir>:
SYSCALL(mkdir)
16a5: b8 14 00 00 00 mov $0x14,%eax
16aa: cd 40 int $0x40
16ac: c3 ret
000016ad <chdir>:
SYSCALL(chdir)
16ad: b8 09 00 00 00 mov $0x9,%eax
16b2: cd 40 int $0x40
16b4: c3 ret
000016b5 <dup>:
SYSCALL(dup)
16b5: b8 0a 00 00 00 mov $0xa,%eax
16ba: cd 40 int $0x40
16bc: c3 ret
000016bd <getpid>:
SYSCALL(getpid)
16bd: b8 0b 00 00 00 mov $0xb,%eax
16c2: cd 40 int $0x40
16c4: c3 ret
000016c5 <sbrk>:
SYSCALL(sbrk)
16c5: b8 0c 00 00 00 mov $0xc,%eax
16ca: cd 40 int $0x40
16cc: c3 ret
000016cd <sleep>:
SYSCALL(sleep)
16cd: b8 0d 00 00 00 mov $0xd,%eax
16d2: cd 40 int $0x40
16d4: c3 ret
000016d5 <uptime>:
SYSCALL(uptime)
16d5: b8 0e 00 00 00 mov $0xe,%eax
16da: cd 40 int $0x40
16dc: c3 ret
000016dd <count>:
SYSCALL(count)
16dd: b8 16 00 00 00 mov $0x16,%eax
16e2: cd 40 int $0x40
16e4: c3 ret
000016e5 <settickets>:
SYSCALL(settickets)
16e5: b8 17 00 00 00 mov $0x17,%eax
16ea: cd 40 int $0x40
16ec: c3 ret
000016ed <getpinfo>:
SYSCALL(getpinfo)
16ed: b8 18 00 00 00 mov $0x18,%eax
16f2: cd 40 int $0x40
16f4: c3 ret
000016f5 <mprotect>:
SYSCALL(mprotect)
16f5: b8 19 00 00 00 mov $0x19,%eax
16fa: cd 40 int $0x40
16fc: c3 ret
000016fd <munprotect>:
SYSCALL(munprotect)
16fd: b8 1a 00 00 00 mov $0x1a,%eax
1702: cd 40 int $0x40
1704: c3 ret
00001705 <clone>:
SYSCALL(clone)
1705: b8 1b 00 00 00 mov $0x1b,%eax
170a: cd 40 int $0x40
170c: c3 ret
0000170d <join>:
SYSCALL(join)
170d: b8 1c 00 00 00 mov $0x1c,%eax
1712: cd 40 int $0x40
1714: c3 ret
1715: 66 90 xchg %ax,%ax
1717: 66 90 xchg %ax,%ax
1719: 66 90 xchg %ax,%ax
171b: 66 90 xchg %ax,%ax
171d: 66 90 xchg %ax,%ax
171f: 90 nop
00001720 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
1720: 55 push %ebp
1721: 89 e5 mov %esp,%ebp
1723: 57 push %edi
1724: 56 push %esi
1725: 53 push %ebx
1726: 83 ec 3c sub $0x3c,%esp
1729: 89 4d c4 mov %ecx,-0x3c(%ebp)
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
172c: 89 d1 mov %edx,%ecx
{
172e: 89 45 b8 mov %eax,-0x48(%ebp)
if(sgn && xx < 0){
1731: 85 d2 test %edx,%edx
1733: 0f 89 7f 00 00 00 jns 17b8 <printint+0x98>
1739: f6 45 08 01 testb $0x1,0x8(%ebp)
173d: 74 79 je 17b8 <printint+0x98>
neg = 1;
173f: c7 45 bc 01 00 00 00 movl $0x1,-0x44(%ebp)
x = -xx;
1746: f7 d9 neg %ecx
} else {
x = xx;
}
i = 0;
1748: 31 db xor %ebx,%ebx
174a: 8d 75 d7 lea -0x29(%ebp),%esi
174d: 8d 76 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
1750: 89 c8 mov %ecx,%eax
1752: 31 d2 xor %edx,%edx
1754: 89 cf mov %ecx,%edi
1756: f7 75 c4 divl -0x3c(%ebp)
1759: 0f b6 92 d8 19 00 00 movzbl 0x19d8(%edx),%edx
1760: 89 45 c0 mov %eax,-0x40(%ebp)
1763: 89 d8 mov %ebx,%eax
1765: 8d 5b 01 lea 0x1(%ebx),%ebx
}while((x /= base) != 0);
1768: 8b 4d c0 mov -0x40(%ebp),%ecx
buf[i++] = digits[x % base];
176b: 88 14 1e mov %dl,(%esi,%ebx,1)
}while((x /= base) != 0);
176e: 39 7d c4 cmp %edi,-0x3c(%ebp)
1771: 76 dd jbe 1750 <printint+0x30>
if(neg)
1773: 8b 4d bc mov -0x44(%ebp),%ecx
1776: 85 c9 test %ecx,%ecx
1778: 74 0c je 1786 <printint+0x66>
buf[i++] = '-';
177a: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1)
buf[i++] = digits[x % base];
177f: 89 d8 mov %ebx,%eax
buf[i++] = '-';
1781: ba 2d 00 00 00 mov $0x2d,%edx
while(--i >= 0)
1786: 8b 7d b8 mov -0x48(%ebp),%edi
1789: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx
178d: eb 07 jmp 1796 <printint+0x76>
178f: 90 nop
1790: 0f b6 13 movzbl (%ebx),%edx
1793: 83 eb 01 sub $0x1,%ebx
write(fd, &c, 1);
1796: 83 ec 04 sub $0x4,%esp
1799: 88 55 d7 mov %dl,-0x29(%ebp)
179c: 6a 01 push $0x1
179e: 56 push %esi
179f: 57 push %edi
17a0: e8 b8 fe ff ff call 165d <write>
while(--i >= 0)
17a5: 83 c4 10 add $0x10,%esp
17a8: 39 de cmp %ebx,%esi
17aa: 75 e4 jne 1790 <printint+0x70>
putc(fd, buf[i]);
}
17ac: 8d 65 f4 lea -0xc(%ebp),%esp
17af: 5b pop %ebx
17b0: 5e pop %esi
17b1: 5f pop %edi
17b2: 5d pop %ebp
17b3: c3 ret
17b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
17b8: c7 45 bc 00 00 00 00 movl $0x0,-0x44(%ebp)
17bf: eb 87 jmp 1748 <printint+0x28>
17c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
17c8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
17cf: 90 nop
000017d0 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
17d0: f3 0f 1e fb endbr32
17d4: 55 push %ebp
17d5: 89 e5 mov %esp,%ebp
17d7: 57 push %edi
17d8: 56 push %esi
17d9: 53 push %ebx
17da: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
17dd: 8b 75 0c mov 0xc(%ebp),%esi
17e0: 0f b6 1e movzbl (%esi),%ebx
17e3: 84 db test %bl,%bl
17e5: 0f 84 b4 00 00 00 je 189f <printf+0xcf>
ap = (uint*)(void*)&fmt + 1;
17eb: 8d 45 10 lea 0x10(%ebp),%eax
17ee: 83 c6 01 add $0x1,%esi
write(fd, &c, 1);
17f1: 8d 7d e7 lea -0x19(%ebp),%edi
state = 0;
17f4: 31 d2 xor %edx,%edx
ap = (uint*)(void*)&fmt + 1;
17f6: 89 45 d0 mov %eax,-0x30(%ebp)
17f9: eb 33 jmp 182e <printf+0x5e>
17fb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
17ff: 90 nop
1800: 89 55 d4 mov %edx,-0x2c(%ebp)
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
1803: ba 25 00 00 00 mov $0x25,%edx
if(c == '%'){
1808: 83 f8 25 cmp $0x25,%eax
180b: 74 17 je 1824 <printf+0x54>
write(fd, &c, 1);
180d: 83 ec 04 sub $0x4,%esp
1810: 88 5d e7 mov %bl,-0x19(%ebp)
1813: 6a 01 push $0x1
1815: 57 push %edi
1816: ff 75 08 pushl 0x8(%ebp)
1819: e8 3f fe ff ff call 165d <write>
181e: 8b 55 d4 mov -0x2c(%ebp),%edx
} else {
putc(fd, c);
1821: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
1824: 0f b6 1e movzbl (%esi),%ebx
1827: 83 c6 01 add $0x1,%esi
182a: 84 db test %bl,%bl
182c: 74 71 je 189f <printf+0xcf>
c = fmt[i] & 0xff;
182e: 0f be cb movsbl %bl,%ecx
1831: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
1834: 85 d2 test %edx,%edx
1836: 74 c8 je 1800 <printf+0x30>
}
} else if(state == '%'){
1838: 83 fa 25 cmp $0x25,%edx
183b: 75 e7 jne 1824 <printf+0x54>
if(c == 'd'){
183d: 83 f8 64 cmp $0x64,%eax
1840: 0f 84 9a 00 00 00 je 18e0 <printf+0x110>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
1846: 81 e1 f7 00 00 00 and $0xf7,%ecx
184c: 83 f9 70 cmp $0x70,%ecx
184f: 74 5f je 18b0 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
1851: 83 f8 73 cmp $0x73,%eax
1854: 0f 84 d6 00 00 00 je 1930 <printf+0x160>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
185a: 83 f8 63 cmp $0x63,%eax
185d: 0f 84 8d 00 00 00 je 18f0 <printf+0x120>
putc(fd, *ap);
ap++;
} else if(c == '%'){
1863: 83 f8 25 cmp $0x25,%eax
1866: 0f 84 b4 00 00 00 je 1920 <printf+0x150>
write(fd, &c, 1);
186c: 83 ec 04 sub $0x4,%esp
186f: c6 45 e7 25 movb $0x25,-0x19(%ebp)
1873: 6a 01 push $0x1
1875: 57 push %edi
1876: ff 75 08 pushl 0x8(%ebp)
1879: e8 df fd ff ff call 165d <write>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
187e: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
1881: 83 c4 0c add $0xc,%esp
1884: 6a 01 push $0x1
1886: 83 c6 01 add $0x1,%esi
1889: 57 push %edi
188a: ff 75 08 pushl 0x8(%ebp)
188d: e8 cb fd ff ff call 165d <write>
for(i = 0; fmt[i]; i++){
1892: 0f b6 5e ff movzbl -0x1(%esi),%ebx
putc(fd, c);
1896: 83 c4 10 add $0x10,%esp
}
state = 0;
1899: 31 d2 xor %edx,%edx
for(i = 0; fmt[i]; i++){
189b: 84 db test %bl,%bl
189d: 75 8f jne 182e <printf+0x5e>
}
}
}
189f: 8d 65 f4 lea -0xc(%ebp),%esp
18a2: 5b pop %ebx
18a3: 5e pop %esi
18a4: 5f pop %edi
18a5: 5d pop %ebp
18a6: c3 ret
18a7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
18ae: 66 90 xchg %ax,%ax
printint(fd, *ap, 16, 0);
18b0: 83 ec 0c sub $0xc,%esp
18b3: b9 10 00 00 00 mov $0x10,%ecx
18b8: 6a 00 push $0x0
18ba: 8b 5d d0 mov -0x30(%ebp),%ebx
18bd: 8b 45 08 mov 0x8(%ebp),%eax
18c0: 8b 13 mov (%ebx),%edx
18c2: e8 59 fe ff ff call 1720 <printint>
ap++;
18c7: 89 d8 mov %ebx,%eax
18c9: 83 c4 10 add $0x10,%esp
state = 0;
18cc: 31 d2 xor %edx,%edx
ap++;
18ce: 83 c0 04 add $0x4,%eax
18d1: 89 45 d0 mov %eax,-0x30(%ebp)
18d4: e9 4b ff ff ff jmp 1824 <printf+0x54>
18d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printint(fd, *ap, 10, 1);
18e0: 83 ec 0c sub $0xc,%esp
18e3: b9 0a 00 00 00 mov $0xa,%ecx
18e8: 6a 01 push $0x1
18ea: eb ce jmp 18ba <printf+0xea>
18ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
putc(fd, *ap);
18f0: 8b 5d d0 mov -0x30(%ebp),%ebx
write(fd, &c, 1);
18f3: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
18f6: 8b 03 mov (%ebx),%eax
write(fd, &c, 1);
18f8: 6a 01 push $0x1
ap++;
18fa: 83 c3 04 add $0x4,%ebx
write(fd, &c, 1);
18fd: 57 push %edi
18fe: ff 75 08 pushl 0x8(%ebp)
putc(fd, *ap);
1901: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
1904: e8 54 fd ff ff call 165d <write>
ap++;
1909: 89 5d d0 mov %ebx,-0x30(%ebp)
190c: 83 c4 10 add $0x10,%esp
state = 0;
190f: 31 d2 xor %edx,%edx
1911: e9 0e ff ff ff jmp 1824 <printf+0x54>
1916: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
191d: 8d 76 00 lea 0x0(%esi),%esi
putc(fd, c);
1920: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
1923: 83 ec 04 sub $0x4,%esp
1926: e9 59 ff ff ff jmp 1884 <printf+0xb4>
192b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
192f: 90 nop
s = (char*)*ap;
1930: 8b 45 d0 mov -0x30(%ebp),%eax
1933: 8b 18 mov (%eax),%ebx
ap++;
1935: 83 c0 04 add $0x4,%eax
1938: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
193b: 85 db test %ebx,%ebx
193d: 74 17 je 1956 <printf+0x186>
while(*s != 0){
193f: 0f b6 03 movzbl (%ebx),%eax
state = 0;
1942: 31 d2 xor %edx,%edx
while(*s != 0){
1944: 84 c0 test %al,%al
1946: 0f 84 d8 fe ff ff je 1824 <printf+0x54>
194c: 89 75 d4 mov %esi,-0x2c(%ebp)
194f: 89 de mov %ebx,%esi
1951: 8b 5d 08 mov 0x8(%ebp),%ebx
1954: eb 1a jmp 1970 <printf+0x1a0>
s = "(null)";
1956: bb cf 19 00 00 mov $0x19cf,%ebx
while(*s != 0){
195b: 89 75 d4 mov %esi,-0x2c(%ebp)
195e: b8 28 00 00 00 mov $0x28,%eax
1963: 89 de mov %ebx,%esi
1965: 8b 5d 08 mov 0x8(%ebp),%ebx
1968: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
196f: 90 nop
write(fd, &c, 1);
1970: 83 ec 04 sub $0x4,%esp
s++;
1973: 83 c6 01 add $0x1,%esi
1976: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
1979: 6a 01 push $0x1
197b: 57 push %edi
197c: 53 push %ebx
197d: e8 db fc ff ff call 165d <write>
while(*s != 0){
1982: 0f b6 06 movzbl (%esi),%eax
1985: 83 c4 10 add $0x10,%esp
1988: 84 c0 test %al,%al
198a: 75 e4 jne 1970 <printf+0x1a0>
198c: 8b 75 d4 mov -0x2c(%ebp),%esi
state = 0;
198f: 31 d2 xor %edx,%edx
1991: e9 8e fe ff ff jmp 1824 <printf+0x54>
|
programs/oeis/320/A320429.asm | neoneye/loda | 22 | 165987 | <gh_stars>10-100
; A320429: The length of the shortest prefix of the Thue-Morse word decomposable to not less than n palindromes.
; 1,2,6,10,26,90,154,410,1434,2458,6554,22938,39322,104858,367002,629146,1677722,5872026,10066330,26843546,93952410,161061274,429496730,1503238554,2576980378,6871947674,24051816858,41231686042,109951162778,384829069722,659706976666,1759218604442,6157265115546
mov $2,$0
add $2,1
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
mov $5,$0
add $5,1
mov $6,0
mov $7,$0
lpb $5
mov $0,$7
sub $5,1
sub $0,$5
mov $9,$0
mov $11,2
lpb $11
mov $0,$9
sub $11,1
add $0,$11
sub $0,1
mul $0,2
sub $0,1
div $0,3
mov $3,2
lpb $0
sub $0,1
mul $3,4
lpe
mov $8,$11
lpb $8
sub $8,1
mov $10,$3
lpe
lpe
lpb $9
mov $9,0
sub $10,$3
lpe
mov $3,$10
div $3,2
add $6,$3
lpe
add $1,$6
lpe
mov $0,$1
|
scripts/Yamaha Scenes/Yamaha 300 Generator.applescript | samschloegel/qlab-scripts | 8 | 4248 | -- For help, bug reports, or feature suggestions, please visit https://github.com/samschloegel/qlab-scripts
-- Built for QLab 4. v211121-01
set userPrefix to "y"
set userNamePrefix to "Yamaha Scene"
set showMIDIInfo to true
tell application id "com.figure53.QLab.4" to tell front workspace
set i to 0
set scene to 1
repeat 300 times
make type "MIDI"
set newCue to last item of (selected as list)
set q number of newCue to userPrefix & scene
set command of newCue to program_change
if i is less than 128 then
set theChannel to 1
set byteOne to i
else if i is less than 256 then
set theChannel to 2
set byteOne to (i - 128)
else
set theChannel to 3
set byteOne to (i - 256)
end if
set channel of newCue to theChannel
set byte one of newCue to byteOne
if showMIDIInfo then
set q name of newCue to userNamePrefix & " " & scene & " (Ch " & theChannel & " / PC " & byteOne & ")"
else
set q name of newCue to userNamePrefix & scene
end if
set i to i + 1
set scene to scene + 1
end repeat
end tell |
space-antlr/src/main/antlr4/org/jkcsoft/space/antlr/g4/SpaceParser.g4 | jimcoles/space | 0 | 6111 | <reponame>jimcoles/space
/*------------------------------------------------------------------------------
The Antlr grammar for Space if I can get it to work
------------------------------------------------------------------------------*/
parser grammar SpaceParser;
options {
tokenVocab = SpaceLexer;
}
/*
Meta-Naming Conventions:
-----------------------
__Defn : A nameable element such as a type, association, method, or rule.
__Decl : Datum declaration structures
__Expr : A construct meant for evaluation that references declared elements and expresses
some sequence of actions possibly resulting in a value at
runtime. Might express a mix of operations and truths
(predicates).
Expressions are the intersection between imperative and declartive logic.
Every expression in Space may be used in a Rule or a Statement.
__Stmt : An imperative instruction or action such as a function call. Statements usually
contain expressions.
Syntactic notation:
------------------
{ ... } - Set of notation.
[ ... ] - Sequence of notation.
+,-,*,/ - Algebraic addition, substraction, multiplication, division.
+> = Sequence concatenation.
Object and Tuple operations:
---------------------------
create -
read -
update -
delete -
rename -
Set operations:
--------------
Sequence operations:
-------------------
append (>>)
Stream opereations:
------------------
pipe -
Examples to prime the pump:
--------------------------
type MySpaceDef [equates-to OtherSpaceDef YetAnotherSpaceDef ...] (
// Scalars
int myIntVar [=<int>]; // var-defn
boolean myBoolVar [=]; // var-defn
// These define Associations (ala Foreign KeyValue Relationships)
MyOtherSpaceDef ref;
)
function myFunction solves <MyEquation> for [<var1>, <var2>] given [<var3>, <var4>] (
)
function myFunction solves <MyEquation> for [<var3>, <var4>] given [<var1>, <var2>] (
)
// Rules are classified by the langauge based on the nature of the rule expressions.
// Equations are Relations expressed symbolically, i.e., symbolic expressions.
// They are just predicates in normal form analogous to
// ax + by + cz = 0
// Every (orthogonal) Equation reduces the number of degrees of freedom (DOF) of a system by one.
rule MyEquation (
y = ax + b;
)
// A Constraint is a general predicate that must be true at the end of
// every transaction.
rule MyConstraint (
)
// An Enumerated Relation (aka, Table, Set of Tuples) is just a set of tuples
// aligned to some type definition
rule MyRelation {
[]
}
// Physical
index MyIndex (
)
// specifies vars of root and associated types with filter criteria
query-def <queryName> (
'/' <rootObject> // may be a type
[assocs
./<assocName> [as <alias>]
{ // nested associations
./<assocName> [as <alias>]
}
]
vars
<assocName|alias>.var1 [, ...]
filter
// Should/May not contain object refs, only variable refs ??
[ ( <assocName|alias>.var <boolOper> <valueExpr> )
<boolOper> [<...> ]
| <namedEquation>
)
Operators produce a new computed thing from existing thing(s)
Navigation opers = QueryImpl opers
. - LEFT nav. Do we need a RIGHT nav operator to tell engine that reference is in the right space?
integer and real opers
+
==
Boolean opers
&&
||
Space operators
(rootSpace=MySpace1
(Select <locallyQualified>) // implies need joins
(<annonymoust constraint definition> or <constraintRef>)
)
Regex opers? In effect, make regexes part of the language
*/
/*------------------------------------------------------------------------------
Parse Rule Section
If matched by the ANTLR recognizer, these will generate Rule Context nodes
in the parse tree with the rule name specified. Parse rules should reflect
high-level concepts of the language.
NOTE: Parse Rule names must start with a lowercase letter.
------------------------------------------------------------------------------*/
parseUnit :
packageStatement?
importStatement*
(spaceTypeDefn | equationDefn | functionDefn | associationDefn)*
;
/*
[ // a tuple
space-type = "SpaceDef",
name = "MySpace",
sp
*/
parseUnitRelational :
anyThing*
;
anyThing :
spaceTypeDefn
| equationDefn
| associationDefn
| queryDefn
| regularExpr
;
packageStatement :
'package' metaRefExpr ';';
importStatement :
'import' aliasedSpacePathExpr ';';
spaceTypeDefn :
accessModifier? defnTypeModifier?
TypeDefKeyword identifier
(ExtendsKeyword anyTypeRefList)?
elementDeclHeader?
spaceTypeDefnBody
;
accessModifier :
AccessKeyword
;
defnTypeModifier :
SpaceDefnType
;
elementDeclHeader :
comment?
annotation+
;
/*
Enforce structure:
1. vars, then assocs, then actions.
2. decl/defn before any initializaiton.
*/
spaceTypeDefnBody :
BlockStart
( variableDefnStmt
| keyDefnStmt
| associationDefnStmt
| statementBlock
| functionDefn
| equationDefn
| spaceTypeDefn )*
BlockEnd
;
datumDefnStmt :
variableDefnStmt | associationDefnStmt
;
variableDefnStmt :
variableDefn ';'
;
variableDefn :
variableDecl rightAssignmentExpr?
;
variableDecl :
elementDeclHeader? anyTypeRef identifier
;
//associationDefnList :
// SeqStart associationDefn (',' associationDefn)* SeqEnd
// ;
associationDefnStmt :
associationDefn ';'
;
associationDefn :
accessModifier?
AssocKeyword identifier
elementDeclHeader?
assocDefnBody
;
assocDefnBody :
BlockStart
FromEndKeyword fromAssocEnd
ToEndKeyword toAssocEnd
AssocKindKeyword?
BlockEnd
;
// typeRef.varRef
toAssocEnd : metaRefExpr ;
// typeRef.varRef
fromAssocEnd : metaRefExpr ;
/*------------------------------------------------------------------------------
KEYS and INDEXes
Keys and Indexes have the RDB semantic.
Keys are indentifier variables used to enforce uniqueness of tuples in a set.
Keys are user-level identifiers as opposed to the internal Space OIDs, which
are not accessible to the user program.
Mathematically, I think a KeyValue is just the 'parameter', 't', in a Parametric Equation,
x(t), y(t)
usually denoted by a, 't' or 'w', as opposed to 'x' or 'y'.
A given space Type may have at most one primary key but any number of
alternate keys.
An Index allows for more performant (log n) lookup of objects in a Space than is
given by a linear time (n) 'full scan' of the space. This is analogous to an index
(keyword index) in the back of a book.
An Index is a physical notion which may be defined independently of a
Relation. All Keys will
------------------------------------------------------------------------------*/
keyDefnStmt :
keyDefn ';'
;
keyDefn :
elementDeclHeader?
'key' keyModifier? identifier spacePathList
;
keyModifier :
'primary' | 'alternate'
;
/*------------------------------------------------------------------------------
EQUATIONS
The term 'Equation' is used to match the mathematical notion.
Equations are symbolic or enumerated constraints defined with respect to a
(base) type
An equation is a set-theoretic Relation expressed symbolically using algebra of
other rigourously defined operators.
A Relations is, conceptually, a set of points (tuples)
constituting a equality constraint on a Space as defined by a Type
(set of variables). Evaluates to true or false (or unknown?) or 'exists'.
Can be used to find a solution (or solutions) given independent variables,
which may be a single object.
------------------------------------------------------------------------------*/
equationDefn :
elementDeclHeader?
EquationDefKeyword accessModifier? identifier
'{' equationExpr '}'
;
equationExpr :
symbolicExpr | // type check: boolean-valued?
valueExprChain // type check: set of tuples?
;
/*------------------------------------------------------------------------------
QUERY EXPRESSIONS
Our query model, is more like object-oriented
query model like JQL or any of the models used by persistence engines like
Hibernate.
A query can be:
1. An algebraic "Projection" from (x1, x2, ...) to some subset of
(x3, x7, ...)
2.
Differentiate:
'view' - A static 'View' definition QueryImpl that describes a new Type as an algebraic variation
of existing Types using Projection. Can be a Denormalizing QueryImpl. Mapping QueryImpl. Used
in mapping base Types to some Interface (or other Space) or as a means of defining
new Types or Interfaces. Used to define Type 'extension'.
'type MyNewType extends BaseType { ... }'
equivalent
'view MyNewType { BaseType vars *}'
Things to reconcile:
Type
Equation
Function
Space - An identified set of Types and related Equations (and related Functions, etc)
Interface - Is this the same as a View?
QueryImpl
View
Transform - Space, S1, to Space, S2
Cast - Type, T1, to Type, T2
Path Expression
Projection (var subset)
Selection (filter)
------------------------------------------------------------------------------*/
queryDefn :
'query' identifier '{' queryExpr '}'
;
queryExpr :
queryRootExpr
('assocs' aliasedSpacePathExprList)?
('vars' aliasedSpacePathExprList)?
('filter' valueExprChain)?
;
queryRootExpr:
complexTypeRef
;
/*------------------------------------------------------------------------------
FUNCTIONS
A function, in its pure form, is kind of Relation, wherein there is a unique
mapping from some independent variables to the remaining dependent variables
in the space.
Functions are expresssed in such a way that they provides a way to compute
the solution to an Equation. Space functions,
in general, compute solutions via a sequence of imperitive statements.
Some subset of Space equations might be solvable via our inference engine,
the Equator, which can infer an 'execution plan' that solves the equation.
For more complex equations, the programmer will have to supply functions
that solve for the tuple (or set of tuples) that satisfy the current
system of equations.
------------------------------------------------------------------------------*/
functionDefn :
elementDeclHeader?
'function' accessModifier? (anyTypeRef | voidTypeName) identifier indParams=parameterDefnList
('context' contextSpace=parameterDefnList)?
('solves' metaRefExpr)?
statementBlock
;
parameterDefnList : '(' (parameterDecl (',' parameterDecl)* )? ')' ;
parameterDecl :
variableDecl
;
/*------------------------------------------------------------------------------
SPACE PATH EXPRESSIONS
At this point Space Paths are just paths through the AST namepace used to
specify types. Space Paths can be followed prior to runtime with no
dynamic evaluation.
At some point, Space paths expressions might become more like XPath
expressions: From a starting contextual Space object, one accesses one or
multiple associated objects using the path expression language. Should be
applicable to both user objects and meta objects.
Similar to QueryExpr
Similar to ValueExpr
Semantically valid pairs:
[dir].[dir]
[dir].[type]
[type].[assoc]
[type].[var]
[valueExpr].[func name ()]
[literal of complex type].[assoc name]
[literal of complex type].[func name ()]
[literal of type]
[symbolic expr (scalar-valued or tuple-valued)]
Syntactically valid pairs:
[identifier].[identifier]
[identifier].[identifier ()]
[identifier ()].[identifier]
[identifier ()].[identifier ()]
[object literal].[identifier]
[object literal].[identifier ()]
[ns]:[]
Path Operators:
'->' - asssociation nav (1-for-1)
'<-' - reverse nav (many-for-1)
'.' - member name (tuple variable or function ref)
'/' - (derived) tree nav (including the AST)
------------------------------------------------------------------------------*/
metaRefExpr :
languageKey? spacePathRootExpr? idRef (spacePathAnyNavOper idRef)*
;
alias :
'as' identifier
;
languageKey : (idRef ':') ;
spacePathRootExpr : SPathRoot ;
spacePathAnyNavOper :
SPathDirNavOper | SPathMemberNavOper | SPathRefNavOper
;
spacePathList :
metaRefExpr (',' metaRefExpr)*
;
aliasedSpacePathExpr:
metaRefExpr alias?
;
aliasedSpacePathExprList :
aliasedSpacePathExpr (',' aliasedSpacePathExpr)*
;
anyTypeRef :
primitiveOptSeqTypeRef
| complexOptCollTypeRef
;
complexOptCollTypeRef : complexTypeRef anyCollectionMarker* ;
primitiveOptSeqTypeRef : primitiveTypeName sequenceMarker* ;
complexTypeRef :
metaRefExpr
;
anyTypeRefList :
anyTypeRef (',' anyTypeRef)*
;
//collectionTypeRef :
// (spacePathExpr | primitiveTypeName) collectionMarker
// | collectionTypeRef collectionMarker
// ;
anyCollectionMarker :
setMarker
| sequenceMarker
;
setMarker : SetStart SetEnd ;
sequenceMarker : SequenceStart SequenceEnd ;
streamMarker : StreamStart StreamEnd ;
voidTypeName :
VoidKeyword
;
primitiveTypeName :
BooleanKeyword
| CharKeyword
| OrdinalKeyword
| CardinalKeyword
| RealKeyword
| VoidKeyword
;
/*------------------------------------------------------------------------------
TREE PATHS
A Tree Path is a declarative specification of a path through associated types
which then forms a tree data structure. The runtime makes the resulting tree
available to the user space. The idea is that a user should never have to
maintain their own tree structures, which tend to require the maintenance of
redundant referenes.
A tree specification is very similar to an specification of XML element nestings
or Google Protocol message nestings. One specifies the valid nestings by
Type and the nature of the nesting in terms of 'set', 'sequence', 'choice'
The simplest tree path is the recursive parent-child association within a
single entitiy. E.g.,
type Directory {
charseq name;
Directory parentDir;
tree dirTree {
root {
set Directory.parentDir (name); // existing assoc
set File.dir (name); // existing assoc
}
}
}
type File {
charseq name;
Directory dir;
}
{
Directory myDir = [];
myDir.getChildren().getChildren();
myDir.getChild(
}
------------------------------------------------------------------------------*/
treePathExpr :
;
/*------------------------------------------------------------------------------
STATEMENTS
Statements are the imperative side of the Space langauge. They are
execuatble instructions that allow users to implement algorithms, modify
program state, etc..
------------------------------------------------------------------------------*/
statement :
expression ';'
| statementBlock
| ifStatement
| forEachStatement
| returnStatement
;
statementBlock :
BlockStart
(datumDefnStmt | statement)*
BlockEnd
;
ifStatement :
'if' '(' valueExprChain ')'
statementBlock
;
forEachStatement :
'foreach' identifier 'in' valueExprChain
statementBlock
;
returnStatement :
'return' valueExprChain ';'
;
/*------------------------------------------------------------------------------
VALUE EXPRESSIONS and related
------------------------------------------------------------------------------*/
// NOTE: A 'function call' may be a list of params or a single tuple
// object holding parameters. The language runtime knows the names/paths of
// all elements in a Tuple.
// A valueExpr is like a metaRefExpr except that the latter is a simple
// dot-seperated list of identifiers, whereas the former may start
// with literals or symbolic expressions and may contain function calls
valueExprChain :
atomicValueExpr ('.' namedRefValueExpr)*
;
functionCallExpr :
idRef '(' argList ')'
;
argList :
valueExprChain? (',' valueExprChain)*
;
expression :
variableDefn |
functionCallExpr |
assignmentExpr |
valueExprChain
;
atomicValueExpr :
literalExpr
| tupleLiteral
| setLiteral
| symbolicExpr
| namedRefValueExpr
;
namedRefValueExpr :
metaRefExpr
| functionCallExpr
;
//argTupleOrRef : (untypedTupleLiteral | spacePathExpr) ;
valueOrAssignmentExprList :
valueOrAssignmentExpr (',' valueOrAssignmentExpr)*
;
valueOrAssignmentExpr :
valueExprChain | assignmentExpr
;
/*------------------------------------------------------------------------------
SYMBOLIC EXPRESSIONS
A.K.A.: operator expressions
A symbolic expression (symex) is a possibly nested group of operator-based
expressions where each expression takes one, two, or more values. Values
may be any valid value expression including literals, function calls, type
var references, etc:
(( 1 + 2 ) == 4 )
((A == B) AND (NOT (A > 27)))
A 'Rule' is any boolean-valued symex.
An 'Equality Constraint' is a symex of the form "A == (...)"
An 'Inequality Constraint' is a symex of the form "A
------------------------------------------------------------------------------*/
symbolicExpr :
'(' binaryOperExpr ')'
;
unaryOperExpr :
unaryOper valueExprChain
;
unaryOper :
BooleanUnaryOper
;
binaryOperExpr :
valueExprChain binaryOper valueExprChain
;
binaryOper :
NumericBinaryOper | BooleanBinaryOper | ComparisonOper
;
/*------------------------------------------------------------------------------
LITERAL EXPRESSIONS
------------------------------------------------------------------------------*/
literalExpr :
scalarLiteral
| stringLiteral
| tupleLiteral
| setLiteral
;
scalarLiteral :
integerLiteral
| floatLiteral
| booleanLiteral
;
stringLiteral : StringLiteral;
integerLiteral : IntegerLiteral;
floatLiteral : FloatLiteral;
booleanLiteral : BooleanLiteral;
tupleLiteral :
anyTypeRef? tupleValueList
;
tupleValueList :
SequenceStart valueOrAssignmentExprList? SequenceEnd
;
setLiteral :
anyTypeRef? BlockStart tupleLiteral* BlockEnd
;
sequenceLiteralExpr :
anyTypeRef? SequenceStart tupleLiteral* SequenceEnd
;
/*------------------------------------------------------------------------------
Miscelleneous common little things
------------------------------------------------------------------------------*/
identifier : Identifier;
idRef : Identifier;
comment
: singleLineComment
| multiLineComment
;
singleLineComment : SingleLineComment;
multiLineComment : BlockComment;
annotation : '@' idRef '=' tupleLiteral;
rightAssignmentExpr :
'=' valueExprChain
;
assignmentExpr :
metaRefExpr rightAssignmentExpr
;
//rightSide :
// literal
// | spacePathExpr
// ;
/*------------------------------------------------------------------------------
GRAMMAR EXPRESSIONS
NOTE: Possible Space Ex Language
A sub-language for building binary stream marshallers and unmarshallers.
Character streams are a formal subset of these.
A grammar grammar that will help Space coders map complex strings to Spaces.
------------------------------------------------------------------------------*/
grammarExpression :
;
/*------------------------------------------------------------------------------
REGULAR EXPRESSIONS
NOTE: Possible Space Ex Language (although, it might be difficult to map
Space grammars to the nuiances of the Regualr Expression specification.
A sub-language for parsing industry standard regular expressions like those
used throughout Unix, Linux, Java, XML constraints, etc..
------------------------------------------------------------------------------*/
regularExpr :
'regex'
; |
vimfiles/bundle/vim-lisp/ftplugin/iterm.applescript | BHills15/vimrc | 1 | 3432 | #! /usr/bin/osascript
-- joinList from <NAME> @ bit.ly/1gRPYbH
-- toDo push new terminal to background after creation
to joinList(aList, delimiter)
set retVal to ""
set prevDelimiter to AppleScript's text item delimiters
set AppleScript's text item delimiters to delimiter
set retVal to aList as string
set AppleScript's text item delimiters to prevDelimiter
return retVal
end joinList
-- theSplit from iTerm version check example @ https://goo.gl/dSbQYU
on theSplit(theString, theDelimiter)
set oldDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to theDelimiter
set theArray to every text item of theString
set AppleScript's text item delimiters to oldDelimiters
return theArray
end theSplit
-- IsModernVersion from iTerm version check example @ https://goo.gl/dSbQYU
on IsModernVersion(version)
set myArray to my theSplit(version, ".")
set major to item 1 of myArray
set minor to item 2 of myArray
set veryMinor to item 3 of myArray
if major < 2 then
return false
end if
if major > 2 then
return true
end if
if minor < 9 then
return false
end if
if minor > 9 then
return true
end if
if veryMinor < 20140903 then
return false
end if
return true
end IsModernVersion
on run arg
set thecommand to joinList(arg, " ")
tell application "iTerm"
activate
if my IsModernVersion(version) then
set myterm to (create window with default profile)
set mysession to current session of myterm
else
set myterm to (make new teminal)
tell myterm
set mysession to (launch session "Default")
end tell
end if
tell myterm
tell mysession
write text thecommand
end tell
end tell
end tell
end run
|
8_kyu/Keep_Hydrated.asm | UlrichBerntien/Codewars-Katas | 0 | 244683 | SECTION .text
global litres
; int litres(double);
litres:
cvttsd2si rax, xmm0 ; truncate hours to int
sar rax,1 ; 1 liter per 2 hours
ret |
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_64.asm | ljhsiun2/medusa | 9 | 170171 | <filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_64.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xbd63, %r13
clflush (%r13)
nop
add %r11, %r11
movw $0x6162, (%r13)
xor %rdx, %rdx
lea addresses_D_ht+0xed0c, %rcx
nop
nop
nop
add %rbp, %rbp
mov (%rcx), %esi
nop
nop
nop
cmp $20682, %rbp
lea addresses_UC_ht+0x708b, %r13
nop
sub %rdx, %rdx
movb (%r13), %r11b
nop
nop
xor $41073, %r13
lea addresses_WT_ht+0x4e64, %rsi
lea addresses_WC_ht+0x1608d, %rdi
xor %rax, %rax
mov $7, %rcx
rep movsl
nop
add %rcx, %rcx
lea addresses_UC_ht+0x19e20, %r13
nop
nop
sub $11637, %rsi
mov (%r13), %ax
nop
and $2762, %rcx
lea addresses_WT_ht+0x15a4c, %r13
nop
nop
nop
nop
nop
and $22789, %r11
mov $0x6162636465666768, %rsi
movq %rsi, (%r13)
nop
nop
nop
nop
nop
xor %r13, %r13
lea addresses_A_ht+0x12fae, %rsi
lea addresses_UC_ht+0x1785c, %rdi
clflush (%rdi)
nop
nop
inc %rbp
mov $125, %rcx
rep movsb
nop
nop
nop
inc %rcx
lea addresses_UC_ht+0xe3cc, %rsi
lea addresses_WC_ht+0x10fac, %rdi
nop
nop
nop
nop
inc %r13
mov $83, %rcx
rep movsq
nop
nop
nop
cmp $17021, %rax
lea addresses_normal_ht+0x90c, %rcx
cmp $10907, %rax
mov (%rcx), %r11
nop
nop
nop
nop
nop
cmp %rax, %rax
lea addresses_D_ht+0x1b0c, %rsi
lea addresses_normal_ht+0x49cc, %rdi
nop
nop
nop
add $64828, %rbp
mov $93, %rcx
rep movsb
nop
nop
inc %r13
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r14
push %r9
push %rax
push %rdx
// Load
lea addresses_D+0x1ad0c, %r12
nop
nop
nop
nop
sub %rdx, %rdx
movups (%r12), %xmm2
vpextrq $0, %xmm2, %r11
nop
nop
nop
nop
and %r12, %r12
// Store
lea addresses_normal+0x1550c, %r14
xor %rax, %rax
movl $0x51525354, (%r14)
nop
nop
nop
nop
cmp $12256, %r12
// Store
lea addresses_PSE+0x1328c, %r11
nop
nop
nop
nop
nop
add %r10, %r10
movw $0x5152, (%r11)
nop
and $19426, %rax
// Load
lea addresses_US+0x412c, %r12
nop
nop
nop
and $59325, %r9
movups (%r12), %xmm4
vpextrq $1, %xmm4, %rdx
nop
nop
nop
nop
nop
inc %rdx
// Store
lea addresses_A+0x3bdc, %r11
nop
nop
nop
nop
cmp %rdx, %rdx
mov $0x5152535455565758, %r14
movq %r14, (%r11)
nop
nop
and $25634, %r9
// Store
lea addresses_A+0x18cdc, %rax
nop
add $33505, %r14
movl $0x51525354, (%rax)
nop
nop
nop
nop
nop
xor $30900, %r11
// Faulty Load
lea addresses_D+0x1ad0c, %r10
nop
nop
add %r12, %r12
mov (%r10), %r11w
lea oracles, %r12
and $0xff, %r11
shlq $12, %r11
mov (%r12,%r11,1), %r11
pop %rdx
pop %rax
pop %r9
pop %r14
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': True, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 2}}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_US', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A', 'AVXalign': False, 'size': 4}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}}
{'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 1, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8}}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}}
{'src': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 6, 'type': 'addresses_normal_ht'}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
PRG/objects/1-1.asm | narfman0/smb3_pp1 | 0 | 98588 | .byte $01 ; Unknown purpose
.byte OBJ_GOOMBA, $0E, $19
.byte OBJ_VENUSFIRETRAP, $16, $17
.byte OBJ_GOOMBA, $21, $19
.byte OBJ_REDTROOPA, $24, $16
.byte OBJ_GOOMBA, $34, $18
.byte OBJ_GOOMBA, $37, $18
.byte OBJ_PARAGOOMBA, $3B, $18
.byte OBJ_PARATROOPAGREENHOP, $53, $13
.byte OBJ_PARATROOPAGREENHOP, $56, $13
.byte OBJ_PARATROOPAGREENHOP, $59, $13
.byte OBJ_GREENTROOPA, $5C, $19
.byte OBJ_GREENPIRANHA, $70, $18
.byte OBJ_GREENPIRANHA_FIRE, $74, $17
.byte OBJ_REDTROOPA, $83, $17
.byte OBJ_ENDLEVELCARD, $A8, $15
.byte $FF ; Terminator
|
projects/06/instructions/MOperations.asm | chapnitsky/Nand2Tetris | 0 | 91502 | // Copyright <NAME>, January 2018.
// Free for educational use.
// Exercises all computations using memory as a source.
// This is not a program and cannot be tested by running the resulting
// .hack file. Instead, compare to the .hack file produced by the
// given assembler.
D=M
D=!M
D=-1
D=M+1
D=M-1
D=D+M
D=D-M
D=M-D
D=D&M
D=D|M
|
programs/oeis/131/A131739.asm | neoneye/loda | 22 | 86296 | ; A131739: a(4n) = a(4n+1) = n, a(4n+2) = 3n+2, a(4n+3) = 3n+3.
; 0,0,2,3,1,1,5,6,2,2,8,9,3,3,11,12,4,4,14,15,5,5,17,18,6,6,20,21,7,7,23,24,8,8,26,27,9,9,29,30,10,10,32,33,11,11,35,36,12,12,38,39,13,13,41,42,14,14,44,45,15,15,47,48,16,16,50,51,17,17,53,54,18,18,56,57,19,19,59
mov $2,$0
mul $2,2
add $0,$2
div $0,4
mov $1,$0
add $0,1
gcd $1,3
div $0,$1
|
binary/cpu_kernel_x86_fma.asm | R3tr074/oh_my_cpu | 23 | 10659 | .globl cpu_kernel_x86_fma_fp32
.globl cpu_kernel_x86_fma_fp64
cpu_kernel_x86_fma_fp32:
mov $0x40000000, %rax
vxorps %ymm0, %ymm0, %ymm0
vxorps %ymm1, %ymm1, %ymm1
vxorps %ymm2, %ymm2, %ymm2
vxorps %ymm3, %ymm3, %ymm3
vxorps %ymm4, %ymm4, %ymm4
vxorps %ymm5, %ymm5, %ymm5
vxorps %ymm6, %ymm6, %ymm6
vxorps %ymm7, %ymm7, %ymm7
vxorps %ymm8, %ymm8, %ymm8
vxorps %ymm9, %ymm9, %ymm9
.cpu.x86.fma.fp32.L1:
vfmadd231ps %ymm0, %ymm0, %ymm0
vfmadd231ps %ymm1, %ymm1, %ymm1
vfmadd231ps %ymm2, %ymm2, %ymm2
vfmadd231ps %ymm3, %ymm3, %ymm3
vfmadd231ps %ymm4, %ymm4, %ymm4
vfmadd231ps %ymm5, %ymm5, %ymm5
vfmadd231ps %ymm6, %ymm6, %ymm6
vfmadd231ps %ymm7, %ymm7, %ymm7
vfmadd231ps %ymm8, %ymm8, %ymm8
vfmadd231ps %ymm9, %ymm9, %ymm9
sub $0x1, %rax
jne .cpu.x86.fma.fp32.L1
ret
cpu_kernel_x86_fma_fp64:
mov $0x40000000, %rax
vxorpd %ymm0, %ymm0, %ymm0
vxorpd %ymm1, %ymm1, %ymm1
vxorpd %ymm2, %ymm2, %ymm2
vxorpd %ymm3, %ymm3, %ymm3
vxorpd %ymm4, %ymm4, %ymm4
vxorpd %ymm5, %ymm5, %ymm5
vxorpd %ymm6, %ymm6, %ymm6
vxorpd %ymm7, %ymm7, %ymm7
vxorpd %ymm8, %ymm8, %ymm8
vxorpd %ymm9, %ymm9, %ymm9
.cpu.x86.fma.fp64.L1:
vfmadd231pd %ymm0, %ymm0, %ymm0
vfmadd231pd %ymm1, %ymm1, %ymm1
vfmadd231pd %ymm2, %ymm2, %ymm2
vfmadd231pd %ymm3, %ymm3, %ymm3
vfmadd231pd %ymm4, %ymm4, %ymm4
vfmadd231pd %ymm5, %ymm5, %ymm5
vfmadd231pd %ymm6, %ymm6, %ymm6
vfmadd231pd %ymm7, %ymm7, %ymm7
vfmadd231pd %ymm8, %ymm8, %ymm8
vfmadd231pd %ymm9, %ymm9, %ymm9
sub $0x1, %rax
jne .cpu.x86.fma.fp64.L1
ret
|
agda/Homotopy.agda | JacquesCarette/pi-dual | 14 | 8755 | module Homotopy where
infixr 20 _◎_
open import Data.Product
------------------------------------------------------------------------------
-- Level 0
-- Start with this set and its elements
data B : Set where
ZERO : B
ONE : B
PLUS : B → B → B
TIMES : B → B → B
------------------------------------------------------------------------------
-- Level 1
-- Now we introduce Id_B. Given b1 : B, b2 : B, we have the types
-- Id_B(b1,b2) of equivalences
data Id_B : B × B → Set where
unite₊ : { b : B } → Id_B (PLUS ZERO b , b)
uniti₊ : { b : B } → Id_B (b , PLUS ZERO b)
swap₊ : { b₁ b₂ : B } → Id_B (PLUS b₁ b₂ , PLUS b₂ b₁)
assocl₊ : { b₁ b₂ b₃ : B } → Id_B (PLUS b₁ (PLUS b₂ b₃) , PLUS (PLUS b₁ b₂) b₃)
assocr₊ : { b₁ b₂ b₃ : B } → Id_B (PLUS (PLUS b₁ b₂) b₃ , PLUS b₁ (PLUS b₂ b₃))
unite⋆ : { b : B } → Id_B (TIMES ONE b , b)
uniti⋆ : { b : B } → Id_B (b , TIMES ONE b)
swap⋆ : { b₁ b₂ : B } → Id_B (TIMES b₁ b₂ , TIMES b₂ b₁)
assocl⋆ : { b₁ b₂ b₃ : B } →
Id_B (TIMES b₁ (TIMES b₂ b₃) , TIMES (TIMES b₁ b₂) b₃)
assocr⋆ : { b₁ b₂ b₃ : B } →
Id_B (TIMES (TIMES b₁ b₂) b₃ , TIMES b₁ (TIMES b₂ b₃))
dist : { b₁ b₂ b₃ : B } →
Id_B (TIMES (PLUS b₁ b₂) b₃ , PLUS (TIMES b₁ b₃) (TIMES b₂ b₃))
factor : { b₁ b₂ b₃ : B } →
Id_B (PLUS (TIMES b₁ b₃) (TIMES b₂ b₃) , TIMES (PLUS b₁ b₂) b₃)
id⟷ : { b : B } → Id_B (b , b)
sym : { b₁ b₂ : B } → Id_B (b₁ , b₂) → Id_B (b₂ , b₁)
_◎_ : { b₁ b₂ b₃ : B } → Id_B (b₁ , b₂) → Id_B (b₂ , b₃) → Id_B (b₁ , b₃)
_⊕_ : { b₁ b₂ b₃ b₄ : B } →
Id_B (b₁ , b₃) → Id_B (b₂ , b₄) → Id_B (PLUS b₁ b₂ , PLUS b₃ b₄)
_⊗_ : { b₁ b₂ b₃ b₄ : B } →
Id_B (b₁ , b₃) → Id_B (b₂ , b₄) → Id_B (TIMES b₁ b₂ , TIMES b₃ b₄)
-- values
data BVAL : B → Set where
UNIT : BVAL ONE
LEFT : {b₁ b₂ : B} → BVAL b₁ → BVAL (PLUS b₁ b₂)
RIGHT : {b₁ b₂ : B} → BVAL b₂ → BVAL (PLUS b₁ b₂)
PAIR : {b₁ b₂ : B} → BVAL b₁ → BVAL b₂ → BVAL (TIMES b₁ b₂)
mutual
eval : {b₁ b₂ : B} → Id_B (b₁ , b₂) → BVAL b₁ → BVAL b₂
eval unite₊ (LEFT ())
eval unite₊ (RIGHT v) = v
eval uniti₊ v = RIGHT v
eval swap₊ (LEFT v) = RIGHT v
eval swap₊ (RIGHT v) = LEFT v
eval assocl₊ (LEFT v) = LEFT (LEFT v)
eval assocl₊ (RIGHT (LEFT v)) = LEFT (RIGHT v)
eval assocl₊ (RIGHT (RIGHT v)) = RIGHT v
eval assocr₊ (LEFT (LEFT v)) = LEFT v
eval assocr₊ (LEFT (RIGHT v)) = RIGHT (LEFT v)
eval assocr₊ (RIGHT v) = RIGHT (RIGHT v)
eval unite⋆ (PAIR UNIT v) = v
eval uniti⋆ v = PAIR UNIT v
eval swap⋆ (PAIR v1 v2) = PAIR v2 v1
eval assocl⋆ (PAIR v1 (PAIR v2 v3)) = PAIR (PAIR v1 v2) v3
eval assocr⋆ (PAIR (PAIR v1 v2) v3) = PAIR v1 (PAIR v2 v3)
eval dist (PAIR (LEFT v1) v3) = LEFT (PAIR v1 v3)
eval dist (PAIR (RIGHT v2) v3) = RIGHT (PAIR v2 v3)
eval factor (LEFT (PAIR v1 v3)) = PAIR (LEFT v1) v3
eval factor (RIGHT (PAIR v2 v3)) = PAIR (RIGHT v2) v3
eval id⟷ v = v
eval (sym c) v = evalB c v
eval (c₁ ◎ c₂) v = eval c₂ (eval c₁ v)
eval (c₁ ⊕ c₂) (LEFT v) = LEFT (eval c₁ v)
eval (c₁ ⊕ c₂) (RIGHT v) = RIGHT (eval c₂ v)
eval (c₁ ⊗ c₂) (PAIR v₁ v₂) = PAIR (eval c₁ v₁) (eval c₂ v₂)
evalB : {b₁ b₂ : B} → Id_B (b₁ , b₂) → BVAL b₂ → BVAL b₁
evalB unite₊ v = RIGHT v
evalB uniti₊ (LEFT ())
evalB uniti₊ (RIGHT v) = v
evalB swap₊ (LEFT v) = RIGHT v
evalB swap₊ (RIGHT v) = LEFT v
evalB assocl₊ (LEFT (LEFT v)) = LEFT v
evalB assocl₊ (LEFT (RIGHT v)) = RIGHT (LEFT v)
evalB assocl₊ (RIGHT v) = RIGHT (RIGHT v)
evalB assocr₊ (LEFT v) = LEFT (LEFT v)
evalB assocr₊ (RIGHT (LEFT v)) = LEFT (RIGHT v)
evalB assocr₊ (RIGHT (RIGHT v)) = RIGHT v
evalB unite⋆ v = PAIR UNIT v
evalB uniti⋆ (PAIR UNIT v) = v
evalB swap⋆ (PAIR v1 v2) = PAIR v2 v1
evalB assocl⋆ (PAIR (PAIR v1 v2) v3) = PAIR v1 (PAIR v2 v3)
evalB assocr⋆ (PAIR v1 (PAIR v2 v3)) = PAIR (PAIR v1 v2) v3
evalB dist (LEFT (PAIR v1 v3)) = PAIR (LEFT v1) v3
evalB dist (RIGHT (PAIR v2 v3)) = PAIR (RIGHT v2) v3
evalB factor (PAIR (LEFT v1) v3) = LEFT (PAIR v1 v3)
evalB factor (PAIR (RIGHT v2) v3) = RIGHT (PAIR v2 v3)
evalB id⟷ v = v
evalB (sym c) v = eval c v
evalB (c₁ ◎ c₂) v = evalB c₁ (evalB c₂ v)
evalB (c₁ ⊕ c₂) (LEFT v) = LEFT (evalB c₁ v)
evalB (c₁ ⊕ c₂) (RIGHT v) = RIGHT (evalB c₂ v)
evalB (c₁ ⊗ c₂) (PAIR v₁ v₂) = PAIR (evalB c₁ v₁) (evalB c₂ v₂)
------------------------------------------------------------------------------
-- Level 2
-- Now we introduce Id_{Id_B}. Given c1 : Id_B(b1,b2) and c2 :
-- Id_B(b1,b2), we have the type of equivalences that show that c1 and
-- c2 are isomorphic.
--
-- We want:
--
-- data Id_Id_B : {b₁ b₂ : B} → Id_B (b₁ , b₂) × Id_B (b₁ , b₂) → Set where
-- ...
-- but before we do that we need to embed the combinators as values that can
-- be manipulated using combinators
-- define the category Int C whose objects are pairs (B,B) and which has an
-- inverse recip sending (B1,B2) to (B2,B1) and then the compact closed
-- eta/epsilon where eta : I -> (A+,A-) * (recip (A+,A-))
-- the embedding send B to (B,I)
-- INT B has as objects pairs of B objects
{--
data Id_BB : (B × B) × (B × B) → Set where
intarr : { b₁ b₂ b₃ b₄ : B } → Id_BB ((b₁ , b₂) , (b₃ , b₄))
embedArr : { b₁ b₂ b₃ b₄ : B } →
Id_BB ((b₁ , b₂) , (b₃ , b₄)) → Id_B ((b₁ , b₄) , (b₂ , b₃))
embedArr x = ?
Iuniti₊ : { b : B } → Id_BB (b , PLUS ZERO b)
Iswap₊ : { b₁ b₂ : B } → Id_BB (PLUS b₁ b₂ , PLUS b₂ b₁)
Iassocl₊ : { b₁ b₂ b₃ : B } → Id_BB (PLUS b₁ (PLUS b₂ b₃) , PLUS (PLUS b₁ b₂) b₃)
Iassocr₊ : { b₁ b₂ b₃ : B } → Id_BB (PLUS (PLUS b₁ b₂) b₃ , PLUS b₁ (PLUS b₂ b₃))
Iunite⋆ : { b : B } → Id_BB (TIMES ONE b , b)
Iuniti⋆ : { b : B } → Id_BB (b , TIMES ONE b)
Iswap⋆ : { b₁ b₂ : B } → Id_BB (TIMES b₁ b₂ , TIMES b₂ b₁)
Iassocl⋆ : { b₁ b₂ b₃ : B } →
Id_BB (TIMES b₁ (TIMES b₂ b₃) , TIMES (TIMES b₁ b₂) b₃)
Iassocr⋆ : { b₁ b₂ b₃ : B } →
Id_BB (TIMES (TIMES b₁ b₂) b₃ , TIMES b₁ (TIMES b₂ b₃))
Idist : { b₁ b₂ b₃ : B } →
Id_BB (TIMES (PLUS b₁ b₂) b₃ , PLUS (TIMES b₁ b₃) (TIMES b₂ b₃))
Ifactor : { b₁ b₂ b₃ : B } →
Id_BB (PLUS (TIMES b₁ b₃) (TIMES b₂ b₃) , TIMES (PLUS b₁ b₂) b₃)
Iid⟷ : { b : B } → Id_BB (b , b)
Isym : { b₁ b₂ : B } → Id_BB (b₁ , b₂) → Id_BB (b₂ , b₁)
_I◎_ : { b₁ b₂ b₃ : B } → Id_BB (b₁ , b₂) → Id_BB (b₂ , b₃) → Id_BB (b₁ , b₃)
_I⊕_ : { b₁ b₂ b₃ b₄ : B } →
Id_BB (b₁ , b₃) → Id_BB (b₂ , b₄) → Id_BB (PLUS b₁ b₂ , PLUS b₃ b₄)
_I⊗_ : { b₁ b₂ b₃ b₄ : B } →
Id_BB (b₁ , b₃) → Id_BB (b₂ , b₄) → Id_BB (TIMES b₁ b₂ , TIMES b₃ b₄)
data BRVAL : BR → Set where
UNITR : BRVAL ONER
LEFTR : {b₁ b₂ : BR} → BRVAL b₁ → BRVAL (PLUSR b₁ b₂)
RIGHTR : {b₁ b₂ : BR} → BRVAL b₂ → BRVAL (PLUSR b₁ b₂)
PAIRR : {b₁ b₂ : BR} → BRVAL b₁ → BRVAL b₂ → BRVAL (TIMESR b₁ b₂)
RECIPR : {b : BR} → BRVAL b → BRVAL (RECIP b)
embedT : B → BR
embedT ZERO = ZEROR
embedT ONE = ONER
embedT (PLUS b₁ b₂) = PLUSR (embedT b₁) (embedT b₂)
embedT (TIMES b₁ b₂) = TIMESR (embedT b₁) (embedT b₂)
embedV : {b : B} → BVAL b → BRVAL (embedT b)
embedV UNIT = UNITR
embedV (LEFT v) = LEFTR (embedV v)
embedV (RIGHT v) = RIGHTR (embedV v)
embedV (PAIR v₁ v₂) = PAIRR (embedV v₁) (embedV v₂)
embedC : {b₁ b₂ : B} →
Id_B (b₁ , b₂) → BRVAL (TIMESR (RECIP (embedT b₁)) (embedT b₂))
embedC unite₊ = ?
embedC uniti₊ = ?
embedC swap₊ = ?
embedC assocl₊ = ?
embedC assocr₊ = ?
embedC unite⋆ = ?
embedC uniti⋆ = ?
embedC swap⋆ = ?
embedC assocl⋆ = ?
embedC assocr⋆ = ?
embedC dist = ?
embedC factor = ?
embedC id⟷ = ?
embedC (sym c) = ?
embedC (c₁ ◎ c₂) = ?
embedC (c₁ ⊕ c₂) = ?
embedC (c₁ ⊗ c₂) = ?
--}
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_890.asm | ljhsiun2/medusa | 9 | 9324 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x19b5b, %r14
sub %rbx, %rbx
mov (%r14), %edi
nop
nop
xor $43834, %r10
lea addresses_D_ht+0xc06b, %rsi
clflush (%rsi)
nop
nop
nop
cmp $47888, %r13
movups (%rsi), %xmm1
vpextrq $1, %xmm1, %r10
nop
nop
nop
nop
nop
inc %rbx
lea addresses_A_ht+0x186db, %rsi
nop
nop
nop
nop
nop
cmp %r8, %r8
and $0xffffffffffffffc0, %rsi
vmovaps (%rsi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rbx
nop
nop
add $43228, %r10
lea addresses_D_ht+0x8f5b, %rsi
lea addresses_WC_ht+0x2bf2, %rdi
nop
nop
nop
inc %r13
mov $112, %rcx
rep movsq
nop
and $56687, %r13
lea addresses_WT_ht+0xd03, %rdi
nop
nop
nop
mfence
mov $0x6162636465666768, %r14
movq %r14, %xmm3
and $0xffffffffffffffc0, %rdi
vmovaps %ymm3, (%rdi)
nop
nop
nop
cmp $27285, %r14
lea addresses_normal_ht+0x12f2b, %rdi
nop
nop
xor $44506, %r14
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
and $0xffffffffffffffc0, %rdi
vmovntdq %ymm6, (%rdi)
nop
nop
cmp %r8, %r8
lea addresses_D_ht+0x172ab, %r10
nop
dec %r13
and $0xffffffffffffffc0, %r10
vmovaps (%r10), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %r14
xor %r10, %r10
lea addresses_D_ht+0x1075b, %r14
and %r8, %r8
movw $0x6162, (%r14)
nop
cmp $10236, %rdi
lea addresses_WT_ht+0xf49b, %r14
xor %rbx, %rbx
movl $0x61626364, (%r14)
nop
nop
nop
nop
nop
dec %rsi
lea addresses_D_ht+0xbd5b, %r8
nop
nop
nop
nop
add $10036, %rsi
mov $0x6162636465666768, %r14
movq %r14, %xmm7
and $0xffffffffffffffc0, %r8
movntdq %xmm7, (%r8)
nop
nop
xor %rsi, %rsi
lea addresses_normal_ht+0x15cf3, %rsi
lea addresses_D_ht+0x1aadb, %rdi
nop
xor $48813, %r13
mov $56, %rcx
rep movsl
nop
nop
nop
nop
nop
cmp $43277, %r14
lea addresses_D_ht+0x3f5b, %r8
nop
nop
nop
nop
cmp $189, %rdi
and $0xffffffffffffffc0, %r8
movaps (%r8), %xmm6
vpextrq $0, %xmm6, %rcx
nop
add $20839, %r8
lea addresses_D_ht+0x1d75b, %r14
inc %rcx
mov $0x6162636465666768, %rdi
movq %rdi, (%r14)
nop
nop
nop
nop
nop
and %r14, %r14
lea addresses_WT_ht+0xdb5b, %rsi
lea addresses_UC_ht+0xb45b, %rdi
clflush (%rsi)
nop
nop
nop
cmp $42407, %rbx
mov $104, %rcx
rep movsl
nop
nop
nop
nop
nop
and %rbx, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r9
push %rax
push %rbp
push %rbx
// Faulty Load
lea addresses_PSE+0x1ff5b, %r10
nop
nop
nop
nop
nop
cmp $41250, %r9
mov (%r10), %ebx
lea oracles, %r10
and $0xff, %rbx
shlq $12, %rbx
mov (%r10,%rbx,1), %rbx
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': True, 'AVXalign': True, 'size': 32, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': True, 'AVXalign': True, 'size': 32, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_UC_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
*/
|
source/nodes/program-nodes-exception_handlers.ads | optikos/oasis | 0 | 21456 | <reponame>optikos/oasis
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Choice_Parameter_Specifications;
with Program.Element_Vectors;
with Program.Elements.Exception_Handlers;
with Program.Element_Visitors;
package Program.Nodes.Exception_Handlers is
pragma Preelaborate;
type Exception_Handler is
new Program.Nodes.Node
and Program.Elements.Exception_Handlers.Exception_Handler
and Program.Elements.Exception_Handlers.Exception_Handler_Text
with private;
function Create
(When_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Choice_Parameter : Program.Elements.Choice_Parameter_Specifications
.Choice_Parameter_Specification_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Statements : not null Program.Element_Vectors.Element_Vector_Access)
return Exception_Handler;
type Implicit_Exception_Handler is
new Program.Nodes.Node
and Program.Elements.Exception_Handlers.Exception_Handler
with private;
function Create
(Choice_Parameter : Program.Elements.Choice_Parameter_Specifications
.Choice_Parameter_Specification_Access;
Choices : not null Program.Element_Vectors
.Element_Vector_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Exception_Handler
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Exception_Handler is
abstract new Program.Nodes.Node
and Program.Elements.Exception_Handlers.Exception_Handler
with record
Choice_Parameter : Program.Elements.Choice_Parameter_Specifications
.Choice_Parameter_Specification_Access;
Choices : not null Program.Element_Vectors
.Element_Vector_Access;
Statements : not null Program.Element_Vectors
.Element_Vector_Access;
end record;
procedure Initialize (Self : aliased in out Base_Exception_Handler'Class);
overriding procedure Visit
(Self : not null access Base_Exception_Handler;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Choice_Parameter
(Self : Base_Exception_Handler)
return Program.Elements.Choice_Parameter_Specifications
.Choice_Parameter_Specification_Access;
overriding function Choices
(Self : Base_Exception_Handler)
return not null Program.Element_Vectors.Element_Vector_Access;
overriding function Statements
(Self : Base_Exception_Handler)
return not null Program.Element_Vectors.Element_Vector_Access;
overriding function Is_Exception_Handler_Element
(Self : Base_Exception_Handler)
return Boolean;
type Exception_Handler is
new Base_Exception_Handler
and Program.Elements.Exception_Handlers.Exception_Handler_Text
with record
When_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Arrow_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
end record;
overriding function To_Exception_Handler_Text
(Self : aliased in out Exception_Handler)
return Program.Elements.Exception_Handlers.Exception_Handler_Text_Access;
overriding function When_Token
(Self : Exception_Handler)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Arrow_Token
(Self : Exception_Handler)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Exception_Handler is
new Base_Exception_Handler
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Exception_Handler_Text
(Self : aliased in out Implicit_Exception_Handler)
return Program.Elements.Exception_Handlers.Exception_Handler_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Exception_Handler)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Exception_Handler)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Exception_Handler)
return Boolean;
end Program.Nodes.Exception_Handlers;
|
vbox/src/VBox/Runtime/common/asm/ASMCpuId.asm | Nurzamal/rest_api_docker | 0 | 24378 | <reponame>Nurzamal/rest_api_docker
; $Id: ASMCpuId.asm 69111 2017-10-17 14:26:02Z vboxsync $
;; @file
; IPRT - ASMCpuIdExSlow().
;
;
; Copyright (C) 2012-2017 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
; VirtualBox OSE distribution, in which case the provisions of the
; CDDL are applicable instead of those of the GPL.
;
; You may elect to license modified versions of this file under the
; terms and conditions of either the GPL or the CDDL or both.
;
;*******************************************************************************
;* Header Files *
;*******************************************************************************
%include "iprt/asmdefs.mac"
BEGINCODE
;;
; CPUID with EAX input, returning ALL output registers (no NULL checking).
;
; @param uOperator 8086:bp+4 x86:ebp+8 gcc:rdi msc:rcx
; @param pvEAX 8086:bp+8 x86:ebp+0c gcc:rsi msc:rdx
; @param pvEBX 8086:bp+0c x86:ebp+10 gcc:rdx msc:r8
; @param pvECX 8086:bp+10 x86:ebp+14 gcc:rcx msc:r9
; @param pvEDX 8086:bp+14 x86:ebp+18 gcc:r8 msc:rbp+30h
;
; DECLASM(void) ASMCpuId(uint32_t uOperator, void *pvEAX, void *pvEBX, void *pvECX, void *pvEDX);
;
BEGINPROC_EXPORTED ASMCpuId
push xBP
mov xBP, xSP
push xBX
%ifdef ASM_CALL64_MSC
%if ARCH_BITS != 64
%error ARCH_BITS mismatch?
%endif
mov eax, ecx
mov r10, rdx
cpuid
mov [r10], eax
mov [r8], ebx
mov [r9], ecx
mov r10, [rbp+30h]
mov [r10], edx
%elifdef ASM_CALL64_GCC
mov eax, edi
mov r10, rdx
mov r11, rcx
cpuid
mov [rsi], eax
mov [r10], ebx
mov [r11], ecx
mov [r8], edx
%elif ARCH_BITS == 32
mov eax, [xBP + 08h]
cpuid
push edx
mov edx, [xBP + 0ch]
mov [edx], eax
mov edx, [xBP + 10h]
mov [edx], ebx
mov edx, [xBP + 14h]
mov [edx], ecx
mov edx, [xBP + 18h]
pop dword [edx]
%elif ARCH_BITS == 16
push es
push di
mov eax, [xBP + 04h]
cpuid
les di, [xBP + 08h]
mov [di], eax
les di, [xBP + 0ch]
mov [di], ebx
les di, [xBP + 10h]
mov [di], ecx
les di, [xBP + 14h]
mov [di], edx
pop di
pop es
%else
%error unsupported arch
%endif
pop xBX
leave
ret
ENDPROC ASMCpuId
|
source/directories/machine-pc-linux-gnu/s-nadico.adb | ytomino/drake | 33 | 17447 | <filename>source/directories/machine-pc-linux-gnu/s-nadico.adb
with Ada.Exception_Identification.From_Here;
with System.Zero_Terminated_Strings;
with C.errno;
with C.fcntl;
with C.stdio; -- rename(2)
with C.sys.sendfile;
with C.unistd;
package body System.Native_Directories.Copying is
use Ada.Exception_Identification.From_Here;
use type Ada.Exception_Identification.Exception_Id;
use type C.signed_int;
use type C.unsigned_short; -- mode_t in FreeBSD
use type C.unsigned_int; -- open flag, and mode_t in Linux
use type C.signed_long; -- 64bit ssize_t
use type C.size_t;
-- implementation
procedure Copy_File (
Source_Name : String;
Target_Name : String;
Overwrite : Boolean := True)
is
Exception_Id : Ada.Exception_Identification.Exception_Id :=
Ada.Exception_Identification.Null_Id;
C_Source_Name : C.char_array (
0 ..
Source_Name'Length * Zero_Terminated_Strings.Expanding);
Source : C.signed_int;
C_Target_Name : C.char_array (
0 ..
Target_Name'Length * Zero_Terminated_Strings.Expanding);
Target : C.signed_int;
Flag : C.unsigned_int;
Data : aliased C.sys.stat.struct_stat;
Written : C.sys.types.ssize_t;
begin
Zero_Terminated_Strings.To_C (Source_Name, C_Source_Name (0)'Access);
Zero_Terminated_Strings.To_C (Target_Name, C_Target_Name (0)'Access);
Source := C.fcntl.open (C_Source_Name (0)'Access, C.fcntl.O_RDONLY);
if Source < 0 then
Exception_Id := Named_IO_Exception_Id (C.errno.errno);
else
if C.sys.stat.fstat (Source, Data'Access) < 0 then
Exception_Id := IO_Exception_Id (C.errno.errno);
else
Flag := C.fcntl.O_WRONLY or C.fcntl.O_CREAT or C.fcntl.O_EXLOCK;
if not Overwrite then
Flag := Flag or C.fcntl.O_EXCL;
end if;
Target := C.fcntl.open (
C_Target_Name (0)'Access,
C.signed_int (Flag),
Data.st_mode);
if Target < 0 then
Exception_Id := Named_IO_Exception_Id (C.errno.errno);
else
if C.unistd.ftruncate (Target, Data.st_size) < 0 then
null;
end if;
Written := C.sys.sendfile.sendfile (
Target,
Source,
null,
C.size_t (Data.st_size));
if Written < C.sys.types.ssize_t (Data.st_size) then
Exception_Id := Device_Error'Identity;
end if;
-- close target
if C.unistd.close (Target) < 0
and then Exception_Id = Ada.Exception_Identification.Null_Id
then
Exception_Id := IO_Exception_Id (C.errno.errno);
end if;
end if;
end if;
-- close source
if C.unistd.close (Source) < 0
and then Exception_Id = Ada.Exception_Identification.Null_Id
then
Exception_Id := IO_Exception_Id (C.errno.errno);
end if;
end if;
-- raising
if Exception_Id /= Ada.Exception_Identification.Null_Id then
Raise_Exception (Exception_Id);
end if;
end Copy_File;
procedure Replace_File (
Source_Name : String;
Target_Name : String)
is
C_Source_Name : C.char_array (
0 ..
Source_Name'Length * Zero_Terminated_Strings.Expanding);
C_Target_Name : C.char_array (
0 ..
Target_Name'Length * Zero_Terminated_Strings.Expanding);
Target_Info : aliased C.sys.stat.struct_stat;
Error : Boolean;
begin
Zero_Terminated_Strings.To_C (Source_Name, C_Source_Name (0)'Access);
Zero_Terminated_Strings.To_C (Target_Name, C_Target_Name (0)'Access);
-- if the target is already existing,
-- copy attributes from the target to the source.
Error := False;
if C.sys.stat.lstat (C_Target_Name (0)'Access, Target_Info'Access) = 0
and then (Target_Info.st_mode and C.sys.stat.S_IFMT) /=
C.sys.stat.S_IFLNK -- Linux does not have lchmod
then
Error := C.sys.stat.chmod (
C_Source_Name (0)'Access,
Target_Info.st_mode and C.sys.stat.ALLPERMS) < 0;
end if;
if not Error then
-- overwrite the target with the source.
Error := C.stdio.rename (
C_Source_Name (0)'Access,
C_Target_Name (0)'Access) < 0;
end if;
if Error then
Raise_Exception (Named_IO_Exception_Id (C.errno.errno));
end if;
end Replace_File;
end System.Native_Directories.Copying;
|
src/bitmap_fonts/giza-bitmap_fonts.ads | Fabien-Chouteau/Giza | 7 | 17922 | ------------------------------------------------------------------------------
-- --
-- Giza --
-- --
-- Copyright (C) 2016 <NAME> (<EMAIL>) --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Interfaces; use Interfaces;
with Giza.Context; use Giza.Context;
with Giza.Font; use Giza.Font;
package Giza.Bitmap_Fonts is
subtype Parent is Font.Instance;
type Bitmap_Font is new Parent with private;
overriding
procedure Glyph_Box (This : Bitmap_Font;
C : Character;
Width, Height, X_Advance : out Natural;
X_Offset, Y_Offset : out Integer);
overriding
procedure Print_Glyph (This : Bitmap_Font;
Ctx : in out Context.Class;
C : Character);
overriding
function Y_Advance (This : Bitmap_Font) return Integer;
private
type Font_Bitmap is array (Positive range <>) of Unsigned_8;
type Font_Bitmap_Ref is not null access constant Font_Bitmap;
type Bitmap_Glyph is record
BitmapOffset : Unsigned_16;
Width, Height : Unsigned_8;
X_Advance : Unsigned_8;
X_Offset, Y_Offset : Integer_8;
end record;
type Glyph_Array is array (16#20# .. 16#7E#) of Bitmap_Glyph;
type Glyph_Array_Ref is not null access constant Glyph_Array;
type Bitmap_Font is new Parent with record
Bitmap : Font_Bitmap_Ref;
Glyphs : Glyph_Array_Ref;
Y_Advance : Unsigned_8;
end record;
end Giza.Bitmap_Fonts;
|
PRG/objects/4-1Bonus.asm | narfman0/smb3_pp1 | 0 | 95626 | .byte $01 ; Unknown purpose
.byte OBJ_BIGBERTHABIRTHER, $0F, $13
.byte OBJ_BIGBERTHABIRTHER, $17, $17
.byte $FF ; Terminator
|
experiments/test-suite/mutation-based/10/2/binaryTree.als | kaiyuanw/AlloyFLCore | 1 | 4476 | <filename>experiments/test-suite/mutation-based/10/2/binaryTree.als
pred test7 {
some disj Node0, Node1: Node {
Node = Node0 + Node1
left = Node1->Node1
no right
}
}
run test7 for 3 expect 1
pred test21 {
some disj Node0, Node1, Node2: Node {
Node = Node0 + Node1 + Node2
left = Node0->Node2 + Node1->Node0
no right
Acyclic[]
}
}
run test21 for 3 expect 1
pred test4 {
some disj Node0: Node {
Node = Node0
no left
no right
}
}
run test4 for 3 expect 1
|
tools/fuse/akt-commands-mount.adb | My-Colaborations/ada-keystore | 0 | 27393 | <filename>tools/fuse/akt-commands-mount.adb
-----------------------------------------------------------------------
-- akt-commands-mount -- Mount the keystore on the filesystem for direct access
-- Copyright (C) 2019, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with System;
with Fuse;
with AKT.Filesystem;
package body AKT.Commands.Mount is
use type System.Address;
function Sys_Daemon (No_Chdir : in Integer; No_Close : in Integer) return Integer
with Import => True, Convention => C, Link_Name => "daemon";
pragma Weak_External (Sys_Daemon);
Mount_Command : aliased Command_Type;
-- ------------------------------
-- Mount the keystore on the filesystem.
-- ------------------------------
overriding
procedure Execute (Command : in out Command_Type;
Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type) is
pragma Unreferenced (Name);
Data : AKT.Filesystem.User_Data_Type;
Mount_Arguments : Fuse.Arguments_Type;
begin
Data.Wallet := Context.Wallet'Unchecked_Access;
Data.Direct_IO := not Command.Enable_Cache;
-- We can open the keystore before going in background
-- but don't create the worker tasks.
Context.Open_Keystore (Args, Use_Worker => False);
-- If daemon(3) is available and -d is defined, run it so that the parent
-- process terminates and the child process continues.
if not Command.Foreground and Sys_Daemon'Address /= System.Null_Address then
declare
Result : constant Integer := Sys_Daemon (1, 0);
begin
if Result /= 0 then
AKT.Commands.Log.Error ("Cannot run in background");
end if;
end;
end if;
-- Now we can start the workers.
if Context.Worker_Count > 1 then
Context.Workers := new Keystore.Task_Manager (Context.Worker_Count);
Keystore.Start (Context.Workers);
Context.Wallet.Set_Work_Manager (Context.Workers);
end if;
-- Always run in foreground because Open_Keystore has started some tasks
-- and we need them (they will dead in the child if fuse runs as daemon).
Mount_Arguments.Append ("-f");
if Command.Verbose_Fuse then
Mount_Arguments.Append ("-d");
end if;
-- Enable big writes because it's faster with 128K writes.
Mount_Arguments.Append ("-o");
Mount_Arguments.Append ("big_writes");
for I in Context.First_Arg .. Args.Get_Count loop
Mount_Arguments.Append (Args.Get_Argument (I));
end loop;
AKT.Filesystem.Fuse_Keystore.Main (Mount_Arguments, Data);
end Execute;
-- ------------------------------
-- Setup the command before parsing the arguments and executing it.
-- ------------------------------
procedure Setup (Command : in out Command_Type;
Config : in out GNAT.Command_Line.Command_Line_Configuration;
Context : in out Context_Type) is
package GC renames GNAT.Command_Line;
begin
Drivers.Command_Type (Command).Setup (Config, Context);
GC.Define_Switch (Config => Config,
Output => Command.Foreground'Access,
Switch => "-f",
Long_Switch => "--foreground",
Help => -("Run as foreground (no daemonize)"));
GC.Define_Switch (Config => Config,
Output => Command.Verbose_Fuse'Access,
Long_Switch => "--debug-fuse",
Help => -("Enable debug output of fuse library"));
GC.Define_Switch (Config => Config,
Output => Command.Enable_Cache'Access,
Long_Switch => "--enable-cache",
Help => -("Allow the kernel to cache data from this file system"));
end Setup;
procedure Register (Driver : in out AKT.Commands.Drivers.Driver_Type) is
begin
Driver.Add_Command ("mount",
-("mount the keystore on the filesystem for a direct access"),
Mount_Command'Access);
end Register;
end AKT.Commands.Mount;
|
programs/oeis/107/A107008.asm | neoneye/loda | 22 | 3550 | ; A107008: Primes of the form x^2 + 24*y^2.
; 73,97,193,241,313,337,409,433,457,577,601,673,769,937,1009,1033,1129,1153,1201,1249,1297,1321,1489,1609,1657,1753,1777,1801,1873,1993,2017,2089,2113,2137,2161,2281,2377,2473,2521,2593,2617,2689,2713,2833,2857,2953,3001,3049,3121,3169,3217,3313,3361,3433,3457,3529,3673,3697,3769,3793,3889,4057,4129,4153,4177,4201,4273,4297,4441,4513,4561,4657,4729,4801,4969,4993,5113,5209,5233,5281,5449,5521,5569,5641,5689,5737,5857,5881,5953,6073,6121,6217,6337,6361,6481,6529,6553,6577,6673,6793
seq $0,141375 ; Primes of the form x^2+8*x*y-8*y^2 (as well as of the form x^2+10*x*y+y^2).
|
Transynther/x86/_processed/NONE/_zr_/i3-7100_9_0x84_notsx.log_113_106.asm | ljhsiun2/medusa | 9 | 935 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %r8
push %rcx
push %rdi
push %rdx
lea addresses_normal_ht+0x3151, %r15
nop
nop
nop
nop
and %r12, %r12
mov $0x6162636465666768, %rdi
movq %rdi, (%r15)
nop
cmp $64342, %r13
lea addresses_WT_ht+0x110f1, %r8
nop
nop
nop
nop
nop
add %rcx, %rcx
mov (%r8), %dx
nop
nop
nop
nop
nop
sub $41090, %rcx
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r8
push %r9
push %rcx
push %rsi
// Store
mov $0x41be0a0000000611, %r9
nop
nop
nop
sub $3087, %r14
movl $0x51525354, (%r9)
nop
nop
nop
nop
nop
and $8263, %rcx
// Faulty Load
lea addresses_A+0x1e8d1, %r10
nop
nop
and %r11, %r11
mov (%r10), %r9w
lea oracles, %r8
and $0xff, %r9
shlq $12, %r9
mov (%r8,%r9,1), %r9
pop %rsi
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 4, 'congruent': 6, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'00': 113}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/load.asm | dikdom/tapecart-browser | 5 | 176919 | <gh_stars>1-10
block load -- @ 0x0200
var lohi end @zp
var lohi ptr @zp
inline byte raster_pos = 60
var lohi progress @zp
run:
// load address (lo only)
ldy ptr.lo
// clear lo part of ptr
lda 0
sta ptr.lo
lda 0
sta progress.lo
lda 220
sta progress.hi
loop:
jsr getbyte.run
sta [ptr], y
$if displayBytes
smc_display_bytes:
lda vic.border_color
$endif
lda vic.raster
cmp.imm @raster_pos
bpl next_raster
continue_raster:
iny
bne __skip
inc ptr.hi
lda progress.lo
sec
sbc div_var.quot.lo
sta progress.lo
lda progress.hi
sbc div_var.quot.hi
sta progress.hi
__skip:
cpy end.lo
bne loop
lda ptr.hi
cmp end.hi
bne loop
lda basic.area[0]
sta launch_kernal.eighthundred[0]
lda basic.area[1]
sta launch_kernal.eighthundred[1]
lda basic.area[2]
sta launch_kernal.eighthundred[2]
dec cpu.port
lda basic.rom
sta launch_kernal.rom_check
inc cpu.port
jmp launch_kernal.run
// positions: 0 (occur twice, trigger once) 95 (100..220) 225
next_raster:
lda raster_pos
beq r0
cmp 95
beq r95
cmp 225
beq r225
rlevel:
$if displayBytes
lda 0x8d
sta byte(smc_display_bytes)
$else
lda $grey4
sta vic.border_color
$endif
lda 225
bne exit_raster
r225:
$if displayBytes
lda 0xad
sta byte(smc_display_bytes)
$endif
lda $black4
sta vic.border_color
lda 0
beq exit_raster
r0:
lda $black4
sta vic.border_color
lda 95
bne exit_raster
r95:
lda $darkGrey4
sta vic.border_color
lda progress.hi
-- bne exit_raster
exit_raster:
sta raster_pos
jmp continue_raster
block getbyte -- @ 0x0200
run:
$if fakeTapecart
inline byte p = 0
const byte[] dat = [[ /* 0x01, 0x08, */ 0x0c, 0x08, 0x0a, 0x00, 0x99, 0x22, 0x41, 0x4c, 0x58, 0x22, 0x00, 0x00, 0x00 ]] @reloc_0200
ldx.imm @p
lda dat, x
inc p
-- try to emulate the routine time
var byte nopCrasher @reloc_0200
inc nopCrasher
inc nopCrasher
inc nopCrasher
inc nopCrasher
inc nopCrasher
inc nopCrasher
inc nopCrasher
inc nopCrasher
inc nopCrasher
$elseif useFastLoader
const byte[16] nibbletab = [[0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]] @reloc_0200
// wait until tapecart is ready (sense high)
lda 0x10
rdyloop:
-- inc vic.border_color
bit cpu.port
beq rdyloop
// (this would be a nice place to check if a badline is coming up)
// send our own ready signal
ldx 0x38
lda 0x27
stx cpu.port // set write high (start signal)
sta cpu.ddr // 3 - switch write to input
nop // 2 - delay
// receive byte
lda cpu.port // 3 - read bits 5+4
and 0x18 // 2 - mask
lsr // 2 - shift down
lsr // 2
eor cpu.port // 3 - read bits 7+6 (EOR invertes 5+4!)
lsr // 2
and 0x0f // 2 - mask
tax // 2 - remember value
lda cpu.port // 3 - read bits 1+0
and 0x18 // 2 - mask
lsr // 2 - shift down
lsr // 2
eor cpu.port // 3 - read bits 3+2 (EOR inverts 1+0!)
lsr // 2
and 0x0f // 2 - mask
ora nibbletab,x // 4 - add upper nibble
ldx 0x2f // 2 - switch write to output
stx cpu.ddr // 3
ldx 0x36 // set write low again
stx cpu.port
$else
var byte result @zp
// returns byte in A, preserves Y
// NEW trashes Y
// wait until AVR is ready (sense high)
lda 0x10
rdyloop:
bit cpu.port
beq rdyloop
// send our own ready signal
lda 0x3f -- 0x3d
// lda #$37 // bit4 of $00 set to 1
sta cpu.port // set write high (start signal)
// sta $00 // 3 - switch write to output
// nop // 2 - delay
//now start
ldx 7
iloop:
lda cpu.port
and 0b1111.0111 // write low
sta cpu.port
lda cpu.port
ora 0b0000.1000 // write high
sta cpu.port
lda cpu.port
// 76543210
rol
// 7-6543210c
rol
// 6-543210c7
rol
// 5-43210c76
rol //bit in carry (sense)
// 4-3210c765
rol result
dex
bpl iloop
lda cpu.port
and 0b1111.0111 //write low
sta cpu.port
lda result
$endif
rts
end
end
|
programs/oeis/195/A195028.asm | karttu/loda | 1 | 13052 | <reponame>karttu/loda<filename>programs/oeis/195/A195028.asm
; A195028: a(n) = n*(14*n + 13).
; 0,27,82,165,276,415,582,777,1000,1251,1530,1837,2172,2535,2926,3345,3792,4267,4770,5301,5860,6447,7062,7705,8376,9075,9802,10557,11340,12151,12990,13857,14752,15675,16626,17605,18612,19647,20710,21801,22920,24067,25242,26445,27676,28935,30222,31537,32880,34251,35650,37077,38532,40015,41526,43065,44632,46227,47850,49501,51180,52887,54622,56385,58176,59995,61842,63717,65620,67551,69510,71497,73512,75555,77626,79725,81852,84007,86190,88401,90640,92907,95202,97525,99876,102255,104662,107097,109560,112051,114570,117117,119692,122295,124926,127585,130272,132987,135730,138501,141300,144127,146982,149865,152776,155715,158682,161677,164700,167751,170830,173937,177072,180235,183426,186645,189892,193167,196470,199801,203160,206547,209962,213405,216876,220375,223902,227457,231040,234651,238290,241957,245652,249375,253126,256905,260712,264547,268410,272301,276220,280167,284142,288145,292176,296235,300322,304437,308580,312751,316950,321177,325432,329715,334026,338365,342732,347127,351550,356001,360480,364987,369522,374085,378676,383295,387942,392617,397320,402051,406810,411597,416412,421255,426126,431025,435952,440907,445890,450901,455940,461007,466102,471225,476376,481555,486762,491997,497260,502551,507870,513217,518592,523995,529426,534885,540372,545887,551430,557001,562600,568227,573882,579565,585276,591015,596782,602577,608400,614251,620130,626037,631972,637935,643926,649945,655992,662067,668170,674301,680460,686647,692862,699105,705376,711675,718002,724357,730740,737151,743590,750057,756552,763075,769626,776205,782812,789447,796110,802801,809520,816267,823042,829845,836676,843535,850422,857337,864280,871251
mov $1,14
mul $1,$0
add $1,13
mul $1,$0
|
src/Get Certbot Keys.applescript | x7fff/Certbot-certificate-copier | 0 | 2673 | use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
(*
Some useful references
• https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_about_handlers.html
• https://stackoverflow.com/questions/33035959/optional-parameters-in-applescript-handlers
• https://discussions.apple.com/docs/DOC-6681
• https://certbot.eff.org/docs/
Files we're looking for, if site name is example.com
• /etc/letsencrypt/live/example.com/cert.pem
• /etc/letsencrypt/live/example.com/privkey.pem
*)
property certFolderBase : "/etc/letsencrypt/live/"
property fileNameCertificate : "cert.pem"
property fileNamePrivateKey : "privkey.pem"
property msgPleaseCheck : return & return & "Check the validity of the site’s sub-folder under “" & certFolderBase & "”."
property msgNoSitesFound : "No eligible sites were found." & msgPleaseCheck
property msgGotCertificate0 : "The security certificate for site “"
property msgGotCertificate1 : "” is now on the clipboard." & return & return & ¬
"After you have dealt with that, press “Continue” to copy the private key to the clipboard."
property msgMissingCertificate : "The certificate file could not be found." & msgPleaseCheck
property msgCertificateFormatFailed : "The certificate file is not in the proper format."
property msgGotPrivateKey : "The site’s private key is now on the clipboard."
property msgMissingPrivateKey : "The private key file could not be found." & msgPleaseCheck
property msgPrivateKeyFormatFailed : "The private key file is not in the proper format."
on run
set bCancelled to false
set siteFolders to getSiteFolders()
if siteFolders is not false then
if (length of siteFolders is 0) then
tell me to quitMessage:msgNoSitesFound
set bCancelled to true
else if (length of siteFolders is 1) then
set site to item 1 of siteFolders
else
choose from list siteFolders with prompt "Choose the site"
if the result is not false then
set site to item 1 of the result
else
set bCancelled to true
end if
end if
if not bCancelled then
set certFolder to certFolderBase & site & "/"
-- try to get the site certificate
set fileContents to getFileContents for certFolder & fileNameCertificate
if fileContents is false then
tell me to quitMessage:msgMissingCertificate
else if the length of fileContents is 0 or the first paragraph of fileContents does not contain "BEGIN CERTIFICATE" then
tell me to quitMessage:msgCertificateFormatFailed
else
set the clipboard to fileContents
display dialog msgGotCertificate0 & site & msgGotCertificate1 with icon note buttons {"Cancel", "Continue"} default button "Continue"
-- now do the Private Key
set fileContents to getFileContents for certFolder & fileNamePrivateKey
if fileContents is false then
tell me to quitMessage:msgMissingPrivateKey
else if the length of fileContents is 0 or the first paragraph of fileContents does not contain "BEGIN PRIVATE KEY" then
tell me to quitMessage:msgPrivateKeyFormatFailed
else
set the clipboard to fileContents
display dialog msgGotPrivateKey with icon note buttons {"Clear Clipboard and Quit", "Quit"} default button "Quit"
if button returned of the result is not "Quit" then
set the clipboard to ""
end if
end if
end if
end if
end if
end run
on oneButtonMessage:msg button:btn
display dialog msg with icon note buttons btn default button 1
end oneButtonMessage:button:
on quitMessage:msg
tell me to oneButtonMessage:msg button:"Quit"
end quitMessage:
(* @return - false if they cancelled the authentication dialogue, else a list of zero or more site (folder) names
*)
to getSiteFolders()
set rtn to false
set dirListing to sudoCommand for "ls " & certFolderBase
log {"•dirListing•", dirListing}
if dirListing is not false then
set rtn to every paragraph of dirListing -- convert to a list
end if
return rtn
end getSiteFolders
to getFileContents for filePath
return sudoCommand for "cat " & filePath
end getFileContents
(* @return - false if there was an error (not the shell’s error code), otherwise the output of the command as provided by do shell script
*)
to sudoCommand for theCommand
set shellResult to false
try
with timeout of 5 seconds
set shellResult to do shell script theCommand ¬
with prompt "An administrator password is required to access the Certbot site certificate(s)." with administrator privileges
end timeout
on error errMsg number errNumber
if errNumber is not -128 then -- userCanceledErr
display dialog "A unexpected error has occurred. (" & errNumber & ")" & return & return & errMsg buttons {"Okay"} default button "Okay"
end if
end try
return shellResult
end sudoCommand
|
programs/oeis/057/A057661.asm | neoneye/loda | 22 | 7454 | ; A057661: a(n) = Sum_{k=1..n} lcm(n,k)/n.
; 1,2,4,6,11,11,22,22,31,32,56,39,79,65,74,86,137,92,172,116,151,167,254,151,261,236,274,237,407,221,466,342,389,410,452,336,667,515,550,452,821,452,904,611,641,761,1082,599,1051,782,956,864,1379,821,1166,925,1201,1220,1712,809,1831,1397,1312,1366,1649,1166,2212,1502,1775,1355,2486,1312,2629,2000,1824,1887,2387,1649,3082,1796,2461,2462,3404,1656,2867,2711,2846,2387,3917,1922,3376,2789,3259,3245,3602,2391,4657,3152,3386,2866
add $0,1
pow $0,2
mov $2,$0
lpb $0
mov $3,$2
mov $4,$0
cmp $4,0
add $0,$4
dif $3,$0
cmp $3,$2
cmp $3,0
mul $3,$0
add $5,$3
mul $3,$0
sub $0,1
add $1,$3
lpe
mov $0,$1
cmp $4,0
add $5,$4
div $0,$5
div $0,2
add $0,1
|
test/Succeed/Issue5922.agda | KDr2/agda | 0 | 4029 | <filename>test/Succeed/Issue5922.agda
-- Andreas, 2022-06-10, issue #5922, reported by j-towns.
-- Lack of normalization of data projections against data constructors
-- breaks termination checker applied to extended lambda gone through
-- forcing translation and reflection.
-- The workaround was to turn off the forcing translation:
-- {-# OPTIONS --no-forcing #-}
-- {-# OPTIONS -v term:20 #-}
open import Agda.Builtin.Nat
open import Agda.Builtin.Reflection
open import Agda.Builtin.Unit
data Fin : Nat → Set where
fz : (b : Nat) → Fin (suc b)
fs : (b : Nat) → Fin b → Fin (suc b)
apply : {A B C : Set} (input : A) (f : A → B) (cont : B → C) → C
apply input f cont = cont (f input)
macro
id-macro : (b : Nat) → (Fin b → Nat) → Term → TC ⊤
id-macro b f hole =
bindTC (quoteTC f) λ f-term →
unify hole f-term
test : (b : Nat) → Fin b → Nat
test b = id-macro b λ where
(fz _) → zero
(fs a x) → apply x (test a) suc
-- Should termination check.
-- WAS:
-- Termination checking failed for the following functions:
-- test
-- Problematic calls:
-- λ { (fz .(Agda.Builtin.Nat.suc-0 _)) → zero
-- ; (fs .(Agda.Builtin.Nat.suc-0 _) x)
-- → apply x
-- (test (Agda.Builtin.Nat.suc-0 (suc (Agda.Builtin.Nat.suc-0 b))))
-- suc
-- }
-- test (Agda.Builtin.Nat.suc-0 (suc b))
--
-- This shows data projection Agda.Builtin.Nat.suc-0 applied to data constructor
-- suc, which should be normalized away.
|
patches/vwf_dialogues/vwfframes.asm | RPGHacker/SMW-Workspace | 9 | 28269 | ; This is the palette table that contains the headers and colours for each frame.
; Format:
;db %--------,%-------- ; Frame header (currently all zeroes, intended for future expansion)
;dw $COL1,$COL2,$COL3 ; Frame palette
; Frame $00
db %00000000,%00000000
dw $0000,$FFFF,$0000
; Frame $01
db %00000000,%00000000
dw $0A56,$04ED,$0044
; Frame $02
db %00000000,%00000000
dw $45ED,$24E6,$0C41
; Frame $03
db %00000000,%00000000
dw $477D,$2E55,$214D
; Frame $04
db %00000000,%00000000
dw $00C4,$1F7F,$15D1
; Frame $05
db %00000000,%00000000
dw $739C,$5250,$0000
; Frame $06
db %00000000,%00000000
dw $473F,$3EDC,$3258
; Frame $07
db %00000000,%00000000
dw $5235,$290A,$679F
; Frame $08
db %00000000,%00000000
dw $3250,$2D09,$0C63
; Frame $09
db %00000000,%00000000
dw $3250,$2D09,$0C63
; Frame $0A
db %00000000,%00000000
dw $3250,$2D09,$0C63
; Frame $0B
db %00000000,%00000000
dw $45ED,$24E6,$0C41
; Frame $0C
db %00000000,%00000000
dw $0A56,$04ED,$0044
; Frame $0D
db %00000000,%00000000
dw $19F0,$00CB,$0044
; Frame $0E
db %00000000,%00000000
dw $3250,$2D09,$0C63
; Frame $0F
db %00000000,%00000000
dw $3250,$2D09,$0C63
|
Projetos/J-VMTranslator/bin/nasm/SimplePushAdd.nasm | mariaeduardabicalho/Z01 | 2 | 166093 | <gh_stars>1-10
; 0 - PUSH constant 5
leaw $5, %A
movw %A, %S
leaw $SP, %A
movw (%A), %D
movw %D, %A
movw %S, (%A)
leaw $SP, %A
movw (%A), %A
incw %A
movw %A, %S
leaw $SP, %A
movw %S, (%A)
; 1 - PUSH constant 9
leaw $9, %A
movw %A, %S
leaw $SP, %A
movw (%A), %D
movw %D, %A
movw %S, (%A)
leaw $SP, %A
movw (%A), %A
incw %A
movw %A, %S
leaw $SP, %A
movw %S, (%A)
; 2 - ADD
leaw $SP,%A
movw (%A),%S
movw %S,%A
decw %A
movw (%A),%S
decw %A
addw (%A),%S,%D
movw %D,(%A)
incw %A
movw %A,%D
leaw $SP,%A
movw %D,(%A)
; End
|
oeis/026/A026165.asm | neoneye/loda-programs | 11 | 170108 | <filename>oeis/026/A026165.asm
; A026165: Number of (s(0), s(1), ..., s(n)) such that every s(i) is a nonnegative integer, s(0) = 2, |s(1) - s(0)| = 1, |s(i) - s(i-1)| <= 1 for i >= 2. Also sum of numbers in row n+1 of the array T in A026148.
; Submitted by <NAME>
; 1,2,6,17,49,141,407,1177,3411,9904,28808,83931,244895,715534,2093262,6130767,17974779,52751358,154950378,455524203,1340182539,3945723033,11624603235,34268836707,101081770181,298320243976,880875609552,2602287231901,7691173199897,22741315926549,67268856947231,199057515581737,589251266656467,1744905349079966,5168746167790714,15315586344618723,45395284037738611,134589310605804815,399142116605577309,1184013085525412747,3513116440124099017,10426321865121140904,30950522052185343168
mov $3,2
mov $5,$0
lpb $3
mov $0,$5
sub $3,1
add $0,$3
max $0,0
seq $0,5774 ; Number of directed animals of size n (k=1 column of A038622); number of (s(0), s(1), ..., s(n)) such that s(i) is a nonnegative integer and |s(i) - s(i-1)| <= 1 for i = 1,2,...,n, where s(0) = 2; also sum of row n+1 of array T in A026323.
mul $0,2
mov $2,$3
mul $2,$0
add $4,$2
lpe
min $5,1
mul $5,$0
mov $0,$4
sub $0,$5
div $0,2
|
HC6502/PS2_Keyboard/stm8/software/stm8s-sdcc/src/stm8s_exti.asm | wuxx/HC6502 | 16 | 105105 | ;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.8.0 #10562 (Linux)
;--------------------------------------------------------
.module stm8s_exti
.optsdcc -mstm8
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _assert_failed
.globl _EXTI_DeInit
.globl _EXTI_SetExtIntSensitivity
.globl _EXTI_SetTLISensitivity
.globl _EXTI_GetExtIntSensitivity
.globl _EXTI_GetTLISensitivity
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area DATA
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
.area INITIALIZED
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area DABS (ABS)
; default segment ordering for linker
.area HOME
.area GSINIT
.area GSFINAL
.area CONST
.area INITIALIZER
.area CODE
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area HOME
.area GSINIT
.area GSFINAL
.area GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area HOME
.area HOME
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area CODE
; ../src/stm8s_exti.c: 53: void EXTI_DeInit(void)
; -----------------------------------------
; function EXTI_DeInit
; -----------------------------------------
_EXTI_DeInit:
; ../src/stm8s_exti.c: 55: EXTI->CR1 = EXTI_CR1_RESET_VALUE;
mov 0x50a0+0, #0x00
; ../src/stm8s_exti.c: 56: EXTI->CR2 = EXTI_CR2_RESET_VALUE;
mov 0x50a1+0, #0x00
; ../src/stm8s_exti.c: 57: }
ret
; ../src/stm8s_exti.c: 70: void EXTI_SetExtIntSensitivity(EXTI_Port_TypeDef Port, EXTI_Sensitivity_TypeDef SensitivityValue)
; -----------------------------------------
; function EXTI_SetExtIntSensitivity
; -----------------------------------------
_EXTI_SetExtIntSensitivity:
pushw x
; ../src/stm8s_exti.c: 73: assert_param(IS_EXTI_PORT_OK(Port));
tnz (0x05, sp)
jreq 00111$
ld a, (0x05, sp)
dec a
jreq 00111$
ld a, (0x05, sp)
cp a, #0x02
jreq 00111$
ld a, (0x05, sp)
cp a, #0x03
jreq 00111$
ld a, (0x05, sp)
cp a, #0x04
jreq 00111$
push #0x49
clrw x
pushw x
push #0x00
push #<___str_0
push #(___str_0 >> 8)
call _assert_failed
addw sp, #6
00111$:
; ../src/stm8s_exti.c: 74: assert_param(IS_EXTI_SENSITIVITY_OK(SensitivityValue));
tnz (0x06, sp)
jreq 00125$
ld a, (0x06, sp)
dec a
jreq 00125$
ld a, (0x06, sp)
cp a, #0x02
jreq 00125$
ld a, (0x06, sp)
cp a, #0x03
jreq 00125$
push #0x4a
clrw x
pushw x
push #0x00
push #<___str_0
push #(___str_0 >> 8)
call _assert_failed
addw sp, #6
00125$:
; ../src/stm8s_exti.c: 77: switch (Port)
ld a, (0x05, sp)
cp a, #0x04
jrule 00208$
jp 00108$
00208$:
; ../src/stm8s_exti.c: 85: EXTI->CR1 |= (uint8_t)((uint8_t)(SensitivityValue) << 2);
ld a, (0x06, sp)
ld yl, a
; ../src/stm8s_exti.c: 77: switch (Port)
clrw x
ld a, (0x05, sp)
ld xl, a
sllw x
ldw x, (#00209$, x)
jp (x)
00209$:
.dw #00101$
.dw #00102$
.dw #00103$
.dw #00104$
.dw #00105$
; ../src/stm8s_exti.c: 79: case EXTI_PORT_GPIOA:
00101$:
; ../src/stm8s_exti.c: 80: EXTI->CR1 &= (uint8_t)(~EXTI_CR1_PAIS);
ld a, 0x50a0
and a, #0xfc
ld 0x50a0, a
; ../src/stm8s_exti.c: 81: EXTI->CR1 |= (uint8_t)(SensitivityValue);
ld a, 0x50a0
or a, (0x06, sp)
ld 0x50a0, a
; ../src/stm8s_exti.c: 82: break;
jra 00108$
; ../src/stm8s_exti.c: 83: case EXTI_PORT_GPIOB:
00102$:
; ../src/stm8s_exti.c: 84: EXTI->CR1 &= (uint8_t)(~EXTI_CR1_PBIS);
ld a, 0x50a0
and a, #0xf3
ld 0x50a0, a
; ../src/stm8s_exti.c: 85: EXTI->CR1 |= (uint8_t)((uint8_t)(SensitivityValue) << 2);
ld a, 0x50a0
ldw x, y
sllw x
sllw x
pushw x
or a, (2, sp)
popw x
ld 0x50a0, a
; ../src/stm8s_exti.c: 86: break;
jra 00108$
; ../src/stm8s_exti.c: 87: case EXTI_PORT_GPIOC:
00103$:
; ../src/stm8s_exti.c: 88: EXTI->CR1 &= (uint8_t)(~EXTI_CR1_PCIS);
ld a, 0x50a0
and a, #0xcf
ld 0x50a0, a
; ../src/stm8s_exti.c: 89: EXTI->CR1 |= (uint8_t)((uint8_t)(SensitivityValue) << 4);
ld a, 0x50a0
ld (0x02, sp), a
ld a, yl
swap a
and a, #0xf0
or a, (0x02, sp)
ld 0x50a0, a
; ../src/stm8s_exti.c: 90: break;
jra 00108$
; ../src/stm8s_exti.c: 91: case EXTI_PORT_GPIOD:
00104$:
; ../src/stm8s_exti.c: 92: EXTI->CR1 &= (uint8_t)(~EXTI_CR1_PDIS);
ld a, 0x50a0
and a, #0x3f
ld 0x50a0, a
; ../src/stm8s_exti.c: 93: EXTI->CR1 |= (uint8_t)((uint8_t)(SensitivityValue) << 6);
ld a, 0x50a0
ld (0x01, sp), a
ld a, yl
swap a
and a, #0xf0
sll a
sll a
or a, (0x01, sp)
ld 0x50a0, a
; ../src/stm8s_exti.c: 94: break;
jra 00108$
; ../src/stm8s_exti.c: 95: case EXTI_PORT_GPIOE:
00105$:
; ../src/stm8s_exti.c: 96: EXTI->CR2 &= (uint8_t)(~EXTI_CR2_PEIS);
ld a, 0x50a1
and a, #0xfc
ld 0x50a1, a
; ../src/stm8s_exti.c: 97: EXTI->CR2 |= (uint8_t)(SensitivityValue);
ld a, 0x50a1
or a, (0x06, sp)
ld 0x50a1, a
; ../src/stm8s_exti.c: 101: }
00108$:
; ../src/stm8s_exti.c: 102: }
popw x
ret
; ../src/stm8s_exti.c: 111: void EXTI_SetTLISensitivity(EXTI_TLISensitivity_TypeDef SensitivityValue)
; -----------------------------------------
; function EXTI_SetTLISensitivity
; -----------------------------------------
_EXTI_SetTLISensitivity:
; ../src/stm8s_exti.c: 114: assert_param(IS_EXTI_TLISENSITIVITY_OK(SensitivityValue));
tnz (0x03, sp)
jreq 00104$
ld a, (0x03, sp)
cp a, #0x04
jreq 00104$
push #0x72
clrw x
pushw x
push #0x00
push #<___str_0
push #(___str_0 >> 8)
call _assert_failed
addw sp, #6
00104$:
; ../src/stm8s_exti.c: 117: EXTI->CR2 &= (uint8_t)(~EXTI_CR2_TLIS);
ld a, 0x50a1
and a, #0xfb
ld 0x50a1, a
; ../src/stm8s_exti.c: 118: EXTI->CR2 |= (uint8_t)(SensitivityValue);
ld a, 0x50a1
or a, (0x03, sp)
ld 0x50a1, a
; ../src/stm8s_exti.c: 119: }
ret
; ../src/stm8s_exti.c: 126: EXTI_Sensitivity_TypeDef EXTI_GetExtIntSensitivity(EXTI_Port_TypeDef Port)
; -----------------------------------------
; function EXTI_GetExtIntSensitivity
; -----------------------------------------
_EXTI_GetExtIntSensitivity:
; ../src/stm8s_exti.c: 128: uint8_t value = 0;
clr a
; ../src/stm8s_exti.c: 131: assert_param(IS_EXTI_PORT_OK(Port));
tnz (0x03, sp)
jreq 00111$
push a
ld a, (0x04, sp)
dec a
pop a
jreq 00111$
push a
ld a, (0x04, sp)
cp a, #0x02
pop a
jreq 00111$
push a
ld a, (0x04, sp)
cp a, #0x03
pop a
jreq 00111$
push a
ld a, (0x04, sp)
cp a, #0x04
pop a
jreq 00111$
push a
push #0x83
clrw x
pushw x
push #0x00
push #<___str_0
push #(___str_0 >> 8)
call _assert_failed
addw sp, #6
pop a
00111$:
; ../src/stm8s_exti.c: 133: switch (Port)
push a
ld a, (0x04, sp)
cp a, #0x04
pop a
jrule 00167$
ret
00167$:
clrw x
ld a, (0x03, sp)
ld xl, a
sllw x
ldw x, (#00168$, x)
jp (x)
00168$:
.dw #00101$
.dw #00102$
.dw #00103$
.dw #00104$
.dw #00105$
; ../src/stm8s_exti.c: 135: case EXTI_PORT_GPIOA:
00101$:
; ../src/stm8s_exti.c: 136: value = (uint8_t)(EXTI->CR1 & EXTI_CR1_PAIS);
ld a, 0x50a0
and a, #0x03
; ../src/stm8s_exti.c: 137: break;
ret
; ../src/stm8s_exti.c: 138: case EXTI_PORT_GPIOB:
00102$:
; ../src/stm8s_exti.c: 139: value = (uint8_t)((uint8_t)(EXTI->CR1 & EXTI_CR1_PBIS) >> 2);
ld a, 0x50a0
and a, #0x0c
srl a
srl a
; ../src/stm8s_exti.c: 140: break;
ret
; ../src/stm8s_exti.c: 141: case EXTI_PORT_GPIOC:
00103$:
; ../src/stm8s_exti.c: 142: value = (uint8_t)((uint8_t)(EXTI->CR1 & EXTI_CR1_PCIS) >> 4);
ld a, 0x50a0
and a, #0x30
swap a
and a, #0x0f
; ../src/stm8s_exti.c: 143: break;
ret
; ../src/stm8s_exti.c: 144: case EXTI_PORT_GPIOD:
00104$:
; ../src/stm8s_exti.c: 145: value = (uint8_t)((uint8_t)(EXTI->CR1 & EXTI_CR1_PDIS) >> 6);
ld a, 0x50a0
and a, #0xc0
swap a
and a, #0x0f
srl a
srl a
; ../src/stm8s_exti.c: 146: break;
ret
; ../src/stm8s_exti.c: 147: case EXTI_PORT_GPIOE:
00105$:
; ../src/stm8s_exti.c: 148: value = (uint8_t)(EXTI->CR2 & EXTI_CR2_PEIS);
ld a, 0x50a1
and a, #0x03
; ../src/stm8s_exti.c: 152: }
; ../src/stm8s_exti.c: 154: return((EXTI_Sensitivity_TypeDef)value);
; ../src/stm8s_exti.c: 155: }
ret
; ../src/stm8s_exti.c: 162: EXTI_TLISensitivity_TypeDef EXTI_GetTLISensitivity(void)
; -----------------------------------------
; function EXTI_GetTLISensitivity
; -----------------------------------------
_EXTI_GetTLISensitivity:
; ../src/stm8s_exti.c: 167: value = (uint8_t)(EXTI->CR2 & EXTI_CR2_TLIS);
ld a, 0x50a1
and a, #0x04
; ../src/stm8s_exti.c: 169: return((EXTI_TLISensitivity_TypeDef)value);
; ../src/stm8s_exti.c: 170: }
ret
.area CODE
.area CONST
___str_0:
.ascii "../src/stm8s_exti.c"
.db 0x00
.area INITIALIZER
.area CABS (ABS)
|
testsuite/ubivm/expected/repeat_until_1.asm | alexgarzao/UOP | 0 | 246174 | <reponame>alexgarzao/UOP
Entity start
No options
Constants
0 S start
1 S x
2 I 1
3 S x=
4 I 2
5 S io.writeln
6 I 10
End
Valid context (always)
No properties
Def start
No parameters
Local variables
0 int x
End
No results
ldconst 2 --> [1]
stvar 0 --> [x]
2: ldconst 3 --> [x=]
ldvar 0 --> [x]
ldconst 4 --> [2]
lcall 5 --> [io.writeln]
ldvar 0 --> [x]
ldconst 2 --> [1]
add
stvar 0 --> [x]
ldvar 0 --> [x]
ldconst 6 --> [10]
gt
ifnot 2 --> [2]
stop
End
End
|
src/Ada/syscalls/ewok-syscalls-init.adb | wookey-project/ewok-legacy | 0 | 17753 | <gh_stars>0
--
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
with ewok.tasks; use ewok.tasks;
with ewok.tasks_shared; use ewok.tasks_shared;
with ewok.devices_shared; use ewok.devices_shared;
with ewok.exported.devices; use ewok.exported.devices;
with ewok.devices;
with ewok.sanitize;
with ewok.dma;
with ewok.syscalls.dma;
with ewok.mpu;
with ewok.perm;
with ewok.sched;
with ewok.debug;
package body ewok.syscalls.init
with spark_mode => off
is
package TSK renames ewok.tasks;
procedure init_do_reg_devaccess
(caller_id : in ewok.tasks_shared.t_task_id;
params : in t_parameters;
mode : in ewok.tasks_shared.t_task_mode)
is
udev : aliased ewok.exported.devices.t_user_device
with import, address => to_address (params(1));
-- Device descriptor transmitted to userspace
descriptor : unsigned_8 range 0 .. ewok.tasks.MAX_DEVS_PER_TASK
with address => to_address (params(2));
dev_id : ewok.devices_shared.t_device_id;
ok : boolean;
begin
-- Forbidden after end of task initialization
if TSK.is_init_done (caller_id) then
goto ret_denied;
end if;
-- NOTE
-- The kernel might register some devices using this syscall
-- for user tasks. The device_t structure may be stored in
-- RAM (.data section) or in flash (.rodata section)
if TSK.is_real_user (caller_id) and then
(not ewok.sanitize.is_range_in_data_slot
(to_system_address (udev'address),
udev'size/8,
caller_id,
mode)
and
not ewok.sanitize.is_range_in_txt_slot
(to_system_address (udev'address),
udev'size/8,
caller_id))
then
pragma DEBUG (debug.log (debug.ERROR,
"init_do_reg_devaccess(): udev not in task's memory space"));
goto ret_denied;
end if;
if TSK.is_real_user (caller_id) and then
not ewok.sanitize.is_word_in_data_slot
(to_system_address (descriptor'address), caller_id, mode)
then
pragma DEBUG (debug.log (debug.ERROR,
"init_do_reg_devaccess(): descriptor not in task's memory space"));
goto ret_denied;
end if;
-- Ada based sanitization
if not udev'valid_scalars
then
pragma DEBUG (debug.log (debug.ERROR, "init_do_reg_devaccess(): invalid udev scalars"));
goto ret_inval;
end if;
if TSK.is_real_user (caller_id) and then
not ewok.devices.sanitize_user_defined_device
(udev'unchecked_access, caller_id)
then
pragma DEBUG (debug.log (debug.ERROR, "init_do_reg_devaccess(): invalid udev"));
goto ret_inval;
end if;
if TSK.tasks_list(caller_id).num_devs = TSK.MAX_DEVS_PER_TASK then
pragma DEBUG (debug.log (debug.ERROR,
"init_do_reg_devaccess(): no space left to register the device"));
goto ret_busy;
end if;
if udev.size > 0 and
udev.map_mode = DEV_MAP_AUTO and
TSK.tasks_list(caller_id).num_devs_mounted = ewok.mpu.MAX_DEVICE_REGIONS
then
pragma DEBUG (debug.log (debug.ERROR,
"init_do_reg_devaccess(): no free region left to map the device"));
goto ret_busy;
end if;
--
-- Registering the device
--
ewok.devices.register_device (caller_id, udev'unchecked_access, dev_id, ok);
if not ok then
pragma DEBUG (debug.log (debug.ERROR,
"init_do_reg_devaccess(): failed to register the device"));
goto ret_denied;
end if;
--
-- Recording registered devices in the task record
--
TSK.append_device
(caller_id, dev_id, descriptor, ok);
if not ok then
raise program_error; -- Should never happen here
end if;
-- Mount DEV_MAP_AUTO devices in memory
if udev.size > 0 and udev.map_mode = DEV_MAP_AUTO then
TSK.mount_device (caller_id, dev_id, ok);
if not ok then
raise program_error; -- Should never happen here
end if;
end if;
set_return_value (caller_id, mode, SYS_E_DONE);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_busy>>
set_return_value (caller_id, mode, SYS_E_BUSY);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_inval>>
set_return_value (caller_id, mode, SYS_E_INVAL);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_denied>>
set_return_value (caller_id, mode, SYS_E_DENIED);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end init_do_reg_devaccess;
procedure init_do_done
(caller_id : in ewok.tasks_shared.t_task_id;
mode : in ewok.tasks_shared.t_task_mode)
is
ok : boolean;
udev : ewok.devices.t_checked_user_device_access;
begin
-- Forbidden after end of task initialization
if TSK.is_init_done (caller_id) then
goto ret_denied;
end if;
-- We enable auto mapped devices (MAP_AUTO)
for i in TSK.tasks_list(caller_id).device_id'range loop
if TSK.tasks_list(caller_id).device_id(i) /= ID_DEV_UNUSED then
udev := ewok.devices.get_user_device
(TSK.tasks_list(caller_id).device_id(i));
if udev.all.map_mode = DEV_MAP_AUTO then
-- FIXME - Create new syscalls for enabling/disabling devices?
ewok.devices.enable_device
(TSK.tasks_list(caller_id).device_id(i), ok);
if not ok then
goto ret_denied;
end if;
end if;
end if;
end loop;
#if CONFIG_KERNEL_DMA_ENABLE
for i in 1 .. TSK.tasks_list(caller_id).num_dma_id loop
ewok.dma.enable_dma_irq (TSK.tasks_list(caller_id).dma_id(i));
end loop;
#end if;
TSK.tasks_list(caller_id).init_done := true;
set_return_value (caller_id, mode, SYS_E_DONE);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
-- Request a schedule to ensure that the task has its devices mapped
-- afterward
-- FIXME - has to be changed when device mapping will be synchronously done
ewok.sched.request_schedule;
return;
<<ret_denied>>
set_return_value (caller_id, mode, SYS_E_DENIED);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end init_do_done;
procedure init_do_get_taskid
(caller_id : in ewok.tasks_shared.t_task_id;
params : in t_parameters;
mode : in ewok.tasks_shared.t_task_mode)
is
target_name : TSK.t_task_name
with address => to_address (params(1));
target_id : ewok.tasks_shared.t_task_id
with address => to_address (params(2));
tmp_id : ewok.tasks_shared.t_task_id;
begin
-- Forbidden after end of task initialization
if TSK.is_init_done (caller_id) then
goto ret_denied;
end if;
-- Does &target_id is in the caller address space ?
if not ewok.sanitize.is_word_in_data_slot
(to_system_address (target_id'address), caller_id, mode)
then
goto ret_denied;
end if;
-- We retrieve the 'id' related to the target name. Before updating the
-- parameter passed by the user, we must check that the 2 tasked are
-- allowed to communicate
tmp_id := TSK.get_task_id (target_name);
if tmp_id = ID_UNUSED then
goto ret_inval;
end if;
#if CONFIG_KERNEL_DOMAIN
if TSK.get_domain (tmp_id) /= TSK.get_domain (caller_id) then
goto ret_inval;
end if;
#end if;
-- Are tasks allowed to communicate through IPCs or DMA_SHM ?
if not ewok.perm.ipc_is_granted (caller_id, tmp_id) and
not ewok.perm.dmashm_is_granted (caller_id, tmp_id)
then
goto ret_inval;
end if;
-- We may update the target_id
target_id := tmp_id;
set_return_value (caller_id, mode, SYS_E_DONE);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_inval>>
set_return_value (caller_id, mode, SYS_E_INVAL);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_denied>>
set_return_value (caller_id, mode, SYS_E_DENIED);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end init_do_get_taskid;
procedure sys_init
(caller_id : in ewok.tasks_shared.t_task_id;
params : in out t_parameters;
mode : in ewok.tasks_shared.t_task_mode)
is
syscall : t_syscalls_init
with import, address => params(0)'address;
begin
if not syscall'valid then
set_return_value (caller_id, mode, SYS_E_INVAL);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end if;
case syscall is
when INIT_DEVACCESS => init_do_reg_devaccess
(caller_id, params, mode);
#if CONFIG_KERNEL_DMA_ENABLE
when INIT_DMA => ewok.syscalls.dma.init_do_reg_dma
(caller_id, params, mode);
when INIT_DMA_SHM => ewok.syscalls.dma.init_do_reg_dma_shm
(caller_id, params, mode);
#end if;
when INIT_GETTASKID => init_do_get_taskid (caller_id, params, mode);
when INIT_DONE => init_do_done (caller_id, mode);
end case;
end sys_init;
end ewok.syscalls.init;
|
grammar/antlr4/synthesis/skip_top/py/SkipTop.g4 | sthagen/odata-url-parser | 2 | 5509 | <reponame>sthagen/odata-url-parser<gh_stars>1-10
grammar SkipTop;
skip_top : skip
| top
;
skip : '$'? Skip '=' INTEGER;
top : '$'? Top '=' INTEGER;
Skip : S K I P;
Top : T O P;
INTEGER: DIGIT
| NON_ZERO DIGIT+
;
fragment I : [iI];
fragment K : [kK];
fragment O : [oO];
fragment P : [pP];
fragment S : [sS];
fragment T : [tT];
fragment DIGIT: ZERO | NON_ZERO;
fragment NON_ZERO: [1-9];
fragment ZERO: [0];
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/limited_with2_pkg1.ads | best08618/asylo | 7 | 23605 | limited with Limited_With2_Pkg2;
package Limited_With2_Pkg1 is
type Rec2 is record
F : access Limited_With2_Pkg2.Rec3;
end record;
end Limited_With2_Pkg1;
|
main.scpt | Fornost461/JavaDowngrader | 0 | 1230 | (*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
Please refer to <http://unlicense.org/>.
*)
try
display dialog "You should close all other applications and check that no other user is logged in. Then, click Launch." buttons {"Cancel", "Launch"} default button 2
if button returned of the result is "Cancel" then return
--Uninstall Java 7
set command to "sudo rm -Rf /Library/Internet\\ Plug-Ins/JavaAppletPlugin.plugin >/dev/null 2>&1 & "
--Remove the Java 7 JDK if you installed it
set command to command & "sudo rm -Rf /Library/Java/JavaVirtualMachines/jdk1.7*.jdk >/dev/null 2>&1 & "
--Re-enable Java 6
set command to command & "sudo ln -sf /System/Library/Java/Support/Deploy.bundle/Contents/Resources/JavaPlugin2_NPAPI.plugin /Library/Internet\\ Plug-Ins/JavaAppletPlugin.plugin >/dev/null 2>&1 & sudo ln -sf /System/Library/Frameworks/JavaVM.framework/Commands/javaws /usr/bin/javaws >/dev/null 2>&1 & "
--Delete startup daemons, actually these are just empty symlinks
set command to command & "sudo rm -f /Library/LaunchAgents/com.oracle.java.Java-Updater.plist /Library/LaunchDaemons/com.oracle.java.Helper-Tool.plist >/dev/null 2>&1 &"
--Launch the whole command
tell application "Terminal" to do shell script command with administrator privileges
display dialog "Java 6 should now work!"
on error errorName number errorNumber
--(-128) indicates that the user canceled the script execution
if errorNumber is -128 then
display dialog "Nothing has been changed." buttons {"OK"} default button 1 giving up after 10
else
display dialog "Please report the following error :" & return & "Error " & errorNumber & " : " & errorName
end if
return
end try
|
cdc-160-replica/OSAP/demo2.asm | paulscottrobson/assorted-archives | 0 | 241072 | rem hello world !
// flx Hello./
// flr 12Hello./
tty 01Hello./
|
source/nodes/program-nodes-null_literals.adb | optikos/oasis | 0 | 7590 | <reponame>optikos/oasis
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Null_Literals is
function Create
(Null_Literal_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Null_Literal is
begin
return Result : Null_Literal :=
(Null_Literal_Token => Null_Literal_Token, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Null_Literal is
begin
return Result : Implicit_Null_Literal :=
(Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Null_Literal_Token
(Self : Null_Literal)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Null_Literal_Token;
end Null_Literal_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Null_Literal)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Null_Literal)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Null_Literal)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : aliased in out Base_Null_Literal'Class) is
begin
null;
end Initialize;
overriding function Is_Null_Literal_Element
(Self : Base_Null_Literal)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Null_Literal_Element;
overriding function Is_Expression_Element
(Self : Base_Null_Literal)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Expression_Element;
overriding procedure Visit
(Self : not null access Base_Null_Literal;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Null_Literal (Self);
end Visit;
overriding function To_Null_Literal_Text
(Self : aliased in out Null_Literal)
return Program.Elements.Null_Literals.Null_Literal_Text_Access is
begin
return Self'Unchecked_Access;
end To_Null_Literal_Text;
overriding function To_Null_Literal_Text
(Self : aliased in out Implicit_Null_Literal)
return Program.Elements.Null_Literals.Null_Literal_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Null_Literal_Text;
end Program.Nodes.Null_Literals;
|
programs/oeis/272/A272975.asm | neoneye/loda | 22 | 245694 | ; A272975: Numbers that are congruent to {0,7} mod 12.
; 0,7,12,19,24,31,36,43,48,55,60,67,72,79,84,91,96,103,108,115,120,127,132,139,144,151,156,163,168,175,180,187,192,199,204,211,216,223,228,235,240,247,252,259,264,271,276,283,288,295,300,307,312,319,324
mov $1,$0
mul $0,6
mod $1,2
add $0,$1
|
Miei-sorgenti/new/Seconda lezione/Versione 1/rwmemoria.asm | DigiOhhh/LabArchitettura2-2017-2018 | 1 | 168107 | <reponame>DigiOhhh/LabArchitettura2-2017-2018
# Si scriva il codice Assembly che effettui:
# A[99] = 5 + B[i] + C
# Inizializzazione dei registri indirizzi:
# i vettori A e B contengono 100 elementi, ogni elemento è un intero a 32 bit;
# variabili C e i sono interi a 32 bit.
# Inizializzazione dei valori dati in memoria:
# i=3, C=2, B[i]=10.
.data
A: .space 400
B: .space 400
C: .word 0
i: .word 0
.text
.globl main
main:
la $s0, i
li $t0, 3
sw $t0, ($s0) # i <-- 3
la $s1, C
li $t0, 2
sw $t0, ($s1) # C <-- 2
lw $t0, i
li $t1, 4
mul $t0, $t0, $t1 # Offset per accedere a B[i] in $t0
la $s2, B
add $t2, $t0, $s2
li $t3, 10
sw $t3, ($t2) # B[i] <-- 10
lw $s3, ($t2)
lw $t4, C
addi $s3, $s3, 5
add $s3, $s3, $t4 # $s3 <-- 5 + B[i] + C
li $t0, 99
mul $t0, $t0, $t1 # Offset per accedere a A[99] in $t0
la $s4, A
add $s4, $s4, $t0
sw $s3, ($s4) # A[99] <-- 5 + B[i] + C |
example/map_scroll/program.asm | suzukiplan/fcs80 | 2 | 27694 | <reponame>suzukiplan/fcs80
org $0000
.main
; 割り込み関連の初期化
IM 1
DI
; VBLANKを待機
call wait_vblank
; パレットを初期化
ld bc, 12
ld hl, palette0_data
ld de, $9400
ldir
; Bank 1 を Character Pattern Table ($A000) に転送 (DMA)
ld a, $01
out ($c0), a
; マップの初期状態を描画
ld bc, 800
ld hl, $4000 + 8192 - 800
ld a, l
ld ($C002), a ; Next read position (low)
ld a, h
ld ($C003), a ; Next read position (high)
ld de, $8000
ldir
ld a, $00
ld ($C004), a ; Next write nametbl (low)
ld ($C005), a ; Next write nametbl (high)
; メインループ
mainloop:
; VBLANKを待機
call wait_vblank
; BGを下スクロール
ld hl, $9603
dec (hl)
; スクロールカウンタ (RAM) をインクリメント
ld a, ($C000)
inc a
and $07
ld ($C000), a
jp nz, mainloop_next
; 次のマップを描画
ld hl, ($C002)
ld a, h
cp $40
jp z, mainloop_jump_to_head
ld a, l
sub $20
ld l, a
ld a, h
sbc $00
ld h, a
ld ($C002), hl
jmp mainloop_set_nametbl
mainloop_jump_to_head:
; 先頭に達したのでループさせる
ld hl, $5FE0
ld ($C002), hl
mainloop_set_nametbl:
ld de, ($C004)
ld a, e
sub $20
ld e, a
ld a, d
sbc $00
and $03
ld d, a
ld ($C004), de
ld a, d
or $80
ld d, a
ld bc, 32
ldir
mainloop_next:
jmp mainloop
; VBLANKになるまで待機
.wait_vblank
ld hl, $9607
wait_vblank_loop:
ld a, (hl)
and $80
jp z, wait_vblank_loop
ret
palette0_data: defw %0000000000000000, %0001110011100111, %0110001100011000, %0111111111111111, %0000001110000000, %0000000000011100
|
syntaxes/vein.g4 | 0xF6/vscode.mana | 0 | 7761 | <reponame>0xF6/vscode.mana
grammar wave;
INTEGER
: '-'? ('0'..'9')+
;
FLOAT
: '-'? ('0'..'9')+ '.' ('0'..'9')+
;
STRING
: '\'' (~ '\'' )* '\''
;
BOOLEAN
: 'true'
| 'false'
;
r : 'hello' ID ; // match keyword hello followed by an identifier
ID : [a-z]+ ; // match lower-case identifiers
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.