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/Parsers/XML/project_processor-parsers-xml_parsers.adb | fintatarta/eugen | 0 | 322 | <gh_stars>0
with DOM.Core.Documents;
with Project_Processor.Parsers.Parser_Tables;
with XML_Utilities;
with XML_Scanners;
with DOM.Core.Nodes;
with EU_Projects.Nodes.Action_Nodes.Tasks;
with EU_Projects.Nodes.Action_Nodes.WPs;
with EU_Projects.Nodes.Timed_Nodes.Milestones;
with Project_Processor.Parsers.XML_Parsers.Sub_Parsers;
with EU_Projects.Nodes.Timed_Nodes.Deliverables;
package body Project_Processor.Parsers.XML_Parsers is
use XML_Scanners;
use EU_Projects.Projects;
------------
-- Create --
------------
function Create
(Params : not null access Plugins.Parameter_Maps.Map)
return Parser_Type
is
pragma Unreferenced (Params);
Result : Parser_Type;
begin
return Result;
end Create;
procedure Parse_Project
(Parser : in out Parser_Type;
Project : out Project_Descriptor;
N : in DOM.Core.Node)
is
pragma Unreferenced (Parser);
use EU_Projects.Nodes;
Scanner : XML_Scanner := Create_Child_Scanner (N);
procedure Add_Partner (N : DOM.Core.Node) is
begin
Project.Add_Partner (Sub_Parsers.Parse_Partner (N));
end Add_Partner;
procedure Add_Milestone (N : DOM.Core.Node) is
Milestone : Timed_Nodes.Milestones.Milestone_Access;
begin
Sub_Parsers.Parse_Milestone (N, Milestone);
Project.Add_Milestone (Milestone);
end Add_Milestone;
procedure Add_WP (N : DOM.Core.Node) is
WP : Action_Nodes.WPs.Project_WP_Access;
begin
Sub_Parsers.Parse_WP (N, WP);
Project.Add_WP (WP);
end Add_WP;
procedure Handle_Configuration (N : DOM.Core.Node) is
begin
Sub_Parsers.Parse_Configuration (Project, N);
end Handle_Configuration;
procedure Add_Risk (N : DOM.Core.Node) is
begin
Project.Add_Risk (Sub_Parsers.Parse_Risk (N));
end Add_Risk;
procedure Add_Deliverable (N : DOM.Core.Node) is
Deliv : Timed_Nodes.Deliverables.Deliverable_Access;
begin
Sub_Parsers.Parse_Deliverable (N, Deliv);
Project.Add_Deliverable (Deliv);
end Add_Deliverable;
begin
if DOM.Core.Nodes.Node_Name (N) /= "project" then
raise Parsing_Error;
end if;
Dom.Core.Nodes.Print (N);
Scanner.Parse_Optional ("configuration", Handle_Configuration'Access);
Scanner.Parse_Sequence ("partner", Add_Partner'Access);
Scanner.Parse_Sequence ("wp", Add_WP'Access);
Scanner.Parse_Sequence ("milestone", Add_Milestone'Access);
Scanner.Parse_Sequence (Name => "deliverable",
Callback => Add_Deliverable'Access,
Min_Length => 0);
Scanner.Parse_Sequence (Name => "risk",
Callback => Add_Risk'Access,
Min_Length => 0);
end Parse_Project;
-----------
-- Parse --
-----------
procedure Parse
(Parser : in out Parser_Type;
Project : out EU_Projects.Projects.Project_Descriptor;
Input : String)
is
use DOM.Core.Documents;
begin
Parse_Project
(Parser => Parser,
Project => Project,
N => Get_Element (XML_Utilities.Parse_String (Input)));
Project.Freeze;
end Parse;
begin
Parser_Tables.Register (ID => "xml",
Tag => Parser_Type'Tag);
end Project_Processor.Parsers.XML_Parsers;
|
mc-sema/validator/x86/tests/CDQ.asm | randolphwong/mcsema | 2 | 29561 | BITS 32
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=
;TEST_FILE_META_END
; CDQ
;TEST_BEGIN_RECORDING
MOV eax, 0x819EDB32
MOV edx, 0
cdq
;TEST_END_RECORDING
|
example-programs/add2.asm | tuna-arch/escolar | 0 | 85016 | bits 16
mov 0x2, r0
addp out, r0
mov 0x0, r1 # we want to print to OUT
outp r1, r0 # print value of r0 to OUT.
|
oeis/142/A142807.asm | neoneye/loda-programs | 11 | 245715 | ; A142807: Primes congruent to 9 mod 61.
; Submitted by <NAME>
; 131,619,863,1229,2083,2693,3181,3547,4157,4523,4889,5011,5743,5987,6353,6719,6841,7207,7451,7573,7817,9281,9403,9769,10501,10867,12697,12941,13063,14771,15137,15259,15991,17333,18553,18797,18919,19163,20261,20627,20749,21481,22091,23189,23311,23677,24043,25873,26849,27337,27581,27947,28069,29167,29411,30509,30631,31607,31729,31973,33071,35023,35267,35999,37097,37463,37951,38317,38561,39293,39659,40879,41611,42221,42709,42953,43319,43441,44417,47711,48809,49297,49663,50273,51859,52103,52957
mov $1,4
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $2,1
mov $3,$1
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,61
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
sub $0,60
mul $0,2
sub $0,1
|
entropy-supportforum.applescript | rinchen/fesc | 0 | 4421 | <gh_stars>0
on clicked theObject
do shell script "open http://f27.parsimony.net/forum66166/"
end clicked
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_1083.asm | ljhsiun2/medusa | 9 | 100039 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xf245, %rsi
lea addresses_A_ht+0x18c0d, %rdi
nop
nop
nop
and %rbp, %rbp
mov $99, %rcx
rep movsb
nop
nop
nop
nop
nop
xor $6422, %rbp
lea addresses_UC_ht+0x9aad, %rsi
lea addresses_WT_ht+0x1770d, %rdi
clflush (%rsi)
nop
xor %r14, %r14
mov $29, %rcx
rep movsb
nop
nop
nop
and $50823, %rsi
lea addresses_UC_ht+0x1ad8d, %rsi
lea addresses_WC_ht+0xf30d, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
nop
nop
lfence
mov $86, %rcx
rep movsb
nop
nop
and %rbp, %rbp
lea addresses_WT_ht+0x1deb5, %rsi
lea addresses_WC_ht+0x17a25, %rdi
nop
nop
xor $9697, %r10
mov $0, %rcx
rep movsq
nop
nop
nop
nop
nop
inc %rdi
lea addresses_D_ht+0x230d, %rsi
lea addresses_D_ht+0x330d, %rdi
clflush (%rdi)
nop
xor %rbp, %rbp
mov $118, %rcx
rep movsw
nop
nop
add %rdi, %rdi
lea addresses_A_ht+0x1330d, %rcx
nop
nop
nop
nop
inc %rdi
mov $0x6162636465666768, %r14
movq %r14, (%rcx)
cmp $61322, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r15
push %r8
push %rbx
push %rdx
// Load
lea addresses_US+0x126d1, %rdx
clflush (%rdx)
nop
nop
nop
nop
nop
xor %r13, %r13
mov (%rdx), %r10d
nop
cmp %r8, %r8
// Faulty Load
lea addresses_normal+0x14b0d, %r12
nop
nop
nop
nop
add $41882, %r15
mov (%r12), %r13d
lea oracles, %r8
and $0xff, %r13
shlq $12, %r13
mov (%r8,%r13,1), %r13
pop %rdx
pop %rbx
pop %r8
pop %r15
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}}
{'src': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}}
{'src': {'same': True, 'congruent': 7, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}}
{'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}}
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
Core.agda | esoeylemez/agda-simple | 1 | 16145 | <filename>Core.agda
-- Copyright: (c) 2016 <NAME>
-- License: BSD3
-- Maintainer: <NAME> <<EMAIL>>
--
-- This module contains definitions that are fundamental and/or used
-- everywhere.
module Core where
open import Agda.Builtin.Equality public
renaming (refl to ≡-refl)
using (_≡_)
open import Agda.Builtin.FromNat public
open import Agda.Builtin.FromNeg public
open import Agda.Builtin.FromString public
open import Agda.Builtin.Unit using (⊤; tt) public
open import Agda.Primitive using (Level; lsuc; lzero; _⊔_) public
-- An empty type (or a false hypothesis).
data ⊥ : Set where
-- Dependent sums (or existential quantification).
record Σ {a b} (A : Set a) (B : A → Set b) : Set (a ⊔ b) where
constructor _,_
field
fst : A
snd : B fst
open Σ public
infixr 4 _,_
infixr 0 _because_ _because:_
∃ : ∀ {a b} {A : Set a} (B : A → Set b) → Set (a ⊔ b)
∃ = Σ _
_because_ : ∀ {a b} {A : Set a} {B : A → Set b} → (x : A) → B x → Σ A B
_because_ = _,_
_because:_ : ∀ {a b} {A : Set a} {B : A → Set b} → (x : A) → B x → Σ A B
_because:_ = _,_
_×_ : ∀ {a b} (A : Set a) (B : Set b) → Set (a ⊔ b)
A × B = Σ A (λ _ → B)
infixr 7 _×_
-- Tagged unions.
data Either {a} {b} (A : Set a) (B : Set b) : Set (a ⊔ b) where
Left : A → Either A B
Right : B → Either A B
-- Equivalence relations.
record Equiv {a r} (A : Set a) : Set (a ⊔ lsuc r) where
field
_≈_ : A → A → Set r
refl : ∀ {x} → x ≈ x
sym : ∀ {x y} → x ≈ y → y ≈ x
trans : ∀ {x y z} → x ≈ y → y ≈ z → x ≈ z
infix 4 _≈_
-- Helper functions for equational reasoning.
begin_ : ∀ {x y} → x ≈ y → x ≈ y
begin_ p = p
_≈[_]_ : ∀ x {y z} → x ≈ y → y ≈ z → x ≈ z
_ ≈[ x≈y ] y≈z = trans x≈y y≈z
_≈[]_ : ∀ x {y} → x ≈ y → x ≈ y
_ ≈[] p = p
_qed : ∀ (x : A) → x ≈ x
_qed _ = refl
infix 1 begin_
infixr 2 _≈[_]_ _≈[]_
infix 3 _qed
PropEq : ∀ {a} → (A : Set a) → Equiv A
PropEq A =
record {
_≈_ = _≡_;
refl = ≡-refl;
sym = sym';
trans = trans'
}
where
sym' : ∀ {x y} → x ≡ y → y ≡ x
sym' ≡-refl = ≡-refl
trans' : ∀ {x y z} → x ≡ y → y ≡ z → x ≡ z
trans' ≡-refl q = q
module PropEq {a} {A : Set a} = Equiv (PropEq A)
FuncEq : ∀ {a b} (A : Set a) (B : Set b) → Equiv (A → B)
FuncEq A B =
record {
_≈_ = λ f g → ∀ x → f x ≡ g x;
refl = λ _ → ≡-refl;
sym = λ p x → PropEq.sym (p x);
trans = λ p q x → PropEq.trans (p x) (q x)
}
module FuncEq {a b} {A : Set a} {B : Set b} = Equiv (FuncEq A B)
cong : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) {x y} → x ≡ y → f x ≡ f y
cong _ ≡-refl = ≡-refl
cong2 :
∀ {a b c} {A : Set a} {B : Set b} {C : Set c}
(f : A → B → C)
→ ∀ {x1 x2 : A} {y1 y2 : B}
→ x1 ≡ x2
→ y1 ≡ y2
→ f x1 y1 ≡ f x2 y2
cong2 _ ≡-refl ≡-refl = ≡-refl
-- Partial orders.
record PartialOrder {a re rl} (A : Set a) : Set (a ⊔ lsuc (re ⊔ rl)) where
field Eq : Equiv {r = re} A
module ≈ = Equiv Eq
open ≈ public using (_≈_)
field
_≤_ : (x : A) → (y : A) → Set rl
antisym : ∀ {x y} → x ≤ y → y ≤ x → x ≈ y
refl' : ∀ {x y} → x ≈ y → x ≤ y
trans : ∀ {x y z} → x ≤ y → y ≤ z → x ≤ z
infix 4 _≤_
refl : ∀ {x} → x ≤ x
refl = refl' ≈.refl
-- Helper functions for transitivity reasoning.
begin_ : ∀ {x y} → x ≤ y → x ≤ y
begin_ p = p
_≤[_]_ : ∀ x {y z} → x ≤ y → y ≤ z → x ≤ z
_ ≤[ x≤y ] y≤z = trans x≤y y≤z
_≤[]_ : ∀ x {y} → x ≤ y → x ≤ y
_ ≤[] p = p
_qed : ∀ (x : A) → x ≤ x
_qed _ = refl
infix 1 begin_
infixr 2 _≤[_]_ _≤[]_
infix 3 _qed
-- Total orders.
record TotalOrder {a re rl} (A : Set a) : Set (a ⊔ lsuc (re ⊔ rl)) where
field partialOrder : PartialOrder {a} {re} {rl} A
open PartialOrder partialOrder public
field
total : ∀ x y → Either (x ≤ y) (y ≤ x)
-- Low-priority function application.
_$_ : ∀ {a} {A : Set a} → A → A
_$_ f = f
infixr 0 _$_
-- Given two predicates, this is the predicate that requires both.
_and_ : ∀ {a r1 r2} {A : Set a} → (A → Set r1) → (A → Set r2) → A → Set (r1 ⊔ r2)
(P and Q) x = P x × Q x
infixr 6 _and_
-- Use instance resolution to find a value of the target type.
it : ∀ {a} {A : Set a} {{_ : A}} → A
it {{x}} = x
-- Not.
not : ∀ {a} → Set a → Set a
not A = A → ⊥
-- Given two predicates, this is the predicate that requires at least
-- one of them.
_or_ : ∀ {a r1 r2} {A : Set a} → (A → Set r1) → (A → Set r2) → A → Set (r1 ⊔ r2)
(P or Q) x = Either (P x) (Q x)
-- Values with inline type signatures.
the : ∀ {a} (A : Set a) → A → A
the _ x = x
-- Decidable properties.
data Decision {a} (P : Set a) : Set a where
yes : (p : P) → Decision P
no : (np : not P) → Decision P
|
boards/stm32f746_discovery/src/framebuffer_rk043fn48h.adb | morbos/Ada_Drivers_Library | 2 | 16833 | <reponame>morbos/Ada_Drivers_Library<filename>boards/stm32f746_discovery/src/framebuffer_rk043fn48h.adb
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with STM32.Device; use STM32.Device;
with STM32.GPIO; use STM32.GPIO;
package body Framebuffer_RK043FN48H is
LCD_BL_CTRL : GPIO_Point renames PK3;
LCD_ENABLE : GPIO_Point renames PI12;
LCD_HSYNC : GPIO_Point renames PI10;
LCD_VSYNC : GPIO_Point renames PI9;
LCD_CLK : GPIO_Point renames PI14;
LCD_DE : GPIO_Point renames PK7;
LCD_INT : GPIO_Point renames PI13;
NC1 : GPIO_Point renames PI8;
LCD_CTRL_PINS : constant GPIO_Points :=
(LCD_VSYNC, LCD_HSYNC, LCD_INT,
LCD_CLK, LCD_DE, NC1);
LCD_RGB_AF14 : constant GPIO_Points :=
(PI15, PJ0, PJ1, PJ2, PJ3, PJ4, PJ5, PJ6, -- Red
PJ7, PJ8, PJ9, PJ10, PJ11, PK0, PK1, PK2, -- Green
PE4, PJ13, PJ14, PJ15, PK4, PK5, PK6); -- Blue
LCD_RGB_AF9 : constant GPIO_Points :=
(1 => PG12); -- B4
procedure Init_Pins;
---------------
-- Init_Pins --
---------------
procedure Init_Pins
is
LTDC_Pins : constant GPIO_Points :=
LCD_CTRL_PINS & LCD_RGB_AF14 & LCD_RGB_AF9;
begin
Enable_Clock (LTDC_Pins);
Configure_Alternate_Function
(LCD_CTRL_PINS & LCD_RGB_AF14, GPIO_AF_LTDC_14);
Configure_Alternate_Function (LCD_RGB_AF9, GPIO_AF_LTDC_9);
Configure_IO
(Points => LTDC_Pins,
Config => (Speed => Speed_50MHz,
Mode => Mode_AF,
Output_Type => Push_Pull,
Resistors => Floating));
Lock (LTDC_Pins);
Configure_IO
(GPIO_Points'(LCD_ENABLE, LCD_BL_CTRL),
Config => (Speed => Speed_2MHz,
Mode => Mode_Out,
Output_Type => Push_Pull,
Resistors => Pull_Down));
Lock (LCD_ENABLE & LCD_BL_CTRL);
end Init_Pins;
----------------
-- Initialize --
----------------
procedure Initialize
(Display : in out Frame_Buffer;
Orientation : HAL.Framebuffer.Display_Orientation := Default;
Mode : HAL.Framebuffer.Wait_Mode := Interrupt)
is
begin
Init_Pins;
Display.Initialize
(Width => LCD_Natural_Width,
Height => LCD_Natural_Height,
H_Sync => 41,
H_Back_Porch => 13,
H_Front_Porch => 32,
V_Sync => 10,
V_Back_Porch => 2,
V_Front_Porch => 2,
PLLSAI_N => 192,
PLLSAI_R => 5,
DivR => 4,
Orientation => Orientation,
Mode => Mode);
STM32.GPIO.Set (LCD_ENABLE);
STM32.GPIO.Set (LCD_BL_CTRL);
end Initialize;
end Framebuffer_RK043FN48H;
|
src/kvflyweights/kvflyweights-untracked_lists.adb | jhumphry/auto_counters | 5 | 21903 | <filename>src/kvflyweights/kvflyweights-untracked_lists.adb
-- kvflyweights-untracked_lists.adb
-- A package of singly-linked lists for the KVFlyweights packages. Resources
-- are associated with a key that can be used to create them if they have not
-- already been created.
-- Copyright (c) 2016, <NAME>
--
-- Permission to use, copy, modify, and/or 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.
pragma Profile (No_Implementation_Extensions);
package body KVFlyweights.Untracked_Lists is
procedure Insert (L : in out List;
K : in Key;
Key_Ptr : out Key_Access;
Value_Ptr : out Value_Access) is
Node_Ptr : Node_Access := L;
begin
if Node_Ptr = null then
-- List is empty:
-- Create a new node as the first list element
Key_Ptr := new Key'(K);
Value_Ptr := Factory(K);
L := new Node'(Next => null,
Key_Ptr => Key_Ptr,
Value_Ptr => Value_Ptr);
else
-- List is not empty
-- Loop over existing elements
loop
if K = Node_Ptr.Key_Ptr.all then
-- K's value is already in the KVFlyweight
Key_Ptr := Node_Ptr.Key_Ptr;
Value_Ptr := Node_Ptr.Value_Ptr;
exit;
elsif Node_Ptr.Next = null then
-- We have reached the end of the relevant bucket's list and K is
-- not already in the KVFlyweight, so add it.
Key_Ptr := new Key'(K);
Value_Ptr := Factory(K);
Node_Ptr.Next := new Node'(Next => null,
Key_Ptr => Key_Ptr,
Value_Ptr => Value_Ptr);
exit;
else
Node_Ptr := Node_Ptr.Next;
end if;
end loop;
end if;
end Insert;
procedure Increment (L : in out List;
Key_Ptr : in Key_Access) is
begin
raise Program_Error
with "Attempting to adjust a use-count in an untracked list!";
end Increment;
procedure Remove (L : in out List;
Key_Ptr : in Key_Access) is
begin
raise Program_Error
with "Attempting to free element in an untracked list!";
end Remove;
end KVFlyweights.Untracked_Lists;
|
examples/mips2.asm | kubasikora/ARKO-MIPS-Projekt | 0 | 4780 | <filename>examples/mips2.asm
#########################################################
# #
# Wypisywanie najdluzszego ciagu cyfr #
# Autor: <NAME> #
# #
#########################################################
.data
prompt: .asciiz "Enter string: \n"
error: .asciiz "No sequence found"
buf: .space 100
.text
.globl main
main:
#print prompt
li $v0, 4
la $a0, prompt
syscall
#get string
li $v0, 8
la $a0, buf
li $a1, 100
syscall
#interesting range of charachters
li $t0, '0'
li $t1, '9'
la $t2, buf #get buf adress
lb $t3, ($t2) #load byte from buffer
beqz $t3, end #if 0, go to end
li $t4, 0 #lenght of actual sequence lm
li $t5, 0 #address of actual sequence pm
li $t6, 0 #longest sequence
li $t7, 1000 #address of longest sequence, 1000 means no sequence was found
loop: #check condition
blt $t3, $t0, nan
bgt $t3, $t1, nan
#is a number
bnez $t4, addnum
la $t5, ($t2) #store address of first number in sequence
addnum:
addiu $t4, $t4, 1 #increace actual sequence length
b next
nan: #not a number
ble $t4, $t6, reset
move $t6, $t4
move $t7, $t5
reset:
li $t4, 0
next: #finishing the loop and branching
addiu $t2, $t2, 1
lb $t3, ($t2)
bnez $t3, loop
end:
#check if any sequence was found
beq $t7, 1000, endwitherror
#write 0 after longest sequence
addu $t4, $t7, $t6
li $a0, 0x00
sb $a0, ($t4)
#print result
li $v0, 4
la $a0, ($t7)
syscall
#exit
li $v0, 10
syscall
endwitherror:
#print error
li $v0, 4
la $a0, error
syscall
#exit
li $v0, 10
syscall
|
hott/equivalence/coind.agda | HoTT/M-types | 27 | 9293 | {-# OPTIONS --without-K #-}
module hott.equivalence.coind where
open import level
open import sum
open import equality.core
open import equality.calculus
open import equality.reasoning
open import function.core
open import function.extensionality
open import function.fibration
open import function.isomorphism
open import function.overloading
open import container.core
open import container.fixpoint
open import container.m
open import hott.equivalence.core
open import hott.equivalence.alternative
open import hott.level
open import sets.unit
apply≅' : ∀ {i j}{X : Set i}{Y : Set j}
→ X ≅' Y → X → Y
apply≅' (i , _) = _≅_.to i
is-≅' : ∀ {i j}{X : Set i}{Y : Set j} → (X → Y) → Set _
is-≅' {X = X}{Y = Y} f = apply≅' ⁻¹ f
abstract
≅'-≈-fib-comm : ∀ {i j}{X : Set i}{Y : Set j}(eq : X ≅' Y)
→ proj₁ (≅'⇒≈ eq) ≡ apply≅' eq
≅'-≈-fib-comm eq = refl
≅'⇒≈-we : ∀ {i j}{X : Set i}{Y : Set j}
→ weak-equiv (≅'⇒≈ {X = X}{Y = Y})
≅'⇒≈-we = proj₂ (≅⇒≈ (sym≅ ≈⇔≅'))
is-≅'-≈-iso : ∀ {i j}{X : Set i}{Y : Set j}(f : X → Y)
→ is-≅' f ≅ weak-equiv f
is-≅'-≈-iso {X = X}{Y = Y} f = begin
is-≅' f
≡⟨ refl ⟩
(fib weak-equiv ∘' ≅'⇒≈) ⁻¹ f
≅⟨ fib-compose ≅'⇒≈ (fib weak-equiv) f ⟩
( Σ (fib weak-equiv ⁻¹ f) λ { (we , _) → ≅'⇒≈ ⁻¹ we } )
≅⟨ ( Σ-ap-iso refl≅ λ { (we , _)
→ contr-⊤-iso (≅'⇒≈-we we) } ) ⟩
( fib weak-equiv ⁻¹ f × ⊤ )
≅⟨ ×-right-unit ⟩
fib weak-equiv ⁻¹ f
≅⟨ fib-iso f ⟩
weak-equiv f
∎
where open ≅-Reasoning
is-≅'-h1 : ∀ {i j}{X : Set i}{Y : Set j}
→ (f : X → Y) → h 1 (is-≅' f)
is-≅'-h1 f = iso-level (sym≅ (is-≅'-≈-iso f)) (weak-equiv-h1 f)
≅'-Σ-iso : ∀ {i j}{X : Set i}{Y : Set j}
→ (X ≅' Y) ≅ (Σ (X → Y) λ f → is-≅' f)
≅'-Σ-iso {X = X}{Y = Y} = sym≅ (total-iso apply≅')
≅'-equality : ∀ {i j}{X : Set i}{Y : Set j}
→ {isom₁ isom₂ : X ≅' Y}
→ (apply isom₁ ≡ apply isom₂)
→ isom₁ ≡ isom₂
≅'-equality {X = X}{Y = Y} {isom₁}{isom₂} p = iso⇒inj ≅'-Σ-iso q
where
q : apply ≅'-Σ-iso isom₁ ≡ apply ≅'-Σ-iso isom₂
q = unapΣ (p , h1⇒prop (is-≅'-h1 _) _ _)
record F {i j}(Z : ∀ {i j} → Set i → Set j → Set (i ⊔ j))
(X : Set i)(Y : Set j) : Set (i ⊔ j) where
constructor mk-F
field
f : X → Y
g : Y → X
φ : (x : X)(y : Y) → Z (f x ≡ y) (x ≡ g y)
~-container : ∀ i → Container _ _ _
~-container i = record
{ I = Set i × Set i
; A = λ { (X , Y) → (X → Y) × (Y → X) }
; B = λ { {X , Y} _ → X × Y }
; r = λ { {a = f , g} (x , y) → (f x ≡ y) , (x ≡ g y) } }
module D {i} where
open Definition (~-container i) public
open Fixpoint (fix M fixpoint) public
hiding (fixpoint)
unfold≅' : ∀ {i}{X Y : Set i}
→ X ≅' Y → D.F (λ { (X , Y) → X ≅' Y }) (X , Y)
unfold≅' (isom , _)
= (to , from)
, λ { (x , y) → ≅⇒≅' (iso-adjunction isom x y) }
where
open _≅_ isom
--unfold≅' : ∀ {i}{X Y : Set i}
-- → X ≅' Y → D.F (λ { (X , Y) → X ≅' Y }) (X , Y)
--unfold≅' {X = X}{Y = Y} (iso f g α β , δ) =
-- ((f , g) , λ {(x , y) → ≅⇒≅' (φ x y)})
-- where
-- open ≡-Reasoning
--
-- δ' = co-coherence (iso f g α β) δ
--
-- iso₁ : {x : X}{y : Y}(p : f x ≡ y)
-- → ap f (sym (α x) · ap g p) · β y ≡ p
-- iso₁ {x} .{f x} refl = begin
-- ap f (sym (α x) · refl) · β (f x)
-- ≡⟨ ap (λ z → ap f z · β (f x)) (left-unit (sym (α x))) ⟩
-- ap f (sym (α x)) · β (f x)
-- ≡⟨ ap (λ z → z · β (f x)) (ap-inv f (α x)) ⟩
-- sym (ap f (α x)) · β (f x)
-- ≡⟨ ap (λ z → sym z · β (f x)) (δ x) ⟩
-- sym (β (f x)) · β (f x)
-- ≡⟨ right-inverse (β (f x)) ⟩
-- refl
-- ∎
--
-- iso₂' : {x : X}{y : Y}(q : g y ≡ x)
-- → sym (α x) · ap g (ap f (sym q) · β y) ≡ sym q
-- iso₂' .{g y}{y} refl = begin
-- sym (α (g y)) · ap g (refl · β y)
-- ≡⟨ ap (λ z → sym (α (g y)) · ap g z) (right-unit (β y)) ⟩
-- sym (α (g y)) · ap g (β y)
-- ≡⟨ ap (λ z → sym (α (g y)) · z) (δ' y) ⟩
-- sym (α (g y)) · α (g y)
-- ≡⟨ right-inverse (α (g y)) ⟩
-- refl
-- ∎
--
-- iso₂ : {x : X}{y : Y}(q : x ≡ g y)
-- → sym (α x) · ap g (ap f q · β y) ≡ q
-- iso₂ {x}{y} q =
-- subst (λ z → sym (α x) · ap g (ap f z · β y) ≡ z)
-- (double-inverse q)
-- (iso₂' (sym q))
--
-- φ : (x : X)(y : Y) → (f x ≡ y) ≅ (x ≡ g y)
-- φ x y = record
-- { to = λ p → sym (α x) · ap g p
-- ; from = λ q → ap f q · β y
-- ; iso₁ = iso₁
-- ; iso₂ = iso₂ }
Iso' : ∀ {i} → Set i × Set i → Set _
Iso' (X , Y) = X ≅' Y
_~_ : ∀ {i} → Set i → Set i → Set i
_~_ {i} X Y = D.M (X , Y)
apply~ : ∀ {i}{X Y : Set i} → X ~ Y → X → Y
apply~ eq = proj₁ (D.head eq)
invert~ : ∀ {i}{X Y : Set i} → X ~ Y → Y → X
invert~ eq = proj₂ (D.head eq)
private
u : ∀ {i}(XY : Set i × Set i)
→ let (X , Y) = XY in X ~ Y → X ≅' Y
u (X , Y) eq = ≅⇒≅' (iso f g α β)
where
f : X → Y
f = apply~ eq
g : Y → X
g = invert~ eq
φ : (x : X)(y : Y) → (f x ≡ y) ~ (x ≡ g y)
φ x y = D.tail eq (x , y)
α : (x : X) → g (f x) ≡ x
α x = sym (apply~ (φ x (f x)) refl)
β : (y : Y) → f (g y) ≡ y
β y = invert~ (φ (g y) y) refl
-- u-morphism : ∀ {i}{X Y : Set i}
-- → (eq : X ~ Y)
-- → unfold≅' (u _ eq)
-- ≡ D.imap u _ (D.out _ eq)
-- u-morphism {i}{X}{Y} eq = unapΣ (refl , funext λ {(x , y) → lem₂ x y})
-- where
-- f : X → Y
-- f = apply~ eq
--
-- g : Y → X
-- g = invert~ eq
--
-- φ : (x : X)(y : Y) → (f x ≡ y) ~ (x ≡ g y)
-- φ x y = D.tail eq (x , y)
--
-- σ τ : (x : X)(y : Y) → (f x ≡ y) ≅' (x ≡ g y)
-- σ x y = proj₂ (unfold≅' (u _ eq)) (x , y)
-- τ x y = u _ (φ x y)
--
-- lem : (x : X)(y : Y)(p : f x ≡ y)
-- → apply≅' (σ x y) p ≡ apply≅' (τ x y) p
-- lem x .(f x) refl = ?
--
-- lem₂ : (x : X)(y : Y) → proj₂ (unfold≅' (u (X , Y) eq)) (x , y)
-- ≡ u _ (D.tail eq (x , y))
-- lem₂ x y = ≅'-equality (funext (lem x y))
--
-- v : ∀ {i}(XY : Set i × Set i) → let (X , Y) = XY in X ≅' Y → X ~ Y
-- v = D.unfold (λ _ → unfold≅')
--
-- vu-morphism : ∀ {i}{X Y : Set i}
-- → (eq : X ~ Y)
-- → D.out _ (v _ (u _ eq))
-- ≡ D.imap (v D.∘ⁱ u) _ (D.out _ eq)
-- vu-morphism {X = X}{Y = Y} eq = ap (D.imap v _) (u-morphism eq)
--
-- vu-id : ∀ {i}{X Y : Set i} (eq : X ~ Y) → v _ (u _ eq) ≡ eq
-- vu-id eq = D.unfold-η D.out (v D.∘ⁱ u) vu-morphism eq · D.unfold-id eq
--
-- uv-id : ∀ {i}{X Y : Set i} (i : X ≅' Y) → u _ (v _ i) ≡ i
-- uv-id {X = X}{Y = Y} i = ≅'-equality refl
--
-- ~⇔≅' : ∀ {i}{X Y : Set i} → (X ~ Y) ≅ (X ≅' Y)
-- ~⇔≅' = iso (u _) (v _) vu-id uv-id
|
Src/SacaraVm/vm_jump_if_great.asm | mrfearless/sacara | 0 | 168811 | <filename>Src/SacaraVm/vm_jump_if_great.asm
header_VmJumpIfGreat
vm_jump_if_great PROC
push ebp
mov ebp, esp
; pop the value
push [ebp+arg0]
call_vm_stack_pop_enc
; read the carry flag
mov ebx, [ebp+arg0]
mov ebx, [ebx+vm_flags]
test ebx, VM_CARRY_FLAG
jnz finish
; modify the vm IP
mov ebx, [ebp+arg0]
mov [ebx+vm_ip], eax
finish:
mov esp, ebp
pop ebp
ret
vm_jump_if_great ENDP
header_marker |
Script-Debugger/Handler-Tester.applescript | boisy/AppleScripts | 116 | 4734 | use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use kl : script "Kevin's Library"
tell application "Keyboard Maestro Engine"
if variable "SD__theChoice" exists then
set handlerName to getvariable "SD__theChoice"
else
tell application "Script Debugger"
tell front document
set theselection to selection
if theselection begins with "on" then
set handlerName to kl's extractBetween(paragraph 1 of theselection, "on ", "(")
end if
end tell
end tell
end if
end tell
tell application "Script Debugger"
tell front document
set theName to name
set theHandler to first script handler whose name is handlerName
set theparams to every handler parameter of theHandler
set handlerCall to missing value
if (count of every handler parameter of theHandler) > 0 then
repeat with n from 1 to (count of theparams)
if n = 1 then
set paramList to name of item n of theparams
set variableSetter to "set " & name of item n of theparams & " to var" & n
else
set paramList to paramList & ", " & name of item n of theparams
set variableSetter to variableSetter & return & "set " & name of item n of theparams & " to var" & n
end if
end repeat
end if
if handlerCall ≠ missing value then
set handlerCall to handlerName & "(" & paramList & ")"
set theTester to variableSetter & "
tell application \"Script Debugger\"
tell document \"" & theName & "\"
" & handlerCall & "
end tell
kend tell"
else
set theTester to "tell application \"Script Debugger\"
tell document \"" & theName & "\"
" & handlerName & "()" & "
end tell
end tell"
end if
end tell
set d to make new document with properties {source text:theTester}
tell d
compile
end tell
end tell
|
agda-stdlib/src/Data/List/Relation/Unary/Unique/Propositional.agda | DreamLinuxer/popl21-artifact | 5 | 13491 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Lists made up entirely of unique elements (propositional equality)
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.List.Relation.Unary.Unique.Propositional {a} {A : Set a} where
open import Relation.Binary.PropositionalEquality using (setoid)
open import Data.List.Relation.Unary.Unique.Setoid as SetoidUnique
------------------------------------------------------------------------
-- Re-export the contents of setoid uniqueness
open SetoidUnique (setoid A) public
|
programs/oeis/098/A098003.asm | karttu/loda | 0 | 89556 | <reponame>karttu/loda<filename>programs/oeis/098/A098003.asm
; A098003: Start with positive integers. On the m-th step, shift terms a(m+1) to a(2m-1) one position to the left, then move a(m) to position (2m-1). Sequence is limit of reordering.
; 1,3,4,2,7,8,6,11,12,9,15,16,5,19,20,14,23,24,17,27,28,13,31,32,22,35,36,25,39,40,18,43,44,30,47,48,33,51,52,10,55,56,38,59,60,41,63,64,29,67,68,46,71,72,49,75,76,34,79,80,54,83,84,57,87,88,26,91,92,62,95,96,65,99,100,45,103,104,70,107,108,73,111,112,50,115,116,78,119,120,81,123,124,37,127,128,86,131,132,89,135,136,61,139,140,94,143,144,97,147,148,66,151,152,102,155,156,105,159,160,21,163,164,110,167,168,113,171,172,77,175,176,118,179,180,121,183,184,82,187,188,126,191,192,129,195,196,58,199,200,134,203,204,137,207,208,93,211,212,142,215,216,145,219,220,98,223,224,150,227,228,153,231,232,69,235,236,158,239,240,161,243,244,109,247,248,166,251,252,169,255,256,114,259,260,174,263,264,177,267,268,53,271,272,182,275,276,185,279,280,125,283,284,190,287,288,193,291,292,130,295,296,198,299,300,201,303,304,90,307,308,206,311,312,209,315,316,141,319,320,214,323,324,217,327,328,146,331,332,222
mul $0,2
mov $1,1
mov $2,$0
mov $3,1
lpb $2,1
lpb $4,1
sub $3,$0
add $4,$0
add $0,1
mov $2,$3
sub $4,2
sub $4,$3
lpe
mov $0,$2
sub $2,1
add $3,$1
mov $4,2
lpe
add $1,$3
sub $1,1
|
programs/oeis/315/A315170.asm | jmorken/loda | 1 | 245548 | ; A315170: Coordination sequence Gal.6.119.6 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,6,10,14,18,22,26,30,34,38,42,48,54,58,62,66,70,74,78,82,86,90,96,102,106,110,114,118,122,126,130,134,138,144,150,154,158,162,166,170,174,178,182,186,192,198,202,206,210,214
mov $2,$0
mov $5,$0
lpb $0
sub $0,5
trn $0,5
add $3,$5
add $3,2
mov $4,$0
trn $0,1
add $4,$3
sub $3,$3
add $5,2
lpe
mov $0,4
trn $4,1
add $1,$4
add $0,$1
trn $4,1
add $0,$4
mov $1,$0
lpb $2
add $1,2
sub $2,1
lpe
sub $1,3
|
LibraBFT/Impl/Consensus/Types.agda | cwjnkins/bft-consensus-agda | 0 | 14587 | {- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2020, 2021, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
{-# OPTIONS --allow-unsolved-metas #-}
open import Optics.All
open import LibraBFT.Prelude
open import LibraBFT.Base.PKCS
open import LibraBFT.Base.Encode
open import LibraBFT.Base.KVMap as KVMap
open import LibraBFT.Base.Types
open import Data.String using (String)
-- This module defines types for an out-of-date implementation, based
-- on a previous version of LibraBFT. It will be updated to model a
-- more recent version in future.
--
-- One important trick here is that the RoundManager type separayes
-- types that /define/ the EpochConfig and types that /use/ the
-- /EpochConfig/. The advantage of doing this separation can be seen
-- in Util.Util.liftEC, where we define a lifting of a function that
-- does not change the bits that define the EpochConfig into the whole
-- state. This enables a more elegant approach for reasoning about
-- functions that do not change parts of the state responsible for
-- defining the epoch config. However, the separation is not perfect,
-- so sometimes fields may be modified in EpochIndep even though there
-- is no epoch change.
module LibraBFT.Impl.Consensus.Types where
open import LibraBFT.Impl.Base.Types public
open import LibraBFT.Impl.NetworkMsg public
open import LibraBFT.Abstract.Types.EpochConfig UID NodeId public
open import LibraBFT.Impl.Consensus.Types.EpochIndep public
open import LibraBFT.Impl.Consensus.Types.EpochDep public
record EpochState : Set where
constructor EpochState∙new
field
₋esEpoch : Epoch
₋esVerifier : ValidatorVerifier
open EpochState public
unquoteDecl esEpoch esVerifier = mkLens (quote EpochState)
(esEpoch ∷ esVerifier ∷ [])
-- The parts of the state of a peer that are used to
-- define the EpochConfig are the SafetyRules and ValidatorVerifier:
record RoundManagerEC : Set where
constructor RoundManagerEC∙new
field
₋rmEpochState : EpochState
₋rmSafetyRules : SafetyRules
open RoundManagerEC public
unquoteDecl rmEpochState rmSafetyRules = mkLens (quote RoundManagerEC)
(rmEpochState ∷ rmSafetyRules ∷ [])
rmEpoch : Lens RoundManagerEC Epoch
rmEpoch = rmEpochState ∙ esEpoch
rmLastVotedRound : Lens RoundManagerEC Round
rmLastVotedRound = rmSafetyRules ∙ srPersistentStorage ∙ pssSafetyData ∙ sdLastVotedRound
-- We need enough authors to withstand the desired number of
-- byzantine failures. We enforce this with a predicate over
-- 'RoundManagerEC'.
RoundManagerEC-correct : RoundManagerEC → Set
RoundManagerEC-correct rmec =
let numAuthors = kvm-size (rmec ^∙ rmEpochState ∙ esVerifier ∙ vvAddressToValidatorInfo)
qsize = rmec ^∙ rmEpochState ∙ esVerifier ∙ vvQuorumVotingPower
bizF = numAuthors ∸ qsize
in suc (3 * bizF) ≤ numAuthors
RoundManagerEC-correct-≡ : (rmec1 : RoundManagerEC)
→ (rmec2 : RoundManagerEC)
→ (rmec1 ^∙ rmEpochState ∙ esVerifier) ≡ (rmec2 ^∙ rmEpochState ∙ esVerifier)
→ RoundManagerEC-correct rmec1
→ RoundManagerEC-correct rmec2
RoundManagerEC-correct-≡ rmec1 rmec2 refl = id
-- Given a well-formed set of definitions that defines an EpochConfig,
-- α-EC will compute this EpochConfig by abstracting away the unecessary
-- pieces from RoundManagerEC.
-- TODO-2: update and complete when definitions are updated to more recent version
α-EC : Σ RoundManagerEC RoundManagerEC-correct → EpochConfig
α-EC (rmec , ok) =
let numAuthors = kvm-size (rmec ^∙ rmEpochState ∙ esVerifier ∙ vvAddressToValidatorInfo)
qsize = rmec ^∙ rmEpochState ∙ esVerifier ∙ vvQuorumVotingPower
bizF = numAuthors ∸ qsize
in (EpochConfig∙new {! someHash?!}
(rmec ^∙ rmEpoch) numAuthors {!!} {!!} {!!} {!!} {!!} {!!} {!!} {!!})
postulate
α-EC-≡ : (rmec1 : RoundManagerEC)
→ (rmec2 : RoundManagerEC)
→ (vals≡ : rmec1 ^∙ rmEpochState ∙ esVerifier ≡ rmec2 ^∙ rmEpochState ∙ esVerifier)
→ rmec1 ^∙ rmEpoch ≡ rmec2 ^∙ rmEpoch
→ (rmec1-corr : RoundManagerEC-correct rmec1)
→ α-EC (rmec1 , rmec1-corr) ≡ α-EC (rmec2 , RoundManagerEC-correct-≡ rmec1 rmec2 vals≡ rmec1-corr)
{-
α-EC-≡ rmec1 rmec2 refl refl rmec1-corr = refl
-}
-- Just in case RoundManager is at a higher level in future
ℓ-RoundManager : Level
ℓ-RoundManager = 0ℓ
-- Finally, the RoundManager is split in two pieces: those that are used to make an EpochConfig
-- versus those that use an EpochConfig. The reason is that the *abstract* EpochConfig is a
-- function of some parts of the RoundManager (₋rmEC), and some parts depend on the abstract
-- EpochConfig. For example, ₋btIdToQuorumCert carries a proof that the QuorumCert is valid (for
-- the abstract EpochConfig).
record RoundManager : Set ℓ-RoundManager where
constructor RoundManager∙new
field
₋rmEC : RoundManagerEC
₋rmEC-correct : RoundManagerEC-correct ₋rmEC
₋rmWithEC : RoundManagerWithEC (α-EC (₋rmEC , ₋rmEC-correct))
-- If we want to add pieces that neither contribute to the
-- construction of the EC nor need one, they should be defined in
-- RoundManager directly
open RoundManager public
α-EC-RM : RoundManager → EpochConfig
α-EC-RM rm = α-EC ((₋rmEC rm) , (₋rmEC-correct rm))
₋rmHighestQC : (rm : RoundManager) → QuorumCert
₋rmHighestQC rm = ₋btHighestQuorumCert ((₋rmWithEC rm) ^∙ (lBlockTree (α-EC-RM rm)))
rmHighestQC : Lens RoundManager QuorumCert
rmHighestQC = mkLens' ₋rmHighestQC
(λ (RoundManager∙new ec ecc (RoundManagerWithEC∙new (BlockStore∙new bsInner))) qc
→ RoundManager∙new ec ecc (RoundManagerWithEC∙new (BlockStore∙new (record bsInner {₋btHighestQuorumCert = qc}))))
₋rmHighestCommitQC : (rm : RoundManager) → QuorumCert
₋rmHighestCommitQC rm = ₋btHighestCommitCert ((₋rmWithEC rm) ^∙ (lBlockTree (α-EC-RM rm)))
rmHighestCommitQC : Lens RoundManager QuorumCert
rmHighestCommitQC = mkLens' ₋rmHighestCommitQC
(λ (RoundManager∙new ec ecc (RoundManagerWithEC∙new (BlockStore∙new bsInner))) qc
→ RoundManager∙new ec ecc (RoundManagerWithEC∙new (BlockStore∙new (record bsInner {₋btHighestCommitCert = qc}))))
|
programs/oeis/069/A069924.asm | jmorken/loda | 1 | 96863 | <filename>programs/oeis/069/A069924.asm<gh_stars>1-10
; A069924: Number of k, 1<=k<=n, such that phi(k) divides k.
; 1,2,2,3,3,4,4,5,5,5,5,6,6,6,6,7,7,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22
add $0,1
lpb $0
div $0,2
mov $2,$0
lpb $2
add $1,1
div $2,3
lpe
lpe
add $1,1
|
45/runtime/herc/cursor.asm | minblock/msdos | 0 | 97221 | ; TITLE CURSOR - page and cursor control for MSHERC
;***
;CURSOR
;
; Copyright <C> 1987, 1988, Microsoft Corporation
;
;Purpose:
; Page and cursor control for MSHERC.
;
;Revision History:
;
;******************************************************************************
include hgcdefs.inc
code segment para public 'code'
assume cs:code,ds:code
Public SetActivePage
Public SetCursor
Public ReadCursor
Public GSetCursorType
Extrn DMC_Save:byte
Extrn ConfigMode:byte ;[1] FULL or HALF mode
;-------------------------------------------------------------------------------
; 5 SELECTACTIVEPAGE
; AL => Page Number
;-------------------------------------------------------------------------------
SetActivePage proc near
mov ah,DMC_Save ;get saved DMC_Port value
and ah,not GraphicsPage1 ;clear page bit
xor cx,cx ;Assume Graphics Page 0
and al,1 ;page 0 or 1?
jz SetGSeg ;go if page 0
dec al ;[1] set al = 0 in case not FULL mode
cmp [ConfigMode],FULL ;[1] make sure FULL mode
jne SetGSeg ;[1] brif not, use page 0
inc al ;[1] reset al = 1 for page 1
mov cx,GraphBufferSize ;no, use page 1
or ah,GraphicsPage1 ;set page 1
SetGSeg:
mov DMC_Save,ah ;Save in Mode Record
mov byte ptr es:BIOSPAGE,al ;set page number BIOS variable
mov word ptr es:BIOSSTART,cx;set buffer offset BIOS variable
push ax
mov dx,DMC_Port ;Use the Display Mode Control Port
mov al,ah ;output new DMC_Port value
out dx,al ;Set DMC Port and turn on screen
pop ax
xor ah,ah ;set proper cursor loc for this page
shl ax,1
mov di,ax
mov bx,es:BIOSCURS[di]
ret
SetActivePage endp
;-------------------------------------------------------------------------------
; 2 SET CURSOR POSITION
; BH => Page Number
; DH,DL => Row, Column, (0,0) is upper left
;-------------------------------------------------------------------------------
SetCursor proc near
xor ax,ax
mov al,bh
and ax,1
shl ax,1
mov di,ax
mov es:BIOSCURS[di],dx
Ret ;Finished Set Cursor Procedure
SetCursor endp
;-------------------------------------------------------------------------------
; 3 READ CURSOR POSITION
; BH => Page Number
; DH,DL <= Row, Column, (0,0) is upper left
; CX <= BIOS Cursor Type (N/A for graphics mode)
;-------------------------------------------------------------------------------
ReadCursor proc near
;------Put the current cursor position on stack------
xor ax,ax
mov al,bh
shl ax,1
mov di,ax
mov dx,es:BIOSCURS[di] ;Fetch Cursor Position
mov FunData.FunDX,dx ;Save in Stack Parameter Area
mov cx,es:BIOSCURSMODE ;Fetch Cursor Start/Stop Scans
mov FunData.FunCX,cx ;Save in Stack Parameter Area
Ret ;Finished Read Cursor Procedure
ReadCursor endp
;-------------------------------------------------------------------------------
; 1 SET CURSOR TYPE
; CX => Cursor type (saved, but no action taken)
;-------------------------------------------------------------------------------
GSetCursorType proc near
mov word ptr es:BIOSCURSMODE,cx
Ret ;Finished Set Cursor Type Procedure
GSetCursorType endp
code ends
end
|
Cubical/HITs/Join/Base.agda | dan-iel-lee/cubical | 0 | 14664 | {-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.HITs.Join.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.HITs.S1
open import Cubical.HITs.S3
-- redtt version : https://github.com/RedPRL/redtt/blob/master/library/cool/s3-to-join.red
data join {ℓ ℓ'} (A : Type ℓ) (B : Type ℓ') : Type (ℓ-max ℓ ℓ') where
inl : A → join A B
inr : B → join A B
push : ∀ a b → inl a ≡ inr b
facek01 : I → I → I → join S¹ S¹
facek01 i j k = hfill (λ l → λ { (j = i0) → push base base (~ l ∧ ~ k)
; (j = i1) → push base base (~ l ∧ ~ k)
; (k = i0) → push (loop j) base (~ l)
; (k = i1) → inl base })
(inS (push base base (~ k))) i
border-contraction : I → I → I → I → join S¹ S¹
border-contraction i j k m =
hfill (λ l → λ { (i = i0) → facek01 i1 j l
; (i = i1) → push base (loop k) (~ l)
; (j = i0) → push base (loop k) (i ∧ ~ l)
; (j = i1) → push base (loop k) (i ∧ ~ l)
; (k = i0) → facek01 (~ i) j l
; (k = i1) → facek01 (~ i) j l })
(inS (push (loop j) (loop k) i)) m
S³→joinS¹S¹ : S³ → join S¹ S¹
S³→joinS¹S¹ base = inl base
S³→joinS¹S¹ (surf j k i) = border-contraction i j k i1
joinS¹S¹→S³ : join S¹ S¹ → S³
joinS¹S¹→S³ (inl x) = base
joinS¹S¹→S³ (inr x) = base
joinS¹S¹→S³ (push base b i) = base
joinS¹S¹→S³ (push (loop x) base i) = base
joinS¹S¹→S³ (push (loop i) (loop j) k) = surf i j k
connection : I → I → I → I → S³
connection i j k l =
hfill (λ m → λ { (k = i0) → joinS¹S¹→S³ (facek01 m i j)
; (k = i1) → base
; (j = i0) → base
; (j = i1) → base
; (i = i0) → base
; (i = i1) → base })
(inS base) l
S³→joinS¹S¹→S³ : ∀ x → joinS¹S¹→S³ (S³→joinS¹S¹ x) ≡ x
S³→joinS¹S¹→S³ base l = base
S³→joinS¹S¹→S³ (surf j k i) l =
hcomp (λ m → λ { (l = i0) → joinS¹S¹→S³ (border-contraction i j k m)
; (l = i1) → surf j k i
; (i = i0) → connection j m l i1
; (i = i1) → base
; (j = i0) → base
; (j = i1) → base
; (k = i0) → connection j m l (~ i)
; (k = i1) → connection j m l (~ i) })
(surf j k i)
joinS¹S¹→S³→joinS¹S¹ : ∀ x → S³→joinS¹S¹ (joinS¹S¹→S³ x) ≡ x
joinS¹S¹→S³→joinS¹S¹ (inl base) l = inl base
joinS¹S¹→S³→joinS¹S¹ (inl (loop i)) l = facek01 i1 i (~ l)
joinS¹S¹→S³→joinS¹S¹ (inr base) l = push base base l
joinS¹S¹→S³→joinS¹S¹ (inr (loop i)) l = push base (loop i) l
joinS¹S¹→S³→joinS¹S¹ (push base base i) l = push base base (i ∧ l)
joinS¹S¹→S³→joinS¹S¹ (push base (loop k) i) l = push base (loop k) (i ∧ l)
joinS¹S¹→S³→joinS¹S¹ (push (loop k) base i) l = facek01 (~ i) k (~ l)
joinS¹S¹→S³→joinS¹S¹ (push (loop j) (loop k) i) l = border-contraction i j k (~ l)
S³IsojoinS¹S¹ : Iso S³ (join S¹ S¹)
Iso.fun S³IsojoinS¹S¹ = S³→joinS¹S¹
Iso.inv S³IsojoinS¹S¹ = joinS¹S¹→S³
Iso.rightInv S³IsojoinS¹S¹ = joinS¹S¹→S³→joinS¹S¹
Iso.leftInv S³IsojoinS¹S¹ = S³→joinS¹S¹→S³
S³≡joinS¹S¹ : S³ ≡ join S¹ S¹
S³≡joinS¹S¹ = isoToPath S³IsojoinS¹S¹
|
bounding_volume/example.adb | Lucretia/old_nehe_ada95 | 0 | 9064 | <filename>bounding_volume/example.adb
---------------------------------------------------------------------------------
-- Copyright 2004-2005 © <NAME>
--
-- This code is to be used for tutorial purposes only.
-- You may not redistribute this code in any form without my express permission.
---------------------------------------------------------------------------------
with Ada.Numerics;
with Interfaces.C; use Interfaces.C;
with Unchecked_Conversion;
with Text_Io; use Text_Io;
with GL;
with GL.EXT;
with GLU;
with GLUtils;
with Matrix4x4;
with Mesh;
with Torus;
with Cylinder;
with AABB;
with OBB;
with Sphere;
use type GL.EXT.glLockArraysEXTPtr;
use type GL.EXT.glUnlockArraysEXTPtr;
use type GL.GLfloat;
use type GL.GLbitfield;
package body Example is
subtype ColourRange is Integer range 1 .. 4;
subtype VectorRange is Integer range 1 .. 4;
type ColourArray is array(ColourRange) of aliased GL.GLfloat;
type VectorArray is array(VectorRange) of aliased GL.GLfloat;
function Get_glLockArraysEXT is new GLUtils.GetProc(GL.EXT.glLockArraysEXTPtr);
function Get_glUnlockArraysEXT is new GLUtils.GetProc(GL.EXT.glUnlockArraysEXTPtr);
glLockArraysEXT : GL.EXT.glLockArraysEXTPtr := null;
glUnlockArraysEXT : GL.EXT.glUnlockArraysEXTPtr := null;
--Torus_Data : Torus.Object := Torus.Object'(1.0, 1.0, 4, 4);
Cylinder_Data : Cylinder.Object := Cylinder.Object'(1.0, 2.0, 8);
--Torus_Mesh : Mesh.Object := Mesh.Create(Torus_Data);
Cylinder_Mesh : Mesh.Object := Mesh.Create(Cylinder_Data);
procedure FindNeededExtensions is
begin
if GLUtils.IsExtensionAvailable("GL_EXT_compiled_vertex_array") = True then
HaveCVA := True;
else
Put_Line("Cannot find GL_EXT_compiled_vertex_array extension");
end if;
if HaveCVA = True then
glLockArraysEXT := Get_glLockArraysEXT("glLockArraysEXT");
glUnlockArraysEXT := Get_glUnlockArraysEXT("glUnlockArraysEXT");
if glLockArraysEXT = null then
Put_Line("Error getting glLockArraysEXT");
end if;
if glUnlockArraysEXT = null then
Put_Line("Error getting glUnlockArraysEXT");
end if;
end if;
end FindNeededExtensions;
procedure PrintGLInfo is
begin
Put_Line("GL Vendor => " & GLUtils.GL_Vendor);
Put_Line("GL Version => " & GLUtils.GL_Version);
Put_Line("GL Renderer => " & GLUtils.GL_Renderer);
Put_Line("GL Extensions => " & GLUtils.GL_Extensions);
New_Line;
Put_Line("GLU Version => " & GLUtils.GLU_Version);
Put_Line("GLU Extensions => " & GLUtils.GLU_Extensions);
New_Line;
end PrintGLInfo;
procedure PrintUsage is
begin
Put_Line("Keys");
Put_Line("Cursor keys => Rotate cube/move camera");
Put_Line("Page Down/Up => Zoom in/out");
Put_Line("Shift + Page Up/Down => Look up/down");
Put_Line("F1 => Toggle Fullscreen");
Put_Line("F2 => Toggle CVA rendering");
Put_Line("F3 => Toggle AABB (Green)");
Put_Line("F4 => Toggle OBB (Blue)");
Put_Line("F5 => Toggle Bounding Sphere (Yellow)");
Put_Line("C => Select Camera for movement");
Put_Line("L => Toggle Lighting");
Put_Line("S => Select Smooth/Flat Shading");
Put_Line("W => Toggle Wireframe");
Put_Line("Escape => Quit");
end PrintUsage;
procedure CalculateFPS is
CurrentTime : Float := Float(SDL.Timer.GetTicks) / 1000.0;
ElapsedTime : Float := CurrentTime - LastElapsedTime;
FramesPerSecond : String(1 .. 10);
MillisecondPerFrame : String(1 .. 10);
package Float_InOut is new Text_IO.Float_IO(Float);
use Float_InOut;
begin
FrameCount := FrameCount + 1;
if ElapsedTime > 1.0 then
FPS := Float(FrameCount) / ElapsedTime;
Put(FramesPerSecond, FPS, Aft => 2, Exp => 0);
Put(MillisecondPerFrame, 1000.0 / FPS, Aft => 2, Exp => 0);
SDL.Video.WM_Set_Caption_Title(Example.GetTitle & " " & FramesPerSecond & " fps " & MillisecondPerFrame & " ms/frame");
LastElapsedTime := CurrentTime;
FrameCount := 0;
end if;
end CalculateFPS;
function Initialise return Boolean is
LightAmbient : ColourArray := (0.5, 0.5, 0.5, 1.0);
LightDiffuse : ColourArray := (1.0, 1.0, 1.0, 1.0);
LightPosition : VectorArray := (0.0, 2.0, 4.0, 1.0);
begin
GL.glClearColor(0.0, 0.0, 0.0, 0.0); -- Black Background.
GL.glClearDepth(1.0); -- Depth Buffer Setup.
GL.glDepthFunc(GL.GL_LEQUAL); -- The Type Of Depth Testing (Less Or Equal).
GL.glEnable(GL.GL_DEPTH_TEST); -- Enable Depth Testing.
GL.glShadeModel(GL.GL_SMOOTH); -- Select Smooth Shading.
GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); -- Set Perspective Calculations To Most Accurate.
-- Start of user initialisation.
GL.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, LightAmbient(LightAmbient'First)'Unchecked_Access);
GL.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, LightDiffuse(LightDiffuse'First)'Unchecked_Access);
GL.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, LightPosition(LightPosition'First)'Unchecked_Access);
GL.glEnable(GL.GL_LIGHT1);
if LightingOn = True then
GL.glEnable(GL.GL_LIGHTING);
else
GL.glDisable(GL.GL_LIGHTING);
end if;
-- We only need to update the OBB for the mesh once as it never changes.
Mesh.Update_OBB(Cylinder_Mesh); -- Would normally be creating in the modelling package.
return True;
end Initialise;
procedure Uninitialise is
begin
null;
end Uninitialise;
procedure Update is --(Ticks : in Integer) is
Result : Interfaces.C.int;
ShiftPressed : Boolean := False;
begin
-- Handle the modifiers.
if Keys(SDL.Keysym.K_LSHIFT) = True or Keys(SDL.Keysym.K_RSHIFT) = True then
ShiftPressed := True;
end if;
-- Now handle the other keys.
if Keys(SDL.Keysym.K_F1) = True then
Result := SDL.Video.WM_ToggleFullScreen(ScreenSurface);
end if;
if Keys(SDL.Keysym.K_LEFT) = True then
if CameraMoving = True then
ViewCamera.Eye.X := ViewCamera.Eye.X - 0.1;
else
YSpeed := YSpeed - 0.1;
end if;
end if;
if Keys(SDL.Keysym.K_RIGHT) = True then
if CameraMoving = True then
ViewCamera.Eye.X := ViewCamera.Eye.X + 0.1;
else
YSpeed := YSpeed + 0.1;
end if;
end if;
if Keys(SDL.Keysym.K_UP) = True then
if CameraMoving = True then
ViewCamera.Eye.Y := ViewCamera.Eye.Y - 0.1;
else
XSpeed := XSpeed - 0.1;
end if;
end if;
if Keys(SDL.Keysym.K_DOWN) = True then
if CameraMoving = True then
ViewCamera.Eye.Y := ViewCamera.Eye.Y + 0.1;
else
XSpeed := XSpeed + 0.1;
end if;
end if;
if Keys(SDL.Keysym.K_PAGEUP) = True then
if ShiftPressed = True then
ViewCamera.Centre.Y := ViewCamera.Centre.Y + 0.01;
else
ViewCamera.Eye.Z := ViewCamera.Eye.Z + 0.1;
end if;
end if;
if Keys(SDL.Keysym.K_PAGEDOWN) = True then
if ShiftPressed = True then
ViewCamera.Centre.Y := ViewCamera.Centre.Y - 0.01;
else
ViewCamera.Eye.Z := ViewCamera.Eye.Z - 0.1;
end if;
end if;
if Keys(SDL.Keysym.K_ESCAPE) = True then
AppQuit := True;
end if;
if Keys(SDL.Keysym.K_l) = True and PressedL = False then
PressedL := True;
LightingOn := LightingOn xor True;
if LightingOn = True then
GL.glEnable(GL.GL_LIGHTING);
else
GL.glDisable(GL.GL_LIGHTING);
end if;
end if;
if Keys(SDL.Keysym.K_l) = False then
PressedL := False;
end if;
if Keys(SDL.Keysym.K_s) = True and PressedS = False then
PressedS := True;
SmoothShadingOn := SmoothShadingOn xor True;
if SmoothShadingOn = True then
GL.glShadeModel(GL.GL_SMOOTH);
else
GL.glShadeModel(GL.GL_FLAT);
end if;
end if;
if Keys(SDL.Keysym.K_s) = False then
PressedS := False;
end if;
if Keys(SDL.Keysym.K_w) = True and PressedW = False then
PressedW := True;
WireframeOn := WireframeOn xor True;
if WireframeOn = True then
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE);
else
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL);
end if;
end if;
if Keys(SDL.Keysym.K_w) = False then
PressedW := False;
end if;
if Keys(SDL.Keysym.K_F2) = True and PressedF2 = False then
PressedF2 := True;
UseCVA := UseCVA xor True;
if UseCVA = True then
Put_Line("CVA rendering enabled");
else
Put_Line("CVA rendering disabled");
end if;
end if;
if Keys(SDL.Keysym.K_F2) = False then
PressedF2 := False;
end if;
if Keys(SDL.Keysym.K_F3) = True and PressedF3 = False then
PressedF3 := True;
AABBs_On := AABBs_On xor True;
end if;
if Keys(SDL.Keysym.K_F3) = False then
PressedF3 := False;
end if;
if Keys(SDL.Keysym.K_F4) = True and PressedF4 = False then
PressedF4 := True;
OBBs_On := OBBs_On xor True;
end if;
if Keys(SDL.Keysym.K_F4) = False then
PressedF4 := False;
end if;
if Keys(SDL.Keysym.K_F5) = True and PressedF5 = False then
PressedF5 := True;
Spheres_On := Spheres_On xor True;
end if;
if Keys(SDL.Keysym.K_F5) = False then
PressedF5 := False;
end if;
if Keys(SDL.Keysym.K_c) = True and PressedC = False then
PressedC := True;
CameraMoving := CameraMoving xor True;
end if;
if Keys(SDL.Keysym.K_c) = False then
PressedC := False;
end if;
-- Update the geometry.
-- Cylinder.
declare
CylinderRotX : Matrix3x3.Object := Matrix3x3.Identity;
CylinderRotY : Matrix3x3.Object := Matrix3x3.Identity;
begin
-- Construct the cylinder matrix.
Matrix3x3.FromAngleAxis(CylinderRotX, Float(XSpeed) * (Ada.Numerics.PI / 180.0), Vector3.Object'(1.0, 0.0, 0.0));
Matrix3x3.FromAngleAxis(CylinderRotY, Float(YSpeed) * (Ada.Numerics.PI / 180.0), Vector3.Object'(0.0, 1.0, 0.0));
Cylinder_Mesh.Transform := CylinderRotX * CylinderRotY;
Cylinder_Mesh.Translation := Vector3.Object'(0.0, 0.0, 0.0);
end;
-- We would normally be able to only update these if necessary.
Mesh.Update_AABB(Cylinder_Mesh); -- Would only be updated if the mesh had moved, i.e. using a dirty flag.
Mesh.Update_Sphere(Cylinder_Mesh); -- As per AABB
end Update;
procedure Draw is
ViewCameraInverse : Matrix4x4.Object := Camera.GetMatrix(ViewCamera);
FloorAmbient : ColourArray := (0.0, 0.0, 0.5, 1.0);
TorusAmbient : ColourArray := (1.0, 1.0, 1.0, 1.0);
function Matrix4x4_To_GLfloat is new Unchecked_Conversion(Source => Matrix4x4.View, Target => GL.GLfloatPtr);
begin
GL.glClear(GL.GL_COLOR_BUFFER_BIT or GL.GL_DEPTH_BUFFER_BIT); -- Clear Screen And Depth Buffer.
-- Move the camera aound the scene.
Camera.Set(ViewCamera);
-- Floor.
declare
FloorRotation : Matrix3x3.Object := Matrix3x3.Identity;
FloorTransform : Matrix4x4.Object := Matrix4x4.Identity;
FloorTM : aliased Matrix4x4.Object := Matrix4x4.Identity;
begin
-- Construct the floor's matrix.
Matrix3x3.Scale(FloorRotation, 4.0, 1.0, 4.0);
FloorTransform := Matrix4x4.Compose(FloorRotation, Vector3.Object'(0.0, -1.0, 0.0));
FloorTM := FloorTransform * ViewCameraInverse;
GL.glLoadMatrixf(Matrix4x4_To_GLfloat(FloorTM'Unchecked_Access));
end;
GL.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT, FloorAmbient(FloorAmbient'First)'Unchecked_Access);
GL.glBegin(GL.GL_QUADS);
GL.glNormal3f(GL.GLFloat'( 0.0), 1.0, 0.0);
GL.glVertex3f(GL.GLFloat'(-1.0), -1.0, -1.0);
GL.glVertex3f(GL.GLFloat'( 1.0), -1.0, -1.0);
GL.glVertex3f(GL.GLFloat'( 1.0), -1.0, 1.0);
GL.glVertex3f(GL.GLFloat'(-1.0), -1.0, 1.0);
GL.glEnd;
-- Torus.
-- declare
-- LeftCubeRotX : Matrix3x3.Object := Matrix3x3.Identity;
-- LeftCubeRotY : Matrix3x3.Object := Matrix3x3.Identity;
-- LeftCubeRotTM : Matrix3x3.Object := Matrix3x3.Identity;
-- LeftCubeTransform : Matrix4x4.Object := Matrix4x4.Identity;
-- LeftCubeTM : aliased Matrix4x4.Object := Matrix4x4.Identity;
-- begin
-- Construct the tori matrix.
-- Matrix3x3.FromAngleAxis(LeftCubeRotX, Float(XSpeed) * (Ada.Numerics.PI / 180.0), Vector3.Object'(1.0, 0.0, 0.0));
-- Matrix3x3.FromAngleAxis(LeftCubeRotY, Float(YSpeed) * (Ada.Numerics.PI / 180.0), Vector3.Object'(0.0, 1.0, 0.0));
-- LeftCubeRotTM := LeftCubeRotX * LeftCubeRotY;
-- LeftCubeTransform := Matrix4x4.Compose(LeftCubeRotTM, Vector3.Object'(0.0, 0.0, 0.0));
-- LeftCubeTM := LeftCubeTransform * ViewCameraInverse;
-- GL.glLoadMatrixf(Matrix4x4_To_GLfloat(LeftCubeTM'Unchecked_Access));
-- end;
declare
CylinderTransform : Matrix4x4.Object := Matrix4x4.Identity;
CylinderTM : aliased Matrix4x4.Object := Matrix4x4.Identity;
begin
CylinderTransform := Matrix4x4.Compose(Cylinder_Mesh.Transform, Cylinder_Mesh.Translation);
CylinderTM := CylinderTransform * ViewCameraInverse;
GL.glLoadMatrixf(Matrix4x4_To_GLfloat(CylinderTM'Unchecked_Access));
end;
GL.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT, TorusAmbient(TorusAmbient'First)'Unchecked_Access);
GL.glEnableClientState(GL.GL_VERTEX_ARRAY);
GL.glVertexPointer(3, GL.GL_FLOAT, 0, Mesh.GetVertices(Cylinder_Mesh));
--GL.glEnableClientState(GL.GL_NORMAL_ARRAY);
--GL.glNormalPointer(GL.GL_FLOAT, 0, Mesh.GetNormals(Torus_Mesh));
--GL.glEnableClientState(GL.GL_COLOR_ARRAY);
--GL.glColorPointer(4, GL.GL_FLOAT, 0, To_GLpointer(Colours(Colours'First)'Access));
if HaveCVA = True and UseCVA = True then
glLockArraysEXT.all(GL.GLint(Cylinder_Mesh.Indices.all'First), Cylinder_Mesh.Indices.all'Length);
end if;
GL.glDrawElements(Cylinder_Mesh.Primitive, Cylinder_Mesh.Indices.all'Length, GL.GL_UNSIGNED_INT, Mesh.GetIndices(Cylinder_Mesh));
if HaveCVA = True and UseCVA = True then
glUnlockArraysEXT.all;
end if;
GL.glDisableClientState(GL.GL_VERTEX_ARRAY);
--GL.glDisableClientState(GL.GL_NORMAL_ARRAY);
--GL.glDisableClientState(GL.GL_COLOR_ARRAY);
if AABBs_On = True then
declare
AABBTransform : Matrix4x4.Object := Matrix4x4.Identity;
AABBTM : aliased Matrix4x4.Object := Matrix4x4.Identity;
begin
-- Construct the AABB matrix.
AABBTM := AABBTransform * ViewCameraInverse;
GL.glLoadMatrixf(Matrix4x4_To_GLfloat(AABBTM'Unchecked_Access));
end;
AABB.Render(Cylinder_Mesh.AABB_Bounds);
end if;
if OBBs_On = True then
declare
OBBTransform : Matrix4x4.Object := Matrix4x4.Compose(Cylinder_Mesh.Transform, Cylinder_Mesh.Translation);
OBBTM : aliased Matrix4x4.Object := Matrix4x4.Identity;
begin
-- Construct the AABB matrix.
OBBTM := OBBTransform * ViewCameraInverse;
GL.glLoadMatrixf(Matrix4x4_To_GLfloat(OBBTM'Unchecked_Access));
end;
OBB.Render(Cylinder_Mesh.OBB_Bounds);
end if;
if Spheres_On = True then
declare
SphereTransform : Matrix4x4.Object := Matrix4x4.Compose(Cylinder_Mesh.Transform, Cylinder_Mesh.Translation);
SphereTM : aliased Matrix4x4.Object := Matrix4x4.Identity;
begin
-- Construct the AABB matrix.
SphereTM := SphereTransform * ViewCameraInverse;
GL.glLoadMatrixf(Matrix4x4_To_GLfloat(SphereTM'Unchecked_Access));
end;
Sphere.Render(Cylinder_Mesh.Sphere_Bounds);
end if;
GL.glFlush; -- Flush The GL Rendering Pipeline.
end Draw;
function GetTitle return String is
begin
return Title;
end GetTitle;
function GetWidth return Integer is
begin
return Width;
end GetWidth;
function GetHeight return Integer is
begin
return Height;
end GetHeight;
function GetBitsPerPixel return Integer is
begin
return BitsPerPixel;
end GetBitsPerPixel;
procedure SetLastTickCount(Ticks : in Integer) is
begin
LastTickCount := Ticks;
end SetLastTickCount;
procedure SetSurface(Surface : in SDL.Video.Surface_Ptr) is
begin
ScreenSurface := Surface;
end SetSurface;
function GetSurface return SDL.Video.Surface_Ptr is
begin
return ScreenSurface;
end GetSurface;
procedure SetKey(Key : in SDL.Keysym.Key; Down : in Boolean) is
begin
Keys(Key) := Down;
end SetKey;
procedure SetActive(Active : in Boolean) is
begin
AppActive := Active;
end SetActive;
function IsActive return Boolean is
begin
return AppActive;
end IsActive;
procedure SetQuit(Quit : in Boolean) is
begin
AppQuit := Quit;
end SetQuit;
function Quit return Boolean is
begin
return AppQuit;
end Quit;
end Example;
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca.log_21829_660.asm | ljhsiun2/medusa | 9 | 88045 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xcbeb, %rsi
lea addresses_WT_ht+0x1db5, %rdi
sub $63075, %rbp
mov $15, %rcx
rep movsw
nop
nop
nop
nop
nop
xor $51683, %r10
lea addresses_UC_ht+0x1c1eb, %rbp
nop
nop
nop
cmp $5988, %rcx
vmovups (%rbp), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rdi
nop
nop
nop
and $54971, %rdi
lea addresses_UC_ht+0x6beb, %rsi
lea addresses_WC_ht+0x3beb, %rdi
nop
xor $15824, %rdx
mov $26, %rcx
rep movsq
nop
nop
xor %r10, %r10
lea addresses_D_ht+0xfbeb, %rsi
lea addresses_D_ht+0x1e3c3, %rdi
lfence
mov $77, %rcx
rep movsl
nop
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_A_ht+0x156d5, %rsi
clflush (%rsi)
add %rbp, %rbp
mov $0x6162636465666768, %rdx
movq %rdx, %xmm0
vmovups %ymm0, (%rsi)
nop
nop
nop
nop
nop
dec %r10
lea addresses_WT_ht+0x17beb, %r10
and $29428, %r8
vmovups (%r10), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rcx
nop
nop
nop
nop
dec %r10
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %r9
push %rbx
push %rdx
// Load
lea addresses_normal+0x103eb, %r13
nop
nop
nop
nop
nop
inc %rbx
vmovups (%r13), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %rdx
nop
cmp $31457, %r13
// Faulty Load
lea addresses_RW+0xfbeb, %r10
dec %r8
movb (%r10), %dl
lea oracles, %r9
and $0xff, %rdx
shlq $12, %rdx
mov (%r9,%rdx,1), %rdx
pop %rdx
pop %rbx
pop %r9
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': True, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 8}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': True, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_D_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'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
*/
|
programs/oeis/245/A245578.asm | neoneye/loda | 22 | 101425 | ; A245578: The number of permutations of {0,0,1,1,...,n-1,n-1} that begin with 0 and in which adjacent elements are adjacent mod n.
; 1,10,18,22,32,38,50,58,72,82,98,110,128,142,162,178,200,218,242,262,288,310,338,362,392,418,450,478,512,542,578,610,648,682,722,758,800,838,882,922,968,1010,1058,1102,1152,1198,1250,1298,1352,1402,1458,1510,1568,1622,1682,1738,1800,1858,1922,1982,2048,2110,2178,2242,2312,2378,2450,2518,2592,2662,2738,2810,2888,2962,3042,3118,3200,3278,3362,3442,3528,3610,3698,3782,3872,3958,4050,4138,4232,4322,4418,4510,4608,4702,4802,4898,5000,5098,5202,5302
lpb $0
add $0,8
add $4,5
sub $0,$4
add $3,$0
trn $0,4
mov $4,1
lpe
add $2,$3
add $1,$2
add $1,5
add $1,$3
add $2,$4
add $1,$2
sub $1,$3
sub $1,4
mov $0,$1
|
rewrite-protobuf/src/main/antlr/Protobuf2Parser.g4 | thomaszub/rewrite | 0 | 7836 | parser grammar Protobuf2Parser;
options { tokenVocab=Protobuf2Lexer; }
proto
: syntax (importStatement | packageStatement | optionDef | topLevelDef | emptyStatement)* EOF
;
stringLiteral
: StringLiteral
;
identOrReserved
: ident
| reservedWord
;
syntax
: SYNTAX ASSIGN stringLiteral SEMI
;
importStatement
: IMPORT (WEAK | PUBLIC)? stringLiteral SEMI
;
packageStatement
: PACKAGE fullIdent SEMI
;
optionName
: (ident | LPAREN fullIdent RPAREN ) (DOT identOrReserved)*
;
option
: optionName ASSIGN constant
;
optionDef
: OPTION option SEMI
;
optionList
: (LBRACK option (COMMA option)* RBRACK)
;
topLevelDef
: message
| enumDefinition
| service
| extend
;
ident
: Ident
;
message
: MESSAGE ident messageBody
;
messageField
: (OPTIONAL | REQUIRED | REPEATED) field
;
messageBody
: LBRACE (messageField | enumDefinition | extend | message | optionDef | oneOf | mapField | reserved | emptyStatement)* RBRACE
;
extend
: EXTEND fullIdent LBRACE ( messageField | emptyStatement )* RBRACE
;
enumDefinition
: ENUM ident enumBody
;
enumBody
: LBRACE (optionDef | enumField | emptyStatement)* RBRACE
;
enumField
: ident ASSIGN MINUS? IntegerLiteral optionList? SEMI
;
service
: SERVICE ident serviceBody
;
serviceBody
: LBRACE (optionDef | rpc | emptyStatement)* RBRACE
;
rpc
: RPC ident rpcInOut RETURNS rpcInOut (rpcBody | SEMI)
;
rpcInOut
: LPAREN STREAM? messageType=fullIdent RPAREN
;
rpcBody
: LBRACE (optionDef | emptyStatement)* RBRACE
;
reserved
: RESERVED (ranges | fieldNames) SEMI
;
ranges
: range (COMMA range)*
;
range
: IntegerLiteral (TO IntegerLiteral)?
;
fieldNames
: stringLiteral (COMMA stringLiteral)*
;
type
: (DOUBLE
| FLOAT
| INT32
| INT64
| UINT32
| UINT64
| SINT32
| SINT64
| FIXED32
| FIXED64
| SFIXED32
| SFIXED64
| BOOL
| STRING
| BYTES) #PrimitiveType
| fullIdent #FullyQualifiedType
;
field
: type fieldName=identOrReserved ASSIGN IntegerLiteral optionList? SEMI
;
oneOf
: ONEOF ident LBRACE (field | emptyStatement)* RBRACE
;
mapField
: MAP LCHEVR keyType COMMA type RCHEVR ident ASSIGN IntegerLiteral optionList? SEMI
;
keyType
: INT32
| INT64
| UINT32
| UINT64
| SINT32
| SINT64
| FIXED32
| FIXED64
| SFIXED32
| SFIXED64
| BOOL
| STRING
;
reservedWord
: MESSAGE
| OPTION
| PACKAGE
| SERVICE
| STREAM
| STRING
| SYNTAX
| WEAK
| RPC
;
/*
Technically a fullIdent can't start with a reserved word, but
it simplifies the use of the parser if we start with the assumption
that the proto is well formed to begin with.
Also, in some cases a fullIdent can begin with a dot and some cases not, but
we are going to map both of these cases to the same AST element for simplicity.
*/
fullIdent
: DOT? (identOrReserved DOT)* identOrReserved
;
emptyStatement
: SEMI
;
constant
: fullIdent
| IntegerLiteral
| NumericLiteral
| StringLiteral
| BooleanLiteral
;
|
programs/oeis/240/A240676.asm | karttu/loda | 1 | 97672 | <reponame>karttu/loda
; A240676: Number of digits in the decimal expansion of n^7.
; 1,1,3,4,5,5,6,6,7,7,8,8,8,8,9,9,9,9,9,9,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13
pow $0,7
add $0,1
log $0,10
mov $1,$0
add $1,1
|
src/keystore-marshallers.adb | My-Colaborations/ada-keystore | 25 | 11477 | -----------------------------------------------------------------------
-- keystore-marshallers -- Data marshaller for the keystore
-- 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 Interfaces.C;
with Ada.Calendar.Conversions;
with Util.Encoders.HMAC.SHA256;
with Util.Encoders.AES;
package body Keystore.Marshallers is
use Interfaces;
-- ------------------------------
-- Set the block header with the tag and wallet identifier.
-- ------------------------------
procedure Set_Header (Into : in out Marshaller;
Tag : in Interfaces.Unsigned_16;
Id : in Keystore.Wallet_Identifier) is
Buf : constant Buffers.Buffer_Accessor := Into.Buffer.Data.Value;
begin
Into.Pos := Block_Index'First + 1;
Buf.Data (Block_Index'First) := Stream_Element (Shift_Right (Tag, 8));
Buf.Data (Block_Index'First + 1) := Stream_Element (Tag and 16#0ff#);
Put_Unsigned_16 (Into, 0);
Put_Unsigned_32 (Into, Interfaces.Unsigned_32 (Id));
Put_Unsigned_32 (Into, 0);
Put_Unsigned_32 (Into, 0);
end Set_Header;
procedure Set_Header (Into : in out Marshaller;
Value : in Interfaces.Unsigned_32) is
Buf : constant Buffers.Buffer_Accessor := Into.Buffer.Data.Value;
begin
Buf.Data (Block_Index'First) := Stream_Element (Shift_Right (Value, 24));
Buf.Data (Block_Index'First + 1) := Stream_Element (Shift_Right (Value, 16) and 16#0ff#);
Buf.Data (Block_Index'First + 2) := Stream_Element (Shift_Right (Value, 8) and 16#0ff#);
Buf.Data (Block_Index'First + 3) := Stream_Element (Value and 16#0ff#);
Into.Pos := Block_Index'First + 3;
end Set_Header;
procedure Put_Unsigned_16 (Into : in out Marshaller;
Value : in Interfaces.Unsigned_16) is
Pos : constant Block_Index := Into.Pos;
Buf : constant Buffers.Buffer_Accessor := Into.Buffer.Data.Value;
begin
Into.Pos := Pos + 2;
Buf.Data (Pos + 1) := Stream_Element (Shift_Right (Value, 8));
Buf.Data (Pos + 2) := Stream_Element (Value and 16#0ff#);
end Put_Unsigned_16;
procedure Put_Unsigned_32 (Into : in out Marshaller;
Value : in Interfaces.Unsigned_32) is
Pos : constant Block_Index := Into.Pos;
Buf : constant Buffers.Buffer_Accessor := Into.Buffer.Data.Value;
begin
Into.Pos := Pos + 4;
Buf.Data (Pos + 1) := Stream_Element (Shift_Right (Value, 24));
Buf.Data (Pos + 2) := Stream_Element (Shift_Right (Value, 16) and 16#0ff#);
Buf.Data (Pos + 3) := Stream_Element (Shift_Right (Value, 8) and 16#0ff#);
Buf.Data (Pos + 4) := Stream_Element (Value and 16#0ff#);
end Put_Unsigned_32;
procedure Put_Unsigned_64 (Into : in out Marshaller;
Value : in Interfaces.Unsigned_64) is
begin
Put_Unsigned_32 (Into, Unsigned_32 (Shift_Right (Value, 32)));
Put_Unsigned_32 (Into, Unsigned_32 (Value and 16#0ffffffff#));
end Put_Unsigned_64;
procedure Put_Kind (Into : in out Marshaller;
Value : in Entry_Type) is
begin
case Value is
when T_INVALID =>
Put_Unsigned_16 (Into, 0);
when T_STRING =>
Put_Unsigned_16 (Into, 1);
when T_BINARY =>
Put_Unsigned_16 (Into, 2);
when T_WALLET =>
Put_Unsigned_16 (Into, 3);
when T_FILE =>
Put_Unsigned_16 (Into, 4);
when T_DIRECTORY =>
Put_Unsigned_16 (Into, 5);
end case;
end Put_Kind;
procedure Put_Block_Number (Into : in out Marshaller;
Value : in Block_Number) is
begin
Put_Unsigned_32 (Into, Interfaces.Unsigned_32 (Value));
end Put_Block_Number;
procedure Put_Block_Index (Into : in out Marshaller;
Value : in Block_Index) is
begin
Put_Unsigned_16 (Into, Interfaces.Unsigned_16 (Value));
end Put_Block_Index;
procedure Put_Buffer_Size (Into : in out Marshaller;
Value : in Buffer_Size) is
begin
Put_Unsigned_16 (Into, Interfaces.Unsigned_16 (Value));
end Put_Buffer_Size;
procedure Put_String (Into : in out Marshaller;
Value : in String) is
Pos : Block_Index;
Buf : constant Buffers.Buffer_Accessor := Into.Buffer.Data.Value;
begin
Put_Unsigned_16 (Into, Value'Length);
Pos := Into.Pos;
Into.Pos := Into.Pos + Value'Length;
for C of Value loop
Pos := Pos + 1;
Buf.Data (Pos) := Character'Pos (C);
end loop;
end Put_String;
procedure Put_Date (Into : in out Marshaller;
Value : in Ada.Calendar.Time) is
Unix_Time : Interfaces.C.long;
begin
Unix_Time := Ada.Calendar.Conversions.To_Unix_Time (Value);
Put_Unsigned_64 (Into, Unsigned_64 (Unix_Time));
end Put_Date;
procedure Put_Storage_Block (Into : in out Marshaller;
Value : in Buffers.Storage_Block) is
begin
Put_Unsigned_32 (Into, Interfaces.Unsigned_32 (Value.Storage));
Put_Unsigned_32 (Into, Interfaces.Unsigned_32 (Value.Block));
end Put_Storage_Block;
procedure Put_Secret (Into : in out Marshaller;
Value : in Secret_Key;
Protect_Key : in Secret_Key;
Protect_IV : in Secret_Key) is
Cipher_Key : Util.Encoders.AES.Encoder;
Last : Stream_Element_Offset;
Pos : constant Block_Index := Into.Pos + 1;
Buf : constant Buffers.Buffer_Accessor := Into.Buffer.Data.Value;
IV : constant Util.Encoders.AES.Word_Block_Type
:= (others => Interfaces.Unsigned_32 (Into.Buffer.Block.Block));
begin
Cipher_Key.Set_Key (Protect_Key, Util.Encoders.AES.CBC);
Cipher_Key.Set_IV (Protect_IV, IV);
Cipher_Key.Set_Padding (Util.Encoders.AES.NO_PADDING);
-- Encrypt the key into the key-slot using the protection key.
Last := Pos + Block_Index (Value.Length) - 1;
Cipher_Key.Encrypt_Secret (Secret => Value,
Into => Buf.Data (Pos .. Last));
Into.Pos := Last;
end Put_Secret;
procedure Put_HMAC_SHA256 (Into : in out Marshaller;
Key : in Secret_Key;
Content : in Ada.Streams.Stream_Element_Array) is
Pos : constant Block_Index := Into.Pos;
Buf : constant Buffers.Buffer_Accessor := Into.Buffer.Data.Value;
begin
Into.Pos := Into.Pos + SIZE_HMAC;
-- Make HMAC-SHA256 signature of the data content before encryption.
Util.Encoders.HMAC.SHA256.Sign (Key => Key,
Data => Content,
Result => Buf.Data (Pos + 1 .. Into.Pos));
end Put_HMAC_SHA256;
procedure Put_UUID (Into : in out Marshaller;
Value : in UUID_Type) is
begin
for I in Value'Range loop
Put_Unsigned_32 (Into, Value (I));
end loop;
end Put_UUID;
function Get_Header (From : in out Marshaller) return Interfaces.Unsigned_32 is
Buf : constant Buffers.Buffer_Accessor := From.Buffer.Data.Value;
begin
From.Pos := Block_Index'First + 3;
return Shift_Left (Unsigned_32 (Buf.Data (Block_Index'First)), 24) or
Shift_Left (Unsigned_32 (Buf.Data (Block_Index'First + 1)), 16) or
Shift_Left (Unsigned_32 (Buf.Data (Block_Index'First + 2)), 8) or
Unsigned_32 (Buf.Data (Block_Index'First + 3));
end Get_Header;
function Get_Header_16 (From : in out Marshaller) return Interfaces.Unsigned_16 is
Buf : constant Buffers.Buffer_Accessor := From.Buffer.Data.Value;
begin
From.Pos := Block_Index'First + 1;
return Shift_Left (Unsigned_16 (Buf.Data (Block_Index'First)), 8) or
Unsigned_16 (Buf.Data (Block_Index'First + 1));
end Get_Header_16;
function Get_Unsigned_16 (From : in out Marshaller) return Interfaces.Unsigned_16 is
Pos : constant Block_Index := From.Pos;
Buf : constant Buffers.Buffer_Accessor := From.Buffer.Data.Value;
begin
From.Pos := Pos + 2;
return Shift_Left (Unsigned_16 (Buf.Data (Pos + 1)), 8) or
Unsigned_16 (Buf.Data (Pos + 2));
end Get_Unsigned_16;
function Get_Unsigned_32 (From : in out Marshaller) return Interfaces.Unsigned_32 is
Pos : constant Block_Index := From.Pos;
Buf : constant Buffers.Buffer_Accessor := From.Buffer.Data.Value;
begin
From.Pos := Pos + 4;
return Shift_Left (Unsigned_32 (Buf.Data (Pos + 1)), 24) or
Shift_Left (Unsigned_32 (Buf.Data (Pos + 2)), 16) or
Shift_Left (Unsigned_32 (Buf.Data (Pos + 3)), 8) or
Unsigned_32 (Buf.Data (Pos + 4));
end Get_Unsigned_32;
function Get_Unsigned_64 (From : in out Marshaller) return Interfaces.Unsigned_64 is
High : constant Interfaces.Unsigned_32 := Get_Unsigned_32 (From);
Low : constant Interfaces.Unsigned_32 := Get_Unsigned_32 (From);
begin
return Shift_Left (Unsigned_64 (High), 32) or Unsigned_64 (Low);
end Get_Unsigned_64;
function Get_Storage_Block (From : in out Marshaller) return Buffers.Storage_Block is
Storage : constant Interfaces.Unsigned_32 := Get_Unsigned_32 (From);
Block : constant Interfaces.Unsigned_32 := Get_Unsigned_32 (From);
begin
return Buffers.Storage_Block '(Storage => Buffers.Storage_Identifier (Storage),
Block => Block_Number (Block));
end Get_Storage_Block;
procedure Get_String (From : in out Marshaller;
Result : in out String) is
Pos : Block_Index := From.Pos;
Buf : constant Buffers.Buffer_Accessor := From.Buffer.Data.Value;
begin
From.Pos := From.Pos + Block_Index (Result'Length);
for I in Result'Range loop
Pos := Pos + 1;
Result (I) := Character'Val (Buf.Data (Pos));
end loop;
end Get_String;
function Get_Date (From : in out Marshaller) return Ada.Calendar.Time is
Unix_Time : constant Unsigned_64 := Get_Unsigned_64 (From);
begin
return Ada.Calendar.Conversions.To_Ada_Time (Interfaces.C.long (Unix_Time));
end Get_Date;
function Get_Kind (From : in out Marshaller) return Entry_Type is
Value : constant Unsigned_16 := Get_Unsigned_16 (From);
begin
case Value is
when 0 =>
return T_INVALID;
when 1 =>
return T_STRING;
when 2 =>
return T_BINARY;
when 3 =>
return T_WALLET;
when 4 =>
return T_FILE;
when 5 =>
return T_DIRECTORY;
when others =>
return T_INVALID;
end case;
end Get_Kind;
procedure Get_Secret (From : in out Marshaller;
Secret : out Secret_Key;
Protect_Key : in Secret_Key;
Protect_IV : in Secret_Key) is
Decipher_Key : Util.Encoders.AES.Decoder;
Last : Stream_Element_Offset;
Pos : constant Block_Index := From.Pos + 1;
Buf : constant Buffers.Buffer_Accessor := From.Buffer.Data.Value;
IV : constant Util.Encoders.AES.Word_Block_Type
:= (others => Interfaces.Unsigned_32 (From.Buffer.Block.Block));
begin
Decipher_Key.Set_Key (Protect_Key, Util.Encoders.AES.CBC);
Decipher_Key.Set_IV (Protect_IV, IV);
Decipher_Key.Set_Padding (Util.Encoders.AES.NO_PADDING);
Last := Pos + Block_Index (Secret.Length) - 1;
Decipher_Key.Decrypt_Secret (Data => Buf.Data (Pos .. Last),
Secret => Secret);
From.Pos := Last;
end Get_Secret;
procedure Get_UUID (From : in out Marshaller;
UUID : out UUID_Type) is
begin
for I in UUID'Range loop
UUID (I) := Marshallers.Get_Unsigned_32 (From);
end loop;
end Get_UUID;
procedure Get_Data (From : in out Marshaller;
Size : in Ada.Streams.Stream_Element_Offset;
Data : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is
Buf : constant Buffers.Buffer_Accessor := From.Buffer.Data.Value;
Pos : constant Block_Index := From.Pos + 1;
begin
Last := Data'First + Size - 1;
Data (Data'First .. Last) := Buf.Data (Pos .. Pos + Size - 1);
From.Pos := Pos + Size - 1;
end Get_Data;
procedure Skip (From : in out Marshaller;
Count : in Block_Index) is
begin
From.Pos := From.Pos + Count;
end Skip;
end Keystore.Marshallers;
|
gfx/pokemon/unown_s/anim.asm | Dev727/ancientplatinum | 28 | 241161 | frame 1, 12
frame 0, 10
frame 2, 12
frame 0, 24
setrepeat 2
frame 1, 03
frame 2, 03
dorepeat 5
endanim
|
oeis/049/A049395.asm | neoneye/loda-programs | 11 | 29304 | ; A049395: Expansion of (1-25*x)^(-7/5).
; Submitted by <NAME>
; 1,35,1050,29750,818125,22089375,589050000,15567750000,408653437500,10670395312500,277430278125000,7187966296875000,185689129335937500,4785066025195312500,123044554933593750000,3158143576628906250000,80927429151115722656250,2070790098866784667968750,52920191415484497070312500,1350857517711051635742187500,34446866701631816711425781250,877574937398715330505371093750,22338271133785481140136718750000,568169070141935063781738281250000,14440963866107516204452514648437500
add $0,1
mov $2,$0
seq $0,49380 ; Expansion of (1-25*x)^(-2/5).
mul $2,$0
mov $0,$2
div $0,10
|
openwebinspector.scpt | wannundwo/wuw_client | 5 | 2558 | <reponame>wannundwo/wuw_client<filename>openwebinspector.scpt
#!/usr/bin/osascript
# Name of the device as visible in Safari->Develop menu
set deviceName to "iOS Simulator"
# Number of seconds to wait for the simulator window to show up
set maxWait to 30
# ---------------------------------------
# You shouldn't modify anything below here
set hasClicked to false
set x to 0
tell application "Safari"
activate
repeat until hasClicked or x > (maxWait * 10)
try
tell application "System Events"
click menu item "index.html" of menu deviceName of menu item deviceName of menu "Entwickler" of menu bar item "Entwickler" of menu bar 1 of application process "Safari"
end tell
set hasClicked to true
on error foo
delay 0.1
set x to x + 1
end try
end repeat
if hasClicked = false then
display dialog "Unable to connect to iOS simulator - make sure that it's working" buttons {"OK"} default button 1
else
try
tell application "System Events"
click button 1 of window "Top Sites" of application process "Safari"
end tell
end try
return
end if
end tell |
Transynther/x86/_processed/US/_zr_/i3-7100_9_0xca_notsx.log_2_33.asm | ljhsiun2/medusa | 9 | 88376 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xbe36, %rsi
lea addresses_D_ht+0x6ba6, %rdi
nop
nop
nop
nop
add $16216, %r8
mov $109, %rcx
rep movsq
add %rbp, %rbp
lea addresses_WC_ht+0x1ab1e, %rbx
nop
nop
nop
nop
and $32495, %r13
mov (%rbx), %ecx
nop
xor %rbp, %rbp
lea addresses_WC_ht+0xf26e, %rsi
nop
and $26272, %rcx
movl $0x61626364, (%rsi)
nop
nop
nop
xor %rbx, %rbx
lea addresses_WC_ht+0x3bca, %rsi
lea addresses_WT_ht+0xb466, %rdi
and $14479, %r10
mov $108, %rcx
rep movsq
nop
nop
nop
nop
xor %r13, %r13
lea addresses_A_ht+0xf19e, %rbx
nop
nop
inc %r13
mov $0x6162636465666768, %rcx
movq %rcx, %xmm7
movups %xmm7, (%rbx)
nop
nop
and %r13, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_US+0x5b1e, %rsi
mov $0xf1e, %rdi
nop
nop
nop
nop
nop
inc %r11
mov $63, %rcx
rep movsl
nop
nop
nop
and $51994, %r10
// Faulty Load
lea addresses_US+0x5b1e, %r10
clflush (%r10)
nop
and %rdi, %rdi
mov (%r10), %r11
lea oracles, %r10
and $0xff, %r11
shlq $12, %r11
mov (%r10,%r11,1), %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_US', 'congruent': 0, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_P', 'congruent': 8, 'same': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 4, 'NT': True, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False}}
{'00': 2}
00 00
*/
|
Util/llvm/test/FrontendAda/vce.adb | ianloic/unladen-swallow | 5 | 16028 | <reponame>ianloic/unladen-swallow<filename>Util/llvm/test/FrontendAda/vce.adb
-- RUN: %llvmgcc -c %s
procedure VCE is
S : String (1 .. 2);
B : Character := 'B';
begin
S := 'A' & B;
end;
|
pkgs/tools/yasm/src/modules/parsers/gas/tests/gas-fill.asm | manggoguy/parsec-modified | 2,151 | 171558 | <reponame>manggoguy/parsec-modified<filename>pkgs/tools/yasm/src/modules/parsers/gas/tests/gas-fill.asm<gh_stars>1000+
.text
.fill 5
.fill 3, 1
.fill 4, 2
.fill 4, 8, 0x11223344
.fill 4, 4, 0x11223344
|
Computability/Data/Fin/Opposite.agda | jesyspa/computability-in-agda | 2 | 8753 | <reponame>jesyspa/computability-in-agda
module Computability.Data.Fin.Opposite where
open import Computability.Prelude
open import Data.Nat using (_≤_; _<_; s≤s; z≤n)
open import Data.Nat.Properties using (≤-step)
open import Data.Fin using (Fin; zero; suc; inject₁; fromℕ; fromℕ<; toℕ; opposite)
opposite-fromℕ : ∀ k → opposite (fromℕ k) ≡ zero
opposite-fromℕ zero = refl
opposite-fromℕ (suc k) rewrite opposite-fromℕ k = refl
opposite-inject₁-suc : ∀{k}(i : Fin k) → opposite (inject₁ i) ≡ suc (opposite i)
opposite-inject₁-suc zero = refl
opposite-inject₁-suc (suc i) rewrite opposite-inject₁-suc i = refl
opposite-opposite : ∀{k}(i : Fin k) → opposite (opposite i) ≡ i
opposite-opposite {suc k} zero rewrite opposite-fromℕ k = refl
opposite-opposite (suc i)
rewrite opposite-inject₁-suc (opposite i)
| opposite-opposite i = refl
opposite-fromℕ< : ∀ a b (lt : a < b) → opposite (fromℕ< (≤-step lt)) ≡ suc (opposite (fromℕ< lt))
opposite-fromℕ< zero .(suc _) (s≤s le) = refl
opposite-fromℕ< (suc a) .(suc _) (s≤s le) rewrite opposite-fromℕ< _ _ le = refl
|
archive/agda-2/Oscar/Category/Category.agda | m0davis/oscar | 0 | 9325 |
module Oscar.Category.Category where
open import Oscar.Category.Setoid
open import Oscar.Category.Semigroupoid
open import Oscar.Level
module _
{𝔬 𝔪 𝔮}
(semigroupoid : Semigroupoid 𝔬 𝔪 𝔮)
where
open Semigroupoid semigroupoid
record IsCategory (ε : ∀ {x} → x ↦ x) : Set (𝔬 ⊔ 𝔪 ⊔ 𝔮) where
instance _ = IsSetoid↦
field
left-identity : ∀ {x y} (f : x ↦ y) → ε ∙ f ≋ f
right-identity : ∀ {x y} (f : x ↦ y) → f ∙ ε ≋ f
open IsCategory ⦃ … ⦄ public
record Category 𝔬 𝔪 𝔮 : Set (lsuc (𝔬 ⊔ 𝔪 ⊔ 𝔮)) where
constructor _,_
field
semigroupoid : Semigroupoid 𝔬 𝔪 𝔮
open Semigroupoid semigroupoid public
field
ε : ∀ {x} → x ↦ x
⦃ isCategory ⦄ : IsCategory semigroupoid ε
open IsCategory isCategory public
|
tests/glfw_test-environment.adb | zrmyers/GLFWAda | 0 | 6870 | --------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2020 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--------------------------------------------------------------------------------
with Ada.Text_IO;
With Glfw;
procedure Glfw_Test.Environment is
-- The default window configuration is used, with no client API specified.
window_hints : Glfw.Record_Window_Hints := (
Client_Api => Glfw.NO_API,
others => <>
);
window_handle : Glfw.Glfw_Window := Glfw.No_Window;
required_extension_names : Glfw.Glfw_String_Vector;
begin
Ada.Text_IO.Put_Line("Initializing GLFW");
-- Initialize GLFW
Glfw.Platform_Init;
Ada.Text_IO.Put_Line("Initializing Window");
-- Set window hints
Glfw.Window_Set_Hints(
hints => window_hints);
-- Initialize a GLFW Window
window_handle :=
Glfw.Window_Create(
width => 1024,
height => 768,
title => "Hello World!");
Ada.Text_IO.Put_Line("Running GLFW Main Loop");
Glfw.Get_Required_Instance_Extensions(required_extension_names);
for name of required_extension_names loop
Ada.Text_IO.Put_Line("Required_Extension: " & Glfw.To_String(name));
end loop;
-- Main Loop
loop
------------------------------------------------------------------------
-- This loop will run forever until the user closes the window or some
-- kind of exception occurs, which causes the program to begin handling
-- the exception.
------------------------------------------------------------------------
pragma Warnings (Off, "variable ""window_handle"" is not modified in loop body");
pragma Warnings (Off, "possible infinite loop");
exit when Glfw.Window_Should_Close(window_handle => window_handle);
pragma Warnings (On, "variable ""window_handle"" is not modified in loop body");
pragma Warnings (On, "possible infinite loop");
-- Poll for Glfw events
Glfw.Platform_Process_Events;
end loop;
Ada.Text_IO.Put_Line("Destroying Window");
Glfw.Window_Destroy(window_handle => window_handle);
Ada.Text_IO.Put_Line("Shutting Down GLFW");
-- Shut down the GLFW instance
Glfw.Platform_Shutdown;
end Glfw_Test.Environment;
|
oeis/188/A188527.asm | neoneye/loda-programs | 11 | 12961 | ; A188527: a(n) = A188526(n) / 7.
; Submitted by <NAME>
; 4,35,313,2813,25309,227765,2049853,18448613,166037389,1494336245,13449025693,121041230213,1089371069869,9804339624725,88239056614333,794151509512613,7147363585580749,64326272270161205,578936450431319773,5210428053881615813,46893852484934018029,422044672364405113685,3798402051279643926013,34185618461516791139813,307670566153651111869709,2769035095382859990050165,24921315858445739876897053,224291842726011658824964613,2018626584534104929290463789,18167639260806944363345738645
add $0,1
mov $1,2
pow $1,$0
mul $0,2
mov $2,3
pow $2,$0
mul $2,6
add $1,$2
mov $0,$1
div $0,14
|
oeis/162/A162261.asm | neoneye/loda-programs | 11 | 27575 | <gh_stars>10-100
; A162261: a(n) = (2*n^3 + 5*n^2 - 7*n)/2.
; 0,11,39,90,170,285,441,644,900,1215,1595,2046,2574,3185,3885,4680,5576,6579,7695,8930,10290,11781,13409,15180,17100,19175,21411,23814,26390,29145,32085,35216,38544,42075,45815,49770,53946,58349,62985,67860,72980,78351,83979,89870,96030,102465,109181,116184,123480,131075,138975,147186,155714,164565,173745,183260,193116,203319,213875,224790,236070,247721,259749,272160,284960,298155,311751,325754,340170,355005,370265,385956,402084,418655,435675,453150,471086,489489,508365,527720,547560,567891
mov $1,$0
add $0,6
add $0,$1
bin $0,2
sub $0,6
mul $0,$1
div $0,2
|
src/offmt_lib-parser.ads | Fabien-Chouteau/offmt-tool | 0 | 3009 | package Offmt_Lib.Parser is
function Parse (Str : String) return Trace;
end Offmt_Lib.Parser;
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca.log_9648_468.asm | ljhsiun2/medusa | 9 | 4938 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca.log_9648_468.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xa283, %r9
nop
nop
nop
nop
add %r11, %r11
vmovups (%r9), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rbp
nop
nop
nop
nop
inc %rax
lea addresses_WC_ht+0xcb83, %rsi
lea addresses_WC_ht+0x1e303, %rdi
cmp $49592, %r10
mov $77, %rcx
rep movsl
nop
nop
nop
nop
dec %rax
lea addresses_UC_ht+0x172e1, %r11
nop
nop
nop
sub %rsi, %rsi
movb (%r11), %al
nop
nop
nop
xor $1136, %r9
lea addresses_D_ht+0x9703, %r9
nop
nop
nop
inc %rbp
mov $0x6162636465666768, %rsi
movq %rsi, %xmm1
and $0xffffffffffffffc0, %r9
movntdq %xmm1, (%r9)
nop
nop
xor $61117, %rbp
lea addresses_normal_ht+0xe183, %rsi
nop
nop
xor $25059, %rbp
mov (%rsi), %r9
dec %r10
lea addresses_UC_ht+0x5e03, %rax
dec %rbp
mov (%rax), %di
nop
nop
nop
nop
dec %rcx
lea addresses_D_ht+0x16853, %rsi
lea addresses_WC_ht+0x1e603, %rdi
nop
nop
nop
add $62769, %rax
mov $26, %rcx
rep movsq
nop
nop
cmp %r10, %r10
lea addresses_UC_ht+0x473, %rsi
clflush (%rsi)
nop
nop
nop
nop
nop
xor %r9, %r9
movb (%rsi), %r11b
nop
nop
nop
nop
nop
cmp %rsi, %rsi
lea addresses_normal_ht+0x1dc63, %r11
nop
xor $21542, %rax
movl $0x61626364, (%r11)
nop
nop
nop
nop
nop
cmp $54062, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r8
push %rax
push %rbp
push %rdi
push %rdx
// Store
mov $0x502ccf00000001da, %rdx
nop
nop
xor $28775, %r11
mov $0x5152535455565758, %rax
movq %rax, (%rdx)
nop
inc %r12
// Load
lea addresses_D+0x18243, %r8
nop
nop
nop
and %rdx, %rdx
vmovups (%r8), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %r11
nop
nop
xor %rbp, %rbp
// Load
mov $0x7d319a0000000963, %rdx
nop
xor $53948, %rdi
movb (%rdx), %r12b
nop
nop
nop
and %r12, %r12
// Store
lea addresses_US+0xf3f, %rdx
nop
dec %rdi
movb $0x51, (%rdx)
nop
nop
nop
cmp %rax, %rax
// Store
lea addresses_D+0x14103, %rdi
nop
cmp %rax, %rax
mov $0x5152535455565758, %r8
movq %r8, (%rdi)
dec %rdi
// Store
lea addresses_WT+0xe7a3, %rdx
nop
nop
nop
nop
inc %r12
mov $0x5152535455565758, %rax
movq %rax, (%rdx)
nop
nop
nop
nop
and $28935, %r11
// Store
lea addresses_RW+0x1c1e9, %r12
nop
nop
nop
cmp %r8, %r8
mov $0x5152535455565758, %rdx
movq %rdx, %xmm2
movntdq %xmm2, (%r12)
nop
nop
dec %r12
// Load
lea addresses_PSE+0x2e2b, %r12
nop
add %r11, %r11
mov (%r12), %rdx
nop
nop
cmp $13711, %r12
// Faulty Load
lea addresses_US+0x1703, %rbp
nop
nop
nop
nop
and $21408, %rdx
movb (%rbp), %r11b
lea oracles, %rdx
and $0xff, %r11
shlq $12, %r11
mov (%rdx,%r11,1), %r11
pop %rdx
pop %rdi
pop %rbp
pop %rax
pop %r8
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_NC'}}
{'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_D'}, 'OP': 'LOAD'}
{'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': True, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_US'}}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': True, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_D'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WT'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_RW'}}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': True, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 1, 'AVXalign': True, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 7, 'AVXalign': True, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': True, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}}
{'00': 9648}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2.log_217_114.asm | ljhsiun2/medusa | 9 | 246184 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1c009, %rsi
lea addresses_UC_ht+0xfd23, %rdi
nop
nop
nop
nop
cmp $31819, %r15
mov $64, %rcx
rep movsq
nop
nop
nop
nop
sub $59350, %r11
lea addresses_D_ht+0xd469, %rcx
clflush (%rcx)
nop
nop
dec %r9
mov (%rcx), %r15d
nop
nop
and %rdi, %rdi
lea addresses_D_ht+0xb2c9, %rcx
nop
dec %r8
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
movups %xmm6, (%rcx)
nop
nop
nop
inc %rdi
lea addresses_WC_ht+0xbfc9, %rsi
nop
nop
nop
nop
nop
cmp $35111, %r11
mov (%rsi), %r8w
nop
and %r9, %r9
lea addresses_D_ht+0x17ea9, %rsi
lea addresses_WT_ht+0x1ce49, %rdi
nop
nop
dec %rbx
mov $22, %rcx
rep movsb
nop
nop
nop
cmp %rsi, %rsi
lea addresses_D_ht+0xfbc9, %rsi
lea addresses_WC_ht+0x9fc9, %rdi
nop
nop
sub %r9, %r9
mov $39, %rcx
rep movsq
nop
nop
nop
nop
sub $2985, %rsi
lea addresses_WT_ht+0x12fc9, %rsi
lea addresses_A_ht+0xa63, %rdi
nop
nop
nop
cmp $56575, %rbx
mov $1, %rcx
rep movsq
nop
nop
cmp %r8, %r8
lea addresses_UC_ht+0x1bfe9, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
cmp %rsi, %rsi
movb $0x61, (%rdi)
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_normal_ht+0x7bc9, %r11
nop
nop
nop
nop
sub %r8, %r8
mov (%r11), %r15d
nop
nop
nop
sub %r8, %r8
lea addresses_WT_ht+0x8fc9, %r15
nop
nop
nop
nop
nop
add $47657, %rbx
mov (%r15), %r8
nop
nop
nop
and %rcx, %rcx
lea addresses_A_ht+0x1b3b9, %r15
nop
nop
nop
and %rsi, %rsi
movb $0x61, (%r15)
nop
nop
nop
nop
and %r8, %r8
lea addresses_D_ht+0x4109, %rsi
lea addresses_A_ht+0x4ac9, %rdi
nop
nop
nop
nop
sub $64162, %rbx
mov $18, %rcx
rep movsw
nop
nop
nop
sub %rsi, %rsi
lea addresses_A_ht+0x14949, %rdi
nop
nop
nop
inc %r8
mov $0x6162636465666768, %rsi
movq %rsi, %xmm7
and $0xffffffffffffffc0, %rdi
vmovntdq %ymm7, (%rdi)
nop
nop
nop
nop
nop
xor $18587, %r15
lea addresses_A_ht+0x79c9, %rsi
nop
add %rbx, %rbx
movw $0x6162, (%rsi)
nop
nop
dec %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %r8
push %rbp
push %rsi
// Store
lea addresses_D+0x157c9, %r10
clflush (%r10)
nop
nop
nop
nop
inc %r13
movw $0x5152, (%r10)
nop
nop
nop
inc %r10
// Store
lea addresses_US+0x142e1, %r8
nop
nop
nop
nop
nop
xor $701, %r11
mov $0x5152535455565758, %r12
movq %r12, %xmm3
vmovups %ymm3, (%r8)
nop
nop
nop
nop
dec %rbp
// Store
mov $0x3c9, %r10
cmp $25323, %r12
mov $0x5152535455565758, %rsi
movq %rsi, (%r10)
nop
nop
nop
cmp $6836, %r13
// Faulty Load
lea addresses_D+0x157c9, %r10
nop
nop
nop
nop
add %rbp, %rbp
mov (%r10), %r12w
lea oracles, %r13
and $0xff, %r12
shlq $12, %r12
mov (%r13,%r12,1), %r12
pop %rsi
pop %rbp
pop %r8
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'52': 217}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
1A/S5/PIM/projet/src/display_shell.adb | MOUDDENEHamza/ENSEEIHT | 4 | 15678 | -------------------------------------------------------------------------------
-- Fichier : display_shell.adb
-- Auteur : <NAME> & <NAME>
-- Objectif : Implantation du module Display_Shell
-- Crée : Dimanche Nov 25 2019
--------------------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO;
-- RED ESC & "[31m"
-- GREEN ESC & "[32m"
-- BLUE ESC & "[34m"
-- RESET ESC & "[0m"
package body Display_Shell is
-- Afficher la barre d'initialisation.
procedure Init_Bar is
begin
New_Line;
Put_Line ("*****************************************************************************************************");
New_Line;
Put_Line (" " & ESC & "[32m" & "ARBRE GÉNÉALOGIQUE" & ESC & "[0m");
New_Line;
Put_Line ("*****************************************************************************************************");
New_Line;
Put_Line ("Téléchargement programme ...");
New_Line;
end Init_Bar;
-- Afficher le menu principal.
procedure Display_Menu is
begin
New_Line;
Put_Line (" MENU PRINCIPAL");
New_Line;
Put_Line (ESC & "[31m" & "0)- Pour quitter" & ESC & "[0m");
Put_Line (ESC & "[34m" & "1)- Créer un arbre minimal");
Put_Line ("2)- Ajouter un parent");
Put_Line ("3)- Obtenir le nombre d'ancêtres");
Put_Line ("4)- Obtenir l'ensemble des ancêtres situés à une certaine génération");
Put_Line ("5)- Afficher l'arbre génealogqiue");
Put_Line ("6)- Supprimer l'arbre généalogique");
Put_Line ("7)- Obtenir l'ensemble des individus qui n'ont qu'un parent connu");
Put_Line ("8)- Obtenir l'ensemble des individus dont les deux parents sont connus");
Put_Line ("9)- Obtenir l'ensemble des individus dont les deux parents sont inconnus");
Put_Line ("10)- Identifier les ancêtres sur n générations données");
Put_Line ("11)- Vérifier que deux individus n et m ont un ou plusieurs ancêtres homonymes");
Put_Line ("12)- Obtenir l'ensemble des demi-frères");
Put_Line ("13)- Obtenir l'ensemble des conjoints" & ESC & "[0m");
New_Line;
end Display_Menu;
-- Afficher une erreur quand l'arbre existe déja dans la foret.
procedure Display_TREE_IN_FOREST is
begin
New_Line;
Put_Line (ESC & "[31m" & "ÉCHOUÉ :" & ESC & "[0m" & " L'ID entré est dèja racine d'un arbre existant dans la foret.");
end Display_TREE_IN_FOREST;
-- Afficher un message quand une fonction ou procedure lève une exception.
procedure Display_Exception (Message : in String; Restart : in Integer) is
begin
New_Line;
Put_Line (ESC & "[31m" & "ÉCHOUÉ : " & ESC & "[0m" & Message);
New_Line;
if (Restart = 0) then
Put_Line ("Réessayez encore une fois avec un autre ID.");
else
Put_Line ("Retour au menu principal.");
end if;
end Display_Exception;
-- Afficher un message quand l'exéctuion d'une procédure ou fonction réussit.
procedure Display_Success (Message : in String) is
begin
New_Line;
Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & Message & " est exécutée avec succés.");
New_Line;
Put_Line ("Retour au menu principal");
end Display_Success;
-- Afficher un message quand la création de l'arbre minimal réussi.
procedure Display_Success_Minimal_Tree_Ceation is
begin
New_Line;
Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "La création d'arbre minimal est exécutée avec succés.");
New_Line;
Put_Line ("Retour au menu principal");
end Display_Success_Minimal_Tree_Ceation;
-- Afficher un message quand creer arbre minimal lève l'exception ARBRE_NON_VIDE_EXCEPTION.
procedure Display_ARBRE_NON_VIDE_EXCEPTION is
begin
New_Line;
Put_Line (ESC & "[31m" & "ÉCHOUÉ :" & ESC & "[0m" & " L'arbre passé en paramètre n'est pas vide. L'opération Créer un arbre minimal a échoué.");
New_Line;
Put_Line ("Retour au menu principal");
end Display_ARBRE_NON_VIDE_EXCEPTION;
-- Afficher un message quand ajouter parent réussit.
procedure Display_Success_Add_Parent is
begin
New_Line;
Put_Line (ESC & "[32m" & "RÉUSSI : " & ESC & "[0m" & "Ajout du parent est fait avec succés.");
New_Line;
Put_Line ("Retour au menu principal");
end Display_Success_Add_Parent;
-- Afficher un message quand ajouter parent lève l'exception ARBRE_VIDE_EXCEPTION.
procedure Display_ARBRE_VIDE_EXCEPTION (Message : in String; Restart : in Integer) is
begin
New_Line;
Put_Line (ESC & "[31m" & "ÉCHOUÉ : " & ESC & "[0m" & "L'arbre passé en paramètre est vide. " & Message);
New_Line;
if (Restart = 0) then
Put_Line ("Réessayez encore une fois avec un autre ID.");
else
Put_Line ("Retour au menu principal.");
end if;
end Display_ARBRE_VIDE_EXCEPTION;
-- Afficher un message quand ajouter parent lève l'exception DEUX_PARENTS_PRESENTS_EXCEPTION.
procedure Display_DEUX_PARENTS_PRESENTS_EXCEPTION is
begin
New_Line;
Put_Line (ESC & "[31m" & "ÉCHOUÉ : " & ESC & "[0m" & "L'individu a déjà deux parents. L'ajout du parent a échoué.");
New_Line;
Put_Line ("Réessayez encore une fois avec un autre ID.");
end Display_DEUX_PARENTS_PRESENTS_EXCEPTION;
-- Afficher un message quand ajouter parent lève l'exception ID_ABSENT_EXCEPTION.
procedure Display_ID_ABSENT_EXCEPTION (Message : in String; Restart : in Integer) is
begin
New_Line;
Put_Line (ESC & "[31m" & "ÉCHOUÉ : " & ESC & "[0m" & "l'ID que vous avez entré n'existe pas. " & Message);
New_Line;
if (Restart = 0) then
Put_Line ("Réessayez encore une fois avec un autre ID.");
else
Put_Line ("Retour au menu principal.");
end if;
end Display_ID_ABSENT_EXCEPTION;
-- Afficher le nombre d'ancetres d'un individu donné.
procedure Display_Number_Ancestors (Ab : in T_ABG; ID : in Integer) is
begin
New_Line;
Put_Line ("L'individu qui a l'ID" & ESC & "[32m" & Integer'Image (ID) & ESC & "[0m" & " a" & ESC & "[31m" & Integer'Image(Nombre_Ancetres (Ab, ID)) & ESC & "[0m" & " ancetres.");
New_Line;
Put_Line ("Retour au menu principal.");
end Display_Number_Ancestors;
-- Afficher un message descriptif de l'ensemble affiché sur le terminal.
procedure Display_Title_Set (Message : in String; Generation : in Integer) is
begin
if (Generation = -1) then
New_Line;
Put (Message & " est : ");
else
New_Line;
Put (Message & Integer'Image (Generation) & " géneration est : ");
end if;
end Display_Title_Set;
-- Afficher Vrai si deux individus n et m ont un ou plusieurs ancêtres
-- homonymes, sinon faux.
procedure Display_Is_Homonym (Is_Homonym : in Boolean) is
begin
New_Line;
if (Is_Homonym) then
Put_Line (ESC & "[32m" & "Vrai : " & ESC & "[0m" & "Il existe des ancetres homonymes entre les deux individus");
else
Put_Line (ESC & "[31m" & "Faux : " & ESC & "[0m" & "Il n'existe pas des ancetres homonymes entre les deux individus");
end if;
end Display_Is_Homonym;
-- Afficher la donnée associée à un identifiant dans le registre.
procedure Afficher_Donnee(Registre : in T_Registre ; Id : in Integer) is
Donnee : T_Donnee;
begin
Donnee := La_Donnee_R(Registre,Id);
Put_Line ("Nom : " & Get_Last_Name (Donnee));
Put_Line ("Prénom : " & Get_First_Name (Donnee));
Put_Line ("Date de Naissance : " & Integer'Image(Get_Birthday_Day (Donnee)) & "/" & Integer'Image(Get_Birthday_Month (Donnee)) & "/" & Integer'Image(Get_Birthday_Year (Donnee)));
Put_Line ("Lieu de Naissance : " & Get_Birthplace (Donnee));
Put_Line ("Date de Décès : " & Integer'Image(Get_Deathday_Day (Donnee)) & "/" & Integer'Image(Get_Deathday_Month (Donnee)) & "/" & Integer'Image(Get_Deathday_Year (Donnee)));
Put_Line ("Lieu de Décès : " & Get_Deathplace (Donnee));
Put_Line ("Sexe : " & Character'Image (Get_Sex (Donnee)));
Put_Line ("Email : " & Get_Email (Donnee));
Put_Line ("Numéro de téléphone : " & Integer'Image (Get_Tel (Donnee)));
end Afficher_Donnee;
procedure Display_ABSENT_TREE_EXCEPTION (Message : in String) is
begin
New_Line;
Put_Line (ESC & "[31m" & "ÉCHOUÉ : " & ESC & "[0m" & "L'arbre n'existe pas. " & Message & " a échoué.");
New_Line;
Put_Line ("Retour au menu principal.");
end Display_ABSENT_TREE_EXCEPTION;
-- Afficher la barre de fin d'exécution.
procedure End_Bar is
begin
New_Line;
Put_Line ("À bientôt!");
New_Line;
Put_Line (" " & ESC & "[32m" & "FIN D'EXÉCTUTION" & ESC & "[0m");
New_Line;
Put_Line ("*****************************************************************************************************");
New_Line;
end End_Bar;
end Display_Shell;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/preelab.ads | best08618/asylo | 7 | 15037 | -- { dg-do compile }
with Ada.Finalization;
package preelab is
type T is limited private;
pragma Preelaborable_Initialization (T);
private
type T is new Ada.Finalization.Limited_Controlled with null record;
end preelab;
|
src/shaders/post_processing/gen5_6/Common/RGBX_Save_YUV_Float.asm | martin-kokos/intel-vaapi-driver | 192 | 167240 | /*
* All Video Processing kernels
* Copyright © <2010>, Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This file was originally licensed under the following license
*
* 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.
*
* Authors:
* <NAME> <<EMAIL>>
*/
// Module name: RGBX_Save_YUV_Float.asm
//----------------------------------------------------------------
#include "RGBX_Load_16x8.inc"
#if (0)
// 8 grf reg for one row of pixel (2 pixel per grf)
#define nTEMP0 34
#define nTEMP1 35
#define nTEMP2 36
#define nTEMP3 37
#define nTEMP4 38
#define nTEMP5 39
#define nTEMP6 40
#define nTEMP7 41
#define nTEMP8 42 // transformation coefficient
#define nTEMP10 44 // transformation coefficient
#define nTEMP12 46 // save Y/U/V in ub format
#define nTEMP14 48 // save YUV in ud format
#define nTEMP16 50 // dp4 result
#define nTEMP17 51
#define nTEMP18 52
#define nTEMP24 58
#endif
$for(0; <nY_NUM_OF_ROWS; 1) {
// BGRX | B | G | R | X |
// ###### save one row of pixel to temp grf with float format (required by dp4)
// mov (8) doesn't work, puzzle
mov (4) REG(r, nTEMP0)<1>:f r[SRC_RGBA_OFFSET_1,%1*32 + 0]<4,1>:ub
mov (4) REG(r, nTEMP1)<1>:f r[SRC_RGBA_OFFSET_1,%1*32 + 8]<4,1>:ub
mov (4) REG(r, nTEMP2)<1>:f r[SRC_RGBA_OFFSET_1,%1*32 + 16]<4,1>:ub
mov (4) REG(r, nTEMP3)<1>:f r[SRC_RGBA_OFFSET_1,%1*32 + 24]<4,1>:ub
mov (4) REG(r, nTEMP4)<1>:f r[SRC_RGBA_OFFSET_2,%1*32 + 0]<4,1>:ub
mov (4) REG(r, nTEMP5)<1>:f r[SRC_RGBA_OFFSET_2,%1*32 + 8]<4,1>:ub
mov (4) REG(r, nTEMP6)<1>:f r[SRC_RGBA_OFFSET_2,%1*32 + 16]<4,1>:ub
mov (4) REG(r, nTEMP7)<1>:f r[SRC_RGBA_OFFSET_2,%1*32 + 24]<4,1>:ub
mov (4) REG2(r, nTEMP0, 4)<1>:f r[SRC_RGBA_OFFSET_1,%1*32 + 4]<4,1>:ub
mov (4) REG2(r, nTEMP1, 4)<1>:f r[SRC_RGBA_OFFSET_1,%1*32 + 12]<4,1>:ub
mov (4) REG2(r, nTEMP2, 4)<1>:f r[SRC_RGBA_OFFSET_1,%1*32 + 20]<4,1>:ub
mov (4) REG2(r, nTEMP3, 4)<1>:f r[SRC_RGBA_OFFSET_1,%1*32 + 28]<4,1>:ub
mov (4) REG2(r, nTEMP4, 4)<1>:f r[SRC_RGBA_OFFSET_2,%1*32 + 4]<4,1>:ub
mov (4) REG2(r, nTEMP5, 4)<1>:f r[SRC_RGBA_OFFSET_2,%1*32 + 12]<4,1>:ub
mov (4) REG2(r, nTEMP6, 4)<1>:f r[SRC_RGBA_OFFSET_2,%1*32 + 20]<4,1>:ub
mov (4) REG2(r, nTEMP7, 4)<1>:f r[SRC_RGBA_OFFSET_2,%1*32 + 24]<4,1>:ub
// ###### do one row for Y
// ##### dp4(nTEMP16) and save result to uw format(nTEMP12)
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(0, 0)<0;8,1> fRGB_to_Y_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 0)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(1, 0)<0;8,1> fRGB_to_Y_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 2)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(2, 0)<0;8,1> fRGB_to_Y_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 4)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(3, 0)<0;8,1> fRGB_to_Y_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 6)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(4, 0)<0;8,1> fRGB_to_Y_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 8)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(5, 0)<0;8,1> fRGB_to_Y_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 10)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(6, 0)<0;8,1> fRGB_to_Y_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 12)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(7, 0)<0;8,1> fRGB_to_Y_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:ud REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 14)<1>:ub REG2(r, nTEMP14, 0)<0;2,4>:ub
// #### write Y to the 1 row
mov (16) uwDEST_Y(%1)<1> REG2(r,nTEMP12, 0)<0;16,1>:ub
// ###### do one row for U
// ##### dp4(nTEMP16) and save result to uw format(nTEMP12)
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(0, 0)<0;8,1> fRGB_to_U_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 0)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(1, 0)<0;8,1> fRGB_to_U_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 2)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(2, 0)<0;8,1> fRGB_to_U_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 4)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(3, 0)<0;8,1> fRGB_to_U_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 6)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(4, 0)<0;8,1> fRGB_to_U_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 8)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(5, 0)<0;8,1> fRGB_to_U_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 10)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(6, 0)<0;8,1> fRGB_to_U_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 12)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(7, 0)<0;8,1> fRGB_to_U_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 14)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
add (16) REG2(r, nTEMP12, 0)<1>:w REG2(r, nTEMP12, 0)<0;16,1>:w 128:w
// #### write U to the 1 row
mov (16) uwDEST_U(%1)<1> REG2(r,nTEMP12, 0)<0;16,2>:ub
// ###### do one row for V
// ##### dp4(nTEMP16) and save result to uw format(nTEMP12)
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(0, 0)<0;8,1> fRGB_to_V_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 0)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(1, 0)<0;8,1> fRGB_to_V_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 2)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(2, 0)<0;8,1> fRGB_to_V_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 4)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(3, 0)<0;8,1> fRGB_to_V_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 6)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(4, 0)<0;8,1> fRGB_to_V_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 8)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(5, 0)<0;8,1> fRGB_to_V_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 10)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(6, 0)<0;8,1> fRGB_to_V_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 12)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
dp4 (8) REG2(r, nTEMP16, 0)<1>:f fROW_BGRX(7, 0)<0;8,1> fRGB_to_V_Coef_Float<0;4,1>:f
mov (2) REG2(r, nTEMP14, 0)<1>:d REG2(r, nTEMP16, 0)<0;2,4>:f
mov (2) REG2(r, nTEMP12, 14)<1>:w REG2(r, nTEMP14, 0)<0;2,2>:w
add (16) REG2(r, nTEMP12, 0)<1>:w REG2(r, nTEMP12, 0)<0;16,1>:w 128:w
// #### write V to the 1 row
mov (16) uwDEST_V(%1)<1> REG2(r,nTEMP12, 0)<0;16,2>:ub
}
|
contrib/mac/app/startup.applescript | JuliaLabs/julia | 38,805 | 4347 | set RootPath to (path to me)
set JuliaPath to POSIX path of ((RootPath as text) & "Contents:Resources:julia:bin:julia")
set JuliaFile to POSIX file JuliaPath
tell application id "com.apple.finder" to open JuliaFile
|
programs/oeis/094/A094500.asm | neoneye/loda | 22 | 81045 | <reponame>neoneye/loda
; A094500: Least number k such that (n+1)^k / n^k >= 2.
; 1,2,3,4,4,5,6,6,7,8,8,9,10,11,11,12,13,13,14,15,15,16,17,17,18,19,20,20,21,22,22,23,24,24,25,26,26,27,28,29,29,30,31,31,32,33,33,34,35,36,36,37,38,38,39,40,40,41,42,42,43,44,45,45,46,47,47,48,49,49,50,51,51
lpb $0
mov $1,$0
mov $0,0
seq $1,175406 ; The greatest integer k such that (1+1/n)^k <= 2.
lpe
add $1,1
mov $0,$1
|
programs/oeis/070/A070533.asm | karttu/loda | 1 | 100163 | <gh_stars>1-10
; A070533: n^4 mod 15.
; 0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6,10,1,6,1,1,0,1,1,6,1,10,6,1,1,6
pow $0,4
mod $0,15
mov $1,$0
|
oeis/137/A137880.asm | neoneye/loda-programs | 11 | 12419 | <gh_stars>10-100
; A137880: Indices k of perfect squares among 17-gonal numbers A051869(k) = k*(15*k - 13)/2.
; Submitted by <NAME>
; 1,49,225,23409,108241,11282881,52171729,5438325025,25146664929,2621261378961,12120640323841,1263442546333969,5842123489426225,608976686071593889,2815891401263116401,293525499243961920321,1357253813285332678849,141478681658903574000625,654193522112129088088609,68192431034092278706380721,315319920404232935126030481,32868610279750819432901506689,151983547441318162601658603025,15842601962408860874379819843169,73255754546794950141064320627361,7636101277270791190631640262900561
seq $0,137881 ; a(n) = sqrt(A137880(n)).
pow $0,2
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2_notsx.log_1_141.asm | ljhsiun2/medusa | 9 | 172282 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %rcx
push %rsi
// Faulty Load
mov $0xa03, %r13
nop
mfence
movntdqa (%r13), %xmm7
vpextrq $0, %xmm7, %rsi
lea oracles, %rcx
and $0xff, %rsi
shlq $12, %rsi
mov (%rcx,%rsi,1), %rsi
pop %rsi
pop %rcx
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'00': 1}
00
*/
|
Math/Combinatorics/ListFunction/Properties/Lemma.agda | rei1024/agda-combinatorics | 3 | 6878 | <filename>Math/Combinatorics/ListFunction/Properties/Lemma.agda
------------------------------------------------------------------------
-- Lemmas
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe --exact-split #-}
module Math.Combinatorics.ListFunction.Properties.Lemma where
open import Data.List hiding (_∷ʳ_)
import Data.List.Properties as Lₚ
open import Data.List.Relation.Binary.Sublist.Propositional using (_⊆_; []; _∷_; _∷ʳ_)
open import Data.Product as Prod using (proj₁; proj₂; _×_; _,_)
open import Function
open import Relation.Binary.PropositionalEquality
module _ {a} {A : Set a} where
[]⊆xs : ∀ (xs : List A) → [] ⊆ xs
[]⊆xs [] = []
[]⊆xs (x ∷ xs) = x ∷ʳ []⊆xs xs
module _ {a b} {A : Set a} {B : Set b} where
lemma₁ : ∀ (f : A → B) (x : A) (xss : List (List A)) →
map (λ ys → f x ∷ ys) (map (map f) xss) ≡ map (map f) (map (λ ys → x ∷ ys) xss)
lemma₁ f x xss = begin
map (λ ys → f x ∷ ys) (map (map f) xss) ≡⟨ sym $ Lₚ.map-compose xss ⟩
map (λ ys → f x ∷ map f ys) xss ≡⟨ Lₚ.map-compose xss ⟩
map (map f) (map (λ ys → x ∷ ys) xss) ∎
where open ≡-Reasoning
module _ {a b c} {A : Set a} {B : Set b} {C : Set c} where
proj₁-map₁ : ∀ (f : A → B) (t : A × C) → proj₁ (Prod.map₁ f t) ≡ f (Prod.proj₁ t)
proj₁-map₁ _ _ = refl
module _ {a b} {A : Set a} {B : Set b} where
proj₁-map₂ : ∀ (f : B → B) (t : A × B) → proj₁ (Prod.map₂ f t) ≡ proj₁ t
proj₁-map₂ _ _ = refl
proj₁′ : A × B → A
proj₁′ = proj₁
|
examples/outdated-and-incorrect/Alonzo/Proj.agda | asr/agda-kanso | 1 | 17143 | <reponame>asr/agda-kanso
module Proj where
open import AlonzoPrelude
showTrue : True -> String
showTrue _ = "tt"
-- data True : Set where
-- tt : True
data T4 : Set where
C : True -> True -> True -> True -> T4
g : True -> True -> True
g x y = tt
f14 : T4 -> True -> True
f14 (C x y z t) = \w -> g x t
mainS : String
mainS = showTrue $ (id ○ f14) (C tt tt tt tt) tt |
runtime/sources/x86/memcpy.x86.asm | wdv4758h/Yeppp- | 30 | 83526 | <gh_stars>10-100
;
; Yeppp! library runtime infrastructure
;
; This file is part of Yeppp! library and licensed under MIT license.
; See runtime/LICENSE.txt for details.
;
;
%ifidn __OUTPUT_FORMAT__,elf32
section .text.memcpy align=32
global memcpy:function internal
%else
section .text
global memcpy
%endif
memcpy:
PUSH edi
PUSH esi
CLD
MOV edi, [esp + 8 + 4]
MOV esi, [esp + 8 + 8]
MOV ecx, [esp + 8 + 12]
MOV eax, edi
REP MOVSB
POP esi
POP edi
RET
|
alloy4fun_models/trainstlt/models/2/megMfkHgFGYxLn44b.als | Kaixi26/org.alloytools.alloy | 0 | 841 | <gh_stars>0
open main
pred idmegMfkHgFGYxLn44b_prop3 {
all t : Train | always no t.pos
}
pred __repair { idmegMfkHgFGYxLn44b_prop3 }
check __repair { idmegMfkHgFGYxLn44b_prop3 <=> prop3o } |
src/kernel/drivers/soc/ac_cseg.asm | rostislav-nikitin/socOS | 1 | 29302 | ;=======================================================================================================================
; ;
; Name: socOS (System On Chip Operation System) ;
; Year: 2020 ;
; License: MIT License ;
; ;
;=======================================================================================================================
; Require:
;.include "m8def.inc"
;.include "kernel/kernel_def.asm"
;.include "kernel/drivers/device_def.asm"
;.include "kernel/kernel_cseg.asm"
;.include "kernel/drivers/device_cseg.asm"
.macro m_ac_init
; parameters:
; @0 byte AC_INPUT_NEGATIVE
; @1 byte AC_INPUT_POSITIVE
; @2 byte AC_INTERRPUT_MODE
; @3 word [on_completed_handler]
m_save_r21_r22_r23_Y_Z_registers
m_device_init
;
ldi ZL, low(ac_static_instance)
ldi ZH, high(ac_static_instance)
ldi r23, @0
ldi r22, @1
ldi r21, @2
ldi YL, low(@3)
ldi YH, high(@3)
;
rcall ac_init
;
m_restore_r21_r22_r23_Y_Z_registers
.endm
ac_init:
; parameters:
; Z word [st_ac]
; Y word [on_completed_handler]
; r23 byte AC_INPUT_NEGATIVE
; r22 byte AC_INPUT_POSITIVE
; r21 byte AC_INTERRPUT_MODE
m_save_r22_r23_registers
;
push r23
ldi r23, ST_AC_INPUT_POSITIVE
rcall set_struct_byte
pop r23
mov r22, r23
ldi r23, ST_AC_INPUT_NEGATIVE
rcall set_struct_byte
mov r22, r21
ldi r23, ST_AC_INTERRPUT_MODE_ARISE
rcall set_struct_byte
ldi r23, ST_AC_ON_COMPLETED_HANDLER_OFFSET
rcall set_struct_word
rcall ac_init_ports
;
m_restore_r22_r23_registers
ret
ac_init_ports:
; parameters:
; Z word [st_ac]
m_save_r16_SREG_registers
ldi r23, ST_AC_INPUT_NEGATIVE
rcall get_struct_byte
ac_init_ports_input_negative_check:
cpi r23, AC_INPUT_NEGATIVE_A_IN1
brne ac_init_ports_input_negative_set_mux
ac_init_ports_input_negative_set_a_in1:
; set ACME
in r16, SFIOR
andi r16, ~(1<< ACME)
out SFIOR, r16
; set IN mode for the DDRD BIT7
cbi DDRD, BIT7
; unpull up PORTD7 from the Vcc
cbi PORTD, BIT7
rjmp ac_init_ports_input_positive_check
ac_init_ports_input_negative_set_mux:
; set ACME
in r16, SFIOR
ori r16, (1<< ACME)
out SFIOR, r16
; set ADMUX
in r16, ADMUX
; reset 0 bits
andi r16, ~((1 << MUX2) | (1 << MUX1) | (1 << MUX0))
; set 1 bits
or r16, r23
out ADMUX, r16
; set DDRC
rcall int_to_mask
in r16, DDRC
com r23
and r16, r23
out DDRC, r16
;com r23
in r16, PORTC
;or r16, r23
and r16, r23
out PORTC, r16
ac_init_ports_input_positive_check:
ldi r23, ST_AC_INPUT_POSITIVE
rcall get_struct_byte
cpi r23, AC_INPUT_POSITIVE_A_IN0
brne ac_init_ports_input_positive_vref_1_23_v
ac_init_ports_input_positive_in0:
in r16, ACSR
; reset ACBG
andi r16, ~(1 << ACBG)
out ACSR, r16
; set DDRD to IN for BIT6
cbi DDRD, BIT6
; unpull-up PORTD BIT6 from the Vcc
cbi PORTD, BIT6
rjmp ac_init_ports_interrupt_mode_arise_check
ac_init_ports_input_positive_vref_1_23_v:
in r16, ACSR
; reset ACBG
ori r16, (1 << ACBG)
out ACSR, r16
ac_init_ports_interrupt_mode_arise_check:
ldi r23, ST_AC_INPUT_NEGATIVE
rcall get_struct_byte
in r16, ACSR
andi r16, ~((1 << ACIS0) | (1 << ACIS1))
or r16, r23
out ACSR, r16
m_restore_r16_SREG_registers
ret
.macro m_ac_enable
rcall ac_enable
.endm
ac_enable:
cbi ACSR, ACD
cbi ADCSRA, ADEN
ret
.macro m_ac_disable
rcall ac_disable
.endm
ac_disable:
sbi ACSR, ACD
ret
.macro m_ac_interrupts_enable
rcall ac_interrupts_enable
.endm
ac_interrupts_enable:
sbi ACSR, ACIE
ret
.macro m_ac_interrupts_disable
rcall ac_interrupts_disable
.endm
ac_interrupts_disable:
cbi ACSR, ACIE
ret
.macro m_ac_timer1_capture_enable
rcall ac_timer1_capture_enable
.endm
ac_timer1_capture_enable:
sbi ACSR, ACIC
ret
.macro m_ac_timer1_capture_disable
rcall ac_timer1_capture_disable
.endm
ac_timer1_capture_disable:
cbi ACSR, ACIC
ret
.macro m_ac_output_value_get
; returns:
; @0 byte comparator output value
m_save_r23_registers
rcall ac_output_value_get
mov @0, r23
m_restore_r23_registers
.endm
ac_output_value_get:
; returns:
; r23 byte comparator output value
sbis ACSR, ACO
rjmp ac_output_value_get_false
ac_output_value_get_true:
ldi r23, AC_OUTPUT_VALUE_TRUE
rjmp ac_output_value_get_end
ac_output_value_get_false:
ldi r23, AC_OUTPUT_VALUE_FALSE
ac_output_value_get_end:
ret
ac_completed_handler:
; returns:
; YL byte AC_OUTPUT_VALUE
m_save_r23_Y_Z_registers
; get current value
rcall ac_output_value_get
mov YL, r23
; get [handler]
ldi r23, ST_AC_ON_COMPLETED_HANDLER_OFFSET
ldi ZL, low(ac_static_instance)
ldi ZH, high(ac_static_instance)
; raise event
rcall device_raise_event
;
m_restore_r23_Y_Z_registers
reti |
Task/Increment-a-numerical-string/Ada/increment-a-numerical-string.ada | LaudateCorpus1/RosettaCodeData | 1 | 16403 | <reponame>LaudateCorpus1/RosettaCodeData
S : String := "12345";
S := Ada.Strings.Fixed.Trim(Source => Integer'Image(Integer'Value(S) + 1), Side => Ada.Strings.Both);
|
Cubical/Data/Queue/Base.agda | dan-iel-lee/cubical | 0 | 6937 | <reponame>dan-iel-lee/cubical
{-# OPTIONS --cubical --no-import-sorts --no-exact-split --safe #-}
module Cubical.Data.Queue.Base where
open import Cubical.Data.Queue.1List public
open import Cubical.Data.Queue.Truncated2List public
open import Cubical.Data.Queue.Untruncated2List public
|
source/directories/machine-apple-darwin/a-dirinf.adb | ytomino/drake | 33 | 3770 | <filename>source/directories/machine-apple-darwin/a-dirinf.adb
with Ada.Calendar.Naked;
with Ada.Exception_Identification.From_Here;
with Ada.Unchecked_Conversion;
with System.Address_To_Named_Access_Conversions;
with System.Growth;
with System.Native_Credentials;
with System.Zero_Terminated_Strings;
with C.errno;
with C.sys.stat;
with C.sys.types;
with C.unistd;
package body Ada.Directories.Information is
use Exception_Identification.From_Here;
use type System.Bit_Order;
use type C.size_t;
use type C.sys.types.mode_t;
use type C.sys.types.ssize_t;
subtype Directory_Entry_Information_Type is
System.Native_Directories.Directory_Entry_Information_Type;
function Named_IO_Exception_Id (errno : C.signed_int)
return Exception_Identification.Exception_Id
renames System.Native_Directories.Named_IO_Exception_Id;
package char_ptr_Conv is
new System.Address_To_Named_Access_Conversions (C.char, C.char_ptr);
procedure Fill (
Directory_Entry : aliased in out Non_Controlled_Directory_Entry_Type);
procedure Fill (
Directory_Entry : aliased in out Non_Controlled_Directory_Entry_Type) is
begin
if not Directory_Entry.Additional.Filled then
System.Native_Directories.Searching.Get_Information (
Directory_Entry.Path.all,
Directory_Entry.Directory_Entry,
Directory_Entry.Additional.Information);
Directory_Entry.Additional.Filled := True;
end if;
end Fill;
function To_Permission_Set (Mode : C.sys.types.mode_t)
return Permission_Set_Type;
function To_Permission_Set (Mode : C.sys.types.mode_t)
return Permission_Set_Type
is
Castable : constant Boolean :=
System.Default_Bit_Order = System.Low_Order_First
and then C.sys.stat.S_IXOTH = 8#001#
and then C.sys.stat.S_IWOTH = 8#002#
and then C.sys.stat.S_IROTH = 8#004#
and then C.sys.stat.S_IXGRP = 8#010#
and then C.sys.stat.S_IWGRP = 8#020#
and then C.sys.stat.S_IRGRP = 8#040#
and then C.sys.stat.S_IXUSR = 8#100#
and then C.sys.stat.S_IWUSR = 8#200#
and then C.sys.stat.S_IRUSR = 8#400#
and then C.sys.stat.S_ISVTX = 8#1000#
and then C.sys.stat.S_ISGID = 8#2000#
and then C.sys.stat.S_ISUID = 8#4000#;
begin
if Castable then
declare
type Unsigned_12 is mod 2 ** 12;
function Cast is
new Unchecked_Conversion (Unsigned_12, Permission_Set_Type);
begin
return Cast (Unsigned_12'Mod (Mode and 8#7777#));
end;
else
return (
Others_Execute => (Mode and C.sys.stat.S_IXOTH) /= 0,
Others_Write => (Mode and C.sys.stat.S_IWOTH) /= 0,
Others_Read => (Mode and C.sys.stat.S_IROTH) /= 0,
Group_Execute => (Mode and C.sys.stat.S_IXGRP) /= 0,
Group_Write => (Mode and C.sys.stat.S_IWGRP) /= 0,
Group_Read => (Mode and C.sys.stat.S_IRGRP) /= 0,
Owner_Execute => (Mode and C.sys.stat.S_IXUSR) /= 0,
Owner_Write => (Mode and C.sys.stat.S_IWUSR) /= 0,
Owner_Read => (Mode and C.sys.stat.S_IRUSR) /= 0,
Sticky => (Mode and C.sys.stat.S_ISVTX) /= 0,
Set_Group_ID => (Mode and C.sys.stat.S_ISGID) /= 0,
Set_User_ID => (Mode and C.sys.stat.S_ISUID) /= 0);
end if;
end To_Permission_Set;
function To_User_Permission_Set (Information : C.sys.stat.struct_stat)
return User_Permission_Set_Type;
function To_User_Permission_Set (Information : C.sys.stat.struct_stat)
return User_Permission_Set_Type
is
Executable : Boolean;
Writable : Boolean;
Readable : Boolean;
begin
if System.Native_Credentials.Belongs_To_Current_User (
Information.st_uid)
then
Executable := (Information.st_mode and C.sys.stat.S_IXUSR) /= 0;
Writable := (Information.st_mode and C.sys.stat.S_IWUSR) /= 0;
Readable := (Information.st_mode and C.sys.stat.S_IRUSR) /= 0;
elsif System.Native_Credentials.Belongs_To_Current_Group (
Information.st_gid)
then
Executable := (Information.st_mode and C.sys.stat.S_IXGRP) /= 0;
Writable := (Information.st_mode and C.sys.stat.S_IWGRP) /= 0;
Readable := (Information.st_mode and C.sys.stat.S_IRGRP) /= 0;
else
Executable := (Information.st_mode and C.sys.stat.S_IXOTH) /= 0;
Writable := (Information.st_mode and C.sys.stat.S_IWOTH) /= 0;
Readable := (Information.st_mode and C.sys.stat.S_IROTH) /= 0;
end if;
return (
User_Execute => Executable,
User_Write => Writable,
User_Read => Readable);
end To_User_Permission_Set;
-- implementation
function Last_Access_Time (Name : String) return Calendar.Time is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return Calendar.Naked.To_Time (Information.st_atim);
end Last_Access_Time;
function Last_Status_Change_Time (Name : String) return Calendar.Time is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return Calendar.Naked.To_Time (Information.st_ctim);
end Last_Status_Change_Time;
function Permission_Set (Name : String) return Permission_Set_Type is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return To_Permission_Set (Information.st_mode);
end Permission_Set;
function Owner (Name : String) return String is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return System.Native_Credentials.User_Name (Information.st_uid);
end Owner;
function Group (Name : String) return String is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return System.Native_Credentials.Group_Name (Information.st_gid);
end Group;
function Is_Block_Special_File (Name : String) return Boolean is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return (Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFBLK;
end Is_Block_Special_File;
function Is_Character_Special_File (Name : String) return Boolean is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return (Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFCHR;
end Is_Character_Special_File;
function Is_FIFO (Name : String) return Boolean is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return (Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFIFO;
end Is_FIFO;
function Is_Symbolic_Link (Name : String) return Boolean is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return (Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFLNK;
end Is_Symbolic_Link;
function Is_Socket (Name : String) return Boolean is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return (Information.st_mode and C.sys.stat.S_IFMT) = C.sys.stat.S_IFSOCK;
end Is_Socket;
function Last_Access_Time (
Directory_Entry : Directory_Entry_Type)
return Calendar.Time
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
Fill (NC_Directory_Entry);
return Calendar.Naked.To_Time (
NC_Directory_Entry.Additional.Information.st_atim);
end Last_Access_Time;
function Last_Status_Change_Time (
Directory_Entry : Directory_Entry_Type)
return Calendar.Time
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
Fill (NC_Directory_Entry);
return Calendar.Naked.To_Time (
NC_Directory_Entry.Additional.Information.st_ctim);
end Last_Status_Change_Time;
function Permission_Set (
Directory_Entry : Directory_Entry_Type)
return Permission_Set_Type
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
Fill (NC_Directory_Entry);
return To_Permission_Set (
NC_Directory_Entry.Additional.Information.st_mode);
end Permission_Set;
function Owner (
Directory_Entry : Directory_Entry_Type)
return String
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
Fill (NC_Directory_Entry);
return System.Native_Credentials.User_Name (
NC_Directory_Entry.Additional.Information.st_uid);
end Owner;
function Group (
Directory_Entry : Directory_Entry_Type)
return String
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
Fill (NC_Directory_Entry);
return System.Native_Credentials.Group_Name (
NC_Directory_Entry.Additional.Information.st_gid);
end Group;
function Is_Block_Special_File (
Directory_Entry : Directory_Entry_Type)
return Boolean
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
Fill (NC_Directory_Entry);
return (NC_Directory_Entry.Additional.Information.st_mode
and C.sys.stat.S_IFMT) =
C.sys.stat.S_IFBLK;
end Is_Block_Special_File;
function Is_Character_Special_File (
Directory_Entry : Directory_Entry_Type)
return Boolean
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
Fill (NC_Directory_Entry);
return (NC_Directory_Entry.Additional.Information.st_mode
and C.sys.stat.S_IFMT) =
C.sys.stat.S_IFCHR;
end Is_Character_Special_File;
function Is_FIFO (
Directory_Entry : Directory_Entry_Type)
return Boolean
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
Fill (NC_Directory_Entry);
return (NC_Directory_Entry.Additional.Information.st_mode
and C.sys.stat.S_IFMT) =
C.sys.stat.S_IFIFO;
end Is_FIFO;
function Is_Symbolic_Link (
Directory_Entry : Directory_Entry_Type)
return Boolean
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
Fill (NC_Directory_Entry);
return (NC_Directory_Entry.Additional.Information.st_mode
and C.sys.stat.S_IFMT) =
C.sys.stat.S_IFLNK;
end Is_Symbolic_Link;
function Is_Socket (
Directory_Entry : Directory_Entry_Type)
return Boolean
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
Fill (NC_Directory_Entry);
return (NC_Directory_Entry.Additional.Information.st_mode
and C.sys.stat.S_IFMT) =
C.sys.stat.S_IFSOCK;
end Is_Socket;
function Read_Symbolic_Link (Name : String) return String is
package Holder is
new System.Growth.Scoped_Holder (
C.sys.types.ssize_t,
Component_Size => C.char_array'Component_Size);
C_Name : C.char_array (
0 ..
Name'Length * System.Zero_Terminated_Strings.Expanding);
begin
Holder.Reserve_Capacity (1024);
System.Zero_Terminated_Strings.To_C (Name, C_Name (0)'Access);
loop
declare
S_Length : C.sys.types.ssize_t;
begin
S_Length :=
C.unistd.readlink (
C_Name (0)'Access,
char_ptr_Conv.To_Pointer (Holder.Storage_Address),
C.size_t (Holder.Capacity));
if S_Length < 0 then
Raise_Exception (Named_IO_Exception_Id (C.errno.errno));
end if;
if S_Length < Holder.Capacity then
return System.Zero_Terminated_Strings.Value (
char_ptr_Conv.To_Pointer (Holder.Storage_Address),
C.size_t (S_Length));
end if;
end;
-- growth
declare
function Grow is new System.Growth.Fast_Grow (C.sys.types.ssize_t);
begin
Holder.Reserve_Capacity (Grow (Holder.Capacity));
end;
end loop;
end Read_Symbolic_Link;
function Read_Symbolic_Link (
Directory_Entry : Directory_Entry_Type)
return String is
begin
return Read_Symbolic_Link (
Full_Name (Directory_Entry)); -- checking the predicate
end Read_Symbolic_Link;
function User_Permission_Set (Name : String)
return User_Permission_Set_Type
is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return To_User_Permission_Set (Information);
end User_Permission_Set;
function User_Permission_Set (
Directory_Entry : Directory_Entry_Type)
return User_Permission_Set_Type
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
Fill (NC_Directory_Entry);
return To_User_Permission_Set (
NC_Directory_Entry.Additional.Information);
end User_Permission_Set;
function Identity (Name : String) return File_Id is
Information : aliased Directory_Entry_Information_Type;
begin
System.Native_Directories.Get_Information (Name, Information);
return File_Id (Information.st_ino);
end Identity;
function Identity (
Directory_Entry : Directory_Entry_Type)
return File_Id
is
pragma Check (Dynamic_Predicate,
Check => Is_Assigned (Directory_Entry) or else raise Status_Error);
NC_Directory_Entry : Non_Controlled_Directory_Entry_Type
renames Controlled_Entries.Reference (Directory_Entry).all;
begin
return File_Id (NC_Directory_Entry.Directory_Entry.d_ino);
end Identity;
end Ada.Directories.Information;
|
oeis/040/A040855.asm | neoneye/loda-programs | 11 | 91237 | ; A040855: Continued fraction for sqrt(885).
; Submitted by <NAME>(s3)
; 29,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1,58,1,2,1
gcd $0,262156
mul $0,42
mod $0,13
add $0,3
mov $1,$0
div $0,3
div $1,5
mul $1,27
add $0,$1
sub $0,28
|
alloy4fun_models/trashltl/models/11/Qc2Wa6jhoPKpNoK4z.als | Kaixi26/org.alloytools.alloy | 0 | 1165 | open main
pred idQc2Wa6jhoPKpNoK4z_prop12 {
eventually all f:File | f in Trash implies f in Trash
}
pred __repair { idQc2Wa6jhoPKpNoK4z_prop12 }
check __repair { idQc2Wa6jhoPKpNoK4z_prop12 <=> prop12o } |
src_test/tests/test.asm | hgunicamp/Mips8B | 0 | 27377 | <gh_stars>0
add $0 $1 $2
sub $3 $4 $5
and $6 $7 $0
or $1 $2 $3
slt $4 $5 $6
addi $7 $0 1
beq $5 $6 7
lb $0 $1 2
sb $3 $4 5
j 67
|
Definition/LogicalRelation/Substitution/Introductions/Cast.agda | CoqHott/logrel-mltt | 2 | 1024 | <gh_stars>1-10
{-# OPTIONS --safe #-}
open import Definition.Typed.EqualityRelation
module Definition.LogicalRelation.Substitution.Introductions.Cast {{eqrel : EqRelSet}} where
open EqRelSet {{...}}
open import Definition.Untyped
open import Definition.Untyped.Properties
open import Definition.Typed
open import Definition.Typed.Properties
import Definition.Typed.Weakening as Twk
open import Definition.Typed.EqualityRelation
open import Definition.Typed.RedSteps
open import Definition.LogicalRelation
open import Definition.LogicalRelation.Irrelevance
open import Definition.LogicalRelation.Properties
open import Definition.LogicalRelation.Application
open import Definition.LogicalRelation.Substitution
import Definition.LogicalRelation.Weakening as Lwk
open import Definition.LogicalRelation.Substitution.Properties
import Definition.LogicalRelation.Substitution.Irrelevance as S
open import Definition.LogicalRelation.Substitution.Reflexivity
open import Definition.LogicalRelation.Substitution.Weakening
-- open import Definition.LogicalRelation.Substitution.Introductions.Nat
open import Definition.LogicalRelation.Substitution.Introductions.Empty
open import Definition.LogicalRelation.ShapeView
-- open import Definition.LogicalRelation.Substitution.Introductions.Pi
-- open import Definition.LogicalRelation.Substitution.Introductions.SingleSubst
open import Definition.LogicalRelation.Substitution.Introductions.Universe
open import Definition.LogicalRelation.Substitution.MaybeEmbed
open import Definition.LogicalRelation.Substitution.Introductions.Castlemmas
open import Tools.Product
open import Tools.Empty using (⊥; ⊥-elim)
import Tools.Unit as TU
import Tools.PropositionalEquality as PE
import Data.Nat as Nat
~-irrelevanceTerm : ∀ {t t' u u' A A' r Γ} (eqA : A PE.≡ A') (eqt : t PE.≡ t') (equ : u PE.≡ u')
→ Γ ⊢ t ~ u ∷ A ^ r
→ Γ ⊢ t' ~ u' ∷ A' ^ r
~-irrelevanceTerm PE.refl PE.refl PE.refl X = X
[cast]irr : ∀ {A B Γ}
(⊢Γ : ⊢ Γ)
([A] : Γ ⊩⟨ ι ⁰ ⟩ A ^ [ % , ι ⁰ ])
([B] : Γ ⊩⟨ ι ⁰ ⟩ B ^ [ % , ι ⁰ ]) →
∀ {t e} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ % , ι ⁰ ] / [A]) → (⊢e : Γ ⊢ e ∷ Id (Univ % ⁰) A B ^ [ % , ι ¹ ]) →
Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ∷ B ^ [ % , ι ⁰ ] / [B]
[cast]irr {A} {B} ⊢Γ [A] [B] {t} {e} [t] ⊢e =
let ⊢A = escape {l = ι ⁰} {A = A} [A]
⊢B = escape {l = ι ⁰} {A = B} [B]
⊢t = escapeTerm {l = ι ⁰} {A = A} [A] [t]
in logRelIrr [B] (castⱼ (un-univ ⊢A) (un-univ ⊢B) ⊢e ⊢t)
[castext]irr : ∀ {A A′ B B′ Γ}
(⊢Γ : ⊢ Γ)
([A] : Γ ⊩⟨ ι ⁰ ⟩ A ^ [ % , ι ⁰ ])
([A′] : Γ ⊩⟨ ι ⁰ ⟩ A′ ^ [ % , ι ⁰ ])
([A≡A′] : Γ ⊩⟨ ι ⁰ ⟩ A ≡ A′ ^ [ % , ι ⁰ ] / [A])
([B] : Γ ⊩⟨ ι ⁰ ⟩ B ^ [ % , ι ⁰ ])
([B′] : Γ ⊩⟨ ι ⁰ ⟩ B′ ^ [ % , ι ⁰ ])
([B≡B′] : Γ ⊩⟨ ι ⁰ ⟩ B ≡ B′ ^ [ % , ι ⁰ ] / [B])
→ (∀ {t t′ e e′} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ % , ι ⁰ ] / [A])
→ ([t′] : Γ ⊩⟨ ι ⁰ ⟩ t′ ∷ A′ ^ [ % , ι ⁰ ] / [A′])
→ ([t≡t′] : Γ ⊩⟨ ι ⁰ ⟩ t ≡ t′ ∷ A ^ [ % , ι ⁰ ] / [A])
→ (⊢e : Γ ⊢ e ∷ Id (Univ % ⁰) A B ^ [ % , ι ¹ ])
→ (⊢e′ : Γ ⊢ e′ ∷ Id (Univ % ⁰) A′ B′ ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ≡ cast ⁰ A′ B′ e′ t′ ∷ B ^ [ % , ι ⁰ ] / [B])
[castext]irr {A} {A′} {B} {B′} ⊢Γ [A] [A′] [A≡A′] [B] [B′] [B≡B′] [t] [t′] [t≡t′] ⊢e ⊢e′ =
let ⊢A = escape {l = ι ⁰} {A = A} [A]
⊢B = escape {l = ι ⁰} {A = B} [B]
⊢A′ = escape {l = ι ⁰} {A = A′} [A′]
⊢B′ = escape {l = ι ⁰} {A = B′} [B′]
⊢t = escapeTerm {l = ι ⁰} {A = A} [A] [t]
⊢t′ = escapeTerm {l = ι ⁰} {A = A′} [A′] [t′]
in logRelIrrEq [B] (castⱼ (un-univ ⊢A) (un-univ ⊢B) ⊢e ⊢t) (conv (castⱼ (un-univ ⊢A′) (un-univ ⊢B′) ⊢e′ ⊢t′) (sym (≅-eq (escapeEq [B] [B≡B′]))))
[cast]Ne : ∀ {A B Γ}
(⊢Γ : ⊢ Γ)
([A] : Γ ⊩ne A ^[ ! , ⁰ ])
([B] : Γ ⊩⟨ ι ⁰ ⟩ B ^ [ ! , ι ⁰ ]) →
∀ {t e} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ ! , ι ⁰ ] / ne [A]) → (⊢e : Γ ⊢ e ∷ Id (Univ ! ⁰) A B ^ [ % , ι ¹ ]) →
Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ∷ B ^ [ ! , ι ⁰ ] / [B]
[cast]Ne {A} {B} ⊢Γ (ne K D neK K≡K) [B] {t} {e} [t] ⊢e =
let [[ ⊢A , ⊢K , DK ]] = D
⊢A≡K = subset* DK
⊢B = escape {l = ι ⁰} [B]
B≅B = ≅-un-univ (escapeEq {l = ι ⁰} [B] (reflEq {l = ι ⁰} [B]))
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) (un-univ≡ ⊢A≡K) (refl (un-univ ⊢B))))
cast~cast = ~-cast K≡K B≅B (≅-conv (escapeTermEq {l = ι ⁰} {A = A} (ne′ K D neK K≡K) (reflEqTerm {l = ι ⁰} (ne′ K D neK K≡K) [t])) ⊢A≡K) ⊢e' ⊢e'
in neuTerm:⇒*: {t = cast ⁰ A B e t} [B] (castₙ neK) (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (ne′ K D neK K≡K) [t]) (un-univ:⇒*: D)) cast~cast
[castext]Ne : ∀ {A A′ B B′ Γ}
(⊢Γ : ⊢ Γ)
([A] : Γ ⊩ne A ^[ ! , ⁰ ])
([A′] : Γ ⊩ne A′ ^[ ! , ⁰ ])
([A≡A′] : Γ ⊩⟨ ι ⁰ ⟩ A ≡ A′ ^ [ ! , ι ⁰ ] / ne [A])
([B] : Γ ⊩⟨ ι ⁰ ⟩ B ^ [ ! , ι ⁰ ])
([B′] : Γ ⊩⟨ ι ⁰ ⟩ B′ ^ [ ! , ι ⁰ ])
([B≡B′] : Γ ⊩⟨ ι ⁰ ⟩ B ≡ B′ ^ [ ! , ι ⁰ ] / [B])
→ (∀ {t t′ e e′} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ ! , ι ⁰ ] / ne [A])
→ ([t′] : Γ ⊩⟨ ι ⁰ ⟩ t′ ∷ A′ ^ [ ! , ι ⁰ ] / ne [A′])
→ ([t≡t′] : Γ ⊩⟨ ι ⁰ ⟩ t ≡ t′ ∷ A ^ [ ! , ι ⁰ ] / ne [A])
→ (⊢e : Γ ⊢ e ∷ Id (U ⁰) A B ^ [ % , ι ¹ ])
→ (⊢e′ : Γ ⊢ e′ ∷ Id (U ⁰) A′ B′ ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ≡ cast ⁰ A′ B′ e′ t′ ∷ B ^ [ ! , ι ⁰ ] / [B])
[castext]Ne {A} {A′} {B} {B′} ⊢Γ (ne K D neK K≡K) (ne K′ D′ neK′ K′≡K′) (ne₌ M D′′ neM K≡M) [B] [B′] [B≡B′] [t] [t′] [t≡t′] ⊢e ⊢e′ =
let [A] = ne K D neK K≡K
[A′] = ne K′ D′ neK′ K′≡K′
[[ ⊢A , ⊢K , DK ]] = D
⊢A≡K = subset* DK
[[ _ , _ , DM ]] = D′′
⊢A'≡M = subset* DM
⊢A = escape {l = ι ⁰} {A = A} (ne [A])
⊢B = escape {l = ι ⁰} {A = B} [B]
⊢A′ = escape {l = ι ⁰} {A = A′} (ne [A′])
⊢B′ = escape {l = ι ⁰} {A = B′} [B′]
⊢t = escapeTerm {l = ι ⁰} {A = A} (ne [A]) [t]
⊢t′ = escapeTerm {l = ι ⁰} {A = A′} (ne [A′]) [t′]
t≅t′ = escapeTermEq {l = ι ⁰} {A = A} (ne [A]) [t≡t′]
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) (un-univ≡ ⊢A≡K) (refl (un-univ ⊢B))))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) (un-univ≡ ⊢A'≡M) (refl (un-univ ⊢B′))))
in neuEqTerm:⇒*: [B] (castₙ neK) (castₙ neM)
(CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (ne [A]) [t]) (un-univ:⇒*: D))
(conv:⇒*: (CastRed*Term ⊢B′ ⊢e′ (escapeTerm {l = ι ⁰} (ne [A′]) [t′]) (un-univ:⇒*: D′′)) (sym (≅-eq (escapeEq [B] [B≡B′]))))
(~-cast K≡M (≅-un-univ (escapeEq [B] [B≡B′])) (≅-conv t≅t′ (subset* (red D))) ⊢e' ⊢e′')
[cast]ℕ : ∀ {A B Γ}
(⊢Γ : ⊢ Γ)
([A] : Γ ⊩ℕ A)
([B] : Γ ⊩ℕ B) →
∀ {t e} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ ! , ι ⁰ ] / ℕᵣ [A]) → (⊢e : Γ ⊢ e ∷ Id (Univ ! ⁰) A B ^ [ % , ι ¹ ]) →
Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ∷ B ^ [ ! , ι ⁰ ] / ℕᵣ [B]
[cast]ℕ {A} {B} ⊢Γ [[ ⊢A , ⊢ℕ , D ]] [[ ⊢B , ⊢ℕ' , D' ]] {t} {e} (ℕₜ .(suc _) d n≡n (sucᵣ {a} x)) ⊢e =
let ⊢t = escapeTerm {l = ι ⁰} (ℕᵣ [[ ⊢A , ⊢ℕ , D ]]) (ℕₜ (suc a) d n≡n (sucᵣ x))
[N] = idRed:*: (univ (ℕⱼ ⊢Γ))
⊢eℕℕ = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* D)) (un-univ≡ (subset* D'))))
⊢eℕB = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* D)) (refl (un-univ ⊢B))))
rec = [cast]ℕ ⊢Γ (idRed:*: ⊢ℕ) (idRed:*: ⊢ℕ) x ⊢eℕℕ
cast≅cast = escapeTermEq {l = ι ⁰} (ℕᵣ (idRed:*: ⊢ℕ)) (reflEqTerm {l = ι ⁰} (ℕᵣ (idRed:*: ⊢ℕ)) rec)
in ℕₜ (suc (cast ⁰ ℕ ℕ e a)) ((conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (ℕᵣ [[ ⊢A , ⊢ℕ , D ]]) (ℕₜ (suc a) d n≡n (sucᵣ x))) (un-univ:⇒*: [[ ⊢A , ⊢ℕ , D ]]))
(transTerm:⇒:* (CastRed*Termℕ ⊢eℕB (conv ⊢t (subset* D)) [[ ⊢B , ⊢ℕ' , D' ]])
(conv:⇒*: (transTerm:⇒:* (CastRed*Termℕℕ ⊢eℕℕ d)
(CastRed*Termℕsuc ⊢eℕℕ (escapeTerm {l = ι ⁰} (ℕᵣ (idRed:*: ⊢ℕ)) x))) (sym (subset* D'))))) (subset* D') ))
(≅-suc-cong cast≅cast) (Natural-prop.sucᵣ rec)
[cast]ℕ {A} {B} ⊢Γ [[ ⊢A , ⊢ℕ , D ]] [[ ⊢B , ⊢ℕ' , D' ]] {t} {e} (ℕₜ .zero d n≡n zeroᵣ) ⊢e =
let ⊢t = escapeTerm {l = ι ⁰} (ℕᵣ [[ ⊢A , ⊢ℕ , D ]]) (ℕₜ zero d n≡n zeroᵣ)
⊢eℕℕ = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* D)) (un-univ≡ (subset* D'))))
in ℕₜ zero ((conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (ℕᵣ [[ ⊢A , ⊢ℕ , D ]]) (ℕₜ zero d n≡n zeroᵣ)) (un-univ:⇒*: [[ ⊢A , ⊢ℕ , D ]]))
(transTerm:⇒:* (CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* D))
(refl (un-univ ⊢B))))) (conv ⊢t (subset* D)) [[ ⊢B , ⊢ℕ' , D' ]])
(conv:⇒*: (transTerm:⇒:* (CastRed*Termℕℕ ⊢eℕℕ d)
(CastRed*Termℕzero ⊢eℕℕ)) (sym (subset* D'))))) (subset* D') ))
(≅ₜ-zerorefl ⊢Γ) Natural-prop.zeroᵣ
[cast]ℕ {A} {B} ⊢Γ [[ ⊢A , ⊢ℕ , D ]] [[ ⊢B , ⊢ℕ' , D' ]] {t} {e} (ℕₜ n d n≡n (ne x)) ⊢e =
let ⊢t = escapeTerm {l = ι ⁰} (ℕᵣ [[ ⊢A , ⊢ℕ , D ]]) (ℕₜ n d n≡n (ne x))
⊢eℕℕ = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* D)) (un-univ≡ (subset* D'))))
neNfₜ nen ⊢n n~n = x
in ℕₜ (cast ⁰ ℕ ℕ e n) ((conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (ℕᵣ [[ ⊢A , ⊢ℕ , D ]]) (ℕₜ n d n≡n (ne x))) (un-univ:⇒*: [[ ⊢A , ⊢ℕ , D ]]))
(transTerm:⇒:* (CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* D))
(refl (un-univ ⊢B))))) (conv ⊢t (subset* D)) [[ ⊢B , ⊢ℕ' , D' ]])
(conv:⇒*: (CastRed*Termℕℕ ⊢eℕℕ d) (sym (subset* D'))))) (subset* D') ))
(~-to-≅ₜ (~-castℕℕ (wfTerm ⊢n) n~n ⊢eℕℕ ⊢eℕℕ)) (ne (neNfₜ (castℕℕₙ nen) (castⱼ (ℕⱼ (wfTerm ⊢n)) (ℕⱼ (wfTerm ⊢n)) ⊢eℕℕ ⊢n) (~-castℕℕ (wfTerm ⊢n) n~n ⊢eℕℕ ⊢eℕℕ)))
[castext]ℕ : ∀ {A A' B B' Γ}
(⊢Γ : ⊢ Γ)
([A] : Γ ⊩ℕ A)
([A'] : Γ ⊩ℕ A')
([A≡A′] : Γ ⊩⟨ ι ⁰ ⟩ A ≡ A' ^ [ ! , ι ⁰ ] / ℕᵣ [A])
([B] : Γ ⊩ℕ B)
([B'] : Γ ⊩ℕ B')
([B≡B′] : Γ ⊩⟨ ι ⁰ ⟩ B ≡ B' ^ [ ! , ι ⁰ ] / ℕᵣ [B]) →
∀ {t t' e e' } → (⊢t : Γ ⊢ t ∷ A ^ [ ! , ι ⁰ ])
→ (⊢t′ : Γ ⊢ t' ∷ A' ^ [ ! , ι ⁰ ])
→ ([t≡t′] : Γ ⊩⟨ ι ⁰ ⟩ t ≡ t' ∷ A ^ [ ! , ι ⁰ ] / ℕᵣ [A])
→ (⊢e : Γ ⊢ e ∷ Id (U ⁰) A B ^ [ % , ι ¹ ])
→ (⊢e′ : Γ ⊢ e' ∷ Id (U ⁰) A' B' ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ≡ cast ⁰ A' B' e' t' ∷ B ^ [ ! , ι ⁰ ] / ℕᵣ [B]
[castext]ℕ ⊢Γ [[ ⊢A , ⊢ℕA , DA ]] [[ ⊢A' , ⊢ℕA' , DA' ]] [A≡A′] [[ ⊢B , ⊢ℕB , DB ]] [[ ⊢B' , ⊢ℕB' , DB' ]] [B≡B′] {t} {t'} {e} {e'} ⊢t ⊢t′
(ℕₜ₌ .(suc a) .(suc a') d d′ k≡k′ (sucᵣ {a} {a'} (ℕₜ₌ k k′ [[ ⊢a , ⊢u , d₁ ]] [[ ⊢a' , ⊢u₁ , d₂ ]] k≡k′₁ prop))) ⊢e ⊢e′ =
let ⊢eℕℕ = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* DA)) (un-univ≡ (subset* DB))))
⊢eℕℕ' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢B') )) (un-univ≡ (subset* DA')) (un-univ≡ (subset* DB'))))
⊢B≡B′ = escapeEq {l = ι ⁰} (ℕᵣ [[ ⊢B , ⊢ℕB , DB ]]) [B≡B′]
rec = [castext]ℕ ⊢Γ (idRed:*: ⊢ℕA) (idRed:*: ⊢ℕA) (reflEq {l = ι ⁰} (ℕᵣ (idRed:*: ⊢ℕA))) (idRed:*: ⊢ℕA) (idRed:*: ⊢ℕA) (reflEq {l = ι ⁰} (ℕᵣ (idRed:*: ⊢ℕA)))
⊢a ⊢a' (ℕₜ₌ k k′ [[ ⊢a , ⊢u , d₁ ]] [[ ⊢a' , ⊢u₁ , d₂ ]] k≡k′₁ prop) ⊢eℕℕ ⊢eℕℕ'
cast≅cast = escapeTermEq {l = ι ⁰} (ℕᵣ (idRed:*: ⊢ℕA)) rec
in ℕₜ₌ (suc (cast ⁰ ℕ ℕ e a)) (suc (cast ⁰ ℕ ℕ e' a'))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢B ⊢e ⊢t (un-univ:⇒*: [[ ⊢A , ⊢ℕA , DA ]]))
(transTerm:⇒:* (CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* DA))
(refl (un-univ ⊢B))))) (conv ⊢t (subset* DA)) [[ ⊢B , ⊢ℕB , DB ]])
(conv:⇒*: (transTerm:⇒:* (CastRed*Termℕℕ ⊢eℕℕ d)
(CastRed*Termℕsuc ⊢eℕℕ ⊢a)) (sym (subset* DB))))) (subset* DB))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢B' ⊢e′ ⊢t′ (un-univ:⇒*: [[ ⊢A' , ⊢ℕA' , DA' ]]))
(transTerm:⇒:* (CastRed*Termℕ (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* DA'))
(refl (un-univ ⊢B'))))) (conv ⊢t′ (subset* DA')) [[ ⊢B' , ⊢ℕB' , DB' ]])
(conv:⇒*: (transTerm:⇒:* (CastRed*Termℕℕ ⊢eℕℕ' d′)
(CastRed*Termℕsuc ⊢eℕℕ' ⊢a')) (sym (subset* DB'))))) (subset* DB'))
(≅-suc-cong cast≅cast) (sucᵣ rec)
[castext]ℕ ⊢Γ [[ ⊢A , ⊢ℕA , DA ]] [[ ⊢A' , ⊢ℕA' , DA' ]] [A≡A′] [[ ⊢B , ⊢ℕB , DB ]] [[ ⊢B' , ⊢ℕB' , DB' ]] [B≡B′] ⊢t ⊢t′ (ℕₜ₌ .zero .zero d d′ k≡k′ zeroᵣ) ⊢e ⊢e′ =
let ⊢eℕℕ = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* DA)) (un-univ≡ (subset* DB))))
⊢eℕℕ' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢B') )) (un-univ≡ (subset* DA')) (un-univ≡ (subset* DB'))))
⊢B≡B′ = escapeEq {l = ι ⁰} (ℕᵣ [[ ⊢B , ⊢ℕB , DB ]]) [B≡B′]
in ℕₜ₌ zero zero
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢B ⊢e ⊢t (un-univ:⇒*: [[ ⊢A , ⊢ℕA , DA ]]))
(transTerm:⇒:* (CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* DA))
(refl (un-univ ⊢B))))) (conv ⊢t (subset* DA)) [[ ⊢B , ⊢ℕB , DB ]])
(conv:⇒*: (transTerm:⇒:* (CastRed*Termℕℕ ⊢eℕℕ d)
(CastRed*Termℕzero ⊢eℕℕ)) (sym (subset* DB))))) (subset* DB))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢B' ⊢e′ ⊢t′ (un-univ:⇒*: [[ ⊢A' , ⊢ℕA' , DA' ]]))
(transTerm:⇒:* (CastRed*Termℕ (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* DA'))
(refl (un-univ ⊢B'))))) (conv ⊢t′ (subset* DA')) [[ ⊢B' , ⊢ℕB' , DB' ]])
(conv:⇒*: (transTerm:⇒:* (CastRed*Termℕℕ ⊢eℕℕ' d′)
(CastRed*Termℕzero ⊢eℕℕ')) (sym (subset* DB'))))) (subset* DB'))
(≅ₜ-zerorefl ⊢Γ) zeroᵣ
[castext]ℕ ⊢Γ [[ ⊢A , ⊢ℕA , DA ]] [[ ⊢A' , ⊢ℕA' , DA' ]] [A≡A′] [[ ⊢B , ⊢ℕB , DB ]] [[ ⊢B' , ⊢ℕB' , DB' ]] [B≡B′] ⊢t ⊢t′ (ℕₜ₌ k k′ d d′ k≡k′ (ne (neNfₜ₌ neK neM k≡m))) ⊢e ⊢e′ =
let ⊢eℕℕ = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ (subset* DA)) (un-univ≡ (subset* DB))))
⊢eℕℕ' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢B') )) (un-univ≡ (subset* DA')) (un-univ≡ (subset* DB'))))
⊢B≡B′ = escapeEq {l = ι ⁰} (ℕᵣ [[ ⊢B , ⊢ℕB , DB ]]) [B≡B′]
in neuEqTerm:⇒*: {l = ι ⁰} (ℕᵣ [[ ⊢B , ⊢ℕB , DB ]]) (castℕℕₙ neK) (castℕℕₙ neM)
(transTerm:⇒:* (CastRed*Term ⊢B ⊢e ⊢t (un-univ:⇒*: [[ ⊢A , ⊢ℕA , DA ]]))
(transTerm:⇒:* (CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) ))(un-univ≡ (subset* DA))
(refl (un-univ ⊢B))))) (conv ⊢t (subset* DA)) [[ ⊢B , ⊢ℕB , DB ]])
(conv:⇒*: (CastRed*Termℕℕ ⊢eℕℕ d) (sym (subset* DB)))))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢B' ⊢e′ ⊢t′ (un-univ:⇒*: [[ ⊢A' , ⊢ℕA' , DA' ]]))
(transTerm:⇒:* (CastRed*Termℕ (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢B') ))(un-univ≡ (subset* DA'))
(refl (un-univ ⊢B'))))) (conv ⊢t′ (subset* DA')) [[ ⊢B' , ⊢ℕB' , DB' ]])
(conv:⇒*: (CastRed*Termℕℕ ⊢eℕℕ' d′) (sym (subset* DB'))))) (sym (≅-eq ⊢B≡B′)))
(~-conv (~-castℕℕ ⊢Γ k≡m ⊢eℕℕ ⊢eℕℕ') (sym (subset* DB)))
[cast] : ∀ {A B Γ r}
(⊢Γ : ⊢ Γ)
([A] : Γ ⊩⟨ ι ⁰ ⟩ A ^ [ r , ι ⁰ ])
([B] : Γ ⊩⟨ ι ⁰ ⟩ B ^ [ r , ι ⁰ ])
→ (∀ {t e} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ r , ι ⁰ ] / [A]) → (⊢e : Γ ⊢ e ∷ Id (Univ r ⁰) A B ^ [ % , ι ¹ ]) → Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ∷ B ^ [ r , ι ⁰ ] / [B])
× (∀ {t e} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ B ^ [ r , ι ⁰ ] / [B]) → (⊢e : Γ ⊢ e ∷ Id (Univ r ⁰) B A ^ [ % , ι ¹ ]) → Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ B A e t ∷ A ^ [ r , ι ⁰ ] / [A])
[castext] : ∀ {A A′ B B′ Γ r}
(⊢Γ : ⊢ Γ)
([A] : Γ ⊩⟨ ι ⁰ ⟩ A ^ [ r , ι ⁰ ])
([A′] : Γ ⊩⟨ ι ⁰ ⟩ A′ ^ [ r , ι ⁰ ])
([A≡A′] : Γ ⊩⟨ ι ⁰ ⟩ A ≡ A′ ^ [ r , ι ⁰ ] / [A])
([B] : Γ ⊩⟨ ι ⁰ ⟩ B ^ [ r , ι ⁰ ])
([B′] : Γ ⊩⟨ ι ⁰ ⟩ B′ ^ [ r , ι ⁰ ])
([B≡B′] : Γ ⊩⟨ ι ⁰ ⟩ B ≡ B′ ^ [ r , ι ⁰ ] / [B])
→ (∀ {t t′ e e′} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ r , ι ⁰ ] / [A])
→ ([t′] : Γ ⊩⟨ ι ⁰ ⟩ t′ ∷ A′ ^ [ r , ι ⁰ ] / [A′])
→ ([t≡t′] : Γ ⊩⟨ ι ⁰ ⟩ t ≡ t′ ∷ A ^ [ r , ι ⁰ ] / [A])
→ (⊢e : Γ ⊢ e ∷ Id (Univ r ⁰) A B ^ [ % , ι ¹ ])
→ (⊢e′ : Γ ⊢ e′ ∷ Id (Univ r ⁰) A′ B′ ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ≡ cast ⁰ A′ B′ e′ t′ ∷ B ^ [ r , ι ⁰ ] / [B])
× (∀ {t t′ e e′} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ B ^ [ r , ι ⁰ ] / [B])
→ ([t′] : Γ ⊩⟨ ι ⁰ ⟩ t′ ∷ B′ ^ [ r , ι ⁰ ] / [B′])
→ ([t≡t′] : Γ ⊩⟨ ι ⁰ ⟩ t ≡ t′ ∷ B ^ [ r , ι ⁰ ] / [B])
→ (⊢e : Γ ⊢ e ∷ Id (Univ r ⁰) B A ^ [ % , ι ¹ ])
→ (⊢e′ : Γ ⊢ e′ ∷ Id (Univ r ⁰) B′ A′ ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ B A e t ≡ cast ⁰ B′ A′ e′ t′ ∷ A ^ [ r , ι ⁰ ] / [A])
[castextShape] : ∀ {A A′ B B′ Γ r}
(⊢Γ : ⊢ Γ)
([A] : Γ ⊩⟨ ι ⁰ ⟩ A ^ [ r , ι ⁰ ])
([A′] : Γ ⊩⟨ ι ⁰ ⟩ A′ ^ [ r , ι ⁰ ])
(ShapeA : ShapeView Γ (ι ⁰) (ι ⁰) A A′ [ r , ι ⁰ ] [ r , ι ⁰ ] [A] [A′])
([A≡A′] : Γ ⊩⟨ ι ⁰ ⟩ A ≡ A′ ^ [ r , ι ⁰ ] / [A])
([B] : Γ ⊩⟨ ι ⁰ ⟩ B ^ [ r , ι ⁰ ])
([B′] : Γ ⊩⟨ ι ⁰ ⟩ B′ ^ [ r , ι ⁰ ])
(ShapeB : ShapeView Γ (ι ⁰) (ι ⁰) B B′ [ r , ι ⁰ ] [ r , ι ⁰ ] [B] [B′])
([B≡B′] : Γ ⊩⟨ ι ⁰ ⟩ B ≡ B′ ^ [ r , ι ⁰ ] / [B])
→ (∀ {t t′ e e′} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ r , ι ⁰ ] / [A])
→ ([t′] : Γ ⊩⟨ ι ⁰ ⟩ t′ ∷ A′ ^ [ r , ι ⁰ ] / [A′])
→ ([t≡t′] : Γ ⊩⟨ ι ⁰ ⟩ t ≡ t′ ∷ A ^ [ r , ι ⁰ ] / [A])
→ (⊢e : Γ ⊢ e ∷ Id (Univ r ⁰) A B ^ [ % , ι ¹ ])
→ (⊢e′ : Γ ⊢ e′ ∷ Id (Univ r ⁰) A′ B′ ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ≡ cast ⁰ A′ B′ e′ t′ ∷ B ^ [ r , ι ⁰ ] / [B])
× (∀ {t t′ e e′} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ B ^ [ r , ι ⁰ ] / [B])
→ ([t′] : Γ ⊩⟨ ι ⁰ ⟩ t′ ∷ B′ ^ [ r , ι ⁰ ] / [B′])
→ ([t≡t′] : Γ ⊩⟨ ι ⁰ ⟩ t ≡ t′ ∷ B ^ [ r , ι ⁰ ] / [B])
→ (⊢e : Γ ⊢ e ∷ Id (Univ r ⁰) B A ^ [ % , ι ¹ ])
→ (⊢e′ : Γ ⊢ e′ ∷ Id (Univ r ⁰) B′ A′ ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ B A e t ≡ cast ⁰ B′ A′ e′ t′ ∷ A ^ [ r , ι ⁰ ] / [A])
[cast] ⊢Γ (ℕᵣ x) (ℕᵣ x₁) = (λ [t] ⊢e → [cast]ℕ ⊢Γ x x₁ [t] ⊢e) , (λ [t] ⊢e → [cast]ℕ ⊢Γ x₁ x [t] ⊢e)
[cast] {A} {B} ⊢Γ (ℕᵣ x) (ne′ K [[ ⊢B , ⊢K , D ]] neK K≡K) =
(λ {t} {e} [t] ⊢e → let ⊢A≡ℕ = let [[ _ , _ , Dx ]] = x in un-univ≡ (subset* Dx)
⊢B≡K = un-univ≡ (subset* D)
⊢A≡ℕ' = let [[ _ , _ , Dx ]] = x in subset* Dx
⊢t = conv (escapeTerm {l = ι ⁰} (ℕᵣ x) [t]) ⊢A≡ℕ'
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) ⊢A≡ℕ ⊢B≡K))
in neₜ (cast ⁰ ℕ K e t)
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (ℕᵣ x) [t]) (un-univ:⇒*: x))
(CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) ⊢A≡ℕ
(refl (un-univ ⊢B))))) ⊢t [[ ⊢B , ⊢K , D ]])) (subset* D) )
(neNfₜ (castℕₙ neK) (castⱼ (ℕⱼ (wf ⊢B)) (un-univ ⊢K) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) ))
⊢A≡ℕ (un-univ≡ (subset* D)))))
⊢t)
(~-castℕ (wf ⊢B) K≡K (≅-conv (escapeTermEq {l = ι ⁰} {A = A} (ℕᵣ x) (reflEqTerm {l = ι ⁰} (ℕᵣ x) [t])) ⊢A≡ℕ' ) ⊢e' ⊢e'))) ,
λ {t} {e} [t] ⊢e → [cast]Ne ⊢Γ (ne K [[ ⊢B , ⊢K , D ]] neK K≡K) (ℕᵣ x) [t] ⊢e
[cast] {A} {B} {r = .!} ⊢Γ (ℕᵣ x) (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , D ]] ⊢F ⊢G B≡B [F] [G] G-ext) =
(λ {t} {e} [t] ⊢e →
let ⊢A≡ℕ = let [[ _ , _ , Dx ]] = x in un-univ≡ (subset* (red x))
⊢A≡ℕ' = let [[ _ , _ , Dx ]] = x in subset* (red x)
⊢B≡Π = un-univ≡ (subset* D)
⊢t = conv (escapeTerm {l = ι ⁰} (ℕᵣ x) [t]) ⊢A≡ℕ'
t≅t = ≅-conv (escapeTermEq {l = ι ⁰} {A = A} (ℕᵣ x) (reflEqTerm {l = ι ⁰} (ℕᵣ x) [t])) ⊢A≡ℕ'
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) ⊢A≡ℕ ⊢B≡Π))
cast~cast = ~-castℕΠ (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ B≡B) t≅t ⊢e' ⊢e'
in neuTerm:⇒*: {t = cast ⁰ A B e t} (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , D ]] ⊢F ⊢G B≡B [F] [G] G-ext)
castℕΠₙ (transTerm:⇒:* (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (ℕᵣ x) [t]) (un-univ:⇒*: x))
(CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) ⊢A≡ℕ
(refl (un-univ ⊢B))))) ⊢t [[ ⊢B , ⊢Π , D ]])) (~-conv cast~cast (sym (subset* D)))) ,
λ {t} {e} [t] ⊢e →
let ⊢B≡Π = un-univ≡ (subset* D)
⊢B≡Π' = subset* D
[[ ⊢A , ⊢N , Dx ]] = x
⊢A≡ℕ = subset* Dx
⊢t' = escapeTerm {l = ι ⁰} {A = B} (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , D ]] ⊢F ⊢G B≡B [F] [G] G-ext) [t]
⊢t = conv {B = (Π F ^ rF ° ⁰ ▹ G ° ⁰ ° ⁰)} ⊢t' ⊢B≡Π'
t≅t = ≅-conv (escapeTermEq {l = ι ⁰} {A = B} (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , D ]] ⊢F ⊢G B≡B [F] [G] G-ext)
(reflEqTerm {l = ι ⁰} (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , D ]] ⊢F ⊢G B≡B [F] [G] G-ext) [t])) ⊢B≡Π'
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) ⊢B≡Π (un-univ≡ ⊢A≡ℕ)))
cast~cast = ~-castΠℕ (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ B≡B) t≅t ⊢e' ⊢e'
in neuTerm:⇒*: {l = ∞} (ℕᵣ x) castΠℕₙ (conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A ⊢e ⊢t' (un-univ:⇒*: [[ ⊢B , ⊢Π , D ]]))
(CastRed*TermΠ (un-univ ⊢F ) (un-univ ⊢G) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) ⊢B≡Π
(refl (un-univ ⊢A))))) ⊢t [[ ⊢A , ⊢N , Dx ]])) (refl ⊢A )) (~-conv cast~cast (sym ⊢A≡ℕ))
[cast] {A} {B} ⊢Γ (ne′ K [[ ⊢B , ⊢K , D ]] neK K≡K) (ℕᵣ x) =
(λ {t} {e} [t] ⊢e → [cast]Ne ⊢Γ (ne K [[ ⊢B , ⊢K , D ]] neK K≡K) (ℕᵣ x) [t] ⊢e) ,
(λ {t} {e} [t] ⊢e → let ⊢A≡ℕ = let [[ _ , _ , Dx ]] = x in un-univ≡ (subset* Dx)
⊢A≡ℕ' = let [[ _ , _ , Dx ]] = x in subset* Dx
⊢B≡K = un-univ≡ (subset* D)
⊢t = conv (escapeTerm {l = ι ⁰} (ℕᵣ x) [t]) ⊢A≡ℕ'
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) ⊢A≡ℕ ⊢B≡K))
in neₜ (cast ⁰ ℕ K e t)
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (ℕᵣ x) [t]) (un-univ:⇒*: x))
(CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) ⊢A≡ℕ
(refl (un-univ ⊢B))))) ⊢t [[ ⊢B , ⊢K , D ]])) (subset* D) )
(neNfₜ (castℕₙ neK) (castⱼ (ℕⱼ (wf ⊢B)) (un-univ ⊢K) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) ))
⊢A≡ℕ (un-univ≡ (subset* D)))))
⊢t)
(~-castℕ (wf ⊢B) K≡K (≅-conv (escapeTermEq {l = ι ⁰} {A = B} (ℕᵣ x) (reflEqTerm {l = ι ⁰} (ℕᵣ x) [t])) ⊢A≡ℕ' ) ⊢e' ⊢e')))
[cast] {r = !} ⊢Γ (ne x) (ne x₁) = (λ {t} {e} [t] ⊢e → [cast]Ne ⊢Γ x (ne x₁) [t] ⊢e) , λ {t} {e} [t] ⊢e → [cast]Ne ⊢Γ x₁ (ne x) [t] ⊢e
[cast] {A} {B} {r = !} ⊢Γ (ne′ K [[ ⊢A , ⊢K , D ]] neK K≡K) (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , DΠ ]] ⊢F ⊢G B≡B [F] [G] G-ext) =
(λ {t} {e} [t] ⊢e → [cast]Ne ⊢Γ (ne K [[ ⊢A , ⊢K , D ]] neK K≡K) (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , DΠ ]] ⊢F ⊢G B≡B [F] [G] G-ext) [t] ⊢e) ,
(λ {t} {e} [t] ⊢e → let ⊢B≡Π = un-univ≡ (subset* DΠ)
⊢B≡Π' = subset* DΠ
⊢A≡K = un-univ≡ (subset* D)
[Π] = Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , DΠ ]] ⊢F ⊢G B≡B [F] [G] G-ext
⊢t' = escapeTerm {l = ι ⁰} [Π] [t]
⊢t = conv ⊢t' ⊢B≡Π'
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) ⊢B≡Π ⊢A≡K))
in neₜ (cast ⁰ (Π F ^ rF ° ⁰ ▹ G ° ⁰ ° ⁰) K e t)
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A ⊢e ⊢t' (un-univ:⇒*: [[ ⊢B , ⊢Π , DΠ ]]))
(CastRed*TermΠ (un-univ ⊢F) (un-univ ⊢G) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) ⊢B≡Π
(refl (un-univ ⊢A))))) ⊢t [[ ⊢A , ⊢K , D ]])) (subset* D) )
(neNfₜ (castΠₙ neK) (castⱼ (Πⱼ ≡is≤ PE.refl ▹ ≡is≤ PE.refl ▹ un-univ ⊢F ▹ un-univ ⊢G) (un-univ ⊢K) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) ))
⊢B≡Π (un-univ≡ (subset* D)))))
⊢t)
(~-castΠ (≅-un-univ B≡B) K≡K (≅-conv (escapeTermEq {l = ι ⁰} {A = B} [Π] (reflEqTerm {l = ι ⁰} [Π] [t])) ⊢B≡Π' ) ⊢e' ⊢e')))
[cast] {A} {B} ⊢Γ (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , D ]] ⊢F ⊢G B≡B [F] [G] G-ext) (ℕᵣ x) =
(λ {t} {e} [t] ⊢e →
let ⊢B≡Π = un-univ≡ (subset* D)
⊢B≡Π' = subset* D
[[ ⊢A , ⊢N , Dx ]] = x
⊢A≡ℕ = subset* Dx
⊢t' = escapeTerm {l = ι ⁰} {A = A} (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , D ]] ⊢F ⊢G B≡B [F] [G] G-ext) [t]
⊢t = conv {B = (Π F ^ rF ° ⁰ ▹ G ° ⁰ ° ⁰)} ⊢t' ⊢B≡Π'
t≅t = ≅-conv (escapeTermEq {l = ι ⁰} {A = A} (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , D ]] ⊢F ⊢G B≡B [F] [G] G-ext)
(reflEqTerm {l = ι ⁰} (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , D ]] ⊢F ⊢G B≡B [F] [G] G-ext) [t])) ⊢B≡Π'
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) ⊢B≡Π (un-univ≡ ⊢A≡ℕ)))
cast~cast = ~-castΠℕ (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ B≡B) t≅t ⊢e' ⊢e'
in neuTerm:⇒*: {l = ∞} {t = cast ⁰ A B e t} (ℕᵣ x) castΠℕₙ (conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A ⊢e ⊢t' (un-univ:⇒*: [[ ⊢B , ⊢Π , D ]]))
(CastRed*TermΠ (un-univ ⊢F ) (un-univ ⊢G) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) ⊢B≡Π
(refl (un-univ ⊢A))))) ⊢t [[ ⊢A , ⊢N , Dx ]])) (refl ⊢A )) (~-conv cast~cast (sym ⊢A≡ℕ))) ,
(λ {t} {e} [t] ⊢e →
let ⊢B≡Π = un-univ≡ (subset* D)
⊢A≡ℕ = let [[ _ , _ , Dx ]] = x in un-univ≡ (subset* (red x))
⊢A≡ℕ' = let [[ _ , _ , Dx ]] = x in subset* (red x)
⊢t = conv (escapeTerm {l = ι ⁰} (ℕᵣ x) [t]) ⊢A≡ℕ'
t≅t = ≅-conv (escapeTermEq {l = ι ⁰} {A = B} (ℕᵣ x) (reflEqTerm {l = ι ⁰} (ℕᵣ x) [t])) ⊢A≡ℕ'
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) ⊢A≡ℕ ⊢B≡Π ))
cast~cast = ~-castℕΠ (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ B≡B) t≅t ⊢e' ⊢e'
in neuTerm:⇒*: {t = cast ⁰ B A e t} (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , D ]] ⊢F ⊢G B≡B [F] [G] G-ext)
castℕΠₙ (transTerm:⇒:* (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (ℕᵣ x) [t]) (un-univ:⇒*: x))
(CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) ⊢A≡ℕ
(refl (un-univ ⊢B))))) ⊢t [[ ⊢B , ⊢Π , D ]])) (~-conv cast~cast (sym (subset* D))))
[cast] {A} {B} {r = !} ⊢Γ (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , DΠ ]] ⊢F ⊢G B≡B [F] [G] G-ext) (ne′ K [[ ⊢A , ⊢K , D ]] neK K≡K) =
(λ {t} {e} [t] ⊢e → let ⊢B≡Π = un-univ≡ (subset* DΠ)
⊢A≡K = un-univ≡ (subset* D)
⊢B≡Π' = subset* DΠ
[Π] = Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , DΠ ]] ⊢F ⊢G B≡B [F] [G] G-ext
⊢t' = escapeTerm {l = ι ⁰} [Π] [t]
⊢t = conv ⊢t' ⊢B≡Π'
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) ⊢B≡Π ⊢A≡K))
in neₜ (cast ⁰ (Π F ^ rF ° ⁰ ▹ G ° ⁰ ° ⁰) K e t)
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A ⊢e ⊢t' (un-univ:⇒*: [[ ⊢B , ⊢Π , DΠ ]]))
(CastRed*TermΠ (un-univ ⊢F) (un-univ ⊢G) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) ⊢B≡Π
(refl (un-univ ⊢A))))) ⊢t [[ ⊢A , ⊢K , D ]])) (subset* D) )
(neNfₜ (castΠₙ neK) (castⱼ (Πⱼ ≡is≤ PE.refl ▹ ≡is≤ PE.refl ▹ un-univ ⊢F ▹ un-univ ⊢G) (un-univ ⊢K) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) ))
⊢B≡Π (un-univ≡ (subset* D)))))
⊢t)
(~-castΠ (≅-un-univ B≡B) K≡K (≅-conv (escapeTermEq {l = ι ⁰} {A = A} [Π] (reflEqTerm {l = ι ⁰} [Π] [t])) ⊢B≡Π' ) ⊢e' ⊢e'))) ,
(λ {t} {e} [t] ⊢e → [cast]Ne ⊢Γ (ne K [[ ⊢A , ⊢K , D ]] neK K≡K) (Πᵣ′ rF lF lG (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢B , ⊢Π , DΠ ]] ⊢F ⊢G B≡B [F] [G] G-ext) [t] ⊢e)
[cast] {r = %} ⊢Γ [A] [B] = [cast]irr ⊢Γ [A] [B] , [cast]irr ⊢Γ [B] [A]
[cast] {A} {B} {Γ} {r = !} ⊢Γ (Πᵣ′ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G D ⊢F ⊢G A≡A [F] [G] G-ext)
(Πᵣ′ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext) =
(λ {t} {e} [t] ⊢e →
let [A] = Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G D ⊢F ⊢G A≡A [F] [G] G-ext
⊢A = escape [A]
[B] = Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
⊢B = escape [B]
⊢t = escapeTerm [A] [t]
⊢A≡Π = subset* (red D)
⊢B≡Π = subset* (red D₁)
⊢t≡t = ≅-conv (escapeTermEq {l = ι ⁰} [A] (reflEqTerm {l = ι ⁰} [A] [t])) ⊢A≡Π
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) (un-univ≡ ⊢A≡Π) (un-univ≡ ⊢B≡Π)))
cast~cast = ~-conv (~-castΠΠ%! (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ A≡A) (un-univ ⊢F₁) (un-univ ⊢G₁) (≅-un-univ A₁≡A₁) ⊢t≡t ⊢e' ⊢e') (sym ⊢B≡Π)
in neuTerm:⇒*: {t = cast ⁰ A B e t} [B]
castΠΠ%!ₙ (transTerm:⇒:* (CastRed*Term ⊢B ⊢e ⊢t (un-univ:⇒*: D))
(CastRed*TermΠ (un-univ ⊢F ) (un-univ ⊢G) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ ⊢A≡Π)
(refl (un-univ ⊢B))))) (conv ⊢t ⊢A≡Π) D₁)) cast~cast) ,
(λ {t} {e} [t] ⊢e →
let [A] = Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G D ⊢F ⊢G A≡A [F] [G] G-ext
⊢A = escape [A]
[B] = Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
⊢B = escape [B]
⊢t = escapeTerm [B] [t]
⊢A≡Π = subset* (red D)
⊢B≡Π = subset* (red D₁)
⊢t≡t = ≅-conv (escapeTermEq {l = ι ⁰} [B] (reflEqTerm {l = ι ⁰} [B] [t])) ⊢B≡Π
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) (un-univ≡ ⊢B≡Π) (un-univ≡ ⊢A≡Π)))
cast~cast = ~-conv (~-castΠΠ!% (un-univ ⊢F₁) (un-univ ⊢G₁) (≅-un-univ A₁≡A₁) (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ A≡A) ⊢t≡t ⊢e' ⊢e') (sym ⊢A≡Π)
in neuTerm:⇒*: {t = cast ⁰ B A e t} [A]
castΠΠ!%ₙ (transTerm:⇒:* (CastRed*Term ⊢A ⊢e ⊢t (un-univ:⇒*: D₁))
(CastRed*TermΠ (un-univ ⊢F₁ ) (un-univ ⊢G₁) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A) )) (un-univ≡ ⊢B≡Π)
(refl (un-univ ⊢A))))) (conv ⊢t ⊢B≡Π) D)) cast~cast)
[cast] {A} {B} {Γ} {r = !} ⊢Γ (Πᵣ′ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G D ⊢F ⊢G A≡A [F] [G] G-ext)
(Πᵣ′ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext) =
(λ {t} {e} [t] ⊢e →
let [A] = Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G D ⊢F ⊢G A≡A [F] [G] G-ext
⊢A = escape [A]
[B] = Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
⊢B = escape [B]
⊢t = escapeTerm [A] [t]
⊢A≡Π = subset* (red D)
⊢B≡Π = subset* (red D₁)
⊢t≡t = ≅-conv (escapeTermEq {l = ι ⁰} [A] (reflEqTerm {l = ι ⁰} [A] [t])) ⊢A≡Π
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) (un-univ≡ ⊢A≡Π) (un-univ≡ ⊢B≡Π)))
cast~cast = ~-conv (~-castΠΠ!% (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ A≡A) (un-univ ⊢F₁) (un-univ ⊢G₁) (≅-un-univ A₁≡A₁) ⊢t≡t ⊢e' ⊢e') (sym ⊢B≡Π)
in neuTerm:⇒*: {t = cast ⁰ A B e t} [B]
castΠΠ!%ₙ (transTerm:⇒:* (CastRed*Term ⊢B ⊢e ⊢t (un-univ:⇒*: D))
(CastRed*TermΠ (un-univ ⊢F ) (un-univ ⊢G) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B) )) (un-univ≡ ⊢A≡Π)
(refl (un-univ ⊢B))))) (conv ⊢t ⊢A≡Π) D₁)) cast~cast) ,
(λ {t} {e} [t] ⊢e →
let [A] = Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G D ⊢F ⊢G A≡A [F] [G] G-ext
⊢A = escape [A]
[B] = Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
⊢B = escape [B]
⊢t = escapeTerm [B] [t]
⊢A≡Π = subset* (red D)
⊢B≡Π = subset* (red D₁)
⊢t≡t = ≅-conv (escapeTermEq {l = ι ⁰} [B] (reflEqTerm {l = ι ⁰} [B] [t])) ⊢B≡Π
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢B))) (un-univ≡ ⊢B≡Π) (un-univ≡ ⊢A≡Π)))
cast~cast = ~-conv (~-castΠΠ%! (un-univ ⊢F₁) (un-univ ⊢G₁) (≅-un-univ A₁≡A₁) (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ A≡A) ⊢t≡t ⊢e' ⊢e') (sym ⊢A≡Π)
in neuTerm:⇒*: {t = cast ⁰ B A e t} [A]
castΠΠ%!ₙ (transTerm:⇒:* (CastRed*Term ⊢A ⊢e ⊢t (un-univ:⇒*: D₁))
(CastRed*TermΠ (un-univ ⊢F₁ ) (un-univ ⊢G₁) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A) )) (un-univ≡ ⊢B≡Π)
(refl (un-univ ⊢A))))) (conv ⊢t ⊢B≡Π) D)) cast~cast)
[cast] {A} {B} {Γ} {r = !} ⊢Γ (Πᵣ′ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢ΠFG , D ]] ⊢F ⊢G A≡A [F] [G] G-ext)
(Πᵣ′ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢B , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext) =
[cast]₁ , [cast]₂
where
module b₁ = cast-ΠΠ-lemmas ⊢Γ ⊢F [F] ⊢F₁ [F₁]
(λ [ρ] ⊢Δ → proj₂ ([cast] ⊢Δ ([F] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₂ ([castext] ⊢Δ ([F] [ρ] ⊢Δ) ([F] [ρ] ⊢Δ) (reflEq ([F] [ρ] ⊢Δ)) ([F₁] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ) (reflEq ([F₁] [ρ] ⊢Δ))))
module b₂ = cast-ΠΠ-lemmas ⊢Γ ⊢F₁ [F₁] ⊢F [F]
(λ [ρ] ⊢Δ → proj₁ ([cast] ⊢Δ ([F] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₁ ([castext] ⊢Δ ([F] [ρ] ⊢Δ) ([F] [ρ] ⊢Δ) (reflEq ([F] [ρ] ⊢Δ)) ([F₁] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ) (reflEq ([F₁] [ρ] ⊢Δ))))
[A] = (Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢ΠFG , D ]] ⊢F ⊢G A≡A [F] [G] G-ext)
[B] = (Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢B , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
[cast]₁ : ∀ {t e} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ ! , ι ⁰ ] / [A])
→ (⊢e : Γ ⊢ e ∷ Id (U ⁰) A B ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ∷ B ^ [ ! , ι ⁰ ] / [B]
[cast]₁ {t} {e} (f , [[ ⊢t , ⊢f , Df ]] , funf , f≡f , [fext] , [f]) ⊢e = [castΠΠ]
where
open cast-ΠΠ-lemmas-2 ⊢Γ ⊢A ⊢ΠFG D ⊢F ⊢G A≡A [F] [G] G-ext ⊢B ⊢ΠF₁G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext ⊢e
(λ [ρ] ⊢Δ [x] [y] → proj₁ ([cast] ⊢Δ ([G] [ρ] ⊢Δ [x]) ([G₁] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [x] [x′] [x≡x′] [y] [y′] [y≡y′] →
proj₁ ([castext] ⊢Δ ([G] [ρ] ⊢Δ [x]) ([G] [ρ] ⊢Δ [x′]) (G-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₁] [ρ] ⊢Δ [y]) ([G₁] [ρ] ⊢Δ [y′]) (G₁-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
⊢t Df [fext] [f] b₁.[b] b₁.[bext]
[cast]₂ : ∀ {t e} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ B ^ [ ! , ι ⁰ ] / [B])
→ (⊢e : Γ ⊢ e ∷ Id (U ⁰) B A ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ B A e t ∷ A ^ [ ! , ι ⁰ ] / [A]
[cast]₂ {t} {e} (f , [[ ⊢t , ⊢f , Df ]] , funf , f≡f , [fext] , [f]) ⊢e = [castΠΠ]
where
open cast-ΠΠ-lemmas-2 ⊢Γ ⊢B ⊢ΠF₁G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext ⊢A ⊢ΠFG D ⊢F ⊢G A≡A [F] [G] G-ext ⊢e
(λ [ρ] ⊢Δ [y] [x] → proj₂ ([cast] ⊢Δ ([G] [ρ] ⊢Δ [x]) ([G₁] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [y] [y′] [y≡y′] [x] [x′] [x≡x′] →
proj₂ ([castext] ⊢Δ ([G] [ρ] ⊢Δ [x]) ([G] [ρ] ⊢Δ [x′]) (G-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₁] [ρ] ⊢Δ [y]) ([G₁] [ρ] ⊢Δ [y′]) (G₁-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
⊢t Df [fext] [f] b₂.[b] b₂.[bext]
[cast] {A} {B} {Γ} {r = !} ⊢Γ (Πᵣ′ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢ΠFG , D ]] ⊢F ⊢G A≡A [F] [G] G-ext)
(Πᵣ′ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢B , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext) =
[cast]₁ , [cast]₂
where
module b₁ = cast-ΠΠ-lemmas ⊢Γ ⊢F [F] ⊢F₁ [F₁]
(λ [ρ] ⊢Δ → proj₂ ([cast] ⊢Δ ([F] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₂ ([castext] ⊢Δ ([F] [ρ] ⊢Δ) ([F] [ρ] ⊢Δ) (reflEq ([F] [ρ] ⊢Δ)) ([F₁] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ) (reflEq ([F₁] [ρ] ⊢Δ))))
module b₂ = cast-ΠΠ-lemmas ⊢Γ ⊢F₁ [F₁] ⊢F [F]
(λ [ρ] ⊢Δ → proj₁ ([cast] ⊢Δ ([F] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₁ ([castext] ⊢Δ ([F] [ρ] ⊢Δ) ([F] [ρ] ⊢Δ) (reflEq ([F] [ρ] ⊢Δ)) ([F₁] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ) (reflEq ([F₁] [ρ] ⊢Δ))))
[A] = (Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢ΠFG , D ]] ⊢F ⊢G A≡A [F] [G] G-ext)
[B] = (Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢B , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
[cast]₁ : ∀ {t e} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ ! , ι ⁰ ] / [A])
→ (⊢e : Γ ⊢ e ∷ Id (U ⁰) A B ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ∷ B ^ [ ! , ι ⁰ ] / [B]
[cast]₁ {t} {e} (f , [[ ⊢t , ⊢f , Df ]] , funf , f≡f , [fext] , [f]) ⊢e = [castΠΠ]
where
open cast-ΠΠ-lemmas-2 ⊢Γ ⊢A ⊢ΠFG D ⊢F ⊢G A≡A [F] [G] G-ext ⊢B ⊢ΠF₁G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext ⊢e
(λ [ρ] ⊢Δ [x] [y] → proj₁ ([cast] ⊢Δ ([G] [ρ] ⊢Δ [x]) ([G₁] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [x] [x′] [x≡x′] [y] [y′] [y≡y′] →
proj₁ ([castext] ⊢Δ ([G] [ρ] ⊢Δ [x]) ([G] [ρ] ⊢Δ [x′]) (G-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₁] [ρ] ⊢Δ [y]) ([G₁] [ρ] ⊢Δ [y′]) (G₁-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
⊢t Df [fext] [f] b₁.[b] b₁.[bext]
[cast]₂ : ∀ {t e} → ([t] : Γ ⊩⟨ ι ⁰ ⟩ t ∷ B ^ [ ! , ι ⁰ ] / [B])
→ (⊢e : Γ ⊢ e ∷ Id (U ⁰) B A ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ B A e t ∷ A ^ [ ! , ι ⁰ ] / [A]
[cast]₂ {t} {e} (f , [[ ⊢t , ⊢f , Df ]] , funf , f≡f , [fext] , [f]) ⊢e = [castΠΠ]
where
open cast-ΠΠ-lemmas-2 ⊢Γ ⊢B ⊢ΠF₁G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext ⊢A ⊢ΠFG D ⊢F ⊢G A≡A [F] [G] G-ext ⊢e
(λ [ρ] ⊢Δ [y] [x] → proj₂ ([cast] ⊢Δ ([G] [ρ] ⊢Δ [x]) ([G₁] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [y] [y′] [y≡y′] [x] [x′] [x≡x′] →
proj₂ ([castext] ⊢Δ ([G] [ρ] ⊢Δ [x]) ([G] [ρ] ⊢Δ [x′]) (G-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₁] [ρ] ⊢Δ [y]) ([G₁] [ρ] ⊢Δ [y′]) (G₁-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
⊢t Df [fext] [f] b₂.[b] b₂.[bext]
[castextShape] {A₁} {A₂} {A₃} {A₄} {Γ} {r = !} ⊢Γ
_ _
(Πᵥ (Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
(Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext))
(Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′]) =
let ΠFG′≡ΠFG′₁ = whrDet* (D₂ , Πₙ) (D₂′ , Πₙ)
F′≡F′₁ , rF≡rF′ , _ , G′≡G′₁ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₁
in ⊥-elim (!≢% (PE.sym rF≡rF′))
[castextShape] {A₁} {A₂} {A₃} {A₄} {Γ} {r = !} ⊢Γ
_ _
(Πᵥ (Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
(Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext))
(Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′])
=
let ΠFG′≡ΠFG′₁ = whrDet* (D₂ , Πₙ) (D₂′ , Πₙ)
F′≡F′₁ , rF≡rF′ , _ , G′≡G′₁ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₁
in ⊥-elim (!≢% rF≡rF′)
[castextShape] {A₁} {A₂} {A₃} {A₄} {Γ} {r = !} ⊢Γ
_ _
(Πᵥ (Πᵣ r1 .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
(Πᵣ r2 .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext))
(Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′])
_ _
(Πᵥ (Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext)
(Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₄ G₄ [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]] ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext))
(Π₌ F₄′ G₄′ D₄′ A₃≡A₄′ [F₃≡F₄′] [G₃≡G₄′]) =
let ΠFG′≡ΠFG′₁ = whrDet* (D₄ , Πₙ) (D₄′ , Πₙ)
F′≡F′₁ , rF≡rF′ , _ , G′≡G′₁ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₁
in ⊥-elim (!≢% rF≡rF′)
[castextShape] {A₁} {A₂} {A₃} {A₄} {Γ} {r = !} ⊢Γ
_ _
(Πᵥ (Πᵣ r1 .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
(Πᵣ r2 .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext))
(Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′])
_ _
(Πᵥ (Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext)
(Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₄ G₄ [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]] ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext))
(Π₌ F₄′ G₄′ D₄′ A₃≡A₄′ [F₃≡F₄′] [G₃≡G₄′]) =
let ΠFG′≡ΠFG′₁ = whrDet* (D₄ , Πₙ) (D₄′ , Πₙ)
F′≡F′₁ , rF≡rF′ , _ , G′≡G′₁ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₁
in ⊥-elim (!≢% (PE.sym rF≡rF′))
[castextShape] {A₁} {A₂} {A₃} {A₄} {Γ} {r = !} ⊢Γ
_ _
(Πᵥ (Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
(Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext))
(Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′])
_ _
(Πᵥ (Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext)
(Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₄ G₄ [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]] ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext))
(Π₌ F₄′ G₄′ D₄′ A₃≡A₄′ [F₃≡F₄′] [G₃≡G₄′]) =
([castext]₁ , [castext]₂)
where
module b₁ = cast-ΠΠ-lemmas ⊢Γ ⊢F₁ [F₁] ⊢F₃ [F₃]
(λ [ρ] ⊢Δ → proj₂ ([cast] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₂ ([castext] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ) (reflEq ([F₁] [ρ] ⊢Δ)) ([F₃] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ) (reflEq ([F₃] [ρ] ⊢Δ))))
module b₂ = cast-ΠΠ-lemmas ⊢Γ ⊢F₂ [F₂] ⊢F₄ [F₄]
(λ [ρ] ⊢Δ → proj₂ ([cast] ⊢Δ ([F₂] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₂ ([castext] ⊢Δ ([F₂] [ρ] ⊢Δ) ([F₂] [ρ] ⊢Δ) (reflEq ([F₂] [ρ] ⊢Δ)) ([F₄] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ) (reflEq ([F₄] [ρ] ⊢Δ))))
module b₃ = cast-ΠΠ-lemmas ⊢Γ ⊢F₃ [F₃] ⊢F₁ [F₁]
(λ [ρ] ⊢Δ → proj₁ ([cast] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₁ ([castext] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ) (reflEq ([F₁] [ρ] ⊢Δ)) ([F₃] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ) (reflEq ([F₃] [ρ] ⊢Δ))))
module b₄ = cast-ΠΠ-lemmas ⊢Γ ⊢F₄ [F₄] ⊢F₂ [F₂]
(λ [ρ] ⊢Δ → proj₁ ([cast] ⊢Δ ([F₂] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₁ ([castext] ⊢Δ ([F₂] [ρ] ⊢Δ) ([F₂] [ρ] ⊢Δ) (reflEq ([F₂] [ρ] ⊢Δ)) ([F₄] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ) (reflEq ([F₄] [ρ] ⊢Δ))))
[A₁] = (Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
[A₂] = (Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext)
[A₁≡A₂] = (Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′])
[A₃] = (Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext)
[A₄] = (Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₄ G₄ [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]] ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext)
[A₃≡A₄] = (Π₌ F₄′ G₄′ D₄′ A₃≡A₄′ [F₃≡F₄′] [G₃≡G₄′])
Π≡Π = whrDet* (D₂ , Whnf.Πₙ) (D₂′ , Whnf.Πₙ)
F₂≡F₂′ = let x , _ , _ , _ , _ = Π-PE-injectivity Π≡Π in x
G₂≡G₂′ = let _ , _ , _ , x , _ = Π-PE-injectivity Π≡Π in x
Π≡Π′ = whrDet* (D₄ , Whnf.Πₙ) (D₄′ , Whnf.Πₙ)
F₄≡F₄′ = let x , _ , _ , _ , _ = Π-PE-injectivity Π≡Π′ in x
G₄≡G₄′ = let _ , _ , _ , x , _ = Π-PE-injectivity Π≡Π′ in x
A₁≡A₂ = PE.subst₂ (λ X Y → Γ ⊢ Π F₁ ^ ! ° ⁰ ▹ G₁ ° ⁰ ° ⁰ ≅ Π X ^ ! ° ⁰ ▹ Y ° ⁰ ° ⁰ ^ [ ! , ι ⁰ ]) (PE.sym F₂≡F₂′) (PE.sym G₂≡G₂′) A₁≡A₂′
A₃≡A₄ = PE.subst₂ (λ X Y → Γ ⊢ Π F₃ ^ ! ° ⁰ ▹ G₃ ° ⁰ ° ⁰ ≅ Π X ^ ! ° ⁰ ▹ Y ° ⁰ ° ⁰ ^ [ ! , ι ⁰ ]) (PE.sym F₄≡F₄′) (PE.sym G₄≡G₄′) A₃≡A₄′
[F₁≡F₂] = PE.subst (λ X → ∀ {ρ Δ} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → Δ ⊩⟨ ι ⁰ ⟩ wk ρ F₁ ≡ wk ρ X ^ [ ! , ι ⁰ ] / [F₁] [ρ] ⊢Δ)
(PE.sym F₂≡F₂′) [F₁≡F₂′]
[F₃≡F₄] = PE.subst (λ X → ∀ {ρ Δ} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → Δ ⊩⟨ ι ⁰ ⟩ wk ρ F₃ ≡ wk ρ X ^ [ ! , ι ⁰ ] / [F₃] [ρ] ⊢Δ)
(PE.sym F₄≡F₄′) [F₃≡F₄′]
[G₁≡G₂] = PE.subst (λ X → ∀ {ρ Δ a} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ)
→ ([a] : Δ ⊩⟨ ι ⁰ ⟩ a ∷ wk ρ F₁ ^ [ ! , ι ⁰ ] / [F₁] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ wk (lift ρ) G₁ [ a ] ≡ wk (lift ρ) X [ a ] ^ [ ! , ι ⁰ ] / [G₁] [ρ] ⊢Δ [a])
(PE.sym G₂≡G₂′) [G₁≡G₂′]
[G₃≡G₄] = PE.subst (λ X → ∀ {ρ Δ a} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ)
→ ([a] : Δ ⊩⟨ ι ⁰ ⟩ a ∷ wk ρ F₃ ^ [ ! , ι ⁰ ] / [F₃] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ wk (lift ρ) G₃ [ a ] ≡ wk (lift ρ) X [ a ] ^ [ ! , ι ⁰ ] / [G₃] [ρ] ⊢Δ [a])
(PE.sym G₄≡G₄′) [G₃≡G₄′]
[b₁≡b₂] : ∀ {ρ Δ e₁₃ e₂₄ x₃ x₄} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ)
→ (Δ ⊢ e₁₃ ∷ Id (U ⁰) (wk ρ F₁) (wk ρ F₃) ^ [ % , ι ¹ ])
→ (Δ ⊢ e₂₄ ∷ Id (U ⁰) (wk ρ F₂) (wk ρ F₄) ^ [ % , ι ¹ ])
→ (Δ ⊩⟨ ι ⁰ ⟩ x₃ ∷ wk ρ F₃ ^ [ ! , ι ⁰ ] / [F₃] [ρ] ⊢Δ)
→ (Δ ⊩⟨ ι ⁰ ⟩ x₄ ∷ wk ρ F₄ ^ [ ! , ι ⁰ ] / [F₄] [ρ] ⊢Δ)
→ (Δ ⊩⟨ ι ⁰ ⟩ x₃ ≡ x₄ ∷ wk ρ F₃ ^ [ ! , ι ⁰ ] / [F₃] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ b₁.b ρ e₁₃ x₃ ≡ b₂.b ρ e₂₄ x₄ ∷ wk ρ F₁ ^ [ ! , ι ⁰ ] / [F₁] [ρ] ⊢Δ
[b₁≡b₂] [ρ] ⊢Δ ⊢e₁₃ ⊢e₂₄ [x₃] [x₄] [x₃≡x₄] =
let
⊢e₃₁ = Idsymⱼ (univ 0<1 ⊢Δ) (un-univ (escape ([F₁] [ρ] ⊢Δ)))
(un-univ (escape ([F₃] [ρ] ⊢Δ))) ⊢e₁₃
⊢e₄₂ = Idsymⱼ (univ 0<1 ⊢Δ) (un-univ (escape ([F₂] [ρ] ⊢Δ)))
(un-univ (escape ([F₄] [ρ] ⊢Δ))) ⊢e₂₄
in proj₂ ([castext] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₂] [ρ] ⊢Δ) ([F₁≡F₂] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ) ([F₃≡F₄] [ρ] ⊢Δ)) [x₃] [x₄] [x₃≡x₄] ⊢e₃₁ ⊢e₄₂
[b₃≡b₄] : ∀ {ρ Δ e₃₁ e₄₂ x₁ x₂} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ)
→ (Δ ⊢ e₃₁ ∷ Id (U ⁰) (wk ρ F₃) (wk ρ F₁) ^ [ % , ι ¹ ])
→ (Δ ⊢ e₄₂ ∷ Id (U ⁰) (wk ρ F₄) (wk ρ F₂) ^ [ % , ι ¹ ])
→ (Δ ⊩⟨ ι ⁰ ⟩ x₁ ∷ wk ρ F₁ ^ [ ! , ι ⁰ ] / [F₁] [ρ] ⊢Δ)
→ (Δ ⊩⟨ ι ⁰ ⟩ x₂ ∷ wk ρ F₂ ^ [ ! , ι ⁰ ] / [F₂] [ρ] ⊢Δ)
→ (Δ ⊩⟨ ι ⁰ ⟩ x₁ ≡ x₂ ∷ wk ρ F₁ ^ [ ! , ι ⁰ ] / [F₁] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ b₃.b ρ e₃₁ x₁ ≡ b₄.b ρ e₄₂ x₂ ∷ wk ρ F₃ ^ [ ! , ι ⁰ ] / [F₃] [ρ] ⊢Δ
[b₃≡b₄] [ρ] ⊢Δ ⊢e₃₁ ⊢e₄₂ [x₁] [x₂] [x₁≡x₂] =
let
⊢e₁₃ = Idsymⱼ (univ 0<1 ⊢Δ) (un-univ (escape ([F₃] [ρ] ⊢Δ)))
(un-univ (escape ([F₁] [ρ] ⊢Δ))) ⊢e₃₁
⊢e₂₄ = Idsymⱼ (univ 0<1 ⊢Δ) (un-univ (escape ([F₄] [ρ] ⊢Δ)))
(un-univ (escape ([F₂] [ρ] ⊢Δ))) ⊢e₄₂
in proj₁ ([castext] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₂] [ρ] ⊢Δ) ([F₁≡F₂] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ) ([F₃≡F₄] [ρ] ⊢Δ)) [x₁] [x₂] [x₁≡x₂] ⊢e₁₃ ⊢e₂₄
[castext]₁ : (∀ {t₁ t₂ e₁₃ e₂₄} → ([t₁] : Γ ⊩⟨ ι ⁰ ⟩ t₁ ∷ A₁ ^ [ ! , ι ⁰ ] / [A₁])
→ ([t₁] : Γ ⊩⟨ ι ⁰ ⟩ t₂ ∷ A₂ ^ [ ! , ι ⁰ ] / [A₂])
→ ([t₁≡t₂] : Γ ⊩⟨ ι ⁰ ⟩ t₁ ≡ t₂ ∷ A₁ ^ [ ! , ι ⁰ ] / [A₁])
→ (⊢e₁₃ : Γ ⊢ e₁₃ ∷ Id (U ⁰) A₁ A₃ ^ [ % , ι ¹ ])
→ (⊢e₂₄ : Γ ⊢ e₂₄ ∷ Id (U ⁰) A₂ A₄ ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A₁ A₃ e₁₃ t₁ ≡ cast ⁰ A₂ A₄ e₂₄ t₂ ∷ A₃ ^ [ ! , ι ⁰ ] / [A₃])
[castext]₁ {t₁} {t₂} {e₁₃} {e₂₄}
(f₁ , [[ ⊢t₁ , ⊢f₁ , Df₁ ]] , funf₁ , f₁≡f₁ , [f₁ext] , [f₁])
(f₂ , [[ ⊢t₂ , ⊢f₂ , Df₂ ]] , funf₂ , f₂≡f₂ , [f₂ext] , [f₂])
(f₁′ , f₂′ , [[ _ , ⊢f₁′ , Df₁′ ]] , [[ _ , ⊢f₂′ , Df₂′ ]] , funf₁′ , funf₂′ , _ , _ , _ , [f₁′≡f₂′])
⊢e₁₃ ⊢e₂₄ =
( (lam F₃ ▹ g₁.g (step id) (var 0) ^ ⁰)
, (lam F₄ ▹ g₂.g (step id) (var 0) ^ ⁰)
, g₁.Dg
, conv:* g₂.Dg (sym (≅-eq A₃≡A₄))
, lamₙ
, lamₙ
, g₁≡g₂
, g₁.[castΠΠ]
, convTerm₂ [A₃] [A₄] [A₃≡A₄] g₂.[castΠΠ]
, [g₁a≡g₂a] )
where
f₁≡f₁′ = whrDet*Term (Df₁ , functionWhnf funf₁) (Df₁′ , functionWhnf funf₁′)
f₂≡f₂′ = whrDet*Term (Df₂ , functionWhnf funf₂) (Df₂′ , functionWhnf funf₂′)
[f₁≡f₂] = PE.subst₂ (λ X Y → ∀ {ρ Δ a} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → ([a] : Δ ⊩⟨ ι ⁰ ⟩ a ∷ wk ρ F₁ ^ [ ! , ι ⁰ ] / [F₁] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ wk ρ X ∘ a ^ ⁰ ≡ wk ρ Y ∘ a ^ ⁰ ∷ wk (lift ρ) G₁ [ a ] ^ [ ! , ι ⁰ ] / [G₁] [ρ] ⊢Δ [a]) (PE.sym f₁≡f₁′) (PE.sym f₂≡f₂′) [f₁′≡f₂′]
open cast-ΠΠ-lemmas-3 ⊢Γ ⊢A₁ ⊢ΠF₁G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
⊢A₂ ⊢ΠF₂G₂ D₂ ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext
⊢A₃ ⊢ΠF₃G₃ D₃ ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext
⊢A₄ ⊢ΠF₄G₄ D₄ ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext
A₁≡A₂ A₃≡A₄ [F₁≡F₂] [F₃≡F₄] [G₁≡G₂] [G₃≡G₄]
⊢e₁₃ ⊢e₂₄
⊢t₁ Df₁ [f₁ext] [f₁]
⊢t₂ Df₂ [f₂ext] [f₂]
[f₁≡f₂]
(λ [ρ] ⊢Δ [x] [y] → proj₁ ([cast] ⊢Δ ([G₁] [ρ] ⊢Δ [x]) ([G₃] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [x] [y] → proj₁ ([cast] ⊢Δ ([G₂] [ρ] ⊢Δ [x]) ([G₄] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [x] [x′] [x≡x′] [y] [y′] [y≡y′] →
proj₁ ([castext] ⊢Δ ([G₁] [ρ] ⊢Δ [x]) ([G₁] [ρ] ⊢Δ [x′]) (G₁-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₃] [ρ] ⊢Δ [y]) ([G₃] [ρ] ⊢Δ [y′]) (G₃-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
(λ [ρ] ⊢Δ [x] [x′] [x≡x′] [y] [y′] [y≡y′] →
proj₁ ([castext] ⊢Δ ([G₂] [ρ] ⊢Δ [x]) ([G₂] [ρ] ⊢Δ [x′]) (G₂-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₄] [ρ] ⊢Δ [y]) ([G₄] [ρ] ⊢Δ [y′]) (G₄-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
(λ [ρ] ⊢Δ [x₁] [x₂] [G₁x₁≡G₂x₂] [x₃] [x₄] [G₃x₃≡G₄x₄] →
proj₁ ([castext] ⊢Δ ([G₁] [ρ] ⊢Δ [x₁]) ([G₂] [ρ] ⊢Δ [x₂]) [G₁x₁≡G₂x₂]
([G₃] [ρ] ⊢Δ [x₃]) ([G₄] [ρ] ⊢Δ [x₄]) [G₃x₃≡G₄x₄]))
b₁.[b] b₁.[bext] b₂.[b] b₂.[bext] [b₁≡b₂]
[castext]₂ : (∀ {t₃ t₄ e₃₁ e₄₂} → ([t₃] : Γ ⊩⟨ ι ⁰ ⟩ t₃ ∷ A₃ ^ [ ! , ι ⁰ ] / [A₃])
→ ([t₄] : Γ ⊩⟨ ι ⁰ ⟩ t₄ ∷ A₄ ^ [ ! , ι ⁰ ] / [A₄])
→ ([t₃≡t₄] : Γ ⊩⟨ ι ⁰ ⟩ t₃ ≡ t₄ ∷ A₃ ^ [ ! , ι ⁰ ] / [A₃])
→ (⊢e₃₁ : Γ ⊢ e₃₁ ∷ Id (U ⁰) A₃ A₁ ^ [ % , ι ¹ ])
→ (⊢e₄₂ : Γ ⊢ e₄₂ ∷ Id (U ⁰) A₄ A₂ ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A₃ A₁ e₃₁ t₃ ≡ cast ⁰ A₄ A₂ e₄₂ t₄ ∷ A₁ ^ [ ! , ι ⁰ ] / [A₁])
[castext]₂ {t₃} {t₄} {e₃₁} {e₄₂}
(f₃ , [[ ⊢t₃ , ⊢f₃ , Df₃ ]] , funf₃ , f₃≡f₃ , [f₃ext] , [f₃])
(f₄ , [[ ⊢t₄ , ⊢f₄ , Df₄ ]] , funf₄ , f₄≡f₄ , [f₄ext] , [f₄])
(f₃′ , f₄′ , [[ _ , ⊢f₃′ , Df₃′ ]] , [[ _ , ⊢f₄′ , Df₄′ ]] , funf₃′ , funf₄′ , _ , _ , _ , [f₃′≡f₄′])
⊢e₃₁ ⊢e₄₂ =
( (lam F₁ ▹ g₁.g (step id) (var 0) ^ ⁰)
, (lam F₂ ▹ g₂.g (step id) (var 0) ^ ⁰)
, g₁.Dg
, conv:* g₂.Dg (sym (≅-eq A₁≡A₂))
, lamₙ
, lamₙ
, g₁≡g₂
, g₁.[castΠΠ]
, convTerm₂ [A₁] [A₂] [A₁≡A₂] g₂.[castΠΠ]
, [g₁a≡g₂a] )
where
f₃≡f₃′ = whrDet*Term (Df₃ , functionWhnf funf₃) (Df₃′ , functionWhnf funf₃′)
f₄≡f₄′ = whrDet*Term (Df₄ , functionWhnf funf₄) (Df₄′ , functionWhnf funf₄′)
[f₃≡f₄] = PE.subst₂ (λ X Y → ∀ {ρ Δ a} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → ([a] : Δ ⊩⟨ ι ⁰ ⟩ a ∷ wk ρ F₃ ^ [ ! , ι ⁰ ] / [F₃] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ wk ρ X ∘ a ^ ⁰ ≡ wk ρ Y ∘ a ^ ⁰ ∷ wk (lift ρ) G₃ [ a ] ^ [ ! , ι ⁰ ] / [G₃] [ρ] ⊢Δ [a]) (PE.sym f₃≡f₃′) (PE.sym f₄≡f₄′) [f₃′≡f₄′]
open cast-ΠΠ-lemmas-3 ⊢Γ ⊢A₃ ⊢ΠF₃G₃ D₃ ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext
⊢A₄ ⊢ΠF₄G₄ D₄ ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext
⊢A₁ ⊢ΠF₁G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
⊢A₂ ⊢ΠF₂G₂ D₂ ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext
A₃≡A₄ A₁≡A₂ [F₃≡F₄] [F₁≡F₂] [G₃≡G₄] [G₁≡G₂]
⊢e₃₁ ⊢e₄₂
⊢t₃ Df₃ [f₃ext] [f₃]
⊢t₄ Df₄ [f₄ext] [f₄]
[f₃≡f₄]
(λ [ρ] ⊢Δ [y] [x] → proj₂ ([cast] ⊢Δ ([G₁] [ρ] ⊢Δ [x]) ([G₃] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [y] [x] → proj₂ ([cast] ⊢Δ ([G₂] [ρ] ⊢Δ [x]) ([G₄] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [y] [y′] [y≡y′] [x] [x′] [x≡x′] →
proj₂ ([castext] ⊢Δ ([G₁] [ρ] ⊢Δ [x]) ([G₁] [ρ] ⊢Δ [x′]) (G₁-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₃] [ρ] ⊢Δ [y]) ([G₃] [ρ] ⊢Δ [y′]) (G₃-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
(λ [ρ] ⊢Δ [y] [y′] [y≡y′] [x] [x′] [x≡x′] →
proj₂ ([castext] ⊢Δ ([G₂] [ρ] ⊢Δ [x]) ([G₂] [ρ] ⊢Δ [x′]) (G₂-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₄] [ρ] ⊢Δ [y]) ([G₄] [ρ] ⊢Δ [y′]) (G₄-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
(λ [ρ] ⊢Δ [x₃] [x₄] [G₃x₃≡G₄x₄] [x₁] [x₂] [G₁x₁≡G₂x₂] →
proj₂ ([castext] ⊢Δ ([G₁] [ρ] ⊢Δ [x₁]) ([G₂] [ρ] ⊢Δ [x₂]) [G₁x₁≡G₂x₂]
([G₃] [ρ] ⊢Δ [x₃]) ([G₄] [ρ] ⊢Δ [x₄]) [G₃x₃≡G₄x₄]))
b₃.[b] b₃.[bext] b₄.[b] b₄.[bext] [b₃≡b₄]
[castextShape] {A₁} {A₂} {A₃} {A₄} {Γ} {r = !} ⊢Γ
_ _
(Πᵥ (Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
(Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext))
(Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′])
_ _
(Πᵥ (Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext)
(Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₄ G₄ [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]] ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext))
(Π₌ F₄′ G₄′ D₄′ A₃≡A₄′ [F₃≡F₄′] [G₃≡G₄′]) =
([castext]₁ , [castext]₂)
where
module b₁ = cast-ΠΠ-lemmas ⊢Γ ⊢F₁ [F₁] ⊢F₃ [F₃]
(λ [ρ] ⊢Δ → proj₂ ([cast] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₂ ([castext] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ) (reflEq ([F₁] [ρ] ⊢Δ)) ([F₃] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ) (reflEq ([F₃] [ρ] ⊢Δ))))
module b₂ = cast-ΠΠ-lemmas ⊢Γ ⊢F₂ [F₂] ⊢F₄ [F₄]
(λ [ρ] ⊢Δ → proj₂ ([cast] ⊢Δ ([F₂] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₂ ([castext] ⊢Δ ([F₂] [ρ] ⊢Δ) ([F₂] [ρ] ⊢Δ) (reflEq ([F₂] [ρ] ⊢Δ)) ([F₄] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ) (reflEq ([F₄] [ρ] ⊢Δ))))
module b₃ = cast-ΠΠ-lemmas ⊢Γ ⊢F₃ [F₃] ⊢F₁ [F₁]
(λ [ρ] ⊢Δ → proj₁ ([cast] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₁ ([castext] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₁] [ρ] ⊢Δ) (reflEq ([F₁] [ρ] ⊢Δ)) ([F₃] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ) (reflEq ([F₃] [ρ] ⊢Δ))))
module b₄ = cast-ΠΠ-lemmas ⊢Γ ⊢F₄ [F₄] ⊢F₂ [F₂]
(λ [ρ] ⊢Δ → proj₁ ([cast] ⊢Δ ([F₂] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ)))
(λ [ρ] ⊢Δ → proj₁ ([castext] ⊢Δ ([F₂] [ρ] ⊢Δ) ([F₂] [ρ] ⊢Δ) (reflEq ([F₂] [ρ] ⊢Δ)) ([F₄] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ) (reflEq ([F₄] [ρ] ⊢Δ))))
[A₁] = (Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
[A₂] = (Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext)
[A₁≡A₂] = (Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′])
[A₃] = (Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext)
[A₄] = (Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₄ G₄ [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]] ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext)
[A₃≡A₄] = (Π₌ F₄′ G₄′ D₄′ A₃≡A₄′ [F₃≡F₄′] [G₃≡G₄′])
Π≡Π = whrDet* (D₂ , Whnf.Πₙ) (D₂′ , Whnf.Πₙ)
F₂≡F₂′ = let x , _ , _ , _ , _ = Π-PE-injectivity Π≡Π in x
G₂≡G₂′ = let _ , _ , _ , x , _ = Π-PE-injectivity Π≡Π in x
Π≡Π′ = whrDet* (D₄ , Whnf.Πₙ) (D₄′ , Whnf.Πₙ)
F₄≡F₄′ = let x , _ , _ , _ , _ = Π-PE-injectivity Π≡Π′ in x
G₄≡G₄′ = let _ , _ , _ , x , _ = Π-PE-injectivity Π≡Π′ in x
A₁≡A₂ = PE.subst₂ (λ X Y → Γ ⊢ Π F₁ ^ % ° ⁰ ▹ G₁ ° ⁰ ° ⁰ ≅ Π X ^ % ° ⁰ ▹ Y ° ⁰ ° ⁰ ^ [ ! , ι ⁰ ]) (PE.sym F₂≡F₂′) (PE.sym G₂≡G₂′) A₁≡A₂′
A₃≡A₄ = PE.subst₂ (λ X Y → Γ ⊢ Π F₃ ^ % ° ⁰ ▹ G₃ ° ⁰ ° ⁰ ≅ Π X ^ % ° ⁰ ▹ Y ° ⁰ ° ⁰ ^ [ ! , ι ⁰ ]) (PE.sym F₄≡F₄′) (PE.sym G₄≡G₄′) A₃≡A₄′
[F₁≡F₂] = PE.subst (λ X → ∀ {ρ Δ} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → Δ ⊩⟨ ι ⁰ ⟩ wk ρ F₁ ≡ wk ρ X ^ [ % , ι ⁰ ] / [F₁] [ρ] ⊢Δ)
(PE.sym F₂≡F₂′) [F₁≡F₂′]
[F₃≡F₄] = PE.subst (λ X → ∀ {ρ Δ} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → Δ ⊩⟨ ι ⁰ ⟩ wk ρ F₃ ≡ wk ρ X ^ [ % , ι ⁰ ] / [F₃] [ρ] ⊢Δ)
(PE.sym F₄≡F₄′) [F₃≡F₄′]
[G₁≡G₂] = PE.subst (λ X → ∀ {ρ Δ a} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ)
→ ([a] : Δ ⊩⟨ ι ⁰ ⟩ a ∷ wk ρ F₁ ^ [ % , ι ⁰ ] / [F₁] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ wk (lift ρ) G₁ [ a ] ≡ wk (lift ρ) X [ a ] ^ [ ! , ι ⁰ ] / [G₁] [ρ] ⊢Δ [a])
(PE.sym G₂≡G₂′) [G₁≡G₂′]
[G₃≡G₄] = PE.subst (λ X → ∀ {ρ Δ a} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ)
→ ([a] : Δ ⊩⟨ ι ⁰ ⟩ a ∷ wk ρ F₃ ^ [ % , ι ⁰ ] / [F₃] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ wk (lift ρ) G₃ [ a ] ≡ wk (lift ρ) X [ a ] ^ [ ! , ι ⁰ ] / [G₃] [ρ] ⊢Δ [a])
(PE.sym G₄≡G₄′) [G₃≡G₄′]
[b₁≡b₂] : ∀ {ρ Δ e₁₃ e₂₄ x₃ x₄} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ)
→ (Δ ⊢ e₁₃ ∷ Id (SProp ⁰) (wk ρ F₁) (wk ρ F₃) ^ [ % , ι ¹ ])
→ (Δ ⊢ e₂₄ ∷ Id (SProp ⁰) (wk ρ F₂) (wk ρ F₄) ^ [ % , ι ¹ ])
→ (Δ ⊩⟨ ι ⁰ ⟩ x₃ ∷ wk ρ F₃ ^ [ % , ι ⁰ ] / [F₃] [ρ] ⊢Δ)
→ (Δ ⊩⟨ ι ⁰ ⟩ x₄ ∷ wk ρ F₄ ^ [ % , ι ⁰ ] / [F₄] [ρ] ⊢Δ)
→ (Δ ⊩⟨ ι ⁰ ⟩ x₃ ≡ x₄ ∷ wk ρ F₃ ^ [ % , ι ⁰ ] / [F₃] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ b₁.b ρ e₁₃ x₃ ≡ b₂.b ρ e₂₄ x₄ ∷ wk ρ F₁ ^ [ % , ι ⁰ ] / [F₁] [ρ] ⊢Δ
[b₁≡b₂] [ρ] ⊢Δ ⊢e₁₃ ⊢e₂₄ [x₃] [x₄] [x₃≡x₄] =
let
⊢e₃₁ = Idsymⱼ (univ 0<1 ⊢Δ) (un-univ (escape ([F₁] [ρ] ⊢Δ)))
(un-univ (escape ([F₃] [ρ] ⊢Δ))) ⊢e₁₃
⊢e₄₂ = Idsymⱼ (univ 0<1 ⊢Δ) (un-univ (escape ([F₂] [ρ] ⊢Δ)))
(un-univ (escape ([F₄] [ρ] ⊢Δ))) ⊢e₂₄
in proj₂ ([castext] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₂] [ρ] ⊢Δ) ([F₁≡F₂] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ) ([F₃≡F₄] [ρ] ⊢Δ)) [x₃] [x₄] [x₃≡x₄] ⊢e₃₁ ⊢e₄₂
[b₃≡b₄] : ∀ {ρ Δ e₃₁ e₄₂ x₁ x₂} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ)
→ (Δ ⊢ e₃₁ ∷ Id (SProp ⁰) (wk ρ F₃) (wk ρ F₁) ^ [ % , ι ¹ ])
→ (Δ ⊢ e₄₂ ∷ Id (SProp ⁰) (wk ρ F₄) (wk ρ F₂) ^ [ % , ι ¹ ])
→ (Δ ⊩⟨ ι ⁰ ⟩ x₁ ∷ wk ρ F₁ ^ [ % , ι ⁰ ] / [F₁] [ρ] ⊢Δ)
→ (Δ ⊩⟨ ι ⁰ ⟩ x₂ ∷ wk ρ F₂ ^ [ % , ι ⁰ ] / [F₂] [ρ] ⊢Δ)
→ (Δ ⊩⟨ ι ⁰ ⟩ x₁ ≡ x₂ ∷ wk ρ F₁ ^ [ % , ι ⁰ ] / [F₁] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ b₃.b ρ e₃₁ x₁ ≡ b₄.b ρ e₄₂ x₂ ∷ wk ρ F₃ ^ [ % , ι ⁰ ] / [F₃] [ρ] ⊢Δ
[b₃≡b₄] [ρ] ⊢Δ ⊢e₃₁ ⊢e₄₂ [x₁] [x₂] [x₁≡x₂] =
let
⊢e₁₃ = Idsymⱼ (univ 0<1 ⊢Δ) (un-univ (escape ([F₃] [ρ] ⊢Δ)))
(un-univ (escape ([F₁] [ρ] ⊢Δ))) ⊢e₃₁
⊢e₂₄ = Idsymⱼ (univ 0<1 ⊢Δ) (un-univ (escape ([F₄] [ρ] ⊢Δ)))
(un-univ (escape ([F₂] [ρ] ⊢Δ))) ⊢e₄₂
in proj₁ ([castext] ⊢Δ ([F₁] [ρ] ⊢Δ) ([F₂] [ρ] ⊢Δ) ([F₁≡F₂] [ρ] ⊢Δ) ([F₃] [ρ] ⊢Δ) ([F₄] [ρ] ⊢Δ) ([F₃≡F₄] [ρ] ⊢Δ)) [x₁] [x₂] [x₁≡x₂] ⊢e₁₃ ⊢e₂₄
[castext]₁ : (∀ {t₁ t₂ e₁₃ e₂₄} → ([t₁] : Γ ⊩⟨ ι ⁰ ⟩ t₁ ∷ A₁ ^ [ ! , ι ⁰ ] / [A₁])
→ ([t₁] : Γ ⊩⟨ ι ⁰ ⟩ t₂ ∷ A₂ ^ [ ! , ι ⁰ ] / [A₂])
→ ([t₁≡t₂] : Γ ⊩⟨ ι ⁰ ⟩ t₁ ≡ t₂ ∷ A₁ ^ [ ! , ι ⁰ ] / [A₁])
→ (⊢e₁₃ : Γ ⊢ e₁₃ ∷ Id (U ⁰) A₁ A₃ ^ [ % , ι ¹ ])
→ (⊢e₂₄ : Γ ⊢ e₂₄ ∷ Id (U ⁰) A₂ A₄ ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A₁ A₃ e₁₃ t₁ ≡ cast ⁰ A₂ A₄ e₂₄ t₂ ∷ A₃ ^ [ ! , ι ⁰ ] / [A₃])
[castext]₁ {t₁} {t₂} {e₁₃} {e₂₄}
(f₁ , [[ ⊢t₁ , ⊢f₁ , Df₁ ]] , funf₁ , f₁≡f₁ , [f₁ext] , [f₁])
(f₂ , [[ ⊢t₂ , ⊢f₂ , Df₂ ]] , funf₂ , f₂≡f₂ , [f₂ext] , [f₂])
(f₁′ , f₂′ , [[ _ , ⊢f₁′ , Df₁′ ]] , [[ _ , ⊢f₂′ , Df₂′ ]] , funf₁′ , funf₂′ , _ , _ , _ , [f₁′≡f₂′])
⊢e₁₃ ⊢e₂₄ =
( (lam F₃ ▹ g₁.g (step id) (var 0) ^ ⁰)
, (lam F₄ ▹ g₂.g (step id) (var 0) ^ ⁰)
, g₁.Dg
, conv:* g₂.Dg (sym (≅-eq A₃≡A₄))
, lamₙ
, lamₙ
, g₁≡g₂
, g₁.[castΠΠ]
, convTerm₂ [A₃] [A₄] [A₃≡A₄] g₂.[castΠΠ]
, [g₁a≡g₂a] )
where
f₁≡f₁′ = whrDet*Term (Df₁ , functionWhnf funf₁) (Df₁′ , functionWhnf funf₁′)
f₂≡f₂′ = whrDet*Term (Df₂ , functionWhnf funf₂) (Df₂′ , functionWhnf funf₂′)
[f₁≡f₂] = PE.subst₂ (λ X Y → ∀ {ρ Δ a} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → ([a] : Δ ⊩⟨ ι ⁰ ⟩ a ∷ wk ρ F₁ ^ [ % , ι ⁰ ] / [F₁] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ wk ρ X ∘ a ^ ⁰ ≡ wk ρ Y ∘ a ^ ⁰ ∷ wk (lift ρ) G₁ [ a ] ^ [ ! , ι ⁰ ] / [G₁] [ρ] ⊢Δ [a]) (PE.sym f₁≡f₁′) (PE.sym f₂≡f₂′) [f₁′≡f₂′]
open cast-ΠΠ-lemmas-3 ⊢Γ ⊢A₁ ⊢ΠF₁G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
⊢A₂ ⊢ΠF₂G₂ D₂ ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext
⊢A₃ ⊢ΠF₃G₃ D₃ ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext
⊢A₄ ⊢ΠF₄G₄ D₄ ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext
A₁≡A₂ A₃≡A₄ [F₁≡F₂] [F₃≡F₄] [G₁≡G₂] [G₃≡G₄]
⊢e₁₃ ⊢e₂₄
⊢t₁ Df₁ [f₁ext] [f₁]
⊢t₂ Df₂ [f₂ext] [f₂]
[f₁≡f₂]
(λ [ρ] ⊢Δ [x] [y] → proj₁ ([cast] ⊢Δ ([G₁] [ρ] ⊢Δ [x]) ([G₃] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [x] [y] → proj₁ ([cast] ⊢Δ ([G₂] [ρ] ⊢Δ [x]) ([G₄] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [x] [x′] [x≡x′] [y] [y′] [y≡y′] →
proj₁ ([castext] ⊢Δ ([G₁] [ρ] ⊢Δ [x]) ([G₁] [ρ] ⊢Δ [x′]) (G₁-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₃] [ρ] ⊢Δ [y]) ([G₃] [ρ] ⊢Δ [y′]) (G₃-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
(λ [ρ] ⊢Δ [x] [x′] [x≡x′] [y] [y′] [y≡y′] →
proj₁ ([castext] ⊢Δ ([G₂] [ρ] ⊢Δ [x]) ([G₂] [ρ] ⊢Δ [x′]) (G₂-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₄] [ρ] ⊢Δ [y]) ([G₄] [ρ] ⊢Δ [y′]) (G₄-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
(λ [ρ] ⊢Δ [x₁] [x₂] [G₁x₁≡G₂x₂] [x₃] [x₄] [G₃x₃≡G₄x₄] →
proj₁ ([castext] ⊢Δ ([G₁] [ρ] ⊢Δ [x₁]) ([G₂] [ρ] ⊢Δ [x₂]) [G₁x₁≡G₂x₂]
([G₃] [ρ] ⊢Δ [x₃]) ([G₄] [ρ] ⊢Δ [x₄]) [G₃x₃≡G₄x₄]))
b₁.[b] b₁.[bext] b₂.[b] b₂.[bext] [b₁≡b₂]
[castext]₂ : (∀ {t₃ t₄ e₃₁ e₄₂} → ([t₃] : Γ ⊩⟨ ι ⁰ ⟩ t₃ ∷ A₃ ^ [ ! , ι ⁰ ] / [A₃])
→ ([t₄] : Γ ⊩⟨ ι ⁰ ⟩ t₄ ∷ A₄ ^ [ ! , ι ⁰ ] / [A₄])
→ ([t₃≡t₄] : Γ ⊩⟨ ι ⁰ ⟩ t₃ ≡ t₄ ∷ A₃ ^ [ ! , ι ⁰ ] / [A₃])
→ (⊢e₃₁ : Γ ⊢ e₃₁ ∷ Id (U ⁰) A₃ A₁ ^ [ % , ι ¹ ])
→ (⊢e₄₂ : Γ ⊢ e₄₂ ∷ Id (U ⁰) A₄ A₂ ^ [ % , ι ¹ ])
→ Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A₃ A₁ e₃₁ t₃ ≡ cast ⁰ A₄ A₂ e₄₂ t₄ ∷ A₁ ^ [ ! , ι ⁰ ] / [A₁])
[castext]₂ {t₃} {t₄} {e₃₁} {e₄₂}
(f₃ , [[ ⊢t₃ , ⊢f₃ , Df₃ ]] , funf₃ , f₃≡f₃ , [f₃ext] , [f₃])
(f₄ , [[ ⊢t₄ , ⊢f₄ , Df₄ ]] , funf₄ , f₄≡f₄ , [f₄ext] , [f₄])
(f₃′ , f₄′ , [[ _ , ⊢f₃′ , Df₃′ ]] , [[ _ , ⊢f₄′ , Df₄′ ]] , funf₃′ , funf₄′ , _ , _ , _ , [f₃′≡f₄′])
⊢e₃₁ ⊢e₄₂ =
( (lam F₁ ▹ g₁.g (step id) (var 0) ^ ⁰)
, (lam F₂ ▹ g₂.g (step id) (var 0) ^ ⁰)
, g₁.Dg
, conv:* g₂.Dg (sym (≅-eq A₁≡A₂))
, lamₙ
, lamₙ
, g₁≡g₂
, g₁.[castΠΠ]
, convTerm₂ [A₁] [A₂] [A₁≡A₂] g₂.[castΠΠ]
, [g₁a≡g₂a] )
where
f₃≡f₃′ = whrDet*Term (Df₃ , functionWhnf funf₃) (Df₃′ , functionWhnf funf₃′)
f₄≡f₄′ = whrDet*Term (Df₄ , functionWhnf funf₄) (Df₄′ , functionWhnf funf₄′)
[f₃≡f₄] = PE.subst₂ (λ X Y → ∀ {ρ Δ a} → ([ρ] : ρ Twk.∷ Δ ⊆ Γ) (⊢Δ : ⊢ Δ) → ([a] : Δ ⊩⟨ ι ⁰ ⟩ a ∷ wk ρ F₃ ^ [ % , ι ⁰ ] / [F₃] [ρ] ⊢Δ)
→ Δ ⊩⟨ ι ⁰ ⟩ wk ρ X ∘ a ^ ⁰ ≡ wk ρ Y ∘ a ^ ⁰ ∷ wk (lift ρ) G₃ [ a ] ^ [ ! , ι ⁰ ] / [G₃] [ρ] ⊢Δ [a]) (PE.sym f₃≡f₃′) (PE.sym f₄≡f₄′) [f₃′≡f₄′]
open cast-ΠΠ-lemmas-3 ⊢Γ ⊢A₃ ⊢ΠF₃G₃ D₃ ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext
⊢A₄ ⊢ΠF₄G₄ D₄ ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext
⊢A₁ ⊢ΠF₁G₁ D₁ ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
⊢A₂ ⊢ΠF₂G₂ D₂ ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext
A₃≡A₄ A₁≡A₂ [F₃≡F₄] [F₁≡F₂] [G₃≡G₄] [G₁≡G₂]
⊢e₃₁ ⊢e₄₂
⊢t₃ Df₃ [f₃ext] [f₃]
⊢t₄ Df₄ [f₄ext] [f₄]
[f₃≡f₄]
(λ [ρ] ⊢Δ [y] [x] → proj₂ ([cast] ⊢Δ ([G₁] [ρ] ⊢Δ [x]) ([G₃] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [y] [x] → proj₂ ([cast] ⊢Δ ([G₂] [ρ] ⊢Δ [x]) ([G₄] [ρ] ⊢Δ [y])))
(λ [ρ] ⊢Δ [y] [y′] [y≡y′] [x] [x′] [x≡x′] →
proj₂ ([castext] ⊢Δ ([G₁] [ρ] ⊢Δ [x]) ([G₁] [ρ] ⊢Δ [x′]) (G₁-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₃] [ρ] ⊢Δ [y]) ([G₃] [ρ] ⊢Δ [y′]) (G₃-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
(λ [ρ] ⊢Δ [y] [y′] [y≡y′] [x] [x′] [x≡x′] →
proj₂ ([castext] ⊢Δ ([G₂] [ρ] ⊢Δ [x]) ([G₂] [ρ] ⊢Δ [x′]) (G₂-ext [ρ] ⊢Δ [x] [x′] [x≡x′])
([G₄] [ρ] ⊢Δ [y]) ([G₄] [ρ] ⊢Δ [y′]) (G₄-ext [ρ] ⊢Δ [y] [y′] [y≡y′])))
(λ [ρ] ⊢Δ [x₃] [x₄] [G₃x₃≡G₄x₄] [x₁] [x₂] [G₁x₁≡G₂x₂] →
proj₂ ([castext] ⊢Δ ([G₁] [ρ] ⊢Δ [x₁]) ([G₂] [ρ] ⊢Δ [x₂]) [G₁x₁≡G₂x₂]
([G₃] [ρ] ⊢Δ [x₃]) ([G₄] [ρ] ⊢Δ [x₄]) [G₃x₃≡G₄x₄]))
b₃.[b] b₃.[bext] b₄.[b] b₄.[bext] [b₃≡b₄]
[castextShape] {A₁} {A₂} {A₃} {A₄} {Γ} {r = !} ⊢Γ
_ _
(Πᵥ (Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
(Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext))
(Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′])
_ _
(Πᵥ (Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext)
(Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₄ G₄ [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]] ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext))
(Π₌ F₄′ G₄′ D₄′ A₃≡A₄′ [F₃≡F₄′] [G₃≡G₄′]) =
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let [A₁] = Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
[A₃] = Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext
[A₂] = Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext
⊢t = escapeTerm [A₁] [t]
⊢t′ = escapeTerm [A₂] [t′]
⊢A₁≡Π = subset* D₁
⊢A₃≡Π = subset* D₃
⊢A₂≡Π = subset* D₂
⊢A₄≡Π = subset* D₄
⊢A₃≡A₄ = escapeEq {l = ι ⁰} [A₃] (Π₌ F₄′ G₄′ D₄′ A₃≡A₄′ [F₃≡F₄′] [G₃≡G₄′])
⊢t≡t = ≅-conv (escapeTermEq {l = ι ⁰} [A₁] [t≡t′]) ⊢A₁≡Π
ΠFG′≡ΠFG′₂ = whrDet* (D₂ , Πₙ) (D₂′ , Πₙ)
F′≡F′₂ , _ , _ , G′≡G′₂ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₂
ΠFG′≡ΠFG′₄ = whrDet* (D₄ , Πₙ) (D₄′ , Πₙ)
F′≡F′₄ , _ , _ , G′≡G′₄ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₄
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A₁))) (un-univ≡ ⊢A₁≡Π) (un-univ≡ ⊢A₃≡Π)))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A₁)))
(un-univ≡ (PE.subst (λ X → Γ ⊢ A₂ ≡ X ^ [ ! , ι ⁰ ]) ΠFG′≡ΠFG′₂ ⊢A₂≡Π))
(un-univ≡ (PE.subst (λ X → Γ ⊢ A₄ ≡ X ^ [ ! , ι ⁰ ]) ΠFG′≡ΠFG′₄ ⊢A₄≡Π))))
cast~cast = ~-conv (~-castΠΠ!% (un-univ ⊢F₁) (un-univ ⊢G₁) (≅-un-univ A₁≡A₂′) (un-univ ⊢F₃) (un-univ ⊢G₃) (≅-un-univ A₃≡A₄′) ⊢t≡t ⊢e' ⊢e′') (sym ⊢A₃≡Π)
in neuEqTerm:⇒*: {l = ι ⁰} { n = cast ⁰ (Π F₁ ^ ! ° ⁰ ▹ G₁ ° ⁰ ° ⁰) (Π F₃ ^ % ° ⁰ ▹ G₃ ° ⁰ ° ⁰) e t} {n′ = cast ⁰ (Π F₂ ^ ! ° ⁰ ▹ G₂ ° ⁰ ° ⁰) (Π F₄ ^ % ° ⁰ ▹ G₄ ° ⁰ ° ⁰) e′ t′}
[A₃]
castΠΠ!%ₙ castΠΠ!%ₙ
(transTerm:⇒:* (CastRed*Term ⊢A₃ ⊢e ⊢t (un-univ:⇒*: [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]]))
(CastRed*TermΠ (un-univ ⊢F₁ ) (un-univ ⊢G₁) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A₃) )) (un-univ≡ ⊢A₁≡Π)
(refl (un-univ ⊢A₃))))) (conv ⊢t ⊢A₁≡Π) [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]]))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A₄ ⊢e′ ⊢t′ (un-univ:⇒*: [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]]))
(CastRed*TermΠ (un-univ ⊢F₂ ) (un-univ ⊢G₂) (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A₄) )) (un-univ≡ ⊢A₂≡Π)
(refl (un-univ ⊢A₄))))) (conv ⊢t′ ⊢A₂≡Π) [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]])) (sym (≅-eq ⊢A₃≡A₄)))
(~-irrelevanceTerm PE.refl PE.refl (PE.cong₄ (λ X Y X' Y' → cast ⁰ (Π X ^ ! ° ⁰ ▹ Y ° ⁰ ° ⁰) (Π X' ^ % ° ⁰ ▹ Y' ° ⁰ ° ⁰) _ _ ) (PE.sym F′≡F′₂) (PE.sym G′≡G′₂) (PE.sym F′≡F′₄) (PE.sym G′≡G′₄)) cast~cast)),
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let [A₁] = Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
[A₃] = Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext
[A₄] = Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₄ G₄ [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]] ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext
⊢t = escapeTerm [A₃] [t]
⊢t′ = escapeTerm [A₄] [t′]
⊢A₁≡Π = subset* D₁
⊢A₃≡Π = subset* D₃
⊢A₂≡Π = subset* D₂
⊢A₄≡Π = subset* D₄
ΠFG′≡ΠFG′₂ = whrDet* (D₂ , Πₙ) (D₂′ , Πₙ)
ΠFG′≡ΠFG′₄ = whrDet* (D₄ , Πₙ) (D₄′ , Πₙ)
⊢A₁≡A₂ = escapeEq {l = ι ⁰} [A₁] (Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′])
⊢t≡t = ≅-conv (escapeTermEq {l = ι ⁰} [A₃] [t≡t′]) ⊢A₃≡Π
F′≡F′₄ , _ , _ , G′≡G′₄ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₄
F′≡F′₂ , _ , _ , G′≡G′₂ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₂
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A₁))) (un-univ≡ ⊢A₃≡Π) (un-univ≡ ⊢A₁≡Π)))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A₁)))
(un-univ≡ (PE.subst (λ X → Γ ⊢ A₄ ≡ X ^ [ ! , ι ⁰ ]) ΠFG′≡ΠFG′₄ ⊢A₄≡Π))
(un-univ≡ (PE.subst (λ X → Γ ⊢ A₂ ≡ X ^ [ ! , ι ⁰ ]) ΠFG′≡ΠFG′₂ ⊢A₂≡Π))))
cast~cast = ~-conv (~-castΠΠ%! (un-univ ⊢F₃) (un-univ ⊢G₃) (≅-un-univ A₃≡A₄′) (un-univ ⊢F₁) (un-univ ⊢G₁) (≅-un-univ A₁≡A₂′) ⊢t≡t ⊢e' ⊢e′') (sym ⊢A₁≡Π)
in neuEqTerm:⇒*: {l = ι ⁰} { n = cast ⁰ (Π F₃ ^ % ° ⁰ ▹ G₃ ° ⁰ ° ⁰) (Π F₁ ^ ! ° ⁰ ▹ G₁ ° ⁰ ° ⁰) e t} {n′ = cast ⁰ (Π F₄ ^ % ° ⁰ ▹ G₄ ° ⁰ ° ⁰) (Π F₂ ^ ! ° ⁰ ▹ G₂ ° ⁰ ° ⁰) e′ t′}
[A₁]
castΠΠ%!ₙ castΠΠ%!ₙ
(transTerm:⇒:* (CastRed*Term ⊢A₁ ⊢e ⊢t (un-univ:⇒*: [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]]))
(CastRed*TermΠ (un-univ ⊢F₃ ) (un-univ ⊢G₃) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A₁) )) (un-univ≡ ⊢A₃≡Π)
(refl (un-univ ⊢A₁))))) (conv ⊢t ⊢A₃≡Π) [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]]))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A₂ ⊢e′ ⊢t′ (un-univ:⇒*: [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]]))
(CastRed*TermΠ (un-univ ⊢F₄ ) (un-univ ⊢G₄) (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A₂) )) (un-univ≡ ⊢A₄≡Π)
(refl (un-univ ⊢A₂))))) (conv ⊢t′ ⊢A₄≡Π) [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]])) (sym (≅-eq ⊢A₁≡A₂)))
(~-irrelevanceTerm PE.refl PE.refl (PE.cong₄ (λ X Y X' Y' → cast ⁰ (Π X ^ % ° ⁰ ▹ Y ° ⁰ ° ⁰) (Π X' ^ ! ° ⁰ ▹ Y' ° ⁰ ° ⁰) _ _ ) (PE.sym F′≡F′₄) (PE.sym G′≡G′₄) (PE.sym F′≡F′₂) (PE.sym G′≡G′₂)) cast~cast))
[castextShape] {A₃} {A₄} {A₁} {A₂} {Γ} {r = !} ⊢Γ
_ _
(Πᵥ (Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext)
(Πᵣ % .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₄ G₄ [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]] ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext))
(Π₌ F₄′ G₄′ D₄′ A₃≡A₄′ [F₃≡F₄′] [G₃≡G₄′])
_ _
(Πᵥ (Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext)
(Πᵣ ! .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext))
(Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′]) =
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let [A₁] = Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
[A₃] = Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext
[A₄] = Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₄ G₄ [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]] ⊢F₄ ⊢G₄ A₄≡A₄ [F₄] [G₄] G₄-ext
⊢t = escapeTerm [A₃] [t]
⊢t′ = escapeTerm [A₄] [t′]
⊢A₁≡Π = subset* D₁
⊢A₃≡Π = subset* D₃
⊢A₂≡Π = subset* D₂
⊢A₄≡Π = subset* D₄
ΠFG′≡ΠFG′₂ = whrDet* (D₂ , Πₙ) (D₂′ , Πₙ)
ΠFG′≡ΠFG′₄ = whrDet* (D₄ , Πₙ) (D₄′ , Πₙ)
⊢A₁≡A₂ = escapeEq {l = ι ⁰} [A₁] (Π₌ F₂′ G₂′ D₂′ A₁≡A₂′ [F₁≡F₂′] [G₁≡G₂′])
⊢t≡t = ≅-conv (escapeTermEq {l = ι ⁰} [A₃] [t≡t′]) ⊢A₃≡Π
F′≡F′₄ , _ , _ , G′≡G′₄ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₄
F′≡F′₂ , _ , _ , G′≡G′₂ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₂
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A₁))) (un-univ≡ ⊢A₃≡Π)(un-univ≡ ⊢A₁≡Π) ))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A₁)))
(un-univ≡ (PE.subst (λ X → Γ ⊢ A₄ ≡ X ^ [ ! , ι ⁰ ]) ΠFG′≡ΠFG′₄ ⊢A₄≡Π))
(un-univ≡ (PE.subst (λ X → Γ ⊢ A₂ ≡ X ^ [ ! , ι ⁰ ]) ΠFG′≡ΠFG′₂ ⊢A₂≡Π))))
cast~cast = ~-conv (~-castΠΠ%! (un-univ ⊢F₃) (un-univ ⊢G₃) (≅-un-univ A₃≡A₄′) (un-univ ⊢F₁) (un-univ ⊢G₁) (≅-un-univ A₁≡A₂′) ⊢t≡t ⊢e' ⊢e′') (sym ⊢A₁≡Π)
in neuEqTerm:⇒*: {l = ι ⁰} { n = cast ⁰ (Π F₃ ^ % ° ⁰ ▹ G₃ ° ⁰ ° ⁰) (Π F₁ ^ ! ° ⁰ ▹ G₁ ° ⁰ ° ⁰) e t} {n′ = cast ⁰ (Π F₄ ^ % ° ⁰ ▹ G₄ ° ⁰ ° ⁰) (Π F₂ ^ ! ° ⁰ ▹ G₂ ° ⁰ ° ⁰) e′ t′}
[A₁]
castΠΠ%!ₙ castΠΠ%!ₙ
(transTerm:⇒:* (CastRed*Term ⊢A₁ ⊢e ⊢t (un-univ:⇒*: [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]]))
(CastRed*TermΠ (un-univ ⊢F₃ ) (un-univ ⊢G₃) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A₁) )) (un-univ≡ ⊢A₃≡Π)
(refl (un-univ ⊢A₁))))) (conv ⊢t ⊢A₃≡Π) [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]]))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A₂ ⊢e′ ⊢t′ (un-univ:⇒*: [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]]))
(CastRed*TermΠ (un-univ ⊢F₄ ) (un-univ ⊢G₄) (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A₂) )) (un-univ≡ ⊢A₄≡Π)
(refl (un-univ ⊢A₂))))) (conv ⊢t′ ⊢A₄≡Π) [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]])) (sym (≅-eq ⊢A₁≡A₂)))
(~-irrelevanceTerm PE.refl PE.refl (PE.cong₄ (λ X Y X' Y' → cast ⁰ (Π X ^ % ° ⁰ ▹ Y ° ⁰ ° ⁰) (Π X' ^ ! ° ⁰ ▹ Y' ° ⁰ ° ⁰) _ _ ) (PE.sym F′≡F′₄) (PE.sym G′≡G′₄) (PE.sym F′≡F′₂) (PE.sym G′≡G′₂)) cast~cast)) ,
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let [A₁] = Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₁ G₁ [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]] ⊢F₁ ⊢G₁ A₁≡A₁ [F₁] [G₁] G₁-ext
[A₃] = Πᵣ′ % ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₃ G₃ [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]] ⊢F₃ ⊢G₃ A₃≡A₃ [F₃] [G₃] G₃-ext
[A₂] = Πᵣ′ ! ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F₂ G₂ [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]] ⊢F₂ ⊢G₂ A₂≡A₂ [F₂] [G₂] G₂-ext
⊢t = escapeTerm [A₁] [t]
⊢t′ = escapeTerm [A₂] [t′]
⊢A₁≡Π = subset* D₁
⊢A₃≡Π = subset* D₃
⊢A₂≡Π = subset* D₂
⊢A₄≡Π = subset* D₄
⊢A₃≡A₄ = escapeEq {l = ι ⁰} [A₃] (Π₌ F₄′ G₄′ D₄′ A₃≡A₄′ [F₃≡F₄′] [G₃≡G₄′])
⊢t≡t = ≅-conv (escapeTermEq {l = ι ⁰} [A₁] [t≡t′]) ⊢A₁≡Π
ΠFG′≡ΠFG′₂ = whrDet* (D₂ , Πₙ) (D₂′ , Πₙ)
F′≡F′₂ , _ , _ , G′≡G′₂ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₂
ΠFG′≡ΠFG′₄ = whrDet* (D₄ , Πₙ) (D₄′ , Πₙ)
F′≡F′₄ , _ , _ , G′≡G′₄ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₄
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A₁))) (un-univ≡ ⊢A₁≡Π) (un-univ≡ ⊢A₃≡Π)))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A₁)))
(un-univ≡ (PE.subst (λ X → Γ ⊢ A₂ ≡ X ^ [ ! , ι ⁰ ]) ΠFG′≡ΠFG′₂ ⊢A₂≡Π))
(un-univ≡ (PE.subst (λ X → Γ ⊢ A₄ ≡ X ^ [ ! , ι ⁰ ]) ΠFG′≡ΠFG′₄ ⊢A₄≡Π))))
cast~cast = ~-conv (~-castΠΠ!% (un-univ ⊢F₁) (un-univ ⊢G₁) (≅-un-univ A₁≡A₂′) (un-univ ⊢F₃) (un-univ ⊢G₃) (≅-un-univ A₃≡A₄′) ⊢t≡t ⊢e' ⊢e′') (sym ⊢A₃≡Π)
in neuEqTerm:⇒*: {l = ι ⁰} { n = cast ⁰ (Π F₁ ^ ! ° ⁰ ▹ G₁ ° ⁰ ° ⁰) (Π F₃ ^ % ° ⁰ ▹ G₃ ° ⁰ ° ⁰) e t} {n′ = cast ⁰ (Π F₂ ^ ! ° ⁰ ▹ G₂ ° ⁰ ° ⁰) (Π F₄ ^ % ° ⁰ ▹ G₄ ° ⁰ ° ⁰) e′ t′}
[A₃]
castΠΠ!%ₙ castΠΠ!%ₙ
(transTerm:⇒:* (CastRed*Term ⊢A₃ ⊢e ⊢t (un-univ:⇒*: [[ ⊢A₁ , ⊢ΠF₁G₁ , D₁ ]]))
(CastRed*TermΠ (un-univ ⊢F₁ ) (un-univ ⊢G₁) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A₃) )) (un-univ≡ ⊢A₁≡Π)
(refl (un-univ ⊢A₃))))) (conv ⊢t ⊢A₁≡Π) [[ ⊢A₃ , ⊢ΠF₃G₃ , D₃ ]]))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A₄ ⊢e′ ⊢t′ (un-univ:⇒*: [[ ⊢A₂ , ⊢ΠF₂G₂ , D₂ ]]))
(CastRed*TermΠ (un-univ ⊢F₂ ) (un-univ ⊢G₂) (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A₄) )) (un-univ≡ ⊢A₂≡Π)
(refl (un-univ ⊢A₄))))) (conv ⊢t′ ⊢A₂≡Π) [[ ⊢A₄ , ⊢ΠF₄G₄ , D₄ ]])) (sym (≅-eq ⊢A₃≡A₄)))
(~-irrelevanceTerm PE.refl PE.refl (PE.cong₄ (λ X Y X' Y' → cast ⁰ (Π X ^ ! ° ⁰ ▹ Y ° ⁰ ° ⁰) (Π X' ^ % ° ⁰ ▹ Y' ° ⁰ ° ⁰) _ _ ) (PE.sym F′≡F′₂) (PE.sym G′≡G′₂) (PE.sym F′≡F′₄) (PE.sym G′≡G′₄)) cast~cast))
[castextShape] {A} {C} {B} {D} {Γ} ⊢Γ .(ℕᵣ ℕA₁) .(ℕᵣ ℕB₁) (ℕᵥ ℕA₁ ℕB₁) [A≡C] .(ℕᵣ ℕA) .(ℕᵣ ℕB) (ℕᵥ ℕA ℕB) [B≡D] =
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ → [castext]ℕ ⊢Γ ℕA₁ ℕB₁ [A≡C] ℕA ℕB [B≡D] (escapeTerm {l = ι ⁰} (ℕᵣ ℕA₁) [t]) (escapeTerm {l = ι ⁰} (ℕᵣ ℕB₁) [t′]) [t≡t′] ⊢e ⊢e′ ) ,
λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ → [castext]ℕ ⊢Γ ℕA ℕB [B≡D] ℕA₁ ℕB₁ [A≡C] (escapeTerm {l = ι ⁰} (ℕᵣ ℕA) [t]) (escapeTerm {l = ι ⁰} (ℕᵣ ℕB) [t′]) [t≡t′] ⊢e ⊢e′
[castextShape] {A} {C} {B} {D} {Γ} ⊢Γ .(ne neA) .(ne neB) (ne neA neB) [A≡C] .(ℕᵣ ℕA) .(ℕᵣ ℕB) (ℕᵥ ℕA ℕB) [B≡D] =
([castext]Ne ⊢Γ neA neB [A≡C] (ℕᵣ ℕA) (ℕᵣ ℕB) [B≡D]) ,
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let ne K [[ ⊢A , ⊢K , D ]] neK K≡K = neA
ne₌ K′ [[ ⊢A′ , ⊢K′ , D′ ]] neK' K≡K' = [A≡C]
⊢B≡ℕ = subset* (red ℕA)
⊢t = conv (escapeTerm {l = ι ⁰} (ℕᵣ ℕA) [t]) ⊢B≡ℕ
⊢D≡ℕ = subset* (red ℕB)
⊢t′ = conv (escapeTerm {l = ι ⁰} (ℕᵣ ℕB) [t′]) ⊢D≡ℕ
t≅t′ = escapeTermEq {l = ι ⁰} (ℕᵣ ℕA) [t≡t′]
⊢A≡K = subset* D
⊢C≡K = subset* D′
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A))) (un-univ≡ ⊢B≡ℕ) (un-univ≡ ⊢A≡K)))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A))) (un-univ≡ ⊢D≡ℕ) (un-univ≡ ⊢C≡K)))
in neₜ₌ (cast ⁰ ℕ K e t) (cast ⁰ ℕ K′ e′ t′)
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A ⊢e (escapeTerm {l = ι ⁰} (ℕᵣ ℕA) [t]) (un-univ:⇒*: ℕA))
(CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A) )) (un-univ≡ ⊢B≡ℕ)
(refl (un-univ ⊢A))))) ⊢t [[ ⊢A , ⊢K , D ]])) (subset* D))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A′ ⊢e′ (escapeTerm {l = ι ⁰} (ℕᵣ ℕB) [t′]) (un-univ:⇒*: ℕB))
(CastRed*Termℕ (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A′) )) (un-univ≡ ⊢D≡ℕ)
(refl (un-univ ⊢A′))))) ⊢t′ [[ ⊢A′ , ⊢K′ , D′ ]]))
(trans (subset* D′) (sym (≅-eq (≅-univ (~-to-≅ₜ K≡K'))))))
(neNfₜ₌ (castℕₙ neK) (castℕₙ neK') (~-castℕ ⊢Γ K≡K' (≅-conv t≅t′ ⊢B≡ℕ) ⊢e' ⊢e′')))
[castextShape] {A} {C} {B} {D} {Γ} {r = !} ⊢Γ _ _ (Πᵥ (Πᵣ rF .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext)
(Πᵣ rF′ .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F′ G′ [[ ⊢C , ⊢Π′ , DΠB ]] ⊢F′ ⊢G′ C≡C [F]′ [G]′ G-ext′))
(Π₌ F′₁ G′₁ D₌ A≡B [F≡F′] [G≡G′]) .(ℕᵣ ℕA) .(ℕᵣ ℕB) (ℕᵥ ℕA ℕB) [B≡D] =
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let ΠA = Πᵣ rF ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext
ΠB = Πᵣ rF′ ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F′ G′ [[ ⊢C , ⊢Π′ , DΠB ]] ⊢F′ ⊢G′ C≡C [F]′ [G]′ G-ext′
⊢A≡Π = subset* DΠA
[[ _ , _ , DB ]] = ℕA
⊢B≡ℕ = subset* DB
[[ _ , _ , DD ]] = ℕB
⊢D≡ℕ = subset* DD
⊢t = conv (escapeTerm {l = ι ⁰} (Πᵣ ΠA) [t]) ⊢A≡Π
⊢C≡Π = subset* DΠB
⊢t′ = conv (escapeTerm {l = ι ⁰} (Πᵣ ΠB) [t′]) ⊢C≡Π
t≅t′ = escapeTermEq {l = ι ⁰} (Πᵣ ΠA) [t≡t′]
ΠFG′≡ΠFG′₁ = whrDet* (DΠB , Πₙ) (D₌ , Πₙ)
F′≡F′₁ , rF≡rF′ , _ , G′≡G′₁ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₁
⊢B = escape {l = ι ⁰} (ℕᵣ ℕA)
⊢D = escape {l = ι ⁰} (ℕᵣ ℕB)
⊢B≡D = escapeEq {l = ι ⁰} (ℕᵣ ℕA) [B≡D]
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A))) (un-univ≡ ⊢A≡Π) (un-univ≡ ⊢B≡ℕ)))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A)))
(un-univ≡ (PE.subst (λ X → Γ ⊢ C ≡ X ^ [ ! , ι ⁰ ])
(PE.cong₃ (λ X Y Z → Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) F′≡F′₁ rF≡rF′ G′≡G′₁) ⊢C≡Π))
(un-univ≡ ⊢D≡ℕ)))
cast~cast = ~-irrelevanceTerm PE.refl PE.refl (PE.cong₃ (λ X Y Z → cast ⁰ (Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) _ _ _ ) (PE.sym F′≡F′₁) (PE.sym rF≡rF′) (PE.sym G′≡G′₁) )
(~-castΠℕ (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ A≡B) (≅-conv t≅t′ ⊢A≡Π) ⊢e' ⊢e′')
in neuEqTerm:⇒*: {l = ι ⁰} { n = cast ⁰ (Π F ^ rF ° ⁰ ▹ G ° ⁰ ° ⁰) ℕ e t} {n′ = cast ⁰ (Π F′ ^ rF′ ° ⁰ ▹ G′ ° ⁰ ° ⁰) ℕ e′ t′} (ℕᵣ ℕA)
castΠℕₙ castΠℕₙ
(transTerm:⇒:* (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (Πᵣ ΠA) [t]) (un-univ:⇒*: [[ ⊢A , ⊢Π , DΠA ]]))
(CastRed*TermΠ (un-univ ⊢F) (un-univ ⊢G) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A) )) (un-univ≡ ⊢A≡Π)
(refl (un-univ ⊢B))))) ⊢t ℕA))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢D ⊢e′ (escapeTerm {l = ι ⁰} (Πᵣ ΠB) [t′]) (un-univ:⇒*: [[ ⊢C , ⊢Π′ , DΠB ]]))
(CastRed*TermΠ (un-univ ⊢F′) (un-univ ⊢G′) (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢C) )) (un-univ≡ ⊢C≡Π)
(refl (un-univ ⊢D))))) ⊢t′ ℕB)) (sym (≅-eq ⊢B≡D)))
(~-conv cast~cast (sym (subset* (red ℕA))))),
λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let ΠA = Πᵣ rF ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext
⊢A≡Π = subset* DΠA
⊢B≡ℕ = subset* (red ℕA)
⊢D≡ℕ = subset* (red ℕB)
⊢t = conv (escapeTerm {l = ι ⁰} (ℕᵣ ℕA) [t]) ⊢B≡ℕ
⊢C≡Π = subset* DΠB
⊢t′ = conv (escapeTerm {l = ι ⁰} (ℕᵣ ℕB) [t′]) ⊢D≡ℕ
t≅t′ = escapeTermEq {l = ι ⁰} (ℕᵣ ℕA) [t≡t′]
ΠFG′≡ΠFG′₁ = whrDet* (DΠB , Πₙ) (D₌ , Πₙ)
F′≡F′₁ , rF≡rF′ , _ , G′≡G′₁ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₁
⊢B = escape {l = ι ⁰} (ℕᵣ ℕA)
⊢D = escape {l = ι ⁰} (ℕᵣ ℕB)
⊢A≡C = escapeEq {l = ι ⁰} (Πᵣ ΠA) (Π₌ F′₁ G′₁ D₌ A≡B [F≡F′] [G≡G′])
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A))) (un-univ≡ ⊢B≡ℕ) (un-univ≡ ⊢A≡Π)))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A)))
(un-univ≡ ⊢D≡ℕ)
(un-univ≡ (PE.subst (λ X → Γ ⊢ C ≡ X ^ [ ! , ι ⁰ ])
(PE.cong₃ (λ X Y Z → Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) F′≡F′₁ rF≡rF′ G′≡G′₁) ⊢C≡Π))))
cast~cast = ~-irrelevanceTerm PE.refl PE.refl (PE.cong₃ (λ X Y Z → cast ⁰ _ (Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) _ _ ) (PE.sym F′≡F′₁) (PE.sym rF≡rF′) (PE.sym G′≡G′₁) )
(~-castℕΠ (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ A≡B) (≅-conv t≅t′ ⊢B≡ℕ) ⊢e' ⊢e′')
in neuEqTerm:⇒*: { n = cast ⁰ ℕ (Π F ^ rF ° ⁰ ▹ G ° ⁰ ° ⁰) e t} {n′ = cast ⁰ ℕ (Π F′ ^ rF′ ° ⁰ ▹ G′ ° ⁰ ° ⁰) e′ t′} (Πᵣ ΠA)
castℕΠₙ castℕΠₙ
(transTerm:⇒:* (CastRed*Term ⊢A ⊢e (escapeTerm {l = ι ⁰} (ℕᵣ ℕA) [t]) (un-univ:⇒*: ℕA))
(CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A) )) (un-univ≡ ⊢B≡ℕ)
(refl (un-univ ⊢A)))))
⊢t [[ ⊢A , ⊢Π , DΠA ]]))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢C ⊢e′ (escapeTerm {l = ι ⁰} (ℕᵣ ℕB) [t′]) (un-univ:⇒*: ℕB))
(CastRed*Termℕ (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢C) )) (un-univ≡ ⊢D≡ℕ)
(refl (un-univ ⊢C))))) ⊢t′ [[ ⊢C , ⊢Π′ , DΠB ]])) (sym (≅-eq ⊢A≡C)))
(~-conv cast~cast (sym (subset* DΠA)))
[castextShape] {A} {C} {B} {D} {Γ} ⊢Γ .(ℕᵣ ℕA) .(ℕᵣ ℕB) (ℕᵥ ℕA ℕB) [A≡C] .(ne neA) .(ne neB) (ne neA neB) [B≡D] =
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let ne K [[ ⊢A , ⊢K , D ]] neK K≡K = neA
ne₌ K′ [[ ⊢A′ , ⊢K′ , D′ ]] neK' K≡K' = [B≡D]
⊢B≡ℕ = subset* (red ℕA)
⊢A≡K = subset* D
⊢C≡K = subset* D′
⊢t = conv (escapeTerm {l = ι ⁰} (ℕᵣ ℕA) [t]) ⊢B≡ℕ
⊢D≡ℕ = subset* (red ℕB)
⊢t′ = conv (escapeTerm {l = ι ⁰} (ℕᵣ ℕB) [t′]) ⊢D≡ℕ
t≅t′ = escapeTermEq {l = ι ⁰} (ℕᵣ ℕA) [t≡t′]
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A))) (un-univ≡ ⊢B≡ℕ) (un-univ≡ ⊢A≡K)))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A))) (un-univ≡ ⊢D≡ℕ) (un-univ≡ ⊢C≡K)))
in neₜ₌ (cast ⁰ ℕ K e t) (cast ⁰ ℕ K′ e′ t′)
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A ⊢e (escapeTerm {l = ι ⁰} (ℕᵣ ℕA) [t]) (un-univ:⇒*: ℕA))
(CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A) )) (un-univ≡ ⊢B≡ℕ)
(refl (un-univ ⊢A))))) ⊢t [[ ⊢A , ⊢K , D ]])) (subset* D))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢A′ ⊢e′ (escapeTerm {l = ι ⁰} (ℕᵣ ℕB) [t′]) (un-univ:⇒*: ℕB))
(CastRed*Termℕ (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A′) )) (un-univ≡ ⊢D≡ℕ)
(refl (un-univ ⊢A′))))) ⊢t′ [[ ⊢A′ , ⊢K′ , D′ ]]))
(trans (subset* D′) (sym (≅-eq (≅-univ (~-to-≅ₜ K≡K'))))))
(neNfₜ₌ (castℕₙ neK) (castℕₙ neK') (~-castℕ ⊢Γ K≡K' (≅-conv t≅t′ ⊢B≡ℕ) ⊢e' ⊢e′'))) ,
([castext]Ne ⊢Γ neA neB [B≡D] (ℕᵣ ℕA) (ℕᵣ ℕB) [A≡C])
[castextShape] {A} {C} {B} {D} {Γ} {r = !} ⊢Γ .(ne neA₁) .(ne neB₁) (ne neA₁ neB₁) [A≡C] .(ne neA) .(ne neB) (ne neA neB) [B≡D] =
([castext]Ne ⊢Γ neA₁ neB₁ [A≡C] (ne neA) (ne neB) [B≡D]) , ([castext]Ne ⊢Γ neA neB [B≡D] (ne neA₁) (ne neB₁) [A≡C])
[castextShape] {A} {C} {B} {D} {Γ} {r = !} ⊢Γ _ _ (Πᵥ (Πᵣ rF .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext)
(Πᵣ rF′ .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F′ G′ [[ ⊢C , ⊢Π′ , DΠB ]] ⊢F′ ⊢G′ C≡C [F]′ [G]′ G-ext′))
(Π₌ F′₁ G′₁ D₌ A≡B [F≡F′] [G≡G′]) .(ne neA) .(ne neB) (ne neA neB) [B≡D] =
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let ne K [[ ⊢B , ⊢K , D ]] neK K≡K = neA
ne₌ K′ [[ ⊢D , ⊢K′ , D′ ]] neK' K≡K' = [B≡D]
ΠA = Πᵣ rF ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext
ΠB = Πᵣ rF′ ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F′ G′ [[ ⊢C , ⊢Π′ , DΠB ]] ⊢F′ ⊢G′ C≡C [F]′ [G]′ G-ext′
⊢A≡Π = subset* DΠA
⊢B≡K = subset* D
⊢D≡K = subset* D′
⊢t = conv (escapeTerm {l = ι ⁰} (Πᵣ ΠA) [t]) ⊢A≡Π
⊢C≡Π = subset* DΠB
⊢t′ = conv (escapeTerm {l = ι ⁰} (Πᵣ ΠB) [t′]) ⊢C≡Π
t≅t′ = escapeTermEq {l = ι ⁰} (Πᵣ ΠA) [t≡t′]
ΠFG′≡ΠFG′₁ = whrDet* (DΠB , Πₙ) (D₌ , Πₙ)
⊢B≡D = escapeEq {l = ι ⁰} (ne neA) [B≡D]
F′≡F′₁ , rF≡rF′ , _ , G′≡G′₁ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₁
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A))) (un-univ≡ ⊢A≡Π) (un-univ≡ ⊢B≡K)))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A)))
(un-univ≡ (PE.subst (λ X → Γ ⊢ C ≡ X ^ [ ! , ι ⁰ ])
(PE.cong₃ (λ X Y Z → Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) F′≡F′₁ rF≡rF′ G′≡G′₁) ⊢C≡Π))
(un-univ≡ ⊢D≡K)))
in neuEqTerm:⇒*: {l = ι ⁰} {n = cast ⁰ (Π F ^ rF ° ⁰ ▹ G ° ⁰ ° ⁰) K e t} {n′ = cast ⁰ (Π F′ ^ rF′ ° ⁰ ▹ G′ ° ⁰ ° ⁰) K′ e′ t′}
(ne neA) (castΠₙ neK) (castΠₙ neK')
(transTerm:⇒:* (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (Πᵣ ΠA) [t]) (un-univ:⇒*: [[ ⊢A , ⊢Π , DΠA ]]))
(CastRed*TermΠ (un-univ ⊢F) (un-univ ⊢G) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A) )) (un-univ≡ ⊢A≡Π)
(refl (un-univ ⊢B))))) ⊢t [[ ⊢B , ⊢K , D ]]))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢D ⊢e′ (escapeTerm {l = ι ⁰} (Πᵣ ΠB) [t′]) (un-univ:⇒*: [[ ⊢C , ⊢Π′ , DΠB ]]))
(CastRed*TermΠ (un-univ ⊢F′) (un-univ ⊢G′) (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢C) )) (un-univ≡ ⊢C≡Π)
(refl (un-univ ⊢D))))) ⊢t′ [[ ⊢D , ⊢K′ , D′ ]]))
(sym (≅-eq ⊢B≡D)))
(~-irrelevanceTerm PE.refl PE.refl (PE.cong₃ (λ X Y Z → cast ⁰ (Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) _ _ _ ) (PE.sym F′≡F′₁) (PE.sym rF≡rF′) (PE.sym G′≡G′₁) )
(~-conv (~-castΠ (≅-un-univ A≡B) K≡K' (≅-conv t≅t′ ⊢A≡Π) ⊢e' ⊢e′') (sym (subset* D))))) ,
([castext]Ne ⊢Γ neA neB [B≡D] (Πᵣ′ rF ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext)
(Πᵣ′ rF′ ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F′ G′ [[ ⊢C , ⊢Π′ , DΠB ]] ⊢F′ ⊢G′ C≡C [F]′ [G]′ G-ext′) (Π₌ F′₁ G′₁ D₌ A≡B [F≡F′] [G≡G′]))
[castextShape] {A} {C} {B} {D} {Γ} {r = !} ⊢Γ .(ℕᵣ ℕA) .(ℕᵣ ℕB) (ℕᵥ ℕA ℕB) [B≡D]
_ _ (Πᵥ (Πᵣ rF .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext)
(Πᵣ rF′ .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F′ G′ [[ ⊢C , ⊢Π′ , DΠB ]] ⊢F′ ⊢G′ C≡C [F]′ [G]′ G-ext′))
(Π₌ F′₁ G′₁ D₌ A≡B [F≡F′] [G≡G′]) =
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let ΠA = Πᵣ rF ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext
⊢A≡Π = subset* DΠA
⊢B≡ℕ = subset* (red ℕA)
⊢D≡ℕ = subset* (red ℕB)
⊢t = conv (escapeTerm {l = ι ⁰} (ℕᵣ ℕA) [t]) ⊢B≡ℕ
⊢C≡Π = subset* DΠB
⊢t′ = conv (escapeTerm {l = ι ⁰} (ℕᵣ ℕB) [t′]) ⊢D≡ℕ
t≅t′ = escapeTermEq {l = ι ⁰} (ℕᵣ ℕA) [t≡t′]
ΠFG′≡ΠFG′₁ = whrDet* (DΠB , Πₙ) (D₌ , Πₙ)
F′≡F′₁ , rF≡rF′ , _ , G′≡G′₁ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₁
⊢B = escape {l = ι ⁰} (ℕᵣ ℕA)
⊢D = escape {l = ι ⁰} (ℕᵣ ℕB)
⊢A≡C = escapeEq {l = ι ⁰} (Πᵣ ΠA) (Π₌ F′₁ G′₁ D₌ A≡B [F≡F′] [G≡G′])
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A))) (un-univ≡ ⊢B≡ℕ) (un-univ≡ ⊢A≡Π)))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A)))
(un-univ≡ ⊢D≡ℕ)
(un-univ≡ (PE.subst (λ X → Γ ⊢ D ≡ X ^ [ ! , ι ⁰ ])
(PE.cong₃ (λ X Y Z → Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) F′≡F′₁ rF≡rF′ G′≡G′₁) ⊢C≡Π))))
cast~cast = ~-irrelevanceTerm PE.refl PE.refl (PE.cong₃ (λ X Y Z → cast ⁰ _ (Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) _ _ ) (PE.sym F′≡F′₁) (PE.sym rF≡rF′) (PE.sym G′≡G′₁) )
(~-castℕΠ (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ A≡B) (≅-conv t≅t′ ⊢B≡ℕ) ⊢e' ⊢e′')
in neuEqTerm:⇒*: {l = ι ⁰} { n = cast ⁰ ℕ (Π F ^ rF ° ⁰ ▹ G ° ⁰ ° ⁰) e t} {n′ = cast ⁰ ℕ (Π F′ ^ rF′ ° ⁰ ▹ G′ ° ⁰ ° ⁰) e′ t′} (Πᵣ ΠA)
castℕΠₙ castℕΠₙ
(transTerm:⇒:* (CastRed*Term ⊢A ⊢e (escapeTerm {l = ι ⁰} (ℕᵣ ℕA) [t]) (un-univ:⇒*: ℕA))
(CastRed*Termℕ (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A) )) (un-univ≡ ⊢B≡ℕ)
(refl (un-univ ⊢A)))))
⊢t [[ ⊢A , ⊢Π , DΠA ]]))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢C ⊢e′ (escapeTerm {l = ι ⁰} (ℕᵣ ℕB) [t′]) (un-univ:⇒*: ℕB))
(CastRed*Termℕ (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢C) )) (un-univ≡ ⊢D≡ℕ)
(refl (un-univ ⊢C))))) ⊢t′ [[ ⊢C , ⊢Π′ , DΠB ]])) (sym (≅-eq ⊢A≡C)))
(~-conv cast~cast (sym (subset* DΠA)))) ,
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let ΠA = Πᵣ rF ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext
ΠB = Πᵣ rF′ ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F′ G′ [[ ⊢C , ⊢Π′ , DΠB ]] ⊢F′ ⊢G′ C≡C [F]′ [G]′ G-ext′
⊢A≡Π = subset* DΠA
⊢t = conv (escapeTerm {l = ι ⁰} (Πᵣ ΠA) [t]) ⊢A≡Π
⊢C≡Π = subset* DΠB
⊢t′ = conv (escapeTerm {l = ι ⁰} (Πᵣ ΠB) [t′]) ⊢C≡Π
t≅t′ = escapeTermEq {l = ι ⁰} (Πᵣ ΠA) [t≡t′]
ΠFG′≡ΠFG′₁ = whrDet* (DΠB , Πₙ) (D₌ , Πₙ)
F′≡F′₁ , rF≡rF′ , _ , G′≡G′₁ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₁
⊢B = escape {l = ι ⁰} (ℕᵣ ℕA)
⊢D = escape {l = ι ⁰} (ℕᵣ ℕB)
⊢B≡ℕ = subset* (red ℕA)
⊢D≡ℕ = subset* (red ℕB)
⊢B≡D = escapeEq {l = ι ⁰} (ℕᵣ ℕA) [B≡D]
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A))) (un-univ≡ ⊢A≡Π) (un-univ≡ ⊢B≡ℕ)))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A)))
(un-univ≡ (PE.subst (λ X → Γ ⊢ D ≡ X ^ [ ! , ι ⁰ ])
(PE.cong₃ (λ X Y Z → Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) F′≡F′₁ rF≡rF′ G′≡G′₁) ⊢C≡Π))
(un-univ≡ ⊢D≡ℕ)))
cast~cast = ~-irrelevanceTerm PE.refl PE.refl (PE.cong₃ (λ X Y Z → cast ⁰ (Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) _ _ _ ) (PE.sym F′≡F′₁) (PE.sym rF≡rF′) (PE.sym G′≡G′₁) )
(~-castΠℕ (un-univ ⊢F) (un-univ ⊢G) (≅-un-univ A≡B) (≅-conv t≅t′ ⊢A≡Π) ⊢e' ⊢e′')
in neuEqTerm:⇒*: {l = ι ⁰} { n = cast ⁰ (Π F ^ rF ° ⁰ ▹ G ° ⁰ ° ⁰) ℕ e t} {n′ = cast ⁰ (Π F′ ^ rF′ ° ⁰ ▹ G′ ° ⁰ ° ⁰) ℕ e′ t′} (ℕᵣ ℕA)
castΠℕₙ castΠℕₙ
(transTerm:⇒:* (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (Πᵣ ΠA) [t]) (un-univ:⇒*: [[ ⊢A , ⊢Π , DΠA ]]))
(CastRed*TermΠ (un-univ ⊢F) (un-univ ⊢G) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A) )) (un-univ≡ ⊢A≡Π)
(refl (un-univ ⊢B))))) ⊢t ℕA))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢D ⊢e′ (escapeTerm {l = ι ⁰} (Πᵣ ΠB) [t′]) (un-univ:⇒*: [[ ⊢C , ⊢Π′ , DΠB ]]))
(CastRed*TermΠ (un-univ ⊢F′) (un-univ ⊢G′) (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢C) )) (un-univ≡ ⊢C≡Π)
(refl (un-univ ⊢D))))) ⊢t′ ℕB)) (sym (≅-eq ⊢B≡D)))
(~-conv cast~cast (sym (subset* (red ℕA)))))
[castextShape] {A} {C} {B} {D} {Γ} {r = !} ⊢Γ .(ne neA) .(ne neB) (ne neA neB) [B≡D]
_ _ (Πᵥ (Πᵣ rF .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext)
(Πᵣ rF′ .⁰ .⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F′ G′ [[ ⊢C , ⊢Π′ , DΠB ]] ⊢F′ ⊢G′ C≡C [F]′ [G]′ G-ext′))
(Π₌ F′₁ G′₁ D₌ A≡B [F≡F′] [G≡G′]) =
([castext]Ne ⊢Γ neA neB [B≡D] (Πᵣ′ rF ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext)
(Πᵣ′ rF′ ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F′ G′ [[ ⊢C , ⊢Π′ , DΠB ]] ⊢F′ ⊢G′ C≡C [F]′ [G]′ G-ext′) (Π₌ F′₁ G′₁ D₌ A≡B [F≡F′] [G≡G′])) ,
(λ {t} {t′} {e} {e′} [t] [t′] [t≡t′] ⊢e ⊢e′ →
let ne K [[ ⊢B , ⊢K , DB ]] neK K≡K = neA
ne₌ K′ [[ ⊢D , ⊢K′ , D′ ]] neK' K≡K' = [B≡D]
ΠA = Πᵣ rF ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F G [[ ⊢A , ⊢Π , DΠA ]] ⊢F ⊢G A≡A [F] [G] G-ext
ΠB = Πᵣ rF′ ⁰ ⁰ (≡is≤ PE.refl) (≡is≤ PE.refl) F′ G′ [[ ⊢C , ⊢Π′ , DΠB ]] ⊢F′ ⊢G′ C≡C [F]′ [G]′ G-ext′
⊢A≡Π = subset* DΠA
⊢t = conv (escapeTerm {l = ι ⁰} (Πᵣ ΠA) [t]) ⊢A≡Π
⊢C≡Π = subset* DΠB
⊢t′ = conv (escapeTerm {l = ι ⁰} (Πᵣ ΠB) [t′]) ⊢C≡Π
t≅t′ = escapeTermEq {l = ι ⁰} (Πᵣ ΠA) [t≡t′]
ΠFG′≡ΠFG′₁ = whrDet* (DΠB , Πₙ) (D₌ , Πₙ)
⊢B≡K = subset* DB
⊢D≡K = subset* D′
⊢B≡D = escapeEq {l = ι ⁰} (ne neA) [B≡D]
F′≡F′₁ , rF≡rF′ , _ , G′≡G′₁ , _ = Π-PE-injectivity ΠFG′≡ΠFG′₁
⊢e' = conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A))) (un-univ≡ ⊢A≡Π) (un-univ≡ ⊢B≡K)))
⊢e′' = conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢A)))
(un-univ≡ (PE.subst (λ X → Γ ⊢ D ≡ X ^ [ ! , ι ⁰ ])
(PE.cong₃ (λ X Y Z → Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) F′≡F′₁ rF≡rF′ G′≡G′₁) ⊢C≡Π))
(un-univ≡ ⊢D≡K)))
in neuEqTerm:⇒*: {l = ι ⁰} {n = cast ⁰ (Π F ^ rF ° ⁰ ▹ G ° ⁰ ° ⁰) K e t} {n′ = cast ⁰ (Π F′ ^ rF′ ° ⁰ ▹ G′ ° ⁰ ° ⁰) K′ e′ t′}
(ne neA) (castΠₙ neK) (castΠₙ neK')
(transTerm:⇒:* (CastRed*Term ⊢B ⊢e (escapeTerm {l = ι ⁰} (Πᵣ ΠA) [t]) (un-univ:⇒*: [[ ⊢A , ⊢Π , DΠA ]]))
(CastRed*TermΠ (un-univ ⊢F) (un-univ ⊢G) (conv ⊢e (univ (Id-cong (refl (univ 0<1 (wf ⊢A) )) (un-univ≡ ⊢A≡Π)
(refl (un-univ ⊢B))))) ⊢t [[ ⊢B , ⊢K , DB ]]))
(conv:⇒*: (transTerm:⇒:* (CastRed*Term ⊢D ⊢e′ (escapeTerm {l = ι ⁰} (Πᵣ ΠB) [t′]) (un-univ:⇒*: [[ ⊢C , ⊢Π′ , DΠB ]]))
(CastRed*TermΠ (un-univ ⊢F′) (un-univ ⊢G′) (conv ⊢e′ (univ (Id-cong (refl (univ 0<1 (wf ⊢C) )) (un-univ≡ ⊢C≡Π)
(refl (un-univ ⊢D))))) ⊢t′ [[ ⊢D , ⊢K′ , D′ ]]))
(sym (≅-eq ⊢B≡D)))
(~-irrelevanceTerm PE.refl PE.refl (PE.cong₃ (λ X Y Z → cast ⁰ (Π X ^ Y ° ⁰ ▹ Z ° ⁰ ° ⁰) _ _ _ ) (PE.sym F′≡F′₁) (PE.sym rF≡rF′) (PE.sym G′≡G′₁) )
(~-conv (~-castΠ (≅-un-univ A≡B) K≡K' (≅-conv t≅t′ ⊢A≡Π) ⊢e' ⊢e′') (sym (subset* DB)))))
[castextShape] {A} {C} {B} {D} {Γ} {r = %} ⊢Γ [A] [C] _ [A≡C] [B] [D] _ [B≡D] =
[castext]irr {A} {C} {B} {D} {Γ} ⊢Γ [A] [C] [A≡C] [B] [D] [B≡D] , [castext]irr {B} {D} {A} {C} {Γ} ⊢Γ [B] [D] [B≡D] [A] [C] [A≡C]
[castext] {A} {C} {B} {D} {Γ} ⊢Γ [A] [C] [A≡C] [B] [D] [B≡D] = [castextShape] ⊢Γ [A] [C] (goodCases [A] [C] [A≡C]) [A≡C] [B] [D] (goodCases [B] [D] [B≡D]) [B≡D]
cast∞ : ∀ {A B r t e Γ}
(⊢Γ : ⊢ Γ)
([U] : Γ ⊩⟨ ∞ ⟩ Univ r ⁰ ^ [ ! , ι ¹ ])
([AU] : Γ ⊩⟨ ∞ ⟩ A ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U])
([BU] : Γ ⊩⟨ ∞ ⟩ B ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U])
([A] : Γ ⊩⟨ ∞ ⟩ A ^ [ r , ι ⁰ ])
([B] : Γ ⊩⟨ ∞ ⟩ B ^ [ r , ι ⁰ ])
([t] : Γ ⊩⟨ ∞ ⟩ t ∷ A ^ [ r , ι ⁰ ] / [A])
([Id] : Γ ⊩⟨ ∞ ⟩ Id (Univ r ⁰) A B ^ [ % , ι ¹ ]) →
([e] : Γ ⊩⟨ ∞ ⟩ e ∷ Id (Univ r ⁰) A B ^ [ % , ι ¹ ] / [Id] ) →
Γ ⊩⟨ ∞ ⟩ cast ⁰ A B e t ∷ B ^ [ r , ι ⁰ ] / [B]
cast∞ {A} {B} {r} {t} {e} {Γ} ⊢Γ [U] [AU] [BU] [A] [B] [t] [Id] [e] =
let
[A]′ : Γ ⊩⟨ ι ⁰ ⟩ A ^ [ r , ι ⁰ ]
[A]′ = univEq [U] [AU]
[B]′ : Γ ⊩⟨ ι ⁰ ⟩ B ^ [ r , ι ⁰ ]
[B]′ = univEq [U] [BU]
[t]′ : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ r , ι ⁰ ] / [A]′
[t]′ = irrelevanceTerm [A] (emb ∞< (emb emb< [A]′)) [t]
⊢e : Γ ⊢ e ∷ Id (Univ r ⁰) A B ^ [ % , ι ¹ ]
⊢e = escapeTerm [Id] [e]
x : Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ∷ B ^ [ r , ι ⁰ ] / [B]′
x = proj₁ ([cast] ⊢Γ [A]′ [B]′) [t]′ ⊢e
in irrelevanceTerm (emb ∞< (emb emb< [B]′)) [B] x
castext∞ : ∀ {A A' B B' r t t' e e' Γ}
(⊢Γ : ⊢ Γ)
([U] : Γ ⊩⟨ ∞ ⟩ Univ r ⁰ ^ [ ! , ι ¹ ])
([U'] : Γ ⊩⟨ ∞ ⟩ Univ r ⁰ ^ [ ! , ι ¹ ])
([AU] : Γ ⊩⟨ ∞ ⟩ A ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U])
([AU'] : Γ ⊩⟨ ∞ ⟩ A' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U])
([BU] : Γ ⊩⟨ ∞ ⟩ B ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U'])
([BU'] : Γ ⊩⟨ ∞ ⟩ B' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U'])
([UA≡UA'] : Γ ⊩⟨ ∞ ⟩ A ≡ A' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U])
([UB≡UB'] : Γ ⊩⟨ ∞ ⟩ B ≡ B' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U'])
([A] : Γ ⊩⟨ ∞ ⟩ A ^ [ r , ι ⁰ ])
([A'] : Γ ⊩⟨ ∞ ⟩ A' ^ [ r , ι ⁰ ])
([B] : Γ ⊩⟨ ∞ ⟩ B ^ [ r , ι ⁰ ])
([B'] : Γ ⊩⟨ ∞ ⟩ B' ^ [ r , ι ⁰ ])
([t] : Γ ⊩⟨ ∞ ⟩ t ∷ A ^ [ r , ι ⁰ ] / [A])
([t'] : Γ ⊩⟨ ∞ ⟩ t' ∷ A' ^ [ r , ι ⁰ ] / [A'])
([t≡t'] : Γ ⊩⟨ ∞ ⟩ t ≡ t' ∷ A ^ [ r , ι ⁰ ] / [A])
([Id] : Γ ⊩⟨ ∞ ⟩ Id (Univ r ⁰) A B ^ [ % , ι ¹ ]) →
([Id'] : Γ ⊩⟨ ∞ ⟩ Id (Univ r ⁰) A' B' ^ [ % , ι ¹ ]) →
([e] : Γ ⊩⟨ ∞ ⟩ e ∷ Id (Univ r ⁰) A B ^ [ % , ι ¹ ] / [Id] ) →
([e'] : Γ ⊩⟨ ∞ ⟩ e' ∷ Id (Univ r ⁰) A' B' ^ [ % , ι ¹ ] / [Id'] ) →
Γ ⊩⟨ ∞ ⟩ cast ⁰ A B e t ≡ cast ⁰ A' B' e' t' ∷ B ^ [ r , ι ⁰ ] / [B]
castext∞ {A} {A'} {B} {B'} {r} {t} {t'} {e} {e'} {Γ} ⊢Γ [U] [U'] [AU] [AU'] [BU] [BU'] [UA≡UA'] [UB≡UB'] [A] [A'] [B] [B'] [t] [t'] [t≡t'] [Id] [Id'] [e] [e'] =
let
[A]′ : Γ ⊩⟨ ι ⁰ ⟩ A ^ [ r , ι ⁰ ]
[A]′ = univEq [U] [AU]
[A']′ : Γ ⊩⟨ ι ⁰ ⟩ A' ^ [ r , ι ⁰ ]
[A']′ = univEq [U] [AU']
[t]′ : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ r , ι ⁰ ] / [A]′
[t]′ = irrelevanceTerm [A] (emb ∞< (emb emb< [A]′)) [t]
[B]′ : Γ ⊩⟨ ι ⁰ ⟩ B ^ [ r , ι ⁰ ]
[B]′ = univEq [U'] [BU]
[B']′ : Γ ⊩⟨ ι ⁰ ⟩ B' ^ [ r , ι ⁰ ]
[B']′ = univEq [U'] [BU']
[A≡A']′ : Γ ⊩⟨ ι ⁰ ⟩ A ≡ A' ^ [ r , ι ⁰ ] / [A]′
[A≡A']′ = univEqEq [U] [A]′ [UA≡UA']
[B≡B']′ : Γ ⊩⟨ ι ⁰ ⟩ B ≡ B' ^ [ r , ι ⁰ ] / [B]′
[B≡B']′ = univEqEq [U'] [B]′ [UB≡UB']
[t']′ : Γ ⊩⟨ ι ⁰ ⟩ t' ∷ A' ^ [ r , ι ⁰ ] / [A']′
[t']′ = irrelevanceTerm [A'] (emb ∞< (emb emb< [A']′)) [t']
[t≡t']′ : Γ ⊩⟨ ι ⁰ ⟩ t ≡ t' ∷ A ^ [ r , ι ⁰ ] / [A]′
[t≡t']′ = irrelevanceEqTerm [A] (emb ∞< (emb emb< [A]′)) [t≡t']
⊢e : Γ ⊢ e ∷ Id (Univ r ⁰) A B ^ [ % , ι ¹ ]
⊢e = escapeTerm [Id] [e]
⊢e' : Γ ⊢ e' ∷ Id (Univ r ⁰) A' B' ^ [ % , ι ¹ ]
⊢e' = escapeTerm [Id'] [e']
x : Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ≡ cast ⁰ A' B' e' t' ∷ B ^ [ r , ι ⁰ ] / [B]′
x = proj₁ ([castext] ⊢Γ [A]′ [A']′ [A≡A']′ [B]′ [B']′ [B≡B']′) [t]′ [t']′ [t≡t']′ ⊢e ⊢e'
in irrelevanceEqTerm (emb ∞< (emb emb< [B]′)) [B] x
castext∞' : ∀ {A A' B B' r t t' e e' Γ}
(⊢Γ : ⊢ Γ)
([U] : Γ ⊩⟨ ∞ ⟩ Univ r ⁰ ^ [ ! , ι ¹ ])
([U'] : Γ ⊩⟨ ∞ ⟩ Univ r ⁰ ^ [ ! , ι ¹ ])
([AU] : Γ ⊩⟨ ∞ ⟩ A ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U])
([AU'] : Γ ⊩⟨ ∞ ⟩ A' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U'])
([BU] : Γ ⊩⟨ ∞ ⟩ B ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U])
([BU'] : Γ ⊩⟨ ∞ ⟩ B' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U'])
([UA≡UA'] : Γ ⊩⟨ ∞ ⟩ A ≡ A' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U])
([UB≡UB'] : Γ ⊩⟨ ∞ ⟩ B ≡ B' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [U])
([A] : Γ ⊩⟨ ∞ ⟩ A ^ [ r , ι ⁰ ])
([A'] : Γ ⊩⟨ ∞ ⟩ A' ^ [ r , ι ⁰ ])
([B] : Γ ⊩⟨ ∞ ⟩ B ^ [ r , ι ⁰ ])
([B'] : Γ ⊩⟨ ∞ ⟩ B' ^ [ r , ι ⁰ ])
([t] : Γ ⊩⟨ ∞ ⟩ t ∷ A ^ [ r , ι ⁰ ] / [A])
([t'] : Γ ⊩⟨ ∞ ⟩ t' ∷ A' ^ [ r , ι ⁰ ] / [A'])
([t≡t'] : Γ ⊩⟨ ∞ ⟩ t ≡ t' ∷ A ^ [ r , ι ⁰ ] / [A])
([Id] : Γ ⊩⟨ ∞ ⟩ Id (Univ r ⁰) A B ^ [ % , ι ¹ ]) →
([Id'] : Γ ⊩⟨ ∞ ⟩ Id (Univ r ⁰) A' B' ^ [ % , ι ¹ ]) →
([e] : Γ ⊩⟨ ∞ ⟩ e ∷ Id (Univ r ⁰) A B ^ [ % , ι ¹ ] / [Id] ) →
([e'] : Γ ⊩⟨ ∞ ⟩ e' ∷ Id (Univ r ⁰) A' B' ^ [ % , ι ¹ ] / [Id'] ) →
Γ ⊩⟨ ∞ ⟩ cast ⁰ A B e t ≡ cast ⁰ A' B' e' t' ∷ B ^ [ r , ι ⁰ ] / [B]
castext∞' {A} {A'} {B} {B'} {r} {t} {t'} {e} {e'} {Γ} ⊢Γ [U] [U'] [AU] [AU'] [BU] [BU'] [UA≡UA'] [UB≡UB'] [A] [A'] [B] [B'] [t] [t'] [t≡t'] [Id] [Id'] [e] [e'] =
let
[A]′ : Γ ⊩⟨ ι ⁰ ⟩ A ^ [ r , ι ⁰ ]
[A]′ = univEq [U] [AU]
[A']′ : Γ ⊩⟨ ι ⁰ ⟩ A' ^ [ r , ι ⁰ ]
[A']′ = univEq [U'] [AU']
[t]′ : Γ ⊩⟨ ι ⁰ ⟩ t ∷ A ^ [ r , ι ⁰ ] / [A]′
[t]′ = irrelevanceTerm [A] (emb ∞< (emb emb< [A]′)) [t]
[B]′ : Γ ⊩⟨ ι ⁰ ⟩ B ^ [ r , ι ⁰ ]
[B]′ = univEq [U] [BU]
[B']′ : Γ ⊩⟨ ι ⁰ ⟩ B' ^ [ r , ι ⁰ ]
[B']′ = univEq [U'] [BU']
[A≡A']′ : Γ ⊩⟨ ι ⁰ ⟩ A ≡ A' ^ [ r , ι ⁰ ] / [A]′
[A≡A']′ = univEqEq [U] [A]′ [UA≡UA']
[B≡B']′ : Γ ⊩⟨ ι ⁰ ⟩ B ≡ B' ^ [ r , ι ⁰ ] / [B]′
[B≡B']′ = univEqEq [U] [B]′ [UB≡UB']
[t']′ : Γ ⊩⟨ ι ⁰ ⟩ t' ∷ A' ^ [ r , ι ⁰ ] / [A']′
[t']′ = irrelevanceTerm [A'] (emb ∞< (emb emb< [A']′)) [t']
[t≡t']′ : Γ ⊩⟨ ι ⁰ ⟩ t ≡ t' ∷ A ^ [ r , ι ⁰ ] / [A]′
[t≡t']′ = irrelevanceEqTerm [A] (emb ∞< (emb emb< [A]′)) [t≡t']
⊢e : Γ ⊢ e ∷ Id (Univ r ⁰) A B ^ [ % , ι ¹ ]
⊢e = escapeTerm [Id] [e]
⊢e' : Γ ⊢ e' ∷ Id (Univ r ⁰) A' B' ^ [ % , ι ¹ ]
⊢e' = escapeTerm [Id'] [e']
x : Γ ⊩⟨ ι ⁰ ⟩ cast ⁰ A B e t ≡ cast ⁰ A' B' e' t' ∷ B ^ [ r , ι ⁰ ] / [B]′
x = proj₁ ([castext] ⊢Γ [A]′ [A']′ [A≡A']′ [B]′ [B']′ [B≡B']′) [t]′ [t']′ [t≡t']′ ⊢e ⊢e'
in irrelevanceEqTerm (emb ∞< (emb emb< [B]′)) [B] x
abstract
castᵗᵛ : ∀ {A B r t e Γ}
([Γ] : ⊩ᵛ Γ)
([U] : Γ ⊩ᵛ⟨ ∞ ⟩ Univ r ⁰ ^ [ ! , ι ¹ ] / [Γ])
([AU] : Γ ⊩ᵛ⟨ ∞ ⟩ A ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [Γ] / [U])
([BU] : Γ ⊩ᵛ⟨ ∞ ⟩ B ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [Γ] / [U])
([A] : Γ ⊩ᵛ⟨ ∞ ⟩ A ^ [ r , ι ⁰ ] / [Γ])
([B] : Γ ⊩ᵛ⟨ ∞ ⟩ B ^ [ r , ι ⁰ ] / [Γ])
([t] : Γ ⊩ᵛ⟨ ∞ ⟩ t ∷ A ^ [ r , ι ⁰ ] / [Γ] / [A])
([Id] : Γ ⊩ᵛ⟨ ∞ ⟩ Id (Univ r ⁰) A B ^ [ % , ι ¹ ] / [Γ]) →
([e] : Γ ⊩ᵛ⟨ ∞ ⟩ e ∷ Id (Univ r ⁰) A B ^ [ % , ι ¹ ] / [Γ] / [Id] ) →
Γ ⊩ᵛ⟨ ∞ ⟩ cast ⁰ A B e t ∷ B ^ [ r , ι ⁰ ] / [Γ] / [B]
castᵗᵛ {A} {B} {t} {e} {Γ} [Γ] [U] [AU] [BU] [A] [B] [t] [Id] [e] ⊢Δ [σ] =
cast∞ ⊢Δ (proj₁ ([U] ⊢Δ [σ])) (proj₁ ([AU] ⊢Δ [σ])) (proj₁ ([BU] ⊢Δ [σ]))
(proj₁ ([A] ⊢Δ [σ])) (proj₁ ([B] ⊢Δ [σ]))
(proj₁ ([t] ⊢Δ [σ])) (proj₁ ([Id] ⊢Δ [σ])) (proj₁ ([e] ⊢Δ [σ]))
, λ [σ′] [σ≡σ′] → castext∞' ⊢Δ (proj₁ ([U] ⊢Δ [σ])) (proj₁ ([U] ⊢Δ [σ′]))
(proj₁ ([AU] ⊢Δ [σ])) (proj₁ ([AU] ⊢Δ [σ′])) (proj₁ ([BU] ⊢Δ [σ])) (proj₁ ([BU] ⊢Δ [σ′]))
(proj₂ ([AU] ⊢Δ [σ]) [σ′] [σ≡σ′]) (proj₂ ([BU] ⊢Δ [σ]) [σ′] [σ≡σ′])
(proj₁ ([A] ⊢Δ [σ])) (proj₁ ([A] ⊢Δ [σ′]))
(proj₁ ([B] ⊢Δ [σ])) (proj₁ ([B] ⊢Δ [σ′]))
(proj₁ ([t] ⊢Δ [σ])) (proj₁ ([t] ⊢Δ [σ′])) (proj₂ ([t] ⊢Δ [σ]) [σ′] [σ≡σ′])
(proj₁ ([Id] ⊢Δ [σ])) (proj₁ ([Id] ⊢Δ [σ′])) (proj₁ ([e] ⊢Δ [σ])) (proj₁ ([e] ⊢Δ [σ′]))
cast-congᵗᵛ : ∀ {A A' B B' t t' e e' r Γ}
([Γ] : ⊩ᵛ Γ) →
([U] : Γ ⊩ᵛ⟨ ∞ ⟩ Univ r ⁰ ^ [ ! , ι ¹ ] / [Γ])
([U'] : Γ ⊩ᵛ⟨ ∞ ⟩ Univ r ⁰ ^ [ ! , ι ¹ ] / [Γ])
([AU] : Γ ⊩ᵛ⟨ ∞ ⟩ A ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [Γ] / [U])
([AU'] : Γ ⊩ᵛ⟨ ∞ ⟩ A' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [Γ] / [U])
([BU] : Γ ⊩ᵛ⟨ ∞ ⟩ B ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [Γ] / [U'])
([BU'] : Γ ⊩ᵛ⟨ ∞ ⟩ B' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [Γ] / [U'])
([UA≡UA'] : Γ ⊩ᵛ⟨ ∞ ⟩ A ≡ A' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [Γ] / [U])
([UB≡UB'] : Γ ⊩ᵛ⟨ ∞ ⟩ B ≡ B' ∷ Univ r ⁰ ^ [ ! , ι ¹ ] / [Γ] / [U'])
([A] : Γ ⊩ᵛ⟨ ∞ ⟩ A ^ [ r , ι ⁰ ] / [Γ])
([A'] : Γ ⊩ᵛ⟨ ∞ ⟩ A' ^ [ r , ι ⁰ ] / [Γ])
([B] : Γ ⊩ᵛ⟨ ∞ ⟩ B ^ [ r , ι ⁰ ] / [Γ])
([B'] : Γ ⊩ᵛ⟨ ∞ ⟩ B' ^ [ r , ι ⁰ ] / [Γ])
([t] : Γ ⊩ᵛ⟨ ∞ ⟩ t ∷ A ^ [ r , ι ⁰ ] / [Γ] / [A])
([t'] : Γ ⊩ᵛ⟨ ∞ ⟩ t' ∷ A' ^ [ r , ι ⁰ ] / [Γ] / [A'])
([t≡t']ₜ : Γ ⊩ᵛ⟨ ∞ ⟩ t ≡ t' ∷ A ^ [ r , ι ⁰ ] / [Γ] / [A] )
([Id] : Γ ⊩ᵛ⟨ ∞ ⟩ Id (Univ r ⁰) A B ^ [ % , ι ¹ ] / [Γ])
([e] : Γ ⊩ᵛ⟨ ∞ ⟩ e ∷ Id (Univ r ⁰) A B ^ [ % , ι ¹ ] / [Γ] / [Id] )
([Id'] : Γ ⊩ᵛ⟨ ∞ ⟩ Id (Univ r ⁰) A' B' ^ [ % , ι ¹ ] / [Γ])
([e'] : Γ ⊩ᵛ⟨ ∞ ⟩ e' ∷ Id (Univ r ⁰) A' B' ^ [ % , ι ¹ ] / [Γ] / [Id'] ) →
Γ ⊩ᵛ⟨ ∞ ⟩ cast ⁰ A B e t ≡ cast ⁰ A' B' e' t' ∷ B ^ [ r , ι ⁰ ] / [Γ] / [B]
cast-congᵗᵛ [Γ] [U] [U'] [AU] [AU'] [BU] [BU'] [UA≡UA'] [UB≡UB'] [A] [A'] [B]
[B'] [t] [t'] [t≡t']ₜ [Id] [e] [Id'] [e'] ⊢Δ [σ] =
castext∞ ⊢Δ (proj₁ ([U] ⊢Δ [σ])) (proj₁ ([U'] ⊢Δ [σ]))
(proj₁ ([AU] ⊢Δ [σ])) (proj₁ ([AU'] ⊢Δ [σ])) (proj₁ ([BU] ⊢Δ [σ])) (proj₁ ([BU'] ⊢Δ [σ])) ([UA≡UA'] ⊢Δ [σ]) ([UB≡UB'] ⊢Δ [σ])
(proj₁ ([A] ⊢Δ [σ])) (proj₁ ([A'] ⊢Δ [σ])) (proj₁ ([B] ⊢Δ [σ])) (proj₁ ([B'] ⊢Δ [σ]))
(proj₁ ([t] ⊢Δ [σ])) (proj₁ ([t'] ⊢Δ [σ])) ([t≡t']ₜ ⊢Δ [σ])
(proj₁ ([Id] ⊢Δ [σ])) (proj₁ ([Id'] ⊢Δ [σ])) (proj₁ ([e] ⊢Δ [σ])) (proj₁ ([e'] ⊢Δ [σ]))
|
zfp-gba/gnat_user/s-secsta.adb | 98devin/ada-gba-dev | 7 | 14096 | <reponame>98devin/ada-gba-dev<filename>zfp-gba/gnat_user/s-secsta.adb
-- Copyright (c) 2021 <NAME>
-- zlib License -- see LICENSE for details.
package body System.Secondary_Stack is
use all type SS_Stack;
Sec_Stack : aliased SS_Stack
(SSE.Storage_Count (Default_Secondary_Stack_Size))
with Import, Address => Default_Sized_SS_Pool;
-- Import secondary stack from the address it was allocated at.
-------------------
-- Get_Sec_Stack --
-------------------
function Get_Sec_Stack return SS_Stack_Ptr is
begin
return Sec_Stack'Unchecked_Access;
end Get_Sec_Stack;
-----------------
-- SS_Allocate --
-----------------
procedure SS_Allocate
(Addr : out Address;
Storage_Size : SSE.Storage_Count) is
begin
Allocate
(Sec_Stack
, Addr
, Storage_Size
, Standard'Maximum_Alignment
);
end SS_Allocate;
-------------
-- SS_Mark --
-------------
function SS_Mark return SAA.Marker is
begin
return Mark (Sec_Stack);
end SS_Mark;
----------------
-- SS_Release --
----------------
procedure SS_Release (M : SAA.Marker) is
begin
Release (Sec_Stack, M);
end SS_Release;
begin
Init_Arena (Sec_Stack);
-- Since GNAT allocates the stack for us, we need to initialize it.
-- This just sets the pointers of the local arena properly.
end System.Secondary_Stack;
|
home/names.asm | opiter09/ASM-Machina | 1 | 162968 | GetMonName::
push hl
ldh a, [hLoadedROMBank]
push af
ld a, BANK(MonsterNames)
ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld a, [wd11e]
dec a
ld hl, MonsterNames
ld c, 10
ld b, 0
call AddNTimes
ld de, wcd6d
push de
ld bc, 10
call CopyData
ld hl, wcd6d + 10
ld [hl], "@"
pop de
pop af
ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
pop hl
ret
GetItemName::
; given an item ID at [wd11e], store the name of the item into a string
; starting at wcd6d
push hl
push bc
ld a, [wd11e]
cp HM01 ; is this a TM/HM?
jr nc, .Machine
ld [wd0b5], a
ld a, ITEM_NAME
ld [wNameListType], a
ld a, BANK(ItemNames)
ld [wPredefBank], a
call GetName
jr .Finish
.Machine
call GetMachineName
.Finish
ld de, wcd6d ; pointer to where item name is stored in RAM
pop bc
pop hl
ret
GetMachineName::
; copies the name of the TM/HM in [wd11e] to wcd6d
push hl
push de
push bc
ld a, [wd11e]
push af
cp TM01 ; is this a TM? [not HM]
jr nc, .WriteTM
; if HM, then write "HM" and add NUM_HMS to the item ID, so we can reuse the
; TM printing code
add NUM_HMS
ld [wd11e], a
ld hl, HiddenPrefix ; points to "HM"
ld bc, 2
jr .WriteMachinePrefix
.WriteTM
ld hl, TechnicalPrefix ; points to "TM"
ld bc, 2
.WriteMachinePrefix
ld de, wcd6d
call CopyData
; now get the machine number and convert it to text
ld a, [wd11e]
sub TM01 - 1
ld b, "0"
.FirstDigit
sub 10
jr c, .SecondDigit
inc b
jr .FirstDigit
.SecondDigit
add 10
push af
ld a, b
ld [de], a
inc de
pop af
ld b, "0"
add b
ld [de], a
inc de
ld a, "@"
ld [de], a
pop af
ld [wd11e], a
pop bc
pop de
pop hl
ret
TechnicalPrefix::
db "TM"
HiddenPrefix::
db "HM"
; sets carry if item is HM, clears carry if item is not HM
; Input: a = item ID
IsItemHM::
cp HM01
jr c, .notHM
cp TM01
ret
.notHM
and a
ret
; sets carry if move is an HM, clears carry if move is not an HM
; Input: a = move ID
IsMoveHM::
ld hl, HMMoves
ld de, 1
jp IsInArray
HMMoves::
INCLUDE "data/moves/hm_moves.asm"
GetMoveName::
push hl
ld a, MOVE_NAME
ld [wNameListType], a
ld a, [wd11e]
ld [wd0b5], a
ld a, BANK(MoveNames)
ld [wPredefBank], a
call GetName
ld de, wcd6d ; pointer to where move name is stored in RAM
pop hl
ret
|
boot.asm | PUASummerOfCode/PUAOS | 0 | 102469 | <reponame>PUASummerOfCode/PUAOS
; boot sector that enters 32 - bit protected mode.
[org 0x7c00]
mov bp, 0x9000 ; Set the stack.
mov sp, bp
mov bx , MSG_REAL_MODE
call print_string
call switch_to_pm ; Note that we never return from here.
jmp $
%include "print_string.asm"
%include "gdt.asm"
%include "print_string_pm.asm"
%include "switch_to_pm.asm"
[bits 32]
; This is where we arrive after switching to and initializing protected mode
BEGIN_PM:
mov ebx, MSG_PROT_MODE
call print_string_pm ; Use our 32-bit print routine.
jmp $ ; Hang.
; Global variables
MSG_REAL_MODE db "Hello, World. Started in 16-bit Real Mode", 0
MSG_PROT_MODE db "Ingeniously landed in 32-bit Protected Mode", 0
; Bootsector padding
times 510-($-$$) db 0
dw 0xaa55
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/exp_atag.adb | djamal2727/Main-Bearing-Analytical-Model | 0 | 23294 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ A T A G --
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-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 Atree; use Atree;
with Einfo; use Einfo;
with Elists; use Elists;
with Exp_Disp; use Exp_Disp;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
with Rtsfind; use Rtsfind;
with Sinfo; use Sinfo;
with Sem_Aux; use Sem_Aux;
with Sem_Disp; use Sem_Disp;
with Sem_Util; use Sem_Util;
with Stand; use Stand;
with Snames; use Snames;
with Tbuild; use Tbuild;
package body Exp_Atag is
-----------------------
-- Local Subprograms --
-----------------------
function Build_DT
(Loc : Source_Ptr;
Tag_Node : Node_Id) return Node_Id;
-- Build code that displaces the Tag to reference the base of the wrapper
-- record
--
-- Generates:
-- To_Dispatch_Table_Ptr
-- (To_Address (Tag_Node) - Tag_Node.Prims_Ptr'Position);
function Build_Range (Loc : Source_Ptr; Lo, Hi : Nat) return Node_Id;
-- Build an N_Range node for [Lo; Hi] with Standard.Natural type
function Build_TSD
(Loc : Source_Ptr;
Tag_Node_Addr : Node_Id) return Node_Id;
-- Build code that retrieves the address of the record containing the Type
-- Specific Data generated by GNAT.
--
-- Generate: To_Type_Specific_Data_Ptr
-- (To_Addr_Ptr (Tag_Node_Addr - Typeinfo_Offset).all);
function Build_Val (Loc : Source_Ptr; V : Uint) return Node_Id;
-- Build an N_Integer_Literal node for V with Standard.Natural type
------------------------------------------------
-- Build_Common_Dispatching_Select_Statements --
------------------------------------------------
procedure Build_Common_Dispatching_Select_Statements
(Typ : Entity_Id;
Stmts : List_Id)
is
Loc : constant Source_Ptr := Sloc (Typ);
Tag_Node : Node_Id;
begin
-- Generate:
-- C := get_prim_op_kind (tag! (<type>VP), S);
-- where C is the out parameter capturing the call kind and S is the
-- dispatch table slot number.
if Tagged_Type_Expansion then
Tag_Node :=
Unchecked_Convert_To (RTE (RE_Tag),
New_Occurrence_Of
(Node (First_Elmt (Access_Disp_Table (Typ))), Loc));
else
Tag_Node :=
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Typ, Loc),
Attribute_Name => Name_Tag);
end if;
Append_To (Stmts,
Make_Assignment_Statement (Loc,
Name => Make_Identifier (Loc, Name_uC),
Expression =>
Make_Function_Call (Loc,
Name =>
New_Occurrence_Of (RTE (RE_Get_Prim_Op_Kind), Loc),
Parameter_Associations => New_List (
Tag_Node,
Make_Identifier (Loc, Name_uS)))));
-- Generate:
-- if C = POK_Procedure
-- or else C = POK_Protected_Procedure
-- or else C = POK_Task_Procedure;
-- then
-- F := True;
-- return;
-- where F is the out parameter capturing the status of a potential
-- entry call.
Append_To (Stmts,
Make_If_Statement (Loc,
Condition =>
Make_Or_Else (Loc,
Left_Opnd =>
Make_Op_Eq (Loc,
Left_Opnd => Make_Identifier (Loc, Name_uC),
Right_Opnd =>
New_Occurrence_Of (RTE (RE_POK_Procedure), Loc)),
Right_Opnd =>
Make_Or_Else (Loc,
Left_Opnd =>
Make_Op_Eq (Loc,
Left_Opnd => Make_Identifier (Loc, Name_uC),
Right_Opnd =>
New_Occurrence_Of
(RTE (RE_POK_Protected_Procedure), Loc)),
Right_Opnd =>
Make_Op_Eq (Loc,
Left_Opnd => Make_Identifier (Loc, Name_uC),
Right_Opnd =>
New_Occurrence_Of
(RTE (RE_POK_Task_Procedure), Loc)))),
Then_Statements =>
New_List (
Make_Assignment_Statement (Loc,
Name => Make_Identifier (Loc, Name_uF),
Expression => New_Occurrence_Of (Standard_True, Loc)),
Make_Simple_Return_Statement (Loc))));
end Build_Common_Dispatching_Select_Statements;
--------------
-- Build_DT --
--------------
function Build_DT
(Loc : Source_Ptr;
Tag_Node : Node_Id) return Node_Id
is
begin
return
Make_Function_Call (Loc,
Name => New_Occurrence_Of (RTE (RE_DT), Loc),
Parameter_Associations => New_List (
Unchecked_Convert_To (RTE (RE_Tag), Tag_Node)));
end Build_DT;
----------------------------
-- Build_Get_Access_Level --
----------------------------
function Build_Get_Access_Level
(Loc : Source_Ptr;
Tag_Node : Node_Id) return Node_Id
is
begin
return
Make_Selected_Component (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Build_TSD (Loc,
Unchecked_Convert_To (RTE (RE_Address), Tag_Node))),
Selector_Name =>
New_Occurrence_Of
(RTE_Record_Component (RE_Access_Level), Loc));
end Build_Get_Access_Level;
-------------------------
-- Build_Get_Alignment --
-------------------------
function Build_Get_Alignment
(Loc : Source_Ptr;
Tag_Node : Node_Id) return Node_Id
is
begin
return
Make_Selected_Component (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Build_TSD (Loc,
Unchecked_Convert_To (RTE (RE_Address), Tag_Node))),
Selector_Name =>
New_Occurrence_Of (RTE_Record_Component (RE_Alignment), Loc));
end Build_Get_Alignment;
------------------------------------------
-- Build_Get_Predefined_Prim_Op_Address --
------------------------------------------
procedure Build_Get_Predefined_Prim_Op_Address
(Loc : Source_Ptr;
Position : Uint;
Tag_Node : in out Node_Id;
New_Node : out Node_Id)
is
Ctrl_Tag : Node_Id;
begin
Ctrl_Tag := Unchecked_Convert_To (RTE (RE_Address), Tag_Node);
-- Unchecked_Convert_To relocates the controlling tag node and therefore
-- we must update it.
Tag_Node := Expression (Ctrl_Tag);
-- Build code that retrieves the address of the dispatch table
-- containing the predefined Ada primitives:
--
-- Generate:
-- To_Predef_Prims_Table_Ptr
-- (To_Addr_Ptr (To_Address (Tag) - Predef_Prims_Offset).all);
New_Node :=
Make_Indexed_Component (Loc,
Prefix =>
Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To (RTE (RE_Addr_Ptr),
Make_Function_Call (Loc,
Name =>
Make_Expanded_Name (Loc,
Chars => Name_Op_Subtract,
Prefix =>
New_Occurrence_Of
(RTU_Entity (System_Storage_Elements), Loc),
Selector_Name =>
Make_Identifier (Loc, Name_Op_Subtract)),
Parameter_Associations => New_List (
Ctrl_Tag,
New_Occurrence_Of
(RTE (RE_DT_Predef_Prims_Offset), Loc)))))),
Expressions =>
New_List (Build_Val (Loc, Position)));
end Build_Get_Predefined_Prim_Op_Address;
-----------------------------
-- Build_Inherit_CPP_Prims --
-----------------------------
function Build_Inherit_CPP_Prims (Typ : Entity_Id) return List_Id is
Loc : constant Source_Ptr := Sloc (Typ);
CPP_Nb_Prims : constant Nat := CPP_Num_Prims (Typ);
CPP_Table : array (1 .. CPP_Nb_Prims) of Boolean := (others => False);
CPP_Typ : constant Entity_Id := Enclosing_CPP_Parent (Typ);
Result : constant List_Id := New_List;
Parent_Typ : constant Entity_Id := Etype (Typ);
E : Entity_Id;
Elmt : Elmt_Id;
Parent_Tag : Entity_Id;
Prim : Entity_Id;
Prim_Pos : Nat;
Typ_Tag : Entity_Id;
begin
pragma Assert (not Is_CPP_Class (Typ));
-- No code needed if this type has no primitives inherited from C++
if CPP_Nb_Prims = 0 then
return Result;
end if;
-- Stage 1: Inherit and override C++ slots of the primary dispatch table
-- Generate:
-- Typ'Tag (Prim_Pos) := Prim'Unrestricted_Access;
Parent_Tag := Node (First_Elmt (Access_Disp_Table (Parent_Typ)));
Typ_Tag := Node (First_Elmt (Access_Disp_Table (Typ)));
Elmt := First_Elmt (Primitive_Operations (Typ));
while Present (Elmt) loop
Prim := Node (Elmt);
E := Ultimate_Alias (Prim);
Prim_Pos := UI_To_Int (DT_Position (E));
-- Skip predefined, abstract, and eliminated primitives. Skip also
-- primitives not located in the C++ part of the dispatch table.
if not Is_Predefined_Dispatching_Operation (Prim)
and then not Is_Predefined_Dispatching_Operation (E)
and then not Present (Interface_Alias (Prim))
and then not Is_Abstract_Subprogram (E)
and then not Is_Eliminated (E)
and then Prim_Pos <= CPP_Nb_Prims
and then Find_Dispatching_Type (E) = Typ
then
-- Remember that this slot is used
pragma Assert (CPP_Table (Prim_Pos) = False);
CPP_Table (Prim_Pos) := True;
Append_To (Result,
Make_Assignment_Statement (Loc,
Name =>
Make_Indexed_Component (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (Typ))),
New_Occurrence_Of (Typ_Tag, Loc))),
Expressions =>
New_List (Build_Val (Loc, UI_From_Int (Prim_Pos)))),
Expression =>
Unchecked_Convert_To (RTE (RE_Prim_Ptr),
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (E, Loc),
Attribute_Name => Name_Unrestricted_Access))));
end if;
Next_Elmt (Elmt);
end loop;
-- If all primitives have been overridden then there is no need to copy
-- from Typ's parent its dispatch table. Otherwise, if some primitive is
-- inherited from the parent we copy only the C++ part of the dispatch
-- table from the parent before the assignments that initialize the
-- overridden primitives.
-- Generate:
-- type CPP_TypG is array (1 .. CPP_Nb_Prims) ofd Prim_Ptr;
-- type CPP_TypH is access CPP_TypG;
-- CPP_TypG!(Typ_Tag).all := CPP_TypG!(Parent_Tag).all;
-- Note: There is no need to duplicate the declarations of CPP_TypG and
-- CPP_TypH because, for expansion of dispatching calls, these
-- entities are stored in the last elements of Access_Disp_Table.
for J in CPP_Table'Range loop
if not CPP_Table (J) then
Prepend_To (Result,
Make_Assignment_Statement (Loc,
Name =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (CPP_Typ))),
New_Occurrence_Of (Typ_Tag, Loc))),
Expression =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (CPP_Typ))),
New_Occurrence_Of (Parent_Tag, Loc)))));
exit;
end if;
end loop;
-- Stage 2: Inherit and override C++ slots of secondary dispatch tables
declare
Iface : Entity_Id;
Iface_Nb_Prims : Nat;
Parent_Ifaces_List : Elist_Id;
Parent_Ifaces_Comp_List : Elist_Id;
Parent_Ifaces_Tag_List : Elist_Id;
Parent_Iface_Tag_Elmt : Elmt_Id;
Typ_Ifaces_List : Elist_Id;
Typ_Ifaces_Comp_List : Elist_Id;
Typ_Ifaces_Tag_List : Elist_Id;
Typ_Iface_Tag_Elmt : Elmt_Id;
begin
Collect_Interfaces_Info
(T => Parent_Typ,
Ifaces_List => Parent_Ifaces_List,
Components_List => Parent_Ifaces_Comp_List,
Tags_List => Parent_Ifaces_Tag_List);
Collect_Interfaces_Info
(T => Typ,
Ifaces_List => Typ_Ifaces_List,
Components_List => Typ_Ifaces_Comp_List,
Tags_List => Typ_Ifaces_Tag_List);
Parent_Iface_Tag_Elmt := First_Elmt (Parent_Ifaces_Tag_List);
Typ_Iface_Tag_Elmt := First_Elmt (Typ_Ifaces_Tag_List);
while Present (Parent_Iface_Tag_Elmt) loop
Parent_Tag := Node (Parent_Iface_Tag_Elmt);
Typ_Tag := Node (Typ_Iface_Tag_Elmt);
pragma Assert
(Related_Type (Parent_Tag) = Related_Type (Typ_Tag));
Iface := Related_Type (Parent_Tag);
Iface_Nb_Prims :=
UI_To_Int (DT_Entry_Count (First_Tag_Component (Iface)));
if Iface_Nb_Prims > 0 then
-- Update slots of overridden primitives
declare
Last_Nod : constant Node_Id := Last (Result);
Nb_Prims : constant Nat := UI_To_Int
(DT_Entry_Count
(First_Tag_Component (Iface)));
Elmt : Elmt_Id;
Prim : Entity_Id;
E : Entity_Id;
Prim_Pos : Nat;
Prims_Table : array (1 .. Nb_Prims) of Boolean;
begin
Prims_Table := (others => False);
Elmt := First_Elmt (Primitive_Operations (Typ));
while Present (Elmt) loop
Prim := Node (Elmt);
E := Ultimate_Alias (Prim);
if not Is_Predefined_Dispatching_Operation (Prim)
and then Present (Interface_Alias (Prim))
and then Find_Dispatching_Type (Interface_Alias (Prim))
= Iface
and then not Is_Abstract_Subprogram (E)
and then not Is_Eliminated (E)
and then Find_Dispatching_Type (E) = Typ
then
Prim_Pos := UI_To_Int (DT_Position (Prim));
-- Remember that this slot is already initialized
pragma Assert (Prims_Table (Prim_Pos) = False);
Prims_Table (Prim_Pos) := True;
Append_To (Result,
Make_Assignment_Statement (Loc,
Name =>
Make_Indexed_Component (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To
(Node
(Last_Elmt
(Access_Disp_Table (Iface))),
New_Occurrence_Of (Typ_Tag, Loc))),
Expressions =>
New_List
(Build_Val (Loc, UI_From_Int (Prim_Pos)))),
Expression =>
Unchecked_Convert_To (RTE (RE_Prim_Ptr),
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (E, Loc),
Attribute_Name =>
Name_Unrestricted_Access))));
end if;
Next_Elmt (Elmt);
end loop;
-- Check if all primitives from the parent have been
-- overridden (to avoid copying the whole secondary
-- table from the parent).
-- IfaceG!(Typ_Sec_Tag).all := IfaceG!(Parent_Sec_Tag).all;
for J in Prims_Table'Range loop
if not Prims_Table (J) then
Insert_After (Last_Nod,
Make_Assignment_Statement (Loc,
Name =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (Iface))),
New_Occurrence_Of (Typ_Tag, Loc))),
Expression =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (Iface))),
New_Occurrence_Of (Parent_Tag, Loc)))));
exit;
end if;
end loop;
end;
end if;
Next_Elmt (Typ_Iface_Tag_Elmt);
Next_Elmt (Parent_Iface_Tag_Elmt);
end loop;
end;
return Result;
end Build_Inherit_CPP_Prims;
-------------------------
-- Build_Inherit_Prims --
-------------------------
function Build_Inherit_Prims
(Loc : Source_Ptr;
Typ : Entity_Id;
Old_Tag_Node : Node_Id;
New_Tag_Node : Node_Id;
Num_Prims : Nat) return Node_Id
is
begin
if RTE_Available (RE_DT) then
return
Make_Assignment_Statement (Loc,
Name =>
Make_Slice (Loc,
Prefix =>
Make_Selected_Component (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Build_DT (Loc, New_Tag_Node)),
Selector_Name =>
New_Occurrence_Of
(RTE_Record_Component (RE_Prims_Ptr), Loc)),
Discrete_Range =>
Build_Range (Loc, 1, Num_Prims)),
Expression =>
Make_Slice (Loc,
Prefix =>
Make_Selected_Component (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Build_DT (Loc, Old_Tag_Node)),
Selector_Name =>
New_Occurrence_Of
(RTE_Record_Component (RE_Prims_Ptr), Loc)),
Discrete_Range =>
Build_Range (Loc, 1, Num_Prims)));
else
return
Make_Assignment_Statement (Loc,
Name =>
Make_Slice (Loc,
Prefix =>
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (Typ))),
New_Tag_Node),
Discrete_Range =>
Build_Range (Loc, 1, Num_Prims)),
Expression =>
Make_Slice (Loc,
Prefix =>
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (Typ))),
Old_Tag_Node),
Discrete_Range =>
Build_Range (Loc, 1, Num_Prims)));
end if;
end Build_Inherit_Prims;
-------------------------------
-- Build_Get_Prim_Op_Address --
-------------------------------
procedure Build_Get_Prim_Op_Address
(Loc : Source_Ptr;
Typ : Entity_Id;
Position : Uint;
Tag_Node : in out Node_Id;
New_Node : out Node_Id)
is
New_Prefix : Node_Id;
begin
pragma Assert
(Position <= DT_Entry_Count (First_Tag_Component (Typ)));
-- At the end of the Access_Disp_Table list we have the type
-- declaration required to convert the tag into a pointer to
-- the prims_ptr table (see Freeze_Record_Type).
New_Prefix :=
Unchecked_Convert_To
(Node (Last_Elmt (Access_Disp_Table (Typ))), Tag_Node);
-- Unchecked_Convert_To relocates the controlling tag node and therefore
-- we must update it.
Tag_Node := Expression (New_Prefix);
New_Node :=
Make_Indexed_Component (Loc,
Prefix => New_Prefix,
Expressions => New_List (Build_Val (Loc, Position)));
end Build_Get_Prim_Op_Address;
-----------------------------
-- Build_Get_Transportable --
-----------------------------
function Build_Get_Transportable
(Loc : Source_Ptr;
Tag_Node : Node_Id) return Node_Id
is
begin
return
Make_Selected_Component (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Build_TSD (Loc,
Unchecked_Convert_To (RTE (RE_Address), Tag_Node))),
Selector_Name =>
New_Occurrence_Of
(RTE_Record_Component (RE_Transportable), Loc));
end Build_Get_Transportable;
------------------------------------
-- Build_Inherit_Predefined_Prims --
------------------------------------
function Build_Inherit_Predefined_Prims
(Loc : Source_Ptr;
Old_Tag_Node : Node_Id;
New_Tag_Node : Node_Id;
Num_Predef_Prims : Nat) return Node_Id
is
begin
return
Make_Assignment_Statement (Loc,
Name =>
Make_Slice (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To (RTE (RE_Addr_Ptr),
New_Tag_Node)))),
Discrete_Range =>
Build_Range (Loc, 1, Num_Predef_Prims)),
Expression =>
Make_Slice (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To (RTE (RE_Addr_Ptr),
Old_Tag_Node)))),
Discrete_Range =>
Build_Range (Loc, 1, Num_Predef_Prims)));
end Build_Inherit_Predefined_Prims;
-------------------------
-- Build_Offset_To_Top --
-------------------------
function Build_Offset_To_Top
(Loc : Source_Ptr;
This_Node : Node_Id) return Node_Id
is
Tag_Node : Node_Id;
begin
Tag_Node :=
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To (RTE (RE_Tag_Ptr), This_Node));
return
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To (RTE (RE_Offset_To_Top_Ptr),
Make_Function_Call (Loc,
Name =>
Make_Expanded_Name (Loc,
Chars => Name_Op_Subtract,
Prefix =>
New_Occurrence_Of
(RTU_Entity (System_Storage_Elements), Loc),
Selector_Name => Make_Identifier (Loc, Name_Op_Subtract)),
Parameter_Associations => New_List (
Unchecked_Convert_To (RTE (RE_Address), Tag_Node),
New_Occurrence_Of
(RTE (RE_DT_Offset_To_Top_Offset), Loc)))));
end Build_Offset_To_Top;
-----------------
-- Build_Range --
-----------------
function Build_Range (Loc : Source_Ptr; Lo, Hi : Nat) return Node_Id is
Result : Node_Id;
begin
Result :=
Make_Range (Loc,
Low_Bound => Build_Val (Loc, UI_From_Int (Lo)),
High_Bound => Build_Val (Loc, UI_From_Int (Hi)));
Set_Etype (Result, Standard_Natural);
Set_Analyzed (Result);
return Result;
end Build_Range;
------------------------------------------
-- Build_Set_Predefined_Prim_Op_Address --
------------------------------------------
function Build_Set_Predefined_Prim_Op_Address
(Loc : Source_Ptr;
Tag_Node : Node_Id;
Position : Uint;
Address_Node : Node_Id) return Node_Id
is
begin
return
Make_Assignment_Statement (Loc,
Name =>
Make_Indexed_Component (Loc,
Prefix =>
Unchecked_Convert_To (RTE (RE_Predef_Prims_Table_Ptr),
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To (RTE (RE_Addr_Ptr), Tag_Node))),
Expressions =>
New_List (Build_Val (Loc, Position))),
Expression => Address_Node);
end Build_Set_Predefined_Prim_Op_Address;
-------------------------------
-- Build_Set_Prim_Op_Address --
-------------------------------
function Build_Set_Prim_Op_Address
(Loc : Source_Ptr;
Typ : Entity_Id;
Tag_Node : Node_Id;
Position : Uint;
Address_Node : Node_Id) return Node_Id
is
Ctrl_Tag : Node_Id := Tag_Node;
New_Node : Node_Id;
begin
Build_Get_Prim_Op_Address (Loc, Typ, Position, Ctrl_Tag, New_Node);
return
Make_Assignment_Statement (Loc,
Name => New_Node,
Expression => Address_Node);
end Build_Set_Prim_Op_Address;
-----------------------------
-- Build_Set_Size_Function --
-----------------------------
function Build_Set_Size_Function
(Loc : Source_Ptr;
Tag_Node : Node_Id;
Size_Func : Entity_Id) return Node_Id is
begin
pragma Assert (Chars (Size_Func) = Name_uSize
and then RTE_Record_Component_Available (RE_Size_Func));
return
Make_Assignment_Statement (Loc,
Name =>
Make_Selected_Component (Loc,
Prefix =>
Make_Explicit_Dereference (Loc,
Build_TSD (Loc,
Unchecked_Convert_To (RTE (RE_Address), Tag_Node))),
Selector_Name =>
New_Occurrence_Of
(RTE_Record_Component (RE_Size_Func), Loc)),
Expression =>
Unchecked_Convert_To (RTE (RE_Size_Ptr),
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Size_Func, Loc),
Attribute_Name => Name_Unrestricted_Access)));
end Build_Set_Size_Function;
------------------------------------
-- Build_Set_Static_Offset_To_Top --
------------------------------------
function Build_Set_Static_Offset_To_Top
(Loc : Source_Ptr;
Iface_Tag : Node_Id;
Offset_Value : Node_Id) return Node_Id is
begin
return
Make_Assignment_Statement (Loc,
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To (RTE (RE_Offset_To_Top_Ptr),
Make_Function_Call (Loc,
Name =>
Make_Expanded_Name (Loc,
Chars => Name_Op_Subtract,
Prefix =>
New_Occurrence_Of
(RTU_Entity (System_Storage_Elements), Loc),
Selector_Name => Make_Identifier (Loc, Name_Op_Subtract)),
Parameter_Associations => New_List (
Unchecked_Convert_To (RTE (RE_Address), Iface_Tag),
New_Occurrence_Of
(RTE (RE_DT_Offset_To_Top_Offset), Loc))))),
Offset_Value);
end Build_Set_Static_Offset_To_Top;
---------------
-- Build_TSD --
---------------
function Build_TSD
(Loc : Source_Ptr;
Tag_Node_Addr : Node_Id) return Node_Id is
begin
return
Unchecked_Convert_To (RTE (RE_Type_Specific_Data_Ptr),
Make_Explicit_Dereference (Loc,
Prefix => Unchecked_Convert_To (RTE (RE_Addr_Ptr),
Make_Function_Call (Loc,
Name =>
Make_Expanded_Name (Loc,
Chars => Name_Op_Subtract,
Prefix =>
New_Occurrence_Of
(RTU_Entity (System_Storage_Elements), Loc),
Selector_Name => Make_Identifier (Loc, Name_Op_Subtract)),
Parameter_Associations => New_List (
Tag_Node_Addr,
New_Occurrence_Of
(RTE (RE_DT_Typeinfo_Ptr_Size), Loc))))));
end Build_TSD;
---------------
-- Build_Val --
---------------
function Build_Val (Loc : Source_Ptr; V : Uint) return Node_Id is
Result : Node_Id;
begin
Result := Make_Integer_Literal (Loc, V);
Set_Etype (Result, Standard_Natural);
Set_Is_Static_Expression (Result);
Set_Analyzed (Result);
return Result;
end Build_Val;
end Exp_Atag;
|
programs/oeis/151/A151907.asm | karttu/loda | 0 | 8845 | ; A151907: Partial sums of A151906.
; 0,1,5,9,13,25,29,33,45,57,69,105,109,113,125,137,149,185,197,209,245,281,317,425,429,433,445,457,469,505,517,529,565,601,637,745,757,769,805,841,877,985,1021,1057,1165,1273,1381,1705,1709,1713,1725,1737,1749,1785,1797
mov $5,$0
mov $7,$0
lpb $7,1
clr $0,5
mov $0,$5
sub $7,1
sub $0,$7
mul $0,2
lpb $0,1
div $0,3
mov $1,$0
cal $1,147582 ; First differences of A147562.
mov $0,0
add $2,$1
add $3,$2
lpe
add $6,$3
lpe
mov $1,$6
|
target/cos_117/disasm/iop_overlay1/SDMP3.asm | jrrk2/cray-sim | 49 | 3509 | <filename>target/cos_117/disasm/iop_overlay1/SDMP3.asm
@ OR[348] - sector
@ OR[349] - head
@ OR[350] - track
@ OR[351] - '1' for read, '2' for write sector, '3' for reserve unit, '4' for release unit
@ OR[352] - buffer address
@ OR[356] - error counter?
@ OR[382] - last head read (?)
@ OR[383] - last track
0x0000 (0x000000) 0x2161- f:00020 d: 353 | A = OR[353]
0x0001 (0x000002) 0x5800- f:00054 d: 0 | B = A
0x0002 (0x000004) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0003 (0x000006) 0x2964- f:00024 d: 356 | OR[356] = A
0x0004 (0x000008) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0005 (0x00000A) 0x2963- f:00024 d: 355 | OR[355] = A
0x0006 (0x00000C) 0x215F- f:00020 d: 351 | A = OR[351]
0x0007 (0x00000E) 0x1603- f:00013 d: 3 | A = A - 3 (0x0003)
0x0008 (0x000010) 0x8405- f:00102 d: 5 | P = P + 5 (0x000D), A = 0
0x0009 (0x000012) 0x215F- f:00020 d: 351 | A = OR[351]
0x000A (0x000014) 0x1604- f:00013 d: 4 | A = A - 4 (0x0004)
0x000B (0x000016) 0x847C- f:00102 d: 124 | P = P + 124 (0x0087), A = 0
0x000C (0x000018) 0x7023- f:00070 d: 35 | P = P + 35 (0x002F)
@ Function code '3' - Reserve unit
0x000D (0x00001A) 0x1800-0x0200 f:00014 d: 0 | A = 512 (0x0200)
0x000F (0x00001E) 0xE200- f:00161 d: 0 | IOB , fn001
0x0010 (0x000020) 0x0000- f:00000 d: 0 | PASS
0x0011 (0x000022) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0012 (0x000024) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0013 (0x000026) 0x4400- f:00042 d: 0 | C = 1, IOB = DN
0x0014 (0x000028) 0x8205- f:00101 d: 5 | P = P + 5 (0x0019), C = 1
0x0015 (0x00002A) 0x8E03- f:00107 d: 3 | P = P - 3 (0x0012), A # 0
0x0016 (0x00002C) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0017 (0x00002E) 0x2963- f:00024 d: 355 | OR[355] = A
0x0018 (0x000030) 0x0200- f:00001 d: 0 | EXIT
0x0019 (0x000032) 0x7467- f:00072 d: 103 | R = P + 103 (0x0080)
0x001A (0x000034) 0x215D- f:00020 d: 349 | A = OR[349]
0x001B (0x000036) 0x297E- f:00024 d: 382 | OR[382] = A
0x001C (0x000038) 0xE800- f:00164 d: 0 | IOB , fn004
0x001D (0x00003A) 0x215E- f:00020 d: 350 | A = OR[350]
0x001E (0x00003C) 0x297F- f:00024 d: 383 | OR[383] = A
0x001F (0x00003E) 0xEA00- f:00165 d: 0 | IOB , fn005
0x0020 (0x000040) 0x0000- f:00000 d: 0 | PASS
0x0021 (0x000042) 0x4400- f:00042 d: 0 | C = 1, IOB = DN
0x0022 (0x000044) 0x8801- f:00104 d: 1 | P = P - 1 (0x0021), C = 0
0x0023 (0x000046) 0x4600- f:00043 d: 0 | C = 1, IOB = BZ
0x0024 (0x000048) 0x8202- f:00101 d: 2 | P = P + 2 (0x0026), C = 1
0x0025 (0x00004A) 0x7009- f:00070 d: 9 | P = P + 9 (0x002E)
0x0026 (0x00004C) 0x745A- f:00072 d: 90 | R = P + 90 (0x0080)
0x0027 (0x00004E) 0x2D64- f:00026 d: 356 | OR[356] = OR[356] + 1
0x0028 (0x000050) 0x2164- f:00020 d: 356 | A = OR[356]
0x0029 (0x000052) 0x160A- f:00013 d: 10 | A = A - 10 (0x000A)
0x002A (0x000054) 0x880D- f:00104 d: 13 | P = P - 13 (0x001D), C = 0
0x002B (0x000056) 0x1002- f:00010 d: 2 | A = 2 (0x0002)
0x002C (0x000058) 0x2963- f:00024 d: 355 | OR[355] = A
0x002D (0x00005A) 0x0200- f:00001 d: 0 | EXIT
0x002E (0x00005C) 0x0200- f:00001 d: 0 | EXIT
@ Function code '1' or '2' - read or write sector
@ OR[348] - sector
@ OR[349] - head
@ OR[350] - track
@ OR[351] - '1' for read, '2' for write sector
@ OR[352] - buffer address
@ OR[356] - error counter?
@ OR[382] - last head read (?)
@ OR[383] - last track
0x002F (0x00005E) 0x215D- f:00020 d: 349 | A = OR[349]
0x0030 (0x000060) 0x277E- f:00023 d: 382 | A = A - OR[382]
0x0031 (0x000062) 0x8602- f:00103 d: 2 | P = P + 2 (0x0033), A # 0
0x0032 (0x000064) 0x7004- f:00070 d: 4 | P = P + 4 (0x0036)
0x0033 (0x000066) 0x215D- f:00020 d: 349 | A = OR[349] @ Select head group from OR[349]
0x0034 (0x000068) 0x297E- f:00024 d: 382 | OR[382] = A
0x0035 (0x00006A) 0xE800- f:00164 d: 0 | IOB , fn004
0x0036 (0x00006C) 0x215E- f:00020 d: 350 | A = OR[350]
0x0037 (0x00006E) 0x277F- f:00023 d: 383 | A = A - OR[383]
0x0038 (0x000070) 0x8602- f:00103 d: 2 | P = P + 2 (0x003A), A # 0
0x0039 (0x000072) 0x7014- f:00070 d: 20 | P = P + 20 (0x004D)
0x003A (0x000074) 0x215E- f:00020 d: 350 | A = OR[350]
0x003B (0x000076) 0x297F- f:00024 d: 383 | OR[383] = A
0x003C (0x000078) 0xEA00- f:00165 d: 0 | IOB , fn005 @ Select track (cylinder) from OR[350]
0x003D (0x00007A) 0x0000- f:00000 d: 0 | PASS
0x003E (0x00007C) 0x4400- f:00042 d: 0 | C = 1, IOB = DN
0x003F (0x00007E) 0x8801- f:00104 d: 1 | P = P - 1 (0x003E), C = 0
0x0040 (0x000080) 0x4600- f:00043 d: 0 | C = 1, IOB = BZ
0x0041 (0x000082) 0x8202- f:00101 d: 2 | P = P + 2 (0x0043), C = 1
0x0042 (0x000084) 0x7009- f:00070 d: 9 | P = P + 9 (0x004B)
0x0043 (0x000086) 0x743D- f:00072 d: 61 | R = P + 61 (0x0080)
0x0044 (0x000088) 0x2D64- f:00026 d: 356 | OR[356] = OR[356] + 1
0x0045 (0x00008A) 0x4200- f:00041 d: 0 | C = 1, io 0000 (IOR) = BZ
0x0046 (0x00008C) 0x160A- f:00013 d: 10 | A = A - 10 (0x000A)
0x0047 (0x00008E) 0x880D- f:00104 d: 13 | P = P - 13 (0x003A), C = 0
0x0048 (0x000090) 0x1002- f:00010 d: 2 | A = 2 (0x0002)
0x0049 (0x000092) 0x2963- f:00024 d: 355 | OR[355] = A
0x004A (0x000094) 0x0200- f:00001 d: 0 | EXIT
0x004B (0x000096) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x004C (0x000098) 0x2964- f:00024 d: 356 | OR[356] = A
0x004D (0x00009A) 0x2160- f:00020 d: 352 | A = OR[352] @ Set traget buffer
0x004E (0x00009C) 0xF800- f:00174 d: 0 | IOB , fn014
0x004F (0x00009E) 0x215F- f:00020 d: 351 | A = OR[351]
0x0050 (0x0000A0) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x0051 (0x0000A2) 0x8402- f:00102 d: 2 | P = P + 2 (0x0053), A = 0
0x0052 (0x0000A4) 0x7004- f:00070 d: 4 | P = P + 4 (0x0056)
0x0053 (0x0000A6) 0x215C- f:00020 d: 348 | A = OR[348] @ Read sector
0x0054 (0x0000A8) 0xE400- f:00162 d: 0 | IOB , fn002
0x0055 (0x0000AA) 0x7003- f:00070 d: 3 | P = P + 3 (0x0058)
0x0056 (0x0000AC) 0x215C- f:00020 d: 348 | A = OR[348] @ Write sector
0x0057 (0x0000AE) 0xE600- f:00163 d: 0 | IOB , fn003
0x0058 (0x0000B0) 0x215C- f:00020 d: 348 | A = OR[348] @ Pre-select next head, unless it's the last sector in the track
0x0059 (0x0000B2) 0x1611- f:00013 d: 17 | A = A - 17 (0x0011)
0x005A (0x0000B4) 0x8402- f:00102 d: 2 | P = P + 2 (0x005C), A = 0
0x005B (0x0000B6) 0x700A- f:00070 d: 10 | P = P + 10 (0x0065)
0x005C (0x0000B8) 0x217E- f:00020 d: 382 | A = OR[382]
0x005D (0x0000BA) 0x1609- f:00013 d: 9 | A = A - 9 (0x0009)
0x005E (0x0000BC) 0x8402- f:00102 d: 2 | P = P + 2 (0x0060), A = 0
0x005F (0x0000BE) 0x7004- f:00070 d: 4 | P = P + 4 (0x0063)
0x0060 (0x0000C0) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0061 (0x0000C2) 0x297E- f:00024 d: 382 | OR[382] = A
0x0062 (0x0000C4) 0x7002- f:00070 d: 2 | P = P + 2 (0x0064)
0x0063 (0x0000C6) 0x2D7E- f:00026 d: 382 | OR[382] = OR[382] + 1
0x0064 (0x0000C8) 0xE800- f:00164 d: 0 | IOB , fn004 @ Select next head
0x0065 (0x0000CA) 0x4400- f:00042 d: 0 | C = 1, IOB = DN
0x0066 (0x0000CC) 0x8801- f:00104 d: 1 | P = P - 1 (0x0065), C = 0
0x0067 (0x0000CE) 0x4600- f:00043 d: 0 | C = 1, IOB = BZ
0x0068 (0x0000D0) 0x8202- f:00101 d: 2 | P = P + 2 (0x006A), C = 1
0x0069 (0x0000D2) 0x0200- f:00001 d: 0 | EXIT
0x006A (0x0000D4) 0x7416- f:00072 d: 22 | R = P + 22 (0x0080)
0x006B (0x0000D6) 0x2D64- f:00026 d: 356 | OR[356] = OR[356] + 1
0x006C (0x0000D8) 0x4200- f:00041 d: 0 | C = 1, io 0000 (IOR) = BZ
0x006D (0x0000DA) 0x1608- f:00013 d: 8 | A = A - 8 (0x0008)
0x006E (0x0000DC) 0x8202- f:00101 d: 2 | P = P + 2 (0x0070), C = 1
0x006F (0x0000DE) 0x7004- f:00070 d: 4 | P = P + 4 (0x0073)
0x0070 (0x0000E0) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0071 (0x0000E2) 0x2963- f:00024 d: 355 | OR[355] = A
0x0072 (0x0000E4) 0x0200- f:00001 d: 0 | EXIT
0x0073 (0x0000E6) 0x215C- f:00020 d: 348 | A = OR[348]
0x0074 (0x0000E8) 0x1611- f:00013 d: 17 | A = A - 17 (0x0011)
0x0075 (0x0000EA) 0x8402- f:00102 d: 2 | P = P + 2 (0x0077), A = 0
0x0076 (0x0000EC) 0x7009- f:00070 d: 9 | P = P + 9 (0x007F)
0x0077 (0x0000EE) 0x217E- f:00020 d: 382 | A = OR[382]
0x0078 (0x0000F0) 0x8402- f:00102 d: 2 | P = P + 2 (0x007A), A = 0
0x0079 (0x0000F2) 0x7004- f:00070 d: 4 | P = P + 4 (0x007D)
0x007A (0x0000F4) 0x1009- f:00010 d: 9 | A = 9 (0x0009)
0x007B (0x0000F6) 0x297E- f:00024 d: 382 | OR[382] = A
0x007C (0x0000F8) 0x7002- f:00070 d: 2 | P = P + 2 (0x007E)
0x007D (0x0000FA) 0x2F7E- f:00027 d: 382 | OR[382] = OR[382] - 1
0x007E (0x0000FC) 0xE800- f:00164 d: 0 | IOB , fn004
0x007F (0x0000FE) 0x7232- f:00071 d: 50 | P = P - 50 (0x004D)
0x0080 (0x000100) 0xE000- f:00160 d: 0 | IOB , fn000
0x0081 (0x000102) 0x1800-0x0400 f:00014 d: 0 | A = 1024 (0x0400)
0x0083 (0x000106) 0xE200- f:00161 d: 0 | IOB , fn001
0x0084 (0x000108) 0x4400- f:00042 d: 0 | C = 1, IOB = DN
0x0085 (0x00010A) 0x8801- f:00104 d: 1 | P = P - 1 (0x0084), C = 0
0x0086 (0x00010C) 0x0200- f:00001 d: 0 | EXIT
@ Function code '4' - Release unit
0x0087 (0x00010E) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0088 (0x000110) 0xE200- f:00161 d: 0 | IOB , fn001
0x0089 (0x000112) 0x0200- f:00001 d: 0 | EXIT
0x008A (0x000114) 0x0000- f:00000 d: 0 | PASS
0x008B (0x000116) 0x0000- f:00000 d: 0 | PASS
|
library/fmGUI_Menus/fmGUI_Wait_MenuItemAvailable.applescript | NYHTC/applescript-fm-helper | 1 | 1699 | <reponame>NYHTC/applescript-fm-helper<filename>library/fmGUI_Menus/fmGUI_Wait_MenuItemAvailable.applescript
-- fmGUI_Wait_MenuItemAvailable({menuItemRef:null, maxTimeoutSec:60, checkFrequencySec:0.5})
-- <NAME>, NYHTC
-- wait until the specified menu item is available
(*
HISTORY:
2020-03-04 ( dshockley ): Standardized version.
1.0 - 2017-11-06 ( eshagdar ): taken from the sub-handler ( which should return an asnwer right away instead of wating ).
REQUIRES:
fmGUI_AppFrontMost
*)
on run
tell application "System Events"
tell application process "FileMaker Pro Advanced"
set copyMenuItem to menu item "Copy" of menu 1 of menu bar item "Edit" of menu bar 1
end tell
end tell
fmGUI_Wait_MenuItemAvailable({menuItemRef:copyMenuItem})
end run
--------------------
-- START OF CODE
--------------------
on fmGUI_Wait_MenuItemAvailable(prefs)
-- version 2020-03-04-1535
try
set defaultPrefs to {menuItemRef:null, maxTimeoutSec:60, checkFrequencySec:0.5}
set prefs to prefs & defaultPrefs
if menuItemRef of prefs is null then error "menuItemRef not specified" number -1024
fmGUI_AppFrontMost()
repeat ((maxTimeoutSec of prefs) / (checkFrequencySec of prefs) as integer) times
if fmGUI_MenuItemAvailable({menuItemRef:menuItemRef of prefs}) then return true
end repeat
return false
on error errMsg number errNum
error "Couldn't fmGUI_Wait_MenuItemAvailable - " & errMsg number errNum
end try
end fmGUI_Wait_MenuItemAvailable
--------------------
-- END OF CODE
--------------------
on fmGUI_AppFrontMost()
tell application "htcLib" to fmGUI_AppFrontMost()
end fmGUI_AppFrontMost
on fmGUI_MenuItemAvailable(prefs)
tell application "htcLib" to fmGUI_MenuItemAvailable({menuItemRef:my coerceToString(menuItemRef of prefs)} & prefs)
end fmGUI_MenuItemAvailable
on coerceToString(incomingObject)
-- 2017-07-12 ( eshagdar ): bootstrap code to bring a coerceToString into this file for the sample to run ( instead of having a copy of the handler locally ).
tell application "Finder" to set coercePath to (container of (container of (path to me)) as text) & "text parsing:coerceToString.applescript"
set codeCoerce to read file coercePath as text
tell application "htcLib" to set codeCoerce to "script codeCoerce " & return & getTextBetween({sourceText:codeCoerce, beforeText:"-- START OF CODE", afterText:"-- END OF CODE"}) & return & "end script" & return & "return codeCoerce"
set codeCoerce to run script codeCoerce
tell codeCoerce to coerceToString(incomingObject)
end coerceToString
|
src/fot/FOTC/Program/SortList/Properties/Totality/ListN-ATP.agda | asr/fotc | 11 | 11172 | <reponame>asr/fotc
------------------------------------------------------------------------------
-- Totality properties respect to ListN
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Program.SortList.Properties.Totality.ListN-ATP where
open import FOTC.Base
open import FOTC.Data.Nat.List.Type
open import FOTC.Data.Nat.List.PropertiesATP
open import FOTC.Program.SortList.SortList
------------------------------------------------------------------------------
-- The function flatten generates a ListN.
flatten-ListN : ∀ {t} → Tree t → ListN (flatten t)
flatten-ListN tnil = prf
where postulate prf : ListN (flatten nil)
{-# ATP prove prf #-}
flatten-ListN (ttip {i} Ni) = prf
where postulate prf : ListN (flatten (tip i))
{-# ATP prove prf #-}
flatten-ListN (tnode {t₁} {i} {t₂} Tt₁ Ni Tt₂) =
prf (flatten-ListN Tt₁) (flatten-ListN Tt₂)
where postulate prf : ListN (flatten t₁) →
ListN (flatten t₂) →
ListN (flatten (node t₁ i t₂))
|
oeis/177/A177970.asm | neoneye/loda-programs | 11 | 240028 | <gh_stars>10-100
; A177970: Array T(n,m) = A177944(2*n,2*m) read by antidiagonals.
; Submitted by <NAME>
; 1,1,1,1,26,1,1,99,99,1,1,244,622,244,1,1,485,2300,2300,485,1,1,846,6423,12000,6423,846,1,1,1351,15001,45031,45031,15001,1351,1,1,2024,30924,136120,218774,136120,30924,2024,1,1,2889,58122,352698,831384,831384,352698,58122,2889,1,1,3970,101725,813940,2645350,3879856,2645350,813940,101725,3970,1,1,5291,168223,1716077,7354688,14872836,14872836,7354688,1716077,168223,5291,1,1,6876,265626,3364876,18386751,49031376,67603876,49031376,18386751,3364876,265626,6876,1,1,8749,403624,6216184,42181399
mul $0,2
lpb $0
add $2,2
sub $0,$2
mov $1,$2
bin $1,$0
sub $1,1
lpe
add $2,1
mul $2,2
mul $2,$1
mov $0,$2
div $0,2
add $0,1
|
45/qb/ir/exlit.asm | minblock/msdos | 0 | 173674 | <filename>45/qb/ir/exlit.asm
page 49,132
TITLE ExLit - exLiteral Executors
;***
;exLit.asm - executors for literals
;
; Copyright <C> 1986, Microsoft Corporation
;
;Purpose:
;
; This module contains all literal executors.
;
; Numeric literal executors include:
; - support for arbitrary literals. This includes literal executors
; of each numeric data type with an operand of the size of the data
; type.
; - special support for common numeric literals. For text size reasons
; I2 and R4 literal executors for the literals 0 through 10 are
; provided. These executors are also considered speed critical.
;
; The string literal executor has two operands - a word sized byte
; count and the actual string literal. The text pointer must be
; updated to the next even byte boundary by the string literal executor
; as all text is on even byte boundaries.
;
;
;****************************************************************************
.xlist
include version.inc
IncludeOnce executor
IncludeOnce exint
IncludeOnce extort
IncludeOnce variable
IncludeOnce opintrsc
IncludeOnce opaftqb4
IncludeOnce pcode
IncludeOnce debug
.list
assumes cs, CODE
assumes es, NOTHING
assumes ss, DATA
sBegin CODE
I2 dw 2
I3 dw 3
I4 dw 4
I5 dw 5
I6 dw 6
I7 dw 7
I8 dw 8
I9 dw 9
I10 dw 10
;Rewritten with [9]
MakeExe exLitR80,opLitI2,0
fldz
DispMac
MakeExe exLitR81,opLitI2,1
fld1
DispMac
MakeExe exLitR82,opLitI2,2
mov bx,codeOFFSET I2
LitR8:
fild word ptr cs:[bx]
DispMac
MakeExe exLitR83,opLitI2,3
mov bx,codeOFFSET I3
jmp LitR8
MakeExe exLitR84,opLitI2,4
mov bx,codeOFFSET I4
jmp LitR8
MakeExe exLitR85,opLitI2,5
mov bx,codeOFFSET I5
jmp LitR8
MakeExe exLitR86,opLitI2,6
mov bx,codeOFFSET I6
jmp LitR8
MakeExe exLitR87,opLitI2,7
mov bx,codeOFFSET I7
jmp LitR8
MakeExe exLitR88,opLitI2,8
mov bx,codeOFFSET I8
jmp LitR8
MakeExe exLitR89,opLitI2,9
mov bx,codeOFFSET I9
jmp LitR8
MakeExe exLitR810,opLitI2,10
mov bx,codeOFFSET I10
jmp LitR8
;End of [9]
MakeExe exNull,opNull
SkipExHeader ;fall through to share exLitI20 code
MakeExe exLitI20,opLitI2,0
xor ax,ax
push ax
DispMac
MakeExe exLitI21,opLitI2,1
mov al,1
LitI2_Gen:
xor ah,ah
push ax
DispMac
MakeExe exLitI22,opLitI2,2
mov al,2
jmp short LitI2_Gen
MakeExe exLitI23,opLitI2,3
mov al,3
jmp short LitI2_Gen
MakeExe exLitI24,opLitI2,4
mov al,4
jmp short LitI2_Gen
MakeExe exLitI25,opLitI2,5
mov al,5
jmp short LitI2_Gen
MakeExe exLitI26,opLitI2,6
mov al,6
jmp short LitI2_Gen
MakeExe exLitI27,opLitI2,7
mov al,7
jmp short LitI2_Gen
MakeExe exLitI28,opLitI2,8
mov al,8
jmp short LitI2_Gen
MakeExe exLitI29,opLitI2,9
mov al,9
jmp short LitI2_Gen
MakeExe exLitI210,opLitI2,10
mov al,10
jmp short LitI2_Gen
MakeExe exLitHI2,opLitHI2
SkipExHeader ;Fall through to the next executor
MakeExe exLitOI2,opLitOI2
SkipExHeader ;Fall through to the next executor
MakeExe exLitDI2,opLitDI2
LitI2:
LODSWTX
Disp_Ax:
push ax
DispMac
MakeExe exUndef,opUndef
mov ax,UNDEFINED
jmp short Disp_Ax ;push UNDEFINED and dispatch
MakeExe exLitR4,opLitR4
fld dword ptr es:[si]
add si,4
DispMac
MakeExe exLitR8,opLitR8
fld qword ptr es:[si]
add si,8
DispMac
MakeExe exLitHI4,opLitHI4
SkipExHeader ;Fall through to the next executor
MakeExe exLitOI4,opLitOI4
SkipExHeader ;Fall through to the next executor
MakeExe exLitDI4,opLitDI4
LODSWTX
xchg ax,dx
LODSWTX
Lit4:
push ax
Lit4_Exit:
push dx
DispMac
MakeExe exLitSD,opLitSD
LODSWTX ;ax = length of string in bytes
push es ;3 parms to B$LDFS
push si
push ax
inc ax ;round count up - - - pcodes always
and al,0FEh ; fall on even byte boundaries, so if
; string size is odd, a byte of garbage
; filler is put in pcode here
add si,ax ;move text ptr to next opcode
CALLRT B$LDFS,DispMovSd
sEnd CODE
end
|
alloy4fun_models/trashltl/models/7/RAydSH6iaRnDyMHQo.als | Kaixi26/org.alloytools.alloy | 0 | 3450 | open main
pred idRAydSH6iaRnDyMHQo_prop8 {
}
pred __repair { idRAydSH6iaRnDyMHQo_prop8 }
check __repair { idRAydSH6iaRnDyMHQo_prop8 <=> prop8o } |
GUI_test/src/screen_parameters-gtkada_800x480.ads | Fabien-Chouteau/coffee-clock | 7 | 16350 | <reponame>Fabien-Chouteau/coffee-clock<filename>GUI_test/src/screen_parameters-gtkada_800x480.ads
with Cairo;
with Cairo.Image_Surface; use Cairo.Image_Surface;
package Screen_Parameters is
subtype Width is Natural range 0 .. 799;
subtype Height is Natural range 0 .. 479;
subtype Color is ARGB32_Data;
end Screen_Parameters;
|
programs/oeis/302/A302332.asm | neoneye/loda | 22 | 17389 | ; A302332: a(0)=1, a(1)=193; for n>1, a(n) = 194*a(n-1) - a(n-2).
; 1,193,37441,7263361,1409054593,273349327681,53028360515521,10287228590683393,1995669318232062721,387149560508429484481,75105019069317087926593,14569986549887006628274561,2826502285659009968797338241,548326873431298046940055344193,106372586943386162096401939435201,20635733540143484148655036195084801
seq $0,82841 ; a(n) = 4*a(n-1) - a(n-2) for n>1, a(0)=3, a(1)=9.
pow $0,2
sub $0,81
div $0,3
add $0,26
pow $0,2
div $0,672
mul $0,192
add $0,1
|
programs/oeis/066/A066628.asm | neoneye/loda | 22 | 247356 | ; A066628: a(n) = n - the largest Fibonacci number <= n.
; 0,0,0,0,1,0,1,2,0,1,2,3,4,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,8,9,10,11,12,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,0,1,2,3,4,5,6,7,8,9,10
lpb $0
sub $0,1
mov $2,$0
trn $0,$3
trn $1,$2
add $3,$1
mov $1,$2
lpe
mov $0,$1
|
test/asset/agda-stdlib-1.0/Data/List/Relation/Binary/Sublist/Heterogeneous/Properties.agda | omega12345/agda-mode | 0 | 5769 | <gh_stars>0
-----------------------------------------------------------------------
-- The Agda standard library
--
-- Properties of the heterogeneous sublist relation
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.List.Relation.Binary.Sublist.Heterogeneous.Properties where
open import Data.Empty
open import Data.List.Relation.Unary.Any using (Any; here; there)
open import Data.List.Base as List hiding (map; _∷ʳ_)
import Data.List.Properties as Lₚ
open import Data.List.Relation.Unary.Any.Properties
using (here-injective; there-injective)
open import Data.List.Relation.Binary.Pointwise as Pw using (Pointwise; []; _∷_)
open import Data.List.Relation.Binary.Sublist.Heterogeneous
open import Data.Maybe.Relation.Unary.All as MAll using (nothing; just)
open import Data.Nat using (ℕ; _≤_; _≥_); open ℕ; open _≤_
import Data.Nat.Properties as ℕₚ
open import Data.Product using (_×_; uncurry)
open import Function
open import Function.Bijection using (_⤖_; bijection)
open import Function.Equivalence using (_⇔_ ; equivalence)
open import Relation.Nullary using (yes; no; ¬_)
open import Relation.Nullary.Negation using (¬?)
import Relation.Nullary.Decidable as Dec
open import Relation.Unary as U using (Pred; _⊆_)
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as P using (_≡_)
------------------------------------------------------------------------
-- Injectivity of constructors
module _ {a b r} {A : Set a} {B : Set b} {R : REL A B r} where
∷-injectiveˡ : ∀ {x y xs ys} {px qx : R x y} {pxs qxs : Sublist R xs ys} →
(Sublist R (x ∷ xs) (y ∷ ys) ∋ px ∷ pxs) ≡ (qx ∷ qxs) → px ≡ qx
∷-injectiveˡ P.refl = P.refl
∷-injectiveʳ : ∀ {x y xs ys} {px qx : R x y} {pxs qxs : Sublist R xs ys} →
(Sublist R (x ∷ xs) (y ∷ ys) ∋ px ∷ pxs) ≡ (qx ∷ qxs) → pxs ≡ qxs
∷-injectiveʳ P.refl = P.refl
∷ʳ-injective : ∀ {y xs ys} {pxs qxs : Sublist R xs ys} →
(Sublist R xs (y ∷ ys) ∋ y ∷ʳ pxs) ≡ (y ∷ʳ qxs) → pxs ≡ qxs
∷ʳ-injective P.refl = P.refl
module _ {a b r} {A : Set a} {B : Set b} {R : REL A B r} where
length-mono-≤ : ∀ {as bs} → Sublist R as bs → length as ≤ length bs
length-mono-≤ [] = z≤n
length-mono-≤ (y ∷ʳ rs) = ℕₚ.≤-step (length-mono-≤ rs)
length-mono-≤ (r ∷ rs) = s≤s (length-mono-≤ rs)
------------------------------------------------------------------------
-- Conversion to and from Pointwise (proto-reflexivity)
fromPointwise : Pointwise R ⇒ Sublist R
fromPointwise [] = []
fromPointwise (p ∷ ps) = p ∷ fromPointwise ps
toPointwise : ∀ {as bs} → length as ≡ length bs →
Sublist R as bs → Pointwise R as bs
toPointwise {bs = []} eq [] = []
toPointwise {bs = b ∷ bs} eq (r ∷ rs) = r ∷ toPointwise (ℕₚ.suc-injective eq) rs
toPointwise {bs = b ∷ bs} eq (b ∷ʳ rs) =
⊥-elim $ ℕₚ.<-irrefl eq (s≤s (length-mono-≤ rs))
------------------------------------------------------------------------
-- Various functions' outputs are sublists
-- These lemmas are generalisations of results of the form `f xs ⊆ xs`.
-- (where _⊆_ stands for Sublist R). If R is reflexive then we can indeed
-- obtain `f xs ⊆ xs` from `xs ⊆ ys → f xs ⊆ ys`. The other direction is
-- only true if R is both reflexive and transitive.
module _ {a b r} {A : Set a} {B : Set b} {R : REL A B r} where
tail-Sublist : ∀ {as bs} → Sublist R as bs →
MAll.All (λ as → Sublist R as bs) (tail as)
tail-Sublist [] = nothing
tail-Sublist (b ∷ʳ ps) = MAll.map (b ∷ʳ_) (tail-Sublist ps)
tail-Sublist (p ∷ ps) = just (_ ∷ʳ ps)
take-Sublist : ∀ {as bs} n → Sublist R as bs → Sublist R (take n as) bs
take-Sublist n (y ∷ʳ rs) = y ∷ʳ take-Sublist n rs
take-Sublist zero rs = minimum _
take-Sublist (suc n) [] = []
take-Sublist (suc n) (r ∷ rs) = r ∷ take-Sublist n rs
drop-Sublist : ∀ n → Sublist R ⇒ (Sublist R ∘′ drop n)
drop-Sublist n (y ∷ʳ rs) = y ∷ʳ drop-Sublist n rs
drop-Sublist zero rs = rs
drop-Sublist (suc n) [] = []
drop-Sublist (suc n) (r ∷ rs) = _ ∷ʳ drop-Sublist n rs
module _ {a b r p} {A : Set a} {B : Set b}
{R : REL A B r} {P : Pred A p} (P? : U.Decidable P) where
takeWhile-Sublist : ∀ {as bs} → Sublist R as bs → Sublist R (takeWhile P? as) bs
takeWhile-Sublist [] = []
takeWhile-Sublist (y ∷ʳ rs) = y ∷ʳ takeWhile-Sublist rs
takeWhile-Sublist {a ∷ as} (r ∷ rs) with P? a
... | yes pa = r ∷ takeWhile-Sublist rs
... | no ¬pa = minimum _
dropWhile-Sublist : ∀ {as bs} → Sublist R as bs → Sublist R (dropWhile P? as) bs
dropWhile-Sublist [] = []
dropWhile-Sublist (y ∷ʳ rs) = y ∷ʳ dropWhile-Sublist rs
dropWhile-Sublist {a ∷ as} (r ∷ rs) with P? a
... | yes pa = _ ∷ʳ dropWhile-Sublist rs
... | no ¬pa = r ∷ rs
filter-Sublist : ∀ {as bs} → Sublist R as bs → Sublist R (filter P? as) bs
filter-Sublist [] = []
filter-Sublist (y ∷ʳ rs) = y ∷ʳ filter-Sublist rs
filter-Sublist {a ∷ as} (r ∷ rs) with P? a
... | yes pa = r ∷ filter-Sublist rs
... | no ¬pa = _ ∷ʳ filter-Sublist rs
------------------------------------------------------------------------
-- Various functions are increasing wrt _⊆_
-- We write f⁺ for the proof that `xs ⊆ ys → f xs ⊆ f ys`
-- and f⁻ for the one that `f xs ⊆ f ys → xs ⊆ ys`.
module _ {a b r} {A : Set a} {B : Set b} {R : REL A B r} where
------------------------------------------------------------------------
-- _∷_
∷ˡ⁻ : ∀ {a as bs} → Sublist R (a ∷ as) bs → Sublist R as bs
∷ˡ⁻ (y ∷ʳ rs) = y ∷ʳ ∷ˡ⁻ rs
∷ˡ⁻ (r ∷ rs) = _ ∷ʳ rs
∷ʳ⁻ : ∀ {a as b bs} → ¬ R a b → Sublist R (a ∷ as) (b ∷ bs) →
Sublist R (a ∷ as) bs
∷ʳ⁻ ¬r (y ∷ʳ rs) = rs
∷ʳ⁻ ¬r (r ∷ rs) = ⊥-elim (¬r r)
∷⁻ : ∀ {a as b bs} → Sublist R (a ∷ as) (b ∷ bs) → Sublist R as bs
∷⁻ (y ∷ʳ rs) = ∷ˡ⁻ rs
∷⁻ (x ∷ rs) = rs
module _ {a b c d r} {A : Set a} {B : Set b} {C : Set c} {D : Set d}
{R : REL C D r} where
------------------------------------------------------------------------
-- map
map⁺ : ∀ {as bs} (f : A → C) (g : B → D) →
Sublist (λ a b → R (f a) (g b)) as bs →
Sublist R (List.map f as) (List.map g bs)
map⁺ f g [] = []
map⁺ f g (y ∷ʳ rs) = g y ∷ʳ map⁺ f g rs
map⁺ f g (r ∷ rs) = r ∷ map⁺ f g rs
map⁻ : ∀ {as bs} (f : A → C) (g : B → D) →
Sublist R (List.map f as) (List.map g bs) →
Sublist (λ a b → R (f a) (g b)) as bs
map⁻ {[]} {bs} f g rs = minimum _
map⁻ {a ∷ as} {[]} f g ()
map⁻ {a ∷ as} {b ∷ bs} f g (_ ∷ʳ rs) = b ∷ʳ map⁻ f g rs
map⁻ {a ∷ as} {b ∷ bs} f g (r ∷ rs) = r ∷ map⁻ f g rs
module _ {a b r} {A : Set a} {B : Set b} {R : REL A B r} where
------------------------------------------------------------------------
-- _++_
++⁺ : ∀ {as bs cs ds} → Sublist R as bs → Sublist R cs ds →
Sublist R (as ++ cs) (bs ++ ds)
++⁺ [] cds = cds
++⁺ (y ∷ʳ abs) cds = y ∷ʳ ++⁺ abs cds
++⁺ (ab ∷ abs) cds = ab ∷ ++⁺ abs cds
++⁻ : ∀ {as bs cs ds} → length as ≡ length bs →
Sublist R (as ++ cs) (bs ++ ds) → Sublist R cs ds
++⁻ {[]} {[]} eq rs = rs
++⁻ {a ∷ as} {b ∷ bs} eq rs = ++⁻ (ℕₚ.suc-injective eq) (∷⁻ rs)
++⁻ {[]} {_ ∷ _} ()
++⁻ {_ ∷ _} {[]} ()
++ˡ : ∀ {as bs} (cs : List B) → Sublist R as bs → Sublist R as (cs ++ bs)
++ˡ zs = ++⁺ (minimum zs)
++ʳ : ∀ {as bs} (cs : List B) → Sublist R as bs → Sublist R as (bs ++ cs)
++ʳ cs [] = minimum cs
++ʳ cs (y ∷ʳ rs) = y ∷ʳ ++ʳ cs rs
++ʳ cs (r ∷ rs) = r ∷ ++ʳ cs rs
------------------------------------------------------------------------
-- take / drop
take⁺ : ∀ {m n as bs} → m ≤ n → Pointwise R as bs →
Sublist R (take m as) (take n bs)
take⁺ z≤n ps = minimum _
take⁺ (s≤s m≤n) [] = []
take⁺ (s≤s m≤n) (p ∷ ps) = p ∷ take⁺ m≤n ps
drop⁺ : ∀ {m n as bs} → m ≥ n → Sublist R as bs →
Sublist R (drop m as) (drop n bs)
drop⁺ {m} z≤n rs = drop-Sublist m rs
drop⁺ (s≤s m≥n) [] = []
drop⁺ (s≤s m≥n) (y ∷ʳ rs) = drop⁺ (ℕₚ.≤-step m≥n) rs
drop⁺ (s≤s m≥n) (r ∷ rs) = drop⁺ m≥n rs
drop⁺-≥ : ∀ {m n as bs} → m ≥ n → Pointwise R as bs →
Sublist R (drop m as) (drop n bs)
drop⁺-≥ m≥n pw = drop⁺ m≥n (fromPointwise pw)
drop⁺-⊆ : ∀ {as bs} m → Sublist R as bs →
Sublist R (drop m as) (drop m bs)
drop⁺-⊆ m = drop⁺ (ℕₚ.≤-refl {m})
module _ {a b r p q} {A : Set a} {B : Set b}
{R : REL A B r} {P : Pred A p} {Q : Pred B q}
(P? : U.Decidable P) (Q? : U.Decidable Q) where
⊆-takeWhile-Sublist : ∀ {as bs} →
(∀ {a b} → R a b → P a → Q b) →
Pointwise R as bs → Sublist R (takeWhile P? as) (takeWhile Q? bs)
⊆-takeWhile-Sublist rp⇒q [] = []
⊆-takeWhile-Sublist {a ∷ as} {b ∷ bs} rp⇒q (p ∷ ps) with P? a | Q? b
... | yes pa | yes qb = p ∷ ⊆-takeWhile-Sublist rp⇒q ps
... | yes pa | no ¬qb = ⊥-elim $ ¬qb $ rp⇒q p pa
... | no ¬pa | yes qb = minimum _
... | no ¬pa | no ¬qb = []
⊇-dropWhile-Sublist : ∀ {as bs} →
(∀ {a b} → R a b → Q b → P a) →
Pointwise R as bs → Sublist R (dropWhile P? as) (dropWhile Q? bs)
⊇-dropWhile-Sublist rq⇒p [] = []
⊇-dropWhile-Sublist {a ∷ as} {b ∷ bs} rq⇒p (p ∷ ps) with P? a | Q? b
... | yes pa | yes qb = ⊇-dropWhile-Sublist rq⇒p ps
... | yes pa | no ¬qb = b ∷ʳ dropWhile-Sublist P? (fromPointwise ps)
... | no ¬pa | yes qb = ⊥-elim $ ¬pa $ rq⇒p p qb
... | no ¬pa | no ¬qb = p ∷ fromPointwise ps
⊆-filter-Sublist : ∀ {as bs} → (∀ {a b} → R a b → P a → Q b) →
Sublist R as bs → Sublist R (filter P? as) (filter Q? bs)
⊆-filter-Sublist rp⇒q [] = []
⊆-filter-Sublist rp⇒q (y ∷ʳ rs) with Q? y
... | yes qb = y ∷ʳ ⊆-filter-Sublist rp⇒q rs
... | no ¬qb = ⊆-filter-Sublist rp⇒q rs
⊆-filter-Sublist {a ∷ as} {b ∷ bs} rp⇒q (r ∷ rs) with P? a | Q? b
... | yes pa | yes qb = r ∷ ⊆-filter-Sublist rp⇒q rs
... | yes pa | no ¬qb = ⊥-elim $ ¬qb $ rp⇒q r pa
... | no ¬pa | yes qb = _ ∷ʳ ⊆-filter-Sublist rp⇒q rs
... | no ¬pa | no ¬qb = ⊆-filter-Sublist rp⇒q rs
module _ {a r p} {A : Set a} {R : Rel A r} {P : Pred A p} (P? : U.Decidable P) where
takeWhile-filter : ∀ {as} → Pointwise R as as →
Sublist R (takeWhile P? as) (filter P? as)
takeWhile-filter [] = []
takeWhile-filter {a ∷ as} (p ∷ ps) with P? a
... | yes pa = p ∷ takeWhile-filter ps
... | no ¬pa = minimum _
filter-dropWhile : ∀ {as} → Pointwise R as as →
Sublist R (filter P? as) (dropWhile (¬? ∘ P?) as)
filter-dropWhile [] = []
filter-dropWhile {a ∷ as} (p ∷ ps) with P? a
... | yes pa = p ∷ filter-Sublist P? (fromPointwise ps)
... | no ¬pa = filter-dropWhile ps
------------------------------------------------------------------------
-- reverse
module _ {a b r} {A : Set a} {B : Set b} {R : REL A B r} where
reverseAcc⁺ : ∀ {as bs cs ds} → Sublist R as bs → Sublist R cs ds →
Sublist R (reverseAcc cs as) (reverseAcc ds bs)
reverseAcc⁺ [] cds = cds
reverseAcc⁺ (y ∷ʳ abs) cds = reverseAcc⁺ abs (y ∷ʳ cds)
reverseAcc⁺ (r ∷ abs) cds = reverseAcc⁺ abs (r ∷ cds)
reverse⁺ : ∀ {as bs} → Sublist R as bs → Sublist R (reverse as) (reverse bs)
reverse⁺ rs = reverseAcc⁺ rs []
reverse⁻ : ∀ {as bs} → Sublist R (reverse as) (reverse bs) → Sublist R as bs
reverse⁻ {as} {bs} p = cast (reverse⁺ p) where
cast = P.subst₂ (Sublist R) (Lₚ.reverse-involutive as) (Lₚ.reverse-involutive bs)
------------------------------------------------------------------------
-- Inversion lemmas
module _ {a b r} {A : Set a} {B : Set b} {R : REL A B r} {a as b bs} where
∷⁻¹ : R a b → Sublist R as bs ⇔ Sublist R (a ∷ as) (b ∷ bs)
∷⁻¹ r = equivalence (r ∷_) ∷⁻
∷ʳ⁻¹ : ¬ R a b → Sublist R (a ∷ as) bs ⇔ Sublist R (a ∷ as) (b ∷ bs)
∷ʳ⁻¹ ¬r = equivalence (_ ∷ʳ_) (∷ʳ⁻ ¬r)
------------------------------------------------------------------------
-- Irrelevant special case
module _ {a b r} {A : Set a} {B : Set b} {R : REL A B r} where
Sublist-[]-irrelevant : U.Irrelevant (Sublist R [])
Sublist-[]-irrelevant [] [] = P.refl
Sublist-[]-irrelevant (y ∷ʳ p) (.y ∷ʳ q) = P.cong (y ∷ʳ_) (Sublist-[]-irrelevant p q)
------------------------------------------------------------------------
-- (to/from)Any is a bijection
toAny-injective : ∀ {xs x} {p q : Sublist R [ x ] xs} → toAny p ≡ toAny q → p ≡ q
toAny-injective {p = y ∷ʳ p} {y ∷ʳ q} =
P.cong (y ∷ʳ_) ∘′ toAny-injective ∘′ there-injective
toAny-injective {p = _ ∷ p} {_ ∷ q} =
P.cong₂ (flip _∷_) (Sublist-[]-irrelevant p q) ∘′ here-injective
toAny-injective {p = _ ∷ʳ _} {_ ∷ _} = λ ()
toAny-injective {p = _ ∷ _} {_ ∷ʳ _} = λ ()
fromAny-injective : ∀ {xs x} {p q : Any (R x) xs} →
fromAny {R = R} p ≡ fromAny q → p ≡ q
fromAny-injective {p = here px} {here qx} = P.cong here ∘′ ∷-injectiveˡ
fromAny-injective {p = there p} {there q} =
P.cong there ∘′ fromAny-injective ∘′ ∷ʳ-injective
fromAny-injective {p = here _} {there _} = λ ()
fromAny-injective {p = there _} {here _} = λ ()
toAny∘fromAny≗id : ∀ {xs x} (p : Any (R x) xs) → toAny (fromAny {R = R} p) ≡ p
toAny∘fromAny≗id (here px) = P.refl
toAny∘fromAny≗id (there p) = P.cong there (toAny∘fromAny≗id p)
Sublist-[x]-bijection : ∀ {x xs} → (Sublist R [ x ] xs) ⤖ (Any (R x) xs)
Sublist-[x]-bijection = bijection toAny fromAny toAny-injective toAny∘fromAny≗id
------------------------------------------------------------------------
-- Relational properties
module _ {a r} {A : Set a} {R : Rel A r} where
reflexive : Reflexive R → _≡_ ⇒ Sublist R
reflexive R-refl P.refl = fromPointwise (Pw.refl R-refl)
refl : Reflexive R → Reflexive (Sublist R)
refl R-refl = reflexive R-refl P.refl
module _ {a b c r s t} {A : Set a} {B : Set b} {C : Set c}
{R : REL A B r} {S : REL B C s} {T : REL A C t} where
trans : Trans R S T → Trans (Sublist R) (Sublist S) (Sublist T)
trans rs⇒t [] [] = []
trans rs⇒t rs (y ∷ʳ ss) = y ∷ʳ trans rs⇒t rs ss
trans rs⇒t (y ∷ʳ rs) (s ∷ ss) = _ ∷ʳ trans rs⇒t rs ss
trans rs⇒t (r ∷ rs) (s ∷ ss) = rs⇒t r s ∷ trans rs⇒t rs ss
module _ {a b r s e} {A : Set a} {B : Set b}
{R : REL A B r} {S : REL B A s} {E : REL A B e} where
open ℕₚ.≤-Reasoning
antisym : Antisym R S E → Antisym (Sublist R) (Sublist S) (Pointwise E)
antisym rs⇒e [] [] = []
antisym rs⇒e (r ∷ rs) (s ∷ ss) = rs⇒e r s ∷ antisym rs⇒e rs ss
-- impossible cases
antisym rs⇒e (_∷ʳ_ {xs} {ys₁} y rs) (_∷ʳ_ {ys₂} {zs} z ss) =
⊥-elim $ ℕₚ.<-irrefl P.refl $ begin
length (y ∷ ys₁) ≤⟨ length-mono-≤ ss ⟩
length zs ≤⟨ ℕₚ.n≤1+n (length zs) ⟩
length (z ∷ zs) ≤⟨ length-mono-≤ rs ⟩
length ys₁ ∎
antisym rs⇒e (_∷ʳ_ {xs} {ys₁} y rs) (_∷_ {y} {ys₂} {z} {zs} s ss) =
⊥-elim $ ℕₚ.<-irrefl P.refl $ begin
length (z ∷ zs) ≤⟨ length-mono-≤ rs ⟩
length ys₁ ≤⟨ length-mono-≤ ss ⟩
length zs ∎
antisym rs⇒e (_∷_ {x} {xs} {y} {ys₁} r rs) (_∷ʳ_ {ys₂} {zs} z ss) =
⊥-elim $ ℕₚ.<-irrefl P.refl $ begin
length (y ∷ ys₁) ≤⟨ length-mono-≤ ss ⟩
length xs ≤⟨ length-mono-≤ rs ⟩
length ys₁ ∎
module _ {a b r} {A : Set a} {B : Set b} {R : REL A B r} (R? : Decidable R) where
sublist? : Decidable (Sublist R)
sublist? [] ys = yes (minimum ys)
sublist? (x ∷ xs) [] = no λ ()
sublist? (x ∷ xs) (y ∷ ys) with R? x y
... | yes r = Dec.map (∷⁻¹ r) (sublist? xs ys)
... | no ¬r = Dec.map (∷ʳ⁻¹ ¬r) (sublist? (x ∷ xs) ys)
module _ {a e r} {A : Set a} {E : Rel A e} {R : Rel A r} where
isPreorder : IsPreorder E R → IsPreorder (Pointwise E) (Sublist R)
isPreorder ER-isPreorder = record
{ isEquivalence = Pw.isEquivalence ER.isEquivalence
; reflexive = fromPointwise ∘ Pw.map ER.reflexive
; trans = trans ER.trans
} where module ER = IsPreorder ER-isPreorder
isPartialOrder : IsPartialOrder E R → IsPartialOrder (Pointwise E) (Sublist R)
isPartialOrder ER-isPartialOrder = record
{ isPreorder = isPreorder ER.isPreorder
; antisym = antisym ER.antisym
} where module ER = IsPartialOrder ER-isPartialOrder
isDecPartialOrder : IsDecPartialOrder E R →
IsDecPartialOrder (Pointwise E) (Sublist R)
isDecPartialOrder ER-isDecPartialOrder = record
{ isPartialOrder = isPartialOrder ER.isPartialOrder
; _≟_ = Pw.decidable ER._≟_
; _≤?_ = sublist? ER._≤?_
} where module ER = IsDecPartialOrder ER-isDecPartialOrder
module _ {a e r} where
preorder : Preorder a e r → Preorder _ _ _
preorder ER-preorder = record
{ isPreorder = isPreorder ER.isPreorder
} where module ER = Preorder ER-preorder
poset : Poset a e r → Poset _ _ _
poset ER-poset = record
{ isPartialOrder = isPartialOrder ER.isPartialOrder
} where module ER = Poset ER-poset
decPoset : DecPoset a e r → DecPoset _ _ _
decPoset ER-poset = record
{ isDecPartialOrder = isDecPartialOrder ER.isDecPartialOrder
} where module ER = DecPoset ER-poset
|
ada/discovery/ada_synth.adb | FrankBuss/Ada_Synth | 4 | 13503 | <gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- based on the simple_audio example from the Ada_Drivers_Library
-- STM32F4-DISCOVERY board.
-- with Ada.Assertions; use Ada.Assertions;
with HAL; use HAL;
with STM32.Device; use STM32.Device;
with STM32.Board; use STM32.Board;
with STM32.GPIO; use STM32.GPIO;
with HAL.Audio; use HAL.Audio;
with Audio_Stream; use Audio_Stream;
with System; use System;
with Interfaces; use Interfaces;
with Sound_Gen_Interfaces; use Sound_Gen_Interfaces;
with MIDI_Synthesizer; use MIDI_Synthesizer;
with Serial_IO; use Serial_IO;
procedure Ada_Synth is
-- start melody
type Event is record
Time : Integer;
Note : Unsigned_8;
Note_On : Boolean;
end record;
type Events is array (Integer range <>) of Event;
Melody : constant Events := (
(100, 60, True),
(120, 60, False),
(140, 64, True),
(160, 64, False),
(180, 67, True),
(200, 67, False)
);
Start_Time : Integer := 0;
Melody_Index : Integer := Melody'First;
-- audio buffers
subtype Buffer is Audio_Buffer (1 .. 512);
Audio_Data_0 : Buffer := (others => 0);
Audio_Data_1 : Buffer := (others => 0);
-- MIDI parser and sound generator
Main_Synthesizer : constant access Synthesizer'Class := Create_Synthesizer;
-- test output for measuring the runtime of the sound generator
Test_Out : GPIO_Point := PD0;
Configuration : GPIO_Port_Configuration;
-- temporary variable
Data : Unsigned_8;
procedure Copy_Audio (Data : out Buffer);
procedure Copy_Audio (Data : out Buffer)
is
Int_Sample : Integer_16 := 0;
begin
Test_Out.Set;
for I in Data'Range loop
Int_Sample := Integer_16 (Main_Synthesizer.Next_Sample * 32767.0);
Data (I) := Int_Sample;
end loop;
Test_Out.Clear;
end Copy_Audio;
begin
Serial.Init (31_250);
Enable_Clock (Test_Out);
Configuration.Mode := Mode_Out;
Configuration.Output_Type := Push_Pull;
Configuration.Speed := Speed_100MHz;
Configuration.Resistors := Floating;
Configure_IO (Test_Out, Configuration);
-- Assert (
-- Generator_Buffer_Length = Audio_Data_0'Length, "invalid buffer length");
Initialize_LEDs;
Initialize_Audio;
STM32.Board.Audio_DAC.Set_Volume (60);
STM32.Board.Audio_DAC.Play;
Audio_TX_DMA_Int.Start (Destination =>
STM32.Board.Audio_I2S.Data_Register_Address,
Source_0 => Audio_Data_0'Address,
Source_1 => Audio_Data_1'Address,
Data_Count => Audio_Data_0'Length);
loop
-- wait until last audio buffer is transferred
Audio_TX_DMA_Int.Wait_For_Transfer_Complete;
-- play a melody at start
if Melody_Index <= Melody'Last then
if Melody (Melody_Index).Time = Start_Time then
if Melody (Melody_Index).Note_On then
Main_Synthesizer.Note_On (0, Melody (Melody_Index).Note, 100);
else
Main_Synthesizer.Note_Off (0, Melody (Melody_Index).Note, 0);
end if;
Melody_Index := Melody_Index + 1;
end if;
Start_Time := Start_Time + 1;
end if;
-- read MIDI data and parse it
while Serial.Available loop
Serial.Read (Data);
Main_Synthesizer.Parse_MIDI_Byte (Data);
end loop;
-- fill next audio buffer
if Audio_TX_DMA_Int.Not_In_Transfer = Audio_Data_0'Address then
Copy_Audio (Audio_Data_0);
else
Copy_Audio (Audio_Data_1);
end if;
end loop;
end Ada_Synth;
|
Applications/Google-Chrome/window/front tab/front tab.applescript | looking-for-a-job/applescript-examples | 1 | 4186 | #!/usr/bin/osascript
tell application "Google Chrome"
if count of windows is not 0 then front tab of (front window)
end tell
|
libsrc/_DEVELOPMENT/arch/ts2068/display/c/sccz80/tshr_saddrpright_callee.asm | jpoikela/z88dk | 38 | 10184 | ; void *tshr_saddrpright(void *saddr, uchar bitmask)
SECTION code_clib
SECTION code_arch
PUBLIC tshr_saddrpright_callee
EXTERN asm_tshr_saddrpright
tshr_saddrpright_callee:
pop af
pop hl
dec sp
pop de
push af
ld e,d
jp asm_tshr_saddrpright
|
oeis/054/A054447.asm | neoneye/loda-programs | 11 | 104899 | ; A054447: Row sums of triangle A054446 (partial row sums triangle of Fibonacci convolution triangle).
; 1,3,9,26,73,201,545,1460,3873,10191,26633,69198,178889,460437,1180545,3016552,7684481,19522203,49473097,125093506,315654537,795016545,1998909985,5017895196,12578040097,31485713511,78716283081,196563649718,490301138569,1221726409005,3041332476929,7564108885712,18796563814401,46670981169459,115793029029257,287079789634794,711252611988425,1761007771397625,4357413674045217,10775548915797124,26632084617519137,65786578170903807,162422534111343241,400813092717691678,988628905346945865
seq $0,291264 ; p-INVERT of (0,1,0,1,0,1,...), where p(S) = (1 - 2 S)^2.
div $0,4
|
test/Fail/Errors/SchematicPropositionalFunctionsWithoutPredicateSymbols.agda | asr/apia | 10 | 2480 | ------------------------------------------------------------------------------
-- Incompatible options
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- The @--schematic-propositional-functions@ and
-- @--without-predicate-symbols@ options are incompatible.
module SchematicPropositionalFunctionsWithoutPredicateSymbols where
postulate D : Set
postulate id : {P : D → Set}{x : D} → P x → P x
{-# ATP prove id #-}
|
basics/hello-world/main.asm | rodrigocam/assembly-mips | 0 | 25992 | <gh_stars>0
.data
message: .asciiz "Hello World"
.text
main:
li $v0 4 # four is the instruction to print a string
la $a0 message # load the address of the variable 'message' to the register that syscall use to print
syscall |
src/crosshair_cursor.asm | rondnelson99/bomb-golf | 1 | 628 | INCLUDE "defines.asm"
SECTION "Crosshair", ROM0
CROSSHAIR_SPEED equ 2
ProcessCrosshair::
ld hl, wCrosshairX ;this isn't strictly nescessary, but it optimizes things and hl isn't needed for anything else
ldh a, [hHeldKeys]
bit PADB_B, a
jr nz, DoneMovement ;if B is being pressed, the background will scroll instead, so skip this
ld b, a
CheckUp:
bit PADB_UP, b ;check the button
jr z, .skip
inc l ;point hl to wCrosshairY
ld a, [hl]
sub CROSSHAIR_SPEED ;move the coord if its pressed
jr nc, .noClamp
xor a ;clamp to its min/max
.noClamp
ld [hl-], a ;point it back to wCrosshairX
.skip
;and repeat for the other directions
CheckDown:
bit PADB_DOWN, b
jr z, .skip
inc l
ld a, [hl]
add CROSSHAIR_SPEED
cp SCRN_Y + 1
jr c, .noClamp
ld a, SCRN_Y
.noClamp
ld [hl-], a
.skip
CheckLeft:
bit PADB_LEFT, b
jr z, .skip
ld a, [hl]
sub CROSSHAIR_SPEED
jr nc, .noClamp
xor a
.noClamp
ld [hl], a
.skip
CheckRight:
bit PADB_RIGHT, b
jr z, .skip
ld a, [hl]
add CROSSHAIR_SPEED
cp SCRN_X + 1
jr c, .noClamp
ld a, SCRN_X
.noClamp
ld [hl], a
.skip
DoneMovement:
SetOAMCrosshair:
ld a, [hl+] ;X pos
add 8 - 4 ;oam coord offset - half of size
ld [OBJ_CROSSHAIR + OAMA_X], a
ld a, [hl-] ;Y pos
add 16 - 4
ld [OBJ_CROSSHAIR + OAMA_Y], a
CheckDrawing:
ldh a, [hPressedKeys] ;get the pressed keys instead of the held keys
bit PADB_START, a
ret z ;jr z, .done ;draw the crater if start is being pressed
ldh a, [hSCX] ;add the scroll registers to the crosshair coordinates
;to get the crosshair's position on the golf course
add [hl] ;X pos
inc l
ld b, a
ldh a, [hSCY]
add [hl]
ld c, a
jp RenderCrater ;tail call
.done
ret
SECTION "Init Crosshair", ROM0
InitCrosshair::
ld a, SCRN_X / 2
ld [wCrosshairX], a
ld a, SCRN_Y / 2
ld [wCrosshairY], a
ld a, SPRITE_CROSSHAIR
ld [OBJ_CROSSHAIR + OAMA_TILEID], a
xor a ;no special flags
ld [OBJ_CROSSHAIR + OAMA_FLAGS], a
ret
SECTION "Crosshair variables", WRAM0, ALIGN[1]
;the alignment forces them onto the same page so I can inc/dec l rather than hl
wCrosshairX: db
wCrosshairY: db |
VPN Autoconnect.applescript | NReilingh/VPN-Autoconnect | 0 | 3735 | <gh_stars>0
tell application "System Events"
set vpnName to "Example VPN"
set credentialName to "vpn.example.com"
set quotedVpnName to quoted form of vpnName
try
try
set vpnStatus to first word of (do shell script "scutil --nc status " & quotedVpnName)
on error "No Service"
set sysPrefButton to "Open System Preferences"
set alertResult to display alert "Couldn't find " & vpnName & " service." message "The VPN service must be named " & quote & vpnName & quote & ". Services can be renamed in Network System Preferences by selecting the service and clicking the gear icon at the bottom of the list." buttons {sysPrefButton, "OK"}
if button returned of alertResult is equal to sysPrefButton then
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.network"
end tell
end if
return
end try
if vpnStatus is equal to "Connected" then
do shell script "scutil --nc stop " & quotedVpnName
else if vpnStatus is equal to "Disconnected" then
try
set vpnPassword to do shell script "security find-generic-password -s " & credentialName & " -w"
if length of vpnPassword < 1 then error number 501
on error errMsg number errNum
if errNum = 44 then
set keychainButton to "Open Keychain Access"
set alertResult to display alert credentialName & " not found in Keychain." message "Please use Keychain Access to store your VPN credential with the name " & quote & credentialName & quote & ". The \"security\" utility will request access; choose Always Allow to avoid being prompted in the future." buttons {keychainButton, "OK"}
if button returned of alertResult is equal to keychainButton then activate application "Keychain Access"
else if errNum = 501 then
display alert "Retrieved password contains < 1 character. Please check the " & quote & credentialName & quote & " keychain item."
else if errMsg = "The command exited with a non-zero status." then
display alert "An unknown error occurred with the shell script. Perhaps try logging out and back in again to make sure your Keychain isn't temporarily messed up?" message "Exit code " & errNum
else
error errMsg number errNum
end if
return
end try
do shell script "scutil --nc start " & quotedVpnName
set attempt to 1
repeat until window 1 of application process "UserNotificationCenter" exists
set attempt to attempt + 1
if attempt > 10 then error "Couldn't find the VPN Connection window after 10 attempts." number 502
delay 1
end repeat
tell window 1 of application process "UserNotificationCenter"
if name of first static text is not equal to "VPN Connection" then error "Displayed window is not VPN Connection" number 503
if subrole of text field 2 is not equal to "AXSecureTextField" then error "Can't enter password into insecure text field" number 504
set value of text field 2 to vpnPassword
click button "OK"
end tell
end if
on error errMsg number errNum
if errNum >= 500 and errNum < 600 then
display alert errMsg message "Error number " & errNum
else
display alert "Error number " & errNum message errMsg
end if
end try
end tell |
Fields/Orders/Lemmas.agda | Smaug123/agdaproofs | 4 | 11441 | {-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Groups.Lemmas
open import Groups.Definition
open import Rings.Definition
open import Rings.Orders.Partial.Definition
open import Rings.Orders.Total.Definition
open import Rings.Lemmas
open import Setoids.Setoids
open import Setoids.Orders.Partial.Definition
open import Setoids.Orders.Total.Definition
open import Rings.IntegralDomains.Definition
open import Functions.Definition
open import Sets.EquivalenceRelations
open import Fields.Fields
open import Fields.Orders.Total.Definition
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Order
module Fields.Orders.Lemmas {m n o : _} {A : Set m} {S : Setoid {m} {n} A} {_+_ : A → A → A} {_*_ : A → A → A} {_<_ : Rel {_} {o} A} {R : Ring S _+_ _*_} {pOrder : SetoidPartialOrder S _<_} {F : Field R} {pRing : PartiallyOrderedRing R pOrder} (oF : TotallyOrderedField F pRing) where
abstract
open import Rings.InitialRing R
open Ring R
open PartiallyOrderedRing pRing
open Group additiveGroup
open TotallyOrderedRing (TotallyOrderedField.oRing oF)
open SetoidTotalOrder total
open import Rings.Orders.Partial.Lemmas pRing
open import Rings.Orders.Total.Lemmas (TotallyOrderedField.oRing oF)
open import Fields.Lemmas F
open Setoid S
open SetoidPartialOrder pOrder
open Equivalence eq
open Field F
clearDenominatorHalf : (x y 1/2 : A) → (1/2 + 1/2 ∼ 1R) → x < (y * 1/2) → (x + x) < y
clearDenominatorHalf x y 1/2 pr1/2 x<1/2y = <WellDefined (Equivalence.reflexive eq) (Equivalence.transitive eq (Equivalence.transitive eq (Equivalence.symmetric eq *DistributesOver+) (Equivalence.transitive eq *Commutative (*WellDefined pr1/2 (Equivalence.reflexive eq)))) identIsIdent) (ringAddInequalities x<1/2y x<1/2y)
clearDenominatorHalf' : (x y 1/2 : A) → (1/2 + 1/2 ∼ 1R) → (x * 1/2) < y → x < (y + y)
clearDenominatorHalf' x y 1/2 pr1/2 1/2x<y = <WellDefined (Equivalence.transitive eq (Equivalence.symmetric eq *DistributesOver+) (Equivalence.transitive eq (Equivalence.transitive eq *Commutative (*WellDefined pr1/2 (Equivalence.reflexive eq))) identIsIdent)) (Equivalence.reflexive eq) (ringAddInequalities 1/2x<y 1/2x<y)
halveInequality : (x y 1/2 : A) → (1/2 + 1/2 ∼ 1R) → (x + x) < y → x < (y * 1/2)
halveInequality x y 1/2 pr1/2 2x<y with totality 0R 1R
... | inl (inl 0<1') = <WellDefined (halfHalves 1/2 pr1/2) (Equivalence.reflexive eq) (ringCanMultiplyByPositive {_} {_} {1/2} (halvePositive 1/2 (<WellDefined (Equivalence.reflexive eq) (Equivalence.symmetric eq pr1/2) (0<1 λ bad → irreflexive {0R} (<WellDefined (Equivalence.reflexive eq) (Equivalence.symmetric eq bad) 0<1')))) 2x<y)
... | inl (inr 1<0) = <WellDefined (halfHalves 1/2 pr1/2) (Equivalence.reflexive eq) (ringCanMultiplyByPositive {_} {_} {1/2} (halvePositive 1/2 (<WellDefined (Equivalence.reflexive eq) (Equivalence.symmetric eq pr1/2) (0<1 λ bad → irreflexive {0R} (<WellDefined (Equivalence.symmetric eq bad) (Equivalence.reflexive eq) 1<0)))) 2x<y)
... | inr 0=1 = exFalso (irreflexive {0R} (<WellDefined (oneZeroImpliesAllZero R 0=1) (oneZeroImpliesAllZero R 0=1) 2x<y))
halveInequality' : (x y 1/2 : A) → (1/2 + 1/2 ∼ 1R) → x < (y + y) → (x * 1/2) < y
halveInequality' x y 1/2 pr1/2 x<2y with halveInequality (inverse y) (inverse x) 1/2 pr1/2 (<WellDefined (invContravariant additiveGroup) (Equivalence.reflexive eq) (ringSwapNegatives' x<2y))
... | bl = ringSwapNegatives (<WellDefined (Equivalence.reflexive eq) (ringMinusExtracts' R) bl)
dense : (charNot2 : ((1R + 1R) ∼ 0R) → False) {x y : A} → (x < y) → Sg A (λ i → (x < i) && (i < y))
dense charNot2 {x} {y} x<y with halve charNot2 1R
dense charNot2 {x} {y} x<y | 1/2 , pr1/2 = ((x + y) * 1/2) , (halveInequality x (x + y) 1/2 pr1/2 (<WellDefined (Equivalence.reflexive eq) groupIsAbelian (orderRespectsAddition x<y x)) ,, halveInequality' (x + y) y 1/2 pr1/2 (orderRespectsAddition x<y y))
halfLess : (e/2 e : A) → (0<e : 0G < e) → (pr : e/2 + e/2 ∼ e) → e/2 < e
halfLess e/2 e 0<e pr with halvePositive e/2 (<WellDefined (Equivalence.reflexive eq) (Equivalence.symmetric eq pr) 0<e)
... | 0<e/2 = <WellDefined identLeft pr (orderRespectsAddition 0<e/2 e/2)
inversePositiveIsPositive : {a b : A} → (a * b) ∼ 1R → 0R < b → 0R < a
inversePositiveIsPositive {a} {b} ab=1 0<b with totality 0R a
inversePositiveIsPositive {a} {b} ab=1 0<b | inl (inl 0<a) = 0<a
inversePositiveIsPositive {a} {b} ab=1 0<b | inl (inr a<0) with <WellDefined *Commutative (Equivalence.reflexive eq) (posTimesNeg _ _ 0<b a<0)
... | ab<0 = exFalso (1<0False (<WellDefined ab=1 (Equivalence.reflexive eq) ab<0))
inversePositiveIsPositive {a} {b} ab=1 0<b | inr 0=a = exFalso (irreflexive {0G} (<WellDefined (Equivalence.reflexive eq) (oneZeroImpliesAllZero R 0=1) 0<b))
where
0=1 : 0R ∼ 1R
0=1 = Equivalence.transitive eq (Equivalence.symmetric eq (Equivalence.transitive eq (*WellDefined (Equivalence.symmetric eq 0=a) (Equivalence.reflexive eq)) (Equivalence.transitive eq *Commutative timesZero))) ab=1
halvesEqual : ((1R + 1R ∼ 0R) → False) → (1/2 1/2' : A) → (1/2 + 1/2) ∼ 1R → (1/2' + 1/2') ∼ 1R → 1/2 ∼ 1/2'
halvesEqual charNot2 1/2 1/2' pr1 pr2 = Equivalence.transitive eq (Equivalence.transitive eq (Equivalence.symmetric eq identIsIdent) (Equivalence.transitive eq *Commutative (*WellDefined (Equivalence.reflexive eq) (Equivalence.transitive eq (Equivalence.symmetric eq p1) *Commutative)))) (Equivalence.transitive eq r (Equivalence.transitive eq (Equivalence.transitive eq (*WellDefined (Equivalence.reflexive eq) (Equivalence.transitive eq *Commutative p1)) *Commutative) (identIsIdent)))
where
p : 1/2 * (1R + 1R) ∼ 1/2' * (1R + 1R)
p = Equivalence.transitive eq *DistributesOver+ (Equivalence.transitive eq (Equivalence.transitive eq (Equivalence.transitive eq (+WellDefined (Equivalence.transitive eq *Commutative identIsIdent) (Equivalence.transitive eq *Commutative identIsIdent)) pr1) (Equivalence.transitive eq (Equivalence.symmetric eq pr2) (+WellDefined (Equivalence.symmetric eq (Equivalence.transitive eq *Commutative identIsIdent)) (Equivalence.symmetric eq (Equivalence.transitive eq *Commutative identIsIdent))))) (Equivalence.symmetric eq *DistributesOver+))
x : A
x with Field.allInvertible F (1R + 1R) charNot2
... | y , _ = y
p1 : (x * (1R + 1R)) ∼ 1R
p1 with Field.allInvertible F (1R + 1R) charNot2
... | _ , pr = pr
q : ((1/2 * (1R + 1R)) * x) ∼ ((1/2' * (1R + 1R)) * x)
q = *WellDefined p (Equivalence.reflexive eq)
r : (1/2 * ((1R + 1R) * x)) ∼ (1/2' * ((1R + 1R) * x))
r = Equivalence.transitive eq *Associative (Equivalence.transitive eq q (Equivalence.symmetric eq *Associative))
private
orderedFieldIntDom : {a b : A} → (a * b ∼ 0R) → (a ∼ 0R) || (b ∼ 0R)
orderedFieldIntDom {a} {b} ab=0 with totality 0R a
... | inl (inl x) = inr (Equivalence.transitive eq (Equivalence.transitive eq (symmetric identIsIdent) (*WellDefined q reflexive)) p')
where
a!=0 : (a ∼ Group.0G additiveGroup) → False
a!=0 pr = SetoidPartialOrder.irreflexive pOrder (SetoidPartialOrder.<WellDefined pOrder (symmetric pr) reflexive x)
invA : A
invA = underlying (Field.allInvertible F a a!=0)
q : 1R ∼ (invA * a)
q with Field.allInvertible F a a!=0
... | invA , pr = symmetric pr
p : invA * (a * b) ∼ invA * Group.0G additiveGroup
p = *WellDefined reflexive ab=0
p' : (invA * a) * b ∼ Group.0G additiveGroup
p' = Equivalence.transitive eq (symmetric *Associative) (Equivalence.transitive eq p (Ring.timesZero R))
orderedFieldIntDom {a} {b} ab=0 | inl (inr x) = inr (Equivalence.transitive eq (Equivalence.transitive eq (symmetric identIsIdent) (*WellDefined q reflexive)) p')
where
a!=0 : (a ∼ Group.0G additiveGroup) → False
a!=0 pr = SetoidPartialOrder.irreflexive pOrder (SetoidPartialOrder.<WellDefined pOrder reflexive (symmetric pr) x)
invA : A
invA = underlying (Field.allInvertible F a a!=0)
q : 1R ∼ (invA * a)
q with Field.allInvertible F a a!=0
... | invA , pr = symmetric pr
p : invA * (a * b) ∼ invA * Group.0G additiveGroup
p = *WellDefined reflexive ab=0
p' : (invA * a) * b ∼ Group.0G additiveGroup
p' = Equivalence.transitive eq (symmetric *Associative) (Equivalence.transitive eq p (Ring.timesZero R))
orderedFieldIntDom {a} {b} ab=0 | inr x = inl (Equivalence.symmetric (Setoid.eq S) x)
orderedFieldIsIntDom : IntegralDomain R
IntegralDomain.intDom orderedFieldIsIntDom = decidedIntDom R orderedFieldIntDom
IntegralDomain.nontrivial orderedFieldIsIntDom pr = Field.nontrivial F (Equivalence.symmetric (Setoid.eq S) pr)
charZero : (n : ℕ) → (0R ∼ (fromN (succ n))) → False
charZero n 0=sn = irreflexive (<WellDefined 0=sn reflexive (fromNPreservesOrder (0<1 (Field.nontrivial F)) (succIsPositive n)))
charZero' : (n : ℕ) → ((fromN (succ n)) ∼ 0R) → False
charZero' n pr = charZero n (symmetric pr)
|
programs/oeis/340/A340128.asm | neoneye/loda | 22 | 176171 | ; A340128: a(n) = (n*prime(n)) mod prime(n+1).
; 2,1,1,6,3,10,5,14,4,11,8,34,17,38,16,22,27,26,66,33,32,78,40,2,1,51,106,53,110,88,7,82,73,107,81,98,104,15,112,118,99,153,107,21,109,81,105,35,131,33,172,137,223,190,196,202,157,206,45,163,269,53,59,185,57,69,272,14,211,73,292,158,308,314,83,322,178,89,186,38,259,42,267,374,103,382,218,109,285,107,345,238,119,246,123,442,399,327,382,494
mov $1,$0
seq $0,40 ; The prime numbers.
add $1,1
mul $0,$1
mov $2,$1
seq $2,40 ; The prime numbers.
mod $0,$2
|
MIPS/array.asm | nhutnamhcmus/code | 1 | 24592 | .data
tb1: .asciiz "Nhap n: "
tb2: .asciiz "a["
tb3: .asciiz "]: "
tb4: .asciiz "\nMang vua nhap la: "
tb5: .asciiz "\nTong mang: "
tb6: .asciiz "\nMax: "
tb7: .asciiz "\nCac so nguyen to: "
tb8: .asciiz "\nMang da sap xep la: "
n: .word 0
arr: .space 1024 # 256 phan tu
.text
#truyen tham so
la $a0,n
la $a1,arr
# Goi ham nhapmang
jal _NhapMang
#xuat tb4
li $v0,4
la $a0,tb4
syscall
#truyen tham so
lw $a0,n
la $a1,arr
# Goi ham xuatmang
jal _XuatMang
#xuat tb5
li $v0,4
la $a0,tb5
syscall
#truyen tham so
lw $a0,n
la $a1,arr
# Goi ham xuatmang
jal _array.Sum
#xuat tb6
li $v0,4
la $a0,tb6
syscall
#truyen tham so
lw $a0,n
la $a1,arr
# Goi ham xuatmang
jal _array.Max
#xuat tb7
li $v0,4
la $a0,tb7
syscall
#truyen tham so
lw $a0,n
la $a1,arr
# Goi ham xuatmang
jal _array.filter.Prime
#truyen tham so
la $t0,arr
lw $t1,n
jal _array.Sort
#xuat tb7
li $v0,4
la $a0,tb8
syscall
#truyen tham so
lw $a0,n
la $a1,arr
# Goi ham xuatmang
jal _XuatMang
#ket thuc
li $v0,10
syscall
#========== Ham Nhap Mang =============
#dau thu tuc
_NhapMang:
addi $sp,$sp,-32
sw $ra,($sp)
sw $s0,4($sp)
sw $s1,8($sp)
sw $t0,12($sp)
sw $t1,16($sp)
#Lay tham so luu vao thanh ghi
move $s0,$a0
move $s1,$a1
#than thu tuc
#xuat tb1
li $v0,4
la $a0,tb1
syscall
#nhap so nguyen
li $v0,5
syscall
#Luu vao n tai $s0
sw $v0,($s0)
#load gia tri n
lw $s0,($s0)
#Khoi tao vong lap
li $t0,0 # i = 0
_NhapMang.Lap:
#xuat tb2
li $v0,4
la $a0,tb2
syscall
#xuat i
li $v0,1
move $a0,$t0
syscall
#xuat tb3
li $v0,4
la $a0,tb3
syscall
#nhap so nguyen
li $v0,5
syscall
#Luu vao a[i] tai $s1
sw $v0,($s1)
#Tang dia chi
addi $s1,$s1,4
#tang chi so i
addi $t0,$t0,1
#Kiem tra i < n thi Lap
blt $t0,$s0,_NhapMang.Lap
#Cuoi thu tuc
#resotore
lw $ra,($sp)
lw $s0,4($sp)
lw $s1,8($sp)
lw $t0,12($sp)
lw $t1,16($sp)
#xoa stack
addi $sp,$sp,32
# tra ve
jr $ra
# ========== Xuat Mang ===========
_XuatMang:
addi $sp,$sp,-32
sw $ra,($sp)
sw $s0,4($sp)
sw $s1,8($sp)
sw $t0,12($sp)
sw $t1,16($sp)
#Lay tham so luu vao thanh ghi
move $s0,$a0 #n
move $s1,$a1 #arr
#Than thu tuc
#khoi tao vong lap
li $t0,0 # i = 0
_XuatMang.Lap:
#xuat a[i]
li $v0,1
lw $a0,($s1)
syscall
#xuat khoang trang
li $v0,11
li $a0,' '
syscall
#Tang dia chi mang
addi $s1,$s1,4
#Tang i
addi $t0,$t0,1
#Kiem tra i < n thi Lap
blt $t0,$s0,_XuatMang.Lap
#Cuoi thu tuc
#resotore
lw $ra,($sp)
lw $s0,4($sp)
lw $s1,8($sp)
lw $t0,12($sp)
lw $t1,16($sp)
#xoa stack
addi $sp,$sp,32
# tra ve
jr $ra
# ========== Tinh tong mang ===========
_array.Sum:
addi $sp, $sp,-32
sw $ra, ($sp)
sw $s0, 4($sp)
sw $s1, 8($sp)
sw $t0, 12($sp)
sw $t1, 16($sp)
sw $t2, 24($sp)
#Lay tham so luu vao thanh ghi
move $s0,$a0 # n
move $s1,$a1 # arr
#Than thu tuc
#khoi tao vong lap
li $t0, 0 # i = 0
add $t1, $zero, $zero # sum = 0
_array.Sum.Loop:
lw $a0,($s1)
addu $t1, $t1, $a0
#Tang dia chi mang
addi $s1,$s1,4
#Tang i
addi $t0,$t0,1
#Kiem tra i < n thi Lap
blt $t0,$s0,_array.Sum.Loop
add $a0, $zero, $t1
add $v0, $zero, 1
syscall
#Cuoi thu tuc
#resotore
lw $ra,($sp)
lw $s0,4($sp)
lw $s1,8($sp)
lw $t0,12($sp)
lw $t1,16($sp)
#xoa stack
addi $sp,$sp,32
# tra ve
jr $ra
# ========== Tim max cua mang ===========
_array.Max:
addi $sp,$sp,-32
sw $ra,($sp)
sw $s0,4($sp)
sw $s1,8($sp)
sw $t0,12($sp)
sw $t1,16($sp)
sw $t2,20($sp)
#Lay tham so luu vao thanh ghi
move $s0,$a0 # n
move $s1,$a1 # arr
#Than thu tuc
#khoi tao vong lap
li $t0, 0 # i = 0
lw $a0,($s1)
add $t1, $t1, $a0 # max = a[0]
_array.Max.Loop:
lw $a0,($s1)
add $t2, $zero, $a0
slt $t3, $t1, $t2
beq $t3, 1, _array.Max.setMax
beq $t3, 0, _array.Max.next
_array.Max.setMax:
add $t1, $zero, $t2
_array.Max.next:
#Tang dia chi mang
addi $s1,$s1,4
#Tang i
addi $t0,$t0,1
#Kiem tra i < n thi Lap
blt $t0,$s0,_array.Max.Loop
add $a0, $zero, $t1
add $v0, $zero, 1
syscall
#Cuoi thu tuc
#resotore
lw $ra,($sp)
lw $s0,4($sp)
lw $s1,8($sp)
lw $t0,12($sp)
lw $t1,16($sp)
lw $t2,20($sp)
#xoa stack
addi $sp,$sp,32
# tra ve
jr $ra
# === Check prime
_isPrime:
addi $sp,$sp,-32
sw $ra,($sp)
sw $s0,4($sp)
sw $s1,8($sp)
sw $t0,12($sp)
sw $t1,16($sp)
sw $t2,20($sp)
#Lay tham so luu vao thanh ghi
move $s0, $a2 # number
add $t1, $zero, 2 # i = 2
beq $s0, 1, _isPrime.ReturnFalse
beq $s0, 2, _isPrime.ReturnTrue
_isPrime.Loop:
divu $s0, $t1
mfhi $t2
beq $t2, 0, _isPrime.ReturnFalse
addi $t1,$t1, 1
slt $t0, $t1, $s0
beq $t0, 0, _isPrime.ReturnTrue
j _isPrime.Loop
_isPrime.ReturnFalse:
add $v0, $zero, 0
j _isPrime.endIsPrime
_isPrime.ReturnTrue:
add $v0, $zero, 1
j _isPrime.endIsPrime
_isPrime.endIsPrime:
#Cuoi thu tuc
#resotore
lw $ra,($sp)
lw $s0,4($sp)
lw $s1,8($sp)
lw $t0,12($sp)
lw $t1,16($sp)
lw $t2,20($sp)
#xoa stack
addi $sp,$sp,32
# tra ve
jr $ra
# ==== Liet ke so nguyen to
_array.filter.Prime:
addi $sp,$sp,-32
sw $ra,($sp)
sw $s0,4($sp)
sw $s1,8($sp)
sw $t0,12($sp)
sw $t1,16($sp)
sw $t2,20($sp)
#Lay tham so luu vao thanh ghi
move $s0,$a0 # n
move $s1,$a1 # arr
#Than thu tuc
#khoi tao vong lap
li $t0, 0 # i = 0
lw $a0,($s1)
add $t1, $t1, $a0 # max = a[0]
_array.filter.Prime.Loop:
lw $a2,($s1)
jal _isPrime
beq $v0, 1, _array.filter.Prime.printElement
j _array.filter.Prime.next
_array.filter.Prime.printElement:
li $v0, 1
lw $a0,($s1)
syscall
#xuat khoang trang
li $v0,11
li $a0,' '
syscall
_array.filter.Prime.next:
#Tang dia chi mang
addi $s1,$s1,4
#Tang i
addi $t0,$t0,1
#Kiem tra i < n thi Lap
blt $t0,$s0,_array.filter.Prime.Loop
#Cuoi thu tuc
#resotore
lw $ra,($sp)
lw $s0,4($sp)
lw $s1,8($sp)
lw $t0,12($sp)
lw $t1,16($sp)
lw $t2,20($sp)
#xoa stack
addi $sp,$sp,32
# tra ve
jr $ra
# === Sap xep mang =====
_array.Sort:
addiu $sp, $sp, -4
sw $ra, 0($sp)
sll $t1, $t1, 2
li $v0, 0
_array.Sort.Loop:
slt $t3, $v0, $t1
beq $t3, $zero, _array.Sort.End
bne $v0, $zero, _array.Sort.Compare
addiu $v0, $v0, 4
_array.Sort.Compare:
addu $t2, $t0, $v0
lw $t4, -4($t2)
lw $t5, 0($t2)
blt $t5, $t4, _array.Sort.Swap
addiu $v0, $v0, 4
j _array.Sort.Loop
_array.Sort.Swap:
sw $t4, 0($t2)
sw $t5, -4($t2)
addiu $v0, $v0, -4
j _array.Sort.Loop
_array.Sort.End:
srl $t1, $t1, 2
lw $ra, ($sp)
addi $sp, $sp, 4
jr $ra
|
src/natools-smaz-tools-gnat.ads | faelys/natools | 0 | 23027 | <gh_stars>0
------------------------------------------------------------------------------
-- Copyright (c) 2016, <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.Smaz.Tools.GNAT gather tools to handle Smaz diction aries that --
-- depend so heavily on GNAT that they cannot be considered portable. --
------------------------------------------------------------------------------
package Natools.Smaz.Tools.GNAT is
procedure Build_Perfect_Hash
(List : in String_Lists.List;
Package_Name : in String)
with Pre => (for all S of List => S'First = 1);
-- Generate a static hash function that can be used with a dictionary
-- built from List, using GNAT.Perfect_Hash_Generators.
-- The precondition reflects an assumption made by
-- GNAT.Perfect_Hash_Generators but not enforced,
-- which leads to nasty bugs.
end Natools.Smaz.Tools.GNAT;
|
PRG/levels/Sky/Unused15.asm | narfman0/smb3_pp1 | 0 | 169265 | <filename>PRG/levels/Sky/Unused15.asm<gh_stars>0
; Original address was $AE61
; "Unused Level 15"
.word $0000 ; Alternate level layout
.word $0000 ; Alternate object layout
.byte LEVEL1_SIZE_06 | LEVEL1_YSTART_170
.byte LEVEL2_BGPAL_02 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18
.byte LEVEL3_TILESET_01 | LEVEL3_VSCROLL_LOCKED | LEVEL3_PIPENOTEXIT
.byte LEVEL4_BGBANK_INDEX(13) | LEVEL4_INITACT_NOTHING
.byte LEVEL5_BGM_OVERWORLD | LEVEL5_TIME_300
.byte $00, $00, $03, $79, $00, $10, $5F, $31, $16, $80, $31, $18, $80, $31, $1A, $80
.byte $31, $1C, $80, $31, $1E, $80, $13, $14, $E5, $0D, $11, $24, $E4, $06, $33, $2F
.byte $20, $16, $27, $E2, $0C, $55, $2C, $31, $10, $36, $E3, $01, $10, $3D, $E3, $01
.byte $31, $39, $82, $33, $31, $00, $14, $36, $E3, $01, $14, $3D, $E3, $01, $34, $39
.byte $82, $10, $41, $E4, $04, $11, $48, $E4, $04, $12, $4F, $E4, $04, $FF
|
Transynther/x86/_processed/NONE/_ht_zr_un_/i9-9900K_12_0xa0.log_21829_1903.asm | ljhsiun2/medusa | 9 | 101573 | .global s_prepare_buffers
s_prepare_buffers:
push %r15
push %r8
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1176c, %rsi
lea addresses_normal_ht+0x4770, %rdi
cmp %rbx, %rbx
mov $124, %rcx
rep movsl
nop
nop
xor $19428, %r8
lea addresses_WT_ht+0x96c, %rsi
lea addresses_normal_ht+0x9d6c, %rdi
clflush (%rsi)
nop
nop
nop
nop
sub %r15, %r15
mov $81, %rcx
rep movsq
nop
nop
nop
nop
nop
and $11556, %rdi
lea addresses_D_ht+0xab2c, %r8
nop
nop
nop
nop
nop
add $2568, %r9
mov $0x6162636465666768, %rdi
movq %rdi, (%r8)
nop
nop
nop
nop
inc %r8
lea addresses_D_ht+0x1dbec, %rsi
lea addresses_D_ht+0x1e6ab, %rdi
nop
nop
nop
and %rax, %rax
mov $110, %rcx
rep movsb
nop
inc %r8
lea addresses_WT_ht+0x89cf, %rsi
lea addresses_normal_ht+0xc016, %rdi
clflush (%rsi)
nop
nop
nop
sub $60729, %rax
mov $78, %rcx
rep movsw
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_UC_ht+0x26c, %rdi
nop
nop
nop
sub %rbx, %rbx
mov (%rdi), %r15w
nop
nop
nop
nop
and %r8, %r8
lea addresses_WC_ht+0xf0ec, %rax
clflush (%rax)
nop
nop
nop
nop
nop
cmp $15471, %r15
vmovups (%rax), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %rsi
nop
add $4245, %r8
lea addresses_WT_ht+0x16850, %rsi
nop
nop
nop
cmp $4232, %rdi
mov $0x6162636465666768, %rbx
movq %rbx, %xmm3
movups %xmm3, (%rsi)
nop
nop
inc %rcx
lea addresses_A_ht+0xc46c, %rsi
lea addresses_WC_ht+0x4d6c, %rdi
nop
nop
nop
nop
inc %r8
mov $83, %rcx
rep movsq
cmp $61507, %rbx
lea addresses_A_ht+0xcbec, %r15
nop
nop
nop
nop
nop
xor %rax, %rax
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
and $0xffffffffffffffc0, %r15
vmovntdq %ymm3, (%r15)
nop
xor %r15, %r15
lea addresses_normal_ht+0x139a8, %r15
nop
xor %rcx, %rcx
movw $0x6162, (%r15)
nop
nop
nop
and $55529, %r8
lea addresses_A_ht+0x2a18, %rdi
nop
nop
nop
nop
nop
xor %r8, %r8
mov (%rdi), %r15w
nop
nop
nop
nop
inc %rsi
lea addresses_normal_ht+0x816c, %rsi
lea addresses_UC_ht+0x516c, %rdi
nop
nop
nop
nop
sub $37138, %rbx
mov $94, %rcx
rep movsb
nop
nop
nop
sub %r8, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r9
push %rbp
push %rbx
push %rsi
// Store
mov $0x74c, %r12
xor $53471, %rsi
mov $0x5152535455565758, %r11
movq %r11, %xmm1
movups %xmm1, (%r12)
nop
nop
nop
sub $46425, %r9
// Faulty Load
lea addresses_UC+0x316c, %r9
sub $47889, %r14
vmovups (%r9), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %r11
lea oracles, %rbx
and $0xff, %r11
shlq $12, %r11
mov (%rbx,%r11,1), %r11
pop %rsi
pop %rbx
pop %rbp
pop %r9
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_P', 'AVXalign': False, 'size': 16}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 0, 'type': 'addresses_normal_ht'}}
{'src': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}}
{'src': {'same': False, 'congruent': 5, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}}
{'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16}}
{'src': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 6, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 2, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}}
{'src': {'NT': False, 'same': True, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': True, 'size': 2}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}}
{'46': 5, '49': 2527, '00': 1, '48': 82, '45': 19212, 'ef': 1, 'f0': 1}
45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 49 49 45 45 45 45 45 45 49 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 45 45 49 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 49 49 45 45 45 45 45 49 48 45 45 45 45 45 45 45 45 45 49 45 45 45 49 49 45 45 45 49 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 45 45 45 45 49 45 45 45 49 45 48 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 49 45 48 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 49 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 45 45 45 49 49 49 45 45 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 45 49 45 49 49 45 45 45 45 45 45 49 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 49 45 49 45 45 45 45 45 49 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 49 45 45 45 45 45 45 45 45 f0 45 45 45 45 45 45 45 49 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 49 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 49 45 45 45 45 49 45 48 45 45 45 45 49 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45 49 45 45 45 45 45 45 45 45 49 45 49 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 49 49 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 49 49 45 45 45 45 49 45 45 45 45 49 45 45 45 45 45 45 45 45 49 49 45 45 45 45 49 45 45 45 45 45 45 45 45 49 49 45 48 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 49 45 45 45 45 45 49 49 45 45 45 49 45 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 49 49 45 48 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45 45 45 45 45 45 49 49 45 45 45 45 45 49 49 45 45 45 45 45 49 45 45 45 45 45 45 49 45 45 45 45 45
*/
|
oeis/332/A332552.asm | neoneye/loda-programs | 11 | 100708 | ; A332552: a(n) = A082184(n) - A082183(n).
; Submitted by <NAME>
; 1,1,1,3,3,1,3,6,5,4,4,7,10,5,1,9,9,5,15,14,11,8,15,13,18,21,7,15,15,1,11,22,17,28,12,19,26,24,8,21,21,11,36,30,23,16,21,35,34,39,13,27,45,40,24,38,29,20,20,31,42,21,13,55,33,17,51,46,35,24,24,37,50,60,44,66,39,16,48,54,41,28,68,43,58,33,11,45,78,52,69,62,47,57,32,49,77,75,25,51
mov $4,$0
sub $4,$0
add $0,2
mov $2,1
mov $3,$0
lpb $0
sub $0,$2
sub $4,$3
sub $3,1
add $5,$4
gcd $5,$0
div $5,$0
lpb $5
mov $0,0
sub $5,1
lpe
lpe
mov $0,$3
|
grammar/HTMLTable.g4 | Blueswing/tableconverter | 1 | 4947 | /*
HTML table
*/
parser grammar HTMLTable;
options {
tokenVocab = HTMLLexer;
}
table:
TAG_OPEN TAG_TABLE htmlAttribute* (
TAG_CLOSE (
htmlContent TAG_OPEN TAG_SLASH TAG_TABLE TAG_CLOSE
)?
| TAG_SLASH_CLOSE
) EOF?;
htmlElement:
TAG_OPEN tag = TAG_NAME htmlAttribute* (
TAG_CLOSE content = htmlContent TAG_OPEN TAG_SLASH TAG_NAME TAG_CLOSE
| TAG_SLASH_CLOSE
) # NormalTag
| SCRIPTLET # Ignored
| script # Ignored
| style # Ignored;
htmlContent:
htmlChardata? (
(htmlElement | CDATA | htmlComment) htmlChardata?
)*;
htmlAttribute: TAG_NAME (TAG_EQUALS ATTVALUE_VALUE)?;
htmlChardata: HTML_TEXT | SEA_WS;
htmlMisc: htmlComment | SEA_WS;
htmlComment: HTML_COMMENT | HTML_CONDITIONAL_COMMENT;
script: SCRIPT_OPEN (SCRIPT_BODY | SCRIPT_SHORT_BODY);
style: STYLE_OPEN (STYLE_BODY | STYLE_SHORT_BODY); |
Driver/Printer/Fax/Group3/group3StartJob.asm | steakknife/pcgeos | 504 | 8158 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Geoworks 1994. All rights reserved.
GEOWORKS CONFIDENTIAL
PROJECT: Pasta
MODULE: Fax Printer Driver
FILE: group3StartJob.asm
AUTHOR: <NAME>, Apr 12, 1993
ROUTINES:
Name Description
---- -----------
INT ECCheckDGroupES
INT PrintStartJob Handle the start of a print job
INT Group3OpenFile Opens the output file for the printer
driver.
INT Group3GenerateFileName Opens the actual VM fax file and tries to
generate a unique name for the file
INT CheckDiskSpace Checks the amount of disk space there is
and guesses if there will be enough memory.
It then querry's the user if he wants to
continue.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jag 4/12/93 Initial revision
AC 9/ 8/93 Changed for Group3
DESCRIPTION:
$Id: group3StartJob.asm,v 1.1 97/04/18 11:52:59 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
;-----------------------------------------------------------------------------
; Initialized data
;-----------------------------------------------------------------------------
idata segment
if ERROR_CHECK
DGROUP_PROTECT1 equ 0xA6D3
dgroupHere word DGROUP_PROTECT1 ; protect word
endif
idata ends
;-----------------------------------------------------------------------------
; Data initialized to 0
;-----------------------------------------------------------------------------
udata segment
errorFlag byte ; A flag that will be passed
; from start job to end job to
; indicate if an error has
; occurred.
; Must indicate no error to start
outputVMFileHan hptr ; output file for fax
outputHugeArrayHan hptr ; handle to huge array for fax
faxPageCount word ; tells what page is currently
; being printed
gstringFileName byte DOS_DOT_FILE_NAME_LENGTH+1 dup (?)
udata ends
;
; An error-checking routine that can be called to verify that ds
; points to our dgroup. It's not totally 100% accurate, but almost...
;
if ERROR_CHECK
ECCheckDGroupES proc far
pushf
cmp es:[dgroupHere], DGROUP_PROTECT1
ERROR_NE -1
popf
ret
ECCheckDGroupES endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrintStartJob
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle the start of a print job
CALLED BY: DriverStrategy
PASS: bp = PState segment
RETURN: carry set on error
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
- Check if this is an error job by looking at the FaxSpoolID
- Check if there's enough disk space.
- Set CWD to fax directory. If it doesn't exist, make one.
- Create the output file.
- Update printer data in the fax file header
REVISION HISTORY:
Name Date Description
---- ---- -----------
jag 4/12/93 Initial version
AC 9/13/93 Modified for Group3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrintStartJob proc far
uses ax, bx, cx, dx, bp, si, di, ds, es
.enter
;
; Check for some error conditions:
; - first check if the job should be nuked because
; it has an error FaxSpoolID.
; - then check to see if there will be enough disk space.
;
mov es, bp ; point at PState
.warn -field
cmpdw es:[PS_jobParams].JP_printerData.FFH_spoolID, \
FAX_ERROR_SPOOL_ID
.warn @field
LONG jz badJobError
;
; Check to see if there's enough disk space to make the fax file
;
call CheckDiskSpace
LONG jc notEnoughDiskSpace
;
; Store the name of the spooler file for the end-job handler.
;
segmov ds, es, bx ; ds = PState
mov bx, segment dgroup
mov es, bx ; es = dgroup
mov di, offset gstringFileName ; es:di = dest buffer
lea si, ds:[PS_jobParams].JP_fname ; ds:si = filename
mov cx, DOS_DOT_FILE_NAME_LENGTH+1 ; +1 for null
rep movsb
segmov es, ds, bx ; es = PState
;
; Open a VM file so we can store the fax information into it.
;
mov bx, es:[PS_deviceInfo] ; bx <- device specific info
call MemLock ; ax <- device info segment
mov ds, ax ; ds <- device info segment
mov al, ds:[PI_type] ; get PrinterType field
mov ah, ds:[PI_smarts] ; get PrinterSmart field
mov {word} es:[PS_printerType], ax ; set both in PState
;
; I think the following is normally set by the UI eval routine,
; but since the Fax modem is ASF only, it seems best to set it
; here...
;
mov al, ds:[PI_paperInput] ; al <- PaperInput record
mov es:[PS_paperInput], al ; copy record into PState
mov al, ds:[PI_paperOutput] ; al <- PaperOutput record
mov es:[PS_paperOutput], al ; copy record into PState
call MemUnlock
;
; Create the fax file:
; * cx:dx will be buffer to put file name.
; (This buffer will be in the PState)
; * if an error occured, kill the fax job.
;
.warn -field
mov cx, es
lea dx, es:[PS_jobParams].JP_printerData.FFH_fileName
call Group3OpenFile ; cx:dx filled
; bx <- file handle
LONG jc cannotMakeFile
.warn @field
;
; Get the fax file's header.
;
mov ax, segment dgroup ; ax <- dgroup
mov ds, ax
mov ds:[outputVMFileHan], bx
mov ds:[faxPageCount], 1 ; start the page count
call FaxFileGetHeader ; ds:si = FaxFileHeader
LONG jc cannotMakeFile
push bp ; save mem handle # 2
;
; Write misc information into the fax file's header.
;
movdw ds:[si].FFH_pageWidth, FAXFILE_HORIZONTAL_SIZE
movdw ds:[si].FFH_pageHeight, FAXFILE_VERTICAL_SIZE
mov ds:[si].FFH_xRes, FAX_X_RES
mov ds:[si].FFH_compressionType, FCT_CCITT_T4_1D
mov ds:[si].FFH_imageType, FIT_BILEVEL
;
; Find out what vertical resolution to use.
;
clr bx
mov bl, es:[PS_mode]
mov bx, cs:FaxVerticalResolution[bx]
mov ds:[si].FFH_yRes, bx
;
; Find out if there is a cover page. If there is a cover page
; we have to inc the faxPageCounter since we should start at page
; 2. If there is not a cover page we do nothing and a branch in
; PrintStartPage will skip the Group3AddHeader.
;
.warn -field
test es:[PS_jobParams].JP_printerData.FFH_flags,
mask FFF_COVER_PAGE
.warn @field
jz noCoverPage
push es ; save PState
segmov es, dgroup, bx ; es <- dgroup
inc es:[faxPageCount]
pop es ; es <- PState
noCoverPage:
;
; Copy information in the JobParameters into the fax file header
; es:cx <- fax file header
; ds:dx <- JobParameters
;
segxchg es, ds ; ds = PState segment
mov cx, si ; es:cx <- fax file header
lea dx, ds:[PS_jobParams] ; ds:dx <- JobParameters
mov bx, size word * (length StartJobParameterOffsets - 1)
copyInfo:
;
; Get ds:si to point to correct location in the JobParameters.
;
mov si, dx
add si, cs:StartJobParameterOffsets[bx]
;
; Get es:di to point to the correct location in the fax
; file header.
;
mov di, cx
add di, cs:StartJobFaxFileOffsets[bx]
;
; Copy each string from the JobParameters to the FaxFileHeader.
; LocalCopyString is fine and all, but it only works if the
; string is null-terminated, so there had better not be garbage
; in any of the fields or it will destroy the entire header
; after the string in question. -stevey 3/8/94
;
LocalCopyString
dec bx
dec bx
jns copyInfo
;
; Copy the flags from the JobParameters to the FaxFileHeader
; es:di <- begining of actual FaxFileHeader
; ds:si <- JobParameters.JP_printerData (FaxFileHeader)
;
mov si, dx ; ds:si = JobParameters
lea si, ds:[si].JP_printerData ; ds:si = JP_printerData
mov di, cx ; es:di = FaxFileHeader
mov ax, ds:[si].FFH_flags ; flags from JobParams
mov es:[di].FFH_flags, ax ; copy to FaxFileHeader
;
; Copy the Fax Spool ID into the file.
;
movdw es:[di].FFH_spoolID, ds:[si].FFH_spoolID, ax
;
; Make sure to write in the fax file header that the file is
; currently disabled. This is done so the fax spooler can tell
; if the fax file is valid or not.
;
mov es:[di].FFH_status, FFS_DISABLED
;
; Copy the FaxSpoolDateTime structure from the JobParameters into
; the fax file header.
;
mov cx, size FaxSpoolDateTime
lea di, es:[di].FFH_spoolDateTime
lea si, ds:[si].FFH_spoolDateTime
rep movsb
;
; Unlock the block that contains the fax file header.
;
pop bp ; # 2
call VMDirty ; bp has mem handle
call VMUnlock
clc
exit:
.leave
ret
;
; ---------------------------
; E R R O R H A N D L E R S
; ---------------------------
;
;
; Handle error if the user wants to abort because they don't
; think there's enough room on the disk.
;
notEnoughDiskSpace:
mov cl, PDEC_USER_SAYS_NO_DISK_SPACE
jmp short writeErrorFlag
;
; Handle the error if it can't create the fax file.
;
cannotMakeFile:
mov cl, PDEC_CANNOT_CREATE_FAX_FILE
jmp short writeErrorFlag
;
; This job was deleted because we couldn't make enough
; space for the job parameters.
;
badJobError:
mov cl, PDEC_CANNOT_RESIZE_JOB_PARAMETERS
jmp short writeErrorFlag
;
; This routine is used to by the error handlers above
; to write an error flag so PrintEndJob will no if an
; error condition has canceled the job.
;
writeErrorFlag:
mov ax, segment dgroup
mov ds, ax
mov ds:[errorFlag], cl
stc
jmp exit
PrintStartJob endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Group3OpenFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Opens the output file for the printer driver.
CALLED BY: PrintStartJob
PASS: cx:dx = buffer to put file name
RETURN: ^lbx = file handle
cx:dx = file name filled
carry set if file is not able to be open
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
- Sets the thread's directory to the document directory
- Creates a file
- Opens the file
- Make the fax file header
REVISION HISTORY:
Name Date Description
---- ---- -----------
AC 9/13/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Group3OpenFile proc near
uses ax, cx, dx, di, ds, es
.enter
;
; Set the current directory to the fax directroy which is at
; SP_PRIVATE_DATA/FaxDir
;
call FilePushDir
call PutThreadInFaxDir
jc exit
openTheFile::
;
; Open the file. Returns file handle and buffer cx:dx filled
; with file name.
;
call Group3GenerateFileName ; bx <- filehandle
jc exit
;
; Make the VM file into a fax file
;
call FaxFileInitialize
;
; Write the name of the file to the header.
;
call FaxFileGetHeader ; ds:si = header
segmov es, ds, di
lea di, ds:[si].FFH_fileName ; es:di = name buffer
movdw dssi, cxdx ; ds:si = filename
if ((size FileLongName and 1) eq 0)
mov cx, size FileLongName / 2
rep movsw
else
mov cx, size FileLongName
rep movsb
endif
call VMDirty ; dirty FaxFileHeader...
call VMUnlock ; ...and unlock it
mov cx, ds ; cx:dx = filename
exit:
call FilePopDir
.leave
ret
Group3OpenFile endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Group3GenerateFileName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Opens the actual VM fax file and tries to generate a unique
name for the file
CALLED BY: Group3OpenFile
PASS: cx:dx = buffer to put file name
RETURN: bx - file handle
cx:dx = filled with new filename
carry returned if can't make the file
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
AC 9/20/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Group3GenerateFileName proc near
uses ax, cx, dx, di, si, bp, ds, es
.enter
;
; Generate the filename. Now copy the prefix of the string
; to the filename.
;
segmov ds, cs, si
mov si, offset faxFilePrefix
mov es, cx
mov di, dx ; es:di <- buffer to write
mov bp, dx ; save offset for later
LocalCopyString
dec di ; place to write number to.
;
; Start the increment of the filenames
;
clr ax
segmov ds, es, dx
makeFilename:
clr dx
inc ax
push ax ; save ... count?
mov cx, mask UHTAF_INCLUDE_LEADING_ZEROS or \
mask UHTAF_NULL_TERMINATE
call UtilHex32ToAscii ; cx <- length of string
;
; Open the file with the generated filename. Make sure
; it's sync-update in order to prevent tons of notifications
; going out during spooling.
;
mov ax, (VMO_CREATE_ONLY shl 8) or \
mask VMAF_FORCE_READ_WRITE or\
mask VMAF_FORCE_SHARED_MULTIPLE
clr cx ; default compression
mov dx, bp
call VMOpen ; bx <- filehandle
mov_tr cx, ax ; preserves carry
jc noSetAttrs ; couldn't open it
clr ah ; bits to clear
mov al, mask VMA_SYNC_UPDATE or mask VMA_SINGLE_THREAD_ACCESS; bits to set
call VMSetAttributes
noSetAttrs:
;
; Check to see if there were no errors in creating the file.
;
pop ax ; ax <- counter
cmp cx, VM_FILE_EXISTS
je makeFilename
;
; See if the filename is a new filename
;
cmp cx, VM_CREATE_OK
jne createError
;
; Success! Save the filename (in ds:dx) into dgroup, in
; case we need to delete the file, later.
;
clc
exit:
.leave
ret
createError:
stc
jmp exit
Group3GenerateFileName endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckDiskSpace
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks the amount of disk space there is and guesses if
there will be enough memory. It then queries the user
if they want to continue.
CALLED BY: PrintStartJob
PASS: bp = PState
RETURN: carry - set if printing should abort
dgroup errorState is nonzero if error
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
AC 2/ 5/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
;
; Estimates for how big each page will be (based on resolution).
;
;faxPageSize dword \
; FAX_STD_PAGE_SIZE_ESTIMATE, ; PM_GRAPHICS_LOW_RES
; 0, ; PM_GRAPHICS_MED_RES (none)
; FAX_FINE_PAGE_SIZE_ESTIMATE ; PM_GRAPHICS_HI_RES
CheckDiskSpace proc near
uses ax,bx,cx,si,di,bp
.enter
;
; Get available disk space.
;
if _FLOPPY_BASED_FAX
clr al
call DiskRegisterDisk
tst bx
jz noFloppy
else
mov bx, FAX_DISK_HANDLE
endif
call DiskGetVolumeFreeSpace ; dx:ax - bytes free
;
; Get appropriate estimate for space requirements/page.
;
if 0
mov es, bp
clr bh
mov bl, es:[PS_mode] ; bx <- PrinterMode
shl bx ; dword table
mov cx, cs:[faxPageSize][bx]
endif
;
; Divide how much space we have by page estimate. That gives
; us the number of pages that will fit on the disk. We then
; compare that number with how many pages we need and take it
; from there.
;
; To keep us from having to do slow, ugly dword division,
; we'll make use of the fact that the required disk space
; for fine-res faxes is twice that for standard ones.
;
mov cx, FAX_STD_PAGE_SIZE_ESTIMATE
div cx ; ax = #pages
;
; We've got the estimate for standard-mode...
;
mov es, bp
cmp es:[PS_mode], PM_GRAPHICS_LOW_RES
je gotPages
;
; ...but we need an estimate for fine mode. We can't
; just double the standard-mode estimate because the
; remainder of the division (in dx) may almost be enough
; for an entire page. Well, who cares...it's only an
; estimate. We've got code in PrintSwath() that prevents
; the file from actually eating up all the space...
;
shr ax ; pages / 2 (fine)
gotPages:
cmp es:[PS_jobParams].JP_numPages, ax
ja notEnoughDiskSpace
clc ; it'll fit!
exit:
.leave
ret
notEnoughDiskSpace:
;
; Pop up a dialog to let the user there's not enough disk space.
;
mov si, offset NotEnoughDiskSpaceWarning
mov ax, CustomDialogBoxFlags \
<1, CDT_WARNING, GIT_AFFIRMATION, 0 >
call DoDialog ; ax <- InteractionCommand
;
; We don't want to make assumptions about whether IC_YES is
; greater than or less than IC_NO, so we do the following
; weirdness to get the carry set appropriately.
;
cmp ax, IC_YES
je exit ; carry clear if they're equal
stc ; might still be clear...
jmp exit
if _FLOPPY_BASED_FAX
noFloppy:
;
; Pop up a dialog to tell the user that we could not find a
; floppy.
;
mov si, offset NeedFloppy
mov ax, CustomDialogBoxFlags \
<1, CDT_ERROR, GIT_NOTIFICATION, 0 >
call DoDialog ; ax <- InteractionCommand
stc
jmp exit
endif
CheckDiskSpace endp
|
programs/oeis/195/A195315.asm | karttu/loda | 1 | 21687 | <gh_stars>1-10
; A195315: Centered 32-gonal numbers.
; 1,33,97,193,321,481,673,897,1153,1441,1761,2113,2497,2913,3361,3841,4353,4897,5473,6081,6721,7393,8097,8833,9601,10401,11233,12097,12993,13921,14881,15873,16897,17953,19041,20161,21313,22497,23713,24961,26241,27553,28897,30273,31681,33121,34593,36097,37633,39201,40801,42433,44097,45793,47521,49281,51073,52897,54753,56641,58561,60513,62497,64513,66561,68641,70753,72897,75073,77281,79521,81793,84097,86433,88801,91201,93633,96097,98593,101121,103681,106273,108897,111553,114241,116961,119713,122497,125313,128161,131041,133953,136897,139873,142881,145921,148993,152097,155233,158401,161601,164833,168097,171393,174721,178081,181473,184897,188353,191841,195361,198913,202497,206113,209761,213441,217153,220897,224673,228481,232321,236193,240097,244033,248001,252001,256033,260097,264193,268321,272481,276673,280897,285153,289441,293761,298113,302497,306913,311361,315841,320353,324897,329473,334081,338721,343393,348097,352833,357601,362401,367233,372097,376993,381921,386881,391873,396897,401953,407041,412161,417313,422497,427713,432961,438241,443553,448897,454273,459681,465121,470593,476097,481633,487201,492801,498433,504097,509793,515521,521281,527073,532897,538753,544641,550561,556513,562497,568513,574561,580641,586753,592897,599073,605281,611521,617793,624097,630433,636801,643201,649633,656097,662593,669121,675681,682273,688897,695553,702241,708961,715713,722497,729313,736161,743041,749953,756897,763873,770881,777921,784993,792097,799233,806401,813601,820833,828097,835393,842721,850081,857473,864897,872353,879841,887361,894913,902497,910113,917761,925441,933153,940897,948673,956481,964321,972193,980097,988033,996001
sub $1,$0
bin $1,2
mul $1,32
add $1,1
|
data/baseStats/ninetales.asm | etdv-thevoid/pokemon-rgb-enhanced | 1 | 171221 | db NINETALES ; pokedex id
db 73 ; base hp
db 76 ; base attack
db 75 ; base defense
db 100 ; base speed
db 100 ; base special
db FIRE ; species type 1
db FIRE ; species type 2
db 75 ; catch rate
db 178 ; base exp yield
INCBIN "pic/gsmon/ninetales.pic",0,1 ; 77, sprite dimensions
dw NinetalesPicFront
dw NinetalesPicBack
; attacks known at lvl 0
db QUICK_ATTACK
db CONFUSE_RAY
db HYPNOSIS
db 0
db 0 ; growth rate
; learnset
tmlearn 6,8
tmlearn 9,10,15
tmlearn 20,22
tmlearn 28,31,32
tmlearn 33,34,38,39
tmlearn 42,44
tmlearn 50
db BANK(NinetalesPicFront)
|
Task/Dinesmans-multiple-dwelling-problem/Ada/dinesmans-multiple-dwelling-problem.ada | mullikine/RosettaCodeData | 1 | 10967 | <filename>Task/Dinesmans-multiple-dwelling-problem/Ada/dinesmans-multiple-dwelling-problem.ada
with Ada.Text_IO; use Ada.Text_IO;
procedure Dinesman is
subtype Floor is Positive range 1 .. 5;
type People is (Baker, Cooper, Fletcher, Miller, Smith);
type Floors is array (People'Range) of Floor;
type PtFloors is access all Floors;
function Constrained (f : PtFloors) return Boolean is begin
if f (Baker) /= Floor'Last and
f (Cooper) /= Floor'First and
Floor'First < f (Fletcher) and f (Fletcher) < Floor'Last and
f (Miller) > f (Cooper) and
abs (f (Smith) - f (Fletcher)) /= 1 and
abs (f (Fletcher) - f (Cooper)) /= 1
then return True; end if;
return False;
end Constrained;
procedure Solve (list : PtFloors; n : Natural) is
procedure Swap (I : People; J : Natural) is
temp : constant Floor := list (People'Val (J));
begin list (People'Val (J)) := list (I); list (I) := temp;
end Swap;
begin
if n = 1 then
if Constrained (list) then
for p in People'Range loop
Put_Line (p'Img & " on floor " & list (p)'Img);
end loop;
end if;
return;
end if;
for i in People'First .. People'Val (n - 1) loop
Solve (list, n - 1);
if n mod 2 = 1 then Swap (People'First, n - 1);
else Swap (i, n - 1); end if;
end loop;
end Solve;
thefloors : aliased Floors;
begin
for person in People'Range loop
thefloors (person) := People'Pos (person) + Floor'First;
end loop;
Solve (thefloors'Access, Floors'Length);
end Dinesman;
|
data/wild/maps/SafariZoneNorth.asm | opiter09/ASM-Machina | 1 | 26031 | SafariZoneNorthWildMons:
def_grass_wildmons 30 ; encounter rate
db 47, NIDORAN_M
db 46, RHYHORN
db 43, PARAS
db 45, EXEGGCUTE
db 47, NIDORINO
db 47, NIDORAN_F
db 48, NIDORINA
db 42, VENOMOTH
db 46, CHANSEY
db 50, TAUROS
end_grass_wildmons
def_water_wildmons 0 ; encounter rate
end_water_wildmons
|
bondgo/src/test/source013-switch1.go.asm | mmirko/bondmachine | 6 | 12971 | clr r0
r2m r0 0
clr r0
r2m r0 1
rset r0 1
r2m r0 0
m2r r0 0
rset r1 1
je r0 r1 14
rset r1 2
je r0 r1 17
rset r1 3
je r0 r1 21
j 24
rset r1 11
r2m r1 1
j 24
rset r1 12
r2m r1 1
j 21
j 24
rset r1 13
r2m r1 1
j 24
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_751.asm | ljhsiun2/medusa | 9 | 175226 | <filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_751.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x9f2, %rax
nop
nop
nop
nop
nop
cmp $59892, %r8
mov $0x6162636465666768, %r15
movq %r15, %xmm3
vmovups %ymm3, (%rax)
nop
nop
nop
xor $4792, %r9
lea addresses_WC_ht+0xc812, %r10
nop
nop
xor %r14, %r14
mov (%r10), %rdx
nop
nop
nop
nop
add %rdx, %rdx
lea addresses_A_ht+0x88f2, %r9
nop
xor %r14, %r14
movw $0x6162, (%r9)
nop
add %r8, %r8
lea addresses_normal_ht+0x186b2, %r8
nop
nop
and $40493, %r14
movups (%r8), %xmm4
vpextrq $0, %xmm4, %rdx
nop
nop
nop
nop
cmp %r10, %r10
lea addresses_normal_ht+0xce12, %rsi
lea addresses_WT_ht+0xe5d2, %rdi
nop
nop
and $22399, %r8
mov $0, %rcx
rep movsq
nop
nop
nop
xor $50558, %rsi
lea addresses_D_ht+0x7d2, %rsi
add $56991, %r8
mov $0x6162636465666768, %r9
movq %r9, %xmm0
and $0xffffffffffffffc0, %rsi
vmovaps %ymm0, (%rsi)
nop
nop
cmp $34018, %r9
lea addresses_UC_ht+0x19278, %rsi
lea addresses_UC_ht+0xfdb2, %rdi
and %r8, %r8
mov $41, %rcx
rep movsl
nop
nop
nop
cmp $4632, %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r15
push %rbp
push %rbx
// Faulty Load
lea addresses_normal+0x1ae12, %rbp
cmp $38865, %r15
movups (%rbp), %xmm1
vpextrq $1, %xmm1, %r12
lea oracles, %rbp
and $0xff, %r12
shlq $12, %r12
mov (%rbp,%r12,1), %r12
pop %rbx
pop %rbp
pop %r15
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
decompressors/ZX7 decompressor.asm | maxim-zhao/bmp2tilecompressors | 12 | 242384 | ; ===============================================================
; Dec 2012 by <NAME>, <NAME> & Metalbrain
; "Standard" version (70 bytes)
; modified for sms vram by aralbrec
; modified for asm by Maxim :)
; ===============================================================
;
; Usage:
; ld hl, <source>
; ld de, <destination>
; call zx7_decompress
;
; Note:
; - Define ZX7ToVRAM before including to output to VRAM.
; Destination address must then be ORed with $4000.
; - Define ZX7ToVRAMScreenOn in addition to make it
; interrupt-safe (di and ei around VRAM access),
; not assume the VRAM state is stable,
; and access VRAM slower so it can run while the screen is on.
; - If you do not specify interrupt safety then you must
; make sure any interrupts do not alter the VDP VRAM state
; (i.e. do not read or write anything) and that the screen
; is off (or in VBlank if your data is really small).
; - Define ZX7NoUndocumented to avoid use of undocumented opcodes.
; This is for compatibility with some clone Z80s.
;
; This version only supports match lengths up to 255. This enables
; it to be smaller and faster, but it is not 100% compatible with
; the standard ZX7 compressor. However, in most cases it is because
; match lengths greater than that are very unlikely for most data.
;
; Uses af, bc, de, hl
; ===============================================================
zx7_decompress:
.ifdef ZX7ToVRAM
.ifndef ZX7ToVRAMScreenOn
; Set VRAM address
ld c,$bf
out (c),e
out (c),d
dec c ; data port
; interruptable version sets the address later
.endif
.endif
ld a, 1<<7 ; Signal bit for flags byte
; This is a trick whereby we can cycle a flags byte in a through the carry flag,
; and a will never be zero until it is time to read a new flags byte because we
; shift a bit to the right of the data to keep it non-zero until they are all
; consumed.
; Each time we want a bit, we do:
; add a, a ; get MSB into carry
; jr z, _nextFlagsByte ; get new flags byte if necessary (and shift it into carry)
; <use the bit in carry>
-:; First byte is always literal
.ifdef ZX7ToVRAM
.ifdef ZX7ToVRAMScreenOn
di
; Set VRAM address
ld c,$bf
out (c),e
out (c),d
dec c ; data port
.endif
outi ; increments hl
inc de
.else
ldi
.endif
--: ; Main loop
.ifdef ZX7ToVRAMScreenOn
ei
.endif
add a, a
call z, _nextFlagsByte
jr nc, - ; next bit indicates either literal or sequence
; 0 bit = literal byte
; 1 bit = sequence:
; - length is encoded using a variable number of flags bits, encoding
; the number of bits and the value
; length 2 is encoded as %1
; ^--- indicates 0 bit number, value 0
; length 3 is encoded as %011
; ^^-- indicates 1 bit number, value 1
; length 4 is encoded as %00110
; ^^^- indicates 2 bit number, value 2
; ...etc
; - offsets are encoded as either 7 or 11 bits plus a flag:
; - 0oooooooo for offset ooooooo
; - 1oooooooo plus bitstream bits abcd for offset abcdooooooo
push de
; determine number of bits used for length (Elias gamma coding)
ld b, 1 ; length result
ld d, 0 ; d = 0
-: ; Count how many 0 bits we have in the flags sequence
inc d
add a, a
call z, _nextFlagsByte
jr nc, -
jp +
; determine length
-: add a, a
call z, _nextFlagsByte
rl b
jp c, _done ; check end marker
+: dec d
jr nz, -
inc b ; adjust length
; determine offset
ld e, (hl) ; load offset flag (1 bit) + offset value (7 bits)
inc hl
.ifdef ZX7NoUndocumented
sla e
inc e
.else
sll e ; Undocumented instruction! Shifts into carry, inserts 1 in LSB
.endif
jr nc, + ; if offset flag is set, load 4 extra bits
add a, a
call z, _nextFlagsByte
rl d
add a, a
call z, _nextFlagsByte
rl d
add a, a
call z, _nextFlagsByte
rl d
add a, a
call z, _nextFlagsByte
ccf
jr c, +
inc d
+: rr e ; insert inverted fourth bit into E
; copy previous sequence
ex (sp), hl ; store source, restore destination
push hl ; store destination
sbc hl, de ; HL = destination - offset - 1
pop de ; DE = destination
.ifdef ZX7ToVRAM
; ldir vram -> vram
push af ; need to preserve carry
; Make hl a read address
res 6, h
inc c ; ld c, $bf
.ifdef ZX7ToVRAMScreenOn
di
.endif
-: out (c),l
out (c),h
inc hl ; 6 cycles
.ifdef ZX7ToVRAMScreenOn
; We want to waste 20 cycles, in as few bytes as possible, with no bad side ffects
add a,(hl) ; 1/7 - a is not needed
sub (hl) ; 1/7
inc hl ; 1/6 - undone later
.endif
in a,($be)
; no delay needed here
out (c),e
out (c),d
inc de ; 6 cycles
.ifdef ZX7ToVRAMScreenOn
; See above
add a,(hl) ; 1/7 - a needs to be restored
sub (hl) ; 1/7 - ...here
dec hl ; 1/6 - undoing extra inc
.endif
out ($be),a
djnz -
pop af
dec c ; ld c, $be ; restore VRAM write port
.else
ldir
.endif
pop hl ; restore source address (compressed data)
jp nc, --
_nextFlagsByte:
ld a, (hl) ; Else load the next byte
inc hl
rla ; And push that into the carry bit
ret
_done:
pop hl
ret
|
Firmware/obj/hm_trp/radio~hm_trp/packet.asm | mgrunsfeld/SiK | 0 | 245866 | ;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 3.5.0 #9253 (Mar 24 2016) (Linux)
; This file was generated Mon Jul 23 11:34:34 2018
;--------------------------------------------------------
.module packet
.optsdcc -mmcs51 --model-large
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _timer2_tick
.globl _printf_end_capture
.globl _printf_start_capture
.globl _at_command
.globl _param_print
.globl _serial_read_available
.globl _serial_read_buf
.globl _serial_peekx
.globl _serial_peek2
.globl _serial_peek
.globl _serial_read
.globl _memcmp
.globl _memcpy
.globl _SDN
.globl _NSS1
.globl _IRQ
.globl _PIN_ENABLE
.globl _PIN_CONFIG
.globl _LED_GREEN
.globl _LED_RED
.globl _SPI0EN
.globl _TXBMT0
.globl _NSS0MD0
.globl _NSS0MD1
.globl _RXOVRN0
.globl _MODF0
.globl _WCOL0
.globl _SPIF0
.globl _AD0CM0
.globl _AD0CM1
.globl _AD0CM2
.globl _AD0WINT
.globl _AD0BUSY
.globl _AD0INT
.globl _BURSTEN
.globl _AD0EN
.globl _CCF0
.globl _CCF1
.globl _CCF2
.globl _CCF3
.globl _CCF4
.globl _CCF5
.globl _CR
.globl _CF
.globl _P
.globl _F1
.globl _OV
.globl _RS0
.globl _RS1
.globl _F0
.globl _AC
.globl _CY
.globl _T2XCLK
.globl _T2RCLK
.globl _TR2
.globl _T2SPLIT
.globl _TF2CEN
.globl _TF2LEN
.globl _TF2L
.globl _TF2H
.globl _SI
.globl _ACK
.globl _ARBLOST
.globl _ACKRQ
.globl _STO
.globl _STA
.globl _TXMODE
.globl _MASTER
.globl _PX0
.globl _PT0
.globl _PX1
.globl _PT1
.globl _PS0
.globl _PT2
.globl _PSPI0
.globl _SPI1EN
.globl _TXBMT1
.globl _NSS1MD0
.globl _NSS1MD1
.globl _RXOVRN1
.globl _MODF1
.globl _WCOL1
.globl _SPIF1
.globl _EX0
.globl _ET0
.globl _EX1
.globl _ET1
.globl _ES0
.globl _ET2
.globl _ESPI0
.globl _EA
.globl _RI0
.globl _TI0
.globl _RB80
.globl _TB80
.globl _REN0
.globl _MCE0
.globl _S0MODE
.globl _CRC0VAL
.globl _CRC0INIT
.globl _CRC0SEL
.globl _IT0
.globl _IE0
.globl _IT1
.globl _IE1
.globl _TR0
.globl _TF0
.globl _TR1
.globl _TF1
.globl _PCA0CP4
.globl _PCA0CP0
.globl _PCA0
.globl _PCA0CP3
.globl _PCA0CP2
.globl _PCA0CP1
.globl _PCA0CP5
.globl _TMR2
.globl _TMR2RL
.globl _ADC0LT
.globl _ADC0GT
.globl _ADC0
.globl _TMR3
.globl _TMR3RL
.globl _TOFF
.globl _DP
.globl _VDM0CN
.globl _PCA0CPH4
.globl _PCA0CPL4
.globl _PCA0CPH0
.globl _PCA0CPL0
.globl _PCA0H
.globl _PCA0L
.globl _SPI0CN
.globl _EIP2
.globl _EIP1
.globl _SMB0ADM
.globl _SMB0ADR
.globl _P2MDIN
.globl _P1MDIN
.globl _P0MDIN
.globl _B
.globl _RSTSRC
.globl _PCA0CPH3
.globl _PCA0CPL3
.globl _PCA0CPH2
.globl _PCA0CPL2
.globl _PCA0CPH1
.globl _PCA0CPL1
.globl _ADC0CN
.globl _EIE2
.globl _EIE1
.globl _FLWR
.globl _IT01CF
.globl _XBR2
.globl _XBR1
.globl _XBR0
.globl _ACC
.globl _PCA0PWM
.globl _PCA0CPM4
.globl _PCA0CPM3
.globl _PCA0CPM2
.globl _PCA0CPM1
.globl _PCA0CPM0
.globl _PCA0MD
.globl _PCA0CN
.globl _P0MAT
.globl _P2SKIP
.globl _P1SKIP
.globl _P0SKIP
.globl _PCA0CPH5
.globl _PCA0CPL5
.globl _REF0CN
.globl _PSW
.globl _P1MAT
.globl _PCA0CPM5
.globl _TMR2H
.globl _TMR2L
.globl _TMR2RLH
.globl _TMR2RLL
.globl _REG0CN
.globl _TMR2CN
.globl _P0MASK
.globl _ADC0LTH
.globl _ADC0LTL
.globl _ADC0GTH
.globl _ADC0GTL
.globl _SMB0DAT
.globl _SMB0CF
.globl _SMB0CN
.globl _P1MASK
.globl _ADC0H
.globl _ADC0L
.globl _ADC0TK
.globl _ADC0CF
.globl _ADC0MX
.globl _ADC0PWR
.globl _ADC0AC
.globl _IREF0CN
.globl _IP
.globl _FLKEY
.globl _FLSCL
.globl _PMU0CF
.globl _OSCICL
.globl _OSCICN
.globl _OSCXCN
.globl _SPI1CN
.globl _ONESHOT
.globl _EMI0TC
.globl _RTC0KEY
.globl _RTC0DAT
.globl _RTC0ADR
.globl _EMI0CF
.globl _EMI0CN
.globl _CLKSEL
.globl _IE
.globl _SFRPAGE
.globl _P2DRV
.globl _P2MDOUT
.globl _P1DRV
.globl _P1MDOUT
.globl _P0DRV
.globl _P0MDOUT
.globl _SPI0DAT
.globl _SPI0CKR
.globl _SPI0CFG
.globl _P2
.globl _CPT0MX
.globl _CPT1MX
.globl _CPT0MD
.globl _CPT1MD
.globl _CPT0CN
.globl _CPT1CN
.globl _SBUF0
.globl _SCON0
.globl _CRC0CNT
.globl _DC0CN
.globl _CRC0AUTO
.globl _DC0CF
.globl _TMR3H
.globl _CRC0FLIP
.globl _TMR3L
.globl _CRC0IN
.globl _TMR3RLH
.globl _CRC0CN
.globl _TMR3RLL
.globl _CRC0DAT
.globl _TMR3CN
.globl _P1
.globl _PSCTL
.globl _CKCON
.globl _TH1
.globl _TH0
.globl _TL1
.globl _TL0
.globl _TMOD
.globl _TCON
.globl _PCON
.globl _TOFFH
.globl _SPI1DAT
.globl _TOFFL
.globl _SPI1CKR
.globl _SPI1CFG
.globl _DPH
.globl _DPL
.globl _SP
.globl _P0
.globl _packet_inject_PARM_2
.globl _packet_is_duplicate_PARM_2
.globl _packet_get_next_PARM_2
.globl _packet_is_duplicate_PARM_3
.globl _seen_mavlink
.globl _packet_get_next
.globl _packet_is_resend
.globl _packet_is_injected
.globl _packet_force_resend
.globl _packet_set_max_xmit
.globl _packet_set_serial_speed
.globl _packet_is_duplicate
.globl _packet_ati5_inject
.globl _packet_at_inject
.globl _packet_inject
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
.area RSEG (ABS,DATA)
.org 0x0000
_P0 = 0x0080
_SP = 0x0081
_DPL = 0x0082
_DPH = 0x0083
_SPI1CFG = 0x0084
_SPI1CKR = 0x0085
_TOFFL = 0x0085
_SPI1DAT = 0x0086
_TOFFH = 0x0086
_PCON = 0x0087
_TCON = 0x0088
_TMOD = 0x0089
_TL0 = 0x008a
_TL1 = 0x008b
_TH0 = 0x008c
_TH1 = 0x008d
_CKCON = 0x008e
_PSCTL = 0x008f
_P1 = 0x0090
_TMR3CN = 0x0091
_CRC0DAT = 0x0091
_TMR3RLL = 0x0092
_CRC0CN = 0x0092
_TMR3RLH = 0x0093
_CRC0IN = 0x0093
_TMR3L = 0x0094
_CRC0FLIP = 0x0095
_TMR3H = 0x0095
_DC0CF = 0x0096
_CRC0AUTO = 0x0096
_DC0CN = 0x0097
_CRC0CNT = 0x0097
_SCON0 = 0x0098
_SBUF0 = 0x0099
_CPT1CN = 0x009a
_CPT0CN = 0x009b
_CPT1MD = 0x009c
_CPT0MD = 0x009d
_CPT1MX = 0x009e
_CPT0MX = 0x009f
_P2 = 0x00a0
_SPI0CFG = 0x00a1
_SPI0CKR = 0x00a2
_SPI0DAT = 0x00a3
_P0MDOUT = 0x00a4
_P0DRV = 0x00a4
_P1MDOUT = 0x00a5
_P1DRV = 0x00a5
_P2MDOUT = 0x00a6
_P2DRV = 0x00a6
_SFRPAGE = 0x00a7
_IE = 0x00a8
_CLKSEL = 0x00a9
_EMI0CN = 0x00aa
_EMI0CF = 0x00ab
_RTC0ADR = 0x00ac
_RTC0DAT = 0x00ad
_RTC0KEY = 0x00ae
_EMI0TC = 0x00af
_ONESHOT = 0x00af
_SPI1CN = 0x00b0
_OSCXCN = 0x00b1
_OSCICN = 0x00b2
_OSCICL = 0x00b3
_PMU0CF = 0x00b5
_FLSCL = 0x00b6
_FLKEY = 0x00b7
_IP = 0x00b8
_IREF0CN = 0x00b9
_ADC0AC = 0x00ba
_ADC0PWR = 0x00ba
_ADC0MX = 0x00bb
_ADC0CF = 0x00bc
_ADC0TK = 0x00bd
_ADC0L = 0x00bd
_ADC0H = 0x00be
_P1MASK = 0x00bf
_SMB0CN = 0x00c0
_SMB0CF = 0x00c1
_SMB0DAT = 0x00c2
_ADC0GTL = 0x00c3
_ADC0GTH = 0x00c4
_ADC0LTL = 0x00c5
_ADC0LTH = 0x00c6
_P0MASK = 0x00c7
_TMR2CN = 0x00c8
_REG0CN = 0x00c9
_TMR2RLL = 0x00ca
_TMR2RLH = 0x00cb
_TMR2L = 0x00cc
_TMR2H = 0x00cd
_PCA0CPM5 = 0x00ce
_P1MAT = 0x00cf
_PSW = 0x00d0
_REF0CN = 0x00d1
_PCA0CPL5 = 0x00d2
_PCA0CPH5 = 0x00d3
_P0SKIP = 0x00d4
_P1SKIP = 0x00d5
_P2SKIP = 0x00d6
_P0MAT = 0x00d7
_PCA0CN = 0x00d8
_PCA0MD = 0x00d9
_PCA0CPM0 = 0x00da
_PCA0CPM1 = 0x00db
_PCA0CPM2 = 0x00dc
_PCA0CPM3 = 0x00dd
_PCA0CPM4 = 0x00de
_PCA0PWM = 0x00df
_ACC = 0x00e0
_XBR0 = 0x00e1
_XBR1 = 0x00e2
_XBR2 = 0x00e3
_IT01CF = 0x00e4
_FLWR = 0x00e5
_EIE1 = 0x00e6
_EIE2 = 0x00e7
_ADC0CN = 0x00e8
_PCA0CPL1 = 0x00e9
_PCA0CPH1 = 0x00ea
_PCA0CPL2 = 0x00eb
_PCA0CPH2 = 0x00ec
_PCA0CPL3 = 0x00ed
_PCA0CPH3 = 0x00ee
_RSTSRC = 0x00ef
_B = 0x00f0
_P0MDIN = 0x00f1
_P1MDIN = 0x00f2
_P2MDIN = 0x00f3
_SMB0ADR = 0x00f4
_SMB0ADM = 0x00f5
_EIP1 = 0x00f6
_EIP2 = 0x00f7
_SPI0CN = 0x00f8
_PCA0L = 0x00f9
_PCA0H = 0x00fa
_PCA0CPL0 = 0x00fb
_PCA0CPH0 = 0x00fc
_PCA0CPL4 = 0x00fd
_PCA0CPH4 = 0x00fe
_VDM0CN = 0x00ff
_DP = 0x8382
_TOFF = 0x8685
_TMR3RL = 0x9392
_TMR3 = 0x9594
_ADC0 = 0xbebd
_ADC0GT = 0xc4c3
_ADC0LT = 0xc6c5
_TMR2RL = 0xcbca
_TMR2 = 0xcdcc
_PCA0CP5 = 0xd3d2
_PCA0CP1 = 0xeae9
_PCA0CP2 = 0xeceb
_PCA0CP3 = 0xeeed
_PCA0 = 0xfaf9
_PCA0CP0 = 0xfcfb
_PCA0CP4 = 0xfefd
;--------------------------------------------------------
; special function bits
;--------------------------------------------------------
.area RSEG (ABS,DATA)
.org 0x0000
_TF1 = 0x008f
_TR1 = 0x008e
_TF0 = 0x008d
_TR0 = 0x008c
_IE1 = 0x008b
_IT1 = 0x008a
_IE0 = 0x0089
_IT0 = 0x0088
_CRC0SEL = 0x0096
_CRC0INIT = 0x0095
_CRC0VAL = 0x0094
_S0MODE = 0x009f
_MCE0 = 0x009d
_REN0 = 0x009c
_TB80 = 0x009b
_RB80 = 0x009a
_TI0 = 0x0099
_RI0 = 0x0098
_EA = 0x00af
_ESPI0 = 0x00ae
_ET2 = 0x00ad
_ES0 = 0x00ac
_ET1 = 0x00ab
_EX1 = 0x00aa
_ET0 = 0x00a9
_EX0 = 0x00a8
_SPIF1 = 0x00b7
_WCOL1 = 0x00b6
_MODF1 = 0x00b5
_RXOVRN1 = 0x00b4
_NSS1MD1 = 0x00b3
_NSS1MD0 = 0x00b2
_TXBMT1 = 0x00b1
_SPI1EN = 0x00b0
_PSPI0 = 0x00be
_PT2 = 0x00bd
_PS0 = 0x00bc
_PT1 = 0x00bb
_PX1 = 0x00ba
_PT0 = 0x00b9
_PX0 = 0x00b8
_MASTER = 0x00c7
_TXMODE = 0x00c6
_STA = 0x00c5
_STO = 0x00c4
_ACKRQ = 0x00c3
_ARBLOST = 0x00c2
_ACK = 0x00c1
_SI = 0x00c0
_TF2H = 0x00cf
_TF2L = 0x00ce
_TF2LEN = 0x00cd
_TF2CEN = 0x00cc
_T2SPLIT = 0x00cb
_TR2 = 0x00ca
_T2RCLK = 0x00c9
_T2XCLK = 0x00c8
_CY = 0x00d7
_AC = 0x00d6
_F0 = 0x00d5
_RS1 = 0x00d4
_RS0 = 0x00d3
_OV = 0x00d2
_F1 = 0x00d1
_P = 0x00d0
_CF = 0x00df
_CR = 0x00de
_CCF5 = 0x00dd
_CCF4 = 0x00dc
_CCF3 = 0x00db
_CCF2 = 0x00da
_CCF1 = 0x00d9
_CCF0 = 0x00d8
_AD0EN = 0x00ef
_BURSTEN = 0x00ee
_AD0INT = 0x00ed
_AD0BUSY = 0x00ec
_AD0WINT = 0x00eb
_AD0CM2 = 0x00ea
_AD0CM1 = 0x00e9
_AD0CM0 = 0x00e8
_SPIF0 = 0x00ff
_WCOL0 = 0x00fe
_MODF0 = 0x00fd
_RXOVRN0 = 0x00fc
_NSS0MD1 = 0x00fb
_NSS0MD0 = 0x00fa
_TXBMT0 = 0x00f9
_SPI0EN = 0x00f8
_LED_RED = 0x0096
_LED_GREEN = 0x0095
_PIN_CONFIG = 0x0082
_PIN_ENABLE = 0x0083
_IRQ = 0x0087
_NSS1 = 0x0094
_SDN = 0x00a6
;--------------------------------------------------------
; overlayable register banks
;--------------------------------------------------------
.area REG_BANK_0 (REL,OVR,DATA)
.ds 8
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
.area DSEG (DATA)
_extract_hipri_c_2_150:
.ds 1
_extract_hipri_sloc0_1_0:
.ds 2
_mavlink_frame_slen_1_156:
.ds 2
_mavlink_frame_offset_1_156:
.ds 2
_mavlink_frame_high_offset_1_156:
.ds 2
_mavlink_frame_c_2_157:
.ds 1
_mavlink_frame_sloc0_1_0:
.ds 2
_mavlink_frame_sloc1_1_0:
.ds 1
_packet_get_next_max_xmit_1_163:
.ds 1
_packet_get_next_slen_1_164:
.ds 2
_packet_get_next_sloc0_1_0:
.ds 2
;--------------------------------------------------------
; overlayable items in internal ram
;--------------------------------------------------------
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
.area ISEG (DATA)
;--------------------------------------------------------
; absolute internal ram data
;--------------------------------------------------------
.area IABS (ABS,DATA)
.area IABS (ABS,DATA)
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
.area BSEG (BIT)
_last_sent_is_resend:
.ds 1
_last_sent_is_injected:
.ds 1
_last_recv_is_resend:
.ds 1
_force_resend:
.ds 1
_injected_packet:
.ds 1
_seen_mavlink::
.ds 1
_packet_is_duplicate_PARM_3:
.ds 1
;--------------------------------------------------------
; paged external ram data
;--------------------------------------------------------
.area PSEG (PAG,XDATA)
_last_sent_len:
.ds 1
_last_recv_len:
.ds 1
_serial_rate:
.ds 2
_mav_pkt_len:
.ds 1
_mav_pkt_start_time:
.ds 2
_mav_pkt_max_time:
.ds 2
_mav_max_xmit:
.ds 1
_extract_hipri_max_xmit_1_148:
.ds 1
_extract_hipri_slen_1_149:
.ds 2
_extract_hipri_high_offset_1_149:
.ds 2
_mavlink_frame_PARM_2:
.ds 2
_packet_get_next_PARM_2:
.ds 2
_packet_is_duplicate_PARM_2:
.ds 2
_packet_inject_PARM_2:
.ds 1
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
.area XSEG (XDATA)
_last_received:
.ds 252
_last_sent:
.ds 252
_mavlink_frame_max_xmit_1_155:
.ds 1
_packet_set_max_xmit_max_1_195:
.ds 1
_packet_set_serial_speed_speed_1_197:
.ds 2
_packet_is_duplicate_len_1_199:
.ds 1
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
.area XABS (ABS,XDATA)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
.area XISEG (XDATA)
.area HOME (CODE)
.area GSINIT0 (CODE)
.area GSINIT1 (CODE)
.area GSINIT2 (CODE)
.area GSINIT3 (CODE)
.area GSINIT4 (CODE)
.area GSINIT5 (CODE)
.area GSINIT (CODE)
.area GSFINAL (CODE)
.area CSEG (CODE)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area HOME (CODE)
.area GSINIT (CODE)
.area GSFINAL (CODE)
.area GSINIT (CODE)
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area HOME (CODE)
.area HOME (CODE)
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area CSEG (CODE)
;------------------------------------------------------------
;Allocation info for local variables in function 'check_heartbeat'
;------------------------------------------------------------
; radio/packet.c:77: static void check_heartbeat(__xdata uint8_t * __pdata buf) __nonbanked
; -----------------------------------------
; function check_heartbeat
; -----------------------------------------
_check_heartbeat:
ar7 = 0x07
ar6 = 0x06
ar5 = 0x05
ar4 = 0x04
ar3 = 0x03
ar2 = 0x02
ar1 = 0x01
ar0 = 0x00
; radio/packet.c:79: if (buf[0] == MAVLINK10_STX &&
mov r6,dpl
mov r7,dph
movx a,@dptr
mov r5,a
cjne r5,#0xFE,00105$
; radio/packet.c:80: buf[1] == 9 && buf[5] == 0) {
mov dpl,r6
mov dph,r7
inc dptr
movx a,@dptr
mov r5,a
cjne r5,#0x09,00105$
mov a,#0x05
add a,r6
mov r6,a
clr a
addc a,r7
mov r7,a
mov dpl,r6
mov dph,r7
movx a,@dptr
jnz 00105$
; radio/packet.c:82: seen_mavlink = true;
setb _seen_mavlink
00105$:
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'extract_hipri'
;------------------------------------------------------------
;c Allocated with name '_extract_hipri_c_2_150'
;sloc0 Allocated with name '_extract_hipri_sloc0_1_0'
;------------------------------------------------------------
; radio/packet.c:92: int16_t extract_hipri(__pdata uint8_t max_xmit)
; -----------------------------------------
; function extract_hipri
; -----------------------------------------
_extract_hipri:
mov a,dpl
mov r0,#_extract_hipri_max_xmit_1_148
movx @r0,a
; radio/packet.c:94: __pdata uint16_t slen = serial_read_available();
lcall _serial_read_available
mov r0,#_extract_hipri_slen_1_149
mov a,dpl
movx @r0,a
inc r0
mov a,dph
movx @r0,a
; radio/packet.c:95: __pdata uint16_t offset = 0;
mov r3,#0x00
mov r4,#0x00
; radio/packet.c:96: __pdata int16_t high_offset = -1;
mov r0,#_extract_hipri_high_offset_1_149
mov a,#0xFF
movx @r0,a
inc r0
movx @r0,a
; radio/packet.c:99: while (slen >= 8) {
00111$:
mov r0,#_extract_hipri_slen_1_149
clr c
movx a,@r0
subb a,#0x08
inc r0
movx a,@r0
subb a,#0x00
jnc 00140$
ljmp 00113$
00140$:
; radio/packet.c:100: register uint8_t c = serial_peekx(offset);
mov dpl,r3
mov dph,r4
push ar4
push ar3
lcall _serial_peekx
mov _extract_hipri_c_2_150,dpl
pop ar3
pop ar4
; radio/packet.c:101: if (c != MAVLINK10_STX) {
mov a,#0xFE
cjne a,_extract_hipri_c_2_150,00141$
sjmp 00142$
00141$:
ljmp 00113$
00142$:
; radio/packet.c:105: c = serial_peekx(offset + 1);
mov a,#0x01
add a,r3
mov r6,a
clr a
addc a,r4
mov r7,a
mov dpl,r6
mov dph,r7
push ar4
push ar3
lcall _serial_peekx
mov _extract_hipri_c_2_150,dpl
pop ar3
pop ar4
; radio/packet.c:106: if (c >= 255 - 8 ||
mov a,#0x100 - 0xF7
add a,_extract_hipri_c_2_150
jnc 00143$
ljmp 00113$
00143$:
; radio/packet.c:107: c+8 > max_xmit - last_sent_len) {
push ar3
push ar4
mov r5,_extract_hipri_c_2_150
mov r6,#0x00
mov a,#0x08
add a,r5
mov r2,a
clr a
addc a,r6
mov r4,a
mov r0,#_extract_hipri_max_xmit_1_148
movx a,@r0
mov _extract_hipri_sloc0_1_0,a
; 1-genFromRTrack replaced mov (_extract_hipri_sloc0_1_0 + 1),#0x00
mov (_extract_hipri_sloc0_1_0 + 1),r6
mov r0,#_last_sent_len
movx a,@r0
mov r3,a
mov r7,#0x00
mov a,_extract_hipri_sloc0_1_0
clr c
subb a,r3
mov r3,a
mov a,(_extract_hipri_sloc0_1_0 + 1)
subb a,r7
mov r7,a
clr c
mov a,r3
subb a,r2
mov a,r7
xrl a,#0x80
mov b,r4
xrl b,#0x80
subb a,b
pop ar4
pop ar3
jc 00113$
; radio/packet.c:111: if (c+8 > slen) {
mov a,#0x08
add a,r5
mov r5,a
clr a
addc a,r6
mov r6,a
mov r0,#_extract_hipri_slen_1_149
clr c
movx a,@r0
subb a,r5
inc r0
movx a,@r0
subb a,r6
jc 00113$
; radio/packet.c:117: if(serial_peekx(offset +6) == MSG_TYP_RC_OVERRIDE && c == MSG_LEN_RC_OVERRIDE) {
mov a,#0x06
add a,r3
mov r6,a
clr a
addc a,r4
mov r7,a
mov dpl,r6
mov dph,r7
push ar4
push ar3
lcall _serial_peekx
mov r7,dpl
pop ar3
pop ar4
cjne r7,#0x46,00109$
mov a,#0x12
cjne a,_extract_hipri_c_2_150,00109$
; radio/packet.c:119: high_offset = offset;
mov r0,#_extract_hipri_high_offset_1_149
mov a,r3
movx @r0,a
inc r0
mov a,r4
movx @r0,a
00109$:
; radio/packet.c:122: c += 8;
mov a,#0x08
add a,_extract_hipri_c_2_150
mov _extract_hipri_c_2_150,a
; radio/packet.c:123: slen -= c;
mov r2,_extract_hipri_c_2_150
mov r7,#0x00
mov r0,#_extract_hipri_slen_1_149
movx a,@r0
clr c
subb a,r2
movx @r0,a
inc r0
movx a,@r0
subb a,r7
movx @r0,a
; radio/packet.c:124: offset += c;
mov a,r2
add a,r3
mov r3,a
mov a,r7
addc a,r4
mov r4,a
ljmp 00111$
00113$:
; radio/packet.c:127: return high_offset;
mov r0,#_extract_hipri_high_offset_1_149
movx a,@r0
mov dpl,a
inc r0
movx a,@r0
mov dph,a
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'mavlink_frame'
;------------------------------------------------------------
;slen Allocated with name '_mavlink_frame_slen_1_156'
;offset Allocated with name '_mavlink_frame_offset_1_156'
;high_offset Allocated with name '_mavlink_frame_high_offset_1_156'
;c Allocated with name '_mavlink_frame_c_2_157'
;sloc0 Allocated with name '_mavlink_frame_sloc0_1_0'
;sloc1 Allocated with name '_mavlink_frame_sloc1_1_0'
;max_xmit Allocated with name '_mavlink_frame_max_xmit_1_155'
;------------------------------------------------------------
; radio/packet.c:137: uint8_t mavlink_frame(uint8_t max_xmit, __xdata uint8_t * __pdata buf) __nonbanked
; -----------------------------------------
; function mavlink_frame
; -----------------------------------------
_mavlink_frame:
mov a,dpl
mov dptr,#_mavlink_frame_max_xmit_1_155
movx @dptr,a
; radio/packet.c:139: __data uint16_t slen, offset = 0, high_offset;
clr a
mov _mavlink_frame_offset_1_156,a
mov (_mavlink_frame_offset_1_156 + 1),a
; radio/packet.c:141: serial_read_buf(last_sent, mav_pkt_len);
mov r0,#_mav_pkt_len
mov r1,#_serial_read_buf_PARM_2
movx a,@r0
movx @r1,a
mov dptr,#_last_sent
lcall _serial_read_buf
; radio/packet.c:142: last_sent_len = mav_pkt_len;
mov r0,#_mav_pkt_len
movx a,@r0
mov r5,a
mov r0,#_last_sent_len
movx @r0,a
; radio/packet.c:143: memcpy(buf, last_sent, last_sent_len);
mov r0,#_mavlink_frame_PARM_2
movx a,@r0
mov r2,a
inc r0
movx a,@r0
mov r3,a
mov r4,#0x00
mov dptr,#_memcpy_PARM_2
mov a,#_last_sent
movx @dptr,a
mov a,#(_last_sent >> 8)
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dptr,#_memcpy_PARM_3
mov a,r5
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dpl,r2
mov dph,r3
mov b,r4
lcall _memcpy
; radio/packet.c:144: mav_pkt_len = 0;
mov r0,#_mav_pkt_len
clr a
movx @r0,a
; radio/packet.c:146: check_heartbeat(buf);
mov r0,#_mavlink_frame_PARM_2
movx a,@r0
mov dpl,a
inc r0
movx a,@r0
mov dph,a
lcall _check_heartbeat
; radio/packet.c:148: high_offset = (feature_mavlink_framing == MAVLINK_FRAMING_HIGHPRI) ? extract_hipri(max_xmit) : -1;
mov dptr,#_feature_mavlink_framing
movx a,@dptr
mov r5,a
cjne r5,#0x02,00119$
mov dptr,#_mavlink_frame_max_xmit_1_155
movx a,@dptr
mov dpl,a
lcall _extract_hipri
mov r4,dpl
mov r5,dph
sjmp 00120$
00119$:
mov r4,#0xFF
mov r5,#0xFF
00120$:
mov _mavlink_frame_high_offset_1_156,r4
mov (_mavlink_frame_high_offset_1_156 + 1),r5
; radio/packet.c:150: slen = serial_read_available();
lcall _serial_read_available
mov _mavlink_frame_slen_1_156,dpl
mov (_mavlink_frame_slen_1_156 + 1),dph
; radio/packet.c:154: while (slen >= 8) {
mov dptr,#_mavlink_frame_max_xmit_1_155
movx a,@dptr
mov _mavlink_frame_sloc1_1_0,a
mov a,#0xFF
cjne a,_mavlink_frame_high_offset_1_156,00156$
mov a,#0xFF
cjne a,(_mavlink_frame_high_offset_1_156 + 1),00156$
mov a,#0x01
sjmp 00157$
00156$:
clr a
00157$:
mov r4,a
00114$:
clr c
mov a,_mavlink_frame_slen_1_156
subb a,#0x08
mov a,(_mavlink_frame_slen_1_156 + 1)
subb a,#0x00
jnc 00158$
ljmp 00116$
00158$:
; radio/packet.c:155: register uint8_t c = serial_peek();
push ar4
lcall _serial_peek
mov _mavlink_frame_c_2_157,dpl
pop ar4
; radio/packet.c:156: if (c != MAVLINK10_STX) {
mov a,#0xFE
cjne a,_mavlink_frame_c_2_157,00159$
sjmp 00102$
00159$:
; radio/packet.c:158: return last_sent_len;
mov r0,#_last_sent_len
movx a,@r0
mov dpl,a
ret
00102$:
; radio/packet.c:160: c = serial_peek2();
push ar4
lcall _serial_peek2
mov _mavlink_frame_c_2_157,dpl
pop ar4
; radio/packet.c:161: if (c >= 255 - 8 ||
mov a,#0x100 - 0xF7
add a,_mavlink_frame_c_2_157
jnc 00160$
ljmp 00116$
00160$:
; radio/packet.c:162: c+8 > max_xmit - last_sent_len) {
push ar4
mov _mavlink_frame_sloc0_1_0,_mavlink_frame_c_2_157
mov (_mavlink_frame_sloc0_1_0 + 1),#0x00
mov a,#0x08
add a,_mavlink_frame_sloc0_1_0
mov r3,a
clr a
addc a,(_mavlink_frame_sloc0_1_0 + 1)
mov r6,a
mov r2,_mavlink_frame_sloc1_1_0
mov r7,#0x00
mov r0,#_last_sent_len
movx a,@r0
mov r4,a
mov r5,#0x00
mov a,r2
clr c
subb a,r4
mov r2,a
mov a,r7
subb a,r5
mov r7,a
clr c
mov a,r2
subb a,r3
mov a,r7
xrl a,#0x80
mov b,r6
xrl b,#0x80
subb a,b
pop ar4
jnc 00161$
ljmp 00116$
00161$:
; radio/packet.c:166: if (c+8 > slen) {
mov a,#0x08
add a,_mavlink_frame_sloc0_1_0
mov r6,a
clr a
addc a,(_mavlink_frame_sloc0_1_0 + 1)
mov r7,a
clr c
mov a,_mavlink_frame_slen_1_156
subb a,r6
mov a,(_mavlink_frame_slen_1_156 + 1)
subb a,r7
jnc 00162$
ljmp 00116$
00162$:
; radio/packet.c:173: if(high_offset != -1 && high_offset != offset && serial_peekx(6) == MSG_TYP_RC_OVERRIDE && c == MSG_LEN_RC_OVERRIDE) {
mov a,r4
jnz 00109$
mov a,_mavlink_frame_offset_1_156
cjne a,_mavlink_frame_high_offset_1_156,00164$
mov a,(_mavlink_frame_offset_1_156 + 1)
cjne a,(_mavlink_frame_high_offset_1_156 + 1),00164$
sjmp 00109$
00164$:
mov dptr,#0x0006
push ar4
lcall _serial_peekx
mov r7,dpl
pop ar4
cjne r7,#0x46,00109$
mov a,#0x12
cjne a,_mavlink_frame_c_2_157,00109$
; radio/packet.c:175: c += 8;
mov a,#0x08
add a,_mavlink_frame_c_2_157
mov _mavlink_frame_c_2_157,a
sjmp 00110$
00109$:
; radio/packet.c:178: c += 8;
mov a,#0x08
add a,_mavlink_frame_c_2_157
mov _mavlink_frame_c_2_157,a
; radio/packet.c:181: serial_read_buf(&last_sent[last_sent_len], c);
mov r0,#_last_sent_len
movx a,@r0
add a,#_last_sent
mov r6,a
clr a
addc a,#(_last_sent >> 8)
mov r7,a
mov r0,#_serial_read_buf_PARM_2
mov a,_mavlink_frame_c_2_157
movx @r0,a
mov dpl,r6
mov dph,r7
push ar4
lcall _serial_read_buf
; radio/packet.c:182: memcpy(&buf[last_sent_len], &last_sent[last_sent_len], c);
mov r0,#_mavlink_frame_PARM_2
mov r1,#_last_sent_len
movx a,@r1
xch a,b
movx a,@r0
add a,b
mov r6,a
inc r0
movx a,@r0
addc a,#0x00
mov r7,a
mov r5,#0x00
mov r0,#_last_sent_len
movx a,@r0
add a,#_last_sent
mov r2,a
clr a
addc a,#(_last_sent >> 8)
mov r3,a
mov dptr,#_memcpy_PARM_2
mov a,r2
movx @dptr,a
mov a,r3
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dptr,#_memcpy_PARM_3
mov a,_mavlink_frame_c_2_157
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dpl,r6
mov dph,r7
mov b,r5
lcall _memcpy
; radio/packet.c:184: check_heartbeat(buf+last_sent_len);
mov r0,#_mavlink_frame_PARM_2
mov r1,#_last_sent_len
movx a,@r1
xch a,b
movx a,@r0
add a,b
mov r6,a
inc r0
movx a,@r0
addc a,#0x00
mov r7,a
mov dpl,r6
mov dph,r7
lcall _check_heartbeat
pop ar4
00110$:
; radio/packet.c:187: last_sent_len += c;
mov r0,#_last_sent_len
movx a,@r0
add a,_mavlink_frame_c_2_157
movx @r0,a
; radio/packet.c:188: slen -= c;
mov r6,_mavlink_frame_c_2_157
mov r7,#0x00
mov a,_mavlink_frame_slen_1_156
clr c
subb a,r6
mov _mavlink_frame_slen_1_156,a
mov a,(_mavlink_frame_slen_1_156 + 1)
subb a,r7
mov (_mavlink_frame_slen_1_156 + 1),a
; radio/packet.c:189: offset += c;
mov a,r6
add a,_mavlink_frame_offset_1_156
mov _mavlink_frame_offset_1_156,a
mov a,r7
addc a,(_mavlink_frame_offset_1_156 + 1)
mov (_mavlink_frame_offset_1_156 + 1),a
ljmp 00114$
00116$:
; radio/packet.c:192: return last_sent_len;
mov r0,#_last_sent_len
movx a,@r0
mov dpl,a
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'packet_get_next'
;------------------------------------------------------------
;max_xmit Allocated with name '_packet_get_next_max_xmit_1_163'
;slen Allocated with name '_packet_get_next_slen_1_164'
;c Allocated to registers r7
;sloc0 Allocated with name '_packet_get_next_sloc0_1_0'
;------------------------------------------------------------
; radio/packet.c:198: packet_get_next(register uint8_t max_xmit, __xdata uint8_t * __pdata buf)
; -----------------------------------------
; function packet_get_next
; -----------------------------------------
_packet_get_next:
mov _packet_get_next_max_xmit_1_163,dpl
; radio/packet.c:207: slen = serial_read_available();
lcall _serial_read_available
mov _packet_get_next_slen_1_164,dpl
mov (_packet_get_next_slen_1_164 + 1),dph
; radio/packet.c:208: if (force_resend ||
jb _force_resend,00103$
; radio/packet.c:209: (feature_opportunistic_resend &&
jnb _feature_opportunistic_resend,00104$
jb _last_sent_is_resend,00104$
; radio/packet.c:211: last_sent_len != 0 &&
mov r0,#_last_sent_len
movx a,@r0
jz 00104$
; radio/packet.c:212: slen < PACKET_RESEND_THRESHOLD)) {
clr c
mov a,_packet_get_next_slen_1_164
subb a,#0x20
mov a,(_packet_get_next_slen_1_164 + 1)
subb a,#0x00
jnc 00104$
00103$:
; radio/packet.c:213: if (max_xmit < last_sent_len) {
mov r0,#_last_sent_len
clr c
movx a,@r0
mov b,a
mov a,_packet_get_next_max_xmit_1_163
subb a,b
jnc 00102$
; radio/packet.c:214: last_sent_len = 0;
mov r0,#_last_sent_len
clr a
movx @r0,a
; radio/packet.c:215: return 0;
mov dpl,#0x00
ret
00102$:
; radio/packet.c:217: last_sent_is_resend = true;
setb _last_sent_is_resend
; radio/packet.c:218: force_resend = false;
clr _force_resend
; radio/packet.c:219: memcpy(buf, last_sent, last_sent_len);
mov r0,#_packet_get_next_PARM_2
movx a,@r0
mov r2,a
inc r0
movx a,@r0
mov r3,a
mov r4,#0x00
mov dptr,#_memcpy_PARM_2
mov a,#_last_sent
movx @dptr,a
mov a,#(_last_sent >> 8)
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov r0,#_last_sent_len
mov dptr,#_memcpy_PARM_3
movx a,@r0
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dpl,r2
mov dph,r3
mov b,r4
lcall _memcpy
; radio/packet.c:220: slen = last_sent_len;
mov r0,#_last_sent_len
movx a,@r0
mov _packet_get_next_slen_1_164,a
mov (_packet_get_next_slen_1_164 + 1),#0x00
; radio/packet.c:221: last_sent_len = 0;
mov r0,#_last_sent_len
clr a
movx @r0,a
; radio/packet.c:222: return (slen & 0xFF);
mov r3,_packet_get_next_slen_1_164
mov dpl,r3
ret
00104$:
; radio/packet.c:225: last_sent_is_resend = false;
clr _last_sent_is_resend
; radio/packet.c:227: if (injected_packet) {
jb _injected_packet,00240$
ljmp 00112$
00240$:
; radio/packet.c:229: slen = last_sent_len;
mov r0,#_last_sent_len
movx a,@r0
mov r3,a
mov r4,#0x00
mov _packet_get_next_slen_1_164,r3
mov (_packet_get_next_slen_1_164 + 1),r4
; radio/packet.c:230: if (max_xmit < slen) {
mov _packet_get_next_sloc0_1_0,_packet_get_next_max_xmit_1_163
; 1-genFromRTrack replaced mov (_packet_get_next_sloc0_1_0 + 1),#0x00
mov (_packet_get_next_sloc0_1_0 + 1),r4
clr c
mov a,_packet_get_next_sloc0_1_0
subb a,_packet_get_next_slen_1_164
mov a,(_packet_get_next_sloc0_1_0 + 1)
subb a,(_packet_get_next_slen_1_164 + 1)
jnc 00110$
; radio/packet.c:232: memcpy(buf, last_sent, max_xmit);
mov r0,#_packet_get_next_PARM_2
movx a,@r0
mov r2,a
inc r0
movx a,@r0
mov r6,a
mov r7,#0x00
mov dptr,#_memcpy_PARM_2
mov a,#_last_sent
movx @dptr,a
mov a,#(_last_sent >> 8)
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dptr,#_memcpy_PARM_3
mov a,_packet_get_next_sloc0_1_0
movx @dptr,a
mov a,(_packet_get_next_sloc0_1_0 + 1)
inc dptr
movx @dptr,a
mov dpl,r2
mov dph,r6
mov b,r7
lcall _memcpy
; radio/packet.c:233: memcpy(last_sent, &last_sent[max_xmit], slen - max_xmit);
mov a,_packet_get_next_max_xmit_1_163
add a,#_last_sent
mov r6,a
clr a
addc a,#(_last_sent >> 8)
mov r7,a
mov dptr,#_memcpy_PARM_2
mov a,r6
movx @dptr,a
mov a,r7
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov r6,_packet_get_next_max_xmit_1_163
mov r7,#0x00
mov dptr,#_memcpy_PARM_3
mov a,_packet_get_next_slen_1_164
clr c
subb a,r6
movx @dptr,a
mov a,(_packet_get_next_slen_1_164 + 1)
subb a,r7
inc dptr
movx @dptr,a
mov dptr,#_last_sent
mov b,#0x00
lcall _memcpy
; radio/packet.c:234: last_sent_len = slen - max_xmit;
mov a,_packet_get_next_slen_1_164
clr c
subb a,_packet_get_next_max_xmit_1_163
mov r0,#_last_sent_len
movx @r0,a
; radio/packet.c:235: last_sent_is_injected = true;
setb _last_sent_is_injected
; radio/packet.c:236: return max_xmit;
mov dpl,_packet_get_next_max_xmit_1_163
ret
00110$:
; radio/packet.c:239: memcpy(buf, last_sent, last_sent_len);
mov r0,#_packet_get_next_PARM_2
movx a,@r0
mov r5,a
inc r0
movx a,@r0
mov r6,a
mov r7,#0x00
mov dptr,#_memcpy_PARM_2
mov a,#_last_sent
movx @dptr,a
mov a,#(_last_sent >> 8)
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dptr,#_memcpy_PARM_3
mov a,r3
movx @dptr,a
mov a,r4
inc dptr
movx @dptr,a
mov dpl,r5
mov dph,r6
mov b,r7
lcall _memcpy
; radio/packet.c:240: injected_packet = false;
clr _injected_packet
; radio/packet.c:241: last_sent_is_injected = true;
setb _last_sent_is_injected
; radio/packet.c:242: return last_sent_len;
mov r0,#_last_sent_len
movx a,@r0
mov dpl,a
ret
00112$:
; radio/packet.c:245: last_sent_is_injected = false;
clr _last_sent_is_injected
; radio/packet.c:249: if (slen > max_xmit) {
mov r6,_packet_get_next_max_xmit_1_163
mov r7,#0x00
clr c
mov a,r6
subb a,_packet_get_next_slen_1_164
mov a,r7
subb a,(_packet_get_next_slen_1_164 + 1)
jnc 00114$
; radio/packet.c:250: slen = max_xmit;
mov _packet_get_next_slen_1_164,r6
mov (_packet_get_next_slen_1_164 + 1),r7
00114$:
; radio/packet.c:253: last_sent_len = 0;
mov r0,#_last_sent_len
clr a
movx @r0,a
; radio/packet.c:255: if (slen == 0) {
mov a,_packet_get_next_slen_1_164
orl a,(_packet_get_next_slen_1_164 + 1)
; radio/packet.c:257: return 0;
jnz 00116$
mov dpl,a
ret
00116$:
; radio/packet.c:260: if (!feature_mavlink_framing) {
mov dptr,#_feature_mavlink_framing
movx a,@dptr
jnz 00122$
; radio/packet.c:262: if (slen > 0 && serial_read_buf(buf, slen)) {
mov a,_packet_get_next_slen_1_164
orl a,(_packet_get_next_slen_1_164 + 1)
jz 00118$
mov r5,_packet_get_next_slen_1_164
mov r0,#_serial_read_buf_PARM_2
mov a,r5
movx @r0,a
mov r0,#_packet_get_next_PARM_2
movx a,@r0
mov dpl,a
inc r0
movx a,@r0
mov dph,a
push ar5
lcall _serial_read_buf
pop ar5
jnc 00118$
; radio/packet.c:263: memcpy(last_sent, buf, slen);
mov r0,#_packet_get_next_PARM_2
mov dptr,#_memcpy_PARM_2
movx a,@r0
movx @dptr,a
inc r0
movx a,@r0
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dptr,#_memcpy_PARM_3
mov a,_packet_get_next_slen_1_164
movx @dptr,a
mov a,(_packet_get_next_slen_1_164 + 1)
inc dptr
movx @dptr,a
mov dptr,#_last_sent
mov b,#0x00
push ar5
lcall _memcpy
pop ar5
; radio/packet.c:264: last_sent_len = slen;
mov r0,#_last_sent_len
mov a,r5
movx @r0,a
sjmp 00119$
00118$:
; radio/packet.c:266: last_sent_len = 0;
mov r0,#_last_sent_len
clr a
movx @r0,a
00119$:
; radio/packet.c:268: return last_sent_len;
mov r0,#_last_sent_len
movx a,@r0
mov dpl,a
ret
00122$:
; radio/packet.c:273: if (mav_pkt_len == 1) {
mov r0,#_mav_pkt_len
movx a,@r0
cjne a,#0x01,00247$
sjmp 00248$
00247$:
ljmp 00128$
00248$:
; radio/packet.c:275: if (slen == 1) {
mov a,#0x01
cjne a,_packet_get_next_slen_1_164,00249$
clr a
cjne a,(_packet_get_next_slen_1_164 + 1),00249$
sjmp 00250$
00249$:
sjmp 00126$
00250$:
; radio/packet.c:276: if ((uint16_t)(timer2_tick() - mav_pkt_start_time) > mav_pkt_max_time) {
lcall _timer2_tick
mov r6,dpl
mov r7,dph
mov r0,#_mav_pkt_start_time
setb c
movx a,@r0
subb a,r6
cpl a
cpl c
mov r6,a
cpl c
inc r0
movx a,@r0
subb a,r7
cpl a
mov r7,a
mov r0,#_mav_pkt_max_time
clr c
movx a,@r0
subb a,r6
inc r0
movx a,@r0
subb a,r7
jnc 00124$
; radio/packet.c:278: last_sent[last_sent_len++] = serial_read();
mov r0,#_last_sent_len
movx a,@r0
mov r7,a
mov r0,#_last_sent_len
inc a
movx @r0,a
mov a,r7
add a,#_last_sent
mov r7,a
clr a
addc a,#(_last_sent >> 8)
mov r6,a
push ar7
push ar6
lcall _serial_read
mov r5,dpl
pop ar6
pop ar7
mov dpl,r7
mov dph,r6
mov a,r5
movx @dptr,a
; radio/packet.c:279: memcpy(buf, last_sent, last_sent_len);
mov r0,#_packet_get_next_PARM_2
movx a,@r0
mov r5,a
inc r0
movx a,@r0
mov r6,a
mov r7,#0x00
mov dptr,#_memcpy_PARM_2
mov a,#_last_sent
movx @dptr,a
mov a,#(_last_sent >> 8)
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov r0,#_last_sent_len
mov dptr,#_memcpy_PARM_3
movx a,@r0
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dpl,r5
mov dph,r6
mov b,r7
lcall _memcpy
; radio/packet.c:280: mav_pkt_len = 0;
mov r0,#_mav_pkt_len
clr a
movx @r0,a
; radio/packet.c:281: return last_sent_len;
mov r0,#_last_sent_len
movx a,@r0
mov dpl,a
ret
00124$:
; radio/packet.c:284: return 0;
mov dpl,#0x00
ret
00126$:
; radio/packet.c:288: mav_pkt_len = 0;
mov r0,#_mav_pkt_len
clr a
movx @r0,a
00128$:
; radio/packet.c:292: if (mav_pkt_len != 0) {
mov r0,#_mav_pkt_len
movx a,@r0
jnz 00252$
ljmp 00179$
00252$:
; radio/packet.c:293: if (slen < mav_pkt_len) {
mov r0,#_mav_pkt_len
movx a,@r0
mov r6,a
mov r7,#0x00
clr c
mov a,_packet_get_next_slen_1_164
subb a,r6
mov a,(_packet_get_next_slen_1_164 + 1)
subb a,r7
jnc 00132$
; radio/packet.c:294: if ((uint16_t)(timer2_tick() - mav_pkt_start_time) > mav_pkt_max_time) {
lcall _timer2_tick
mov r6,dpl
mov r7,dph
mov r0,#_mav_pkt_start_time
setb c
movx a,@r0
subb a,r6
cpl a
cpl c
mov r6,a
cpl c
inc r0
movx a,@r0
subb a,r7
cpl a
mov r7,a
mov r0,#_mav_pkt_max_time
clr c
movx a,@r0
subb a,r6
inc r0
movx a,@r0
subb a,r7
jnc 00130$
; radio/packet.c:297: serial_read_buf(last_sent, slen);
mov r5,_packet_get_next_slen_1_164
mov r0,#_serial_read_buf_PARM_2
mov a,r5
movx @r0,a
mov dptr,#_last_sent
push ar5
lcall _serial_read_buf
pop ar5
; radio/packet.c:298: last_sent_len = slen;
mov r0,#_last_sent_len
mov a,r5
movx @r0,a
; radio/packet.c:299: memcpy(buf, last_sent, last_sent_len);
mov r0,#_packet_get_next_PARM_2
movx a,@r0
mov r4,a
inc r0
movx a,@r0
mov r6,a
mov r7,#0x00
mov dptr,#_memcpy_PARM_2
mov a,#_last_sent
movx @dptr,a
mov a,#(_last_sent >> 8)
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dptr,#_memcpy_PARM_3
mov a,r5
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dpl,r4
mov dph,r6
mov b,r7
lcall _memcpy
; radio/packet.c:300: mav_pkt_len = 0;
mov r0,#_mav_pkt_len
clr a
movx @r0,a
; radio/packet.c:301: return last_sent_len;
mov r0,#_last_sent_len
movx a,@r0
mov dpl,a
ret
00130$:
; radio/packet.c:305: return 0;
mov dpl,#0x00
ret
00132$:
; radio/packet.c:309: return mavlink_frame(max_xmit, buf);
mov r0,#_packet_get_next_PARM_2
mov r1,#_mavlink_frame_PARM_2
movx a,@r0
movx @r1,a
inc r0
movx a,@r0
inc r1
movx @r1,a
mov dpl,_packet_get_next_max_xmit_1_163
ljmp _mavlink_frame
; radio/packet.c:312: while (slen > 0) {
00179$:
00151$:
mov a,_packet_get_next_slen_1_164
orl a,(_packet_get_next_slen_1_164 + 1)
jnz 00255$
ljmp 00153$
00255$:
; radio/packet.c:313: register uint8_t c = serial_peek();
lcall _serial_peek
mov r7,dpl
; radio/packet.c:314: if (c == MAVLINK10_STX) {
cjne r7,#0xFE,00256$
sjmp 00257$
00256$:
ljmp 00149$
00257$:
; radio/packet.c:315: if (slen == 1) {
mov a,#0x01
cjne a,_packet_get_next_slen_1_164,00258$
clr a
cjne a,(_packet_get_next_slen_1_164 + 1),00258$
sjmp 00259$
00258$:
sjmp 00138$
00259$:
; radio/packet.c:317: if (last_sent_len == 0) {
mov r0,#_last_sent_len
movx a,@r0
jz 00260$
ljmp 00153$
00260$:
; radio/packet.c:320: mav_pkt_len = 1;
mov r0,#_mav_pkt_len
mov a,#0x01
movx @r0,a
; radio/packet.c:321: mav_pkt_start_time = timer2_tick();
lcall _timer2_tick
mov a,dpl
mov b,dph
mov r0,#_mav_pkt_start_time
movx @r0,a
inc r0
mov a,b
movx @r0,a
; radio/packet.c:322: mav_pkt_max_time = serial_rate;
mov r0,#_serial_rate
movx a,@r0
mov r6,a
inc r0
movx a,@r0
mov r7,a
mov r0,#_mav_pkt_max_time
mov a,r6
movx @r0,a
inc r0
mov a,r7
movx @r0,a
; radio/packet.c:323: return 0;
mov dpl,#0x00
ret
; radio/packet.c:325: break;
00138$:
; radio/packet.c:327: mav_pkt_len = serial_peek2();
lcall _serial_peek2
mov r7,dpl
mov r0,#_mav_pkt_len
mov a,r7
movx @r0,a
; radio/packet.c:328: if (mav_pkt_len >= 255-8 ||
cjne r7,#0xF7,00261$
00261$:
jnc 00139$
; radio/packet.c:329: mav_pkt_len+8 > mav_max_xmit) {
mov ar5,r7
mov r6,#0x00
mov a,#0x08
add a,r5
mov r5,a
clr a
addc a,r6
mov r6,a
mov r0,#_mav_max_xmit
movx a,@r0
mov r3,a
mov r4,#0x00
clr c
mov a,r3
subb a,r5
mov a,r4
xrl a,#0x80
mov b,r6
xrl b,#0x80
subb a,b
jnc 00140$
00139$:
; radio/packet.c:331: mav_pkt_len = 0;
mov r0,#_mav_pkt_len
clr a
movx @r0,a
; radio/packet.c:332: last_sent[last_sent_len++] = serial_read();
mov r0,#_last_sent_len
movx a,@r0
mov r6,a
mov r0,#_last_sent_len
inc a
movx @r0,a
mov a,r6
add a,#_last_sent
mov r6,a
clr a
addc a,#(_last_sent >> 8)
mov r5,a
push ar6
push ar5
lcall _serial_read
mov r4,dpl
pop ar5
pop ar6
mov dpl,r6
mov dph,r5
mov a,r4
movx @dptr,a
; radio/packet.c:333: slen--;
dec _packet_get_next_slen_1_164
mov a,#0xFF
cjne a,_packet_get_next_slen_1_164,00264$
dec (_packet_get_next_slen_1_164 + 1)
00264$:
; radio/packet.c:334: continue;
ljmp 00151$
00140$:
; radio/packet.c:339: mav_pkt_len += 8;
mov a,#0x08
add a,r7
mov r7,a
mov r0,#_mav_pkt_len
movx @r0,a
; radio/packet.c:341: if (last_sent_len != 0) {
mov r0,#_last_sent_len
movx a,@r0
jz 00146$
; radio/packet.c:345: memcpy(buf, last_sent, last_sent_len);
mov r0,#_packet_get_next_PARM_2
movx a,@r0
mov r4,a
inc r0
movx a,@r0
mov r5,a
mov r6,#0x00
mov dptr,#_memcpy_PARM_2
mov a,#_last_sent
movx @dptr,a
mov a,#(_last_sent >> 8)
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov r0,#_last_sent_len
mov dptr,#_memcpy_PARM_3
movx a,@r0
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dpl,r4
mov dph,r5
mov b,r6
lcall _memcpy
; radio/packet.c:346: mav_pkt_start_time = timer2_tick();
lcall _timer2_tick
mov a,dpl
mov b,dph
mov r0,#_mav_pkt_start_time
movx @r0,a
inc r0
mov a,b
movx @r0,a
; radio/packet.c:347: mav_pkt_max_time = mav_pkt_len * serial_rate;
mov r0,#_mav_pkt_len
movx a,@r0
mov r5,a
mov r6,#0x00
mov r0,#_serial_rate
mov dptr,#__mulint_PARM_2
movx a,@r0
movx @dptr,a
inc r0
movx a,@r0
inc dptr
movx @dptr,a
mov dpl,r5
mov dph,r6
lcall __mulint
mov a,dpl
mov b,dph
mov r0,#_mav_pkt_max_time
movx @r0,a
inc r0
mov a,b
movx @r0,a
; radio/packet.c:348: return last_sent_len;
mov r0,#_last_sent_len
movx a,@r0
mov dpl,a
ret
00146$:
; radio/packet.c:349: } else if (mav_pkt_len > slen) {
mov r6,#0x00
clr c
mov a,_packet_get_next_slen_1_164
subb a,r7
mov a,(_packet_get_next_slen_1_164 + 1)
subb a,r6
jnc 00143$
; radio/packet.c:352: mav_pkt_start_time = timer2_tick();
lcall _timer2_tick
mov a,dpl
mov b,dph
mov r0,#_mav_pkt_start_time
movx @r0,a
inc r0
mov a,b
movx @r0,a
; radio/packet.c:353: mav_pkt_max_time = mav_pkt_len * serial_rate;
mov r0,#_mav_pkt_len
movx a,@r0
mov r6,a
mov r7,#0x00
mov r0,#_serial_rate
mov dptr,#__mulint_PARM_2
movx a,@r0
movx @dptr,a
inc r0
movx a,@r0
inc dptr
movx @dptr,a
mov dpl,r6
mov dph,r7
lcall __mulint
mov a,dpl
mov b,dph
mov r0,#_mav_pkt_max_time
movx @r0,a
inc r0
mov a,b
movx @r0,a
; radio/packet.c:354: return 0;
mov dpl,#0x00
ret
00143$:
; radio/packet.c:358: return mavlink_frame(max_xmit, buf);
mov r0,#_packet_get_next_PARM_2
mov r1,#_mavlink_frame_PARM_2
movx a,@r0
movx @r1,a
inc r0
movx a,@r0
inc r1
movx @r1,a
mov dpl,_packet_get_next_max_xmit_1_163
ljmp _mavlink_frame
00149$:
; radio/packet.c:361: last_sent[last_sent_len++] = serial_read();
mov r0,#_last_sent_len
movx a,@r0
mov r7,a
mov r0,#_last_sent_len
inc a
movx @r0,a
mov a,r7
add a,#_last_sent
mov r7,a
clr a
addc a,#(_last_sent >> 8)
mov r6,a
push ar7
push ar6
lcall _serial_read
mov r5,dpl
pop ar6
pop ar7
mov dpl,r7
mov dph,r6
mov a,r5
movx @dptr,a
; radio/packet.c:362: slen--;
dec _packet_get_next_slen_1_164
mov a,#0xFF
cjne a,_packet_get_next_slen_1_164,00267$
dec (_packet_get_next_slen_1_164 + 1)
00267$:
ljmp 00151$
00153$:
; radio/packet.c:366: memcpy(buf, last_sent, last_sent_len);
mov r0,#_packet_get_next_PARM_2
movx a,@r0
mov r5,a
inc r0
movx a,@r0
mov r6,a
mov r7,#0x00
mov dptr,#_memcpy_PARM_2
mov a,#_last_sent
movx @dptr,a
mov a,#(_last_sent >> 8)
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov r0,#_last_sent_len
mov dptr,#_memcpy_PARM_3
movx a,@r0
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dpl,r5
mov dph,r6
mov b,r7
lcall _memcpy
; radio/packet.c:367: return last_sent_len;
mov r0,#_last_sent_len
movx a,@r0
mov dpl,a
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'packet_is_resend'
;------------------------------------------------------------
; radio/packet.c:373: packet_is_resend(void)
; -----------------------------------------
; function packet_is_resend
; -----------------------------------------
_packet_is_resend:
; radio/packet.c:375: return last_sent_is_resend;
mov c,_last_sent_is_resend
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'packet_is_injected'
;------------------------------------------------------------
; radio/packet.c:381: packet_is_injected(void)
; -----------------------------------------
; function packet_is_injected
; -----------------------------------------
_packet_is_injected:
; radio/packet.c:383: return last_sent_is_injected;
mov c,_last_sent_is_injected
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'packet_force_resend'
;------------------------------------------------------------
; radio/packet.c:388: packet_force_resend(void)
; -----------------------------------------
; function packet_force_resend
; -----------------------------------------
_packet_force_resend:
; radio/packet.c:390: force_resend = true;
setb _force_resend
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'packet_set_max_xmit'
;------------------------------------------------------------
;max Allocated with name '_packet_set_max_xmit_max_1_195'
;------------------------------------------------------------
; radio/packet.c:395: packet_set_max_xmit(uint8_t max)
; -----------------------------------------
; function packet_set_max_xmit
; -----------------------------------------
_packet_set_max_xmit:
mov a,dpl
mov dptr,#_packet_set_max_xmit_max_1_195
movx @dptr,a
; radio/packet.c:397: mav_max_xmit = max;
movx a,@dptr
mov r0,#_mav_max_xmit
movx @r0,a
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'packet_set_serial_speed'
;------------------------------------------------------------
;speed Allocated with name '_packet_set_serial_speed_speed_1_197'
;------------------------------------------------------------
; radio/packet.c:402: packet_set_serial_speed(uint16_t speed)
; -----------------------------------------
; function packet_set_serial_speed
; -----------------------------------------
_packet_set_serial_speed:
mov r7,dph
mov a,dpl
mov dptr,#_packet_set_serial_speed_speed_1_197
movx @dptr,a
mov a,r7
inc dptr
movx @dptr,a
; radio/packet.c:405: serial_rate = (65536UL / speed) + 1;
mov dptr,#_packet_set_serial_speed_speed_1_197
movx a,@dptr
mov r6,a
inc dptr
movx a,@dptr
mov r7,a
mov dptr,#__divulong_PARM_2
mov a,r6
movx @dptr,a
mov a,r7
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
inc dptr
movx @dptr,a
mov dptr,#0x0000
mov b,#0x01
clr a
lcall __divulong
mov r4,dpl
mov r5,dph
mov r6,b
mov r7,a
inc r4
cjne r4,#0x00,00103$
inc r5
cjne r5,#0x00,00103$
inc r6
cjne r6,#0x00,00103$
inc r7
00103$:
mov r0,#_serial_rate
mov a,r4
movx @r0,a
inc r0
mov a,r5
movx @r0,a
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'packet_is_duplicate'
;------------------------------------------------------------
;len Allocated with name '_packet_is_duplicate_len_1_199'
;------------------------------------------------------------
; radio/packet.c:410: packet_is_duplicate(uint8_t len, __xdata uint8_t * __pdata buf, bool is_resend)
; -----------------------------------------
; function packet_is_duplicate
; -----------------------------------------
_packet_is_duplicate:
mov a,dpl
mov dptr,#_packet_is_duplicate_len_1_199
movx @dptr,a
; radio/packet.c:412: if (!is_resend) {
jb _packet_is_duplicate_PARM_3,00102$
; radio/packet.c:413: memcpy(last_received, buf, len);
mov r0,#_packet_is_duplicate_PARM_2
movx a,@r0
mov r5,a
inc r0
movx a,@r0
mov r6,a
mov r7,#0x00
mov dptr,#_packet_is_duplicate_len_1_199
movx a,@dptr
mov r4,a
mov r2,a
mov r3,#0x00
mov dptr,#_memcpy_PARM_2
mov a,r5
movx @dptr,a
mov a,r6
inc dptr
movx @dptr,a
mov a,r7
inc dptr
movx @dptr,a
mov dptr,#_memcpy_PARM_3
mov a,r2
movx @dptr,a
mov a,r3
inc dptr
movx @dptr,a
mov dptr,#_last_received
mov b,#0x00
push ar4
lcall _memcpy
pop ar4
; radio/packet.c:414: last_recv_len = len;
mov r0,#_last_recv_len
mov a,r4
movx @r0,a
; radio/packet.c:415: last_recv_is_resend = false;
clr _last_recv_is_resend
; radio/packet.c:416: return false;
clr c
ret
00102$:
; radio/packet.c:420: memcmp(last_received, buf, len) == 0) {
jb _last_recv_is_resend,00104$
; radio/packet.c:419: len == last_recv_len &&
mov dptr,#_packet_is_duplicate_len_1_199
movx a,@dptr
mov r7,a
mov r0,#_last_recv_len
movx a,@r0
cjne a,ar7,00104$
; radio/packet.c:420: memcmp(last_received, buf, len) == 0) {
mov r0,#_packet_is_duplicate_PARM_2
mov dptr,#_memcmp_PARM_2
movx a,@r0
movx @dptr,a
inc r0
movx a,@r0
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dptr,#_memcmp_PARM_3
mov a,r7
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dptr,#_last_received
mov b,#0x00
lcall _memcmp
mov a,dpl
mov b,dph
orl a,b
jnz 00104$
; radio/packet.c:421: last_recv_is_resend = false;
clr _last_recv_is_resend
; radio/packet.c:422: return true;
setb c
ret
00104$:
; radio/packet.c:430: last_recv_is_resend = true;
setb _last_recv_is_resend
; radio/packet.c:431: return false;
clr c
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'packet_ati5_inject'
;------------------------------------------------------------
; radio/packet.c:436: packet_ati5_inject(__pdata uint8_t ati5_id)
; -----------------------------------------
; function packet_ati5_inject
; -----------------------------------------
_packet_ati5_inject:
mov r7,dpl
; radio/packet.c:438: if (ati5_id < PARAM_MAX) {
cjne r7,#0x13,00113$
00113$:
jnc 00105$
; radio/packet.c:439: printf_start_capture(last_sent, sizeof(last_sent));
mov dptr,#_printf_start_capture_PARM_2
mov a,#0xFC
movx @dptr,a
mov dptr,#_last_sent
push ar7
lcall _printf_start_capture
pop ar7
; radio/packet.c:440: param_print(ati5_id);
mov dpl,r7
lcall _param_print
; radio/packet.c:441: last_sent_len = printf_end_capture();
lcall _printf_end_capture
mov r7,dpl
mov r0,#_last_sent_len
mov a,r7
movx @r0,a
; radio/packet.c:443: if(last_sent_len>0)
mov a,r7
jz 00105$
; radio/packet.c:445: last_sent_is_resend = false;
clr _last_sent_is_resend
; radio/packet.c:446: injected_packet = true;
setb _injected_packet
00105$:
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'packet_at_inject'
;------------------------------------------------------------
; radio/packet.c:458: packet_at_inject(void)
; -----------------------------------------
; function packet_at_inject
; -----------------------------------------
_packet_at_inject:
; radio/packet.c:460: at_cmd_ready = true;
setb _at_cmd_ready
; radio/packet.c:461: printf_start_capture(last_sent, sizeof(last_sent));
mov dptr,#_printf_start_capture_PARM_2
mov a,#0xFC
movx @dptr,a
mov dptr,#_last_sent
lcall _printf_start_capture
; radio/packet.c:462: at_command();
lcall _at_command
; radio/packet.c:463: last_sent_len = printf_end_capture();
lcall _printf_end_capture
mov r7,dpl
mov r0,#_last_sent_len
mov a,r7
movx @r0,a
; radio/packet.c:465: if (last_sent_len > 0)
mov a,r7
jz 00103$
; radio/packet.c:467: last_sent_is_resend = false;
clr _last_sent_is_resend
; radio/packet.c:468: injected_packet = true;
setb _injected_packet
00103$:
ret
;------------------------------------------------------------
;Allocation info for local variables in function 'packet_inject'
;------------------------------------------------------------
; radio/packet.c:474: packet_inject(__xdata uint8_t * __pdata buf, __pdata uint8_t len)
; -----------------------------------------
; function packet_inject
; -----------------------------------------
_packet_inject:
mov r6,dpl
mov r7,dph
; radio/packet.c:476: if (len > sizeof(last_sent)) {
mov r0,#_packet_inject_PARM_2
clr c
movx a,@r0
mov b,a
mov a,#0xFC
subb a,b
jnc 00102$
; radio/packet.c:477: len = sizeof(last_sent);
mov r0,#_packet_inject_PARM_2
mov a,#0xFC
movx @r0,a
00102$:
; radio/packet.c:479: memcpy(last_sent, buf, len);
mov dptr,#_memcpy_PARM_2
mov a,r6
movx @dptr,a
mov a,r7
inc dptr
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov r0,#_packet_inject_PARM_2
mov dptr,#_memcpy_PARM_3
movx a,@r0
movx @dptr,a
clr a
inc dptr
movx @dptr,a
mov dptr,#_last_sent
mov b,#0x00
lcall _memcpy
; radio/packet.c:480: last_sent_len = len;
mov r0,#_packet_inject_PARM_2
movx a,@r0
mov r0,#_last_sent_len
movx @r0,a
; radio/packet.c:481: last_sent_is_resend = false;
clr _last_sent_is_resend
; radio/packet.c:482: injected_packet = true;
setb _injected_packet
ret
.area CSEG (CODE)
.area CONST (CODE)
.area XINIT (CODE)
.area CABS (ABS,CODE)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.