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
asm/script/profiles/profile_11/script.asm
h3rmit-git/F-Zero-Climax-GBA-Translation
6
165446
; F-Zero Climax Translation by Normmatt .align 4 Profile11_CharacterProfile: .sjis "ダークミリオンの科",TextNL,"学力により化石から",TextNL,"よみがえった恐竜。",TextNL,"再生時にDNA操作",TextNL,"により、人間並みの",TextNL,"知能を得た。",TextNL,"元が肉食恐竜なので",TextNL,"こうげき的な性格で",TextNL,"あるが、その反面、",TextNL,"気弱でドジな部分も",TextNL,"あり、にくめない。",TextNL,"オクトマンと組まさ",TextNL,"れることが多い。",TextNL,"" .align 4 Profile11_VehicleProfile: .sjis "マシンナンバー15",TextNL,TextNL,"ダークミリオンから",TextNL,"あたえられたこのマ",TextNL,"シンは優勝すること",TextNL,"よりも他のマシンの",TextNL,"走行をぼう害するこ",TextNL,"とを前提につくられ",TextNL,"ている。",TextNL,"ブーストパワーをお",TextNL,"さえた分、耐久力や",TextNL,"グリップ力が上げら",TextNL,"れている。まさに",TextNL,"おじゃまマシンと",TextNL,"言った所か・・・。",TextNL,"" ; make sure to leave an empty line at the end
Univalence/Obsolete/A4.agda
JacquesCarette/pi-dual
14
16889
<filename>Univalence/Obsolete/A4.agda module A4 where -- open import Data.Nat open import Data.Empty open import Data.Unit open import Data.Sum open import Data.Product open import Groupoid ------------------------------------------------------------------------------ -- Level 0: -- types are collections of points -- equivalences are between points module Pi0 where infixr 10 _◎_ infixr 30 _⟷_ -- types data U : Set where ZERO : U ONE : U PLUS : U → U → U TIMES : U → U → U -- values ⟦_⟧ : U → Set ⟦ ZERO ⟧ = ⊥ ⟦ ONE ⟧ = ⊤ ⟦ PLUS t₁ t₂ ⟧ = ⟦ t₁ ⟧ ⊎ ⟦ t₂ ⟧ ⟦ TIMES t₁ t₂ ⟧ = ⟦ t₁ ⟧ × ⟦ t₂ ⟧ -- Examples BOOL : U BOOL = PLUS ONE ONE BOOL² : U BOOL² = TIMES BOOL BOOL TRUE : ⟦ BOOL ⟧ TRUE = inj₁ tt FALSE : ⟦ BOOL ⟧ FALSE = inj₂ tt -- combinators data _⟷_ : U → U → Set where unite₊ : {t : U} → PLUS ZERO t ⟷ t uniti₊ : {t : U} → t ⟷ PLUS ZERO t swap₊ : {t₁ t₂ : U} → PLUS t₁ t₂ ⟷ PLUS t₂ t₁ assocl₊ : {t₁ t₂ t₃ : U} → PLUS t₁ (PLUS t₂ t₃) ⟷ PLUS (PLUS t₁ t₂) t₃ assocr₊ : {t₁ t₂ t₃ : U} → PLUS (PLUS t₁ t₂) t₃ ⟷ PLUS t₁ (PLUS t₂ t₃) unite⋆ : {t : U} → TIMES ONE t ⟷ t uniti⋆ : {t : U} → t ⟷ TIMES ONE t swap⋆ : {t₁ t₂ : U} → TIMES t₁ t₂ ⟷ TIMES t₂ t₁ assocl⋆ : {t₁ t₂ t₃ : U} → TIMES t₁ (TIMES t₂ t₃) ⟷ TIMES (TIMES t₁ t₂) t₃ assocr⋆ : {t₁ t₂ t₃ : U} → TIMES (TIMES t₁ t₂) t₃ ⟷ TIMES t₁ (TIMES t₂ t₃) distz : {t : U} → TIMES ZERO t ⟷ ZERO factorz : {t : U} → ZERO ⟷ TIMES ZERO t dist : {t₁ t₂ t₃ : U} → TIMES (PLUS t₁ t₂) t₃ ⟷ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) factor : {t₁ t₂ t₃ : U} → PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) ⟷ TIMES (PLUS t₁ t₂) t₃ id⟷ : {t : U} → t ⟷ t sym⟷ : {t₁ t₂ : U} → (t₁ ⟷ t₂) → (t₂ ⟷ t₁) _◎_ : {t₁ t₂ t₃ : U} → (t₁ ⟷ t₂) → (t₂ ⟷ t₃) → (t₁ ⟷ t₃) _⊕_ : {t₁ t₂ t₃ t₄ : U} → (t₁ ⟷ t₃) → (t₂ ⟷ t₄) → (PLUS t₁ t₂ ⟷ PLUS t₃ t₄) _⊗_ : {t₁ t₂ t₃ t₄ : U} → (t₁ ⟷ t₃) → (t₂ ⟷ t₄) → (TIMES t₁ t₂ ⟷ TIMES t₃ t₄) -- Examples COND : {t₁ t₂ : U} → (t₁ ⟷ t₂) → (t₁ ⟷ t₂) → ((TIMES BOOL t₁) ⟷ (TIMES BOOL t₂)) COND f g = dist ◎ ((id⟷ ⊗ f) ⊕ (id⟷ ⊗ g)) ◎ factor CONTROLLED : {t : U} → (t ⟷ t) → ((TIMES BOOL t) ⟷ (TIMES BOOL t)) CONTROLLED f = COND f id⟷ CNOT : BOOL² ⟷ BOOL² CNOT = CONTROLLED swap₊ ------------------------------------------------------------------------------ -- Level 1 -- types are collections of paths (where paths are equivalences between points) -- equivalences are between paths module Pi1 where -- types data U : Set where {- LIFT : Pi0.U → U PLUS : U → U → U TIMES : U → U → U -} EQUIV : {t₁ t₂ : Pi0.U} → (t₁ Pi0.⟷ t₂) → Pi0.⟦ t₁ ⟧ → Pi0.⟦ t₂ ⟧ → U -- extractor, dependently typed. srcU : U → Σ Pi0.U Pi0.⟦_⟧ srcU (EQUIV {t₁} {t₂} c x y) = t₁ , x -- values data Path⊤ : Set where pathtt : Path⊤ data Path⊎ (A B : Set) : Set where pathLeft : A → Path⊎ A B pathRight : B → Path⊎ A B data Path× (A B : Set) : Set where pathPair : A → B → Path× A B data Unite₊ {t : Pi0.U} : Pi0.⟦ Pi0.PLUS Pi0.ZERO t ⟧ → Pi0.⟦ t ⟧ → Set where pathUnite₊ : (v : Pi0.⟦ t ⟧) → Unite₊ (inj₂ v) v data Uniti₊ {t : Pi0.U} : Pi0.⟦ t ⟧ → Pi0.⟦ Pi0.PLUS Pi0.ZERO t ⟧ → Set where pathUniti₊ : (v : Pi0.⟦ t ⟧) → Uniti₊ v (inj₂ v) data Swap₊ {t₁ t₂ : Pi0.U} : Pi0.⟦ Pi0.PLUS t₁ t₂ ⟧ → Pi0.⟦ Pi0.PLUS t₂ t₁ ⟧ → Set where path1Swap₊ : (v₁ : Pi0.⟦ t₁ ⟧) → Swap₊ (inj₁ v₁) (inj₂ v₁) path2Swap₊ : (v₂ : Pi0.⟦ t₂ ⟧) → Swap₊ (inj₂ v₂) (inj₁ v₂) data Assocl₊ {t₁ t₂ t₃ : Pi0.U} : Pi0.⟦ Pi0.PLUS t₁ (Pi0.PLUS t₂ t₃) ⟧ → Pi0.⟦ Pi0.PLUS (Pi0.PLUS t₁ t₂) t₃ ⟧ → Set where path1Assocl₊ : (v₁ : Pi0.⟦ t₁ ⟧) → Assocl₊ (inj₁ v₁) (inj₁ (inj₁ v₁)) path2Assocl₊ : (v₂ : Pi0.⟦ t₂ ⟧) → Assocl₊ (inj₂ (inj₁ v₂)) (inj₁ (inj₂ v₂)) path3Assocl₊ : (v₃ : Pi0.⟦ t₃ ⟧) → Assocl₊ (inj₂ (inj₂ v₃)) (inj₂ v₃) data Assocr₊ {t₁ t₂ t₃ : Pi0.U} : Pi0.⟦ Pi0.PLUS (Pi0.PLUS t₁ t₂) t₃ ⟧ → Pi0.⟦ Pi0.PLUS t₁ (Pi0.PLUS t₂ t₃) ⟧ → Set where path1Assocr₊ : (v₁ : Pi0.⟦ t₁ ⟧) → Assocr₊ (inj₁ (inj₁ v₁)) (inj₁ v₁) path2Assocr₊ : (v₂ : Pi0.⟦ t₂ ⟧) → Assocr₊ (inj₁ (inj₂ v₂)) (inj₂ (inj₁ v₂)) path3Assocr₊ : (v₃ : Pi0.⟦ t₃ ⟧) → Assocr₊ (inj₂ v₃) (inj₂ (inj₂ v₃)) data Unite⋆ {t : Pi0.U} : Pi0.⟦ Pi0.TIMES Pi0.ONE t ⟧ → Pi0.⟦ t ⟧ → Set where pathUnite⋆ : (v : Pi0.⟦ t ⟧) → Unite⋆ (tt , v) v data Uniti⋆ {t : Pi0.U} : Pi0.⟦ t ⟧ → Pi0.⟦ Pi0.TIMES Pi0.ONE t ⟧ → Set where pathUniti⋆ : (v : Pi0.⟦ t ⟧) → Uniti⋆ v (tt , v) data Swap⋆ {t₁ t₂ : Pi0.U} : Pi0.⟦ Pi0.TIMES t₁ t₂ ⟧ → Pi0.⟦ Pi0.TIMES t₂ t₁ ⟧ → Set where pathSwap⋆ : (v₁ : Pi0.⟦ t₁ ⟧) → (v₂ : Pi0.⟦ t₂ ⟧) → Swap⋆ (v₁ , v₂) (v₂ , v₁) data Assocl⋆ {t₁ t₂ t₃ : Pi0.U} : Pi0.⟦ Pi0.TIMES t₁ (Pi0.TIMES t₂ t₃) ⟧ → Pi0.⟦ Pi0.TIMES (Pi0.TIMES t₁ t₂) t₃ ⟧ → Set where pathAssocl⋆ : (v₁ : Pi0.⟦ t₁ ⟧) → (v₂ : Pi0.⟦ t₂ ⟧) → (v₃ : Pi0.⟦ t₃ ⟧) → Assocl⋆ (v₁ , (v₂ , v₃)) ((v₁ , v₂) , v₃) data Assocr⋆ {t₁ t₂ t₃ : Pi0.U} : Pi0.⟦ Pi0.TIMES (Pi0.TIMES t₁ t₂) t₃ ⟧ → Pi0.⟦ Pi0.TIMES t₁ (Pi0.TIMES t₂ t₃) ⟧ → Set where pathAssocr⋆ : (v₁ : Pi0.⟦ t₁ ⟧) → (v₂ : Pi0.⟦ t₂ ⟧) → (v₃ : Pi0.⟦ t₃ ⟧) → Assocr⋆ ((v₁ , v₂) , v₃) (v₁ , (v₂ , v₃)) data Dist {t₁ t₂ t₃ : Pi0.U} : Pi0.⟦ Pi0.TIMES (Pi0.PLUS t₁ t₂) t₃ ⟧ → Pi0.⟦ Pi0.PLUS (Pi0.TIMES t₁ t₃) (Pi0.TIMES t₂ t₃) ⟧ → Set where path1Dist : (v₁ : Pi0.⟦ t₁ ⟧) → (v₃ : Pi0.⟦ t₃ ⟧) → Dist (inj₁ v₁ , v₃) (inj₁ (v₁ , v₃)) path2Dist : (v₂ : Pi0.⟦ t₂ ⟧) → (v₃ : Pi0.⟦ t₃ ⟧) → Dist (inj₂ v₂ , v₃) (inj₂ (v₂ , v₃)) data Factor {t₁ t₂ t₃ : Pi0.U} : Pi0.⟦ Pi0.PLUS (Pi0.TIMES t₁ t₃) (Pi0.TIMES t₂ t₃) ⟧ → Pi0.⟦ Pi0.TIMES (Pi0.PLUS t₁ t₂) t₃ ⟧ → Set where path1Factor : (v₁ : Pi0.⟦ t₁ ⟧) → (v₃ : Pi0.⟦ t₃ ⟧) → Factor (inj₁ (v₁ , v₃)) (inj₁ v₁ , v₃) path2Factor : (v₂ : Pi0.⟦ t₂ ⟧) → (v₃ : Pi0.⟦ t₃ ⟧) → Factor (inj₂ (v₂ , v₃)) (inj₂ v₂ , v₃) data Id⟷ {t : Pi0.U} : Pi0.⟦ t ⟧ → Pi0.⟦ t ⟧ → Set where pathId⟷ : (v : Pi0.⟦ t ⟧) → Id⟷ v v data PathRev (A : Set) : Set where pathRev : A → PathRev A record PathTrans (A : Set) (B C : A → Set) : Set where constructor pathTrans field anchor : A pre : B anchor post : C anchor mutual ⟦_⟧ : U → Set {- ⟦ LIFT u ⟧ = Pi0.⟦ u ⟧ ⟦ ZERO ⟧ = ⊥ ⟦ ONE ⟧ = Path⊤ ⟦ PLUS t₁ t₂ ⟧ = Path⊎ ⟦ t₁ ⟧ ⟦ t₂ ⟧ ⟦ TIMES t₁ t₂ ⟧ = Path× ⟦ t₁ ⟧ ⟦ t₂ ⟧ -} ⟦ EQUIV c v₁ v₂ ⟧ = Paths c v₁ v₂ -- space of paths from v₁ to v₂ using c Paths : {t₁ t₂ : Pi0.U} → (t₁ Pi0.⟷ t₂) → Pi0.⟦ t₁ ⟧ → Pi0.⟦ t₂ ⟧ → Set Paths Pi0.unite₊ (inj₁ ()) _ Paths Pi0.unite₊ (inj₂ v) v' = Unite₊ (inj₂ v) v' Paths Pi0.uniti₊ v (inj₁ ()) Paths Pi0.uniti₊ v (inj₂ v') = Uniti₊ v (inj₂ v') Paths Pi0.swap₊ v v' = Swap₊ v v' Paths Pi0.assocl₊ v v' = Assocl₊ v v' Paths Pi0.assocr₊ v v' = Assocr₊ v v' Paths Pi0.unite⋆ v v' = Unite⋆ v v' Paths Pi0.uniti⋆ v v' = Uniti⋆ v v' Paths Pi0.swap⋆ v v' = Swap⋆ v v' Paths Pi0.assocl⋆ v v' = Assocl⋆ v v' Paths Pi0.assocr⋆ v v' = Assocr⋆ v v' Paths Pi0.distz v () Paths Pi0.factorz () v' Paths Pi0.dist v v' = Dist v v' Paths Pi0.factor v v' = Factor v v' Paths Pi0.id⟷ v v' = Id⟷ v v' Paths (Pi0.sym⟷ c) v v' = PathRev (Paths c v' v) Paths (Pi0._◎_ {t₂ = t₂} c₁ c₂) v₁ v₃ = PathTrans Pi0.⟦ t₂ ⟧ (λ v₂ → Paths c₁ v₁ v₂) (λ v₂ → Paths c₂ v₂ v₃) -- Σ[ v₂ ∈ Pi0.⟦ t₂ ⟧ ] (Paths c₁ v₁ v₂ × Paths c₂ v₂ v₃) Paths (c₁ Pi0.⊕ c₂) (inj₁ v₁) (inj₁ v₁') = Path⊎ (Paths c₁ v₁ v₁') ⊥ Paths (c₁ Pi0.⊕ c₂) (inj₁ v₁) (inj₂ v₂') = ⊥ Paths (c₁ Pi0.⊕ c₂) (inj₂ v₂) (inj₁ v₁') = ⊥ Paths (c₁ Pi0.⊕ c₂) (inj₂ v₂) (inj₂ v₂') = Path⊎ ⊥ (Paths c₂ v₂ v₂') Paths (c₁ Pi0.⊗ c₂) (v₁ , v₂) (v₁' , v₂') = Path× (Paths c₁ v₁ v₁') (Paths c₂ v₂ v₂') -- Examples -- A few paths between FALSE and FALSE p₁ : ⟦ EQUIV Pi0.id⟷ Pi0.FALSE Pi0.FALSE ⟧ p₁ = pathId⟷ Pi0.FALSE p₂ : ⟦ EQUIV (Pi0.id⟷ Pi0.◎ Pi0.id⟷) Pi0.FALSE Pi0.FALSE ⟧ p₂ = pathTrans Pi0.FALSE p₁ p₁ p₃ : ⟦ EQUIV (Pi0.swap₊ Pi0.◎ Pi0.swap₊) Pi0.FALSE Pi0.FALSE ⟧ p₃ = pathTrans Pi0.TRUE (path2Swap₊ tt) (path1Swap₊ tt) p₄ : ⟦ EQUIV (Pi0.id⟷ Pi0.⊕ Pi0.id⟷) Pi0.FALSE Pi0.FALSE ⟧ p₄ = pathRight (pathId⟷ tt) -- A few paths between (TRUE,TRUE) and (TRUE,TRUE) p₅ : ⟦ EQUIV Pi0.id⟷ (Pi0.TRUE , Pi0.TRUE) (Pi0.TRUE , Pi0.TRUE) ⟧ p₅ = pathId⟷ (Pi0.TRUE , Pi0.TRUE) p₆ : ⟦ EQUIV (Pi0.id⟷ Pi0.⊗ Pi0.id⟷) (Pi0.TRUE , Pi0.TRUE) (Pi0.TRUE , Pi0.TRUE) ⟧ p₆ = pathPair (pathId⟷ Pi0.TRUE) (pathId⟷ Pi0.TRUE) -- A few paths between (TRUE,FALSE) and (TRUE,TRUE) p₇ : ⟦ EQUIV (Pi0.id⟷ Pi0.⊗ Pi0.swap₊) (Pi0.TRUE , Pi0.FALSE) (Pi0.TRUE , Pi0.TRUE) ⟧ p₇ = pathPair (pathId⟷ Pi0.TRUE) (path2Swap₊ tt) p₇' : ⟦ EQUIV (Pi0.swap₊ Pi0.⊗ Pi0.id⟷) (Pi0.FALSE , Pi0.TRUE) (Pi0.TRUE , Pi0.TRUE) ⟧ p₇' = pathPair (path2Swap₊ tt) (pathId⟷ Pi0.TRUE) p₈ : ⟦ EQUIV Pi0.CNOT (Pi0.TRUE , Pi0.FALSE) (Pi0.TRUE , Pi0.TRUE) ⟧ p₈ = pathTrans (inj₁ (tt , Pi0.FALSE)) (path1Dist tt Pi0.FALSE) (pathTrans (inj₁ (tt , Pi0.TRUE)) (pathLeft (pathPair (pathId⟷ tt) (path2Swap₊ tt))) (path1Factor tt Pi0.TRUE)) -- Examples using sum and products of paths {- q₀ : ⟦ TIMES (LIFT Pi0.ONE) (EQUIV Pi0.id⟷ Pi0.FALSE Pi0.FALSE) ⟧ q₀ = pathPair pathtt p₁ q₁ : ⟦ (LIFT Pi0.PLUS) (EQUIV Pi0.id⟷ Pi0.FALSE Pi0.FALSE) (EQUIV (Pi0.id⟷ Pi0.⊗ Pi0.swap₊) (Pi0.TRUE , Pi0.FALSE) (Pi0.TRUE , Pi0.TRUE)) ⟧ q₁ = pathRight p₇ q₂ : ⟦ (LIFT Pi0.PLUS) (EQUIV Pi0.id⟷ Pi0.FALSE Pi0.FALSE) (LIFT Pi0.ZERO) ⟧ q₂ = pathLeft p₁ -} -- combinators -- the usual semiring combinators to reason about 0, 1, +, and *, and -- the groupoid combinators to reason about id, rev, and trans data _⟷_ : U → U → Set where {- unite₊ : {t : U} → PLUS ZERO t ⟷ t uniti₊ : {t : U} → t ⟷ PLUS ZERO t swap₊ : {t₁ t₂ : U} → PLUS t₁ t₂ ⟷ PLUS t₂ t₁ assocl₊ : {t₁ t₂ t₃ : U} → PLUS t₁ (PLUS t₂ t₃) ⟷ PLUS (PLUS t₁ t₂) t₃ assocr₊ : {t₁ t₂ t₃ : U} → PLUS (PLUS t₁ t₂) t₃ ⟷ PLUS t₁ (PLUS t₂ t₃) unite⋆ : {t : U} → TIMES ONE t ⟷ t uniti⋆ : {t : U} → t ⟷ TIMES ONE t swap⋆ : {t₁ t₂ : U} → TIMES t₁ t₂ ⟷ TIMES t₂ t₁ assocl⋆ : {t₁ t₂ t₃ : U} → TIMES t₁ (TIMES t₂ t₃) ⟷ TIMES (TIMES t₁ t₂) t₃ assocr⋆ : {t₁ t₂ t₃ : U} → TIMES (TIMES t₁ t₂) t₃ ⟷ TIMES t₁ (TIMES t₂ t₃) distz : {t : U} → TIMES ZERO t ⟷ ZERO factorz : {t : U} → ZERO ⟷ TIMES ZERO t dist : {t₁ t₂ t₃ : U} → TIMES (PLUS t₁ t₂) t₃ ⟷ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) factor : {t₁ t₂ t₃ : U} → PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) ⟷ TIMES (PLUS t₁ t₂) t₃ -} id⟷ : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} {v₀ : Pi0.⟦ t₁ ⟧} {v₁ : Pi0.⟦ t₂ ⟧} → EQUIV c v₀ v₁ ⟷ EQUIV c v₀ v₁ sym⟷ : {t₁ t₂ : Pi0.U} {c d : t₁ Pi0.⟷ t₂} {v₀ : Pi0.⟦ t₁ ⟧} {v₁ : Pi0.⟦ t₂ ⟧} → EQUIV c v₀ v₁ ⟷ EQUIV d v₀ v₁ → EQUIV d v₀ v₁ ⟷ EQUIV c v₀ v₁ _◎_ : {t₁ t₂ : Pi0.U} {c d e : t₁ Pi0.⟷ t₂} {v₀ : Pi0.⟦ t₁ ⟧} {v₁ : Pi0.⟦ t₂ ⟧} → EQUIV c v₀ v₁ ⟷ EQUIV d v₀ v₁ → EQUIV d v₀ v₁ ⟷ EQUIV e v₀ v₁ → EQUIV c v₀ v₁ ⟷ EQUIV e v₀ v₁ {- _⊕_ : {t₁ t₂ t₃ t₄ : U} → (t₁ ⟷ t₃) → (t₂ ⟷ t₄) → (PLUS t₁ t₂ ⟷ PLUS t₃ t₄) _⊗_ : {t₁ t₂ t₃ t₄ : U} → (t₁ ⟷ t₃) → (t₂ ⟷ t₄) → (TIMES t₁ t₂ ⟷ TIMES t₃ t₄) -} lidl : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} {v₁ : Pi0.⟦ t₁ ⟧} {v₂ : Pi0.⟦ t₂ ⟧} → EQUIV (Pi0.id⟷ Pi0.◎ c) v₁ v₂ ⟷ EQUIV c v₁ v₂ lidr : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} {v₁ : Pi0.⟦ t₁ ⟧} {v₂ : Pi0.⟦ t₂ ⟧} → EQUIV c v₁ v₂ ⟷ EQUIV (Pi0.id⟷ Pi0.◎ c) v₁ v₂ ridl : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} {v₁ : Pi0.⟦ t₁ ⟧} {v₂ : Pi0.⟦ t₂ ⟧} → EQUIV (c Pi0.◎ Pi0.id⟷) v₁ v₂ ⟷ EQUIV c v₁ v₂ ridr : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} {v₁ : Pi0.⟦ t₁ ⟧} {v₂ : Pi0.⟦ t₂ ⟧} → EQUIV c v₁ v₂ ⟷ EQUIV (c Pi0.◎ Pi0.id⟷) v₁ v₂ invll : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} {v₀ v₂ : Pi0.⟦ t₂ ⟧} → EQUIV (Pi0.sym⟷ c Pi0.◎ c) v₀ v₂ ⟷ EQUIV Pi0.id⟷ v₀ v₂ invlr : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} {v₀ v₂ : Pi0.⟦ t₂ ⟧} → EQUIV Pi0.id⟷ v₀ v₂ ⟷ EQUIV (Pi0.sym⟷ c Pi0.◎ c) v₀ v₂ invrl : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} {v₀ v₁ : Pi0.⟦ t₁ ⟧} → EQUIV (c Pi0.◎ Pi0.sym⟷ c) v₀ v₁ ⟷ EQUIV Pi0.id⟷ v₀ v₁ invrr : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} {v₀ v₁ : Pi0.⟦ t₁ ⟧} → EQUIV Pi0.id⟷ v₀ v₁ ⟷ EQUIV (c Pi0.◎ Pi0.sym⟷ c) v₀ v₁ invinvl : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} {v₁ : Pi0.⟦ t₁ ⟧} {v₂ : Pi0.⟦ t₂ ⟧} → EQUIV (Pi0.sym⟷ (Pi0.sym⟷ c)) v₁ v₂ ⟷ EQUIV c v₁ v₂ invinvr : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} {v₁ : Pi0.⟦ t₁ ⟧} {v₂ : Pi0.⟦ t₂ ⟧} → EQUIV c v₁ v₂ ⟷ EQUIV (Pi0.sym⟷ (Pi0.sym⟷ c)) v₁ v₂ tassocl : {t₁ t₂ t₃ t₄ : Pi0.U} {c₁ : t₁ Pi0.⟷ t₂} {c₂ : t₂ Pi0.⟷ t₃} {c₃ : t₃ Pi0.⟷ t₄} {v₁ : Pi0.⟦ t₁ ⟧} {v₄ : Pi0.⟦ t₄ ⟧} → EQUIV (c₁ Pi0.◎ (c₂ Pi0.◎ c₃)) v₁ v₄ ⟷ EQUIV ((c₁ Pi0.◎ c₂) Pi0.◎ c₃) v₁ v₄ tassocr : {t₁ t₂ t₃ t₄ : Pi0.U} {c₁ : t₁ Pi0.⟷ t₂} {c₂ : t₂ Pi0.⟷ t₃} {c₃ : t₃ Pi0.⟷ t₄} {v₁ : Pi0.⟦ t₁ ⟧} {v₄ : Pi0.⟦ t₄ ⟧} → EQUIV ((c₁ Pi0.◎ c₂) Pi0.◎ c₃) v₁ v₄ ⟷ EQUIV (c₁ Pi0.◎ (c₂ Pi0.◎ c₃)) v₁ v₄ -- this is closely related to Eckmann-Hilton resp◎ : {t₁ t₂ t₃ : Pi0.U} {c₁ : t₁ Pi0.⟷ t₂} {c₂ : t₂ Pi0.⟷ t₃} {c₃ : t₁ Pi0.⟷ t₂} {c₄ : t₂ Pi0.⟷ t₃} {v₁ : Pi0.⟦ t₁ ⟧} {v₂ : Pi0.⟦ t₂ ⟧} {v₃ : Pi0.⟦ t₃ ⟧} → (EQUIV c₁ v₁ v₂ ⟷ EQUIV c₃ v₁ v₂) → (EQUIV c₂ v₂ v₃ ⟷ EQUIV c₄ v₂ v₃) → EQUIV (c₁ Pi0.◎ c₂) v₁ v₃ ⟷ EQUIV (c₃ Pi0.◎ c₄) v₁ v₃ -- extractor for ⟷ src : {t₁ t₂ : U} → t₁ ⟷ t₂ → Pi0.U src (id⟷ {t₁}) = t₁ src (sym⟷ {t₁} c) = t₁ src (_◎_ {t₁} _ _) = t₁ src (lidl {t₁}) = t₁ src (lidr {t₁}) = t₁ src (ridl {t₁}) = t₁ src (ridr {t₁}) = t₁ src (invll {t₁}) = t₁ src (invlr {t₁}) = t₁ src (invrl {t₁}) = t₁ src (invrr {t₁}) = t₁ src (invinvl {t₁}) = t₁ src (invinvr {t₁}) = t₁ src (tassocl {t₁}) = t₁ src (tassocr {t₁}) = t₁ src (resp◎ {t₁} _ _) = t₁ val : {t₁ t₂ : U} → (c : t₁ ⟷ t₂) → Pi0.⟦ src c ⟧ val (id⟷ {v₀ = v₀}) = v₀ val (sym⟷ {v₀ = v₀} c) = v₀ val (c ◎ c₁) = {!!} val lidl = {!!} val lidr = {!!} val ridl = {!!} val ridr = {!!} val invll = {!!} val invlr = {!!} val invrl = {!!} val invrr = {!!} val invinvl = {!!} val invinvr = {!!} val tassocl = {!!} val tassocr = {!!} val (resp◎ c c₅) = {!!} -- Examples -- id;swap₊ is equivalent to swap₊ e₁ : EQUIV (Pi0.id⟷ Pi0.◎ Pi0.swap₊) Pi0.FALSE Pi0.TRUE ⟷ EQUIV Pi0.swap₊ Pi0.FALSE Pi0.TRUE e₁ = lidl -- swap₊;id;swap₊ is equivalent to id e₂ : EQUIV (Pi0.swap₊ Pi0.◎ (Pi0.id⟷ Pi0.◎ Pi0.swap₊)) Pi0.FALSE Pi0.FALSE ⟷ EQUIV Pi0.id⟷ Pi0.FALSE Pi0.FALSE e₂ = {!!} arr : {t₁ t₂ : Pi0.U} {c : t₁ Pi0.⟷ t₂} → Pi0.⟦ t₁ ⟧ → Pi0.⟦ t₂ ⟧ → Set arr {t₁} {t₂} {c} v₁ v₂ = ⟦ EQUIV c v₁ v₂ ⟧ -- we have a 1Groupoid structure G : 1Groupoid G = record { set = Pi0.U ; _↝_ = Pi0._⟷_ ; _≈_ = λ c₀ c₁ → ∀ {v₀ v₁} → EQUIV c₀ v₀ v₁ ⟷ EQUIV c₁ v₀ v₁ ; id = Pi0.id⟷ ; _∘_ = λ c₀ c₁ → c₁ Pi0.◎ c₀ ; _⁻¹ = Pi0.sym⟷ ; lneutr = λ α → ridl {c = α} ; rneutr = λ α → lidl { c = α} ; assoc = λ α β δ {v₁} {v₄} → tassocl ; equiv = record { refl = id⟷ ; sym = λ c → sym⟷ c ; trans = λ c₀ c₁ → c₀ ◎ c₁ } ; linv = λ α → invrl {c = α} ; rinv = λ α → invll {c = α} ; ∘-resp-≈ = λ {_} {_} {_} {f} {h} {g} {i} f⟷h g⟷i {v₀} {v₁} → resp◎ {v₂ = {!val f⟷h!}} g⟷i f⟷h } ------------------------------------------------------------------------------ -- Level 2 explicitly... {- module Pi2 where -- types data U : Set where ZERO : U ONE : U PLUS : U → U → U TIMES : U → U → U EQUIV : {t₁ t₂ : Pi1.U} → (t₁ Pi1.⟷ t₂) → Pi1.⟦ t₁ ⟧ → Pi1.⟦ t₂ ⟧ → U data Unite₊ {t : Pi1.U} : Pi1.⟦ Pi1.PLUS Pi1.ZERO t ⟧ → Pi1.⟦ t ⟧ → Set where pathUnite₊ : (v₁ : Pi1.⟦ Pi1.PLUS Pi1.ZERO t ⟧) → (v₂ : Pi1.⟦ t ⟧) → Unite₊ v₁ v₂ data Id⟷ {t : Pi1.U} : Pi1.⟦ t ⟧ → Pi1.⟦ t ⟧ → Set where pathId⟷ : (v₁ : Pi1.⟦ t ⟧) → (v₂ : Pi1.⟦ t ⟧) → Id⟷ v₁ v₂ -- values mutual ⟦_⟧ : U → Set ⟦ ZERO ⟧ = ⊥ ⟦ ONE ⟧ = ⊤ ⟦ PLUS t₁ t₂ ⟧ = ⟦ t₁ ⟧ ⊎ ⟦ t₂ ⟧ ⟦ TIMES t₁ t₂ ⟧ = ⟦ t₁ ⟧ × ⟦ t₂ ⟧ ⟦ EQUIV c v₁ v₂ ⟧ = f c v₁ v₂ f : {t₁ t₂ : Pi1.U} → (t₁ Pi1.⟷ t₂) → Pi1.⟦ t₁ ⟧ → Pi1.⟦ t₂ ⟧ → Set f (Pi1.id⟷ {t}) v v' = Id⟷ {t} v v' f (Pi1._◎_ {t₂ = t₂} c₁ c₂) v₁ v₃ = Σ[ v₂ ∈ Pi1.⟦ t₂ ⟧ ] (f c₁ v₁ v₂ × f c₂ v₂ v₃) -- f (Pi1.lidl {v₁ = v₁}) (pathTrans .v₁ (Pi1.pathId⟷ .v₁) q) q' = ⊥ -- todo f c v₁ v₂ = ⊥ -- to do -- combinators data _⟷_ : U → U → Set where unite₊ : {t : U} → PLUS ZERO t ⟷ t uniti₊ : {t : U} → t ⟷ PLUS ZERO t swap₊ : {t₁ t₂ : U} → PLUS t₁ t₂ ⟷ PLUS t₂ t₁ assocl₊ : {t₁ t₂ t₃ : U} → PLUS t₁ (PLUS t₂ t₃) ⟷ PLUS (PLUS t₁ t₂) t₃ assocr₊ : {t₁ t₂ t₃ : U} → PLUS (PLUS t₁ t₂) t₃ ⟷ PLUS t₁ (PLUS t₂ t₃) unite⋆ : {t : U} → TIMES ONE t ⟷ t uniti⋆ : {t : U} → t ⟷ TIMES ONE t swap⋆ : {t₁ t₂ : U} → TIMES t₁ t₂ ⟷ TIMES t₂ t₁ assocl⋆ : {t₁ t₂ t₃ : U} → TIMES t₁ (TIMES t₂ t₃) ⟷ TIMES (TIMES t₁ t₂) t₃ assocr⋆ : {t₁ t₂ t₃ : U} → TIMES (TIMES t₁ t₂) t₃ ⟷ TIMES t₁ (TIMES t₂ t₃) distz : {t : U} → TIMES ZERO t ⟷ ZERO factorz : {t : U} → ZERO ⟷ TIMES ZERO t dist : {t₁ t₂ t₃ : U} → TIMES (PLUS t₁ t₂) t₃ ⟷ PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) factor : {t₁ t₂ t₃ : U} → PLUS (TIMES t₁ t₃) (TIMES t₂ t₃) ⟷ TIMES (PLUS t₁ t₂) t₃ id⟷ : {t : U} → t ⟷ t sym⟷ : {t₁ t₂ : U} → (t₁ ⟷ t₂) → (t₂ ⟷ t₁) _◎_ : {t₁ t₂ t₃ : U} → (t₁ ⟷ t₂) → (t₂ ⟷ t₃) → (t₁ ⟷ t₃) _⊕_ : {t₁ t₂ t₃ t₄ : U} → (t₁ ⟷ t₃) → (t₂ ⟷ t₄) → (PLUS t₁ t₂ ⟷ PLUS t₃ t₄) _⊗_ : {t₁ t₂ t₃ t₄ : U} → (t₁ ⟷ t₃) → (t₂ ⟷ t₄) → (TIMES t₁ t₂ ⟷ TIMES t₃ t₄) lid : {t₁ t₂ : Pi1.U} {v₁ : Pi1.⟦ t₁ ⟧} {v₂ : Pi1.⟦ t₂ ⟧} {c : t₁ Pi1.⟷ t₂} → EQUIV (Pi1.id⟷ Pi1.◎ c) v₁ v₂ ⟷ EQUIV c v₁ v₂ -} ------------------------------------------------------------------------------
src/palettetest.asm
ceanrim/CarmiNES
2
13444
<filename>src/palettetest.asm ;; To test palette rendering ;; I wrote those files' roms directly in machine code, ;; I'm only providing the source code for completeness but don't expect ;; these to be in any standard format ;; =========================================================================== ;; Mapper: 0 ;; CHR ROM: 8K ;; PRG ROM: 16K .code $8000: lda #$00 sta $2000 lda #$3f sta $2006 lda #$00 sta $2006 lda #$05 sta $2007 lda #$08 sta $2007 $8019: jmp $8019 $bffc: .data $00, $80
alloy4fun_models/trashltl/models/1/kumbPuFMX3EX56MJp.als
Kaixi26/org.alloytools.alloy
0
309
open main pred idkumbPuFMX3EX56MJp_prop2 { no File since some File } pred __repair { idkumbPuFMX3EX56MJp_prop2 } check __repair { idkumbPuFMX3EX56MJp_prop2 <=> prop2o }
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i9-9900K_12_0xca_notsx.log_21829_1115.asm
ljhsiun2/medusa
9
174621
<reponame>ljhsiun2/medusa<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x1a70f, %rsi lea addresses_normal_ht+0x18c5d, %rdi nop nop nop nop cmp %r12, %r12 mov $25, %rcx rep movsb xor %rbx, %rbx lea addresses_WC_ht+0x4d0f, %rbx clflush (%rbx) nop nop nop nop nop add $18040, %rbp movb (%rbx), %r9b nop nop add $50791, %r9 lea addresses_WC_ht+0x138ff, %rsi nop and %rbp, %rbp mov (%rsi), %r12 xor %rbx, %rbx lea addresses_A_ht+0x12e7f, %rdi nop nop nop nop nop add %rsi, %rsi mov (%rdi), %r9w nop sub %rcx, %rcx lea addresses_UC_ht+0x9f0f, %rsi lea addresses_WC_ht+0x14217, %rdi clflush (%rsi) clflush (%rdi) xor $17569, %rbp mov $50, %rcx rep movsw and $35398, %rdi lea addresses_A_ht+0x1170f, %rsi lea addresses_normal_ht+0x19b0f, %rdi and $56029, %r9 mov $44, %rcx rep movsw nop inc %r9 lea addresses_UC_ht+0xc40f, %rbx nop add %r12, %r12 movb (%rbx), %r9b nop nop nop sub %rdi, %rdi lea addresses_WC_ht+0x8bc7, %r9 lfence mov (%r9), %edi nop nop nop add %r12, %r12 lea addresses_WC_ht+0xa70f, %rbp sub $29006, %rbx movb (%rbp), %r9b nop dec %rbp lea addresses_D_ht+0x18c43, %rsi lea addresses_A_ht+0x9f0f, %rdi nop nop nop sub $28242, %r11 mov $57, %rcx rep movsb nop nop nop nop add $36211, %r12 lea addresses_D_ht+0x860f, %rsi lea addresses_WC_ht+0xed1d, %rdi nop xor $3337, %r12 mov $17, %rcx rep movsb and %rcx, %rcx lea addresses_D_ht+0xe6df, %rcx nop nop nop nop nop xor $50155, %rbx movb $0x61, (%rcx) nop nop nop nop sub $54331, %rdi lea addresses_D_ht+0x3c8f, %rsi lea addresses_WC_ht+0x124f7, %rdi nop nop nop cmp $31037, %r12 mov $2, %rcx rep movsw cmp %r9, %r9 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r15 push %rax push %rbx push %rcx // Store mov $0xf08, %rax nop nop nop nop nop add $63307, %rcx mov $0x5152535455565758, %rbx movq %rbx, %xmm3 movups %xmm3, (%rax) dec %rcx // Store lea addresses_PSE+0xdf0f, %r15 nop nop xor $32780, %rcx mov $0x5152535455565758, %r13 movq %r13, %xmm3 vmovups %ymm3, (%r15) nop nop nop nop cmp %r12, %r12 // Load mov $0x41b24f000000018f, %rax nop nop nop nop and %r10, %r10 movups (%rax), %xmm1 vpextrq $1, %xmm1, %r13 nop nop nop nop add $740, %rax // Store lea addresses_normal+0x8f0f, %r12 nop nop nop nop nop inc %r15 movw $0x5152, (%r12) xor $739, %rcx // Store lea addresses_WT+0x1c70f, %rcx nop nop nop nop nop dec %r15 mov $0x5152535455565758, %r10 movq %r10, %xmm0 vmovups %ymm0, (%rcx) nop nop nop add $15058, %r10 // Faulty Load lea addresses_PSE+0xdf0f, %r15 nop nop nop xor %rbx, %rbx movaps (%r15), %xmm5 vpextrq $1, %xmm5, %r10 lea oracles, %rbx and $0xff, %r10 shlq $12, %r10 mov (%rbx,%r10,1), %r10 pop %rcx pop %rbx pop %rax pop %r15 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 11}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': True, 'congruent': 10, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 8}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 6}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}} {'46': 906, '00': 20917, '45': 5, '08': 1} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 46 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 46 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 46 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 46 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 */
theorems/cw/cohomology/WedgeOfCells.agda
mikeshulman/HoTT-Agda
0
6129
{-# OPTIONS --without-K --rewriting #-} open import HoTT open import cohomology.Theory open import homotopy.PushoutSplit open import homotopy.DisjointlyPointedSet open import cw.CW module cw.cohomology.WedgeOfCells {i} (OT : OrdinaryTheory i) {n} (⊙skel : ⊙Skeleton {i} (S n)) where open OrdinaryTheory OT open import cohomology.Sphere OT Xₙ/Xₙ₋₁ : Ptd i Xₙ/Xₙ₋₁ = ⊙Cofiber (⊙cw-incl-last ⊙skel) module _ (m : ℤ) where CXₙ/Xₙ₋₁ : Group i CXₙ/Xₙ₋₁ = C m Xₙ/Xₙ₋₁ CEl-Xₙ/Xₙ₋₁ : Type i CEl-Xₙ/Xₙ₋₁ = Group.El CXₙ/Xₙ₋₁ abstract CXₙ/Xₙ₋₁-is-abelian : is-abelian CXₙ/Xₙ₋₁ CXₙ/Xₙ₋₁-is-abelian = C-is-abelian m Xₙ/Xₙ₋₁ CXₙ/Xₙ₋₁-abgroup : AbGroup i CXₙ/Xₙ₋₁-abgroup = CXₙ/Xₙ₋₁ , CXₙ/Xₙ₋₁-is-abelian {- the equivalence is in the opposite direction because cohomology functors are contravariant. -} BigWedge-⊙equiv-Xₙ/Xₙ₋₁ : ⊙BigWedge {A = ⊙cells-last ⊙skel} (λ _ → ⊙Sphere (S n)) ⊙≃ Xₙ/Xₙ₋₁ BigWedge-⊙equiv-Xₙ/Xₙ₋₁ = ≃-to-⊙≃ (PS.split-equiv ∘e equiv to from to-from from-to) idp where open AttachedSkeleton (⊙Skeleton.skel ⊙skel) module PS = PushoutLSplit (uncurry attaching) (λ _ → tt) fst module SphereToCofiber (a : fst cells) = SuspRec {A = Sphere n} (cfbase' (fst :> (fst cells × Sphere n → fst cells))) (cfcod a) (λ s → cfglue (a , s)) module To = BigWedgeRec {A = fst cells} {X = λ _ → ⊙Sphere (S n)} cfbase SphereToCofiber.f (λ _ → idp) to = To.f module From = CofiberRec {f = fst :> (fst cells × Sphere n → fst cells)} (bwbase {A = fst cells} {X = λ _ → ⊙Sphere (S n)}) (λ a → bwin a south) (λ{(a , s) → bwglue a ∙ ap (bwin a) (merid s)}) from = From.f abstract from-to : ∀ b → from (to b) == b from-to = BigWedge-elim idp (λ a → Susp-elim (bwglue a) idp (λ s → ↓-='-from-square $ ( ap-∘ from (SphereToCofiber.f a) (merid s) ∙ ap (ap from) (SphereToCofiber.merid-β a s) ∙ From.glue-β (a , s)) ∙v⊡ (tl-square (bwglue a) ⊡h vid-square))) (λ a → ↓-∘=idf-from-square from to $ ap (ap from) (To.glue-β a) ∙v⊡ br-square (bwglue a)) to-from : ∀ c → to (from c) == c to-from = Cofiber-elim idp (λ a → idp) (λ{(a , s) → ↓-∘=idf-in' to from $ ap (ap to) (From.glue-β (a , s)) ∙ ap-∙ to (bwglue a) (ap (bwin a) (merid s)) ∙ ap2 _∙_ (To.glue-β a) ( ∘-ap to (bwin a) (merid s) ∙ SphereToCofiber.merid-β a s)}) CXₙ/Xₙ₋₁-β : ∀ m → ⊙has-cells-with-choice 0 ⊙skel i → C m Xₙ/Xₙ₋₁ ≃ᴳ Πᴳ (⊙cells-last ⊙skel) (λ _ → C m (⊙Lift (⊙Sphere (S n)))) CXₙ/Xₙ₋₁-β m ac = C-additive-iso m (λ _ → ⊙Lift (⊙Sphere (S n))) (⊙cells-last-has-choice ⊙skel ac) ∘eᴳ C-emap m ( BigWedge-⊙equiv-Xₙ/Xₙ₋₁ ⊙∘e ⊙BigWedge-emap-r (λ _ → ⊙lower-equiv)) CXₙ/Xₙ₋₁-β-diag : ⊙has-cells-with-choice 0 ⊙skel i → CXₙ/Xₙ₋₁ (ℕ-to-ℤ (S n)) ≃ᴳ Πᴳ (⊙cells-last ⊙skel) (λ _ → C2 0) CXₙ/Xₙ₋₁-β-diag ac = Πᴳ-emap-r (⊙cells-last ⊙skel) (λ _ → C-Sphere-diag (S n)) ∘eᴳ CXₙ/Xₙ₋₁-β (ℕ-to-ℤ (S n)) ac abstract CXₙ/Xₙ₋₁-≠-is-trivial : ∀ {m} (m≠Sn : m ≠ ℕ-to-ℤ (S n)) → ⊙has-cells-with-choice 0 ⊙skel i → is-trivialᴳ (CXₙ/Xₙ₋₁ m) CXₙ/Xₙ₋₁-≠-is-trivial {m} m≠Sn ac = iso-preserves'-trivial (CXₙ/Xₙ₋₁-β m ac) $ Πᴳ-is-trivial (⊙cells-last ⊙skel) (λ _ → C m (⊙Lift (⊙Sphere (S n)))) (λ _ → C-Sphere-≠-is-trivial m (S n) m≠Sn) CXₙ/Xₙ₋₁-<-is-trivial : ∀ {m} (m<Sn : m < S n) → ⊙has-cells-with-choice 0 ⊙skel i → is-trivialᴳ (CXₙ/Xₙ₋₁ (ℕ-to-ℤ m)) CXₙ/Xₙ₋₁-<-is-trivial m<Sn = CXₙ/Xₙ₋₁-≠-is-trivial (ℕ-to-ℤ-≠ (<-to-≠ m<Sn)) CXₙ/Xₙ₋₁->-is-trivial : ∀ {m} (m>Sn : S n < m) → ⊙has-cells-with-choice 0 ⊙skel i → is-trivialᴳ (CXₙ/Xₙ₋₁ (ℕ-to-ℤ m)) CXₙ/Xₙ₋₁->-is-trivial m>Sn = CXₙ/Xₙ₋₁-≠-is-trivial (≠-inv (ℕ-to-ℤ-≠ (<-to-≠ m>Sn)))
applet/aide/source/editors/aide-editor-of_package.ads
charlie5/aIDE
3
23098
with adam.a_Package, gtk.Widget; private with aIDE.Editor.of_context, gtk.Text_View, gtk.Alignment, gtk.gEntry, gtk.Label, gtk.Box; with Gtk.Scrolled_Window; with Gtk.Notebook; with Gtk.Table; package aIDE.Editor.of_package is type Item is new Editor.item with private; type View is access all Item'Class; package Forge is function to_package_Editor (the_Package : in adam.a_Package.view) return View; end Forge; overriding function top_Widget (Self : in Item) return gtk.Widget.Gtk_Widget; function my_Package (Self : in Item) return adam.a_Package.view; procedure Package_is (Self : in out Item; Now : in adam.a_Package.view); overriding procedure freshen (Self : in out Item); private use gtk.Text_View, Gtk.scrolled_Window, gtk.Box, gtk.gEntry, gtk.Notebook, gtk.Table, gtk.Label, gtk.Alignment; type Item is new Editor.item with record my_Package : adam.a_Package.view; -- public_Part : Boolean; Notebook : gtk_Notebook; public_context_Editor : aIDE.Editor.of_context.view; public_context_Alignment : gtk_Alignment; private_context_Editor : aIDE.Editor.of_context.view; private_context_Alignment : gtk_Alignment; name_Entry : gtk_Entry; package_Label : gtk_Label; declarations_Label : gtk_Label; simple_attributes_Table : gtk_Table; top_Window : gtk_scrolled_Window; top_Box : gtk_Box; public_entities_Box : gtk_Box; private_entities_Box : gtk_Box; declare_Text, begin_Text, exception_Text : Gtk_Text_View; end record; end aIDE.Editor.of_package;
ffight/lcs/container/60.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
95768
<filename>ffight/lcs/container/60.asm copyright zengfr site:http://github.com/zengfr/romhack 0039F6 movem.l D0-D3, -(A6) 0039FA movem.l D0-D3, -(A6) 006228 move.b ($c,A3), ($60,A4) 00622E bpl $6238 [boss+60, container+60, enemy+60] 006238 rts [container+60, enemy+60] 009ACA dbra D5, $9ac8 copyright zengfr site:http://github.com/zengfr/romhack
oeis/213/A213846.asm
neoneye/loda-programs
11
20094
; A213846: Antidiagonal sums of the convolution array A213844. ; Submitted by <NAME> ; 3,23,90,250,565,1113,1988,3300,5175,7755,11198,15678,21385,28525,37320,48008,60843,76095,94050,115010,139293,167233,199180,235500,276575,322803,374598,432390,496625,567765,646288,732688,827475,931175,1044330,1167498,1301253,1446185,1602900,1772020,1954183,2150043,2360270,2585550,2826585,3084093,3358808,3651480,3962875,4293775,4644978,5017298,5411565,5828625,6269340,6734588,7225263,7742275,8286550,8859030,9460673,10092453,10755360,11450400,12178595,12940983,13738618,14572570,15443925,16353785 add $0,3 mov $1,$0 bin $0,3 mul $1,2 sub $1,2 bin $1,4 add $1,$0 add $1,$0 mov $0,$1
maps/PewterMuseum2F.asm
Ebernacher90/pokecrystal-allworld
0
2436
const_def 2 ; object constants const PEWTERMUSEUM2F_TEAMAQUA const PEWTERMUSEUM2F_TEAMMAGMA PewterMuseum2F_MapScripts: db 0 ; scene scripts db 0 ; callbacks TeamAqua: jumptextfaceplayer TeamAquaText TeamAquaText: text "<NAME>" line "auch dieses Museum" cont "übernehmen hahaha!" done TeamMagma: jumptextfaceplayer TeamMagmaText TeamMagmaText: text "Team Magma wird" line "die Weltmacht" cont "erreichen, wir" para "werden auch unsere" line "Feinde Team Aqua" cont "aus dem weg" para "räumen. Darauf" line "kannst du dich" cont "verlassen, Pisser." para "Hahahahahahahaha!" done PewterMuseum2F_MapEvents: db 0, 0 ; filler db 1 ; warp events warp_event 7, 7, PEWTER_MUSEUM_1F, 1 db 0 ; coord events db 0 ; bg events db 2 ; object events object_event 5, 4, SPRITE_AQUA, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, TeamAqua, -1 object_event 5, 7, SPRITE_MAGMA, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 0, TeamMagma, -1
agda/PiF.agda
JacquesCarette/pi-dual
14
8754
<gh_stars>10-100 {-# OPTIONS --no-termination-check --universe-polymorphism #-} module PiF where open import Level open import Data.Empty open import Data.Unit open import Data.Bool open import Data.Sum hiding (map) open import Data.Product hiding (map) open import Relation.Binary.PropositionalEquality hiding (sym; [_]) open import Singleton infixr 30 _⟷_ infixr 30 _⟺_ infixr 20 _◎_ ------------------------------------------------------------------------------ -- A universe of our value types mutual data BF : Set zero where ZEROF : BF ONEF : BF PLUSF : BF → BF → BF TIMESF : BF → BF → BF RECIP : BF → BF --data VF : Set where -- unitF : -- data hasType : -- normalize : (b : BF) → (hasType v b) → normalform v b -- fractional types are un-interpreted data Reciprocal (A : Set) : Set where rec : (b : A) → ((x : Singleton b) → ⊤) → Reciprocal A data Recip (A : Set) : Set where recip : (a : A) → Recip A ⟦_⟧F : BF → Set zero ⟦ ZEROF ⟧F = ⊥ ⟦ ONEF ⟧F = ⊤ ⟦ PLUSF b1 b2 ⟧F = ⟦ b1 ⟧F ⊎ ⟦ b2 ⟧F ⟦ TIMESF b1 b2 ⟧F = ⟦ b1 ⟧F × ⟦ b2 ⟧F ⟦ RECIP b ⟧F = -- Σ ⟦ b ⟧F (λ v → ((x : Singleton v) → ⊤)) Reciprocal ⟦ b ⟧F ------------------------------------------------------------------------------ -- Primitive isomorphisms data _⟷_ : BF → BF → Set where -- (+,0) commutative monoid unite₊ : { b : BF } → PLUSF ZEROF b ⟷ b uniti₊ : { b : BF } → b ⟷ PLUSF ZEROF b swap₊ : { b₁ b₂ : BF } → PLUSF b₁ b₂ ⟷ PLUSF b₂ b₁ assocl₊ : { b₁ b₂ b₃ : BF } → PLUSF b₁ (PLUSF b₂ b₃) ⟷ PLUSF (PLUSF b₁ b₂) b₃ assocr₊ : { b₁ b₂ b₃ : BF } → PLUSF (PLUSF b₁ b₂) b₃ ⟷ PLUSF b₁ (PLUSF b₂ b₃) -- (*,1) commutative monoid unite⋆ : { b : BF } → TIMESF ONEF b ⟷ b uniti⋆ : { b : BF } → b ⟷ TIMESF ONEF b swap⋆ : { b₁ b₂ : BF } → TIMESF b₁ b₂ ⟷ TIMESF b₂ b₁ assocl⋆ : { b₁ b₂ b₃ : BF } → TIMESF b₁ (TIMESF b₂ b₃) ⟷ TIMESF (TIMESF b₁ b₂) b₃ assocr⋆ : { b₁ b₂ b₃ : BF } → TIMESF (TIMESF b₁ b₂) b₃ ⟷ TIMESF b₁ (TIMESF b₂ b₃) -- * distributes over + dist : { b₁ b₂ b₃ : BF } → TIMESF (PLUSF b₁ b₂) b₃ ⟷ PLUSF (TIMESF b₁ b₃) (TIMESF b₂ b₃) factor : { b₁ b₂ b₃ : BF } → PLUSF (TIMESF b₁ b₃) (TIMESF b₂ b₃) ⟷ TIMESF (PLUSF b₁ b₂) b₃ -- id id⟷ : { b : BF } → b ⟷ b adjointP : { b₁ b₂ : BF } → (b₁ ⟷ b₂) → (b₂ ⟷ b₁) adjointP unite₊ = uniti₊ adjointP uniti₊ = unite₊ adjointP swap₊ = swap₊ adjointP assocl₊ = assocr₊ adjointP assocr₊ = assocl₊ adjointP unite⋆ = uniti⋆ adjointP uniti⋆ = unite⋆ adjointP swap⋆ = swap⋆ adjointP assocl⋆ = assocr⋆ adjointP assocr⋆ = assocl⋆ adjointP dist = factor adjointP factor = dist adjointP id⟷ = id⟷ evalP : { b₁ b₂ : BF } → (b₁ ⟷ b₂) → ⟦ b₁ ⟧F → ⟦ b₂ ⟧F evalP unite₊ (inj₁ ()) evalP unite₊ (inj₂ v) = v evalP uniti₊ v = inj₂ v evalP swap₊ (inj₁ v) = inj₂ v evalP swap₊ (inj₂ v) = inj₁ v evalP assocl₊ (inj₁ v) = inj₁ (inj₁ v) evalP assocl₊ (inj₂ (inj₁ v)) = inj₁ (inj₂ v) evalP assocl₊ (inj₂ (inj₂ v)) = inj₂ v evalP assocr₊ (inj₁ (inj₁ v)) = inj₁ v evalP assocr₊ (inj₁ (inj₂ v)) = inj₂ (inj₁ v) evalP assocr₊ (inj₂ v) = inj₂ (inj₂ v) evalP unite⋆ (tt , v) = v evalP uniti⋆ v = (tt , v) evalP swap⋆ (v₁ , v₂) = (v₂ , v₁) evalP assocl⋆ (v₁ , (v₂ , v₃)) = ((v₁ , v₂) , v₃) evalP assocr⋆ ((v₁ , v₂) , v₃) = (v₁ , (v₂ , v₃)) evalP dist (inj₁ v₁ , v₃) = inj₁ (v₁ , v₃) evalP dist (inj₂ v₂ , v₃) = inj₂ (v₂ , v₃) evalP factor (inj₁ (v₁ , v₃)) = (inj₁ v₁ , v₃) evalP factor (inj₂ (v₂ , v₃)) = (inj₂ v₂ , v₃) evalP id⟷ v = v -- normalize values in BF to x * 1/y and then decide equality of normalized values -- _≡B_ {b₁ = ONEF} {b₂ = ONEF} tt tt = true --_≡B_ {b₁ = TIMESF d c} {b₂ = TIMESF c d} (v₁ , v₃) (v₄ , v₂) = -- _≡B_ {b₁ = d} {b₂ = d} v₁ v₂ ∧ _≡B_ {b₁ = c} {b₂ = c} v₃ v₄ -- zero?? -- Backwards evaluator bevalP : { b₁ b₂ : BF } → (b₁ ⟷ b₂) → ⟦ b₂ ⟧F → ⟦ b₁ ⟧F bevalP c v = evalP (adjointP c) v ------------------------------------------------------------------------------ -- Closure combinators data _⟺_ : BF → BF → Set where iso : { b₁ b₂ : BF } → (b₁ ⟷ b₂) → (b₁ ⟺ b₂) sym : { b₁ b₂ : BF } → (b₁ ⟺ b₂) → (b₂ ⟺ b₁) _◎_ : { b₁ b₂ b₃ : BF } → (b₁ ⟺ b₂) → (b₂ ⟺ b₃) → (b₁ ⟺ b₃) _⊕_ : { b₁ b₂ b₃ b₄ : BF } → (b₁ ⟺ b₃) → (b₂ ⟺ b₄) → (PLUSF b₁ b₂ ⟺ PLUSF b₃ b₄) _⊗_ : { b₁ b₂ b₃ b₄ : BF } → (b₁ ⟺ b₃) → (b₂ ⟺ b₄) → (TIMESF b₁ b₂ ⟺ TIMESF b₃ b₄) refe⋆ : { b : BF } → RECIP (RECIP b) ⟺ b refi⋆ : { b : BF } → b ⟺ RECIP (RECIP b) rile⋆ : { b : BF } → TIMESF b (TIMESF b (RECIP b)) ⟺ b rili⋆ : { b : BF } → b ⟺ TIMESF b (TIMESF b (RECIP b)) -- adjoint : { b₁ b₂ : BF } → (b₁ ⟺ b₂) → (b₂ ⟺ b₁) adjoint (iso c) = iso (adjointP c) adjoint (sym c) = c adjoint (c₁ ◎ c₂) = adjoint c₂ ◎ adjoint c₁ adjoint (c₁ ⊕ c₂) = adjoint c₁ ⊕ adjoint c₂ adjoint (c₁ ⊗ c₂) = adjoint c₁ ⊗ adjoint c₂ adjoint refe⋆ = refi⋆ adjoint refi⋆ = refe⋆ adjoint rile⋆ = rili⋆ adjoint rili⋆ = rile⋆ -- -- (Context a b c d) represents a combinator (c <-> d) with a hole -- requiring something of type (a <-> b). When we use these contexts, -- it is always the case that the (c <-> a) part of the computation -- has ALREADY been done and that we are about to evaluate (a <-> b) -- using a given 'a'. The continuation takes the output 'b' and -- produces a 'd'. data Context : BF → BF → BF → BF → Set where emptyC : {a b : BF} → Context a b a b seqC₁ : {a b c i o : BF} → (b ⟺ c) → Context a c i o → Context a b i o seqC₂ : {a b c i o : BF} → (a ⟺ b) → Context a c i o → Context b c i o leftC : {a b c d i o : BF} → (c ⟺ d) → Context (PLUSF a c) (PLUSF b d) i o → Context a b i o rightC : {a b c d i o : BF} → (a ⟺ b) → Context (PLUSF a c) (PLUSF b d) i o → Context c d i o -- the (i <-> a) part of the computation is completely done; so we must store -- the value of type [[ c ]] as part of the context fstC : {a b c d i o : BF} → ⟦ c ⟧F → (c ⟺ d) → Context (TIMESF a c) (TIMESF b d) i o → Context a b i o -- the (i <-> c) part of the computation and the (a <-> b) part of -- the computation are completely done; so we must store the value -- of type [[ b ]] as part of the context sndC : {a b c d i o : BF} → (a ⟺ b) → ⟦ b ⟧F → Context (TIMESF a c) (TIMESF b d) i o → Context c d i o -- Evaluation mutual -- The (c <-> a) part of the computation has been done. -- We have an 'a' and we are about to do the (a <-> b) computation. -- We get a 'b' and examine the context to get the 'd' eval_c : { a b c : BF } → (a ⟺ b) → ⟦ a ⟧F → Context a b c c → ⟦ c ⟧F eval_c (iso f) v C = eval_k (iso f) (evalP f v) C eval_c (sym c) v C = eval_c (adjoint c) v C eval_c (f ◎ g) v C = eval_c f v (seqC₁ g C) eval_c (f ⊕ g) (inj₁ v) C = eval_c f v (leftC g C) eval_c (f ⊕ g) (inj₂ v) C = eval_c g v (rightC f C) eval_c (f ⊗ g) (v₁ , v₂) C = eval_c f v₁ (fstC v₂ g C) eval_c refe⋆ (rec (rec v _) _) C = eval_k refe⋆ v C eval_c refi⋆ v C = eval_k refi⋆ (rec (rec v (λ x → tt)) ff) C where ff = λ x → tt eval_c rile⋆ (v₁ , (v₂ , rec v₃ _)) C = eval_k rile⋆ v₁ C eval_c rili⋆ v C = eval_k rili⋆ (v , (v , {!!})) C -- The (c <-> a) part of the computation has been done. -- The (a <-> b) part of the computation has been done. -- We need to examine the context to get the 'd'. -- We rebuild the combinator on the way out. eval_k : { a b c : BF } → (a ⟺ b) → ⟦ b ⟧F → Context a b c c → ⟦ c ⟧F eval_k f v emptyC = v eval_k f v (seqC₁ g C) = eval_c g v (seqC₂ f C) eval_k g v (seqC₂ f C) = eval_k (f ◎ g) v C eval_k f v (leftC g C) = eval_k (f ⊕ g) (inj₁ v) C eval_k g v (rightC f C) = eval_k (f ⊕ g) (inj₂ v) C eval_k f v₁ (fstC v₂ g C) = eval_c g v₂ (sndC f v₁ C) eval_k g v₂ (sndC f v₁ C) = eval_k (f ⊗ g) (v₁ , v₂) C -- Backwards evaluator -- The (d <-> b) part of the computation has been done. -- We have a 'b' and we are about to do the (a <-> b) computation backwards. -- We get an 'a' and examine the context to get the 'c' beval_c : { a b c : BF } → (a ⟺ b) → ⟦ b ⟧F → Context a b c c → ⟦ c ⟧F beval_c (iso f) v C = beval_k (iso f) (bevalP f v) C beval_c (sym c) v C = beval_c (adjoint c) v C beval_c (f ◎ g) v C = beval_c g v (seqC₂ f C) beval_c (f ⊕ g) (inj₁ v) C = beval_c f v (leftC g C) beval_c (f ⊕ g) (inj₂ v) C = beval_c g v (rightC f C) beval_c (f ⊗ g) (v₁ , v₂) C = beval_c g v₂ (sndC f v₁ C) beval_c refe⋆ v C = beval_k refe⋆ {!!} C beval_c refi⋆ _ C = beval_k refi⋆ {!!} C beval_c rile⋆ v C = beval_k rile⋆ (v , (v , {!!})) C beval_c rili⋆ (v₁ , (v₂ , _)) C = {!!} -- The (d <-> b) part of the computation has been done. -- The (a <-> b) backwards computation has been done. -- We have an 'a' and examine the context to get the 'c' beval_k : { a b c : BF } → (a ⟺ b) → ⟦ a ⟧F → Context a b c c → ⟦ c ⟧F beval_k f v emptyC = v beval_k g v (seqC₂ f C) = beval_c f v (seqC₁ g C) beval_k f v (seqC₁ g C) = beval_k (f ◎ g) v C beval_k f v (leftC g C) = beval_k (f ⊕ g) (inj₁ v) C beval_k g v (rightC f C) = beval_k (f ⊕ g) (inj₂ v) C beval_k g v₂ (sndC f v₁ C) = beval_c f v₁ (fstC v₂ g C) beval_k f v₁ (fstC v₂ g C) = beval_k (f ⊗ g) (v₁ , v₂) C ------------------------------------------------------------------------------ -- Top level eval eval : { a : BF } → (a ⟺ a) → ⟦ a ⟧F → ⟦ a ⟧F eval f v = eval_c f v emptyC -- BOOL : BF BOOL = PLUSF ONEF ONEF test1 : ⟦ BOOL ⟧F test1 = eval {BOOL} (iso swap₊) (inj₁ tt)
Validation/pyFrame3DD-master/gcc-master/gcc/ada/exp_dist.adb
djamal2727/Main-Bearing-Analytical-Model
0
29736
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P_ D I S T -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-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_Atag; use Exp_Atag; with Exp_Strm; use Exp_Strm; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Lib; use Lib; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Rtsfind; use Rtsfind; with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Cat; use Sem_Cat; with Sem_Ch3; use Sem_Ch3; with Sem_Ch8; use Sem_Ch8; with Sem_Ch12; use Sem_Ch12; with Sem_Dist; use Sem_Dist; with Sem_Eval; use Sem_Eval; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Stand; use Stand; with Stringt; use Stringt; with Tbuild; use Tbuild; with Ttypes; use Ttypes; with Uintp; use Uintp; with GNAT.HTable; use GNAT.HTable; package body Exp_Dist is -- The following model has been used to implement distributed objects: -- given a designated type D and a RACW type R, then a record of the form: -- type Stub is tagged record -- [...declaration similar to s-parint.ads RACW_Stub_Type...] -- end record; -- is built. This type has two properties: -- 1) Since it has the same structure as RACW_Stub_Type, it can -- be converted to and from this type to make it suitable for -- System.Partition_Interface.Get_Unique_Remote_Pointer in order -- to avoid memory leaks when the same remote object arrives on the -- same partition through several paths; -- 2) It also has the same dispatching table as the designated type D, -- and thus can be used as an object designated by a value of type -- R on any partition other than the one on which the object has -- been created, since only dispatching calls will be performed and -- the fields themselves will not be used. We call Derive_Subprograms -- to fake half a derivation to ensure that the subprograms do have -- the same dispatching table. First_RCI_Subprogram_Id : constant := 2; -- RCI subprograms are numbered starting at 2. The RCI receiver for -- an RCI package can thus identify calls received through remote -- access-to-subprogram dereferences by the fact that they have a -- (primitive) subprogram id of 0, and 1 is used for the internal RAS -- information lookup operation. (This is for the Garlic code generation, -- where subprograms are identified by numbers; in the PolyORB version, -- they are identified by name, with a numeric suffix for homonyms.) type Hash_Index is range 0 .. 50; ----------------------- -- Local subprograms -- ----------------------- function Hash (F : Entity_Id) return Hash_Index; -- DSA expansion associates stubs to distributed object types using a hash -- table on entity ids. function Hash (F : Name_Id) return Hash_Index; -- The generation of subprogram identifiers requires an overload counter -- to be associated with each remote subprogram name. These counters are -- maintained in a hash table on name ids. type Subprogram_Identifiers is record Str_Identifier : String_Id; Int_Identifier : Int; end record; package Subprogram_Identifier_Table is new Simple_HTable (Header_Num => Hash_Index, Element => Subprogram_Identifiers, No_Element => (No_String, 0), Key => Entity_Id, Hash => Hash, Equal => "="); -- Mapping between a remote subprogram and the corresponding subprogram -- identifiers. package Overload_Counter_Table is new Simple_HTable (Header_Num => Hash_Index, Element => Int, No_Element => 0, Key => Name_Id, Hash => Hash, Equal => "="); -- Mapping between a subprogram name and an integer that counts the number -- of defining subprogram names with that Name_Id encountered so far in a -- given context (an interface). function Get_Subprogram_Ids (Def : Entity_Id) return Subprogram_Identifiers; function Get_Subprogram_Id (Def : Entity_Id) return String_Id; function Get_Subprogram_Id (Def : Entity_Id) return Int; -- Given a subprogram defined in a RCI package, get its distribution -- subprogram identifiers (the distribution identifiers are a unique -- subprogram number, and the non-qualified subprogram name, in the -- casing used for the subprogram declaration; if the name is overloaded, -- a double underscore and a serial number are appended. -- -- The integer identifier is used to perform remote calls with GARLIC; -- the string identifier is used in the case of PolyORB. -- -- Although the PolyORB DSA receiving stubs will make a caseless comparison -- when receiving a call, the calling stubs will create requests with the -- exact casing of the defining unit name of the called subprogram, so as -- to allow calls to subprograms on distributed nodes that do distinguish -- between casings. -- -- NOTE: Another design would be to allow a representation clause on -- subprogram specs: for Subp'Distribution_Identifier use "fooBar"; pragma Warnings (Off, Get_Subprogram_Id); -- One homonym only is unreferenced (specific to the GARLIC version) procedure Add_RAS_Dereference_TSS (N : Node_Id); -- Add a subprogram body for RAS Dereference TSS procedure Add_RAS_Proxy_And_Analyze (Decls : List_Id; Vis_Decl : Node_Id; All_Calls_Remote_E : Entity_Id; Proxy_Object_Addr : out Entity_Id); -- Add the proxy type required, on the receiving (server) side, to handle -- calls to the subprogram declared by Vis_Decl through a remote access -- to subprogram type. All_Calls_Remote_E must be Standard_True if a pragma -- All_Calls_Remote applies, Standard_False otherwise. The new proxy type -- is appended to Decls. Proxy_Object_Addr is a constant of type -- System.Address that designates an instance of the proxy object. function Build_Remote_Subprogram_Proxy_Type (Loc : Source_Ptr; ACR_Expression : Node_Id) return Node_Id; -- Build and return a tagged record type definition for an RCI subprogram -- proxy type. ACR_Expression is used as the initialization value for the -- All_Calls_Remote component. function Build_Get_Unique_RP_Call (Loc : Source_Ptr; Pointer : Entity_Id; Stub_Type : Entity_Id) return List_Id; -- Build a call to Get_Unique_Remote_Pointer (Pointer), followed by a -- tag fixup (Get_Unique_Remote_Pointer may have changed Pointer'Tag to -- RACW_Stub_Type'Tag, while the desired tag is that of Stub_Type). function Build_Stub_Tag (Loc : Source_Ptr; RACW_Type : Entity_Id) return Node_Id; -- Return an expression denoting the tag of the stub type associated with -- RACW_Type. function Build_Subprogram_Calling_Stubs (Vis_Decl : Node_Id; Subp_Id : Node_Id; Asynchronous : Boolean; Dynamically_Asynchronous : Boolean := False; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Locator : Entity_Id := Empty; New_Name : Name_Id := No_Name) return Node_Id; -- Build the calling stub for a given subprogram with the subprogram ID -- being Subp_Id. If Stub_Type is given, then the "addr" field of -- parameters of this type will be marshalled instead of the object itself. -- It will then be converted into Stub_Type before performing the real -- call. If Dynamically_Asynchronous is True, then it will be computed at -- run time whether the call is asynchronous or not. Otherwise, the value -- of the formal Asynchronous will be used. If Locator is not Empty, it -- will be used instead of RCI_Cache. If New_Name is given, then it will -- be used instead of the original name. function Build_RPC_Receiver_Specification (RPC_Receiver : Entity_Id; Request_Parameter : Entity_Id) return Node_Id; -- Make a subprogram specification for an RPC receiver, with the given -- defining unit name and formal parameter. function Build_Ordered_Parameters_List (Spec : Node_Id) return List_Id; -- Return an ordered parameter list: unconstrained parameters are put -- at the beginning of the list and constrained ones are put after. If -- there are no parameters, an empty list is returned. Special case: -- the controlling formal of the equivalent RACW operation for a RAS -- type is always left in first position. function Transmit_As_Unconstrained (Typ : Entity_Id) return Boolean; -- True when Typ is an unconstrained type, or a null-excluding access type. -- In either case, this means stubs cannot contain a default-initialized -- object declaration of such type. procedure Add_Calling_Stubs_To_Declarations (Pkg_Spec : Node_Id); -- Add calling stubs to the declarative part function Could_Be_Asynchronous (Spec : Node_Id) return Boolean; -- Return True if nothing prevents the program whose specification is -- given to be asynchronous (i.e. no [IN] OUT parameters). function Pack_Entity_Into_Stream_Access (Loc : Source_Ptr; Stream : Node_Id; Object : Entity_Id; Etyp : Entity_Id := Empty) return Node_Id; -- Pack Object (of type Etyp) into Stream. If Etyp is not given, -- then Etype (Object) will be used if present. If the type is -- constrained, then 'Write will be used to output the object, -- If the type is unconstrained, 'Output will be used. function Pack_Node_Into_Stream (Loc : Source_Ptr; Stream : Entity_Id; Object : Node_Id; Etyp : Entity_Id) return Node_Id; -- Similar to above, with an arbitrary node instead of an entity function Pack_Node_Into_Stream_Access (Loc : Source_Ptr; Stream : Node_Id; Object : Node_Id; Etyp : Entity_Id) return Node_Id; -- Similar to above, with Stream instead of Stream'Access function Make_Selected_Component (Loc : Source_Ptr; Prefix : Entity_Id; Selector_Name : Name_Id) return Node_Id; -- Return a selected_component whose prefix denotes the given entity, and -- with the given Selector_Name. function Scope_Of_Spec (Spec : Node_Id) return Entity_Id; -- Return the scope represented by a given spec procedure Set_Renaming_TSS (Typ : Entity_Id; Nam : Entity_Id; TSS_Nam : TSS_Name_Type); -- Create a renaming declaration of subprogram Nam, and register it as a -- TSS for Typ with name TSS_Nam. function Need_Extra_Constrained (Parameter : Node_Id) return Boolean; -- Return True if the current parameter needs an extra formal to reflect -- its constrained status. function Is_RACW_Controlling_Formal (Parameter : Node_Id; Stub_Type : Entity_Id) return Boolean; -- Return True if the current parameter is a controlling formal argument -- of type Stub_Type or access to Stub_Type. procedure Declare_Create_NVList (Loc : Source_Ptr; NVList : Entity_Id; Decls : List_Id; Stmts : List_Id); -- Append the declaration of NVList to Decls, and its -- initialization to Stmts. function Add_Parameter_To_NVList (Loc : Source_Ptr; NVList : Entity_Id; Parameter : Entity_Id; Constrained : Boolean; RACW_Ctrl : Boolean := False; Any : Entity_Id) return Node_Id; -- Return a call to Add_Item to add the Any corresponding to the designated -- formal Parameter (with the indicated Constrained status) to NVList. -- RACW_Ctrl must be set to True for controlling formals of distributed -- object primitive operations. -------------------- -- Stub_Structure -- -------------------- -- This record describes various tree fragments associated with the -- generation of RACW calling stubs. One such record exists for every -- distributed object type, i.e. each tagged type that is the designated -- type of one or more RACW type. type Stub_Structure is record Stub_Type : Entity_Id; -- Stub type: this type has the same primitive operations as the -- designated types, but the provided bodies for these operations -- a remote call to an actual target object potentially located on -- another partition; each value of the stub type encapsulates a -- reference to a remote object. Stub_Type_Access : Entity_Id; -- A local access type designating the stub type (this is not an RACW -- type). RPC_Receiver_Decl : Node_Id; -- Declaration for the RPC receiver entity associated with the -- designated type. As an exception, in the case of GARLIC, for an RACW -- that implements a RAS, no object RPC receiver is generated. Instead, -- RPC_Receiver_Decl is the declaration after which the RPC receiver -- would have been inserted. Body_Decls : List_Id; -- List of subprogram bodies to be included in generated code: bodies -- for the RACW's stream attributes, and for the primitive operations -- of the stub type. RACW_Type : Entity_Id; -- One of the RACW types designating this distributed object type -- (they are all interchangeable; we use any one of them in order to -- avoid having to create various anonymous access types). end record; Empty_Stub_Structure : constant Stub_Structure := (Empty, Empty, Empty, No_List, Empty); package Stubs_Table is new Simple_HTable (Header_Num => Hash_Index, Element => Stub_Structure, No_Element => Empty_Stub_Structure, Key => Entity_Id, Hash => Hash, Equal => "="); -- Mapping between a RACW designated type and its stub type package Asynchronous_Flags_Table is new Simple_HTable (Header_Num => Hash_Index, Element => Entity_Id, No_Element => Empty, Key => Entity_Id, Hash => Hash, Equal => "="); -- Mapping between a RACW type and a constant having the value True -- if the RACW is asynchronous and False otherwise. package RCI_Locator_Table is new Simple_HTable (Header_Num => Hash_Index, Element => Entity_Id, No_Element => Empty, Key => Entity_Id, Hash => Hash, Equal => "="); -- Mapping between a RCI package on which All_Calls_Remote applies and -- the generic instantiation of RCI_Locator for this package. package RCI_Calling_Stubs_Table is new Simple_HTable (Header_Num => Hash_Index, Element => Entity_Id, No_Element => Empty, Key => Entity_Id, Hash => Hash, Equal => "="); -- Mapping between a RCI subprogram and the corresponding calling stubs function Get_Stub_Elements (RACW_Type : Entity_Id) return Stub_Structure; -- Return the stub information associated with the given RACW type procedure Add_Stub_Type (Designated_Type : Entity_Id; RACW_Type : Entity_Id; Decls : List_Id; Stub_Type : out Entity_Id; Stub_Type_Access : out Entity_Id; RPC_Receiver_Decl : out Node_Id; Body_Decls : out List_Id; Existing : out Boolean); -- Add the declaration of the stub type, the access to stub type and the -- object RPC receiver at the end of Decls. If these already exist, -- then nothing is added in the tree but the right values are returned -- anyhow and Existing is set to True. function Get_And_Reset_RACW_Bodies (RACW_Type : Entity_Id) return List_Id; -- Retrieve the Body_Decls list associated to RACW_Type in the stub -- structure table, reset it to No_List, and return the previous value. procedure Add_RACW_Asynchronous_Flag (Declarations : List_Id; RACW_Type : Entity_Id); -- Declare a boolean constant associated with RACW_Type whose value -- indicates at run time whether a pragma Asynchronous applies to it. procedure Assign_Subprogram_Identifier (Def : Entity_Id; Spn : Int; Id : out String_Id); -- Determine the distribution subprogram identifier to -- be used for remote subprogram Def, return it in Id and -- store it in a hash table for later retrieval by -- Get_Subprogram_Id. Spn is the subprogram number. function RCI_Package_Locator (Loc : Source_Ptr; Package_Spec : Node_Id) return Node_Id; -- Instantiate the generic package RCI_Locator in order to locate the -- RCI package whose spec is given as argument. function Make_Tag_Check (Loc : Source_Ptr; N : Node_Id) return Node_Id; -- Surround a node N by a tag check, as in: -- begin -- <N>; -- exception -- when E : Ada.Tags.Tag_Error => -- Raise_Exception (Program_Error'Identity, -- Exception_Message (E)); -- end; function Input_With_Tag_Check (Loc : Source_Ptr; Var_Type : Entity_Id; Stream : Node_Id) return Node_Id; -- Return a function with the following form: -- function R return Var_Type is -- begin -- return Var_Type'Input (S); -- exception -- when E : Ada.Tags.Tag_Error => -- Raise_Exception (Program_Error'Identity, -- Exception_Message (E)); -- end R; procedure Build_Actual_Object_Declaration (Object : Entity_Id; Etyp : Entity_Id; Variable : Boolean; Expr : Node_Id; Decls : List_Id); -- Build the declaration of an object with the given defining identifier, -- initialized with Expr if provided, to serve as actual parameter in a -- server stub. If Variable is true, the declared object will be a variable -- (case of an out or in out formal), else it will be a constant. Object's -- Ekind is set accordingly. The declaration, as well as any other -- declarations it requires, are appended to Decls. -------------------------------------------- -- Hooks for PCS-specific code generation -- -------------------------------------------- -- Part of the code generation circuitry for distribution needs to be -- tailored for each implementation of the PCS. For each routine that -- needs to be specialized, a Specific_<routine> wrapper is created, -- which calls the corresponding <routine> in package -- <pcs_implementation>_Support. procedure Specific_Add_RACW_Features (RACW_Type : Entity_Id; Desig : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; RPC_Receiver_Decl : Node_Id; Body_Decls : List_Id); -- Add declaration for TSSs for a given RACW type. The declarations are -- added just after the declaration of the RACW type itself. If the RACW -- appears in the main unit, Body_Decls is a list of declarations to which -- the bodies are appended. Else Body_Decls is No_List. -- PCS-specific ancillary subprogram for Add_RACW_Features. procedure Specific_Add_RAST_Features (Vis_Decl : Node_Id; RAS_Type : Entity_Id); -- Add declaration for TSSs for a given RAS type. PCS-specific ancillary -- subprogram for Add_RAST_Features. -- An RPC_Target record is used during construction of calling stubs -- to pass PCS-specific tree fragments corresponding to the information -- necessary to locate the target of a remote subprogram call. type RPC_Target (PCS_Kind : PCS_Names) is record case PCS_Kind is when Name_PolyORB_DSA => Object : Node_Id; -- An expression whose value is a PolyORB reference to the target -- object. when others => Partition : Entity_Id; -- A variable containing the Partition_ID of the target partition RPC_Receiver : Node_Id; -- An expression whose value is the address of the target RPC -- receiver. end case; end record; procedure Specific_Build_General_Calling_Stubs (Decls : List_Id; Statements : List_Id; Target : RPC_Target; Subprogram_Id : Node_Id; Asynchronous : Node_Id := Empty; Is_Known_Asynchronous : Boolean := False; Is_Known_Non_Asynchronous : Boolean := False; Is_Function : Boolean; Spec : Node_Id; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Nod : Node_Id); -- Build calling stubs for general purpose. The parameters are: -- Decls : A place to put declarations -- Statements : A place to put statements -- Target : PCS-specific target information (see details in -- RPC_Target declaration). -- Subprogram_Id : A node containing the subprogram ID -- Asynchronous : True if an APC must be made instead of an RPC. -- The value needs not be supplied if one of the -- Is_Known_... is True. -- Is_Known_Async... : True if we know that this is asynchronous -- Is_Known_Non_A... : True if we know that this is not asynchronous -- Spec : Node with a Parameter_Specifications and a -- Result_Definition if applicable -- Stub_Type : For case of RACW stubs, parameters of type access -- to Stub_Type will be marshalled using the address -- address of the object (the addr field) rather -- than using the 'Write on the stub itself -- Nod : Used to provide sloc for generated code function Specific_Build_Stub_Target (Loc : Source_Ptr; Decls : List_Id; RCI_Locator : Entity_Id; Controlling_Parameter : Entity_Id) return RPC_Target; -- Build call target information nodes for use within calling stubs. In the -- RCI case, RCI_Locator is the entity for the instance of RCI_Locator. If -- for an RACW, Controlling_Parameter is the entity for the controlling -- formal parameter used to determine the location of the target of the -- call. Decls provides a location where variable declarations can be -- appended to construct the necessary values. function Specific_RPC_Receiver_Decl (RACW_Type : Entity_Id) return Node_Id; -- Build the RPC receiver, for RACW, if applicable, else return Empty procedure Specific_Build_RPC_Receiver_Body (RPC_Receiver : Entity_Id; Request : out Entity_Id; Subp_Id : out Entity_Id; Subp_Index : out Entity_Id; Stmts : out List_Id; Decl : out Node_Id); -- Make a subprogram body for an RPC receiver, with the given -- defining unit name. On return: -- - Subp_Id is the subprogram identifier from the PCS. -- - Subp_Index is the index in the list of subprograms -- used for dispatching (a variable of type Subprogram_Id). -- - Stmts is the place where the request dispatching -- statements can occur, -- - Decl is the subprogram body declaration. function Specific_Build_Subprogram_Receiving_Stubs (Vis_Decl : Node_Id; Asynchronous : Boolean; Dynamically_Asynchronous : Boolean := False; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Parent_Primitive : Entity_Id := Empty) return Node_Id; -- Build the receiving stub for a given subprogram. The subprogram -- declaration is also built by this procedure, and the value returned -- is a N_Subprogram_Body. If a parameter of type access to Stub_Type is -- found in the specification, then its address is read from the stream -- instead of the object itself and converted into an access to -- class-wide type before doing the real call using any of the RACW type -- pointing on the designated type. procedure Specific_Add_Obj_RPC_Receiver_Completion (Loc : Source_Ptr; Decls : List_Id; RPC_Receiver : Entity_Id; Stub_Elements : Stub_Structure); -- Add the necessary code to Decls after the completion of generation -- of the RACW RPC receiver described by Stub_Elements. procedure Specific_Add_Receiving_Stubs_To_Declarations (Pkg_Spec : Node_Id; Decls : List_Id; Stmts : List_Id); -- Add receiving stubs to the declarative part of an RCI unit -------------------- -- GARLIC_Support -- -------------------- package GARLIC_Support is -- Support for generating DSA code that uses the GARLIC PCS -- The subprograms below provide the GARLIC versions of the -- corresponding Specific_<subprogram> routine declared above. procedure Add_RACW_Features (RACW_Type : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; RPC_Receiver_Decl : Node_Id; Body_Decls : List_Id); procedure Add_RAST_Features (Vis_Decl : Node_Id; RAS_Type : Entity_Id); procedure Build_General_Calling_Stubs (Decls : List_Id; Statements : List_Id; Target_Partition : Entity_Id; -- From RPC_Target Target_RPC_Receiver : Node_Id; -- From RPC_Target Subprogram_Id : Node_Id; Asynchronous : Node_Id := Empty; Is_Known_Asynchronous : Boolean := False; Is_Known_Non_Asynchronous : Boolean := False; Is_Function : Boolean; Spec : Node_Id; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Nod : Node_Id); function Build_Stub_Target (Loc : Source_Ptr; Decls : List_Id; RCI_Locator : Entity_Id; Controlling_Parameter : Entity_Id) return RPC_Target; function RPC_Receiver_Decl (RACW_Type : Entity_Id) return Node_Id; function Build_Subprogram_Receiving_Stubs (Vis_Decl : Node_Id; Asynchronous : Boolean; Dynamically_Asynchronous : Boolean := False; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Parent_Primitive : Entity_Id := Empty) return Node_Id; procedure Add_Obj_RPC_Receiver_Completion (Loc : Source_Ptr; Decls : List_Id; RPC_Receiver : Entity_Id; Stub_Elements : Stub_Structure); procedure Add_Receiving_Stubs_To_Declarations (Pkg_Spec : Node_Id; Decls : List_Id; Stmts : List_Id); procedure Build_RPC_Receiver_Body (RPC_Receiver : Entity_Id; Request : out Entity_Id; Subp_Id : out Entity_Id; Subp_Index : out Entity_Id; Stmts : out List_Id; Decl : out Node_Id); end GARLIC_Support; --------------------- -- PolyORB_Support -- --------------------- package PolyORB_Support is -- Support for generating DSA code that uses the PolyORB PCS -- The subprograms below provide the PolyORB versions of the -- corresponding Specific_<subprogram> routine declared above. procedure Add_RACW_Features (RACW_Type : Entity_Id; Desig : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; RPC_Receiver_Decl : Node_Id; Body_Decls : List_Id); procedure Add_RAST_Features (Vis_Decl : Node_Id; RAS_Type : Entity_Id); procedure Build_General_Calling_Stubs (Decls : List_Id; Statements : List_Id; Target_Object : Node_Id; -- From RPC_Target Subprogram_Id : Node_Id; Asynchronous : Node_Id := Empty; Is_Known_Asynchronous : Boolean := False; Is_Known_Non_Asynchronous : Boolean := False; Is_Function : Boolean; Spec : Node_Id; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Nod : Node_Id); function Build_Stub_Target (Loc : Source_Ptr; Decls : List_Id; RCI_Locator : Entity_Id; Controlling_Parameter : Entity_Id) return RPC_Target; function RPC_Receiver_Decl (RACW_Type : Entity_Id) return Node_Id; function Build_Subprogram_Receiving_Stubs (Vis_Decl : Node_Id; Asynchronous : Boolean; Dynamically_Asynchronous : Boolean := False; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Parent_Primitive : Entity_Id := Empty) return Node_Id; procedure Add_Obj_RPC_Receiver_Completion (Loc : Source_Ptr; Decls : List_Id; RPC_Receiver : Entity_Id; Stub_Elements : Stub_Structure); procedure Add_Receiving_Stubs_To_Declarations (Pkg_Spec : Node_Id; Decls : List_Id; Stmts : List_Id); procedure Build_RPC_Receiver_Body (RPC_Receiver : Entity_Id; Request : out Entity_Id; Subp_Id : out Entity_Id; Subp_Index : out Entity_Id; Stmts : out List_Id; Decl : out Node_Id); procedure Reserve_NamingContext_Methods; -- Mark the method names for interface NamingContext as already used in -- the overload table, so no clashes occur with user code (with the -- PolyORB PCS, RCIs Implement The NamingContext interface to allow -- their methods to be accessed as objects, for the implementation of -- remote access-to-subprogram types). ------------- -- Helpers -- ------------- package Helpers is -- Routines to build distribution helper subprograms for user-defined -- types. For implementation of the Distributed systems annex (DSA) -- over the PolyORB generic middleware components, it is necessary to -- generate several supporting subprograms for each application data -- type used in inter-partition communication. These subprograms are: -- A Typecode function returning a high-level description of the -- type's structure; -- Two conversion functions allowing conversion of values of the -- type from and to the generic data containers used by PolyORB. -- These generic containers are called 'Any' type values after the -- CORBA terminology, and hence the conversion subprograms are -- named To_Any and From_Any. function Build_From_Any_Call (Typ : Entity_Id; N : Node_Id; Decls : List_Id) return Node_Id; -- Build call to From_Any attribute function of type Typ with -- expression N as actual parameter. Decls is the declarations list -- for an appropriate enclosing scope of the point where the call -- will be inserted; if the From_Any attribute for Typ needs to be -- generated at this point, its declaration is appended to Decls. procedure Build_From_Any_Function (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Fnam : out Entity_Id); -- Build From_Any attribute function for Typ. Loc is the reference -- location for generated nodes, Typ is the type for which the -- conversion function is generated. On return, Decl and Fnam contain -- the declaration and entity for the newly-created function. function Build_To_Any_Call (Loc : Source_Ptr; N : Node_Id; Decls : List_Id; Constrained : Boolean := False) return Node_Id; -- Build call to To_Any attribute function with expression as actual -- parameter. Loc is the reference location of generated nodes, -- Decls is the declarations list for an appropriate enclosing scope -- of the point where the call will be inserted; if the To_Any -- attribute for the type of N needs to be generated at this point, -- its declaration is appended to Decls. For the case of a limited -- type, there is an additional parameter Constrained indicating -- whether 'Write (when True) or 'Output (when False) is used. procedure Build_To_Any_Function (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Fnam : out Entity_Id); -- Build To_Any attribute function for Typ. Loc is the reference -- location for generated nodes, Typ is the type for which the -- conversion function is generated. On return, Decl and Fnam contain -- the declaration and entity for the newly-created function. function Build_TypeCode_Call (Loc : Source_Ptr; Typ : Entity_Id; Decls : List_Id) return Node_Id; -- Build call to TypeCode attribute function for Typ. Decls is the -- declarations list for an appropriate enclosing scope of the point -- where the call will be inserted; if the To_Any attribute for Typ -- needs to be generated at this point, its declaration is appended -- to Decls. procedure Build_TypeCode_Function (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Fnam : out Entity_Id); -- Build TypeCode attribute function for Typ. Loc is the reference -- location for generated nodes, Typ is the type for which the -- typecode function is generated. On return, Decl and Fnam contain -- the declaration and entity for the newly-created function. procedure Build_Name_And_Repository_Id (E : Entity_Id; Name_Str : out String_Id; Repo_Id_Str : out String_Id); -- In the PolyORB distribution model, each distributed object type -- and each distributed operation has a globally unique identifier, -- its Repository Id. This subprogram builds and returns two strings -- for entity E (a distributed object type or operation): one -- containing the name of E, the second containing its repository id. procedure Assign_Opaque_From_Any (Loc : Source_Ptr; Stms : List_Id; Typ : Entity_Id; N : Node_Id; Target : Entity_Id; Constrained : Boolean := False); -- For a Target object of type Typ, which has opaque representation -- as a sequence of octets determined by stream attributes (which -- includes all limited types), append code to Stmts performing the -- equivalent of: -- Target := Typ'From_Any (N) -- -- or, if Target is Empty: -- return Typ'From_Any (N) -- -- Constrained determines whether 'Input (when False) or 'Read -- (when True) is used. end Helpers; end PolyORB_Support; -- The following PolyORB-specific subprograms are made visible to Exp_Attr: function Build_From_Any_Call (Typ : Entity_Id; N : Node_Id; Decls : List_Id) return Node_Id renames PolyORB_Support.Helpers.Build_From_Any_Call; function Build_To_Any_Call (Loc : Source_Ptr; N : Node_Id; Decls : List_Id; Constrained : Boolean := False) return Node_Id renames PolyORB_Support.Helpers.Build_To_Any_Call; function Build_TypeCode_Call (Loc : Source_Ptr; Typ : Entity_Id; Decls : List_Id) return Node_Id renames PolyORB_Support.Helpers.Build_TypeCode_Call; ------------------------------------ -- Local variables and structures -- ------------------------------------ RCI_Cache : Node_Id; -- Needs comments ??? Output_From_Constrained : constant array (Boolean) of Name_Id := (False => Name_Output, True => Name_Write); -- The attribute to choose depending on the fact that the parameter -- is constrained or not. There is no such thing as Input_From_Constrained -- since this require separate mechanisms ('Input is a function while -- 'Read is a procedure). generic with procedure Process_Subprogram_Declaration (Decl : Node_Id); -- Generate calling or receiving stub for this subprogram declaration procedure Build_Package_Stubs (Pkg_Spec : Node_Id); -- Recursively visit the given RCI Package_Specification, calling -- Process_Subprogram_Declaration for each remote subprogram. ------------------------- -- Build_Package_Stubs -- ------------------------- procedure Build_Package_Stubs (Pkg_Spec : Node_Id) is Decls : constant List_Id := Visible_Declarations (Pkg_Spec); Decl : Node_Id; procedure Visit_Nested_Pkg (Nested_Pkg_Decl : Node_Id); -- Recurse for the given nested package declaration ---------------------- -- Visit_Nested_Pkg -- ---------------------- procedure Visit_Nested_Pkg (Nested_Pkg_Decl : Node_Id) is Nested_Pkg_Spec : constant Node_Id := Specification (Nested_Pkg_Decl); begin Push_Scope (Scope_Of_Spec (Nested_Pkg_Spec)); Build_Package_Stubs (Nested_Pkg_Spec); Pop_Scope; end Visit_Nested_Pkg; -- Start of processing for Build_Package_Stubs begin Decl := First (Decls); while Present (Decl) loop case Nkind (Decl) is when N_Subprogram_Declaration => -- Note: we test Comes_From_Source on Spec, not Decl, because -- in the case of a subprogram instance, only the specification -- (not the declaration) is marked as coming from source. if Comes_From_Source (Specification (Decl)) then Process_Subprogram_Declaration (Decl); end if; when N_Package_Declaration => -- Case of a nested package or package instantiation coming -- from source, including the wrapper package for an instance -- of a generic subprogram. declare Pkg_Ent : constant Entity_Id := Defining_Unit_Name (Specification (Decl)); begin if Comes_From_Source (Decl) or else (Is_Generic_Instance (Pkg_Ent) and then Comes_From_Source (Get_Unit_Instantiation_Node (Pkg_Ent))) then Visit_Nested_Pkg (Decl); end if; end; when others => null; end case; Next (Decl); end loop; end Build_Package_Stubs; --------------------------------------- -- Add_Calling_Stubs_To_Declarations -- --------------------------------------- procedure Add_Calling_Stubs_To_Declarations (Pkg_Spec : Node_Id) is Loc : constant Source_Ptr := Sloc (Pkg_Spec); Current_Subprogram_Number : Int := First_RCI_Subprogram_Id; -- Subprogram id 0 is reserved for calls received from -- remote access-to-subprogram dereferences. RCI_Instantiation : Node_Id; procedure Visit_Subprogram (Decl : Node_Id); -- Generate calling stub for one remote subprogram ---------------------- -- Visit_Subprogram -- ---------------------- procedure Visit_Subprogram (Decl : Node_Id) is Loc : constant Source_Ptr := Sloc (Decl); Spec : constant Node_Id := Specification (Decl); Subp_Stubs : Node_Id; Subp_Str : String_Id; pragma Warnings (Off, Subp_Str); begin -- Disable expansion of stubs if serious errors have been diagnosed, -- because otherwise some illegal remote subprogram declarations -- could cause cascaded errors in stubs. if Serious_Errors_Detected /= 0 then return; end if; Assign_Subprogram_Identifier (Defining_Unit_Name (Spec), Current_Subprogram_Number, Subp_Str); Subp_Stubs := Build_Subprogram_Calling_Stubs (Vis_Decl => Decl, Subp_Id => Build_Subprogram_Id (Loc, Defining_Unit_Name (Spec)), Asynchronous => Nkind (Spec) = N_Procedure_Specification and then Is_Asynchronous (Defining_Unit_Name (Spec))); Append_To (List_Containing (Decl), Subp_Stubs); Analyze (Subp_Stubs); Current_Subprogram_Number := Current_Subprogram_Number + 1; end Visit_Subprogram; procedure Visit_Spec is new Build_Package_Stubs (Visit_Subprogram); -- Start of processing for Add_Calling_Stubs_To_Declarations begin Push_Scope (Scope_Of_Spec (Pkg_Spec)); -- The first thing added is an instantiation of the generic package -- System.Partition_Interface.RCI_Locator with the name of this remote -- package. This will act as an interface with the name server to -- determine the Partition_ID and the RPC_Receiver for the receiver -- of this package. RCI_Instantiation := RCI_Package_Locator (Loc, Pkg_Spec); RCI_Cache := Defining_Unit_Name (RCI_Instantiation); Append_To (Visible_Declarations (Pkg_Spec), RCI_Instantiation); Analyze (RCI_Instantiation); -- For each subprogram declaration visible in the spec, we do build a -- body. We also increment a counter to assign a different Subprogram_Id -- to each subprogram. The receiving stubs processing uses the same -- mechanism and will thus assign the same Id and do the correct -- dispatching. Overload_Counter_Table.Reset; PolyORB_Support.Reserve_NamingContext_Methods; Visit_Spec (Pkg_Spec); Pop_Scope; end Add_Calling_Stubs_To_Declarations; ----------------------------- -- Add_Parameter_To_NVList -- ----------------------------- function Add_Parameter_To_NVList (Loc : Source_Ptr; NVList : Entity_Id; Parameter : Entity_Id; Constrained : Boolean; RACW_Ctrl : Boolean := False; Any : Entity_Id) return Node_Id is Parameter_Name_String : String_Id; Parameter_Mode : Node_Id; function Parameter_Passing_Mode (Loc : Source_Ptr; Parameter : Entity_Id; Constrained : Boolean) return Node_Id; -- Return an expression that denotes the parameter passing mode to be -- used for Parameter in distribution stubs, where Constrained is -- Parameter's constrained status. ---------------------------- -- Parameter_Passing_Mode -- ---------------------------- function Parameter_Passing_Mode (Loc : Source_Ptr; Parameter : Entity_Id; Constrained : Boolean) return Node_Id is Lib_RE : RE_Id; begin if Out_Present (Parameter) then if In_Present (Parameter) or else not Constrained then -- Unconstrained formals must be translated -- to 'in' or 'inout', not 'out', because -- they need to be constrained by the actual. Lib_RE := RE_Mode_Inout; else Lib_RE := RE_Mode_Out; end if; else Lib_RE := RE_Mode_In; end if; return New_Occurrence_Of (RTE (Lib_RE), Loc); end Parameter_Passing_Mode; -- Start of processing for Add_Parameter_To_NVList begin if Nkind (Parameter) = N_Defining_Identifier then Get_Name_String (Chars (Parameter)); else Get_Name_String (Chars (Defining_Identifier (Parameter))); end if; Parameter_Name_String := String_From_Name_Buffer; if RACW_Ctrl or else Nkind (Parameter) = N_Defining_Identifier then -- When the parameter passed to Add_Parameter_To_NVList is an -- Extra_Constrained parameter, Parameter is an N_Defining_ -- Identifier, instead of a complete N_Parameter_Specification. -- Thus, we explicitly set 'in' mode in this case. Parameter_Mode := New_Occurrence_Of (RTE (RE_Mode_In), Loc); else Parameter_Mode := Parameter_Passing_Mode (Loc, Parameter, Constrained); end if; return Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_NVList_Add_Item), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (NVList, Loc), Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_To_PolyORB_String), Loc), Parameter_Associations => New_List ( Make_String_Literal (Loc, Strval => Parameter_Name_String))), New_Occurrence_Of (Any, Loc), Parameter_Mode)); end Add_Parameter_To_NVList; -------------------------------- -- Add_RACW_Asynchronous_Flag -- -------------------------------- procedure Add_RACW_Asynchronous_Flag (Declarations : List_Id; RACW_Type : Entity_Id) is Loc : constant Source_Ptr := Sloc (RACW_Type); Asynchronous_Flag : constant Entity_Id := Make_Defining_Identifier (Loc, New_External_Name (Chars (RACW_Type), 'A')); begin -- Declare the asynchronous flag. This flag will be changed to True -- whenever it is known that the RACW type is asynchronous. Append_To (Declarations, Make_Object_Declaration (Loc, Defining_Identifier => Asynchronous_Flag, Constant_Present => True, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc), Expression => New_Occurrence_Of (Standard_False, Loc))); Asynchronous_Flags_Table.Set (RACW_Type, Asynchronous_Flag); end Add_RACW_Asynchronous_Flag; ----------------------- -- Add_RACW_Features -- ----------------------- procedure Add_RACW_Features (RACW_Type : Entity_Id) is Desig : constant Entity_Id := Etype (Designated_Type (RACW_Type)); Same_Scope : constant Boolean := Scope (Desig) = Scope (RACW_Type); Pkg_Spec : Node_Id; Decls : List_Id; Body_Decls : List_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; RPC_Receiver_Decl : Node_Id; Existing : Boolean; -- True when appropriate stubs have already been generated (this is the -- case when another RACW with the same designated type has already been -- encountered), in which case we reuse the previous stubs rather than -- generating new ones. begin if not Expander_Active then return; end if; -- Mark the current package declaration as containing an RACW, so that -- the bodies for the calling stubs and the RACW stream subprograms -- are attached to the tree when the corresponding body is encountered. Set_Has_RACW (Current_Scope); -- Look for place to declare the RACW stub type and RACW operations Pkg_Spec := Empty; if Same_Scope then -- Case of declaring the RACW in the same package as its designated -- type: we know that the designated type is a private type, so we -- use the private declarations list. Pkg_Spec := Package_Specification_Of_Scope (Current_Scope); if Present (Private_Declarations (Pkg_Spec)) then Decls := Private_Declarations (Pkg_Spec); else Decls := Visible_Declarations (Pkg_Spec); end if; else -- Case of declaring the RACW in another package than its designated -- type: use the private declarations list if present; otherwise -- use the visible declarations. Decls := List_Containing (Declaration_Node (RACW_Type)); end if; -- If we were unable to find the declarations, that means that the -- completion of the type was missing. We can safely return and let the -- error be caught by the semantic analysis. if No (Decls) then return; end if; Add_Stub_Type (Designated_Type => Desig, RACW_Type => RACW_Type, Decls => Decls, Stub_Type => Stub_Type, Stub_Type_Access => Stub_Type_Access, RPC_Receiver_Decl => RPC_Receiver_Decl, Body_Decls => Body_Decls, Existing => Existing); -- If this RACW is not in the main unit, do not generate primitive or -- TSS bodies. if not Entity_Is_In_Main_Unit (RACW_Type) then Body_Decls := No_List; end if; Add_RACW_Asynchronous_Flag (Declarations => Decls, RACW_Type => RACW_Type); Specific_Add_RACW_Features (RACW_Type => RACW_Type, Desig => Desig, Stub_Type => Stub_Type, Stub_Type_Access => Stub_Type_Access, RPC_Receiver_Decl => RPC_Receiver_Decl, Body_Decls => Body_Decls); -- If we already have stubs for this designated type, nothing to do if Existing then return; end if; if Is_Frozen (Desig) then Validate_RACW_Primitives (RACW_Type); Add_RACW_Primitive_Declarations_And_Bodies (Designated_Type => Desig, Insertion_Node => RPC_Receiver_Decl, Body_Decls => Body_Decls); else -- Validate_RACW_Primitives requires the list of all primitives of -- the designated type, so defer processing until Desig is frozen. -- See Exp_Ch3.Freeze_Type. Add_Access_Type_To_Process (E => Desig, A => RACW_Type); end if; end Add_RACW_Features; ------------------------------------------------ -- Add_RACW_Primitive_Declarations_And_Bodies -- ------------------------------------------------ procedure Add_RACW_Primitive_Declarations_And_Bodies (Designated_Type : Entity_Id; Insertion_Node : Node_Id; Body_Decls : List_Id) is Loc : constant Source_Ptr := Sloc (Insertion_Node); -- Set Sloc of generated declaration copy of insertion node Sloc, so -- the declarations are recognized as belonging to the current package. Stub_Elements : constant Stub_Structure := Stubs_Table.Get (Designated_Type); pragma Assert (Stub_Elements /= Empty_Stub_Structure); Is_RAS : constant Boolean := not Comes_From_Source (Stub_Elements.RACW_Type); -- Case of the RACW generated to implement a remote access-to- -- subprogram type. Build_Bodies : constant Boolean := In_Extended_Main_Code_Unit (Stub_Elements.Stub_Type); -- True when bodies must be prepared in Body_Decls. Bodies are generated -- only when the main unit is the unit that contains the stub type. Current_Insertion_Node : Node_Id := Insertion_Node; RPC_Receiver : Entity_Id; RPC_Receiver_Statements : List_Id; RPC_Receiver_Case_Alternatives : constant List_Id := New_List; RPC_Receiver_Elsif_Parts : List_Id := No_List; RPC_Receiver_Request : Entity_Id := Empty; RPC_Receiver_Subp_Id : Entity_Id := Empty; RPC_Receiver_Subp_Index : Entity_Id := Empty; Subp_Str : String_Id; Current_Primitive_Elmt : Elmt_Id; Current_Primitive : Entity_Id; Current_Primitive_Body : Node_Id; Current_Primitive_Spec : Node_Id; Current_Primitive_Decl : Node_Id; Current_Primitive_Number : Int := 0; Current_Primitive_Alias : Node_Id; Current_Receiver : Entity_Id; Current_Receiver_Body : Node_Id; RPC_Receiver_Decl : Node_Id; Possibly_Asynchronous : Boolean; begin if not Expander_Active then return; end if; if not Is_RAS then RPC_Receiver := Make_Temporary (Loc, 'P'); Specific_Build_RPC_Receiver_Body (RPC_Receiver => RPC_Receiver, Request => RPC_Receiver_Request, Subp_Id => RPC_Receiver_Subp_Id, Subp_Index => RPC_Receiver_Subp_Index, Stmts => RPC_Receiver_Statements, Decl => RPC_Receiver_Decl); if Get_PCS_Name = Name_PolyORB_DSA then -- For the case of PolyORB, we need to map a textual operation -- name into a primitive index. Currently we do so using a simple -- sequence of string comparisons. RPC_Receiver_Elsif_Parts := New_List; end if; end if; -- Build callers, receivers for every primitive operations and a RPC -- receiver for this type. Note that we use Direct_Primitive_Operations, -- not Primitive_Operations, because we really want just the primitives -- of the tagged type itself, and in the case of a tagged synchronized -- type we do not want to get the primitives of the corresponding -- record type). if Present (Direct_Primitive_Operations (Designated_Type)) then Overload_Counter_Table.Reset; Current_Primitive_Elmt := First_Elmt (Direct_Primitive_Operations (Designated_Type)); while Current_Primitive_Elmt /= No_Elmt loop Current_Primitive := Node (Current_Primitive_Elmt); -- Copy the primitive of all the parents, except predefined ones -- that are not remotely dispatching. Also omit hidden primitives -- (occurs in the case of primitives of interface progenitors -- other than immediate ancestors of the Designated_Type). if Chars (Current_Primitive) /= Name_uSize and then Chars (Current_Primitive) /= Name_uAlignment and then not (Is_TSS (Current_Primitive, TSS_Deep_Finalize) or else Is_TSS (Current_Primitive, TSS_Stream_Input) or else Is_TSS (Current_Primitive, TSS_Stream_Output) or else Is_TSS (Current_Primitive, TSS_Stream_Read) or else Is_TSS (Current_Primitive, TSS_Stream_Write) or else Is_Predefined_Interface_Primitive (Current_Primitive)) and then not Is_Hidden (Current_Primitive) then -- The first thing to do is build an up-to-date copy of the -- spec with all the formals referencing Controlling_Type -- transformed into formals referencing Stub_Type. Since this -- primitive may have been inherited, go back the alias chain -- until the real primitive has been found. Current_Primitive_Alias := Ultimate_Alias (Current_Primitive); -- Copy the spec from the original declaration for the purpose -- of declaring an overriding subprogram: we need to replace -- the type of each controlling formal with Stub_Type. The -- primitive may have been declared for Controlling_Type or -- inherited from some ancestor type for which we do not have -- an easily determined Entity_Id. We have no systematic way -- of knowing which type to substitute Stub_Type for. Instead, -- Copy_Specification relies on the flag Is_Controlling_Formal -- to determine which formals to change. Current_Primitive_Spec := Copy_Specification (Loc, Spec => Parent (Current_Primitive_Alias), Ctrl_Type => Stub_Elements.Stub_Type); Current_Primitive_Decl := Make_Subprogram_Declaration (Loc, Specification => Current_Primitive_Spec); Insert_After_And_Analyze (Current_Insertion_Node, Current_Primitive_Decl); Current_Insertion_Node := Current_Primitive_Decl; Possibly_Asynchronous := Nkind (Current_Primitive_Spec) = N_Procedure_Specification and then Could_Be_Asynchronous (Current_Primitive_Spec); Assign_Subprogram_Identifier ( Defining_Unit_Name (Current_Primitive_Spec), Current_Primitive_Number, Subp_Str); if Build_Bodies then Current_Primitive_Body := Build_Subprogram_Calling_Stubs (Vis_Decl => Current_Primitive_Decl, Subp_Id => Build_Subprogram_Id (Loc, Defining_Unit_Name (Current_Primitive_Spec)), Asynchronous => Possibly_Asynchronous, Dynamically_Asynchronous => Possibly_Asynchronous, Stub_Type => Stub_Elements.Stub_Type, RACW_Type => Stub_Elements.RACW_Type); Append_To (Body_Decls, Current_Primitive_Body); -- Analyzing the body here would cause the Stub type to -- be frozen, thus preventing subsequent primitive -- declarations. For this reason, it will be analyzed -- later in the regular flow (and in the context of the -- appropriate unit body, see Append_RACW_Bodies). end if; -- Build the receiver stubs if Build_Bodies and then not Is_RAS then Current_Receiver_Body := Specific_Build_Subprogram_Receiving_Stubs (Vis_Decl => Current_Primitive_Decl, Asynchronous => Possibly_Asynchronous, Dynamically_Asynchronous => Possibly_Asynchronous, Stub_Type => Stub_Elements.Stub_Type, RACW_Type => Stub_Elements.RACW_Type, Parent_Primitive => Current_Primitive); Current_Receiver := Defining_Unit_Name (Specification (Current_Receiver_Body)); Append_To (Body_Decls, Current_Receiver_Body); -- Add a case alternative to the receiver if Get_PCS_Name = Name_PolyORB_DSA then Append_To (RPC_Receiver_Elsif_Parts, Make_Elsif_Part (Loc, Condition => Make_Function_Call (Loc, Name => New_Occurrence_Of ( RTE (RE_Caseless_String_Eq), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (RPC_Receiver_Subp_Id, Loc), Make_String_Literal (Loc, Subp_Str))), Then_Statements => New_List ( Make_Assignment_Statement (Loc, Name => New_Occurrence_Of ( RPC_Receiver_Subp_Index, Loc), Expression => Make_Integer_Literal (Loc, Intval => Current_Primitive_Number))))); end if; Append_To (RPC_Receiver_Case_Alternatives, Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List ( Make_Integer_Literal (Loc, Current_Primitive_Number)), Statements => New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Current_Receiver, Loc), Parameter_Associations => New_List ( New_Occurrence_Of (RPC_Receiver_Request, Loc)))))); end if; -- Increment the index of current primitive Current_Primitive_Number := Current_Primitive_Number + 1; end if; Next_Elmt (Current_Primitive_Elmt); end loop; end if; -- Build the case statement and the heart of the subprogram if Build_Bodies and then not Is_RAS then if Get_PCS_Name = Name_PolyORB_DSA and then Present (First (RPC_Receiver_Elsif_Parts)) then Append_To (RPC_Receiver_Statements, Make_Implicit_If_Statement (Designated_Type, Condition => New_Occurrence_Of (Standard_False, Loc), Then_Statements => New_List, Elsif_Parts => RPC_Receiver_Elsif_Parts)); end if; Append_To (RPC_Receiver_Case_Alternatives, Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List (Make_Others_Choice (Loc)), Statements => New_List (Make_Null_Statement (Loc)))); Append_To (RPC_Receiver_Statements, Make_Case_Statement (Loc, Expression => New_Occurrence_Of (RPC_Receiver_Subp_Index, Loc), Alternatives => RPC_Receiver_Case_Alternatives)); Append_To (Body_Decls, RPC_Receiver_Decl); Specific_Add_Obj_RPC_Receiver_Completion (Loc, Body_Decls, RPC_Receiver, Stub_Elements); -- Do not analyze RPC receiver body at this stage since it references -- subprograms that have not been analyzed yet. It will be analyzed in -- the regular flow (see Append_RACW_Bodies). end if; end Add_RACW_Primitive_Declarations_And_Bodies; ----------------------------- -- Add_RAS_Dereference_TSS -- ----------------------------- procedure Add_RAS_Dereference_TSS (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Type_Def : constant Node_Id := Type_Definition (N); RAS_Type : constant Entity_Id := Defining_Identifier (N); Fat_Type : constant Entity_Id := Equivalent_Type (RAS_Type); RACW_Type : constant Entity_Id := Underlying_RACW_Type (RAS_Type); RACW_Primitive_Name : Node_Id; Proc : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Make_TSS_Name (RAS_Type, TSS_RAS_Dereference)); Proc_Spec : Node_Id; Param_Specs : List_Id; Param_Assoc : constant List_Id := New_List; Stmts : constant List_Id := New_List; RAS_Parameter : constant Entity_Id := Make_Temporary (Loc, 'P'); Is_Function : constant Boolean := Nkind (Type_Def) = N_Access_Function_Definition; Is_Degenerate : Boolean; -- Set to True if the subprogram_specification for this RAS has an -- anonymous access parameter (see Process_Remote_AST_Declaration). Spec : constant Node_Id := Type_Def; Current_Parameter : Node_Id; -- Start of processing for Add_RAS_Dereference_TSS begin -- The Dereference TSS for a remote access-to-subprogram type has the -- form: -- [function|procedure] ras_typeRD (RAS_Value, <RAS_Parameters>) -- [return <>] -- This is called whenever a value of a RAS type is dereferenced -- First construct a list of parameter specifications: -- The first formal is the RAS values Param_Specs := New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => RAS_Parameter, In_Present => True, Parameter_Type => New_Occurrence_Of (Fat_Type, Loc))); -- The following formals are copied from the type declaration Is_Degenerate := False; Current_Parameter := First (Parameter_Specifications (Type_Def)); Parameters : while Present (Current_Parameter) loop if Nkind (Parameter_Type (Current_Parameter)) = N_Access_Definition then Is_Degenerate := True; end if; Append_To (Param_Specs, Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Chars => Chars (Defining_Identifier (Current_Parameter))), In_Present => In_Present (Current_Parameter), Out_Present => Out_Present (Current_Parameter), Parameter_Type => New_Copy_Tree (Parameter_Type (Current_Parameter)), Expression => New_Copy_Tree (Expression (Current_Parameter)))); Append_To (Param_Assoc, Make_Identifier (Loc, Chars => Chars (Defining_Identifier (Current_Parameter)))); Next (Current_Parameter); end loop Parameters; if Is_Degenerate then Prepend_To (Param_Assoc, New_Occurrence_Of (RAS_Parameter, Loc)); -- Generate a dummy body. This code will never actually be executed, -- because null is the only legal value for a degenerate RAS type. -- For legality's sake (in order to avoid generating a function that -- does not contain a return statement), we include a dummy recursive -- call on the TSS itself. Append_To (Stmts, Make_Raise_Program_Error (Loc, Reason => PE_Explicit_Raise)); RACW_Primitive_Name := New_Occurrence_Of (Proc, Loc); else -- For a normal RAS type, we cast the RAS formal to the corresponding -- tagged type, and perform a dispatching call to its Call primitive -- operation. Prepend_To (Param_Assoc, Unchecked_Convert_To (RACW_Type, New_Occurrence_Of (RAS_Parameter, Loc))); RACW_Primitive_Name := Make_Selected_Component (Loc, Prefix => Scope (RACW_Type), Selector_Name => Name_uCall); end if; if Is_Function then Append_To (Stmts, Make_Simple_Return_Statement (Loc, Expression => Make_Function_Call (Loc, Name => RACW_Primitive_Name, Parameter_Associations => Param_Assoc))); else Append_To (Stmts, Make_Procedure_Call_Statement (Loc, Name => RACW_Primitive_Name, Parameter_Associations => Param_Assoc)); end if; -- Build the complete subprogram if Is_Function then Proc_Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Proc, Parameter_Specifications => Param_Specs, Result_Definition => New_Occurrence_Of ( Entity (Result_Definition (Spec)), Loc)); Set_Ekind (Proc, E_Function); Set_Etype (Proc, New_Occurrence_Of (Entity (Result_Definition (Spec)), Loc)); else Proc_Spec := Make_Procedure_Specification (Loc, Defining_Unit_Name => Proc, Parameter_Specifications => Param_Specs); Set_Ekind (Proc, E_Procedure); Set_Etype (Proc, Standard_Void_Type); end if; Discard_Node ( Make_Subprogram_Body (Loc, Specification => Proc_Spec, Declarations => New_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts))); Set_TSS (Fat_Type, Proc); end Add_RAS_Dereference_TSS; ------------------------------- -- Add_RAS_Proxy_And_Analyze -- ------------------------------- procedure Add_RAS_Proxy_And_Analyze (Decls : List_Id; Vis_Decl : Node_Id; All_Calls_Remote_E : Entity_Id; Proxy_Object_Addr : out Entity_Id) is Loc : constant Source_Ptr := Sloc (Vis_Decl); Subp_Name : constant Entity_Id := Defining_Unit_Name (Specification (Vis_Decl)); Pkg_Name : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (Subp_Name), 'P', -1)); Proxy_Type : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Related_Id => Chars (Subp_Name), Suffix => 'P')); Proxy_Type_Full_View : constant Entity_Id := Make_Defining_Identifier (Loc, Chars (Proxy_Type)); Subp_Decl_Spec : constant Node_Id := Build_RAS_Primitive_Specification (Subp_Spec => Specification (Vis_Decl), Remote_Object_Type => Proxy_Type); Subp_Body_Spec : constant Node_Id := Build_RAS_Primitive_Specification (Subp_Spec => Specification (Vis_Decl), Remote_Object_Type => Proxy_Type); Vis_Decls : constant List_Id := New_List; Pvt_Decls : constant List_Id := New_List; Actuals : constant List_Id := New_List; Formal : Node_Id; Perform_Call : Node_Id; begin -- type subpP is tagged limited private; Append_To (Vis_Decls, Make_Private_Type_Declaration (Loc, Defining_Identifier => Proxy_Type, Tagged_Present => True, Limited_Present => True)); -- [subprogram] Call -- (Self : access subpP; -- ...other-formals...) -- [return T]; Append_To (Vis_Decls, Make_Subprogram_Declaration (Loc, Specification => Subp_Decl_Spec)); -- A : constant System.Address; Proxy_Object_Addr := Make_Defining_Identifier (Loc, Name_uA); Append_To (Vis_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Proxy_Object_Addr, Constant_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Address), Loc))); -- private -- type subpP is tagged limited record -- All_Calls_Remote : Boolean := [All_Calls_Remote?]; -- ... -- end record; Append_To (Pvt_Decls, Make_Full_Type_Declaration (Loc, Defining_Identifier => Proxy_Type_Full_View, Type_Definition => Build_Remote_Subprogram_Proxy_Type (Loc, New_Occurrence_Of (All_Calls_Remote_E, Loc)))); -- Trick semantic analysis into swapping the public and full view when -- freezing the public view. Set_Comes_From_Source (Proxy_Type_Full_View, True); -- procedure Call -- (Self : access O; -- ...other-formals...) is -- begin -- P (...other-formals...); -- end Call; -- function Call -- (Self : access O; -- ...other-formals...) -- return T is -- begin -- return F (...other-formals...); -- end Call; if Nkind (Subp_Decl_Spec) = N_Procedure_Specification then Perform_Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Subp_Name, Loc), Parameter_Associations => Actuals); else Perform_Call := Make_Simple_Return_Statement (Loc, Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (Subp_Name, Loc), Parameter_Associations => Actuals)); end if; Formal := First (Parameter_Specifications (Subp_Decl_Spec)); pragma Assert (Present (Formal)); loop Next (Formal); exit when No (Formal); Append_To (Actuals, New_Occurrence_Of (Defining_Identifier (Formal), Loc)); end loop; -- O : aliased subpP; Append_To (Pvt_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_uO), Aliased_Present => True, Object_Definition => New_Occurrence_Of (Proxy_Type, Loc))); -- A : constant System.Address := O'Address; Append_To (Pvt_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Chars (Proxy_Object_Addr)), Constant_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Address), Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of ( Defining_Identifier (Last (Pvt_Decls)), Loc), Attribute_Name => Name_Address))); Append_To (Decls, Make_Package_Declaration (Loc, Specification => Make_Package_Specification (Loc, Defining_Unit_Name => Pkg_Name, Visible_Declarations => Vis_Decls, Private_Declarations => Pvt_Decls, End_Label => Empty))); Analyze (Last (Decls)); Append_To (Decls, Make_Package_Body (Loc, Defining_Unit_Name => Make_Defining_Identifier (Loc, Chars (Pkg_Name)), Declarations => New_List ( Make_Subprogram_Body (Loc, Specification => Subp_Body_Spec, Declarations => New_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (Perform_Call)))))); Analyze (Last (Decls)); end Add_RAS_Proxy_And_Analyze; ----------------------- -- Add_RAST_Features -- ----------------------- procedure Add_RAST_Features (Vis_Decl : Node_Id) is RAS_Type : constant Entity_Id := Equivalent_Type (Defining_Identifier (Vis_Decl)); begin pragma Assert (No (TSS (RAS_Type, TSS_RAS_Access))); Add_RAS_Dereference_TSS (Vis_Decl); Specific_Add_RAST_Features (Vis_Decl, RAS_Type); end Add_RAST_Features; ------------------- -- Add_Stub_Type -- ------------------- procedure Add_Stub_Type (Designated_Type : Entity_Id; RACW_Type : Entity_Id; Decls : List_Id; Stub_Type : out Entity_Id; Stub_Type_Access : out Entity_Id; RPC_Receiver_Decl : out Node_Id; Body_Decls : out List_Id; Existing : out Boolean) is Loc : constant Source_Ptr := Sloc (RACW_Type); Stub_Elements : constant Stub_Structure := Stubs_Table.Get (Designated_Type); Stub_Type_Decl : Node_Id; Stub_Type_Access_Decl : Node_Id; begin if Stub_Elements /= Empty_Stub_Structure then Stub_Type := Stub_Elements.Stub_Type; Stub_Type_Access := Stub_Elements.Stub_Type_Access; RPC_Receiver_Decl := Stub_Elements.RPC_Receiver_Decl; Body_Decls := Stub_Elements.Body_Decls; Existing := True; return; end if; Existing := False; Stub_Type := Make_Temporary (Loc, 'S'); Set_Ekind (Stub_Type, E_Record_Type); Set_Is_RACW_Stub_Type (Stub_Type); Stub_Type_Access := Make_Defining_Identifier (Loc, Chars => New_External_Name (Related_Id => Chars (Stub_Type), Suffix => 'A')); RPC_Receiver_Decl := Specific_RPC_Receiver_Decl (RACW_Type); -- Create new stub type, copying components from generic RACW_Stub_Type Stub_Type_Decl := Make_Full_Type_Declaration (Loc, Defining_Identifier => Stub_Type, Type_Definition => Make_Record_Definition (Loc, Tagged_Present => True, Limited_Present => True, Component_List => Make_Component_List (Loc, Component_Items => Copy_Component_List (RTE (RE_RACW_Stub_Type), Loc)))); -- Does the stub type need to explicitly implement interfaces from the -- designated type??? -- In particular are there issues in the case where the designated type -- is a synchronized interface??? Stub_Type_Access_Decl := Make_Full_Type_Declaration (Loc, Defining_Identifier => Stub_Type_Access, Type_Definition => Make_Access_To_Object_Definition (Loc, All_Present => True, Subtype_Indication => New_Occurrence_Of (Stub_Type, Loc))); Append_To (Decls, Stub_Type_Decl); Analyze (Last (Decls)); Append_To (Decls, Stub_Type_Access_Decl); Analyze (Last (Decls)); -- We can't directly derive the stub type from the designated type, -- because we don't want any components or discriminants from the real -- type, so instead we manually fake a derivation to get an appropriate -- dispatch table. Derive_Subprograms (Parent_Type => Designated_Type, Derived_Type => Stub_Type); if Present (RPC_Receiver_Decl) then Append_To (Decls, RPC_Receiver_Decl); else -- Case of RACW implementing a RAS with the GARLIC PCS: there is -- no RPC receiver in that case, this is just an indication of -- where to insert code in the tree (see comment in declaration of -- type Stub_Structure). RPC_Receiver_Decl := Last (Decls); end if; Body_Decls := New_List; Stubs_Table.Set (Designated_Type, (Stub_Type => Stub_Type, Stub_Type_Access => Stub_Type_Access, RPC_Receiver_Decl => RPC_Receiver_Decl, Body_Decls => Body_Decls, RACW_Type => RACW_Type)); end Add_Stub_Type; ------------------------ -- Append_RACW_Bodies -- ------------------------ procedure Append_RACW_Bodies (Decls : List_Id; Spec_Id : Entity_Id) is E : Entity_Id; begin E := First_Entity (Spec_Id); while Present (E) loop if Is_Remote_Access_To_Class_Wide_Type (E) then Append_List_To (Decls, Get_And_Reset_RACW_Bodies (E)); end if; Next_Entity (E); end loop; end Append_RACW_Bodies; ---------------------------------- -- Assign_Subprogram_Identifier -- ---------------------------------- procedure Assign_Subprogram_Identifier (Def : Entity_Id; Spn : Int; Id : out String_Id) is N : constant Name_Id := Chars (Def); Overload_Order : constant Int := Overload_Counter_Table.Get (N) + 1; begin Overload_Counter_Table.Set (N, Overload_Order); Get_Name_String (N); -- Homonym handling: as in Exp_Dbug, but much simpler, because the only -- entities for which we have to generate names here need only to be -- disambiguated within their own scope. if Overload_Order > 1 then Name_Buffer (Name_Len + 1 .. Name_Len + 2) := "__"; Name_Len := Name_Len + 2; Add_Nat_To_Name_Buffer (Overload_Order); end if; Id := String_From_Name_Buffer; Subprogram_Identifier_Table.Set (Def, Subprogram_Identifiers'(Str_Identifier => Id, Int_Identifier => Spn)); end Assign_Subprogram_Identifier; ------------------------------------- -- Build_Actual_Object_Declaration -- ------------------------------------- procedure Build_Actual_Object_Declaration (Object : Entity_Id; Etyp : Entity_Id; Variable : Boolean; Expr : Node_Id; Decls : List_Id) is Loc : constant Source_Ptr := Sloc (Object); begin -- Declare a temporary object for the actual, possibly initialized with -- a 'Input/From_Any call. -- Complication arises in the case of limited types, for which such a -- declaration is illegal in Ada 95. In that case, we first generate a -- renaming declaration of the 'Input call, and then if needed we -- generate an overlaid non-constant view. if Ada_Version <= Ada_95 and then Is_Limited_Type (Etyp) and then Present (Expr) then -- Object : Etyp renames <func-call> Append_To (Decls, Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Object, Subtype_Mark => New_Occurrence_Of (Etyp, Loc), Name => Expr)); if Variable then -- The name defined by the renaming declaration denotes a -- constant view; create a non-constant object at the same address -- to be used as the actual. declare Constant_Object : constant Entity_Id := Make_Temporary (Loc, 'P'); begin Set_Defining_Identifier (Last (Decls), Constant_Object); -- We have an unconstrained Etyp: build the actual constrained -- subtype for the value we just read from the stream. -- subtype S is <actual subtype of Constant_Object>; Append_To (Decls, Build_Actual_Subtype (Etyp, New_Occurrence_Of (Constant_Object, Loc))); -- Object : S; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Object, Object_Definition => New_Occurrence_Of (Defining_Identifier (Last (Decls)), Loc))); Set_Ekind (Object, E_Variable); -- Suppress default initialization: -- pragma Import (Ada, Object); Append_To (Decls, Make_Pragma (Loc, Chars => Name_Import, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Chars => Name_Convention, Expression => Make_Identifier (Loc, Name_Ada)), Make_Pragma_Argument_Association (Loc, Chars => Name_Entity, Expression => New_Occurrence_Of (Object, Loc))))); -- for Object'Address use Constant_Object'Address; Append_To (Decls, Make_Attribute_Definition_Clause (Loc, Name => New_Occurrence_Of (Object, Loc), Chars => Name_Address, Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Constant_Object, Loc), Attribute_Name => Name_Address))); end; end if; else -- General case of a regular object declaration. Object is flagged -- constant unless it has mode out or in out, to allow the backend -- to optimize where possible. -- Object : [constant] Etyp [:= <expr>]; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Object, Constant_Present => Present (Expr) and then not Variable, Object_Definition => New_Occurrence_Of (Etyp, Loc), Expression => Expr)); if Constant_Present (Last (Decls)) then Set_Ekind (Object, E_Constant); else Set_Ekind (Object, E_Variable); end if; end if; end Build_Actual_Object_Declaration; ------------------------------ -- Build_Get_Unique_RP_Call -- ------------------------------ function Build_Get_Unique_RP_Call (Loc : Source_Ptr; Pointer : Entity_Id; Stub_Type : Entity_Id) return List_Id is begin return New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Unique_Remote_Pointer), Loc), Parameter_Associations => New_List ( Unchecked_Convert_To (RTE (RE_RACW_Stub_Type_Access), New_Occurrence_Of (Pointer, Loc)))), Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Pointer, Loc), Selector_Name => New_Occurrence_Of (First_Tag_Component (Designated_Type (Etype (Pointer))), Loc)), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stub_Type, Loc), Attribute_Name => Name_Tag))); -- Note: The assignment to Pointer._Tag is safe here because -- we carefully ensured that Stub_Type has exactly the same layout -- as System.Partition_Interface.RACW_Stub_Type. end Build_Get_Unique_RP_Call; ----------------------------------- -- Build_Ordered_Parameters_List -- ----------------------------------- function Build_Ordered_Parameters_List (Spec : Node_Id) return List_Id is Constrained_List : List_Id; Unconstrained_List : List_Id; Current_Parameter : Node_Id; Ptyp : Node_Id; First_Parameter : Node_Id; For_RAS : Boolean := False; begin if No (Parameter_Specifications (Spec)) then return New_List; end if; Constrained_List := New_List; Unconstrained_List := New_List; First_Parameter := First (Parameter_Specifications (Spec)); if Nkind (Parameter_Type (First_Parameter)) = N_Access_Definition and then Chars (Defining_Identifier (First_Parameter)) = Name_uS then For_RAS := True; end if; -- Loop through the parameters and add them to the right list. Note that -- we treat a parameter of a null-excluding access type as unconstrained -- because we can't declare an object of such a type with default -- initialization. Current_Parameter := First_Parameter; while Present (Current_Parameter) loop Ptyp := Parameter_Type (Current_Parameter); if (Nkind (Ptyp) = N_Access_Definition or else not Transmit_As_Unconstrained (Etype (Ptyp))) and then not (For_RAS and then Current_Parameter = First_Parameter) then Append_To (Constrained_List, New_Copy (Current_Parameter)); else Append_To (Unconstrained_List, New_Copy (Current_Parameter)); end if; Next (Current_Parameter); end loop; -- Unconstrained parameters are returned first Append_List_To (Unconstrained_List, Constrained_List); return Unconstrained_List; end Build_Ordered_Parameters_List; ---------------------------------- -- Build_Passive_Partition_Stub -- ---------------------------------- procedure Build_Passive_Partition_Stub (U : Node_Id) is Pkg_Spec : Node_Id; Pkg_Ent : Entity_Id; L : List_Id; Reg : Node_Id; Loc : constant Source_Ptr := Sloc (U); begin -- Verify that the implementation supports distribution, by accessing -- a type defined in the proper version of system.rpc declare Dist_OK : Entity_Id; pragma Warnings (Off, Dist_OK); begin Dist_OK := RTE (RE_Params_Stream_Type); end; -- Use body if present, spec otherwise if Nkind (U) = N_Package_Declaration then Pkg_Spec := Specification (U); L := Visible_Declarations (Pkg_Spec); else Pkg_Spec := Parent (Corresponding_Spec (U)); L := Declarations (U); end if; Pkg_Ent := Defining_Entity (Pkg_Spec); Reg := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Register_Passive_Package), Loc), Parameter_Associations => New_List ( Make_String_Literal (Loc, Fully_Qualified_Name_String (Pkg_Ent, Append_NUL => False)), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Pkg_Ent, Loc), Attribute_Name => Name_Version))); Append_To (L, Reg); Analyze (Reg); end Build_Passive_Partition_Stub; -------------------------------------- -- Build_RPC_Receiver_Specification -- -------------------------------------- function Build_RPC_Receiver_Specification (RPC_Receiver : Entity_Id; Request_Parameter : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (RPC_Receiver); begin return Make_Procedure_Specification (Loc, Defining_Unit_Name => RPC_Receiver, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Request_Parameter, Parameter_Type => New_Occurrence_Of (RTE (RE_Request_Access), Loc)))); end Build_RPC_Receiver_Specification; ---------------------------------------- -- Build_Remote_Subprogram_Proxy_Type -- ---------------------------------------- function Build_Remote_Subprogram_Proxy_Type (Loc : Source_Ptr; ACR_Expression : Node_Id) return Node_Id is begin return Make_Record_Definition (Loc, Tagged_Present => True, Limited_Present => True, Component_List => Make_Component_List (Loc, Component_Items => New_List ( Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_All_Calls_Remote), Component_Definition => Make_Component_Definition (Loc, Subtype_Indication => New_Occurrence_Of (Standard_Boolean, Loc)), Expression => ACR_Expression), Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_Receiver), Component_Definition => Make_Component_Definition (Loc, Subtype_Indication => New_Occurrence_Of (RTE (RE_Address), Loc)), Expression => New_Occurrence_Of (RTE (RE_Null_Address), Loc)), Make_Component_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_Subp_Id), Component_Definition => Make_Component_Definition (Loc, Subtype_Indication => New_Occurrence_Of (RTE (RE_Subprogram_Id), Loc)))))); end Build_Remote_Subprogram_Proxy_Type; -------------------- -- Build_Stub_Tag -- -------------------- function Build_Stub_Tag (Loc : Source_Ptr; RACW_Type : Entity_Id) return Node_Id is Stub_Type : constant Entity_Id := Corresponding_Stub_Type (RACW_Type); begin return Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stub_Type, Loc), Attribute_Name => Name_Tag); end Build_Stub_Tag; ------------------------------------ -- Build_Subprogram_Calling_Stubs -- ------------------------------------ function Build_Subprogram_Calling_Stubs (Vis_Decl : Node_Id; Subp_Id : Node_Id; Asynchronous : Boolean; Dynamically_Asynchronous : Boolean := False; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Locator : Entity_Id := Empty; New_Name : Name_Id := No_Name) return Node_Id is Loc : constant Source_Ptr := Sloc (Vis_Decl); Decls : constant List_Id := New_List; Statements : constant List_Id := New_List; Subp_Spec : Node_Id; -- The specification of the body Controlling_Parameter : Entity_Id := Empty; Asynchronous_Expr : Node_Id := Empty; RCI_Locator : Entity_Id; Spec_To_Use : Node_Id; procedure Insert_Partition_Check (Parameter : Node_Id); -- Check that the parameter has been elaborated on the same partition -- than the controlling parameter (E.4(19)). ---------------------------- -- Insert_Partition_Check -- ---------------------------- procedure Insert_Partition_Check (Parameter : Node_Id) is Parameter_Entity : constant Entity_Id := Defining_Identifier (Parameter); begin -- The expression that will be built is of the form: -- if not Same_Partition (Parameter, Controlling_Parameter) then -- raise Constraint_Error; -- end if; -- We do not check that Parameter is in Stub_Type since such a check -- has been inserted at the point of call already (a tag check since -- we have multiple controlling operands). Append_To (Decls, Make_Raise_Constraint_Error (Loc, Condition => Make_Op_Not (Loc, Right_Opnd => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Same_Partition), Loc), Parameter_Associations => New_List ( Unchecked_Convert_To (RTE (RE_RACW_Stub_Type_Access), New_Occurrence_Of (Parameter_Entity, Loc)), Unchecked_Convert_To (RTE (RE_RACW_Stub_Type_Access), New_Occurrence_Of (Controlling_Parameter, Loc))))), Reason => CE_Partition_Check_Failed)); end Insert_Partition_Check; -- Start of processing for Build_Subprogram_Calling_Stubs begin Subp_Spec := Copy_Specification (Loc, Spec => Specification (Vis_Decl), New_Name => New_Name); if Locator = Empty then RCI_Locator := RCI_Cache; Spec_To_Use := Specification (Vis_Decl); else RCI_Locator := Locator; Spec_To_Use := Subp_Spec; end if; -- Find a controlling argument if we have a stub type. Also check -- if this subprogram can be made asynchronous. if Present (Stub_Type) and then Present (Parameter_Specifications (Spec_To_Use)) then declare Current_Parameter : Node_Id := First (Parameter_Specifications (Spec_To_Use)); begin while Present (Current_Parameter) loop if Is_RACW_Controlling_Formal (Current_Parameter, Stub_Type) then if Controlling_Parameter = Empty then Controlling_Parameter := Defining_Identifier (Current_Parameter); else Insert_Partition_Check (Current_Parameter); end if; end if; Next (Current_Parameter); end loop; end; end if; pragma Assert (No (Stub_Type) or else Present (Controlling_Parameter)); if Dynamically_Asynchronous then Asynchronous_Expr := Make_Selected_Component (Loc, Prefix => Controlling_Parameter, Selector_Name => Name_Asynchronous); end if; Specific_Build_General_Calling_Stubs (Decls => Decls, Statements => Statements, Target => Specific_Build_Stub_Target (Loc, Decls, RCI_Locator, Controlling_Parameter), Subprogram_Id => Subp_Id, Asynchronous => Asynchronous_Expr, Is_Known_Asynchronous => Asynchronous and then not Dynamically_Asynchronous, Is_Known_Non_Asynchronous => not Asynchronous and then not Dynamically_Asynchronous, Is_Function => Nkind (Spec_To_Use) = N_Function_Specification, Spec => Spec_To_Use, Stub_Type => Stub_Type, RACW_Type => RACW_Type, Nod => Vis_Decl); RCI_Calling_Stubs_Table.Set (Defining_Unit_Name (Specification (Vis_Decl)), Defining_Unit_Name (Spec_To_Use)); return Make_Subprogram_Body (Loc, Specification => Subp_Spec, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements)); end Build_Subprogram_Calling_Stubs; ------------------------- -- Build_Subprogram_Id -- ------------------------- function Build_Subprogram_Id (Loc : Source_Ptr; E : Entity_Id) return Node_Id is begin if Get_Subprogram_Ids (E).Str_Identifier = No_String then declare Current_Declaration : Node_Id; Current_Subp : Entity_Id; Current_Subp_Str : String_Id; Current_Subp_Number : Int := First_RCI_Subprogram_Id; pragma Warnings (Off, Current_Subp_Str); begin -- Build_Subprogram_Id is called outside of the context of -- generating calling or receiving stubs. Hence we are processing -- an 'Access attribute_reference for an RCI subprogram, for the -- purpose of obtaining a RAS value. pragma Assert (Is_Remote_Call_Interface (Scope (E)) and then (Nkind (Parent (E)) = N_Procedure_Specification or else Nkind (Parent (E)) = N_Function_Specification)); Current_Declaration := First (Visible_Declarations (Package_Specification_Of_Scope (Scope (E)))); while Present (Current_Declaration) loop if Nkind (Current_Declaration) = N_Subprogram_Declaration and then Comes_From_Source (Current_Declaration) then Current_Subp := Defining_Unit_Name (Specification ( Current_Declaration)); Assign_Subprogram_Identifier (Current_Subp, Current_Subp_Number, Current_Subp_Str); Current_Subp_Number := Current_Subp_Number + 1; end if; Next (Current_Declaration); end loop; end; end if; case Get_PCS_Name is when Name_PolyORB_DSA => return Make_String_Literal (Loc, Get_Subprogram_Id (E)); when others => return Make_Integer_Literal (Loc, Get_Subprogram_Id (E)); end case; end Build_Subprogram_Id; ------------------------ -- Copy_Specification -- ------------------------ function Copy_Specification (Loc : Source_Ptr; Spec : Node_Id; Ctrl_Type : Entity_Id := Empty; New_Name : Name_Id := No_Name) return Node_Id is Parameters : List_Id := No_List; Current_Parameter : Node_Id; Current_Identifier : Entity_Id; Current_Type : Node_Id; Name_For_New_Spec : Name_Id; New_Identifier : Entity_Id; -- Comments needed in body below ??? begin if New_Name = No_Name then pragma Assert (Nkind (Spec) = N_Function_Specification or else Nkind (Spec) = N_Procedure_Specification); Name_For_New_Spec := Chars (Defining_Unit_Name (Spec)); else Name_For_New_Spec := New_Name; end if; if Present (Parameter_Specifications (Spec)) then Parameters := New_List; Current_Parameter := First (Parameter_Specifications (Spec)); while Present (Current_Parameter) loop Current_Identifier := Defining_Identifier (Current_Parameter); Current_Type := Parameter_Type (Current_Parameter); if Nkind (Current_Type) = N_Access_Definition then if Present (Ctrl_Type) then pragma Assert (Is_Controlling_Formal (Current_Identifier)); Current_Type := Make_Access_Definition (Loc, Subtype_Mark => New_Occurrence_Of (Ctrl_Type, Loc), Null_Exclusion_Present => Null_Exclusion_Present (Current_Type)); else Current_Type := Make_Access_Definition (Loc, Subtype_Mark => New_Copy_Tree (Subtype_Mark (Current_Type)), Null_Exclusion_Present => Null_Exclusion_Present (Current_Type)); end if; else if Present (Ctrl_Type) and then Is_Controlling_Formal (Current_Identifier) then Current_Type := New_Occurrence_Of (Ctrl_Type, Loc); else Current_Type := New_Copy_Tree (Current_Type); end if; end if; New_Identifier := Make_Defining_Identifier (Loc, Chars (Current_Identifier)); Append_To (Parameters, Make_Parameter_Specification (Loc, Defining_Identifier => New_Identifier, Parameter_Type => Current_Type, In_Present => In_Present (Current_Parameter), Out_Present => Out_Present (Current_Parameter), Expression => New_Copy_Tree (Expression (Current_Parameter)))); -- For a regular formal parameter (that needs to be marshalled -- in the context of remote calls), set the Etype now, because -- marshalling processing might need it. if Is_Entity_Name (Current_Type) then Set_Etype (New_Identifier, Entity (Current_Type)); -- Current_Type is an access definition, special processing -- (not requiring etype) will occur for marshalling. else null; end if; Next (Current_Parameter); end loop; end if; case Nkind (Spec) is when N_Access_Function_Definition | N_Function_Specification => return Make_Function_Specification (Loc, Defining_Unit_Name => Make_Defining_Identifier (Loc, Chars => Name_For_New_Spec), Parameter_Specifications => Parameters, Result_Definition => New_Occurrence_Of (Entity (Result_Definition (Spec)), Loc)); when N_Access_Procedure_Definition | N_Procedure_Specification => return Make_Procedure_Specification (Loc, Defining_Unit_Name => Make_Defining_Identifier (Loc, Chars => Name_For_New_Spec), Parameter_Specifications => Parameters); when others => raise Program_Error; end case; end Copy_Specification; ----------------------------- -- Corresponding_Stub_Type -- ----------------------------- function Corresponding_Stub_Type (RACW_Type : Entity_Id) return Entity_Id is Desig : constant Entity_Id := Etype (Designated_Type (RACW_Type)); Stub_Elements : constant Stub_Structure := Stubs_Table.Get (Desig); begin return Stub_Elements.Stub_Type; end Corresponding_Stub_Type; --------------------------- -- Could_Be_Asynchronous -- --------------------------- function Could_Be_Asynchronous (Spec : Node_Id) return Boolean is Current_Parameter : Node_Id; begin if Present (Parameter_Specifications (Spec)) then Current_Parameter := First (Parameter_Specifications (Spec)); while Present (Current_Parameter) loop if Out_Present (Current_Parameter) then return False; end if; Next (Current_Parameter); end loop; end if; return True; end Could_Be_Asynchronous; --------------------------- -- Declare_Create_NVList -- --------------------------- procedure Declare_Create_NVList (Loc : Source_Ptr; NVList : Entity_Id; Decls : List_Id; Stmts : List_Id) is begin Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => NVList, Aliased_Present => False, Object_Definition => New_Occurrence_Of (RTE (RE_NVList_Ref), Loc))); Append_To (Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_NVList_Create), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (NVList, Loc)))); end Declare_Create_NVList; --------------------------------------------- -- Expand_All_Calls_Remote_Subprogram_Call -- --------------------------------------------- procedure Expand_All_Calls_Remote_Subprogram_Call (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Called_Subprogram : constant Entity_Id := Entity (Name (N)); RCI_Package : constant Entity_Id := Scope (Called_Subprogram); RCI_Locator_Decl : Node_Id; RCI_Locator : Entity_Id; Calling_Stubs : Node_Id; E_Calling_Stubs : Entity_Id; begin E_Calling_Stubs := RCI_Calling_Stubs_Table.Get (Called_Subprogram); if E_Calling_Stubs = Empty then RCI_Locator := RCI_Locator_Table.Get (RCI_Package); -- The RCI_Locator package and calling stub are is inserted at the -- top level in the current unit, and must appear in the proper scope -- so that it is not prematurely removed by the GCC back end. declare Scop : constant Entity_Id := Cunit_Entity (Current_Sem_Unit); begin if Ekind (Scop) = E_Package_Body then Push_Scope (Spec_Entity (Scop)); elsif Ekind (Scop) = E_Subprogram_Body then Push_Scope (Corresponding_Spec (Unit_Declaration_Node (Scop))); else Push_Scope (Scop); end if; end; if RCI_Locator = Empty then RCI_Locator_Decl := RCI_Package_Locator (Loc, Package_Specification (RCI_Package)); Prepend_To (Current_Sem_Unit_Declarations, RCI_Locator_Decl); Analyze (RCI_Locator_Decl); RCI_Locator := Defining_Unit_Name (RCI_Locator_Decl); else RCI_Locator_Decl := Parent (RCI_Locator); end if; Calling_Stubs := Build_Subprogram_Calling_Stubs (Vis_Decl => Parent (Parent (Called_Subprogram)), Subp_Id => Build_Subprogram_Id (Loc, Called_Subprogram), Asynchronous => Nkind (N) = N_Procedure_Call_Statement and then Is_Asynchronous (Called_Subprogram), Locator => RCI_Locator, New_Name => New_Internal_Name ('S')); Insert_After (RCI_Locator_Decl, Calling_Stubs); Analyze (Calling_Stubs); Pop_Scope; E_Calling_Stubs := Defining_Unit_Name (Specification (Calling_Stubs)); end if; Rewrite (Name (N), New_Occurrence_Of (E_Calling_Stubs, Loc)); end Expand_All_Calls_Remote_Subprogram_Call; --------------------------------- -- Expand_Calling_Stubs_Bodies -- --------------------------------- procedure Expand_Calling_Stubs_Bodies (Unit_Node : Node_Id) is Spec : constant Node_Id := Specification (Unit_Node); begin Add_Calling_Stubs_To_Declarations (Spec); end Expand_Calling_Stubs_Bodies; ----------------------------------- -- Expand_Receiving_Stubs_Bodies -- ----------------------------------- procedure Expand_Receiving_Stubs_Bodies (Unit_Node : Node_Id) is Spec : Node_Id; Decls : List_Id; Stubs_Decls : List_Id; Stubs_Stmts : List_Id; begin if Nkind (Unit_Node) = N_Package_Declaration then Spec := Specification (Unit_Node); Decls := Private_Declarations (Spec); if No (Decls) then Decls := Visible_Declarations (Spec); end if; Push_Scope (Scope_Of_Spec (Spec)); Specific_Add_Receiving_Stubs_To_Declarations (Spec, Decls, Decls); else Spec := Package_Specification_Of_Scope (Corresponding_Spec (Unit_Node)); Decls := Declarations (Unit_Node); Push_Scope (Scope_Of_Spec (Unit_Node)); Stubs_Decls := New_List; Stubs_Stmts := New_List; Specific_Add_Receiving_Stubs_To_Declarations (Spec, Stubs_Decls, Stubs_Stmts); Insert_List_Before (First (Decls), Stubs_Decls); declare HSS_Stmts : constant List_Id := Statements (Handled_Statement_Sequence (Unit_Node)); First_HSS_Stmt : constant Node_Id := First (HSS_Stmts); begin if No (First_HSS_Stmt) then Append_List_To (HSS_Stmts, Stubs_Stmts); else Insert_List_Before (First_HSS_Stmt, Stubs_Stmts); end if; end; end if; Pop_Scope; end Expand_Receiving_Stubs_Bodies; -------------------- -- GARLIC_Support -- -------------------- package body GARLIC_Support is -- Local subprograms procedure Add_RACW_Read_Attribute (RACW_Type : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; Body_Decls : List_Id); -- Add Read attribute for the RACW type. The declaration and attribute -- definition clauses are inserted right after the declaration of -- RACW_Type. If Body_Decls is not No_List, the subprogram body is -- appended to it (case where the RACW declaration is in the main unit). procedure Add_RACW_Write_Attribute (RACW_Type : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; RPC_Receiver : Node_Id; Body_Decls : List_Id); -- Same as above for the Write attribute function Stream_Parameter return Node_Id; function Result return Node_Id; function Object return Node_Id renames Result; -- Functions to create occurrences of the formal parameter names of the -- 'Read and 'Write attributes. Loc : Source_Ptr; -- Shared source location used by Add_{Read,Write}_Read_Attribute and -- their ancillary subroutines (set on entry by Add_RACW_Features). procedure Add_RAS_Access_TSS (N : Node_Id); -- Add a subprogram body for RAS Access TSS ------------------------------------- -- Add_Obj_RPC_Receiver_Completion -- ------------------------------------- procedure Add_Obj_RPC_Receiver_Completion (Loc : Source_Ptr; Decls : List_Id; RPC_Receiver : Entity_Id; Stub_Elements : Stub_Structure) is begin -- The RPC receiver body should not be the completion of the -- declaration recorded in the stub structure, because then the -- occurrences of the formal parameters within the body should refer -- to the entities from the declaration, not from the completion, to -- which we do not have easy access. Instead, the RPC receiver body -- acts as its own declaration, and the RPC receiver declaration is -- completed by a renaming-as-body. Append_To (Decls, Make_Subprogram_Renaming_Declaration (Loc, Specification => Copy_Specification (Loc, Specification (Stub_Elements.RPC_Receiver_Decl)), Name => New_Occurrence_Of (RPC_Receiver, Loc))); end Add_Obj_RPC_Receiver_Completion; ----------------------- -- Add_RACW_Features -- ----------------------- procedure Add_RACW_Features (RACW_Type : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; RPC_Receiver_Decl : Node_Id; Body_Decls : List_Id) is RPC_Receiver : Node_Id; Is_RAS : constant Boolean := not Comes_From_Source (RACW_Type); begin Loc := Sloc (RACW_Type); if Is_RAS then -- For a RAS, the RPC receiver is that of the RCI unit, not that -- of the corresponding distributed object type. We retrieve its -- address from the local proxy object. RPC_Receiver := Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (RTE (RE_RAS_Proxy_Type_Access), Object), Selector_Name => Make_Identifier (Loc, Name_Receiver)); else RPC_Receiver := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of ( Defining_Unit_Name (Specification (RPC_Receiver_Decl)), Loc), Attribute_Name => Name_Address); end if; Add_RACW_Write_Attribute (RACW_Type, Stub_Type, Stub_Type_Access, RPC_Receiver, Body_Decls); Add_RACW_Read_Attribute (RACW_Type, Stub_Type, Stub_Type_Access, Body_Decls); end Add_RACW_Features; ----------------------------- -- Add_RACW_Read_Attribute -- ----------------------------- procedure Add_RACW_Read_Attribute (RACW_Type : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; Body_Decls : List_Id) is Proc_Decl : Node_Id; Attr_Decl : Node_Id; Body_Node : Node_Id; Statements : constant List_Id := New_List; Decls : List_Id; Local_Statements : List_Id; Remote_Statements : List_Id; -- Various parts of the procedure Pnam : constant Entity_Id := Make_Temporary (Loc, 'R'); Asynchronous_Flag : constant Entity_Id := Asynchronous_Flags_Table.Get (RACW_Type); pragma Assert (Present (Asynchronous_Flag)); -- Prepare local identifiers Source_Partition : Entity_Id; Source_Receiver : Entity_Id; Source_Address : Entity_Id; Local_Stub : Entity_Id; Stubbed_Result : Entity_Id; -- Start of processing for Add_RACW_Read_Attribute begin Build_Stream_Procedure (Loc, RACW_Type, Body_Node, Pnam, Statements, Outp => True); Proc_Decl := Make_Subprogram_Declaration (Loc, Copy_Specification (Loc, Specification (Body_Node))); Attr_Decl := Make_Attribute_Definition_Clause (Loc, Name => New_Occurrence_Of (RACW_Type, Loc), Chars => Name_Read, Expression => New_Occurrence_Of ( Defining_Unit_Name (Specification (Proc_Decl)), Loc)); Insert_After (Declaration_Node (RACW_Type), Proc_Decl); Insert_After (Proc_Decl, Attr_Decl); if No (Body_Decls) then -- Case of processing an RACW type from another unit than the -- main one: do not generate a body. return; end if; -- Prepare local identifiers Source_Partition := Make_Temporary (Loc, 'P'); Source_Receiver := Make_Temporary (Loc, 'S'); Source_Address := Make_Temporary (Loc, 'P'); Local_Stub := Make_Temporary (Loc, 'L'); Stubbed_Result := Make_Temporary (Loc, 'S'); -- Generate object declarations Decls := New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Source_Partition, Object_Definition => New_Occurrence_Of (RTE (RE_Partition_ID), Loc)), Make_Object_Declaration (Loc, Defining_Identifier => Source_Receiver, Object_Definition => New_Occurrence_Of (RTE (RE_Unsigned_64), Loc)), Make_Object_Declaration (Loc, Defining_Identifier => Source_Address, Object_Definition => New_Occurrence_Of (RTE (RE_Unsigned_64), Loc)), Make_Object_Declaration (Loc, Defining_Identifier => Local_Stub, Aliased_Present => True, Object_Definition => New_Occurrence_Of (Stub_Type, Loc)), Make_Object_Declaration (Loc, Defining_Identifier => Stubbed_Result, Object_Definition => New_Occurrence_Of (Stub_Type_Access, Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Local_Stub, Loc), Attribute_Name => Name_Unchecked_Access))); -- Read the source Partition_ID and RPC_Receiver from incoming stream Append_List_To (Statements, New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Partition_ID), Loc), Attribute_Name => Name_Read, Expressions => New_List ( Stream_Parameter, New_Occurrence_Of (Source_Partition, Loc))), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Unsigned_64), Loc), Attribute_Name => Name_Read, Expressions => New_List ( Stream_Parameter, New_Occurrence_Of (Source_Receiver, Loc))), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Unsigned_64), Loc), Attribute_Name => Name_Read, Expressions => New_List ( Stream_Parameter, New_Occurrence_Of (Source_Address, Loc))))); -- Build_Get_Unique_RP_Call needs the type of Stubbed_Result Set_Etype (Stubbed_Result, Stub_Type_Access); -- If the Address is Null_Address, then return a null object, unless -- RACW_Type is null-excluding, in which case unconditionally raise -- CONSTRAINT_ERROR instead. declare Zero_Statements : List_Id; -- Statements executed when a zero value is received begin if Can_Never_Be_Null (RACW_Type) then Zero_Statements := New_List ( Make_Raise_Constraint_Error (Loc, Reason => CE_Null_Not_Allowed)); else Zero_Statements := New_List ( Make_Assignment_Statement (Loc, Name => Result, Expression => Make_Null (Loc)), Make_Simple_Return_Statement (Loc)); end if; Append_To (Statements, Make_Implicit_If_Statement (RACW_Type, Condition => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (Source_Address, Loc), Right_Opnd => Make_Integer_Literal (Loc, Uint_0)), Then_Statements => Zero_Statements)); end; -- If the RACW denotes an object created on the current partition, -- Local_Statements will be executed. The real object will be used. Local_Statements := New_List ( Make_Assignment_Statement (Loc, Name => Result, Expression => Unchecked_Convert_To (RACW_Type, OK_Convert_To (RTE (RE_Address), New_Occurrence_Of (Source_Address, Loc))))); -- If the object is located on another partition, then a stub object -- will be created with all the information needed to rebuild the -- real object at the other end. Remote_Statements := New_List ( Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => Stubbed_Result, Selector_Name => Name_Origin), Expression => New_Occurrence_Of (Source_Partition, Loc)), Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => Stubbed_Result, Selector_Name => Name_Receiver), Expression => New_Occurrence_Of (Source_Receiver, Loc)), Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => Stubbed_Result, Selector_Name => Name_Addr), Expression => New_Occurrence_Of (Source_Address, Loc))); Append_To (Remote_Statements, Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => Stubbed_Result, Selector_Name => Name_Asynchronous), Expression => New_Occurrence_Of (Asynchronous_Flag, Loc))); Append_List_To (Remote_Statements, Build_Get_Unique_RP_Call (Loc, Stubbed_Result, Stub_Type)); -- ??? Issue with asynchronous calls here: the Asynchronous flag is -- set on the stub type if, and only if, the RACW type has a pragma -- Asynchronous. This is incorrect for RACWs that implement RAS -- types, because in that case the /designated subprogram/ (not the -- type) might be asynchronous, and that causes the stub to need to -- be asynchronous too. A solution is to transport a RAS as a struct -- containing a RACW and an asynchronous flag, and to properly alter -- the Asynchronous component in the stub type in the RAS's Input -- TSS. Append_To (Remote_Statements, Make_Assignment_Statement (Loc, Name => Result, Expression => Unchecked_Convert_To (RACW_Type, New_Occurrence_Of (Stubbed_Result, Loc)))); -- Distinguish between the local and remote cases, and execute the -- appropriate piece of code. Append_To (Statements, Make_Implicit_If_Statement (RACW_Type, Condition => Make_Op_Eq (Loc, Left_Opnd => Make_Function_Call (Loc, Name => New_Occurrence_Of ( RTE (RE_Get_Local_Partition_Id), Loc)), Right_Opnd => New_Occurrence_Of (Source_Partition, Loc)), Then_Statements => Local_Statements, Else_Statements => Remote_Statements)); Set_Declarations (Body_Node, Decls); Append_To (Body_Decls, Body_Node); end Add_RACW_Read_Attribute; ------------------------------ -- Add_RACW_Write_Attribute -- ------------------------------ procedure Add_RACW_Write_Attribute (RACW_Type : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; RPC_Receiver : Node_Id; Body_Decls : List_Id) is Body_Node : Node_Id; Proc_Decl : Node_Id; Attr_Decl : Node_Id; Statements : constant List_Id := New_List; Local_Statements : List_Id; Remote_Statements : List_Id; Null_Statements : List_Id; Pnam : constant Entity_Id := Make_Temporary (Loc, 'R'); begin Build_Stream_Procedure (Loc, RACW_Type, Body_Node, Pnam, Statements, Outp => False); Proc_Decl := Make_Subprogram_Declaration (Loc, Copy_Specification (Loc, Specification (Body_Node))); Attr_Decl := Make_Attribute_Definition_Clause (Loc, Name => New_Occurrence_Of (RACW_Type, Loc), Chars => Name_Write, Expression => New_Occurrence_Of ( Defining_Unit_Name (Specification (Proc_Decl)), Loc)); Insert_After (Declaration_Node (RACW_Type), Proc_Decl); Insert_After (Proc_Decl, Attr_Decl); if No (Body_Decls) then return; end if; -- Build the code fragment corresponding to the marshalling of a -- local object. Local_Statements := New_List ( Pack_Entity_Into_Stream_Access (Loc, Stream => Stream_Parameter, Object => RTE (RE_Get_Local_Partition_Id)), Pack_Node_Into_Stream_Access (Loc, Stream => Stream_Parameter, Object => OK_Convert_To (RTE (RE_Unsigned_64), RPC_Receiver), Etyp => RTE (RE_Unsigned_64)), Pack_Node_Into_Stream_Access (Loc, Stream => Stream_Parameter, Object => OK_Convert_To (RTE (RE_Unsigned_64), Make_Attribute_Reference (Loc, Prefix => Make_Explicit_Dereference (Loc, Prefix => Object), Attribute_Name => Name_Address)), Etyp => RTE (RE_Unsigned_64))); -- Build the code fragment corresponding to the marshalling of -- a remote object. Remote_Statements := New_List ( Pack_Node_Into_Stream_Access (Loc, Stream => Stream_Parameter, Object => Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (Stub_Type_Access, Object), Selector_Name => Make_Identifier (Loc, Name_Origin)), Etyp => RTE (RE_Partition_ID)), Pack_Node_Into_Stream_Access (Loc, Stream => Stream_Parameter, Object => Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (Stub_Type_Access, Object), Selector_Name => Make_Identifier (Loc, Name_Receiver)), Etyp => RTE (RE_Unsigned_64)), Pack_Node_Into_Stream_Access (Loc, Stream => Stream_Parameter, Object => Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (Stub_Type_Access, Object), Selector_Name => Make_Identifier (Loc, Name_Addr)), Etyp => RTE (RE_Unsigned_64))); -- Build code fragment corresponding to marshalling of a null object Null_Statements := New_List ( Pack_Entity_Into_Stream_Access (Loc, Stream => Stream_Parameter, Object => RTE (RE_Get_Local_Partition_Id)), Pack_Node_Into_Stream_Access (Loc, Stream => Stream_Parameter, Object => OK_Convert_To (RTE (RE_Unsigned_64), RPC_Receiver), Etyp => RTE (RE_Unsigned_64)), Pack_Node_Into_Stream_Access (Loc, Stream => Stream_Parameter, Object => Make_Integer_Literal (Loc, Uint_0), Etyp => RTE (RE_Unsigned_64))); Append_To (Statements, Make_Implicit_If_Statement (RACW_Type, Condition => Make_Op_Eq (Loc, Left_Opnd => Object, Right_Opnd => Make_Null (Loc)), Then_Statements => Null_Statements, Elsif_Parts => New_List ( Make_Elsif_Part (Loc, Condition => Make_Op_Eq (Loc, Left_Opnd => Make_Attribute_Reference (Loc, Prefix => Object, Attribute_Name => Name_Tag), Right_Opnd => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stub_Type, Loc), Attribute_Name => Name_Tag)), Then_Statements => Remote_Statements)), Else_Statements => Local_Statements)); Append_To (Body_Decls, Body_Node); end Add_RACW_Write_Attribute; ------------------------ -- Add_RAS_Access_TSS -- ------------------------ procedure Add_RAS_Access_TSS (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Ras_Type : constant Entity_Id := Defining_Identifier (N); Fat_Type : constant Entity_Id := Equivalent_Type (Ras_Type); -- Ras_Type is the access to subprogram type while Fat_Type is the -- corresponding record type. RACW_Type : constant Entity_Id := Underlying_RACW_Type (Ras_Type); Desig : constant Entity_Id := Etype (Designated_Type (RACW_Type)); Stub_Elements : constant Stub_Structure := Stubs_Table.Get (Desig); pragma Assert (Stub_Elements /= Empty_Stub_Structure); Proc : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Make_TSS_Name (Ras_Type, TSS_RAS_Access)); Proc_Spec : Node_Id; -- Formal parameters Package_Name : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Name_P); -- Target package Subp_Id : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Name_S); -- Target subprogram Asynch_P : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Name_Asynchronous); -- Is the procedure to which the 'Access applies asynchronous? All_Calls_Remote : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Name_All_Calls_Remote); -- True if an All_Calls_Remote pragma applies to the RCI unit -- that contains the subprogram. -- Common local variables Proc_Decls : List_Id; Proc_Statements : List_Id; Origin : constant Entity_Id := Make_Temporary (Loc, 'P'); -- Additional local variables for the local case Proxy_Addr : constant Entity_Id := Make_Temporary (Loc, 'P'); -- Additional local variables for the remote case Local_Stub : constant Entity_Id := Make_Temporary (Loc, 'L'); Stub_Ptr : constant Entity_Id := Make_Temporary (Loc, 'S'); function Set_Field (Field_Name : Name_Id; Value : Node_Id) return Node_Id; -- Construct an assignment that sets the named component in the -- returned record --------------- -- Set_Field -- --------------- function Set_Field (Field_Name : Name_Id; Value : Node_Id) return Node_Id is begin return Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => Stub_Ptr, Selector_Name => Field_Name), Expression => Value); end Set_Field; -- Start of processing for Add_RAS_Access_TSS begin Proc_Decls := New_List ( -- Common declarations Make_Object_Declaration (Loc, Defining_Identifier => Origin, Constant_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Partition_ID), Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Active_Partition_Id), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Package_Name, Loc)))), -- Declaration use only in the local case: proxy address Make_Object_Declaration (Loc, Defining_Identifier => Proxy_Addr, Object_Definition => New_Occurrence_Of (RTE (RE_Unsigned_64), Loc)), -- Declarations used only in the remote case: stub object and -- stub pointer. Make_Object_Declaration (Loc, Defining_Identifier => Local_Stub, Aliased_Present => True, Object_Definition => New_Occurrence_Of (Stub_Elements.Stub_Type, Loc)), Make_Object_Declaration (Loc, Defining_Identifier => Stub_Ptr, Object_Definition => New_Occurrence_Of (Stub_Elements.Stub_Type_Access, Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Local_Stub, Loc), Attribute_Name => Name_Unchecked_Access))); Set_Etype (Stub_Ptr, Stub_Elements.Stub_Type_Access); -- Build_Get_Unique_RP_Call needs above information -- Note: Here we assume that the Fat_Type is a record -- containing just a pointer to a proxy or stub object. Proc_Statements := New_List ( -- Generate: -- Get_RAS_Info (Pkg, Subp, PA); -- if Origin = Local_Partition_Id -- and then not All_Calls_Remote -- then -- return Fat_Type!(PA); -- end if; Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Get_RAS_Info), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Package_Name, Loc), New_Occurrence_Of (Subp_Id, Loc), New_Occurrence_Of (Proxy_Addr, Loc))), Make_Implicit_If_Statement (N, Condition => Make_And_Then (Loc, Left_Opnd => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (Origin, Loc), Right_Opnd => Make_Function_Call (Loc, New_Occurrence_Of ( RTE (RE_Get_Local_Partition_Id), Loc))), Right_Opnd => Make_Op_Not (Loc, New_Occurrence_Of (All_Calls_Remote, Loc))), Then_Statements => New_List ( Make_Simple_Return_Statement (Loc, Unchecked_Convert_To (Fat_Type, OK_Convert_To (RTE (RE_Address), New_Occurrence_Of (Proxy_Addr, Loc)))))), Set_Field (Name_Origin, New_Occurrence_Of (Origin, Loc)), Set_Field (Name_Receiver, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_RCI_Package_Receiver), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Package_Name, Loc)))), Set_Field (Name_Addr, New_Occurrence_Of (Proxy_Addr, Loc)), -- E.4.1(9) A remote call is asynchronous if it is a call to -- a procedure or a call through a value of an access-to-procedure -- type to which a pragma Asynchronous applies. -- Asynch_P is true when the procedure is asynchronous; -- Asynch_T is true when the type is asynchronous. Set_Field (Name_Asynchronous, Make_Or_Else (Loc, New_Occurrence_Of (Asynch_P, Loc), New_Occurrence_Of (Boolean_Literals ( Is_Asynchronous (Ras_Type)), Loc)))); Append_List_To (Proc_Statements, Build_Get_Unique_RP_Call (Loc, Stub_Ptr, Stub_Elements.Stub_Type)); -- Return the newly created value Append_To (Proc_Statements, Make_Simple_Return_Statement (Loc, Expression => Unchecked_Convert_To (Fat_Type, New_Occurrence_Of (Stub_Ptr, Loc)))); Proc_Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Proc, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Package_Name, Parameter_Type => New_Occurrence_Of (Standard_String, Loc)), Make_Parameter_Specification (Loc, Defining_Identifier => Subp_Id, Parameter_Type => New_Occurrence_Of (RTE (RE_Subprogram_Id), Loc)), Make_Parameter_Specification (Loc, Defining_Identifier => Asynch_P, Parameter_Type => New_Occurrence_Of (Standard_Boolean, Loc)), Make_Parameter_Specification (Loc, Defining_Identifier => All_Calls_Remote, Parameter_Type => New_Occurrence_Of (Standard_Boolean, Loc))), Result_Definition => New_Occurrence_Of (Fat_Type, Loc)); -- Set the kind and return type of the function to prevent -- ambiguities between Ras_Type and Fat_Type in subsequent analysis. Set_Ekind (Proc, E_Function); Set_Etype (Proc, Fat_Type); Discard_Node ( Make_Subprogram_Body (Loc, Specification => Proc_Spec, Declarations => Proc_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Proc_Statements))); Set_TSS (Fat_Type, Proc); end Add_RAS_Access_TSS; ----------------------- -- Add_RAST_Features -- ----------------------- procedure Add_RAST_Features (Vis_Decl : Node_Id; RAS_Type : Entity_Id) is pragma Unreferenced (RAS_Type); begin Add_RAS_Access_TSS (Vis_Decl); end Add_RAST_Features; ----------------------------------------- -- Add_Receiving_Stubs_To_Declarations -- ----------------------------------------- procedure Add_Receiving_Stubs_To_Declarations (Pkg_Spec : Node_Id; Decls : List_Id; Stmts : List_Id) is Loc : constant Source_Ptr := Sloc (Pkg_Spec); Request_Parameter : Node_Id; Pkg_RPC_Receiver : constant Entity_Id := Make_Temporary (Loc, 'H'); Pkg_RPC_Receiver_Statements : List_Id; Pkg_RPC_Receiver_Cases : constant List_Id := New_List; Pkg_RPC_Receiver_Body : Node_Id; -- A Pkg_RPC_Receiver is built to decode the request Lookup_RAS : Node_Id; Lookup_RAS_Info : constant Entity_Id := Make_Temporary (Loc, 'R'); -- A remote subprogram is created to allow peers to look up RAS -- information using subprogram ids. Subp_Id : Entity_Id; Subp_Index : Entity_Id; -- Subprogram_Id as read from the incoming stream Current_Subp_Number : Int := First_RCI_Subprogram_Id; Current_Stubs : Node_Id; Subp_Info_Array : constant Entity_Id := Make_Temporary (Loc, 'I'); Subp_Info_List : constant List_Id := New_List; Register_Pkg_Actuals : constant List_Id := New_List; All_Calls_Remote_E : Entity_Id; Proxy_Object_Addr : Entity_Id; procedure Append_Stubs_To (RPC_Receiver_Cases : List_Id; Stubs : Node_Id; Subprogram_Number : Int); -- Add one case to the specified RPC receiver case list -- associating Subprogram_Number with the subprogram declared -- by Declaration, for which we have receiving stubs in Stubs. procedure Visit_Subprogram (Decl : Node_Id); -- Generate receiving stub for one remote subprogram --------------------- -- Append_Stubs_To -- --------------------- procedure Append_Stubs_To (RPC_Receiver_Cases : List_Id; Stubs : Node_Id; Subprogram_Number : Int) is begin Append_To (RPC_Receiver_Cases, Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List (Make_Integer_Literal (Loc, Subprogram_Number)), Statements => New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (Defining_Entity (Stubs), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Request_Parameter, Loc)))))); end Append_Stubs_To; ---------------------- -- Visit_Subprogram -- ---------------------- procedure Visit_Subprogram (Decl : Node_Id) is Loc : constant Source_Ptr := Sloc (Decl); Spec : constant Node_Id := Specification (Decl); Subp_Def : constant Entity_Id := Defining_Unit_Name (Spec); Subp_Val : String_Id; pragma Warnings (Off, Subp_Val); begin -- Disable expansion of stubs if serious errors have been -- diagnosed, because otherwise some illegal remote subprogram -- declarations could cause cascaded errors in stubs. if Serious_Errors_Detected /= 0 then return; end if; -- Build receiving stub Current_Stubs := Build_Subprogram_Receiving_Stubs (Vis_Decl => Decl, Asynchronous => Nkind (Spec) = N_Procedure_Specification and then Is_Asynchronous (Subp_Def)); Append_To (Decls, Current_Stubs); Analyze (Current_Stubs); -- Build RAS proxy Add_RAS_Proxy_And_Analyze (Decls, Vis_Decl => Decl, All_Calls_Remote_E => All_Calls_Remote_E, Proxy_Object_Addr => Proxy_Object_Addr); -- Compute distribution identifier Assign_Subprogram_Identifier (Subp_Def, Current_Subp_Number, Subp_Val); pragma Assert (Current_Subp_Number = Get_Subprogram_Id (Subp_Def)); -- Add subprogram descriptor (RCI_Subp_Info) to the subprograms -- table for this receiver. This aggregate must be kept consistent -- with the declaration of RCI_Subp_Info in -- System.Partition_Interface. Append_To (Subp_Info_List, Make_Component_Association (Loc, Choices => New_List ( Make_Integer_Literal (Loc, Current_Subp_Number)), Expression => Make_Aggregate (Loc, Component_Associations => New_List ( -- Addr => Make_Component_Association (Loc, Choices => New_List (Make_Identifier (Loc, Name_Addr)), Expression => New_Occurrence_Of (Proxy_Object_Addr, Loc)))))); Append_Stubs_To (Pkg_RPC_Receiver_Cases, Stubs => Current_Stubs, Subprogram_Number => Current_Subp_Number); Current_Subp_Number := Current_Subp_Number + 1; end Visit_Subprogram; procedure Visit_Spec is new Build_Package_Stubs (Visit_Subprogram); -- Start of processing for Add_Receiving_Stubs_To_Declarations begin -- Building receiving stubs consist in several operations: -- - a package RPC receiver must be built. This subprogram -- will get a Subprogram_Id from the incoming stream -- and will dispatch the call to the right subprogram; -- - a receiving stub for each subprogram visible in the package -- spec. This stub will read all the parameters from the stream, -- and put the result as well as the exception occurrence in the -- output stream; -- - a dummy package with an empty spec and a body made of an -- elaboration part, whose job is to register the receiving -- part of this RCI package on the name server. This is done -- by calling System.Partition_Interface.Register_Receiving_Stub. Build_RPC_Receiver_Body ( RPC_Receiver => Pkg_RPC_Receiver, Request => Request_Parameter, Subp_Id => Subp_Id, Subp_Index => Subp_Index, Stmts => Pkg_RPC_Receiver_Statements, Decl => Pkg_RPC_Receiver_Body); pragma Assert (Subp_Id = Subp_Index); -- A null subp_id denotes a call through a RAS, in which case the -- next Uint_64 element in the stream is the address of the local -- proxy object, from which we can retrieve the actual subprogram id. Append_To (Pkg_RPC_Receiver_Statements, Make_Implicit_If_Statement (Pkg_Spec, Condition => Make_Op_Eq (Loc, New_Occurrence_Of (Subp_Id, Loc), Make_Integer_Literal (Loc, 0)), Then_Statements => New_List ( Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Subp_Id, Loc), Expression => Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (RTE (RE_RAS_Proxy_Type_Access), OK_Convert_To (RTE (RE_Address), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Unsigned_64), Loc), Attribute_Name => Name_Input, Expressions => New_List ( Make_Selected_Component (Loc, Prefix => Request_Parameter, Selector_Name => Name_Params))))), Selector_Name => Make_Identifier (Loc, Name_Subp_Id)))))); -- Build a subprogram for RAS information lookups Lookup_RAS := Make_Subprogram_Declaration (Loc, Specification => Make_Function_Specification (Loc, Defining_Unit_Name => Lookup_RAS_Info, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Name_Subp_Id), In_Present => True, Parameter_Type => New_Occurrence_Of (RTE (RE_Subprogram_Id), Loc))), Result_Definition => New_Occurrence_Of (RTE (RE_Unsigned_64), Loc))); Append_To (Decls, Lookup_RAS); Analyze (Lookup_RAS); Current_Stubs := Build_Subprogram_Receiving_Stubs (Vis_Decl => Lookup_RAS, Asynchronous => False); Append_To (Decls, Current_Stubs); Analyze (Current_Stubs); Append_Stubs_To (Pkg_RPC_Receiver_Cases, Stubs => Current_Stubs, Subprogram_Number => 1); -- For each subprogram, the receiving stub will be built and a -- case statement will be made on the Subprogram_Id to dispatch -- to the right subprogram. All_Calls_Remote_E := Boolean_Literals (Has_All_Calls_Remote (Defining_Entity (Pkg_Spec))); Overload_Counter_Table.Reset; Visit_Spec (Pkg_Spec); -- If we receive an invalid Subprogram_Id, it is best to do nothing -- rather than raising an exception since we do not want someone -- to crash a remote partition by sending invalid subprogram ids. -- This is consistent with the other parts of the case statement -- since even in presence of incorrect parameters in the stream, -- every exception will be caught and (if the subprogram is not an -- APC) put into the result stream and sent away. Append_To (Pkg_RPC_Receiver_Cases, Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List (Make_Others_Choice (Loc)), Statements => New_List (Make_Null_Statement (Loc)))); Append_To (Pkg_RPC_Receiver_Statements, Make_Case_Statement (Loc, Expression => New_Occurrence_Of (Subp_Id, Loc), Alternatives => Pkg_RPC_Receiver_Cases)); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Subp_Info_Array, Constant_Present => True, Aliased_Present => True, Object_Definition => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_RCI_Subp_Info_Array), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, New_List ( Make_Range (Loc, Low_Bound => Make_Integer_Literal (Loc, First_RCI_Subprogram_Id), High_Bound => Make_Integer_Literal (Loc, Intval => First_RCI_Subprogram_Id + List_Length (Subp_Info_List) - 1))))))); -- For a degenerate RCI with no visible subprograms, Subp_Info_List -- has zero length, and the declaration is for an empty array, in -- which case no initialization aggregate must be generated. if Present (First (Subp_Info_List)) then Set_Expression (Last (Decls), Make_Aggregate (Loc, Component_Associations => Subp_Info_List)); -- No initialization provided: remove CONSTANT so that the -- declaration is not an incomplete deferred constant. else Set_Constant_Present (Last (Decls), False); end if; Analyze (Last (Decls)); declare Subp_Info_Addr : Node_Id; -- Return statement for Lookup_RAS_Info: address of the subprogram -- information record for the requested subprogram id. begin if Present (First (Subp_Info_List)) then Subp_Info_Addr := Make_Selected_Component (Loc, Prefix => Make_Indexed_Component (Loc, Prefix => New_Occurrence_Of (Subp_Info_Array, Loc), Expressions => New_List ( Convert_To (Standard_Integer, Make_Identifier (Loc, Name_Subp_Id)))), Selector_Name => Make_Identifier (Loc, Name_Addr)); -- Case of no visible subprogram: just raise Constraint_Error, we -- know for sure we got junk from a remote partition. else Subp_Info_Addr := Make_Raise_Constraint_Error (Loc, Reason => CE_Range_Check_Failed); Set_Etype (Subp_Info_Addr, RTE (RE_Unsigned_64)); end if; Append_To (Decls, Make_Subprogram_Body (Loc, Specification => Copy_Specification (Loc, Parent (Lookup_RAS_Info)), Declarations => No_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Simple_Return_Statement (Loc, Expression => OK_Convert_To (RTE (RE_Unsigned_64), Subp_Info_Addr)))))); end; Analyze (Last (Decls)); Append_To (Decls, Pkg_RPC_Receiver_Body); Analyze (Last (Decls)); -- Name Append_To (Register_Pkg_Actuals, Make_String_Literal (Loc, Strval => Fully_Qualified_Name_String (Defining_Entity (Pkg_Spec), Append_NUL => False))); -- Receiver Append_To (Register_Pkg_Actuals, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Pkg_RPC_Receiver, Loc), Attribute_Name => Name_Unrestricted_Access)); -- Version Append_To (Register_Pkg_Actuals, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Defining_Entity (Pkg_Spec), Loc), Attribute_Name => Name_Version)); -- Subp_Info Append_To (Register_Pkg_Actuals, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Subp_Info_Array, Loc), Attribute_Name => Name_Address)); -- Subp_Info_Len Append_To (Register_Pkg_Actuals, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Subp_Info_Array, Loc), Attribute_Name => Name_Length)); -- Generate the call Append_To (Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Register_Receiving_Stub), Loc), Parameter_Associations => Register_Pkg_Actuals)); Analyze (Last (Stmts)); end Add_Receiving_Stubs_To_Declarations; --------------------------------- -- Build_General_Calling_Stubs -- --------------------------------- procedure Build_General_Calling_Stubs (Decls : List_Id; Statements : List_Id; Target_Partition : Entity_Id; Target_RPC_Receiver : Node_Id; Subprogram_Id : Node_Id; Asynchronous : Node_Id := Empty; Is_Known_Asynchronous : Boolean := False; Is_Known_Non_Asynchronous : Boolean := False; Is_Function : Boolean; Spec : Node_Id; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Nod : Node_Id) is Loc : constant Source_Ptr := Sloc (Nod); Stream_Parameter : Node_Id; -- Name of the stream used to transmit parameters to the remote -- package. Result_Parameter : Node_Id; -- Name of the result parameter (in non-APC cases) which get the -- result of the remote subprogram. Exception_Return_Parameter : Node_Id; -- Name of the parameter which will hold the exception sent by the -- remote subprogram. Current_Parameter : Node_Id; -- Current parameter being handled Ordered_Parameters_List : constant List_Id := Build_Ordered_Parameters_List (Spec); Asynchronous_Statements : List_Id := No_List; Non_Asynchronous_Statements : List_Id := No_List; -- Statements specifics to the Asynchronous/Non-Asynchronous cases Extra_Formal_Statements : constant List_Id := New_List; -- List of statements for extra formal parameters. It will appear -- after the regular statements for writing out parameters. pragma Unreferenced (RACW_Type); -- Used only for the PolyORB case begin -- The general form of a calling stub for a given subprogram is: -- procedure X (...) is P : constant Partition_ID := -- RCI_Cache.Get_Active_Partition_ID; Stream, Result : aliased -- System.RPC.Params_Stream_Type (0); begin -- Put_Package_RPC_Receiver_In_Stream; (the package RPC receiver -- comes from RCI_Cache.Get_RCI_Package_Receiver) -- Put_Subprogram_Id_In_Stream; Put_Parameters_In_Stream; Do_RPC -- (Stream, Result); Read_Exception_Occurrence_From_Result; -- Raise_It; -- Read_Out_Parameters_And_Function_Return_From_Stream; end X; -- There are some variations: Do_APC is called for an asynchronous -- procedure and the part after the call is completely ommitted as -- well as the declaration of Result. For a function call, 'Input is -- always used to read the result even if it is constrained. Stream_Parameter := Make_Temporary (Loc, 'S'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Stream_Parameter, Aliased_Present => True, Object_Definition => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Params_Stream_Type), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List (Make_Integer_Literal (Loc, 0)))))); if not Is_Known_Asynchronous then Result_Parameter := Make_Temporary (Loc, 'R'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Result_Parameter, Aliased_Present => True, Object_Definition => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_Params_Stream_Type), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => New_List (Make_Integer_Literal (Loc, 0)))))); Exception_Return_Parameter := Make_Temporary (Loc, 'E'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Exception_Return_Parameter, Object_Definition => New_Occurrence_Of (RTE (RE_Exception_Occurrence), Loc))); else Result_Parameter := Empty; Exception_Return_Parameter := Empty; end if; -- Put first the RPC receiver corresponding to the remote package Append_To (Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Unsigned_64), Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Parameter, Loc), Attribute_Name => Name_Access), Target_RPC_Receiver))); -- Then put the Subprogram_Id of the subprogram we want to call in -- the stream. Append_To (Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Subprogram_Id), Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Parameter, Loc), Attribute_Name => Name_Access), Subprogram_Id))); Current_Parameter := First (Ordered_Parameters_List); while Present (Current_Parameter) loop declare Typ : constant Node_Id := Parameter_Type (Current_Parameter); Etyp : Entity_Id; Constrained : Boolean; Value : Node_Id; Extra_Parameter : Entity_Id; begin if Is_RACW_Controlling_Formal (Current_Parameter, Stub_Type) then -- In the case of a controlling formal argument, we marshall -- its addr field rather than the local stub. Append_To (Statements, Pack_Node_Into_Stream (Loc, Stream => Stream_Parameter, Object => Make_Selected_Component (Loc, Prefix => Defining_Identifier (Current_Parameter), Selector_Name => Name_Addr), Etyp => RTE (RE_Unsigned_64))); else Value := New_Occurrence_Of (Defining_Identifier (Current_Parameter), Loc); -- Access type parameters are transmitted as in out -- parameters. However, a dereference is needed so that -- we marshall the designated object. if Nkind (Typ) = N_Access_Definition then Value := Make_Explicit_Dereference (Loc, Value); Etyp := Etype (Subtype_Mark (Typ)); else Etyp := Etype (Typ); end if; Constrained := not Transmit_As_Unconstrained (Etyp); -- Any parameter but unconstrained out parameters are -- transmitted to the peer. if In_Present (Current_Parameter) or else not Out_Present (Current_Parameter) or else not Constrained then Append_To (Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etyp, Loc), Attribute_Name => Output_From_Constrained (Constrained), Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Parameter, Loc), Attribute_Name => Name_Access), Value))); end if; end if; -- If the current parameter has a dynamic constrained status, -- then this status is transmitted as well. -- This should be done for accessibility as well ??? if Nkind (Typ) /= N_Access_Definition and then Need_Extra_Constrained (Current_Parameter) then -- In this block, we do not use the extra formal that has -- been created because it does not exist at the time of -- expansion when building calling stubs for remote access -- to subprogram types. We create an extra variable of this -- type and push it in the stream after the regular -- parameters. Extra_Parameter := Make_Temporary (Loc, 'P'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Extra_Parameter, Constant_Present => True, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of ( Defining_Identifier (Current_Parameter), Loc), Attribute_Name => Name_Constrained))); Append_To (Extra_Formal_Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Standard_Boolean, Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Parameter, Loc), Attribute_Name => Name_Access), New_Occurrence_Of (Extra_Parameter, Loc)))); end if; Next (Current_Parameter); end; end loop; -- Append the formal statements list to the statements Append_List_To (Statements, Extra_Formal_Statements); if not Is_Known_Non_Asynchronous then -- Build the call to System.RPC.Do_APC Asynchronous_Statements := New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Do_Apc), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Target_Partition, Loc), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Parameter, Loc), Attribute_Name => Name_Access)))); else Asynchronous_Statements := No_List; end if; if not Is_Known_Asynchronous then -- Build the call to System.RPC.Do_RPC Non_Asynchronous_Statements := New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Do_Rpc), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Target_Partition, Loc), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Parameter, Loc), Attribute_Name => Name_Access), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Result_Parameter, Loc), Attribute_Name => Name_Access)))); -- Read the exception occurrence from the result stream and -- reraise it. It does no harm if this is a Null_Occurrence since -- this does nothing. Append_To (Non_Asynchronous_Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Exception_Occurrence), Loc), Attribute_Name => Name_Read, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Result_Parameter, Loc), Attribute_Name => Name_Access), New_Occurrence_Of (Exception_Return_Parameter, Loc)))); Append_To (Non_Asynchronous_Statements, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Reraise_Occurrence), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Exception_Return_Parameter, Loc)))); if Is_Function then -- If this is a function call, then read the value and return -- it. The return value is written/read using 'Output/'Input. Append_To (Non_Asynchronous_Statements, Make_Tag_Check (Loc, Make_Simple_Return_Statement (Loc, Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of ( Etype (Result_Definition (Spec)), Loc), Attribute_Name => Name_Input, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Result_Parameter, Loc), Attribute_Name => Name_Access)))))); else -- Loop around parameters and assign out (or in out) -- parameters. In the case of RACW, controlling arguments -- cannot possibly have changed since they are remote, so -- we do not read them from the stream. Current_Parameter := First (Ordered_Parameters_List); while Present (Current_Parameter) loop declare Typ : constant Node_Id := Parameter_Type (Current_Parameter); Etyp : Entity_Id; Value : Node_Id; begin Value := New_Occurrence_Of (Defining_Identifier (Current_Parameter), Loc); if Nkind (Typ) = N_Access_Definition then Value := Make_Explicit_Dereference (Loc, Value); Etyp := Etype (Subtype_Mark (Typ)); else Etyp := Etype (Typ); end if; if (Out_Present (Current_Parameter) or else Nkind (Typ) = N_Access_Definition) and then Etyp /= Stub_Type then Append_To (Non_Asynchronous_Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etyp, Loc), Attribute_Name => Name_Read, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Result_Parameter, Loc), Attribute_Name => Name_Access), Value))); end if; end; Next (Current_Parameter); end loop; end if; end if; if Is_Known_Asynchronous then Append_List_To (Statements, Asynchronous_Statements); elsif Is_Known_Non_Asynchronous then Append_List_To (Statements, Non_Asynchronous_Statements); else pragma Assert (Present (Asynchronous)); Prepend_To (Asynchronous_Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Standard_Boolean, Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Parameter, Loc), Attribute_Name => Name_Access), New_Occurrence_Of (Standard_True, Loc)))); Prepend_To (Non_Asynchronous_Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Standard_Boolean, Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream_Parameter, Loc), Attribute_Name => Name_Access), New_Occurrence_Of (Standard_False, Loc)))); Append_To (Statements, Make_Implicit_If_Statement (Nod, Condition => Asynchronous, Then_Statements => Asynchronous_Statements, Else_Statements => Non_Asynchronous_Statements)); end if; end Build_General_Calling_Stubs; ----------------------------- -- Build_RPC_Receiver_Body -- ----------------------------- procedure Build_RPC_Receiver_Body (RPC_Receiver : Entity_Id; Request : out Entity_Id; Subp_Id : out Entity_Id; Subp_Index : out Entity_Id; Stmts : out List_Id; Decl : out Node_Id) is Loc : constant Source_Ptr := Sloc (RPC_Receiver); RPC_Receiver_Spec : Node_Id; RPC_Receiver_Decls : List_Id; begin Request := Make_Defining_Identifier (Loc, Name_R); RPC_Receiver_Spec := Build_RPC_Receiver_Specification (RPC_Receiver => RPC_Receiver, Request_Parameter => Request); Subp_Id := Make_Temporary (Loc, 'P'); Subp_Index := Subp_Id; -- Subp_Id may not be a constant, because in the case of the RPC -- receiver for an RCI package, when a call is received from a RAS -- dereference, it will be assigned during subsequent processing. RPC_Receiver_Decls := New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Subp_Id, Object_Definition => New_Occurrence_Of (RTE (RE_Subprogram_Id), Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Subprogram_Id), Loc), Attribute_Name => Name_Input, Expressions => New_List ( Make_Selected_Component (Loc, Prefix => Request, Selector_Name => Name_Params))))); Stmts := New_List; Decl := Make_Subprogram_Body (Loc, Specification => RPC_Receiver_Spec, Declarations => RPC_Receiver_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts)); end Build_RPC_Receiver_Body; ----------------------- -- Build_Stub_Target -- ----------------------- function Build_Stub_Target (Loc : Source_Ptr; Decls : List_Id; RCI_Locator : Entity_Id; Controlling_Parameter : Entity_Id) return RPC_Target is Target_Info : RPC_Target (PCS_Kind => Name_GARLIC_DSA); begin Target_Info.Partition := Make_Temporary (Loc, 'P'); if Present (Controlling_Parameter) then Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Target_Info.Partition, Constant_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Partition_ID), Loc), Expression => Make_Selected_Component (Loc, Prefix => Controlling_Parameter, Selector_Name => Name_Origin))); Target_Info.RPC_Receiver := Make_Selected_Component (Loc, Prefix => Controlling_Parameter, Selector_Name => Name_Receiver); else Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Target_Info.Partition, Constant_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Partition_ID), Loc), Expression => Make_Function_Call (Loc, Name => Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Chars (RCI_Locator)), Selector_Name => Make_Identifier (Loc, Name_Get_Active_Partition_ID))))); Target_Info.RPC_Receiver := Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Chars (RCI_Locator)), Selector_Name => Make_Identifier (Loc, Name_Get_RCI_Package_Receiver)); end if; return Target_Info; end Build_Stub_Target; -------------------------------------- -- Build_Subprogram_Receiving_Stubs -- -------------------------------------- function Build_Subprogram_Receiving_Stubs (Vis_Decl : Node_Id; Asynchronous : Boolean; Dynamically_Asynchronous : Boolean := False; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Parent_Primitive : Entity_Id := Empty) return Node_Id is Loc : constant Source_Ptr := Sloc (Vis_Decl); Request_Parameter : constant Entity_Id := Make_Temporary (Loc, 'R'); -- Formal parameter for receiving stubs: a descriptor for an incoming -- request. Decls : constant List_Id := New_List; -- All the parameters will get declared before calling the real -- subprograms. Also the out parameters will be declared. Statements : constant List_Id := New_List; Extra_Formal_Statements : constant List_Id := New_List; -- Statements concerning extra formal parameters After_Statements : constant List_Id := New_List; -- Statements to be executed after the subprogram call Inner_Decls : List_Id := No_List; -- In case of a function, the inner declarations are needed since -- the result may be unconstrained. Excep_Handlers : List_Id := No_List; Excep_Choice : Entity_Id; Excep_Code : List_Id; Parameter_List : constant List_Id := New_List; -- List of parameters to be passed to the subprogram Current_Parameter : Node_Id; Ordered_Parameters_List : constant List_Id := Build_Ordered_Parameters_List (Specification (Vis_Decl)); Subp_Spec : Node_Id; -- Subprogram specification Called_Subprogram : Node_Id; -- The subprogram to call Null_Raise_Statement : Node_Id; Dynamic_Async : Entity_Id; begin if Present (RACW_Type) then Called_Subprogram := New_Occurrence_Of (Parent_Primitive, Loc); else Called_Subprogram := New_Occurrence_Of (Defining_Unit_Name (Specification (Vis_Decl)), Loc); end if; if Dynamically_Asynchronous then Dynamic_Async := Make_Temporary (Loc, 'S'); else Dynamic_Async := Empty; end if; if not Asynchronous or Dynamically_Asynchronous then -- The first statement after the subprogram call is a statement to -- write a Null_Occurrence into the result stream. Null_Raise_Statement := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Exception_Occurrence), Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Selected_Component (Loc, Prefix => Request_Parameter, Selector_Name => Name_Result), New_Occurrence_Of (RTE (RE_Null_Occurrence), Loc))); if Dynamically_Asynchronous then Null_Raise_Statement := Make_Implicit_If_Statement (Vis_Decl, Condition => Make_Op_Not (Loc, New_Occurrence_Of (Dynamic_Async, Loc)), Then_Statements => New_List (Null_Raise_Statement)); end if; Append_To (After_Statements, Null_Raise_Statement); end if; -- Loop through every parameter and get its value from the stream. If -- the parameter is unconstrained, then the parameter is read using -- 'Input at the point of declaration. Current_Parameter := First (Ordered_Parameters_List); while Present (Current_Parameter) loop declare Etyp : Entity_Id; Constrained : Boolean; Need_Extra_Constrained : Boolean; -- True when an Extra_Constrained actual is required Object : constant Entity_Id := Make_Temporary (Loc, 'P'); Expr : Node_Id := Empty; Is_Controlling_Formal : constant Boolean := Is_RACW_Controlling_Formal (Current_Parameter, Stub_Type); begin if Is_Controlling_Formal then -- We have a controlling formal parameter. Read its address -- rather than a real object. The address is in Unsigned_64 -- form. Etyp := RTE (RE_Unsigned_64); else Etyp := Etype (Parameter_Type (Current_Parameter)); end if; Constrained := not Transmit_As_Unconstrained (Etyp); if In_Present (Current_Parameter) or else not Out_Present (Current_Parameter) or else not Constrained or else Is_Controlling_Formal then -- If an input parameter is constrained, then the read of -- the parameter is deferred until the beginning of the -- subprogram body. If it is unconstrained, then an -- expression is built for the object declaration and the -- variable is set using 'Input instead of 'Read. Note that -- this deferral does not change the order in which the -- actuals are read because Build_Ordered_Parameter_List -- puts them unconstrained first. if Constrained then Append_To (Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etyp, Loc), Attribute_Name => Name_Read, Expressions => New_List ( Make_Selected_Component (Loc, Prefix => Request_Parameter, Selector_Name => Name_Params), New_Occurrence_Of (Object, Loc)))); else -- Build and append Input_With_Tag_Check function Append_To (Decls, Input_With_Tag_Check (Loc, Var_Type => Etyp, Stream => Make_Selected_Component (Loc, Prefix => Request_Parameter, Selector_Name => Name_Params))); -- Prepare function call expression Expr := Make_Function_Call (Loc, Name => New_Occurrence_Of (Defining_Unit_Name (Specification (Last (Decls))), Loc)); end if; end if; Need_Extra_Constrained := Nkind (Parameter_Type (Current_Parameter)) /= N_Access_Definition and then Ekind (Defining_Identifier (Current_Parameter)) /= E_Void and then Present (Extra_Constrained (Defining_Identifier (Current_Parameter))); -- We may not associate an extra constrained actual to a -- constant object, so if one is needed, declare the actual -- as a variable even if it won't be modified. Build_Actual_Object_Declaration (Object => Object, Etyp => Etyp, Variable => Need_Extra_Constrained or else Out_Present (Current_Parameter), Expr => Expr, Decls => Decls); -- An out parameter may be written back using a 'Write -- attribute instead of a 'Output because it has been -- constrained by the parameter given to the caller. Note that -- out controlling arguments in the case of a RACW are not put -- back in the stream because the pointer on them has not -- changed. if Out_Present (Current_Parameter) and then Etype (Parameter_Type (Current_Parameter)) /= Stub_Type then Append_To (After_Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etyp, Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Selected_Component (Loc, Prefix => Request_Parameter, Selector_Name => Name_Result), New_Occurrence_Of (Object, Loc)))); end if; -- For RACW controlling formals, the Etyp of Object is always -- an RACW, even if the parameter is not of an anonymous access -- type. In such case, we need to dereference it at call time. if Is_Controlling_Formal then if Nkind (Parameter_Type (Current_Parameter)) /= N_Access_Definition then Append_To (Parameter_List, Make_Parameter_Association (Loc, Selector_Name => New_Occurrence_Of ( Defining_Identifier (Current_Parameter), Loc), Explicit_Actual_Parameter => Make_Explicit_Dereference (Loc, Unchecked_Convert_To (RACW_Type, OK_Convert_To (RTE (RE_Address), New_Occurrence_Of (Object, Loc)))))); else Append_To (Parameter_List, Make_Parameter_Association (Loc, Selector_Name => New_Occurrence_Of ( Defining_Identifier (Current_Parameter), Loc), Explicit_Actual_Parameter => Unchecked_Convert_To (RACW_Type, OK_Convert_To (RTE (RE_Address), New_Occurrence_Of (Object, Loc))))); end if; else Append_To (Parameter_List, Make_Parameter_Association (Loc, Selector_Name => New_Occurrence_Of ( Defining_Identifier (Current_Parameter), Loc), Explicit_Actual_Parameter => New_Occurrence_Of (Object, Loc))); end if; -- If the current parameter needs an extra formal, then read it -- from the stream and set the corresponding semantic field in -- the variable. If the kind of the parameter identifier is -- E_Void, then this is a compiler generated parameter that -- doesn't need an extra constrained status. -- The case of Extra_Accessibility should also be handled ??? if Need_Extra_Constrained then declare Extra_Parameter : constant Entity_Id := Extra_Constrained (Defining_Identifier (Current_Parameter)); Formal_Entity : constant Entity_Id := Make_Defining_Identifier (Loc, Chars (Extra_Parameter)); Formal_Type : constant Entity_Id := Etype (Extra_Parameter); begin Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Formal_Entity, Object_Definition => New_Occurrence_Of (Formal_Type, Loc))); Append_To (Extra_Formal_Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of ( Formal_Type, Loc), Attribute_Name => Name_Read, Expressions => New_List ( Make_Selected_Component (Loc, Prefix => Request_Parameter, Selector_Name => Name_Params), New_Occurrence_Of (Formal_Entity, Loc)))); -- Note: the call to Set_Extra_Constrained below relies -- on the fact that Object's Ekind has been set by -- Build_Actual_Object_Declaration. Set_Extra_Constrained (Object, Formal_Entity); end; end if; end; Next (Current_Parameter); end loop; -- Append the formal statements list at the end of regular statements Append_List_To (Statements, Extra_Formal_Statements); if Nkind (Specification (Vis_Decl)) = N_Function_Specification then -- The remote subprogram is a function. We build an inner block to -- be able to hold a potentially unconstrained result in a -- variable. declare Etyp : constant Entity_Id := Etype (Result_Definition (Specification (Vis_Decl))); Result : constant Node_Id := Make_Temporary (Loc, 'R'); begin Inner_Decls := New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Result, Constant_Present => True, Object_Definition => New_Occurrence_Of (Etyp, Loc), Expression => Make_Function_Call (Loc, Name => Called_Subprogram, Parameter_Associations => Parameter_List))); if Is_Class_Wide_Type (Etyp) then -- For a remote call to a function with a class-wide type, -- check that the returned value satisfies the requirements -- of E.4(18). Append_To (Inner_Decls, Make_Transportable_Check (Loc, New_Occurrence_Of (Result, Loc))); end if; Append_To (After_Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etyp, Loc), Attribute_Name => Name_Output, Expressions => New_List ( Make_Selected_Component (Loc, Prefix => Request_Parameter, Selector_Name => Name_Result), New_Occurrence_Of (Result, Loc)))); end; Append_To (Statements, Make_Block_Statement (Loc, Declarations => Inner_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => After_Statements))); else -- The remote subprogram is a procedure. We do not need any inner -- block in this case. if Dynamically_Asynchronous then Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Dynamic_Async, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc))); Append_To (Statements, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Standard_Boolean, Loc), Attribute_Name => Name_Read, Expressions => New_List ( Make_Selected_Component (Loc, Prefix => Request_Parameter, Selector_Name => Name_Params), New_Occurrence_Of (Dynamic_Async, Loc)))); end if; Append_To (Statements, Make_Procedure_Call_Statement (Loc, Name => Called_Subprogram, Parameter_Associations => Parameter_List)); Append_List_To (Statements, After_Statements); end if; if Asynchronous and then not Dynamically_Asynchronous then -- For an asynchronous procedure, add a null exception handler Excep_Handlers := New_List ( Make_Implicit_Exception_Handler (Loc, Exception_Choices => New_List (Make_Others_Choice (Loc)), Statements => New_List (Make_Null_Statement (Loc)))); else -- In the other cases, if an exception is raised, then the -- exception occurrence is copied into the output stream and -- no other output parameter is written. Excep_Choice := Make_Temporary (Loc, 'E'); Excep_Code := New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Exception_Occurrence), Loc), Attribute_Name => Name_Write, Expressions => New_List ( Make_Selected_Component (Loc, Prefix => Request_Parameter, Selector_Name => Name_Result), New_Occurrence_Of (Excep_Choice, Loc)))); if Dynamically_Asynchronous then Excep_Code := New_List ( Make_Implicit_If_Statement (Vis_Decl, Condition => Make_Op_Not (Loc, New_Occurrence_Of (Dynamic_Async, Loc)), Then_Statements => Excep_Code)); end if; Excep_Handlers := New_List ( Make_Implicit_Exception_Handler (Loc, Choice_Parameter => Excep_Choice, Exception_Choices => New_List (Make_Others_Choice (Loc)), Statements => Excep_Code)); end if; Subp_Spec := Make_Procedure_Specification (Loc, Defining_Unit_Name => Make_Temporary (Loc, 'F'), Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Request_Parameter, Parameter_Type => New_Occurrence_Of (RTE (RE_Request_Access), Loc)))); return Make_Subprogram_Body (Loc, Specification => Subp_Spec, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Statements, Exception_Handlers => Excep_Handlers)); end Build_Subprogram_Receiving_Stubs; ------------ -- Result -- ------------ function Result return Node_Id is begin return Make_Identifier (Loc, Name_V); end Result; ----------------------- -- RPC_Receiver_Decl -- ----------------------- function RPC_Receiver_Decl (RACW_Type : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (RACW_Type); Is_RAS : constant Boolean := not Comes_From_Source (RACW_Type); begin -- No RPC receiver for remote access-to-subprogram if Is_RAS then return Empty; end if; return Make_Subprogram_Declaration (Loc, Build_RPC_Receiver_Specification (RPC_Receiver => Make_Temporary (Loc, 'R'), Request_Parameter => Make_Defining_Identifier (Loc, Name_R))); end RPC_Receiver_Decl; ---------------------- -- Stream_Parameter -- ---------------------- function Stream_Parameter return Node_Id is begin return Make_Identifier (Loc, Name_S); end Stream_Parameter; end GARLIC_Support; ------------------------------- -- Get_And_Reset_RACW_Bodies -- ------------------------------- function Get_And_Reset_RACW_Bodies (RACW_Type : Entity_Id) return List_Id is Desig : constant Entity_Id := Etype (Designated_Type (RACW_Type)); Stub_Elements : Stub_Structure := Stubs_Table.Get (Desig); Body_Decls : List_Id; -- Returned list of declarations begin if Stub_Elements = Empty_Stub_Structure then -- Stub elements may be missing as a consequence of a previously -- detected error. return No_List; end if; Body_Decls := Stub_Elements.Body_Decls; Stub_Elements.Body_Decls := No_List; Stubs_Table.Set (Desig, Stub_Elements); return Body_Decls; end Get_And_Reset_RACW_Bodies; ----------------------- -- Get_Stub_Elements -- ----------------------- function Get_Stub_Elements (RACW_Type : Entity_Id) return Stub_Structure is Desig : constant Entity_Id := Etype (Designated_Type (RACW_Type)); Stub_Elements : constant Stub_Structure := Stubs_Table.Get (Desig); begin pragma Assert (Stub_Elements /= Empty_Stub_Structure); return Stub_Elements; end Get_Stub_Elements; ----------------------- -- Get_Subprogram_Id -- ----------------------- function Get_Subprogram_Id (Def : Entity_Id) return String_Id is Result : constant String_Id := Get_Subprogram_Ids (Def).Str_Identifier; begin pragma Assert (Result /= No_String); return Result; end Get_Subprogram_Id; ----------------------- -- Get_Subprogram_Id -- ----------------------- function Get_Subprogram_Id (Def : Entity_Id) return Int is begin return Get_Subprogram_Ids (Def).Int_Identifier; end Get_Subprogram_Id; ------------------------ -- Get_Subprogram_Ids -- ------------------------ function Get_Subprogram_Ids (Def : Entity_Id) return Subprogram_Identifiers is begin return Subprogram_Identifier_Table.Get (Def); end Get_Subprogram_Ids; ---------- -- Hash -- ---------- function Hash (F : Entity_Id) return Hash_Index is begin return Hash_Index (Natural (F) mod Positive (Hash_Index'Last + 1)); end Hash; function Hash (F : Name_Id) return Hash_Index is begin return Hash_Index (Integer (F) mod Positive (Hash_Index'Last + 1)); end Hash; -------------------------- -- Input_With_Tag_Check -- -------------------------- function Input_With_Tag_Check (Loc : Source_Ptr; Var_Type : Entity_Id; Stream : Node_Id) return Node_Id is begin return Make_Subprogram_Body (Loc, Specification => Make_Function_Specification (Loc, Defining_Unit_Name => Make_Temporary (Loc, 'S'), Result_Definition => New_Occurrence_Of (Var_Type, Loc)), Declarations => No_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, New_List ( Make_Tag_Check (Loc, Make_Simple_Return_Statement (Loc, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Var_Type, Loc), Attribute_Name => Name_Input, Expressions => New_List (Stream))))))); end Input_With_Tag_Check; -------------------------------- -- Is_RACW_Controlling_Formal -- -------------------------------- function Is_RACW_Controlling_Formal (Parameter : Node_Id; Stub_Type : Entity_Id) return Boolean is Typ : Entity_Id; begin -- If the kind of the parameter is E_Void, then it is not a controlling -- formal (this can happen in the context of RAS). if Ekind (Defining_Identifier (Parameter)) = E_Void then return False; end if; -- If the parameter is not a controlling formal, then it cannot be -- possibly a RACW_Controlling_Formal. if not Is_Controlling_Formal (Defining_Identifier (Parameter)) then return False; end if; Typ := Parameter_Type (Parameter); return (Nkind (Typ) = N_Access_Definition and then Etype (Subtype_Mark (Typ)) = Stub_Type) or else Etype (Typ) = Stub_Type; end Is_RACW_Controlling_Formal; ------------------------------ -- Make_Transportable_Check -- ------------------------------ function Make_Transportable_Check (Loc : Source_Ptr; Expr : Node_Id) return Node_Id is begin return Make_Raise_Program_Error (Loc, Condition => Make_Op_Not (Loc, Build_Get_Transportable (Loc, Make_Selected_Component (Loc, Prefix => Expr, Selector_Name => Make_Identifier (Loc, Name_uTag)))), Reason => PE_Non_Transportable_Actual); end Make_Transportable_Check; ----------------------------- -- Make_Selected_Component -- ----------------------------- function Make_Selected_Component (Loc : Source_Ptr; Prefix : Entity_Id; Selector_Name : Name_Id) return Node_Id is begin return Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Prefix, Loc), Selector_Name => Make_Identifier (Loc, Selector_Name)); end Make_Selected_Component; -------------------- -- Make_Tag_Check -- -------------------- function Make_Tag_Check (Loc : Source_Ptr; N : Node_Id) return Node_Id is Occ : constant Entity_Id := Make_Temporary (Loc, 'E'); begin return Make_Block_Statement (Loc, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (N), Exception_Handlers => New_List ( Make_Implicit_Exception_Handler (Loc, Choice_Parameter => Occ, Exception_Choices => New_List (New_Occurrence_Of (RTE (RE_Tag_Error), Loc)), Statements => New_List (Make_Procedure_Call_Statement (Loc, New_Occurrence_Of (RTE (RE_Raise_Program_Error_Unknown_Tag), Loc), New_List (New_Occurrence_Of (Occ, Loc)))))))); end Make_Tag_Check; ---------------------------- -- Need_Extra_Constrained -- ---------------------------- function Need_Extra_Constrained (Parameter : Node_Id) return Boolean is Etyp : constant Entity_Id := Etype (Parameter_Type (Parameter)); begin return Out_Present (Parameter) and then Has_Discriminants (Etyp) and then not Is_Constrained (Etyp) and then Is_Definite_Subtype (Etyp); end Need_Extra_Constrained; ------------------------------------ -- Pack_Entity_Into_Stream_Access -- ------------------------------------ function Pack_Entity_Into_Stream_Access (Loc : Source_Ptr; Stream : Node_Id; Object : Entity_Id; Etyp : Entity_Id := Empty) return Node_Id is Typ : Entity_Id; begin if Present (Etyp) then Typ := Etyp; else Typ := Etype (Object); end if; return Pack_Node_Into_Stream_Access (Loc, Stream => Stream, Object => New_Occurrence_Of (Object, Loc), Etyp => Typ); end Pack_Entity_Into_Stream_Access; --------------------------- -- Pack_Node_Into_Stream -- --------------------------- function Pack_Node_Into_Stream (Loc : Source_Ptr; Stream : Entity_Id; Object : Node_Id; Etyp : Entity_Id) return Node_Id is Write_Attribute : Name_Id := Name_Write; begin if not Is_Constrained (Etyp) then Write_Attribute := Name_Output; end if; return Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etyp, Loc), Attribute_Name => Write_Attribute, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Stream, Loc), Attribute_Name => Name_Access), Object)); end Pack_Node_Into_Stream; ---------------------------------- -- Pack_Node_Into_Stream_Access -- ---------------------------------- function Pack_Node_Into_Stream_Access (Loc : Source_Ptr; Stream : Node_Id; Object : Node_Id; Etyp : Entity_Id) return Node_Id is Write_Attribute : Name_Id := Name_Write; begin if not Is_Constrained (Etyp) then Write_Attribute := Name_Output; end if; return Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etyp, Loc), Attribute_Name => Write_Attribute, Expressions => New_List ( Stream, Object)); end Pack_Node_Into_Stream_Access; --------------------- -- PolyORB_Support -- --------------------- package body PolyORB_Support is -- Local subprograms procedure Add_RACW_Read_Attribute (RACW_Type : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; Body_Decls : List_Id); -- Add Read attribute for the RACW type. The declaration and attribute -- definition clauses are inserted right after the declaration of -- RACW_Type. If Body_Decls is not No_List, the subprogram body is -- appended to it (case where the RACW declaration is in the main unit). procedure Add_RACW_Write_Attribute (RACW_Type : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; Body_Decls : List_Id); -- Same as above for the Write attribute procedure Add_RACW_From_Any (RACW_Type : Entity_Id; Body_Decls : List_Id); -- Add the From_Any TSS for this RACW type procedure Add_RACW_To_Any (RACW_Type : Entity_Id; Body_Decls : List_Id); -- Add the To_Any TSS for this RACW type procedure Add_RACW_TypeCode (Designated_Type : Entity_Id; RACW_Type : Entity_Id; Body_Decls : List_Id); -- Add the TypeCode TSS for this RACW type procedure Add_RAS_From_Any (RAS_Type : Entity_Id); -- Add the From_Any TSS for this RAS type procedure Add_RAS_To_Any (RAS_Type : Entity_Id); -- Add the To_Any TSS for this RAS type procedure Add_RAS_TypeCode (RAS_Type : Entity_Id); -- Add the TypeCode TSS for this RAS type procedure Add_RAS_Access_TSS (N : Node_Id); -- Add a subprogram body for RAS Access TSS ------------------------------------- -- Add_Obj_RPC_Receiver_Completion -- ------------------------------------- procedure Add_Obj_RPC_Receiver_Completion (Loc : Source_Ptr; Decls : List_Id; RPC_Receiver : Entity_Id; Stub_Elements : Stub_Structure) is Desig : constant Entity_Id := Etype (Designated_Type (Stub_Elements.RACW_Type)); begin Append_To (Decls, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of ( RTE (RE_Register_Obj_Receiving_Stub), Loc), Parameter_Associations => New_List ( -- Name Make_String_Literal (Loc, Fully_Qualified_Name_String (Desig, Append_NUL => False)), -- Handler Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of ( Defining_Unit_Name (Parent (RPC_Receiver)), Loc), Attribute_Name => Name_Access), -- Receiver Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of ( Defining_Identifier ( Stub_Elements.RPC_Receiver_Decl), Loc), Attribute_Name => Name_Access)))); end Add_Obj_RPC_Receiver_Completion; ----------------------- -- Add_RACW_Features -- ----------------------- procedure Add_RACW_Features (RACW_Type : Entity_Id; Desig : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; RPC_Receiver_Decl : Node_Id; Body_Decls : List_Id) is pragma Unreferenced (RPC_Receiver_Decl); begin Add_RACW_From_Any (RACW_Type => RACW_Type, Body_Decls => Body_Decls); Add_RACW_To_Any (RACW_Type => RACW_Type, Body_Decls => Body_Decls); Add_RACW_Write_Attribute (RACW_Type => RACW_Type, Stub_Type => Stub_Type, Stub_Type_Access => Stub_Type_Access, Body_Decls => Body_Decls); Add_RACW_Read_Attribute (RACW_Type => RACW_Type, Stub_Type => Stub_Type, Stub_Type_Access => Stub_Type_Access, Body_Decls => Body_Decls); Add_RACW_TypeCode (Designated_Type => Desig, RACW_Type => RACW_Type, Body_Decls => Body_Decls); end Add_RACW_Features; ----------------------- -- Add_RACW_From_Any -- ----------------------- procedure Add_RACW_From_Any (RACW_Type : Entity_Id; Body_Decls : List_Id) is Loc : constant Source_Ptr := Sloc (RACW_Type); Is_RAS : constant Boolean := not Comes_From_Source (RACW_Type); Fnam : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (RACW_Type), 'F')); Func_Spec : Node_Id; Func_Decl : Node_Id; Func_Body : Node_Id; Statements : List_Id; -- Various parts of the subprogram Any_Parameter : constant Entity_Id := Make_Defining_Identifier (Loc, Name_A); Asynchronous_Flag : constant Entity_Id := Asynchronous_Flags_Table.Get (RACW_Type); -- The flag object declared in Add_RACW_Asynchronous_Flag begin Func_Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Fnam, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Any_Parameter, Parameter_Type => New_Occurrence_Of (RTE (RE_Any), Loc))), Result_Definition => New_Occurrence_Of (RACW_Type, Loc)); -- NOTE: The usage occurrences of RACW_Parameter must refer to the -- entity in the declaration spec, not those of the body spec. Func_Decl := Make_Subprogram_Declaration (Loc, Func_Spec); Insert_After (Declaration_Node (RACW_Type), Func_Decl); Set_Renaming_TSS (RACW_Type, Fnam, TSS_From_Any); if No (Body_Decls) then return; end if; -- ??? Issue with asynchronous calls here: the Asynchronous flag is -- set on the stub type if, and only if, the RACW type has a pragma -- Asynchronous. This is incorrect for RACWs that implement RAS -- types, because in that case the /designated subprogram/ (not the -- type) might be asynchronous, and that causes the stub to need to -- be asynchronous too. A solution is to transport a RAS as a struct -- containing a RACW and an asynchronous flag, and to properly alter -- the Asynchronous component in the stub type in the RAS's _From_Any -- TSS. Statements := New_List ( Make_Simple_Return_Statement (Loc, Expression => Unchecked_Convert_To (RACW_Type, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_RACW), Loc), Parameter_Associations => New_List ( Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_FA_ObjRef), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Any_Parameter, Loc))), Build_Stub_Tag (Loc, RACW_Type), New_Occurrence_Of (Boolean_Literals (Is_RAS), Loc), New_Occurrence_Of (Asynchronous_Flag, Loc)))))); Func_Body := Make_Subprogram_Body (Loc, Specification => Copy_Specification (Loc, Func_Spec), Declarations => No_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Statements)); Append_To (Body_Decls, Func_Body); end Add_RACW_From_Any; ----------------------------- -- Add_RACW_Read_Attribute -- ----------------------------- procedure Add_RACW_Read_Attribute (RACW_Type : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; Body_Decls : List_Id) is pragma Unreferenced (Stub_Type, Stub_Type_Access); Loc : constant Source_Ptr := Sloc (RACW_Type); Proc_Decl : Node_Id; Attr_Decl : Node_Id; Body_Node : Node_Id; Decls : constant List_Id := New_List; Statements : constant List_Id := New_List; Reference : constant Entity_Id := Make_Defining_Identifier (Loc, Name_R); -- Various parts of the procedure Pnam : constant Entity_Id := Make_Temporary (Loc, 'R'); Is_RAS : constant Boolean := not Comes_From_Source (RACW_Type); Asynchronous_Flag : constant Entity_Id := Asynchronous_Flags_Table.Get (RACW_Type); pragma Assert (Present (Asynchronous_Flag)); function Stream_Parameter return Node_Id; function Result return Node_Id; -- Functions to create occurrences of the formal parameter names ------------ -- Result -- ------------ function Result return Node_Id is begin return Make_Identifier (Loc, Name_V); end Result; ---------------------- -- Stream_Parameter -- ---------------------- function Stream_Parameter return Node_Id is begin return Make_Identifier (Loc, Name_S); end Stream_Parameter; -- Start of processing for Add_RACW_Read_Attribute begin Build_Stream_Procedure (Loc, RACW_Type, Body_Node, Pnam, Statements, Outp => True); Proc_Decl := Make_Subprogram_Declaration (Loc, Copy_Specification (Loc, Specification (Body_Node))); Attr_Decl := Make_Attribute_Definition_Clause (Loc, Name => New_Occurrence_Of (RACW_Type, Loc), Chars => Name_Read, Expression => New_Occurrence_Of ( Defining_Unit_Name (Specification (Proc_Decl)), Loc)); Insert_After (Declaration_Node (RACW_Type), Proc_Decl); Insert_After (Proc_Decl, Attr_Decl); if No (Body_Decls) then return; end if; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Reference, Object_Definition => New_Occurrence_Of (RTE (RE_Object_Ref), Loc))); Append_List_To (Statements, New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Object_Ref), Loc), Attribute_Name => Name_Read, Expressions => New_List ( Stream_Parameter, New_Occurrence_Of (Reference, Loc))), Make_Assignment_Statement (Loc, Name => Result, Expression => Unchecked_Convert_To (RACW_Type, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_RACW), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Reference, Loc), Build_Stub_Tag (Loc, RACW_Type), New_Occurrence_Of (Boolean_Literals (Is_RAS), Loc), New_Occurrence_Of (Asynchronous_Flag, Loc))))))); Set_Declarations (Body_Node, Decls); Append_To (Body_Decls, Body_Node); end Add_RACW_Read_Attribute; --------------------- -- Add_RACW_To_Any -- --------------------- procedure Add_RACW_To_Any (RACW_Type : Entity_Id; Body_Decls : List_Id) is Loc : constant Source_Ptr := Sloc (RACW_Type); Fnam : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (RACW_Type), 'T')); Is_RAS : constant Boolean := not Comes_From_Source (RACW_Type); Stub_Elements : constant Stub_Structure := Get_Stub_Elements (RACW_Type); Func_Spec : Node_Id; Func_Decl : Node_Id; Func_Body : Node_Id; Decls : List_Id; Statements : List_Id; -- Various parts of the subprogram RACW_Parameter : constant Entity_Id := Make_Defining_Identifier (Loc, Name_R); Reference : constant Entity_Id := Make_Temporary (Loc, 'R'); Any : constant Entity_Id := Make_Temporary (Loc, 'A'); begin Func_Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Fnam, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => RACW_Parameter, Parameter_Type => New_Occurrence_Of (RACW_Type, Loc))), Result_Definition => New_Occurrence_Of (RTE (RE_Any), Loc)); -- NOTE: The usage occurrences of RACW_Parameter must refer to the -- entity in the declaration spec, not in the body spec. Func_Decl := Make_Subprogram_Declaration (Loc, Func_Spec); Insert_After (Declaration_Node (RACW_Type), Func_Decl); Set_Renaming_TSS (RACW_Type, Fnam, TSS_To_Any); if No (Body_Decls) then return; end if; -- Generate: -- R : constant Object_Ref := -- Get_Reference -- (Address!(RACW), -- "typ", -- Stub_Type'Tag, -- Is_RAS, -- RPC_Receiver'Access); -- A : Any; Decls := New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Reference, Constant_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Object_Ref), Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Reference), Loc), Parameter_Associations => New_List ( Unchecked_Convert_To (RTE (RE_Address), New_Occurrence_Of (RACW_Parameter, Loc)), Make_String_Literal (Loc, Strval => Fully_Qualified_Name_String (Etype (Designated_Type (RACW_Type)), Append_NUL => False)), Build_Stub_Tag (Loc, RACW_Type), New_Occurrence_Of (Boolean_Literals (Is_RAS), Loc), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Defining_Identifier (Stub_Elements.RPC_Receiver_Decl), Loc), Attribute_Name => Name_Access)))), Make_Object_Declaration (Loc, Defining_Identifier => Any, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc))); -- Generate: -- Any := TA_ObjRef (Reference); -- Set_TC (Any, RPC_Receiver.Obj_TypeCode); -- return Any; Statements := New_List ( Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Any, Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_TA_ObjRef), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Reference, Loc)))), Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Set_TC), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Any, Loc), Make_Selected_Component (Loc, Prefix => Defining_Identifier ( Stub_Elements.RPC_Receiver_Decl), Selector_Name => Name_Obj_TypeCode))), Make_Simple_Return_Statement (Loc, Expression => New_Occurrence_Of (Any, Loc))); Func_Body := Make_Subprogram_Body (Loc, Specification => Copy_Specification (Loc, Func_Spec), Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Statements)); Append_To (Body_Decls, Func_Body); end Add_RACW_To_Any; ----------------------- -- Add_RACW_TypeCode -- ----------------------- procedure Add_RACW_TypeCode (Designated_Type : Entity_Id; RACW_Type : Entity_Id; Body_Decls : List_Id) is Loc : constant Source_Ptr := Sloc (RACW_Type); Fnam : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (RACW_Type), 'Y')); Stub_Elements : constant Stub_Structure := Stubs_Table.Get (Designated_Type); pragma Assert (Stub_Elements /= Empty_Stub_Structure); Func_Spec : Node_Id; Func_Decl : Node_Id; Func_Body : Node_Id; begin -- The spec for this subprogram has a dummy 'access RACW' argument, -- which serves only for overloading purposes. Func_Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Fnam, Result_Definition => New_Occurrence_Of (RTE (RE_TypeCode), Loc)); -- NOTE: The usage occurrences of RACW_Parameter must refer to the -- entity in the declaration spec, not those of the body spec. Func_Decl := Make_Subprogram_Declaration (Loc, Func_Spec); Insert_After (Declaration_Node (RACW_Type), Func_Decl); Set_Renaming_TSS (RACW_Type, Fnam, TSS_TypeCode); if No (Body_Decls) then return; end if; Func_Body := Make_Subprogram_Body (Loc, Specification => Copy_Specification (Loc, Func_Spec), Declarations => Empty_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Simple_Return_Statement (Loc, Expression => Make_Selected_Component (Loc, Prefix => Defining_Identifier (Stub_Elements.RPC_Receiver_Decl), Selector_Name => Name_Obj_TypeCode))))); Append_To (Body_Decls, Func_Body); end Add_RACW_TypeCode; ------------------------------ -- Add_RACW_Write_Attribute -- ------------------------------ procedure Add_RACW_Write_Attribute (RACW_Type : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; Body_Decls : List_Id) is pragma Unreferenced (Stub_Type, Stub_Type_Access); Loc : constant Source_Ptr := Sloc (RACW_Type); Is_RAS : constant Boolean := not Comes_From_Source (RACW_Type); Stub_Elements : constant Stub_Structure := Get_Stub_Elements (RACW_Type); Body_Node : Node_Id; Proc_Decl : Node_Id; Attr_Decl : Node_Id; Statements : constant List_Id := New_List; Pnam : constant Entity_Id := Make_Temporary (Loc, 'R'); function Stream_Parameter return Node_Id; function Object return Node_Id; -- Functions to create occurrences of the formal parameter names ------------ -- Object -- ------------ function Object return Node_Id is begin return Make_Identifier (Loc, Name_V); end Object; ---------------------- -- Stream_Parameter -- ---------------------- function Stream_Parameter return Node_Id is begin return Make_Identifier (Loc, Name_S); end Stream_Parameter; -- Start of processing for Add_RACW_Write_Attribute begin Build_Stream_Procedure (Loc, RACW_Type, Body_Node, Pnam, Statements, Outp => False); Proc_Decl := Make_Subprogram_Declaration (Loc, Copy_Specification (Loc, Specification (Body_Node))); Attr_Decl := Make_Attribute_Definition_Clause (Loc, Name => New_Occurrence_Of (RACW_Type, Loc), Chars => Name_Write, Expression => New_Occurrence_Of ( Defining_Unit_Name (Specification (Proc_Decl)), Loc)); Insert_After (Declaration_Node (RACW_Type), Proc_Decl); Insert_After (Proc_Decl, Attr_Decl); if No (Body_Decls) then return; end if; Append_To (Statements, Pack_Node_Into_Stream_Access (Loc, Stream => Stream_Parameter, Object => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Reference), Loc), Parameter_Associations => New_List ( Unchecked_Convert_To (RTE (RE_Address), Object), Make_String_Literal (Loc, Strval => Fully_Qualified_Name_String (Etype (Designated_Type (RACW_Type)), Append_NUL => False)), Build_Stub_Tag (Loc, RACW_Type), New_Occurrence_Of (Boolean_Literals (Is_RAS), Loc), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Defining_Identifier (Stub_Elements.RPC_Receiver_Decl), Loc), Attribute_Name => Name_Access))), Etyp => RTE (RE_Object_Ref))); Append_To (Body_Decls, Body_Node); end Add_RACW_Write_Attribute; ----------------------- -- Add_RAST_Features -- ----------------------- procedure Add_RAST_Features (Vis_Decl : Node_Id; RAS_Type : Entity_Id) is begin Add_RAS_Access_TSS (Vis_Decl); Add_RAS_From_Any (RAS_Type); Add_RAS_TypeCode (RAS_Type); -- To_Any uses TypeCode, and therefore needs to be generated last Add_RAS_To_Any (RAS_Type); end Add_RAST_Features; ------------------------ -- Add_RAS_Access_TSS -- ------------------------ procedure Add_RAS_Access_TSS (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Ras_Type : constant Entity_Id := Defining_Identifier (N); Fat_Type : constant Entity_Id := Equivalent_Type (Ras_Type); -- Ras_Type is the access to subprogram type; Fat_Type is the -- corresponding record type. RACW_Type : constant Entity_Id := Underlying_RACW_Type (Ras_Type); Stub_Elements : constant Stub_Structure := Get_Stub_Elements (RACW_Type); Proc : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Make_TSS_Name (Ras_Type, TSS_RAS_Access)); Proc_Spec : Node_Id; -- Formal parameters Package_Name : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Name_P); -- Target package Subp_Id : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Name_S); -- Target subprogram Asynch_P : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Name_Asynchronous); -- Is the procedure to which the 'Access applies asynchronous? All_Calls_Remote : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Name_All_Calls_Remote); -- True if an All_Calls_Remote pragma applies to the RCI unit -- that contains the subprogram. -- Common local variables Proc_Decls : List_Id; Proc_Statements : List_Id; Subp_Ref : constant Entity_Id := Make_Defining_Identifier (Loc, Name_R); -- Reference that designates the target subprogram (returned -- by Get_RAS_Info). Is_Local : constant Entity_Id := Make_Defining_Identifier (Loc, Name_L); Local_Addr : constant Entity_Id := Make_Defining_Identifier (Loc, Name_A); -- For the call to Get_Local_Address Local_Stub : constant Entity_Id := Make_Temporary (Loc, 'L'); Stub_Ptr : constant Entity_Id := Make_Temporary (Loc, 'S'); -- Additional local variables for the remote case function Set_Field (Field_Name : Name_Id; Value : Node_Id) return Node_Id; -- Construct an assignment that sets the named component in the -- returned record --------------- -- Set_Field -- --------------- function Set_Field (Field_Name : Name_Id; Value : Node_Id) return Node_Id is begin return Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => Stub_Ptr, Selector_Name => Field_Name), Expression => Value); end Set_Field; -- Start of processing for Add_RAS_Access_TSS begin Proc_Decls := New_List ( -- Common declarations Make_Object_Declaration (Loc, Defining_Identifier => Subp_Ref, Object_Definition => New_Occurrence_Of (RTE (RE_Object_Ref), Loc)), Make_Object_Declaration (Loc, Defining_Identifier => Is_Local, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc)), Make_Object_Declaration (Loc, Defining_Identifier => Local_Addr, Object_Definition => New_Occurrence_Of (RTE (RE_Address), Loc)), Make_Object_Declaration (Loc, Defining_Identifier => Local_Stub, Aliased_Present => True, Object_Definition => New_Occurrence_Of (Stub_Elements.Stub_Type, Loc)), Make_Object_Declaration (Loc, Defining_Identifier => Stub_Ptr, Object_Definition => New_Occurrence_Of (Stub_Elements.Stub_Type_Access, Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Local_Stub, Loc), Attribute_Name => Name_Unchecked_Access))); Set_Etype (Stub_Ptr, Stub_Elements.Stub_Type_Access); -- Build_Get_Unique_RP_Call needs this information -- Get_RAS_Info (Pkg, Subp, R); -- Obtain a reference to the target subprogram Proc_Statements := New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Get_RAS_Info), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Package_Name, Loc), New_Occurrence_Of (Subp_Id, Loc), New_Occurrence_Of (Subp_Ref, Loc))), -- Get_Local_Address (R, L, A); -- Determine whether the subprogram is local (L), and if so -- obtain the local address of its proxy (A). Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Local_Address), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Subp_Ref, Loc), New_Occurrence_Of (Is_Local, Loc), New_Occurrence_Of (Local_Addr, Loc)))); -- Note: Here we assume that the Fat_Type is a record containing just -- an access to a proxy or stub object. Append_To (Proc_Statements, -- if L then Make_Implicit_If_Statement (N, Condition => New_Occurrence_Of (Is_Local, Loc), Then_Statements => New_List ( -- if A.Target = null then Make_Implicit_If_Statement (N, Condition => Make_Op_Eq (Loc, Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (RTE (RE_RAS_Proxy_Type_Access), New_Occurrence_Of (Local_Addr, Loc)), Selector_Name => Make_Identifier (Loc, Name_Target)), Make_Null (Loc)), Then_Statements => New_List ( -- A.Target := Entity_Of (Ref); Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (RTE (RE_RAS_Proxy_Type_Access), New_Occurrence_Of (Local_Addr, Loc)), Selector_Name => Make_Identifier (Loc, Name_Target)), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Entity_Of), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Subp_Ref, Loc)))), -- Inc_Usage (A.Target); -- end if; Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Inc_Usage), Loc), Parameter_Associations => New_List ( Make_Selected_Component (Loc, Prefix => Unchecked_Convert_To (RTE (RE_RAS_Proxy_Type_Access), New_Occurrence_Of (Local_Addr, Loc)), Selector_Name => Make_Identifier (Loc, Name_Target)))))), -- if not All_Calls_Remote then -- return Fat_Type!(A); -- end if; Make_Implicit_If_Statement (N, Condition => Make_Op_Not (Loc, Right_Opnd => New_Occurrence_Of (All_Calls_Remote, Loc)), Then_Statements => New_List ( Make_Simple_Return_Statement (Loc, Expression => Unchecked_Convert_To (Fat_Type, New_Occurrence_Of (Local_Addr, Loc)))))))); Append_List_To (Proc_Statements, New_List ( -- Stub.Target := Entity_Of (Ref); Set_Field (Name_Target, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Entity_Of), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Subp_Ref, Loc)))), -- Inc_Usage (Stub.Target); Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Inc_Usage), Loc), Parameter_Associations => New_List ( Make_Selected_Component (Loc, Prefix => Stub_Ptr, Selector_Name => Name_Target))), -- E.4.1(9) A remote call is asynchronous if it is a call to -- a procedure, or a call through a value of an access-to-procedure -- type, to which a pragma Asynchronous applies. -- Parameter Asynch_P is true when the procedure is asynchronous; -- Expression Asynch_T is true when the type is asynchronous. Set_Field (Name_Asynchronous, Make_Or_Else (Loc, Left_Opnd => New_Occurrence_Of (Asynch_P, Loc), Right_Opnd => New_Occurrence_Of (Boolean_Literals (Is_Asynchronous (Ras_Type)), Loc))))); Append_List_To (Proc_Statements, Build_Get_Unique_RP_Call (Loc, Stub_Ptr, Stub_Elements.Stub_Type)); Append_To (Proc_Statements, Make_Simple_Return_Statement (Loc, Expression => Unchecked_Convert_To (Fat_Type, New_Occurrence_Of (Stub_Ptr, Loc)))); Proc_Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Proc, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Package_Name, Parameter_Type => New_Occurrence_Of (Standard_String, Loc)), Make_Parameter_Specification (Loc, Defining_Identifier => Subp_Id, Parameter_Type => New_Occurrence_Of (Standard_String, Loc)), Make_Parameter_Specification (Loc, Defining_Identifier => Asynch_P, Parameter_Type => New_Occurrence_Of (Standard_Boolean, Loc)), Make_Parameter_Specification (Loc, Defining_Identifier => All_Calls_Remote, Parameter_Type => New_Occurrence_Of (Standard_Boolean, Loc))), Result_Definition => New_Occurrence_Of (Fat_Type, Loc)); -- Set the kind and return type of the function to prevent -- ambiguities between Ras_Type and Fat_Type in subsequent analysis. Set_Ekind (Proc, E_Function); Set_Etype (Proc, Fat_Type); Discard_Node ( Make_Subprogram_Body (Loc, Specification => Proc_Spec, Declarations => Proc_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Proc_Statements))); Set_TSS (Fat_Type, Proc); end Add_RAS_Access_TSS; ---------------------- -- Add_RAS_From_Any -- ---------------------- procedure Add_RAS_From_Any (RAS_Type : Entity_Id) is Loc : constant Source_Ptr := Sloc (RAS_Type); Fnam : constant Entity_Id := Make_Defining_Identifier (Loc, Make_TSS_Name (RAS_Type, TSS_From_Any)); Func_Spec : Node_Id; Statements : List_Id; Any_Parameter : constant Entity_Id := Make_Defining_Identifier (Loc, Name_A); begin Statements := New_List ( Make_Simple_Return_Statement (Loc, Expression => Make_Aggregate (Loc, Component_Associations => New_List ( Make_Component_Association (Loc, Choices => New_List (Make_Identifier (Loc, Name_Ras)), Expression => PolyORB_Support.Helpers.Build_From_Any_Call (Underlying_RACW_Type (RAS_Type), New_Occurrence_Of (Any_Parameter, Loc), No_List)))))); Func_Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Fnam, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Any_Parameter, Parameter_Type => New_Occurrence_Of (RTE (RE_Any), Loc))), Result_Definition => New_Occurrence_Of (RAS_Type, Loc)); Discard_Node ( Make_Subprogram_Body (Loc, Specification => Func_Spec, Declarations => No_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Statements))); Set_TSS (RAS_Type, Fnam); end Add_RAS_From_Any; -------------------- -- Add_RAS_To_Any -- -------------------- procedure Add_RAS_To_Any (RAS_Type : Entity_Id) is Loc : constant Source_Ptr := Sloc (RAS_Type); Fnam : constant Entity_Id := Make_Defining_Identifier (Loc, Make_TSS_Name (RAS_Type, TSS_To_Any)); Decls : List_Id; Statements : List_Id; Func_Spec : Node_Id; Any : constant Entity_Id := Make_Temporary (Loc, 'A'); RAS_Parameter : constant Entity_Id := Make_Temporary (Loc, 'R'); RACW_Parameter : constant Node_Id := Make_Selected_Component (Loc, Prefix => RAS_Parameter, Selector_Name => Name_Ras); begin -- Object declarations Set_Etype (RACW_Parameter, Underlying_RACW_Type (RAS_Type)); Decls := New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Any, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc), Expression => PolyORB_Support.Helpers.Build_To_Any_Call (Loc, RACW_Parameter, No_List))); Statements := New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Set_TC), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Any, Loc), PolyORB_Support.Helpers.Build_TypeCode_Call (Loc, RAS_Type, Decls))), Make_Simple_Return_Statement (Loc, Expression => New_Occurrence_Of (Any, Loc))); Func_Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Fnam, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => RAS_Parameter, Parameter_Type => New_Occurrence_Of (RAS_Type, Loc))), Result_Definition => New_Occurrence_Of (RTE (RE_Any), Loc)); Discard_Node ( Make_Subprogram_Body (Loc, Specification => Func_Spec, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Statements))); Set_TSS (RAS_Type, Fnam); end Add_RAS_To_Any; ---------------------- -- Add_RAS_TypeCode -- ---------------------- procedure Add_RAS_TypeCode (RAS_Type : Entity_Id) is Loc : constant Source_Ptr := Sloc (RAS_Type); Fnam : constant Entity_Id := Make_Defining_Identifier (Loc, Make_TSS_Name (RAS_Type, TSS_TypeCode)); Func_Spec : Node_Id; Decls : constant List_Id := New_List; Name_String : String_Id; Repo_Id_String : String_Id; begin Func_Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Fnam, Result_Definition => New_Occurrence_Of (RTE (RE_TypeCode), Loc)); PolyORB_Support.Helpers.Build_Name_And_Repository_Id (RAS_Type, Name_Str => Name_String, Repo_Id_Str => Repo_Id_String); Discard_Node ( Make_Subprogram_Body (Loc, Specification => Func_Spec, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Simple_Return_Statement (Loc, Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Build_Complex_TC), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (RTE (RE_Tk_Objref), Loc), Make_Aggregate (Loc, Expressions => New_List ( Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_TA_Std_String), Loc), Parameter_Associations => New_List ( Make_String_Literal (Loc, Name_String))), Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_TA_Std_String), Loc), Parameter_Associations => New_List ( Make_String_Literal (Loc, Strval => Repo_Id_String)))))))))))); Set_TSS (RAS_Type, Fnam); end Add_RAS_TypeCode; ----------------------------------------- -- Add_Receiving_Stubs_To_Declarations -- ----------------------------------------- procedure Add_Receiving_Stubs_To_Declarations (Pkg_Spec : Node_Id; Decls : List_Id; Stmts : List_Id) is Loc : constant Source_Ptr := Sloc (Pkg_Spec); Pkg_RPC_Receiver : constant Entity_Id := Make_Temporary (Loc, 'H'); Pkg_RPC_Receiver_Object : Node_Id; Pkg_RPC_Receiver_Body : Node_Id; Pkg_RPC_Receiver_Decls : List_Id; Pkg_RPC_Receiver_Statements : List_Id; Pkg_RPC_Receiver_Cases : constant List_Id := New_List; -- A Pkg_RPC_Receiver is built to decode the request Request : Node_Id; -- Request object received from neutral layer Subp_Id : Entity_Id; -- Subprogram identifier as received from the neutral distribution -- core. Subp_Index : Entity_Id; -- Internal index as determined by matching either the method name -- from the request structure, or the local subprogram address (in -- case of a RAS). Is_Local : constant Entity_Id := Make_Temporary (Loc, 'L'); Local_Address : constant Entity_Id := Make_Temporary (Loc, 'A'); -- Address of a local subprogram designated by a reference -- corresponding to a RAS. Dispatch_On_Address : constant List_Id := New_List; Dispatch_On_Name : constant List_Id := New_List; Current_Subp_Number : Int := First_RCI_Subprogram_Id; Subp_Info_Array : constant Entity_Id := Make_Temporary (Loc, 'I'); Subp_Info_List : constant List_Id := New_List; Register_Pkg_Actuals : constant List_Id := New_List; All_Calls_Remote_E : Entity_Id; procedure Append_Stubs_To (RPC_Receiver_Cases : List_Id; Declaration : Node_Id; Stubs : Node_Id; Subp_Number : Int; Subp_Dist_Name : Entity_Id; Subp_Proxy_Addr : Entity_Id); -- Add one case to the specified RPC receiver case list associating -- Subprogram_Number with the subprogram declared by Declaration, for -- which we have receiving stubs in Stubs. Subp_Number is an internal -- subprogram index. Subp_Dist_Name is the string used to call the -- subprogram by name, and Subp_Dist_Addr is the address of the proxy -- object, used in the context of calls through remote -- access-to-subprogram types. procedure Visit_Subprogram (Decl : Node_Id); -- Generate receiving stub for one remote subprogram --------------------- -- Append_Stubs_To -- --------------------- procedure Append_Stubs_To (RPC_Receiver_Cases : List_Id; Declaration : Node_Id; Stubs : Node_Id; Subp_Number : Int; Subp_Dist_Name : Entity_Id; Subp_Proxy_Addr : Entity_Id) is Case_Stmts : List_Id; begin Case_Stmts := New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of ( Defining_Entity (Stubs), Loc), Parameter_Associations => New_List (New_Occurrence_Of (Request, Loc)))); if Nkind (Specification (Declaration)) = N_Function_Specification or else not Is_Asynchronous (Defining_Entity (Specification (Declaration))) then Append_To (Case_Stmts, Make_Simple_Return_Statement (Loc)); end if; Append_To (RPC_Receiver_Cases, Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List (Make_Integer_Literal (Loc, Subp_Number)), Statements => Case_Stmts)); Append_To (Dispatch_On_Name, Make_Elsif_Part (Loc, Condition => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Caseless_String_Eq), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Subp_Id, Loc), New_Occurrence_Of (Subp_Dist_Name, Loc))), Then_Statements => New_List ( Make_Assignment_Statement (Loc, New_Occurrence_Of (Subp_Index, Loc), Make_Integer_Literal (Loc, Subp_Number))))); Append_To (Dispatch_On_Address, Make_Elsif_Part (Loc, Condition => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (Local_Address, Loc), Right_Opnd => New_Occurrence_Of (Subp_Proxy_Addr, Loc)), Then_Statements => New_List ( Make_Assignment_Statement (Loc, New_Occurrence_Of (Subp_Index, Loc), Make_Integer_Literal (Loc, Subp_Number))))); end Append_Stubs_To; ---------------------- -- Visit_Subprogram -- ---------------------- procedure Visit_Subprogram (Decl : Node_Id) is Loc : constant Source_Ptr := Sloc (Decl); Spec : constant Node_Id := Specification (Decl); Subp_Def : constant Entity_Id := Defining_Unit_Name (Spec); Subp_Val : String_Id; Subp_Dist_Name : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Related_Id => Chars (Subp_Def), Suffix => 'D', Suffix_Index => -1)); Current_Stubs : Node_Id; Proxy_Obj_Addr : Entity_Id; begin -- Disable expansion of stubs if serious errors have been -- diagnosed, because otherwise some illegal remote subprogram -- declarations could cause cascaded errors in stubs. if Serious_Errors_Detected /= 0 then return; end if; -- Build receiving stub Current_Stubs := Build_Subprogram_Receiving_Stubs (Vis_Decl => Decl, Asynchronous => Nkind (Spec) = N_Procedure_Specification and then Is_Asynchronous (Subp_Def)); Append_To (Decls, Current_Stubs); Analyze (Current_Stubs); -- Build RAS proxy Add_RAS_Proxy_And_Analyze (Decls, Vis_Decl => Decl, All_Calls_Remote_E => All_Calls_Remote_E, Proxy_Object_Addr => Proxy_Obj_Addr); -- Compute distribution identifier Assign_Subprogram_Identifier (Subp_Def, Current_Subp_Number, Subp_Val); pragma Assert (Current_Subp_Number = Get_Subprogram_Id (Subp_Def)); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Subp_Dist_Name, Constant_Present => True, Object_Definition => New_Occurrence_Of (Standard_String, Loc), Expression => Make_String_Literal (Loc, Subp_Val))); Analyze (Last (Decls)); -- Add subprogram descriptor (RCI_Subp_Info) to the subprograms -- table for this receiver. The aggregate below must be kept -- consistent with the declaration of RCI_Subp_Info in -- System.Partition_Interface. Append_To (Subp_Info_List, Make_Component_Association (Loc, Choices => New_List (Make_Integer_Literal (Loc, Current_Subp_Number)), Expression => Make_Aggregate (Loc, Expressions => New_List ( -- Name => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Subp_Dist_Name, Loc), Attribute_Name => Name_Address), -- Name_Length => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Subp_Dist_Name, Loc), Attribute_Name => Name_Length), -- Addr => New_Occurrence_Of (Proxy_Obj_Addr, Loc))))); Append_Stubs_To (Pkg_RPC_Receiver_Cases, Declaration => Decl, Stubs => Current_Stubs, Subp_Number => Current_Subp_Number, Subp_Dist_Name => Subp_Dist_Name, Subp_Proxy_Addr => Proxy_Obj_Addr); Current_Subp_Number := Current_Subp_Number + 1; end Visit_Subprogram; procedure Visit_Spec is new Build_Package_Stubs (Visit_Subprogram); -- Start of processing for Add_Receiving_Stubs_To_Declarations begin -- Building receiving stubs consist in several operations: -- - a package RPC receiver must be built. This subprogram will get -- a Subprogram_Id from the incoming stream and will dispatch the -- call to the right subprogram; -- - a receiving stub for each subprogram visible in the package -- spec. This stub will read all the parameters from the stream, -- and put the result as well as the exception occurrence in the -- output stream; Build_RPC_Receiver_Body ( RPC_Receiver => Pkg_RPC_Receiver, Request => Request, Subp_Id => Subp_Id, Subp_Index => Subp_Index, Stmts => Pkg_RPC_Receiver_Statements, Decl => Pkg_RPC_Receiver_Body); Pkg_RPC_Receiver_Decls := Declarations (Pkg_RPC_Receiver_Body); -- Extract local address information from the target reference: -- if non-null, that means that this is a reference that denotes -- one particular operation, and hence that the operation name -- must not be taken into account for dispatching. Append_To (Pkg_RPC_Receiver_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Is_Local, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc))); Append_To (Pkg_RPC_Receiver_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Local_Address, Object_Definition => New_Occurrence_Of (RTE (RE_Address), Loc))); Append_To (Pkg_RPC_Receiver_Statements, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Local_Address), Loc), Parameter_Associations => New_List ( Make_Selected_Component (Loc, Prefix => Request, Selector_Name => Name_Target), New_Occurrence_Of (Is_Local, Loc), New_Occurrence_Of (Local_Address, Loc)))); -- For each subprogram, the receiving stub will be built and a case -- statement will be made on the Subprogram_Id to dispatch to the -- right subprogram. All_Calls_Remote_E := Boolean_Literals ( Has_All_Calls_Remote (Defining_Entity (Pkg_Spec))); Overload_Counter_Table.Reset; Reserve_NamingContext_Methods; Visit_Spec (Pkg_Spec); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Subp_Info_Array, Constant_Present => True, Aliased_Present => True, Object_Definition => Make_Subtype_Indication (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RE_RCI_Subp_Info_Array), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, New_List ( Make_Range (Loc, Low_Bound => Make_Integer_Literal (Loc, Intval => First_RCI_Subprogram_Id), High_Bound => Make_Integer_Literal (Loc, Intval => First_RCI_Subprogram_Id + List_Length (Subp_Info_List) - 1))))))); if Present (First (Subp_Info_List)) then Set_Expression (Last (Decls), Make_Aggregate (Loc, Component_Associations => Subp_Info_List)); -- Generate the dispatch statement to determine the subprogram id -- of the called subprogram. -- We first test whether the reference that was used to make the -- call was the base RCI reference (in which case Local_Address is -- zero, and the method identifier from the request must be used -- to determine which subprogram is called) or a reference -- identifying one particular subprogram (in which case -- Local_Address is the address of that subprogram, and the -- method name from the request is ignored). The latter occurs -- for the case of a call through a remote access-to-subprogram. -- In each case, cascaded elsifs are used to determine the proper -- subprogram index. Using hash tables might be more efficient. Append_To (Pkg_RPC_Receiver_Statements, Make_Implicit_If_Statement (Pkg_Spec, Condition => Make_Op_Ne (Loc, Left_Opnd => New_Occurrence_Of (Local_Address, Loc), Right_Opnd => New_Occurrence_Of (RTE (RE_Null_Address), Loc)), Then_Statements => New_List ( Make_Implicit_If_Statement (Pkg_Spec, Condition => New_Occurrence_Of (Standard_False, Loc), Then_Statements => New_List ( Make_Null_Statement (Loc)), Elsif_Parts => Dispatch_On_Address)), Else_Statements => New_List ( Make_Implicit_If_Statement (Pkg_Spec, Condition => New_Occurrence_Of (Standard_False, Loc), Then_Statements => New_List (Make_Null_Statement (Loc)), Elsif_Parts => Dispatch_On_Name)))); else -- For a degenerate RCI with no visible subprograms, -- Subp_Info_List has zero length, and the declaration is for an -- empty array, in which case no initialization aggregate must be -- generated. We do not generate a Dispatch_Statement either. -- No initialization provided: remove CONSTANT so that the -- declaration is not an incomplete deferred constant. Set_Constant_Present (Last (Decls), False); end if; -- Analyze Subp_Info_Array declaration Analyze (Last (Decls)); -- If we receive an invalid Subprogram_Id, it is best to do nothing -- rather than raising an exception since we do not want someone -- to crash a remote partition by sending invalid subprogram ids. -- This is consistent with the other parts of the case statement -- since even in presence of incorrect parameters in the stream, -- every exception will be caught and (if the subprogram is not an -- APC) put into the result stream and sent away. Append_To (Pkg_RPC_Receiver_Cases, Make_Case_Statement_Alternative (Loc, Discrete_Choices => New_List (Make_Others_Choice (Loc)), Statements => New_List (Make_Null_Statement (Loc)))); Append_To (Pkg_RPC_Receiver_Statements, Make_Case_Statement (Loc, Expression => New_Occurrence_Of (Subp_Index, Loc), Alternatives => Pkg_RPC_Receiver_Cases)); -- Pkg_RPC_Receiver body is now complete: insert it into the tree and -- analyze it. Append_To (Decls, Pkg_RPC_Receiver_Body); Analyze (Last (Decls)); Pkg_RPC_Receiver_Object := Make_Object_Declaration (Loc, Defining_Identifier => Make_Temporary (Loc, 'R'), Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Servant), Loc)); Append_To (Decls, Pkg_RPC_Receiver_Object); Analyze (Last (Decls)); -- Name Append_To (Register_Pkg_Actuals, Make_String_Literal (Loc, Strval => Fully_Qualified_Name_String (Defining_Entity (Pkg_Spec), Append_NUL => False))); -- Version Append_To (Register_Pkg_Actuals, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Defining_Entity (Pkg_Spec), Loc), Attribute_Name => Name_Version)); -- Handler Append_To (Register_Pkg_Actuals, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Pkg_RPC_Receiver, Loc), Attribute_Name => Name_Access)); -- Receiver Append_To (Register_Pkg_Actuals, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of ( Defining_Identifier (Pkg_RPC_Receiver_Object), Loc), Attribute_Name => Name_Access)); -- Subp_Info Append_To (Register_Pkg_Actuals, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Subp_Info_Array, Loc), Attribute_Name => Name_Address)); -- Subp_Info_Len Append_To (Register_Pkg_Actuals, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Subp_Info_Array, Loc), Attribute_Name => Name_Length)); -- Is_All_Calls_Remote Append_To (Register_Pkg_Actuals, New_Occurrence_Of (All_Calls_Remote_E, Loc)); -- Finally call Register_Pkg_Receiving_Stub with the above parameters Append_To (Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Register_Pkg_Receiving_Stub), Loc), Parameter_Associations => Register_Pkg_Actuals)); Analyze (Last (Stmts)); end Add_Receiving_Stubs_To_Declarations; --------------------------------- -- Build_General_Calling_Stubs -- --------------------------------- procedure Build_General_Calling_Stubs (Decls : List_Id; Statements : List_Id; Target_Object : Node_Id; Subprogram_Id : Node_Id; Asynchronous : Node_Id := Empty; Is_Known_Asynchronous : Boolean := False; Is_Known_Non_Asynchronous : Boolean := False; Is_Function : Boolean; Spec : Node_Id; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Nod : Node_Id) is Loc : constant Source_Ptr := Sloc (Nod); Request : constant Entity_Id := Make_Temporary (Loc, 'R'); -- The request object constructed by these stubs -- Could we use Name_R instead??? (see GLADE client stubs) function Make_Request_RTE_Call (RE : RE_Id; Actuals : List_Id := New_List) return Node_Id; -- Generate a procedure call statement calling RE with the given -- actuals. Request'Access is appended to the list. --------------------------- -- Make_Request_RTE_Call -- --------------------------- function Make_Request_RTE_Call (RE : RE_Id; Actuals : List_Id := New_List) return Node_Id is begin Append_To (Actuals, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Request, Loc), Attribute_Name => Name_Access)); return Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE), Loc), Parameter_Associations => Actuals); end Make_Request_RTE_Call; Arguments : Node_Id; -- Name of the named values list used to transmit parameters -- to the remote package Result : Node_Id; -- Name of the result named value (in non-APC cases) which get the -- result of the remote subprogram. Result_TC : Node_Id; -- Typecode expression for the result of the request (void -- typecode for procedures). Exception_Return_Parameter : Node_Id; -- Name of the parameter which will hold the exception sent by the -- remote subprogram. Current_Parameter : Node_Id; -- Current parameter being handled Ordered_Parameters_List : constant List_Id := Build_Ordered_Parameters_List (Spec); Asynchronous_P : Node_Id; -- A Boolean expression indicating whether this call is asynchronous Asynchronous_Statements : List_Id := No_List; Non_Asynchronous_Statements : List_Id := No_List; -- Statements specifics to the Asynchronous/Non-Asynchronous cases Extra_Formal_Statements : constant List_Id := New_List; -- List of statements for extra formal parameters. It will appear -- after the regular statements for writing out parameters. After_Statements : constant List_Id := New_List; -- Statements to be executed after call returns (to assign IN OUT or -- OUT parameter values). Etyp : Entity_Id; -- The type of the formal parameter being processed Is_Controlling_Formal : Boolean; Is_First_Controlling_Formal : Boolean; First_Controlling_Formal_Seen : Boolean := False; -- Controlling formal parameters of distributed object primitives -- require special handling, and the first such parameter needs even -- more special handling. begin -- ??? document general form of stub subprograms for the PolyORB case Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Request, Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Request), Loc))); Result := Make_Temporary (Loc, 'R'); if Is_Function then Result_TC := PolyORB_Support.Helpers.Build_TypeCode_Call (Loc, Etype (Result_Definition (Spec)), Decls); else Result_TC := New_Occurrence_Of (RTE (RE_TC_Void), Loc); end if; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Result, Aliased_Present => False, Object_Definition => New_Occurrence_Of (RTE (RE_NamedValue), Loc), Expression => Make_Aggregate (Loc, Component_Associations => New_List ( Make_Component_Association (Loc, Choices => New_List (Make_Identifier (Loc, Name_Name)), Expression => New_Occurrence_Of (RTE (RE_Result_Name), Loc)), Make_Component_Association (Loc, Choices => New_List ( Make_Identifier (Loc, Name_Argument)), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Create_Any), Loc), Parameter_Associations => New_List (Result_TC))), Make_Component_Association (Loc, Choices => New_List ( Make_Identifier (Loc, Name_Arg_Modes)), Expression => Make_Integer_Literal (Loc, 0)))))); if not Is_Known_Asynchronous then Exception_Return_Parameter := Make_Temporary (Loc, 'E'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Exception_Return_Parameter, Object_Definition => New_Occurrence_Of (RTE (RE_Exception_Occurrence), Loc))); else Exception_Return_Parameter := Empty; end if; -- Initialize and fill in arguments list Arguments := Make_Temporary (Loc, 'A'); Declare_Create_NVList (Loc, Arguments, Decls, Statements); Current_Parameter := First (Ordered_Parameters_List); while Present (Current_Parameter) loop if Is_RACW_Controlling_Formal (Current_Parameter, Stub_Type) then Is_Controlling_Formal := True; Is_First_Controlling_Formal := not First_Controlling_Formal_Seen; First_Controlling_Formal_Seen := True; else Is_Controlling_Formal := False; Is_First_Controlling_Formal := False; end if; if Is_Controlling_Formal then -- For a controlling formal argument, we send its reference Etyp := RACW_Type; else Etyp := Etype (Parameter_Type (Current_Parameter)); end if; -- The first controlling formal parameter is treated specially: -- it is used to set the target object of the call. if not Is_First_Controlling_Formal then declare Constrained : constant Boolean := Is_Constrained (Etyp) or else Is_Elementary_Type (Etyp); Any : constant Entity_Id := Make_Temporary (Loc, 'A'); Actual_Parameter : Node_Id := New_Occurrence_Of ( Defining_Identifier ( Current_Parameter), Loc); Expr : Node_Id; begin if Is_Controlling_Formal then -- For a controlling formal parameter (other than the -- first one), use the corresponding RACW. If the -- parameter is not an anonymous access parameter, that -- involves taking its 'Unrestricted_Access. if Nkind (Parameter_Type (Current_Parameter)) = N_Access_Definition then Actual_Parameter := OK_Convert_To (Etyp, Actual_Parameter); else Actual_Parameter := OK_Convert_To (Etyp, Make_Attribute_Reference (Loc, Prefix => Actual_Parameter, Attribute_Name => Name_Unrestricted_Access)); end if; end if; if In_Present (Current_Parameter) or else not Out_Present (Current_Parameter) or else not Constrained or else Is_Controlling_Formal then -- The parameter has an input value, is constrained at -- runtime by an input value, or is a controlling formal -- parameter (always passed as a reference) other than -- the first one. Expr := PolyORB_Support.Helpers.Build_To_Any_Call (Loc, Actual_Parameter, Decls); else Expr := Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Create_Any), Loc), Parameter_Associations => New_List ( PolyORB_Support.Helpers.Build_TypeCode_Call (Loc, Etyp, Decls))); end if; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Any, Aliased_Present => False, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc), Expression => Expr)); Append_To (Statements, Add_Parameter_To_NVList (Loc, Parameter => Current_Parameter, NVList => Arguments, Constrained => Constrained, Any => Any)); if Out_Present (Current_Parameter) and then not Is_Controlling_Formal then if Is_Limited_Type (Etyp) then Helpers.Assign_Opaque_From_Any (Loc, Stms => After_Statements, Typ => Etyp, N => New_Occurrence_Of (Any, Loc), Target => Defining_Identifier (Current_Parameter), Constrained => True); else Append_To (After_Statements, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of ( Defining_Identifier (Current_Parameter), Loc), Expression => PolyORB_Support.Helpers.Build_From_Any_Call (Etyp, New_Occurrence_Of (Any, Loc), Decls))); end if; end if; end; end if; -- If the current parameter has a dynamic constrained status, then -- this status is transmitted as well. -- This should be done for accessibility as well ??? if Nkind (Parameter_Type (Current_Parameter)) /= N_Access_Definition and then Need_Extra_Constrained (Current_Parameter) then -- In this block, we do not use the extra formal that has been -- created because it does not exist at the time of expansion -- when building calling stubs for remote access to subprogram -- types. We create an extra variable of this type and push it -- in the stream after the regular parameters. declare Extra_Any_Parameter : constant Entity_Id := Make_Temporary (Loc, 'P'); Parameter_Exp : constant Node_Id := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of ( Defining_Identifier (Current_Parameter), Loc), Attribute_Name => Name_Constrained); begin Set_Etype (Parameter_Exp, Etype (Standard_Boolean)); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Extra_Any_Parameter, Aliased_Present => False, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc), Expression => PolyORB_Support.Helpers.Build_To_Any_Call (Loc, Parameter_Exp, Decls))); Append_To (Extra_Formal_Statements, Add_Parameter_To_NVList (Loc, Parameter => Extra_Any_Parameter, NVList => Arguments, Constrained => True, Any => Extra_Any_Parameter)); end; end if; Next (Current_Parameter); end loop; -- Append the formal statements list to the statements Append_List_To (Statements, Extra_Formal_Statements); Append_To (Statements, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Request_Setup), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Request, Loc), Target_Object, Subprogram_Id, New_Occurrence_Of (Arguments, Loc), New_Occurrence_Of (Result, Loc), New_Occurrence_Of (RTE (RE_Nil_Exc_List), Loc)))); pragma Assert (not (Is_Known_Non_Asynchronous and Is_Known_Asynchronous)); if Is_Known_Non_Asynchronous or Is_Known_Asynchronous then Asynchronous_P := New_Occurrence_Of (Boolean_Literals (Is_Known_Asynchronous), Loc); else pragma Assert (Present (Asynchronous)); Asynchronous_P := New_Copy_Tree (Asynchronous); -- The expression node Asynchronous will be used to build an 'if' -- statement at the end of Build_General_Calling_Stubs: we need to -- make a copy here. end if; Append_To (Parameter_Associations (Last (Statements)), Make_Indexed_Component (Loc, Prefix => New_Occurrence_Of ( RTE (RE_Asynchronous_P_To_Sync_Scope), Loc), Expressions => New_List (Asynchronous_P))); Append_To (Statements, Make_Request_RTE_Call (RE_Request_Invoke)); -- Asynchronous case if not Is_Known_Non_Asynchronous then Asynchronous_Statements := New_List (Make_Null_Statement (Loc)); end if; -- Non-asynchronous case if not Is_Known_Asynchronous then -- Reraise an exception occurrence from the completed request. -- If the exception occurrence is empty, this is a no-op. Non_Asynchronous_Statements := New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Request_Raise_Occurrence), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Request, Loc)))); if Is_Function then -- If this is a function call, read the value and return it Append_To (Non_Asynchronous_Statements, Make_Tag_Check (Loc, Make_Simple_Return_Statement (Loc, PolyORB_Support.Helpers.Build_From_Any_Call (Etype (Result_Definition (Spec)), Make_Selected_Component (Loc, Prefix => Result, Selector_Name => Name_Argument), Decls)))); else -- Case of a procedure: deal with IN OUT and OUT formals Append_List_To (Non_Asynchronous_Statements, After_Statements); end if; end if; if Is_Known_Asynchronous then Append_List_To (Statements, Asynchronous_Statements); elsif Is_Known_Non_Asynchronous then Append_List_To (Statements, Non_Asynchronous_Statements); else pragma Assert (Present (Asynchronous)); Append_To (Statements, Make_Implicit_If_Statement (Nod, Condition => Asynchronous, Then_Statements => Asynchronous_Statements, Else_Statements => Non_Asynchronous_Statements)); end if; end Build_General_Calling_Stubs; ----------------------- -- Build_Stub_Target -- ----------------------- function Build_Stub_Target (Loc : Source_Ptr; Decls : List_Id; RCI_Locator : Entity_Id; Controlling_Parameter : Entity_Id) return RPC_Target is Target_Info : RPC_Target (PCS_Kind => Name_PolyORB_DSA); Target_Reference : constant Entity_Id := Make_Temporary (Loc, 'T'); begin if Present (Controlling_Parameter) then Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Target_Reference, Object_Definition => New_Occurrence_Of (RTE (RE_Object_Ref), Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Make_Ref), Loc), Parameter_Associations => New_List ( Make_Selected_Component (Loc, Prefix => Controlling_Parameter, Selector_Name => Name_Target))))); -- Note: Controlling_Parameter has the same components as -- System.Partition_Interface.RACW_Stub_Type. Target_Info.Object := New_Occurrence_Of (Target_Reference, Loc); else Target_Info.Object := Make_Selected_Component (Loc, Prefix => Make_Identifier (Loc, Chars (RCI_Locator)), Selector_Name => Make_Identifier (Loc, Name_Get_RCI_Package_Ref)); end if; return Target_Info; end Build_Stub_Target; ----------------------------- -- Build_RPC_Receiver_Body -- ----------------------------- procedure Build_RPC_Receiver_Body (RPC_Receiver : Entity_Id; Request : out Entity_Id; Subp_Id : out Entity_Id; Subp_Index : out Entity_Id; Stmts : out List_Id; Decl : out Node_Id) is Loc : constant Source_Ptr := Sloc (RPC_Receiver); RPC_Receiver_Spec : Node_Id; RPC_Receiver_Decls : List_Id; begin Request := Make_Defining_Identifier (Loc, Name_R); RPC_Receiver_Spec := Build_RPC_Receiver_Specification (RPC_Receiver => RPC_Receiver, Request_Parameter => Request); Subp_Id := Make_Defining_Identifier (Loc, Name_P); Subp_Index := Make_Defining_Identifier (Loc, Name_I); RPC_Receiver_Decls := New_List ( Make_Object_Renaming_Declaration (Loc, Defining_Identifier => Subp_Id, Subtype_Mark => New_Occurrence_Of (Standard_String, Loc), Name => Make_Explicit_Dereference (Loc, Prefix => Make_Selected_Component (Loc, Prefix => Request, Selector_Name => Name_Operation))), Make_Object_Declaration (Loc, Defining_Identifier => Subp_Index, Object_Definition => New_Occurrence_Of (RTE (RE_Subprogram_Id), Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Subprogram_Id), Loc), Attribute_Name => Name_Last))); Stmts := New_List; Decl := Make_Subprogram_Body (Loc, Specification => RPC_Receiver_Spec, Declarations => RPC_Receiver_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stmts)); end Build_RPC_Receiver_Body; -------------------------------------- -- Build_Subprogram_Receiving_Stubs -- -------------------------------------- function Build_Subprogram_Receiving_Stubs (Vis_Decl : Node_Id; Asynchronous : Boolean; Dynamically_Asynchronous : Boolean := False; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Parent_Primitive : Entity_Id := Empty) return Node_Id is Loc : constant Source_Ptr := Sloc (Vis_Decl); Request_Parameter : constant Entity_Id := Make_Temporary (Loc, 'R'); -- Formal parameter for receiving stubs: a descriptor for an incoming -- request. Outer_Decls : constant List_Id := New_List; -- At the outermost level, an NVList and Any's are declared for all -- parameters. The Dynamic_Async flag also needs to be declared there -- to be visible from the exception handling code. Outer_Statements : constant List_Id := New_List; -- Statements that occur prior to the declaration of the actual -- parameter variables. Outer_Extra_Formal_Statements : constant List_Id := New_List; -- Statements concerning extra formal parameters, prior to the -- declaration of the actual parameter variables. Decls : constant List_Id := New_List; -- All the parameters will get declared before calling the real -- subprograms. Also the out parameters will be declared. At this -- level, parameters may be unconstrained. Statements : constant List_Id := New_List; After_Statements : constant List_Id := New_List; -- Statements to be executed after the subprogram call Inner_Decls : List_Id := No_List; -- In case of a function, the inner declarations are needed since -- the result may be unconstrained. Excep_Handlers : List_Id := No_List; Parameter_List : constant List_Id := New_List; -- List of parameters to be passed to the subprogram First_Controlling_Formal_Seen : Boolean := False; Current_Parameter : Node_Id; Ordered_Parameters_List : constant List_Id := Build_Ordered_Parameters_List (Specification (Vis_Decl)); Arguments : constant Entity_Id := Make_Temporary (Loc, 'A'); -- Name of the named values list used to retrieve parameters Subp_Spec : Node_Id; -- Subprogram specification Called_Subprogram : Node_Id; -- The subprogram to call begin if Present (RACW_Type) then Called_Subprogram := New_Occurrence_Of (Parent_Primitive, Loc); else Called_Subprogram := New_Occurrence_Of (Defining_Unit_Name (Specification (Vis_Decl)), Loc); end if; Declare_Create_NVList (Loc, Arguments, Outer_Decls, Outer_Statements); -- Loop through every parameter and get its value from the stream. If -- the parameter is unconstrained, then the parameter is read using -- 'Input at the point of declaration. Current_Parameter := First (Ordered_Parameters_List); while Present (Current_Parameter) loop declare Etyp : Entity_Id; Constrained : Boolean; Any : Entity_Id := Empty; Object : constant Entity_Id := Make_Temporary (Loc, 'P'); Expr : Node_Id := Empty; Is_Controlling_Formal : constant Boolean := Is_RACW_Controlling_Formal (Current_Parameter, Stub_Type); Is_First_Controlling_Formal : Boolean := False; Need_Extra_Constrained : Boolean; -- True when an extra constrained actual is required begin if Is_Controlling_Formal then -- Controlling formals in distributed object primitive -- operations are handled specially: -- - the first controlling formal is used as the -- target of the call; -- - the remaining controlling formals are transmitted -- as RACWs. Etyp := RACW_Type; Is_First_Controlling_Formal := not First_Controlling_Formal_Seen; First_Controlling_Formal_Seen := True; else Etyp := Etype (Parameter_Type (Current_Parameter)); end if; Constrained := Is_Constrained (Etyp) or else Is_Elementary_Type (Etyp); if not Is_First_Controlling_Formal then Any := Make_Temporary (Loc, 'A'); Append_To (Outer_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Any, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Create_Any), Loc), Parameter_Associations => New_List ( PolyORB_Support.Helpers.Build_TypeCode_Call (Loc, Etyp, Outer_Decls))))); Append_To (Outer_Statements, Add_Parameter_To_NVList (Loc, Parameter => Current_Parameter, NVList => Arguments, Constrained => Constrained, Any => Any)); end if; if Is_First_Controlling_Formal then declare Addr : constant Entity_Id := Make_Temporary (Loc, 'A'); Is_Local : constant Entity_Id := Make_Temporary (Loc, 'L'); begin -- Special case: obtain the first controlling formal -- from the target of the remote call, instead of the -- argument list. Append_To (Outer_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Addr, Object_Definition => New_Occurrence_Of (RTE (RE_Address), Loc))); Append_To (Outer_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Is_Local, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc))); Append_To (Outer_Statements, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Local_Address), Loc), Parameter_Associations => New_List ( Make_Selected_Component (Loc, Prefix => New_Occurrence_Of ( Request_Parameter, Loc), Selector_Name => Make_Identifier (Loc, Name_Target)), New_Occurrence_Of (Is_Local, Loc), New_Occurrence_Of (Addr, Loc)))); Expr := Unchecked_Convert_To (RACW_Type, New_Occurrence_Of (Addr, Loc)); end; elsif In_Present (Current_Parameter) or else not Out_Present (Current_Parameter) or else not Constrained then -- If an input parameter is constrained, then its reading is -- deferred until the beginning of the subprogram body. If -- it is unconstrained, then an expression is built for -- the object declaration and the variable is set using -- 'Input instead of 'Read. if Constrained and then Is_Limited_Type (Etyp) then Helpers.Assign_Opaque_From_Any (Loc, Stms => Statements, Typ => Etyp, N => New_Occurrence_Of (Any, Loc), Target => Object); else Expr := Helpers.Build_From_Any_Call (Etyp, New_Occurrence_Of (Any, Loc), Decls); if Constrained then Append_To (Statements, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Object, Loc), Expression => Expr)); Expr := Empty; else -- Expr will be used to initialize (and constrain) the -- parameter when it is declared. null; end if; null; end if; end if; Need_Extra_Constrained := Nkind (Parameter_Type (Current_Parameter)) /= N_Access_Definition and then Ekind (Defining_Identifier (Current_Parameter)) /= E_Void and then Present (Extra_Constrained (Defining_Identifier (Current_Parameter))); -- We may not associate an extra constrained actual to a -- constant object, so if one is needed, declare the actual -- as a variable even if it won't be modified. Build_Actual_Object_Declaration (Object => Object, Etyp => Etyp, Variable => Need_Extra_Constrained or else Out_Present (Current_Parameter), Expr => Expr, Decls => Decls); Set_Etype (Object, Etyp); -- An out parameter may be written back using a 'Write -- attribute instead of a 'Output because it has been -- constrained by the parameter given to the caller. Note that -- OUT controlling arguments in the case of a RACW are not put -- back in the stream because the pointer on them has not -- changed. if Out_Present (Current_Parameter) and then not Is_Controlling_Formal then Append_To (After_Statements, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Move_Any_Value), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Any, Loc), PolyORB_Support.Helpers.Build_To_Any_Call (Loc, New_Occurrence_Of (Object, Loc), Decls, Constrained => True)))); end if; -- For RACW controlling formals, the Etyp of Object is always -- an RACW, even if the parameter is not of an anonymous access -- type. In such case, we need to dereference it at call time. if Is_Controlling_Formal then if Nkind (Parameter_Type (Current_Parameter)) /= N_Access_Definition then Append_To (Parameter_List, Make_Parameter_Association (Loc, Selector_Name => New_Occurrence_Of (Defining_Identifier (Current_Parameter), Loc), Explicit_Actual_Parameter => Make_Explicit_Dereference (Loc, Prefix => New_Occurrence_Of (Object, Loc)))); else Append_To (Parameter_List, Make_Parameter_Association (Loc, Selector_Name => New_Occurrence_Of (Defining_Identifier (Current_Parameter), Loc), Explicit_Actual_Parameter => New_Occurrence_Of (Object, Loc))); end if; else Append_To (Parameter_List, Make_Parameter_Association (Loc, Selector_Name => New_Occurrence_Of ( Defining_Identifier (Current_Parameter), Loc), Explicit_Actual_Parameter => New_Occurrence_Of (Object, Loc))); end if; -- If the current parameter needs an extra formal, then read it -- from the stream and set the corresponding semantic field in -- the variable. If the kind of the parameter identifier is -- E_Void, then this is a compiler generated parameter that -- doesn't need an extra constrained status. -- The case of Extra_Accessibility should also be handled ??? if Need_Extra_Constrained then declare Extra_Parameter : constant Entity_Id := Extra_Constrained (Defining_Identifier (Current_Parameter)); Extra_Any : constant Entity_Id := Make_Temporary (Loc, 'A'); Formal_Entity : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Chars (Extra_Parameter)); Formal_Type : constant Entity_Id := Etype (Extra_Parameter); begin Append_To (Outer_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Extra_Any, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Create_Any), Loc), Parameter_Associations => New_List ( PolyORB_Support.Helpers.Build_TypeCode_Call (Loc, Formal_Type, Outer_Decls))))); Append_To (Outer_Extra_Formal_Statements, Add_Parameter_To_NVList (Loc, Parameter => Extra_Parameter, NVList => Arguments, Constrained => True, Any => Extra_Any)); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Formal_Entity, Object_Definition => New_Occurrence_Of (Formal_Type, Loc))); Append_To (Statements, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Formal_Entity, Loc), Expression => PolyORB_Support.Helpers.Build_From_Any_Call (Formal_Type, New_Occurrence_Of (Extra_Any, Loc), Decls))); Set_Extra_Constrained (Object, Formal_Entity); end; end if; end; Next (Current_Parameter); end loop; -- Extra Formals should go after all the other parameters Append_List_To (Outer_Statements, Outer_Extra_Formal_Statements); Append_To (Outer_Statements, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Request_Arguments), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Request_Parameter, Loc), New_Occurrence_Of (Arguments, Loc)))); if Nkind (Specification (Vis_Decl)) = N_Function_Specification then -- The remote subprogram is a function: Build an inner block to be -- able to hold a potentially unconstrained result in a variable. declare Etyp : constant Entity_Id := Etype (Result_Definition (Specification (Vis_Decl))); Result : constant Node_Id := Make_Temporary (Loc, 'R'); begin Inner_Decls := New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Result, Constant_Present => True, Object_Definition => New_Occurrence_Of (Etyp, Loc), Expression => Make_Function_Call (Loc, Name => Called_Subprogram, Parameter_Associations => Parameter_List))); if Is_Class_Wide_Type (Etyp) then -- For a remote call to a function with a class-wide type, -- check that the returned value satisfies the requirements -- of (RM E.4(18)). Append_To (Inner_Decls, Make_Transportable_Check (Loc, New_Occurrence_Of (Result, Loc))); end if; Set_Etype (Result, Etyp); Append_To (After_Statements, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Set_Result), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Request_Parameter, Loc), PolyORB_Support.Helpers.Build_To_Any_Call (Loc, New_Occurrence_Of (Result, Loc), Decls)))); -- A DSA function does not have out or inout arguments end; Append_To (Statements, Make_Block_Statement (Loc, Declarations => Inner_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => After_Statements))); else -- The remote subprogram is a procedure. We do not need any inner -- block in this case. No specific processing is required here for -- the dynamically asynchronous case: the indication of whether -- call is asynchronous or not is managed by the Sync_Scope -- attibute of the request, and is handled entirely in the -- protocol layer. Append_To (After_Statements, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Request_Set_Out), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Request_Parameter, Loc)))); Append_To (Statements, Make_Procedure_Call_Statement (Loc, Name => Called_Subprogram, Parameter_Associations => Parameter_List)); Append_List_To (Statements, After_Statements); end if; Subp_Spec := Make_Procedure_Specification (Loc, Defining_Unit_Name => Make_Temporary (Loc, 'F'), Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Request_Parameter, Parameter_Type => New_Occurrence_Of (RTE (RE_Request_Access), Loc)))); -- An exception raised during the execution of an incoming remote -- subprogram call and that needs to be sent back to the caller is -- propagated by the receiving stubs, and will be handled by the -- caller (the distribution runtime). if Asynchronous and then not Dynamically_Asynchronous then -- For an asynchronous procedure, add a null exception handler Excep_Handlers := New_List ( Make_Implicit_Exception_Handler (Loc, Exception_Choices => New_List (Make_Others_Choice (Loc)), Statements => New_List (Make_Null_Statement (Loc)))); else -- In the other cases, if an exception is raised, then the -- exception occurrence is propagated. null; end if; Append_To (Outer_Statements, Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Statements))); return Make_Subprogram_Body (Loc, Specification => Subp_Spec, Declarations => Outer_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Outer_Statements, Exception_Handlers => Excep_Handlers)); end Build_Subprogram_Receiving_Stubs; ------------- -- Helpers -- ------------- package body Helpers is ----------------------- -- Local Subprograms -- ----------------------- function Find_Numeric_Representation (Typ : Entity_Id) return Entity_Id; -- Given a numeric type Typ, return the smallest integer or modular -- type from Interfaces, or the smallest floating point type from -- Standard whose range encompasses that of Typ. function Is_Generic_Actual_Subtype (Typ : Entity_Id) return Boolean; -- Return true if Typ is a subtype representing a generic formal type -- as a subtype of the actual type in an instance. This is needed to -- recognize these subtypes because the Is_Generic_Actual_Type flag -- can only be relied upon within the instance. function Make_Helper_Function_Name (Loc : Source_Ptr; Typ : Entity_Id; Nam : Name_Id) return Entity_Id; -- Return the name to be assigned for helper subprogram Nam of Typ ------------------------------------------------------------ -- Common subprograms for building various tree fragments -- ------------------------------------------------------------ function Build_Get_Aggregate_Element (Loc : Source_Ptr; Any : Entity_Id; TC : Node_Id; Idx : Node_Id) return Node_Id; -- Build a call to Get_Aggregate_Element on Any for typecode TC, -- returning the Idx'th element. generic Subprogram : Entity_Id; -- Reference location for constructed nodes Arry : Entity_Id; -- For 'Range and Etype Indexes : List_Id; -- For the construction of the innermost element expression with procedure Add_Process_Element (Stmts : List_Id; Any : Entity_Id; Counter : Entity_Id; Datum : Node_Id); procedure Append_Array_Traversal (Stmts : List_Id; Any : Entity_Id; Counter : Entity_Id := Empty; Depth : Pos := 1); -- Build nested loop statements that iterate over the elements of an -- array Arry. The statement(s) built by Add_Process_Element are -- executed for each element; Indexes is the list of indexes to be -- used in the construction of the indexed component that denotes the -- current element. Subprogram is the entity for the subprogram for -- which this iterator is generated. The generated statements are -- appended to Stmts. generic Rec : Entity_Id; -- The record entity being dealt with with procedure Add_Process_Element (Stmts : List_Id; Container : Node_Or_Entity_Id; Counter : in out Int; Rec : Entity_Id; Field : Node_Id); -- Rec is the instance of the record type, or Empty. -- Field is either the N_Defining_Identifier for a component, -- or an N_Variant_Part. procedure Append_Record_Traversal (Stmts : List_Id; Clist : Node_Id; Container : Node_Or_Entity_Id; Counter : in out Int); -- Process component list Clist. Individual fields are passed -- to Field_Processing. Each variant part is also processed. -- Container is the outer Any (for From_Any/To_Any), -- the outer typecode (for TC) to which the operation applies. ----------------------------- -- Append_Record_Traversal -- ----------------------------- procedure Append_Record_Traversal (Stmts : List_Id; Clist : Node_Id; Container : Node_Or_Entity_Id; Counter : in out Int) is CI : List_Id; VP : Node_Id; -- Clist's Component_Items and Variant_Part Item : Node_Id; Def : Entity_Id; begin if No (Clist) then return; end if; CI := Component_Items (Clist); VP := Variant_Part (Clist); Item := First (CI); while Present (Item) loop Def := Defining_Identifier (Item); if not Is_Internal_Name (Chars (Def)) then Add_Process_Element (Stmts, Container, Counter, Rec, Def); end if; Next (Item); end loop; if Present (VP) then Add_Process_Element (Stmts, Container, Counter, Rec, VP); end if; end Append_Record_Traversal; ----------------------------- -- Assign_Opaque_From_Any -- ----------------------------- procedure Assign_Opaque_From_Any (Loc : Source_Ptr; Stms : List_Id; Typ : Entity_Id; N : Node_Id; Target : Entity_Id; Constrained : Boolean := False) is Strm : constant Entity_Id := Make_Temporary (Loc, 'S'); Expr : Node_Id; Read_Call_List : List_Id; -- List on which to place the 'Read attribute reference begin -- Strm : Buffer_Stream_Type; Append_To (Stms, Make_Object_Declaration (Loc, Defining_Identifier => Strm, Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Buffer_Stream_Type), Loc))); -- Any_To_BS (Strm, A); Append_To (Stms, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Any_To_BS), Loc), Parameter_Associations => New_List ( N, New_Occurrence_Of (Strm, Loc)))); if Transmit_As_Unconstrained (Typ) and then not Constrained then Expr := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Typ, Loc), Attribute_Name => Name_Input, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Strm, Loc), Attribute_Name => Name_Access))); -- Target := Typ'Input (Strm'Access) if Present (Target) then Append_To (Stms, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Target, Loc), Expression => Expr)); -- return Typ'Input (Strm'Access); else Append_To (Stms, Make_Simple_Return_Statement (Loc, Expression => Expr)); end if; else if Present (Target) then Read_Call_List := Stms; Expr := New_Occurrence_Of (Target, Loc); else declare Temp : constant Entity_Id := Make_Temporary (Loc, 'R'); begin Read_Call_List := New_List; Expr := New_Occurrence_Of (Temp, Loc); Append_To (Stms, Make_Block_Statement (Loc, Declarations => New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Temp, Object_Definition => New_Occurrence_Of (Typ, Loc))), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Read_Call_List))); end; end if; -- Typ'Read (Strm'Access, [Target|Temp]) Append_To (Read_Call_List, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Typ, Loc), Attribute_Name => Name_Read, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Strm, Loc), Attribute_Name => Name_Access), Expr))); if No (Target) then -- return Temp Append_To (Read_Call_List, Make_Simple_Return_Statement (Loc, Expression => New_Copy (Expr))); end if; end if; end Assign_Opaque_From_Any; ------------------------- -- Build_From_Any_Call -- ------------------------- function Build_From_Any_Call (Typ : Entity_Id; N : Node_Id; Decls : List_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); U_Type : Entity_Id := Underlying_Type (Typ); Fnam : Entity_Id := Empty; Lib_RE : RE_Id := RE_Null; Result : Node_Id; begin -- First simple case where the From_Any function is present -- in the type's TSS. Fnam := Find_Inherited_TSS (U_Type, TSS_From_Any); -- For the subtype representing a generic actual type, go to the -- actual type. if Is_Generic_Actual_Subtype (U_Type) then U_Type := Underlying_Type (Base_Type (U_Type)); end if; -- For a standard subtype, go to the base type if Sloc (U_Type) <= Standard_Location then U_Type := Base_Type (U_Type); -- For a user subtype, go to first subtype elsif Comes_From_Source (U_Type) and then Nkind (Declaration_Node (U_Type)) = N_Subtype_Declaration then U_Type := First_Subtype (U_Type); end if; -- Check first for Boolean and Character. These are enumeration -- types, but we treat them specially, since they may require -- special handling in the transfer protocol. However, this -- special handling only applies if they have standard -- representation, otherwise they are treated like any other -- enumeration type. if Present (Fnam) then null; elsif U_Type = Standard_Boolean then Lib_RE := RE_FA_B; elsif U_Type = Standard_Character then Lib_RE := RE_FA_C; elsif U_Type = Standard_Wide_Character then Lib_RE := RE_FA_WC; elsif U_Type = Standard_Wide_Wide_Character then Lib_RE := RE_FA_WWC; -- Floating point types elsif U_Type = Standard_Short_Float then Lib_RE := RE_FA_SF; elsif U_Type = Standard_Float then Lib_RE := RE_FA_F; elsif U_Type = Standard_Long_Float then Lib_RE := RE_FA_LF; elsif U_Type = Standard_Long_Long_Float then Lib_RE := RE_FA_LLF; -- Integer types elsif U_Type = RTE (RE_Integer_8) then Lib_RE := RE_FA_I8; elsif U_Type = RTE (RE_Integer_16) then Lib_RE := RE_FA_I16; elsif U_Type = RTE (RE_Integer_32) then Lib_RE := RE_FA_I32; elsif U_Type = RTE (RE_Integer_64) then Lib_RE := RE_FA_I64; -- Unsigned integer types elsif U_Type = RTE (RE_Unsigned_8) then Lib_RE := RE_FA_U8; elsif U_Type = RTE (RE_Unsigned_16) then Lib_RE := RE_FA_U16; elsif U_Type = RTE (RE_Unsigned_32) then Lib_RE := RE_FA_U32; elsif U_Type = RTE (RE_Unsigned_64) then Lib_RE := RE_FA_U64; elsif Is_RTE (U_Type, RE_Unbounded_String) then Lib_RE := RE_FA_String; -- Special DSA types elsif Is_RTE (U_Type, RE_Any_Container_Ptr) then Lib_RE := RE_FA_A; -- Other (non-primitive) types else declare Decl : Entity_Id; begin Build_From_Any_Function (Loc, U_Type, Decl, Fnam); Append_To (Decls, Decl); end; end if; -- Call the function if Lib_RE /= RE_Null then pragma Assert (No (Fnam)); Fnam := RTE (Lib_RE); end if; Result := Make_Function_Call (Loc, Name => New_Occurrence_Of (Fnam, Loc), Parameter_Associations => New_List (N)); -- We must set the type of Result, so the unchecked conversion -- from the underlying type to the base type is properly done. Set_Etype (Result, U_Type); return Unchecked_Convert_To (Typ, Result); end Build_From_Any_Call; ----------------------------- -- Build_From_Any_Function -- ----------------------------- procedure Build_From_Any_Function (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Fnam : out Entity_Id) is Spec : Node_Id; Decls : constant List_Id := New_List; Stms : constant List_Id := New_List; Any_Parameter : constant Entity_Id := Make_Temporary (Loc, 'A'); Use_Opaque_Representation : Boolean; begin -- For a derived type, we can't go past the base type (to the -- parent type) here, because that would cause the attribute's -- formal parameter to have the wrong type; hence the Base_Type -- check here. if Is_Itype (Typ) and then Typ /= Base_Type (Typ) then Build_From_Any_Function (Loc => Loc, Typ => Etype (Typ), Decl => Decl, Fnam => Fnam); return; end if; Fnam := Make_Helper_Function_Name (Loc, Typ, Name_From_Any); Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Fnam, Parameter_Specifications => New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Any_Parameter, Parameter_Type => New_Occurrence_Of (RTE (RE_Any), Loc))), Result_Definition => New_Occurrence_Of (Typ, Loc)); -- The RACW case is taken care of by Exp_Dist.Add_RACW_From_Any pragma Assert (not (Is_Remote_Access_To_Class_Wide_Type (Typ))); Use_Opaque_Representation := False; if Has_Stream_Attribute_Definition (Typ, TSS_Stream_Output, At_Any_Place => True) or else Has_Stream_Attribute_Definition (Typ, TSS_Stream_Write, At_Any_Place => True) then -- If user-defined stream attributes are specified for this -- type, use them and transmit data as an opaque sequence of -- stream elements. Use_Opaque_Representation := True; elsif Is_Derived_Type (Typ) and then not Is_Tagged_Type (Typ) then Append_To (Stms, Make_Simple_Return_Statement (Loc, Expression => OK_Convert_To (Typ, Build_From_Any_Call (Root_Type (Typ), New_Occurrence_Of (Any_Parameter, Loc), Decls)))); elsif Is_Record_Type (Typ) and then not Is_Derived_Type (Typ) and then not Is_Tagged_Type (Typ) then if Nkind (Declaration_Node (Typ)) = N_Subtype_Declaration then Append_To (Stms, Make_Simple_Return_Statement (Loc, Expression => Build_From_Any_Call (Etype (Typ), New_Occurrence_Of (Any_Parameter, Loc), Decls))); else declare Disc : Entity_Id := Empty; Discriminant_Associations : List_Id; Rdef : constant Node_Id := Type_Definition (Declaration_Node (Typ)); Component_Counter : Int := 0; -- The returned object Res : constant Entity_Id := Make_Temporary (Loc, 'R'); Res_Definition : Node_Id := New_Occurrence_Of (Typ, Loc); procedure FA_Rec_Add_Process_Element (Stmts : List_Id; Any : Entity_Id; Counter : in out Int; Rec : Entity_Id; Field : Node_Id); procedure FA_Append_Record_Traversal is new Append_Record_Traversal (Rec => Res, Add_Process_Element => FA_Rec_Add_Process_Element); -------------------------------- -- FA_Rec_Add_Process_Element -- -------------------------------- procedure FA_Rec_Add_Process_Element (Stmts : List_Id; Any : Entity_Id; Counter : in out Int; Rec : Entity_Id; Field : Node_Id) is Ctyp : Entity_Id; begin if Nkind (Field) = N_Defining_Identifier then -- A regular component Ctyp := Etype (Field); Append_To (Stmts, Make_Assignment_Statement (Loc, Name => Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Rec, Loc), Selector_Name => New_Occurrence_Of (Field, Loc)), Expression => Build_From_Any_Call (Ctyp, Build_Get_Aggregate_Element (Loc, Any => Any, TC => Build_TypeCode_Call (Loc, Ctyp, Decls), Idx => Make_Integer_Literal (Loc, Counter)), Decls))); else -- A variant part declare Variant : Node_Id; Struct_Counter : Int := 0; Block_Decls : constant List_Id := New_List; Block_Stmts : constant List_Id := New_List; VP_Stmts : List_Id; Alt_List : constant List_Id := New_List; Choice_List : List_Id; Struct_Any : constant Entity_Id := Make_Temporary (Loc, 'S'); begin Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Struct_Any, Constant_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Extract_Union_Value), Loc), Parameter_Associations => New_List ( Build_Get_Aggregate_Element (Loc, Any => Any, TC => Make_Function_Call (Loc, Name => New_Occurrence_Of ( RTE (RE_Any_Member_Type), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Any, Loc), Make_Integer_Literal (Loc, Intval => Counter))), Idx => Make_Integer_Literal (Loc, Intval => Counter)))))); Append_To (Stmts, Make_Block_Statement (Loc, Declarations => Block_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Block_Stmts))); Append_To (Block_Stmts, Make_Case_Statement (Loc, Expression => Make_Selected_Component (Loc, Prefix => Rec, Selector_Name => Chars (Name (Field))), Alternatives => Alt_List)); Variant := First_Non_Pragma (Variants (Field)); while Present (Variant) loop Choice_List := New_Copy_List_Tree (Discrete_Choices (Variant)); VP_Stmts := New_List; -- Struct_Counter should be reset before -- handling a variant part. Indeed only one -- of the case statement alternatives will be -- executed at run time, so the counter must -- start at 0 for every case statement. Struct_Counter := 0; FA_Append_Record_Traversal ( Stmts => VP_Stmts, Clist => Component_List (Variant), Container => Struct_Any, Counter => Struct_Counter); Append_To (Alt_List, Make_Case_Statement_Alternative (Loc, Discrete_Choices => Choice_List, Statements => VP_Stmts)); Next_Non_Pragma (Variant); end loop; end; end if; Counter := Counter + 1; end FA_Rec_Add_Process_Element; begin -- First all discriminants if Has_Discriminants (Typ) then Discriminant_Associations := New_List; Disc := First_Discriminant (Typ); while Present (Disc) loop declare Disc_Var_Name : constant Entity_Id := Make_Defining_Identifier (Loc, Chars => Chars (Disc)); Disc_Type : constant Entity_Id := Etype (Disc); begin Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Disc_Var_Name, Constant_Present => True, Object_Definition => New_Occurrence_Of (Disc_Type, Loc), Expression => Build_From_Any_Call (Disc_Type, Build_Get_Aggregate_Element (Loc, Any => Any_Parameter, TC => Build_TypeCode_Call (Loc, Disc_Type, Decls), Idx => Make_Integer_Literal (Loc, Intval => Component_Counter)), Decls))); Component_Counter := Component_Counter + 1; Append_To (Discriminant_Associations, Make_Discriminant_Association (Loc, Selector_Names => New_List ( New_Occurrence_Of (Disc, Loc)), Expression => New_Occurrence_Of (Disc_Var_Name, Loc))); end; Next_Discriminant (Disc); end loop; Res_Definition := Make_Subtype_Indication (Loc, Subtype_Mark => Res_Definition, Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Discriminant_Associations)); end if; -- Now we have all the discriminants in variables, we can -- declared a constrained object. Note that we are not -- initializing (non-discriminant) components directly in -- the object declarations, because which fields to -- initialize depends (at run time) on the discriminant -- values. Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Res, Object_Definition => Res_Definition)); -- ... then all components FA_Append_Record_Traversal (Stms, Clist => Component_List (Rdef), Container => Any_Parameter, Counter => Component_Counter); Append_To (Stms, Make_Simple_Return_Statement (Loc, Expression => New_Occurrence_Of (Res, Loc))); end; end if; elsif Is_Array_Type (Typ) then declare Constrained : constant Boolean := Is_Constrained (Typ); procedure FA_Ary_Add_Process_Element (Stmts : List_Id; Any : Entity_Id; Counter : Entity_Id; Datum : Node_Id); -- Assign the current element (as identified by Counter) of -- Any to the variable denoted by name Datum, and advance -- Counter by 1. If Datum is not an Any, a call to From_Any -- for its type is inserted. -------------------------------- -- FA_Ary_Add_Process_Element -- -------------------------------- procedure FA_Ary_Add_Process_Element (Stmts : List_Id; Any : Entity_Id; Counter : Entity_Id; Datum : Node_Id) is Assignment : constant Node_Id := Make_Assignment_Statement (Loc, Name => Datum, Expression => Empty); Element_Any : Node_Id; begin declare Element_TC : Node_Id; begin if Etype (Datum) = RTE (RE_Any) then -- When Datum is an Any the Etype field is not -- sufficient to determine the typecode of Datum -- (which can be a TC_SEQUENCE or TC_ARRAY -- depending on the value of Constrained). -- Therefore we retrieve the typecode which has -- been constructed in Append_Array_Traversal with -- a call to Get_Any_Type. Element_TC := Make_Function_Call (Loc, Name => New_Occurrence_Of ( RTE (RE_Get_Any_Type), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Entity (Datum), Loc))); else -- For non Any Datum we simply construct a typecode -- matching the Etype of the Datum. Element_TC := Build_TypeCode_Call (Loc, Etype (Datum), Decls); end if; Element_Any := Build_Get_Aggregate_Element (Loc, Any => Any, TC => Element_TC, Idx => New_Occurrence_Of (Counter, Loc)); end; -- Note: here we *prepend* statements to Stmts, so -- we must do it in reverse order. Prepend_To (Stmts, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Counter, Loc), Expression => Make_Op_Add (Loc, Left_Opnd => New_Occurrence_Of (Counter, Loc), Right_Opnd => Make_Integer_Literal (Loc, 1)))); if Nkind (Datum) /= N_Attribute_Reference then -- We ignore the value of the length of each -- dimension, since the target array has already been -- constrained anyway. if Etype (Datum) /= RTE (RE_Any) then Set_Expression (Assignment, Build_From_Any_Call (Component_Type (Typ), Element_Any, Decls)); else Set_Expression (Assignment, Element_Any); end if; Prepend_To (Stmts, Assignment); end if; end FA_Ary_Add_Process_Element; ------------------------ -- Local Declarations -- ------------------------ Counter : constant Entity_Id := Make_Defining_Identifier (Loc, Name_J); Initial_Counter_Value : Int := 0; Component_TC : constant Entity_Id := Make_Defining_Identifier (Loc, Name_T); Res : constant Entity_Id := Make_Defining_Identifier (Loc, Name_R); procedure Append_From_Any_Array_Iterator is new Append_Array_Traversal ( Subprogram => Fnam, Arry => Res, Indexes => New_List, Add_Process_Element => FA_Ary_Add_Process_Element); Res_Subtype_Indication : Node_Id := New_Occurrence_Of (Typ, Loc); begin if not Constrained then declare Ndim : constant Int := Number_Dimensions (Typ); Lnam : Name_Id; Hnam : Name_Id; Indx : Node_Id := First_Index (Typ); Indt : Entity_Id; Ranges : constant List_Id := New_List; begin for J in 1 .. Ndim loop Lnam := New_External_Name ('L', J); Hnam := New_External_Name ('H', J); -- Note, for empty arrays bounds may be out of -- the range of Etype (Indx). Indt := Base_Type (Etype (Indx)); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Lnam), Constant_Present => True, Object_Definition => New_Occurrence_Of (Indt, Loc), Expression => Build_From_Any_Call (Indt, Build_Get_Aggregate_Element (Loc, Any => Any_Parameter, TC => Build_TypeCode_Call (Loc, Indt, Decls), Idx => Make_Integer_Literal (Loc, J - 1)), Decls))); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Hnam), Constant_Present => True, Object_Definition => New_Occurrence_Of (Indt, Loc), Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Indt, Loc), Attribute_Name => Name_Val, Expressions => New_List ( Make_Op_Subtract (Loc, Left_Opnd => Make_Op_Add (Loc, Left_Opnd => OK_Convert_To (Standard_Long_Integer, Make_Identifier (Loc, Lnam)), Right_Opnd => OK_Convert_To (Standard_Long_Integer, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE ( RE_Get_Nested_Sequence_Length ), Loc), Parameter_Associations => New_List ( New_Occurrence_Of ( Any_Parameter, Loc), Make_Integer_Literal (Loc, Intval => J))))), Right_Opnd => Make_Integer_Literal (Loc, 1)))))); Append_To (Ranges, Make_Range (Loc, Low_Bound => Make_Identifier (Loc, Lnam), High_Bound => Make_Identifier (Loc, Hnam))); Next_Index (Indx); end loop; -- Now we have all the necessary bound information: -- apply the set of range constraints to the -- (unconstrained) nominal subtype of Res. Initial_Counter_Value := Ndim; Res_Subtype_Indication := Make_Subtype_Indication (Loc, Subtype_Mark => Res_Subtype_Indication, Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => Ranges)); end; end if; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Res, Object_Definition => Res_Subtype_Indication)); Set_Etype (Res, Typ); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Counter, Object_Definition => New_Occurrence_Of (RTE (RE_Unsigned_32), Loc), Expression => Make_Integer_Literal (Loc, Initial_Counter_Value))); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Component_TC, Constant_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_TypeCode), Loc), Expression => Build_TypeCode_Call (Loc, Component_Type (Typ), Decls))); Append_From_Any_Array_Iterator (Stms, Any_Parameter, Counter); Append_To (Stms, Make_Simple_Return_Statement (Loc, Expression => New_Occurrence_Of (Res, Loc))); end; elsif Is_Integer_Type (Typ) or else Is_Unsigned_Type (Typ) then Append_To (Stms, Make_Simple_Return_Statement (Loc, Expression => Unchecked_Convert_To (Typ, Build_From_Any_Call (Find_Numeric_Representation (Typ), New_Occurrence_Of (Any_Parameter, Loc), Decls)))); else Use_Opaque_Representation := True; end if; if Use_Opaque_Representation then Assign_Opaque_From_Any (Loc, Stms => Stms, Typ => Typ, N => New_Occurrence_Of (Any_Parameter, Loc), Target => Empty); end if; Decl := Make_Subprogram_Body (Loc, Specification => Spec, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stms)); end Build_From_Any_Function; --------------------------------- -- Build_Get_Aggregate_Element -- --------------------------------- function Build_Get_Aggregate_Element (Loc : Source_Ptr; Any : Entity_Id; TC : Node_Id; Idx : Node_Id) return Node_Id is begin return Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_Aggregate_Element), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Any, Loc), TC, Idx)); end Build_Get_Aggregate_Element; ---------------------------------- -- Build_Name_And_Repository_Id -- ---------------------------------- procedure Build_Name_And_Repository_Id (E : Entity_Id; Name_Str : out String_Id; Repo_Id_Str : out String_Id) is begin Name_Str := Fully_Qualified_Name_String (E, Append_NUL => False); Start_String; Store_String_Chars ("DSA:"); Store_String_Chars (Name_Str); Store_String_Chars (":1.0"); Repo_Id_Str := End_String; end Build_Name_And_Repository_Id; ----------------------- -- Build_To_Any_Call -- ----------------------- function Build_To_Any_Call (Loc : Source_Ptr; N : Node_Id; Decls : List_Id; Constrained : Boolean := False) return Node_Id is Typ : Entity_Id := Etype (N); U_Type : Entity_Id; C_Type : Entity_Id; Fnam : Entity_Id := Empty; Lib_RE : RE_Id := RE_Null; begin -- If N is a selected component, then maybe its Etype has not been -- set yet: try to use Etype of the selector_name in that case. if No (Typ) and then Nkind (N) = N_Selected_Component then Typ := Etype (Selector_Name (N)); end if; pragma Assert (Present (Typ)); -- Get full view for private type, completion for incomplete type U_Type := Underlying_Type (Typ); -- First simple case where the To_Any function is present in the -- type's TSS. Fnam := Find_Inherited_TSS (U_Type, TSS_To_Any); -- For the subtype representing a generic actual type, go to the -- actual type. if Is_Generic_Actual_Subtype (U_Type) then U_Type := Underlying_Type (Base_Type (U_Type)); end if; -- For a standard subtype, go to the base type if Sloc (U_Type) <= Standard_Location then U_Type := Base_Type (U_Type); -- For a user subtype, go to first subtype elsif Comes_From_Source (U_Type) and then Nkind (Declaration_Node (U_Type)) = N_Subtype_Declaration then U_Type := First_Subtype (U_Type); end if; if Present (Fnam) then null; -- Check first for Boolean and Character. These are enumeration -- types, but we treat them specially, since they may require -- special handling in the transfer protocol. However, this -- special handling only applies if they have standard -- representation, otherwise they are treated like any other -- enumeration type. elsif U_Type = Standard_Boolean then Lib_RE := RE_TA_B; elsif U_Type = Standard_Character then Lib_RE := RE_TA_C; elsif U_Type = Standard_Wide_Character then Lib_RE := RE_TA_WC; elsif U_Type = Standard_Wide_Wide_Character then Lib_RE := RE_TA_WWC; -- Floating point types elsif U_Type = Standard_Short_Float then Lib_RE := RE_TA_SF; elsif U_Type = Standard_Float then Lib_RE := RE_TA_F; elsif U_Type = Standard_Long_Float then Lib_RE := RE_TA_LF; elsif U_Type = Standard_Long_Long_Float then Lib_RE := RE_TA_LLF; -- Integer types elsif U_Type = RTE (RE_Integer_8) then Lib_RE := RE_TA_I8; elsif U_Type = RTE (RE_Integer_16) then Lib_RE := RE_TA_I16; elsif U_Type = RTE (RE_Integer_32) then Lib_RE := RE_TA_I32; elsif U_Type = RTE (RE_Integer_64) then Lib_RE := RE_TA_I64; -- Unsigned integer types elsif U_Type = RTE (RE_Unsigned_8) then Lib_RE := RE_TA_U8; elsif U_Type = RTE (RE_Unsigned_16) then Lib_RE := RE_TA_U16; elsif U_Type = RTE (RE_Unsigned_32) then Lib_RE := RE_TA_U32; elsif U_Type = RTE (RE_Unsigned_64) then Lib_RE := RE_TA_U64; elsif Is_RTE (U_Type, RE_Unbounded_String) then Lib_RE := RE_TA_String; -- Special DSA types elsif Is_RTE (U_Type, RE_Any_Container_Ptr) then Lib_RE := RE_TA_A; U_Type := Typ; elsif U_Type = Underlying_Type (RTE (RE_TypeCode)) then -- No corresponding FA_TC ??? Lib_RE := RE_TA_TC; -- Other (non-primitive) types else declare Decl : Entity_Id; begin Build_To_Any_Function (Loc, U_Type, Decl, Fnam); Append_To (Decls, Decl); end; end if; -- Call the function if Lib_RE /= RE_Null then pragma Assert (No (Fnam)); Fnam := RTE (Lib_RE); end if; -- If Fnam is already analyzed, find the proper expected type, -- else we have a newly constructed To_Any function and we know -- that the expected type of its parameter is U_Type. if Ekind (Fnam) = E_Function and then Present (First_Formal (Fnam)) then C_Type := Etype (First_Formal (Fnam)); else C_Type := U_Type; end if; declare Params : constant List_Id := New_List (OK_Convert_To (C_Type, N)); begin if Is_Limited_Type (C_Type) then Append_To (Params, New_Occurrence_Of (Boolean_Literals (Constrained), Loc)); end if; return Make_Function_Call (Loc, Name => New_Occurrence_Of (Fnam, Loc), Parameter_Associations => Params); end; end Build_To_Any_Call; --------------------------- -- Build_To_Any_Function -- --------------------------- procedure Build_To_Any_Function (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Fnam : out Entity_Id) is Spec : Node_Id; Params : List_Id; Decls : List_Id; Stms : List_Id; Expr_Formal : Entity_Id; Cstr_Formal : Entity_Id := Empty; -- initialize to prevent warning Any : Entity_Id; Result_TC : Node_Id; Any_Decl : Node_Id; Use_Opaque_Representation : Boolean; -- When True, use stream attributes and represent type as an -- opaque sequence of bytes. begin -- For a derived type, we can't go past the base type (to the -- parent type) here, because that would cause the attribute's -- formal parameter to have the wrong type; hence the Base_Type -- check here. if Is_Itype (Typ) and then Typ /= Base_Type (Typ) then Build_To_Any_Function (Loc => Loc, Typ => Etype (Typ), Decl => Decl, Fnam => Fnam); return; end if; Decls := New_List; Stms := New_List; Any := Make_Defining_Identifier (Loc, Name_A); Result_TC := Build_TypeCode_Call (Loc, Typ, Decls); Fnam := Make_Helper_Function_Name (Loc, Typ, Name_To_Any); Expr_Formal := Make_Defining_Identifier (Loc, Name_E); Params := New_List ( Make_Parameter_Specification (Loc, Defining_Identifier => Expr_Formal, Parameter_Type => New_Occurrence_Of (Typ, Loc))); Set_Etype (Expr_Formal, Typ); if Is_Limited_Type (Typ) then Cstr_Formal := Make_Defining_Identifier (Loc, Name_C); Append_To (Params, Make_Parameter_Specification (Loc, Defining_Identifier => Cstr_Formal, Parameter_Type => New_Occurrence_Of (Standard_Boolean, Loc))); end if; Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Fnam, Parameter_Specifications => Params, Result_Definition => New_Occurrence_Of (RTE (RE_Any), Loc)); Any_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Any, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc)); Use_Opaque_Representation := False; if Has_Stream_Attribute_Definition (Typ, TSS_Stream_Output, At_Any_Place => True) or else Has_Stream_Attribute_Definition (Typ, TSS_Stream_Write, At_Any_Place => True) then -- If user-defined stream attributes are specified for this -- type, use them and transmit data as an opaque sequence of -- stream elements. Use_Opaque_Representation := True; elsif Is_Derived_Type (Typ) and then not Is_Tagged_Type (Typ) then -- Untagged derived type: convert to root type declare Rt_Type : constant Entity_Id := Root_Type (Typ); Expr : constant Node_Id := OK_Convert_To (Rt_Type, New_Occurrence_Of (Expr_Formal, Loc)); begin Set_Expression (Any_Decl, Build_To_Any_Call (Loc, Expr, Decls)); end; elsif Is_Record_Type (Typ) and then not Is_Tagged_Type (Typ) then -- Untagged record type if Nkind (Declaration_Node (Typ)) = N_Subtype_Declaration then declare Rt_Type : constant Entity_Id := Etype (Typ); Expr : constant Node_Id := OK_Convert_To (Rt_Type, New_Occurrence_Of (Expr_Formal, Loc)); begin Set_Expression (Any_Decl, Build_To_Any_Call (Loc, Expr, Decls)); end; -- Comment needed here (and label on declare block ???) else declare Disc : Entity_Id := Empty; Rdef : constant Node_Id := Type_Definition (Declaration_Node (Typ)); Counter : Int := 0; Elements : constant List_Id := New_List; procedure TA_Rec_Add_Process_Element (Stmts : List_Id; Container : Node_Or_Entity_Id; Counter : in out Int; Rec : Entity_Id; Field : Node_Id); -- Processing routine for traversal below procedure TA_Append_Record_Traversal is new Append_Record_Traversal (Rec => Expr_Formal, Add_Process_Element => TA_Rec_Add_Process_Element); -------------------------------- -- TA_Rec_Add_Process_Element -- -------------------------------- procedure TA_Rec_Add_Process_Element (Stmts : List_Id; Container : Node_Or_Entity_Id; Counter : in out Int; Rec : Entity_Id; Field : Node_Id) is Field_Ref : Node_Id; begin if Nkind (Field) = N_Defining_Identifier then -- A regular component Field_Ref := Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Rec, Loc), Selector_Name => New_Occurrence_Of (Field, Loc)); Set_Etype (Field_Ref, Etype (Field)); Append_To (Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of ( RTE (RE_Add_Aggregate_Element), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Container, Loc), Build_To_Any_Call (Loc, Field_Ref, Decls)))); else -- A variant part Variant_Part : declare Variant : Node_Id; Struct_Counter : Int := 0; Block_Decls : constant List_Id := New_List; Block_Stmts : constant List_Id := New_List; VP_Stmts : List_Id; Alt_List : constant List_Id := New_List; Choice_List : List_Id; Union_Any : constant Entity_Id := Make_Temporary (Loc, 'V'); Struct_Any : constant Entity_Id := Make_Temporary (Loc, 'S'); function Make_Discriminant_Reference return Node_Id; -- Build reference to the discriminant for this -- variant part. --------------------------------- -- Make_Discriminant_Reference -- --------------------------------- function Make_Discriminant_Reference return Node_Id is Nod : constant Node_Id := Make_Selected_Component (Loc, Prefix => Rec, Selector_Name => Chars (Name (Field))); begin Set_Etype (Nod, Etype (Name (Field))); return Nod; end Make_Discriminant_Reference; -- Start of processing for Variant_Part begin Append_To (Stmts, Make_Block_Statement (Loc, Declarations => Block_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Block_Stmts))); -- Declare variant part aggregate (Union_Any). -- Knowing the position of this VP in the -- variant record, we can fetch the VP typecode -- from Container. Append_To (Block_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Union_Any, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of ( RTE (RE_Create_Any), Loc), Parameter_Associations => New_List ( Make_Function_Call (Loc, Name => New_Occurrence_Of ( RTE (RE_Any_Member_Type), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Container, Loc), Make_Integer_Literal (Loc, Counter))))))); -- Declare inner struct aggregate (which -- contains the components of this VP). Append_To (Block_Decls, Make_Object_Declaration (Loc, Defining_Identifier => Struct_Any, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of ( RTE (RE_Create_Any), Loc), Parameter_Associations => New_List ( Make_Function_Call (Loc, Name => New_Occurrence_Of ( RTE (RE_Any_Member_Type), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Union_Any, Loc), Make_Integer_Literal (Loc, Uint_1))))))); -- Build case statement Append_To (Block_Stmts, Make_Case_Statement (Loc, Expression => Make_Discriminant_Reference, Alternatives => Alt_List)); Variant := First_Non_Pragma (Variants (Field)); while Present (Variant) loop Choice_List := New_Copy_List_Tree (Discrete_Choices (Variant)); VP_Stmts := New_List; -- Append discriminant val to union aggregate Append_To (VP_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of ( RTE (RE_Add_Aggregate_Element), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Union_Any, Loc), Build_To_Any_Call (Loc, Make_Discriminant_Reference, Block_Decls)))); -- Populate inner struct aggregate -- Struct_Counter should be reset before -- handling a variant part. Indeed only one -- of the case statement alternatives will be -- executed at run time, so the counter must -- start at 0 for every case statement. Struct_Counter := 0; TA_Append_Record_Traversal (Stmts => VP_Stmts, Clist => Component_List (Variant), Container => Struct_Any, Counter => Struct_Counter); -- Append inner struct to union aggregate Append_To (VP_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Add_Aggregate_Element), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Union_Any, Loc), New_Occurrence_Of (Struct_Any, Loc)))); -- Append union to outer aggregate Append_To (VP_Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Add_Aggregate_Element), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Container, Loc), New_Occurrence_Of (Union_Any, Loc)))); Append_To (Alt_List, Make_Case_Statement_Alternative (Loc, Discrete_Choices => Choice_List, Statements => VP_Stmts)); Next_Non_Pragma (Variant); end loop; end Variant_Part; end if; Counter := Counter + 1; end TA_Rec_Add_Process_Element; begin -- Records are encoded in a TC_STRUCT aggregate: -- -- Outer aggregate (TC_STRUCT) -- | [discriminant1] -- | [discriminant2] -- | ... -- | -- | [component1] -- | [component2] -- | ... -- A component can be a common component or variant part -- A variant part is encoded as a TC_UNION aggregate: -- -- Variant Part Aggregate (TC_UNION) -- | [discriminant choice for this Variant Part] -- | -- | -- Inner struct (TC_STRUCT) -- | | [component1] -- | | [component2] -- | | ... -- Let's start by building the outer aggregate. First we -- construct Elements array containing all discriminants. if Has_Discriminants (Typ) then Disc := First_Discriminant (Typ); while Present (Disc) loop declare Discriminant : constant Entity_Id := Make_Selected_Component (Loc, Prefix => Expr_Formal, Selector_Name => Chars (Disc)); begin Set_Etype (Discriminant, Etype (Disc)); Append_To (Elements, Make_Component_Association (Loc, Choices => New_List ( Make_Integer_Literal (Loc, Counter)), Expression => Build_To_Any_Call (Loc, Discriminant, Decls))); end; Counter := Counter + 1; Next_Discriminant (Disc); end loop; else -- If there are no discriminants, we declare an empty -- Elements array. declare Dummy_Any : constant Entity_Id := Make_Temporary (Loc, 'A'); begin Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Dummy_Any, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc))); Append_To (Elements, Make_Component_Association (Loc, Choices => New_List ( Make_Range (Loc, Low_Bound => Make_Integer_Literal (Loc, 1), High_Bound => Make_Integer_Literal (Loc, 0))), Expression => New_Occurrence_Of (Dummy_Any, Loc))); end; end if; -- We build the result aggregate with discriminants -- as the first elements. Set_Expression (Any_Decl, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Any_Aggregate_Build), Loc), Parameter_Associations => New_List ( Result_TC, Make_Aggregate (Loc, Component_Associations => Elements)))); Result_TC := Empty; -- Then we append all the components to the result -- aggregate. TA_Append_Record_Traversal (Stms, Clist => Component_List (Rdef), Container => Any, Counter => Counter); end; end if; elsif Is_Array_Type (Typ) then -- Constrained and unconstrained array types declare Constrained : constant Boolean := not Transmit_As_Unconstrained (Typ); procedure TA_Ary_Add_Process_Element (Stmts : List_Id; Any : Entity_Id; Counter : Entity_Id; Datum : Node_Id); -------------------------------- -- TA_Ary_Add_Process_Element -- -------------------------------- procedure TA_Ary_Add_Process_Element (Stmts : List_Id; Any : Entity_Id; Counter : Entity_Id; Datum : Node_Id) is pragma Unreferenced (Counter); Element_Any : Node_Id; begin if Etype (Datum) = RTE (RE_Any) then Element_Any := Datum; else Element_Any := Build_To_Any_Call (Loc, Datum, Decls); end if; Append_To (Stmts, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of ( RTE (RE_Add_Aggregate_Element), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Any, Loc), Element_Any))); end TA_Ary_Add_Process_Element; procedure Append_To_Any_Array_Iterator is new Append_Array_Traversal ( Subprogram => Fnam, Arry => Expr_Formal, Indexes => New_List, Add_Process_Element => TA_Ary_Add_Process_Element); Index : Node_Id; begin Set_Expression (Any_Decl, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Create_Any), Loc), Parameter_Associations => New_List (Result_TC))); Result_TC := Empty; if not Constrained then Index := First_Index (Typ); for J in 1 .. Number_Dimensions (Typ) loop Append_To (Stms, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Add_Aggregate_Element), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Any, Loc), Build_To_Any_Call (Loc, OK_Convert_To (Etype (Index), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Expr_Formal, Loc), Attribute_Name => Name_First, Expressions => New_List ( Make_Integer_Literal (Loc, J)))), Decls)))); Next_Index (Index); end loop; end if; Append_To_Any_Array_Iterator (Stms, Any); end; elsif Is_Integer_Type (Typ) or else Is_Unsigned_Type (Typ) then -- Integer types Set_Expression (Any_Decl, Build_To_Any_Call (Loc, OK_Convert_To ( Find_Numeric_Representation (Typ), New_Occurrence_Of (Expr_Formal, Loc)), Decls)); else -- Default case, including tagged types: opaque representation Use_Opaque_Representation := True; end if; if Use_Opaque_Representation then declare Strm : constant Entity_Id := Make_Temporary (Loc, 'S'); -- Stream used to store data representation produced by -- stream attribute. begin -- Generate: -- Strm : aliased Buffer_Stream_Type; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Strm, Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Buffer_Stream_Type), Loc))); -- Generate: -- T'Output (Strm'Access, E); -- or -- T'Write (Strm'Access, E); -- depending on whether to transmit as unconstrained. -- For limited types, select at run time depending on -- Constrained parameter. declare function Stream_Call (Attr : Name_Id) return Node_Id; -- Return a call to the named attribute ----------------- -- Stream_Call -- ----------------- function Stream_Call (Attr : Name_Id) return Node_Id is begin return Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Typ, Loc), Attribute_Name => Attr, Expressions => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Strm, Loc), Attribute_Name => Name_Access), New_Occurrence_Of (Expr_Formal, Loc))); end Stream_Call; begin if Is_Limited_Type (Typ) then Append_To (Stms, Make_Implicit_If_Statement (Typ, Condition => New_Occurrence_Of (Cstr_Formal, Loc), Then_Statements => New_List ( Stream_Call (Name_Write)), Else_Statements => New_List ( Stream_Call (Name_Output)))); elsif Transmit_As_Unconstrained (Typ) then Append_To (Stms, Stream_Call (Name_Output)); else Append_To (Stms, Stream_Call (Name_Write)); end if; end; -- Generate: -- BS_To_Any (Strm, A); Append_To (Stms, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_BS_To_Any), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Strm, Loc), New_Occurrence_Of (Any, Loc)))); -- Generate: -- Release_Buffer (Strm); Append_To (Stms, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Release_Buffer), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Strm, Loc)))); end; end if; Append_To (Decls, Any_Decl); if Present (Result_TC) then Append_To (Stms, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Set_TC), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Any, Loc), Result_TC))); end if; Append_To (Stms, Make_Simple_Return_Statement (Loc, Expression => New_Occurrence_Of (Any, Loc))); Decl := Make_Subprogram_Body (Loc, Specification => Spec, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stms)); end Build_To_Any_Function; ------------------------- -- Build_TypeCode_Call -- ------------------------- function Build_TypeCode_Call (Loc : Source_Ptr; Typ : Entity_Id; Decls : List_Id) return Node_Id is U_Type : Entity_Id := Underlying_Type (Typ); -- The full view, if Typ is private; the completion, -- if Typ is incomplete. Fnam : Entity_Id := Empty; Lib_RE : RE_Id := RE_Null; Expr : Node_Id; begin -- Special case System.PolyORB.Interface.Any: its primitives have -- not been set yet, so can't call Find_Inherited_TSS. if Typ = RTE (RE_Any) then Fnam := RTE (RE_TC_A); else -- First simple case where the TypeCode is present -- in the type's TSS. Fnam := Find_Inherited_TSS (U_Type, TSS_TypeCode); end if; -- For the subtype representing a generic actual type, go to the -- actual type. if Is_Generic_Actual_Subtype (U_Type) then U_Type := Underlying_Type (Base_Type (U_Type)); end if; -- For a standard subtype, go to the base type if Sloc (U_Type) <= Standard_Location then U_Type := Base_Type (U_Type); -- For a user subtype, go to first subtype elsif Comes_From_Source (U_Type) and then Nkind (Declaration_Node (U_Type)) = N_Subtype_Declaration then U_Type := First_Subtype (U_Type); end if; if No (Fnam) then if U_Type = Standard_Boolean then Lib_RE := RE_TC_B; elsif U_Type = Standard_Character then Lib_RE := RE_TC_C; elsif U_Type = Standard_Wide_Character then Lib_RE := RE_TC_WC; elsif U_Type = Standard_Wide_Wide_Character then Lib_RE := RE_TC_WWC; -- Floating point types elsif U_Type = Standard_Short_Float then Lib_RE := RE_TC_SF; elsif U_Type = Standard_Float then Lib_RE := RE_TC_F; elsif U_Type = Standard_Long_Float then Lib_RE := RE_TC_LF; elsif U_Type = Standard_Long_Long_Float then Lib_RE := RE_TC_LLF; -- Integer types (walk back to the base type) elsif U_Type = RTE (RE_Integer_8) then Lib_RE := RE_TC_I8; elsif U_Type = RTE (RE_Integer_16) then Lib_RE := RE_TC_I16; elsif U_Type = RTE (RE_Integer_32) then Lib_RE := RE_TC_I32; elsif U_Type = RTE (RE_Integer_64) then Lib_RE := RE_TC_I64; -- Unsigned integer types elsif U_Type = RTE (RE_Unsigned_8) then Lib_RE := RE_TC_U8; elsif U_Type = RTE (RE_Unsigned_16) then Lib_RE := RE_TC_U16; elsif U_Type = RTE (RE_Unsigned_32) then Lib_RE := RE_TC_U32; elsif U_Type = RTE (RE_Unsigned_64) then Lib_RE := RE_TC_U64; elsif Is_RTE (U_Type, RE_Unbounded_String) then Lib_RE := RE_TC_String; -- Special DSA types elsif Is_RTE (U_Type, RE_Any_Container_Ptr) then Lib_RE := RE_TC_A; -- Other (non-primitive) types else declare Decl : Entity_Id; begin Build_TypeCode_Function (Loc, U_Type, Decl, Fnam); Append_To (Decls, Decl); end; end if; if Lib_RE /= RE_Null then Fnam := RTE (Lib_RE); end if; end if; -- Call the function Expr := Make_Function_Call (Loc, Name => New_Occurrence_Of (Fnam, Loc)); -- Allow Expr to be used as arg to Build_To_Any_Call immediately Set_Etype (Expr, RTE (RE_TypeCode)); return Expr; end Build_TypeCode_Call; ----------------------------- -- Build_TypeCode_Function -- ----------------------------- procedure Build_TypeCode_Function (Loc : Source_Ptr; Typ : Entity_Id; Decl : out Node_Id; Fnam : out Entity_Id) is Spec : Node_Id; Decls : constant List_Id := New_List; Stms : constant List_Id := New_List; TCNam : constant Entity_Id := Make_Helper_Function_Name (Loc, Typ, Name_TypeCode); Parameters : List_Id; procedure Add_String_Parameter (S : String_Id; Parameter_List : List_Id); -- Add a literal for S to Parameters procedure Add_TypeCode_Parameter (TC_Node : Node_Id; Parameter_List : List_Id); -- Add the typecode for Typ to Parameters procedure Add_Long_Parameter (Expr_Node : Node_Id; Parameter_List : List_Id); -- Add a signed long integer expression to Parameters procedure Initialize_Parameter_List (Name_String : String_Id; Repo_Id_String : String_Id; Parameter_List : out List_Id); -- Return a list that contains the first two parameters -- for a parameterized typecode: name and repository id. function Make_Constructed_TypeCode (Kind : Entity_Id; Parameters : List_Id) return Node_Id; -- Call Build_Complex_TC with the given kind and parameters procedure Return_Constructed_TypeCode (Kind : Entity_Id); -- Make a return statement that calls Build_Complex_TC with the -- given typecode kind, and the constructed parameters list. procedure Return_Alias_TypeCode (Base_TypeCode : Node_Id); -- Return a typecode that is a TC_Alias for the given typecode -------------------------- -- Add_String_Parameter -- -------------------------- procedure Add_String_Parameter (S : String_Id; Parameter_List : List_Id) is begin Append_To (Parameter_List, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_TA_Std_String), Loc), Parameter_Associations => New_List ( Make_String_Literal (Loc, S)))); end Add_String_Parameter; ---------------------------- -- Add_TypeCode_Parameter -- ---------------------------- procedure Add_TypeCode_Parameter (TC_Node : Node_Id; Parameter_List : List_Id) is begin Append_To (Parameter_List, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_TA_TC), Loc), Parameter_Associations => New_List (TC_Node))); end Add_TypeCode_Parameter; ------------------------ -- Add_Long_Parameter -- ------------------------ procedure Add_Long_Parameter (Expr_Node : Node_Id; Parameter_List : List_Id) is begin Append_To (Parameter_List, Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_TA_I32), Loc), Parameter_Associations => New_List (Expr_Node))); end Add_Long_Parameter; ------------------------------- -- Initialize_Parameter_List -- ------------------------------- procedure Initialize_Parameter_List (Name_String : String_Id; Repo_Id_String : String_Id; Parameter_List : out List_Id) is begin Parameter_List := New_List; Add_String_Parameter (Name_String, Parameter_List); Add_String_Parameter (Repo_Id_String, Parameter_List); end Initialize_Parameter_List; --------------------------- -- Return_Alias_TypeCode -- --------------------------- procedure Return_Alias_TypeCode (Base_TypeCode : Node_Id) is begin Add_TypeCode_Parameter (Base_TypeCode, Parameters); Return_Constructed_TypeCode (RTE (RE_Tk_Alias)); end Return_Alias_TypeCode; ------------------------------- -- Make_Constructed_TypeCode -- ------------------------------- function Make_Constructed_TypeCode (Kind : Entity_Id; Parameters : List_Id) return Node_Id is Constructed_TC : constant Node_Id := Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Build_Complex_TC), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Kind, Loc), Make_Aggregate (Loc, Expressions => Parameters))); begin Set_Etype (Constructed_TC, RTE (RE_TypeCode)); return Constructed_TC; end Make_Constructed_TypeCode; --------------------------------- -- Return_Constructed_TypeCode -- --------------------------------- procedure Return_Constructed_TypeCode (Kind : Entity_Id) is begin Append_To (Stms, Make_Simple_Return_Statement (Loc, Expression => Make_Constructed_TypeCode (Kind, Parameters))); end Return_Constructed_TypeCode; ------------------ -- Record types -- ------------------ procedure TC_Rec_Add_Process_Element (Params : List_Id; Any : Entity_Id; Counter : in out Int; Rec : Entity_Id; Field : Node_Id); procedure TC_Append_Record_Traversal is new Append_Record_Traversal ( Rec => Empty, Add_Process_Element => TC_Rec_Add_Process_Element); -------------------------------- -- TC_Rec_Add_Process_Element -- -------------------------------- procedure TC_Rec_Add_Process_Element (Params : List_Id; Any : Entity_Id; Counter : in out Int; Rec : Entity_Id; Field : Node_Id) is pragma Unreferenced (Any, Counter, Rec); begin if Nkind (Field) = N_Defining_Identifier then -- A regular component Add_TypeCode_Parameter (Build_TypeCode_Call (Loc, Etype (Field), Decls), Params); Get_Name_String (Chars (Field)); Add_String_Parameter (String_From_Name_Buffer, Params); else -- A variant part Variant_Part : declare Disc_Type : constant Entity_Id := Etype (Name (Field)); Is_Enum : constant Boolean := Is_Enumeration_Type (Disc_Type); Union_TC_Params : List_Id; U_Name : constant Name_Id := New_External_Name (Chars (Typ), 'V', -1); Name_Str : String_Id; Struct_TC_Params : List_Id; Variant : Node_Id; Choice : Node_Id; Default : constant Node_Id := Make_Integer_Literal (Loc, -1); Dummy_Counter : Int := 0; Choice_Index : Int := 0; -- Index of current choice in TypeCode, used to identify -- it as the default choice if it is a "when others". procedure Add_Params_For_Variant_Components; -- Add a struct TypeCode and a corresponding member name -- to the union parameter list. -- Ordering of declarations is a complete mess in this -- area, it is supposed to be types/variables, then -- subprogram specs, then subprogram bodies ??? --------------------------------------- -- Add_Params_For_Variant_Components -- --------------------------------------- procedure Add_Params_For_Variant_Components is S_Name : constant Name_Id := New_External_Name (U_Name, 'S', -1); begin Get_Name_String (S_Name); Name_Str := String_From_Name_Buffer; Initialize_Parameter_List (Name_Str, Name_Str, Struct_TC_Params); -- Build struct parameters TC_Append_Record_Traversal (Struct_TC_Params, Component_List (Variant), Empty, Dummy_Counter); Add_TypeCode_Parameter (Make_Constructed_TypeCode (RTE (RE_Tk_Struct), Struct_TC_Params), Union_TC_Params); Add_String_Parameter (Name_Str, Union_TC_Params); end Add_Params_For_Variant_Components; -- Start of processing for Variant_Part begin Get_Name_String (U_Name); Name_Str := String_From_Name_Buffer; Initialize_Parameter_List (Name_Str, Name_Str, Union_TC_Params); -- Add union in enclosing parameter list Add_TypeCode_Parameter (Make_Constructed_TypeCode (RTE (RE_Tk_Union), Union_TC_Params), Params); Add_String_Parameter (Name_Str, Params); -- Build union parameters Add_TypeCode_Parameter (Build_TypeCode_Call (Loc, Disc_Type, Decls), Union_TC_Params); Add_Long_Parameter (Default, Union_TC_Params); Variant := First_Non_Pragma (Variants (Field)); while Present (Variant) loop Choice := First (Discrete_Choices (Variant)); while Present (Choice) loop case Nkind (Choice) is when N_Range => declare L : constant Uint := Expr_Value (Low_Bound (Choice)); H : constant Uint := Expr_Value (High_Bound (Choice)); J : Uint := L; -- 3.8.1(8) guarantees that the bounds of -- this range are static. Expr : Node_Id; begin while J <= H loop if Is_Enum then Expr := Get_Enum_Lit_From_Pos (Disc_Type, J, Loc); else Expr := Make_Integer_Literal (Loc, J); end if; Set_Etype (Expr, Disc_Type); Append_To (Union_TC_Params, Build_To_Any_Call (Loc, Expr, Decls)); Add_Params_For_Variant_Components; J := J + Uint_1; end loop; Choice_Index := Choice_Index + UI_To_Int (H - L) + 1; end; when N_Others_Choice => -- This variant has a default choice. We must -- therefore set the default parameter to the -- current choice index. This parameter is by -- construction the 4th in Union_TC_Params. Replace (Pick (Union_TC_Params, 4), Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_TA_I32), Loc), Parameter_Associations => New_List ( Make_Integer_Literal (Loc, Intval => Choice_Index)))); -- Add a placeholder member label for the -- default case, which must have the -- discriminant type. declare Exp : constant Node_Id := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Disc_Type, Loc), Attribute_Name => Name_First); begin Set_Etype (Exp, Disc_Type); Append_To (Union_TC_Params, Build_To_Any_Call (Loc, Exp, Decls)); end; Add_Params_For_Variant_Components; Choice_Index := Choice_Index + 1; -- Case of an explicit choice when others => declare Exp : constant Node_Id := New_Copy_Tree (Choice); begin Append_To (Union_TC_Params, Build_To_Any_Call (Loc, Exp, Decls)); end; Add_Params_For_Variant_Components; Choice_Index := Choice_Index + 1; end case; Next (Choice); end loop; Next_Non_Pragma (Variant); end loop; end Variant_Part; end if; end TC_Rec_Add_Process_Element; Type_Name_Str : String_Id; Type_Repo_Id_Str : String_Id; -- Start of processing for Build_TypeCode_Function begin -- For a derived type, we can't go past the base type (to the -- parent type) here, because that would cause the attribute's -- formal parameter to have the wrong type; hence the Base_Type -- check here. if Is_Itype (Typ) and then Typ /= Base_Type (Typ) then Build_TypeCode_Function (Loc => Loc, Typ => Etype (Typ), Decl => Decl, Fnam => Fnam); return; end if; Fnam := TCNam; Spec := Make_Function_Specification (Loc, Defining_Unit_Name => Fnam, Parameter_Specifications => Empty_List, Result_Definition => New_Occurrence_Of (RTE (RE_TypeCode), Loc)); Build_Name_And_Repository_Id (Typ, Name_Str => Type_Name_Str, Repo_Id_Str => Type_Repo_Id_Str); Initialize_Parameter_List (Type_Name_Str, Type_Repo_Id_Str, Parameters); if Has_Stream_Attribute_Definition (Typ, TSS_Stream_Output, At_Any_Place => True) or else Has_Stream_Attribute_Definition (Typ, TSS_Stream_Write, At_Any_Place => True) then -- If user-defined stream attributes are specified for this -- type, use them and transmit data as an opaque sequence of -- stream elements. Return_Alias_TypeCode (New_Occurrence_Of (RTE (RE_TC_Opaque), Loc)); elsif Is_Derived_Type (Typ) and then not Is_Tagged_Type (Typ) then Return_Alias_TypeCode ( Build_TypeCode_Call (Loc, Etype (Typ), Decls)); elsif Is_Integer_Type (Typ) or else Is_Unsigned_Type (Typ) then Return_Alias_TypeCode ( Build_TypeCode_Call (Loc, Find_Numeric_Representation (Typ), Decls)); elsif Is_Record_Type (Typ) and then not Is_Tagged_Type (Typ) then -- Record typecodes are encoded as follows: -- -- TC_STRUCT -- | -- | [Name] -- | [Repository Id] -- -- Then for each discriminant: -- -- | [Discriminant Type Code] -- | [Discriminant Name] -- | ... -- -- Then for each component: -- -- | [Component Type Code] -- | [Component Name] -- | ... -- -- Variants components type codes are encoded as follows: -- -- TC_UNION -- | -- | [Name] -- | [Repository Id] -- | [Discriminant Type Code] -- | [Index of Default Variant Part or -1 for no default] -- -- Then for each Variant Part : -- -- | [VP Label] -- | -- | -- TC_STRUCT -- | | [Variant Part Name] -- | | [Variant Part Repository Id] -- | | -- | Then for each VP component: -- | | [VP component Typecode] -- | | [VP component Name] -- | | ... -- | -- -- | -- | [VP Name] if Nkind (Declaration_Node (Typ)) = N_Subtype_Declaration then Return_Alias_TypeCode (Build_TypeCode_Call (Loc, Etype (Typ), Decls)); else declare Disc : Entity_Id := Empty; Rdef : constant Node_Id := Type_Definition (Declaration_Node (Typ)); Dummy_Counter : Int := 0; begin -- Construct the discriminants typecodes if Has_Discriminants (Typ) then Disc := First_Discriminant (Typ); end if; while Present (Disc) loop Add_TypeCode_Parameter ( Build_TypeCode_Call (Loc, Etype (Disc), Decls), Parameters); Get_Name_String (Chars (Disc)); Add_String_Parameter ( String_From_Name_Buffer, Parameters); Next_Discriminant (Disc); end loop; -- then the components typecodes TC_Append_Record_Traversal (Parameters, Component_List (Rdef), Empty, Dummy_Counter); Return_Constructed_TypeCode (RTE (RE_Tk_Struct)); end; end if; elsif Is_Array_Type (Typ) then declare Ndim : constant Pos := Number_Dimensions (Typ); Inner_TypeCode : Node_Id; Constrained : constant Boolean := Is_Constrained (Typ); Indx : Node_Id := First_Index (Typ); begin Inner_TypeCode := Build_TypeCode_Call (Loc, Component_Type (Typ), Decls); for J in 1 .. Ndim loop if Constrained then Inner_TypeCode := Make_Constructed_TypeCode (RTE (RE_Tk_Array), New_List ( Build_To_Any_Call (Loc, OK_Convert_To (RTE (RE_Unsigned_32), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Typ, Loc), Attribute_Name => Name_Length, Expressions => New_List ( Make_Integer_Literal (Loc, Intval => Ndim - J + 1)))), Decls), Build_To_Any_Call (Loc, Inner_TypeCode, Decls))); else -- Unconstrained case: add low bound for each -- dimension. Add_TypeCode_Parameter (Build_TypeCode_Call (Loc, Etype (Indx), Decls), Parameters); Get_Name_String (New_External_Name ('L', J)); Add_String_Parameter ( String_From_Name_Buffer, Parameters); Next_Index (Indx); Inner_TypeCode := Make_Constructed_TypeCode (RTE (RE_Tk_Sequence), New_List ( Build_To_Any_Call (Loc, OK_Convert_To (RTE (RE_Unsigned_32), Make_Integer_Literal (Loc, 0)), Decls), Build_To_Any_Call (Loc, Inner_TypeCode, Decls))); end if; end loop; if Constrained then Return_Alias_TypeCode (Inner_TypeCode); else Add_TypeCode_Parameter (Inner_TypeCode, Parameters); Start_String; Store_String_Char ('V'); Add_String_Parameter (End_String, Parameters); Return_Constructed_TypeCode (RTE (RE_Tk_Struct)); end if; end; else -- Default: type is represented as an opaque sequence of bytes Return_Alias_TypeCode (New_Occurrence_Of (RTE (RE_TC_Opaque), Loc)); end if; Decl := Make_Subprogram_Body (Loc, Specification => Spec, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Stms)); end Build_TypeCode_Function; --------------------------------- -- Find_Numeric_Representation -- --------------------------------- function Find_Numeric_Representation (Typ : Entity_Id) return Entity_Id is FST : constant Entity_Id := First_Subtype (Typ); P_Size : constant Uint := Esize (FST); begin -- Special case: for Stream_Element_Offset and Storage_Offset, -- always force transmission as a 64-bit value. if Is_RTE (FST, RE_Stream_Element_Offset) or else Is_RTE (FST, RE_Storage_Offset) then return RTE (RE_Unsigned_64); end if; if Is_Unsigned_Type (Typ) then if P_Size <= 8 then return RTE (RE_Unsigned_8); elsif P_Size <= 16 then return RTE (RE_Unsigned_16); elsif P_Size <= 32 then return RTE (RE_Unsigned_32); else return RTE (RE_Unsigned_64); end if; elsif Is_Integer_Type (Typ) then if P_Size <= 8 then return RTE (RE_Integer_8); elsif P_Size <= Standard_Short_Integer_Size then return RTE (RE_Integer_16); elsif P_Size <= Standard_Integer_Size then return RTE (RE_Integer_32); else return RTE (RE_Integer_64); end if; elsif Is_Floating_Point_Type (Typ) then if P_Size <= Standard_Short_Float_Size then return Standard_Short_Float; elsif P_Size <= Standard_Float_Size then return Standard_Float; elsif P_Size <= Standard_Long_Float_Size then return Standard_Long_Float; else return Standard_Long_Long_Float; end if; else raise Program_Error; end if; -- TBD: fixed point types??? -- TBverified numeric types with a biased representation??? end Find_Numeric_Representation; --------------------------------- -- Is_Generic_Actual_Subtype -- --------------------------------- function Is_Generic_Actual_Subtype (Typ : Entity_Id) return Boolean is begin if Is_Itype (Typ) and then Present (Associated_Node_For_Itype (Typ)) then declare N : constant Node_Id := Associated_Node_For_Itype (Typ); begin if Nkind (N) = N_Subtype_Declaration and then Nkind (Parent (N)) = N_Package_Specification and then Is_Generic_Instance (Scope_Of_Spec (Parent (N))) then return True; end if; end; end if; return False; end Is_Generic_Actual_Subtype; --------------------------- -- Append_Array_Traversal -- --------------------------- procedure Append_Array_Traversal (Stmts : List_Id; Any : Entity_Id; Counter : Entity_Id := Empty; Depth : Pos := 1) is Loc : constant Source_Ptr := Sloc (Subprogram); Typ : constant Entity_Id := Etype (Arry); Constrained : constant Boolean := Is_Constrained (Typ); Ndim : constant Pos := Number_Dimensions (Typ); Inner_Any, Inner_Counter : Entity_Id; Loop_Stm : Node_Id; Inner_Stmts : constant List_Id := New_List; begin if Depth > Ndim then -- Processing for one element of an array declare Element_Expr : constant Node_Id := Make_Indexed_Component (Loc, New_Occurrence_Of (Arry, Loc), Indexes); begin Set_Etype (Element_Expr, Component_Type (Typ)); Add_Process_Element (Stmts, Any => Any, Counter => Counter, Datum => Element_Expr); end; return; end if; Append_To (Indexes, Make_Identifier (Loc, New_External_Name ('L', Depth))); if not Constrained or else Depth > 1 then Inner_Any := Make_Defining_Identifier (Loc, New_External_Name ('A', Depth)); Set_Etype (Inner_Any, RTE (RE_Any)); else Inner_Any := Empty; end if; if Present (Counter) then Inner_Counter := Make_Defining_Identifier (Loc, New_External_Name ('J', Depth)); else Inner_Counter := Empty; end if; declare Loop_Any : Node_Id := Inner_Any; begin -- For the first dimension of a constrained array, we add -- elements directly in the corresponding Any; there is no -- intervening inner Any. if No (Loop_Any) then Loop_Any := Any; end if; Append_Array_Traversal (Inner_Stmts, Any => Loop_Any, Counter => Inner_Counter, Depth => Depth + 1); end; Loop_Stm := Make_Implicit_Loop_Statement (Subprogram, Iteration_Scheme => Make_Iteration_Scheme (Loc, Loop_Parameter_Specification => Make_Loop_Parameter_Specification (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Chars => New_External_Name ('L', Depth)), Discrete_Subtype_Definition => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Arry, Loc), Attribute_Name => Name_Range, Expressions => New_List ( Make_Integer_Literal (Loc, Depth))))), Statements => Inner_Stmts); declare Decls : constant List_Id := New_List; Dimen_Stmts : constant List_Id := New_List; Length_Node : Node_Id; Inner_Any_TypeCode : constant Entity_Id := Make_Defining_Identifier (Loc, New_External_Name ('T', Depth)); Inner_Any_TypeCode_Expr : Node_Id; begin if Depth = 1 then if Constrained then Inner_Any_TypeCode_Expr := Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Get_TC), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Any, Loc))); else Inner_Any_TypeCode_Expr := Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Any_Member_Type), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Any, Loc), Make_Integer_Literal (Loc, Ndim))); end if; else Inner_Any_TypeCode_Expr := Make_Function_Call (Loc, Name => New_Occurrence_Of (RTE (RE_Content_Type), Loc), Parameter_Associations => New_List ( Make_Identifier (Loc, Chars => New_External_Name ('T', Depth - 1)))); end if; Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Inner_Any_TypeCode, Constant_Present => True, Object_Definition => New_Occurrence_Of ( RTE (RE_TypeCode), Loc), Expression => Inner_Any_TypeCode_Expr)); if Present (Inner_Any) then Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Inner_Any, Object_Definition => New_Occurrence_Of (RTE (RE_Any), Loc), Expression => Make_Function_Call (Loc, Name => New_Occurrence_Of ( RTE (RE_Create_Any), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Inner_Any_TypeCode, Loc))))); end if; if Present (Inner_Counter) then Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Inner_Counter, Object_Definition => New_Occurrence_Of (RTE (RE_Unsigned_32), Loc), Expression => Make_Integer_Literal (Loc, 0))); end if; if not Constrained then Length_Node := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Arry, Loc), Attribute_Name => Name_Length, Expressions => New_List (Make_Integer_Literal (Loc, Depth))); Set_Etype (Length_Node, RTE (RE_Unsigned_32)); Add_Process_Element (Dimen_Stmts, Datum => Length_Node, Any => Inner_Any, Counter => Inner_Counter); end if; -- Loop_Stm does appropriate processing for each element -- of Inner_Any. Append_To (Dimen_Stmts, Loop_Stm); -- Link outer and inner any if Present (Inner_Any) then Add_Process_Element (Dimen_Stmts, Any => Any, Counter => Counter, Datum => New_Occurrence_Of (Inner_Any, Loc)); end if; Append_To (Stmts, Make_Block_Statement (Loc, Declarations => Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => Dimen_Stmts))); end; end Append_Array_Traversal; ------------------------------- -- Make_Helper_Function_Name -- ------------------------------- function Make_Helper_Function_Name (Loc : Source_Ptr; Typ : Entity_Id; Nam : Name_Id) return Entity_Id is begin declare Serial : Nat := 0; -- For tagged types that aren't frozen yet, generate the helper -- under its canonical name so that it matches the primitive -- spec. For all other cases, we use a serialized name so that -- multiple generations of the same procedure do not clash. begin if Is_Tagged_Type (Typ) and then not Is_Frozen (Typ) then null; else Serial := Increment_Serial_Number; end if; -- Use prefixed underscore to avoid potential clash with user -- identifier (we use attribute names for Nam). return Make_Defining_Identifier (Loc, Chars => New_External_Name (Related_Id => Nam, Suffix => ' ', Suffix_Index => Serial, Prefix => '_')); end; end Make_Helper_Function_Name; end Helpers; ----------------------------------- -- Reserve_NamingContext_Methods -- ----------------------------------- procedure Reserve_NamingContext_Methods is Str_Resolve : constant String := "resolve"; begin Name_Buffer (1 .. Str_Resolve'Length) := Str_Resolve; Name_Len := Str_Resolve'Length; Overload_Counter_Table.Set (Name_Find, 1); end Reserve_NamingContext_Methods; ----------------------- -- RPC_Receiver_Decl -- ----------------------- function RPC_Receiver_Decl (RACW_Type : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (RACW_Type); begin return Make_Object_Declaration (Loc, Defining_Identifier => Make_Temporary (Loc, 'R'), Aliased_Present => True, Object_Definition => New_Occurrence_Of (RTE (RE_Servant), Loc)); end RPC_Receiver_Decl; end PolyORB_Support; ------------------------------- -- RACW_Type_Is_Asynchronous -- ------------------------------- procedure RACW_Type_Is_Asynchronous (RACW_Type : Entity_Id) is Asynchronous_Flag : constant Entity_Id := Asynchronous_Flags_Table.Get (RACW_Type); begin Replace (Expression (Parent (Asynchronous_Flag)), New_Occurrence_Of (Standard_True, Sloc (Asynchronous_Flag))); end RACW_Type_Is_Asynchronous; ------------------------- -- RCI_Package_Locator -- ------------------------- function RCI_Package_Locator (Loc : Source_Ptr; Package_Spec : Node_Id) return Node_Id is Inst : Node_Id; Pkg_Name : constant String_Id := Fully_Qualified_Name_String (Defining_Entity (Package_Spec), Append_NUL => False); begin Inst := Make_Package_Instantiation (Loc, Defining_Unit_Name => Make_Temporary (Loc, 'R'), Name => New_Occurrence_Of (RTE (RE_RCI_Locator), Loc), Generic_Associations => New_List ( Make_Generic_Association (Loc, Selector_Name => Make_Identifier (Loc, Name_RCI_Name), Explicit_Generic_Actual_Parameter => Make_String_Literal (Loc, Strval => Pkg_Name)), Make_Generic_Association (Loc, Selector_Name => Make_Identifier (Loc, Name_Version), Explicit_Generic_Actual_Parameter => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Defining_Entity (Package_Spec), Loc), Attribute_Name => Name_Version)))); RCI_Locator_Table.Set (Defining_Unit_Name (Package_Spec), Defining_Unit_Name (Inst)); return Inst; end RCI_Package_Locator; ----------------------------------------------- -- Remote_Types_Tagged_Full_View_Encountered -- ----------------------------------------------- procedure Remote_Types_Tagged_Full_View_Encountered (Full_View : Entity_Id) is Stub_Elements : constant Stub_Structure := Stubs_Table.Get (Full_View); begin -- For an RACW encountered before the freeze point of its designated -- type, the stub type is generated at the point of the RACW declaration -- but the primitives are generated only once the designated type is -- frozen. That freeze can occur in another scope, for example when the -- RACW is declared in a nested package. In that case we need to -- reestablish the stub type's scope prior to generating its primitive -- operations. if Stub_Elements /= Empty_Stub_Structure then declare Saved_Scope : constant Entity_Id := Current_Scope; Stubs_Scope : constant Entity_Id := Scope (Stub_Elements.Stub_Type); begin if Current_Scope /= Stubs_Scope then Push_Scope (Stubs_Scope); end if; Add_RACW_Primitive_Declarations_And_Bodies (Full_View, Stub_Elements.RPC_Receiver_Decl, Stub_Elements.Body_Decls); if Current_Scope /= Saved_Scope then Pop_Scope; end if; end; end if; end Remote_Types_Tagged_Full_View_Encountered; ------------------- -- Scope_Of_Spec -- ------------------- function Scope_Of_Spec (Spec : Node_Id) return Entity_Id is Unit_Name : Node_Id; begin Unit_Name := Defining_Unit_Name (Spec); while Nkind (Unit_Name) /= N_Defining_Identifier loop Unit_Name := Defining_Identifier (Unit_Name); end loop; return Unit_Name; end Scope_Of_Spec; ---------------------- -- Set_Renaming_TSS -- ---------------------- procedure Set_Renaming_TSS (Typ : Entity_Id; Nam : Entity_Id; TSS_Nam : TSS_Name_Type) is Loc : constant Source_Ptr := Sloc (Nam); Spec : constant Node_Id := Parent (Nam); TSS_Node : constant Node_Id := Make_Subprogram_Renaming_Declaration (Loc, Specification => Copy_Specification (Loc, Spec => Spec, New_Name => Make_TSS_Name (Typ, TSS_Nam)), Name => New_Occurrence_Of (Nam, Loc)); Snam : constant Entity_Id := Defining_Unit_Name (Specification (TSS_Node)); begin if Nkind (Spec) = N_Function_Specification then Set_Ekind (Snam, E_Function); Set_Etype (Snam, Entity (Result_Definition (Spec))); else Set_Ekind (Snam, E_Procedure); Set_Etype (Snam, Standard_Void_Type); end if; Set_TSS (Typ, Snam); end Set_Renaming_TSS; ---------------------------------------------- -- Specific_Add_Obj_RPC_Receiver_Completion -- ---------------------------------------------- procedure Specific_Add_Obj_RPC_Receiver_Completion (Loc : Source_Ptr; Decls : List_Id; RPC_Receiver : Entity_Id; Stub_Elements : Stub_Structure) is begin case Get_PCS_Name is when Name_PolyORB_DSA => PolyORB_Support.Add_Obj_RPC_Receiver_Completion (Loc, Decls, RPC_Receiver, Stub_Elements); when others => GARLIC_Support.Add_Obj_RPC_Receiver_Completion (Loc, Decls, RPC_Receiver, Stub_Elements); end case; end Specific_Add_Obj_RPC_Receiver_Completion; -------------------------------- -- Specific_Add_RACW_Features -- -------------------------------- procedure Specific_Add_RACW_Features (RACW_Type : Entity_Id; Desig : Entity_Id; Stub_Type : Entity_Id; Stub_Type_Access : Entity_Id; RPC_Receiver_Decl : Node_Id; Body_Decls : List_Id) is begin case Get_PCS_Name is when Name_PolyORB_DSA => PolyORB_Support.Add_RACW_Features (RACW_Type, Desig, Stub_Type, Stub_Type_Access, RPC_Receiver_Decl, Body_Decls); when others => GARLIC_Support.Add_RACW_Features (RACW_Type, Stub_Type, Stub_Type_Access, RPC_Receiver_Decl, Body_Decls); end case; end Specific_Add_RACW_Features; -------------------------------- -- Specific_Add_RAST_Features -- -------------------------------- procedure Specific_Add_RAST_Features (Vis_Decl : Node_Id; RAS_Type : Entity_Id) is begin case Get_PCS_Name is when Name_PolyORB_DSA => PolyORB_Support.Add_RAST_Features (Vis_Decl, RAS_Type); when others => GARLIC_Support.Add_RAST_Features (Vis_Decl, RAS_Type); end case; end Specific_Add_RAST_Features; -------------------------------------------------- -- Specific_Add_Receiving_Stubs_To_Declarations -- -------------------------------------------------- procedure Specific_Add_Receiving_Stubs_To_Declarations (Pkg_Spec : Node_Id; Decls : List_Id; Stmts : List_Id) is begin case Get_PCS_Name is when Name_PolyORB_DSA => PolyORB_Support.Add_Receiving_Stubs_To_Declarations (Pkg_Spec, Decls, Stmts); when others => GARLIC_Support.Add_Receiving_Stubs_To_Declarations (Pkg_Spec, Decls, Stmts); end case; end Specific_Add_Receiving_Stubs_To_Declarations; ------------------------------------------ -- Specific_Build_General_Calling_Stubs -- ------------------------------------------ procedure Specific_Build_General_Calling_Stubs (Decls : List_Id; Statements : List_Id; Target : RPC_Target; Subprogram_Id : Node_Id; Asynchronous : Node_Id := Empty; Is_Known_Asynchronous : Boolean := False; Is_Known_Non_Asynchronous : Boolean := False; Is_Function : Boolean; Spec : Node_Id; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Nod : Node_Id) is begin case Get_PCS_Name is when Name_PolyORB_DSA => PolyORB_Support.Build_General_Calling_Stubs (Decls, Statements, Target.Object, Subprogram_Id, Asynchronous, Is_Known_Asynchronous, Is_Known_Non_Asynchronous, Is_Function, Spec, Stub_Type, RACW_Type, Nod); when others => GARLIC_Support.Build_General_Calling_Stubs (Decls, Statements, Target.Partition, Target.RPC_Receiver, Subprogram_Id, Asynchronous, Is_Known_Asynchronous, Is_Known_Non_Asynchronous, Is_Function, Spec, Stub_Type, RACW_Type, Nod); end case; end Specific_Build_General_Calling_Stubs; -------------------------------------- -- Specific_Build_RPC_Receiver_Body -- -------------------------------------- procedure Specific_Build_RPC_Receiver_Body (RPC_Receiver : Entity_Id; Request : out Entity_Id; Subp_Id : out Entity_Id; Subp_Index : out Entity_Id; Stmts : out List_Id; Decl : out Node_Id) is begin case Get_PCS_Name is when Name_PolyORB_DSA => PolyORB_Support.Build_RPC_Receiver_Body (RPC_Receiver, Request, Subp_Id, Subp_Index, Stmts, Decl); when others => GARLIC_Support.Build_RPC_Receiver_Body (RPC_Receiver, Request, Subp_Id, Subp_Index, Stmts, Decl); end case; end Specific_Build_RPC_Receiver_Body; -------------------------------- -- Specific_Build_Stub_Target -- -------------------------------- function Specific_Build_Stub_Target (Loc : Source_Ptr; Decls : List_Id; RCI_Locator : Entity_Id; Controlling_Parameter : Entity_Id) return RPC_Target is begin case Get_PCS_Name is when Name_PolyORB_DSA => return PolyORB_Support.Build_Stub_Target (Loc, Decls, RCI_Locator, Controlling_Parameter); when others => return GARLIC_Support.Build_Stub_Target (Loc, Decls, RCI_Locator, Controlling_Parameter); end case; end Specific_Build_Stub_Target; -------------------------------- -- Specific_RPC_Receiver_Decl -- -------------------------------- function Specific_RPC_Receiver_Decl (RACW_Type : Entity_Id) return Node_Id is begin case Get_PCS_Name is when Name_PolyORB_DSA => return PolyORB_Support.RPC_Receiver_Decl (RACW_Type); when others => return GARLIC_Support.RPC_Receiver_Decl (RACW_Type); end case; end Specific_RPC_Receiver_Decl; ----------------------------------------------- -- Specific_Build_Subprogram_Receiving_Stubs -- ----------------------------------------------- function Specific_Build_Subprogram_Receiving_Stubs (Vis_Decl : Node_Id; Asynchronous : Boolean; Dynamically_Asynchronous : Boolean := False; Stub_Type : Entity_Id := Empty; RACW_Type : Entity_Id := Empty; Parent_Primitive : Entity_Id := Empty) return Node_Id is begin case Get_PCS_Name is when Name_PolyORB_DSA => return PolyORB_Support.Build_Subprogram_Receiving_Stubs (Vis_Decl, Asynchronous, Dynamically_Asynchronous, Stub_Type, RACW_Type, Parent_Primitive); when others => return GARLIC_Support.Build_Subprogram_Receiving_Stubs (Vis_Decl, Asynchronous, Dynamically_Asynchronous, Stub_Type, RACW_Type, Parent_Primitive); end case; end Specific_Build_Subprogram_Receiving_Stubs; ------------------------------- -- Transmit_As_Unconstrained -- ------------------------------- function Transmit_As_Unconstrained (Typ : Entity_Id) return Boolean is begin return not (Is_Elementary_Type (Typ) or else Is_Constrained (Typ)) or else (Is_Access_Type (Typ) and then Can_Never_Be_Null (Typ)); end Transmit_As_Unconstrained; -------------------------- -- Underlying_RACW_Type -- -------------------------- function Underlying_RACW_Type (RAS_Typ : Entity_Id) return Entity_Id is Record_Type : Entity_Id; begin if Ekind (RAS_Typ) = E_Record_Type then Record_Type := RAS_Typ; else pragma Assert (Present (Equivalent_Type (RAS_Typ))); Record_Type := Equivalent_Type (RAS_Typ); end if; return Etype (Subtype_Indication (Component_Definition (First (Component_Items (Component_List (Type_Definition (Declaration_Node (Record_Type)))))))); end Underlying_RACW_Type; end Exp_Dist;
Project-Einstein/src/E-Assembly/src/isEven.nasm
FelixLuciano/Elements-of-Computing-Systems
0
83844
<reponame>FelixLuciano/Elements-of-Computing-Systems ; Arquivo: isEven.nasm ; Curso: Elementos de Sistemas ; Criado por: <NAME> ; Data: 28/3/2019 ; ; Verifica se o valor salvo no endereço RAM[5] é ; par. Se for verdadeiro, salva 1 ; em RAM[0] e 0 caso contrário.
Resource_Control_Protocol/obj/b__main.adb
Maxelweb/concurrency-sandbox
0
13279
pragma Warnings (Off); pragma Ada_95; pragma Source_File_Name (ada_main, Spec_File_Name => "b__main.ads"); pragma Source_File_Name (ada_main, Body_File_Name => "b__main.adb"); pragma Suppress (Overflow_Check); with System.Restrictions; with Ada.Exceptions; package body ada_main is E075 : Short_Integer; pragma Import (Ada, E075, "system__os_lib_E"); E008 : Short_Integer; pragma Import (Ada, E008, "ada__exceptions_E"); E013 : Short_Integer; pragma Import (Ada, E013, "system__soft_links_E"); E025 : Short_Integer; pragma Import (Ada, E025, "system__exception_table_E"); E040 : Short_Integer; pragma Import (Ada, E040, "ada__containers_E"); E070 : Short_Integer; pragma Import (Ada, E070, "ada__io_exceptions_E"); E055 : Short_Integer; pragma Import (Ada, E055, "ada__strings_E"); E057 : Short_Integer; pragma Import (Ada, E057, "ada__strings__maps_E"); E061 : Short_Integer; pragma Import (Ada, E061, "ada__strings__maps__constants_E"); E045 : Short_Integer; pragma Import (Ada, E045, "interfaces__c_E"); E027 : Short_Integer; pragma Import (Ada, E027, "system__exceptions_E"); E081 : Short_Integer; pragma Import (Ada, E081, "system__object_reader_E"); E050 : Short_Integer; pragma Import (Ada, E050, "system__dwarf_lines_E"); E021 : Short_Integer; pragma Import (Ada, E021, "system__soft_links__initialize_E"); E039 : Short_Integer; pragma Import (Ada, E039, "system__traceback__symbolic_E"); E005 : Short_Integer; pragma Import (Ada, E005, "ada__tags_E"); E108 : Short_Integer; pragma Import (Ada, E108, "ada__streams_E"); E116 : Short_Integer; pragma Import (Ada, E116, "system__file_control_block_E"); E115 : Short_Integer; pragma Import (Ada, E115, "system__finalization_root_E"); E113 : Short_Integer; pragma Import (Ada, E113, "ada__finalization_E"); E112 : Short_Integer; pragma Import (Ada, E112, "system__file_io_E"); E141 : Short_Integer; pragma Import (Ada, E141, "system__task_info_E"); E133 : Short_Integer; pragma Import (Ada, E133, "system__task_primitives__operations_E"); E175 : Short_Integer; pragma Import (Ada, E175, "ada__calendar_E"); E173 : Short_Integer; pragma Import (Ada, E173, "ada__calendar__delays_E"); E183 : Short_Integer; pragma Import (Ada, E183, "ada__real_time_E"); E106 : Short_Integer; pragma Import (Ada, E106, "ada__text_io_E"); E157 : Short_Integer; pragma Import (Ada, E157, "system__tasking__initialization_E"); E122 : Short_Integer; pragma Import (Ada, E122, "system__tasking__protected_objects_E"); E153 : Short_Integer; pragma Import (Ada, E153, "system__tasking__protected_objects__entries_E"); E165 : Short_Integer; pragma Import (Ada, E165, "system__tasking__queuing_E"); E181 : Short_Integer; pragma Import (Ada, E181, "system__tasking__stages_E"); E104 : Short_Integer; pragma Import (Ada, E104, "rcp__control_E"); E171 : Short_Integer; pragma Import (Ada, E171, "rcp__user_E"); Sec_Default_Sized_Stacks : array (1 .. 1) of aliased System.Secondary_Stack.SS_Stack (System.Parameters.Runtime_Default_Sec_Stack_Size); Local_Priority_Specific_Dispatching : constant String := ""; Local_Interrupt_States : constant String := ""; Is_Elaborated : Boolean := False; procedure finalize_library is begin E104 := E104 - 1; declare procedure F1; pragma Import (Ada, F1, "rcp__control__finalize_spec"); begin F1; end; E153 := E153 - 1; declare procedure F2; pragma Import (Ada, F2, "system__tasking__protected_objects__entries__finalize_spec"); begin F2; end; E106 := E106 - 1; declare procedure F3; pragma Import (Ada, F3, "ada__text_io__finalize_spec"); begin F3; end; declare procedure F4; pragma Import (Ada, F4, "system__file_io__finalize_body"); begin E112 := E112 - 1; F4; end; declare procedure Reraise_Library_Exception_If_Any; pragma Import (Ada, Reraise_Library_Exception_If_Any, "__gnat_reraise_library_exception_if_any"); begin Reraise_Library_Exception_If_Any; end; end finalize_library; procedure adafinal is procedure s_stalib_adafinal; pragma Import (C, s_stalib_adafinal, "system__standard_library__adafinal"); procedure Runtime_Finalize; pragma Import (C, Runtime_Finalize, "__gnat_runtime_finalize"); begin if not Is_Elaborated then return; end if; Is_Elaborated := False; Runtime_Finalize; s_stalib_adafinal; end adafinal; type No_Param_Proc is access procedure; pragma Favor_Top_Level (No_Param_Proc); procedure adainit is Main_Priority : Integer; pragma Import (C, Main_Priority, "__gl_main_priority"); Time_Slice_Value : Integer; pragma Import (C, Time_Slice_Value, "__gl_time_slice_val"); WC_Encoding : Character; pragma Import (C, WC_Encoding, "__gl_wc_encoding"); Locking_Policy : Character; pragma Import (C, Locking_Policy, "__gl_locking_policy"); Queuing_Policy : Character; pragma Import (C, Queuing_Policy, "__gl_queuing_policy"); Task_Dispatching_Policy : Character; pragma Import (C, Task_Dispatching_Policy, "__gl_task_dispatching_policy"); Priority_Specific_Dispatching : System.Address; pragma Import (C, Priority_Specific_Dispatching, "__gl_priority_specific_dispatching"); Num_Specific_Dispatching : Integer; pragma Import (C, Num_Specific_Dispatching, "__gl_num_specific_dispatching"); Main_CPU : Integer; pragma Import (C, Main_CPU, "__gl_main_cpu"); Interrupt_States : System.Address; pragma Import (C, Interrupt_States, "__gl_interrupt_states"); Num_Interrupt_States : Integer; pragma Import (C, Num_Interrupt_States, "__gl_num_interrupt_states"); Unreserve_All_Interrupts : Integer; pragma Import (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts"); Detect_Blocking : Integer; pragma Import (C, Detect_Blocking, "__gl_detect_blocking"); Default_Stack_Size : Integer; pragma Import (C, Default_Stack_Size, "__gl_default_stack_size"); Default_Secondary_Stack_Size : System.Parameters.Size_Type; pragma Import (C, Default_Secondary_Stack_Size, "__gnat_default_ss_size"); Leap_Seconds_Support : Integer; pragma Import (C, Leap_Seconds_Support, "__gl_leap_seconds_support"); Bind_Env_Addr : System.Address; pragma Import (C, Bind_Env_Addr, "__gl_bind_env_addr"); procedure Runtime_Initialize (Install_Handler : Integer); pragma Import (C, Runtime_Initialize, "__gnat_runtime_initialize"); Finalize_Library_Objects : No_Param_Proc; pragma Import (C, Finalize_Library_Objects, "__gnat_finalize_library_objects"); Binder_Sec_Stacks_Count : Natural; pragma Import (Ada, Binder_Sec_Stacks_Count, "__gnat_binder_ss_count"); Default_Sized_SS_Pool : System.Address; pragma Import (Ada, Default_Sized_SS_Pool, "__gnat_default_ss_pool"); begin if Is_Elaborated then return; end if; Is_Elaborated := True; Main_Priority := -1; Time_Slice_Value := -1; WC_Encoding := 'b'; Locking_Policy := ' '; Queuing_Policy := ' '; Task_Dispatching_Policy := ' '; System.Restrictions.Run_Time_Restrictions := (Set => (False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False), Value => (0, 0, 0, 0, 0, 0, 0, 0, 0, 0), Violated => (True, False, False, False, True, True, False, False, False, False, False, True, True, True, True, False, False, False, False, False, True, True, False, True, True, False, True, True, True, True, False, False, False, False, False, True, False, False, True, False, False, False, True, True, False, True, True, True, False, False, False, True, False, False, False, False, False, True, False, True, False, True, True, True, False, False, True, False, True, True, True, False, True, True, False, True, True, True, True, False, False, True, False, False, False, True, False, False, True, False, True, False), Count => (0, 0, 0, 2, 0, 0, 1, 0, 2, 0), Unknown => (False, False, False, False, False, False, True, False, True, False)); Priority_Specific_Dispatching := Local_Priority_Specific_Dispatching'Address; Num_Specific_Dispatching := 0; Main_CPU := -1; Interrupt_States := Local_Interrupt_States'Address; Num_Interrupt_States := 0; Unreserve_All_Interrupts := 0; Detect_Blocking := 0; Default_Stack_Size := -1; Leap_Seconds_Support := 0; ada_main'Elab_Body; Default_Secondary_Stack_Size := System.Parameters.Runtime_Default_Sec_Stack_Size; Binder_Sec_Stacks_Count := 1; Default_Sized_SS_Pool := Sec_Default_Sized_Stacks'Address; Runtime_Initialize (1); Finalize_Library_Objects := finalize_library'access; Ada.Exceptions'Elab_Spec; System.Soft_Links'Elab_Spec; System.Exception_Table'Elab_Body; E025 := E025 + 1; Ada.Containers'Elab_Spec; E040 := E040 + 1; Ada.Io_Exceptions'Elab_Spec; E070 := E070 + 1; Ada.Strings'Elab_Spec; E055 := E055 + 1; Ada.Strings.Maps'Elab_Spec; E057 := E057 + 1; Ada.Strings.Maps.Constants'Elab_Spec; E061 := E061 + 1; Interfaces.C'Elab_Spec; E045 := E045 + 1; System.Exceptions'Elab_Spec; E027 := E027 + 1; System.Object_Reader'Elab_Spec; E081 := E081 + 1; System.Dwarf_Lines'Elab_Spec; E050 := E050 + 1; System.Os_Lib'Elab_Body; E075 := E075 + 1; System.Soft_Links.Initialize'Elab_Body; E021 := E021 + 1; E013 := E013 + 1; System.Traceback.Symbolic'Elab_Body; E039 := E039 + 1; E008 := E008 + 1; Ada.Tags'Elab_Spec; Ada.Tags'Elab_Body; E005 := E005 + 1; Ada.Streams'Elab_Spec; E108 := E108 + 1; System.File_Control_Block'Elab_Spec; E116 := E116 + 1; System.Finalization_Root'Elab_Spec; E115 := E115 + 1; Ada.Finalization'Elab_Spec; E113 := E113 + 1; System.File_Io'Elab_Body; E112 := E112 + 1; System.Task_Info'Elab_Spec; E141 := E141 + 1; System.Task_Primitives.Operations'Elab_Body; E133 := E133 + 1; Ada.Calendar'Elab_Spec; Ada.Calendar'Elab_Body; E175 := E175 + 1; Ada.Calendar.Delays'Elab_Body; E173 := E173 + 1; Ada.Real_Time'Elab_Spec; Ada.Real_Time'Elab_Body; E183 := E183 + 1; Ada.Text_Io'Elab_Spec; Ada.Text_Io'Elab_Body; E106 := E106 + 1; System.Tasking.Initialization'Elab_Body; E157 := E157 + 1; System.Tasking.Protected_Objects'Elab_Body; E122 := E122 + 1; System.Tasking.Protected_Objects.Entries'Elab_Spec; E153 := E153 + 1; System.Tasking.Queuing'Elab_Body; E165 := E165 + 1; System.Tasking.Stages'Elab_Body; E181 := E181 + 1; RCP.CONTROL'ELAB_SPEC; RCP.CONTROL'ELAB_BODY; E104 := E104 + 1; RCP.USER'ELAB_BODY; E171 := E171 + 1; end adainit; procedure Ada_Main_Program; pragma Import (Ada, Ada_Main_Program, "_ada_main"); function main (argc : Integer; argv : System.Address; envp : System.Address) return Integer is procedure Initialize (Addr : System.Address); pragma Import (C, Initialize, "__gnat_initialize"); procedure Finalize; pragma Import (C, Finalize, "__gnat_finalize"); SEH : aliased array (1 .. 2) of Integer; Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address; pragma Volatile (Ensure_Reference); begin if gnat_argc = 0 then gnat_argc := argc; gnat_argv := argv; end if; gnat_envp := envp; Initialize (SEH'Address); adainit; Ada_Main_Program; adafinal; Finalize; return (gnat_exit_status); end; -- BEGIN Object file/option list -- /home/maxelweb/Github/adacore-sandbox/Resource_Control_Protocol/obj/rcp.o -- /home/maxelweb/Github/adacore-sandbox/Resource_Control_Protocol/obj/rcp-control.o -- /home/maxelweb/Github/adacore-sandbox/Resource_Control_Protocol/obj/rcp-user.o -- /home/maxelweb/Github/adacore-sandbox/Resource_Control_Protocol/obj/main.o -- -L/home/maxelweb/Github/adacore-sandbox/Resource_Control_Protocol/obj/ -- -L/home/maxelweb/Github/adacore-sandbox/Resource_Control_Protocol/obj/ -- -L/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/adalib/ -- -static -- -lgnarl -- -lgnat -- -lrt -- -lpthread -- -ldl -- END Object file/option list end ada_main;
alloy4fun_models/trashltl/models/19/MuScyhbX9yS65APnH.als
Kaixi26/org.alloytools.alloy
0
181
<gh_stars>0 open main pred idMuScyhbX9yS65APnH_prop20 { always all f: File | f in Trash since f not in Protected } pred __repair { idMuScyhbX9yS65APnH_prop20 } check __repair { idMuScyhbX9yS65APnH_prop20 <=> prop20o }
screen_splitting/main.asm
cainex/c64_playground
0
93745
main: sei jsr init_screen SetCharMemLocation(GetCharMemValue(charset)) SetScreenMemLocation(GetScreenMemValue(screen)) lda #$00 sta offset jsr fill_map_offsets jsr fill_menu //// Set up interrupt set_irq: // Turn off other interrupts ClearIntMask() // Turn off BASIC and KERNAL ROMs // SetMemMapMode(RAM_IO_RAM) // Enable VIC=II interrupt lda #$01 sta VIC_INT_EN // Set IRQ subroutine lda #<irq ldx #>irq sta BASIC_IRQ_VEC_LO stx BASIC_IRQ_VEC_HI lda #$00 sta VIC_RASTER_CNT // Set initial raster line interrupt lda VIC_CNTRL1 and #$7f sta VIC_CNTRL1 cli gameloop: jsr fill_map_offsets jmp gameloop irq: inc VIC_BORDER_COL dec VIC_INT_REG lda VIC_RASTER_CNT cmp #$00 beq first_run lda #$00 sta VIC_RASTER_CNT SetCharMemLocation(GetCharMemValue(menu_charset)) lda #$06 inc key_check_count cmp key_check_count bne irq_cont lda #$00 sta key_check_count jsr read_key jmp irq_cont first_run: lda #$A9 sta VIC_RASTER_CNT SetCharMemLocation(GetCharMemValue(charset)) irq_cont: dec VIC_BORDER_COL jmp $ea81 screen_swap: .byte $00
Transynther/x86/_processed/NC/_zr_/i3-7100_9_0x84_notsx.log_310_2041.asm
ljhsiun2/medusa
9
162022
<filename>Transynther/x86/_processed/NC/_zr_/i3-7100_9_0x84_notsx.log_310_2041.asm .global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r8 push %r9 push %rbx push %rcx // Store lea addresses_RW+0x19f25, %rbx add %rcx, %rcx movw $0x5152, (%rbx) nop add $3589, %r9 // Faulty Load mov $0x50770d0000000765, %r14 nop nop nop nop dec %r10 vmovups (%r14), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %rcx lea oracles, %r9 and $0xff, %rcx shlq $12, %rcx mov (%r9,%rcx,1), %rcx pop %rcx pop %rbx pop %r9 pop %r8 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_RW', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_NC', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'00': 310} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/variant_part.ads
best08618/asylo
7
3550
-- { dg-do compile } package Variant_Part is type T1(b: boolean) is record case (b) is -- { dg-error "discriminant name may not be parenthesized" } when others => null; end case; end record; end Variant_Part;
AppleScripts/Applications/iZotope RX 7/Toggle Composite View.applescript
fantopop/post-production-scripts
16
810
-- -- AppleScripts for Avid Pro Tools. -- -- Script description: -- 1. Sends audio back to Pro Tools. -- 2. Renders the selection. -- 3. Creates fades around the selection. -- -- (C) 2020 <NAME> -- http://github.com/fantopop -- set RXVersion to "8" -- activate application ("iZotope RX " & RXVersion & " Audio Editor") tell application "System Events" -- get iZotope RX process set RX to the first application process whose name contains "iZotope" -- get main window -- check if already in composite view set compositeViewOn to count (windows of RX whose name contains "Composite View") if (compositeViewOn > 0) then set mainwindow to 1st window of RX whose name contains "Composite View" set mainWindowGroup to 1st group of mainwindow perform action "AXPress" of 2nd item of every button of mainWindowGroup else set mainwindow to 1st window of RX whose name contains "Pro Tools" set mainWindowGroup to 1st group of mainwindow perform action "AXPress" of 3rd item of every button of mainWindowGroup end if end tell
src/fltk-images-rgb-png.ads
micahwelf/FLTK-Ada
1
2039
<filename>src/fltk-images-rgb-png.ads package FLTK.Images.RGB.PNG is type PNG_Image is new RGB_Image with private; type PNG_Image_Reference (Data : not null access PNG_Image'Class) is limited null record with Implicit_Dereference => Data; package Forge is function Create (Filename : in String) return PNG_Image; end Forge; private type PNG_Image is new RGB_Image with null record; overriding procedure Finalize (This : in out PNG_Image); end FLTK.Images.RGB.PNG;
trunk/win/lib/openssl-1.0.1e/tmp32/cast-586.asm
chundonglinlin/srs.win
9
170535
TITLE cast-586.asm IF @Version LT 800 ECHO MASM version 8.00 or later is strongly recommended. ENDIF .486 .MODEL FLAT OPTION DOTNAME IF @Version LT 800 .text$ SEGMENT PAGE 'CODE' ELSE .text$ SEGMENT ALIGN(64) 'CODE' ENDIF EXTERN _CAST_S_table0:NEAR EXTERN _CAST_S_table1:NEAR EXTERN _CAST_S_table2:NEAR EXTERN _CAST_S_table3:NEAR ALIGN 16 _CAST_encrypt PROC PUBLIC $L_CAST_encrypt_begin:: ; push ebp push ebx mov ebx,DWORD PTR 12[esp] mov ebp,DWORD PTR 16[esp] push esi push edi ; Load the 2 words mov edi,DWORD PTR [ebx] mov esi,DWORD PTR 4[ebx] ; Get short key flag mov eax,DWORD PTR 128[ebp] push eax xor eax,eax ; round 0 mov edx,DWORD PTR [ebp] mov ecx,DWORD PTR 4[ebp] add edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor edi,ecx ; round 1 mov edx,DWORD PTR 8[ebp] mov ecx,DWORD PTR 12[ebp] xor edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] xor ecx,ebx xor esi,ecx ; round 2 mov edx,DWORD PTR 16[ebp] mov ecx,DWORD PTR 20[ebp] sub edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] sub ecx,ebx xor edi,ecx ; round 3 mov edx,DWORD PTR 24[ebp] mov ecx,DWORD PTR 28[ebp] add edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor esi,ecx ; round 4 mov edx,DWORD PTR 32[ebp] mov ecx,DWORD PTR 36[ebp] xor edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] xor ecx,ebx xor edi,ecx ; round 5 mov edx,DWORD PTR 40[ebp] mov ecx,DWORD PTR 44[ebp] sub edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] sub ecx,ebx xor esi,ecx ; round 6 mov edx,DWORD PTR 48[ebp] mov ecx,DWORD PTR 52[ebp] add edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor edi,ecx ; round 7 mov edx,DWORD PTR 56[ebp] mov ecx,DWORD PTR 60[ebp] xor edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] xor ecx,ebx xor esi,ecx ; round 8 mov edx,DWORD PTR 64[ebp] mov ecx,DWORD PTR 68[ebp] sub edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] sub ecx,ebx xor edi,ecx ; round 9 mov edx,DWORD PTR 72[ebp] mov ecx,DWORD PTR 76[ebp] add edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor esi,ecx ; round 10 mov edx,DWORD PTR 80[ebp] mov ecx,DWORD PTR 84[ebp] xor edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] xor ecx,ebx xor edi,ecx ; round 11 mov edx,DWORD PTR 88[ebp] mov ecx,DWORD PTR 92[ebp] sub edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] sub ecx,ebx xor esi,ecx ; test short key flag pop edx or edx,edx jnz $L000cast_enc_done ; round 12 mov edx,DWORD PTR 96[ebp] mov ecx,DWORD PTR 100[ebp] add edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor edi,ecx ; round 13 mov edx,DWORD PTR 104[ebp] mov ecx,DWORD PTR 108[ebp] xor edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] xor ecx,ebx xor esi,ecx ; round 14 mov edx,DWORD PTR 112[ebp] mov ecx,DWORD PTR 116[ebp] sub edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] sub ecx,ebx xor edi,ecx ; round 15 mov edx,DWORD PTR 120[ebp] mov ecx,DWORD PTR 124[ebp] add edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor esi,ecx $L000cast_enc_done: nop mov eax,DWORD PTR 20[esp] mov DWORD PTR 4[eax],edi mov DWORD PTR [eax],esi pop edi pop esi pop ebx pop ebp ret _CAST_encrypt ENDP EXTERN _CAST_S_table0:NEAR EXTERN _CAST_S_table1:NEAR EXTERN _CAST_S_table2:NEAR EXTERN _CAST_S_table3:NEAR ALIGN 16 _CAST_decrypt PROC PUBLIC $L_CAST_decrypt_begin:: ; push ebp push ebx mov ebx,DWORD PTR 12[esp] mov ebp,DWORD PTR 16[esp] push esi push edi ; Load the 2 words mov edi,DWORD PTR [ebx] mov esi,DWORD PTR 4[ebx] ; Get short key flag mov eax,DWORD PTR 128[ebp] or eax,eax jnz $L001cast_dec_skip xor eax,eax ; round 15 mov edx,DWORD PTR 120[ebp] mov ecx,DWORD PTR 124[ebp] add edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor edi,ecx ; round 14 mov edx,DWORD PTR 112[ebp] mov ecx,DWORD PTR 116[ebp] sub edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] sub ecx,ebx xor esi,ecx ; round 13 mov edx,DWORD PTR 104[ebp] mov ecx,DWORD PTR 108[ebp] xor edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] xor ecx,ebx xor edi,ecx ; round 12 mov edx,DWORD PTR 96[ebp] mov ecx,DWORD PTR 100[ebp] add edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor esi,ecx $L001cast_dec_skip: ; round 11 mov edx,DWORD PTR 88[ebp] mov ecx,DWORD PTR 92[ebp] sub edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] sub ecx,ebx xor edi,ecx ; round 10 mov edx,DWORD PTR 80[ebp] mov ecx,DWORD PTR 84[ebp] xor edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] xor ecx,ebx xor esi,ecx ; round 9 mov edx,DWORD PTR 72[ebp] mov ecx,DWORD PTR 76[ebp] add edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor edi,ecx ; round 8 mov edx,DWORD PTR 64[ebp] mov ecx,DWORD PTR 68[ebp] sub edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] sub ecx,ebx xor esi,ecx ; round 7 mov edx,DWORD PTR 56[ebp] mov ecx,DWORD PTR 60[ebp] xor edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] xor ecx,ebx xor edi,ecx ; round 6 mov edx,DWORD PTR 48[ebp] mov ecx,DWORD PTR 52[ebp] add edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor esi,ecx ; round 5 mov edx,DWORD PTR 40[ebp] mov ecx,DWORD PTR 44[ebp] sub edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] sub ecx,ebx xor edi,ecx ; round 4 mov edx,DWORD PTR 32[ebp] mov ecx,DWORD PTR 36[ebp] xor edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] xor ecx,ebx xor esi,ecx ; round 3 mov edx,DWORD PTR 24[ebp] mov ecx,DWORD PTR 28[ebp] add edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor edi,ecx ; round 2 mov edx,DWORD PTR 16[ebp] mov ecx,DWORD PTR 20[ebp] sub edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] sub ecx,ebx xor esi,ecx ; round 1 mov edx,DWORD PTR 8[ebp] mov ecx,DWORD PTR 12[ebp] xor edx,esi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] add ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] xor ecx,ebx xor edi,ecx ; round 0 mov edx,DWORD PTR [ebp] mov ecx,DWORD PTR 4[ebp] add edx,edi rol edx,cl mov ebx,edx xor ecx,ecx mov cl,dh and ebx,255 shr edx,16 xor eax,eax mov al,dh and edx,255 mov ecx,DWORD PTR _CAST_S_table0[ecx*4] mov ebx,DWORD PTR _CAST_S_table1[ebx*4] xor ecx,ebx mov ebx,DWORD PTR _CAST_S_table2[eax*4] sub ecx,ebx mov ebx,DWORD PTR _CAST_S_table3[edx*4] add ecx,ebx xor esi,ecx nop mov eax,DWORD PTR 20[esp] mov DWORD PTR 4[eax],edi mov DWORD PTR [eax],esi pop edi pop esi pop ebx pop ebp ret _CAST_decrypt ENDP ALIGN 16 _CAST_cbc_encrypt PROC PUBLIC $L_CAST_cbc_encrypt_begin:: ; push ebp push ebx push esi push edi mov ebp,DWORD PTR 28[esp] ; getting iv ptr from parameter 4 mov ebx,DWORD PTR 36[esp] mov esi,DWORD PTR [ebx] mov edi,DWORD PTR 4[ebx] push edi push esi push edi push esi mov ebx,esp mov esi,DWORD PTR 36[esp] mov edi,DWORD PTR 40[esp] ; getting encrypt flag from parameter 5 mov ecx,DWORD PTR 56[esp] ; get and push parameter 3 mov eax,DWORD PTR 48[esp] push eax push ebx cmp ecx,0 jz $L002decrypt and ebp,4294967288 mov eax,DWORD PTR 8[esp] mov ebx,DWORD PTR 12[esp] jz $L003encrypt_finish $L004encrypt_loop: mov ecx,DWORD PTR [esi] mov edx,DWORD PTR 4[esi] xor eax,ecx xor ebx,edx bswap eax bswap ebx mov DWORD PTR 8[esp],eax mov DWORD PTR 12[esp],ebx call $L_CAST_encrypt_begin mov eax,DWORD PTR 8[esp] mov ebx,DWORD PTR 12[esp] bswap eax bswap ebx mov DWORD PTR [edi],eax mov DWORD PTR 4[edi],ebx add esi,8 add edi,8 sub ebp,8 jnz $L004encrypt_loop $L003encrypt_finish: mov ebp,DWORD PTR 52[esp] and ebp,7 jz $L005finish call $L006PIC_point $L006PIC_point: pop edx lea ecx,DWORD PTR ($L007cbc_enc_jmp_table-$L006PIC_point)[edx] mov ebp,DWORD PTR [ebp*4+ecx] add ebp,edx xor ecx,ecx xor edx,edx jmp ebp $L008ej7: mov dh,BYTE PTR 6[esi] shl edx,8 $L009ej6: mov dh,BYTE PTR 5[esi] $L010ej5: mov dl,BYTE PTR 4[esi] $L011ej4: mov ecx,DWORD PTR [esi] jmp $L012ejend $L013ej3: mov ch,BYTE PTR 2[esi] shl ecx,8 $L014ej2: mov ch,BYTE PTR 1[esi] $L015ej1: mov cl,BYTE PTR [esi] $L012ejend: xor eax,ecx xor ebx,edx bswap eax bswap ebx mov DWORD PTR 8[esp],eax mov DWORD PTR 12[esp],ebx call $L_CAST_encrypt_begin mov eax,DWORD PTR 8[esp] mov ebx,DWORD PTR 12[esp] bswap eax bswap ebx mov DWORD PTR [edi],eax mov DWORD PTR 4[edi],ebx jmp $L005finish $L002decrypt: and ebp,4294967288 mov eax,DWORD PTR 16[esp] mov ebx,DWORD PTR 20[esp] jz $L016decrypt_finish $L017decrypt_loop: mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] bswap eax bswap ebx mov DWORD PTR 8[esp],eax mov DWORD PTR 12[esp],ebx call $L_CAST_decrypt_begin mov eax,DWORD PTR 8[esp] mov ebx,DWORD PTR 12[esp] bswap eax bswap ebx mov ecx,DWORD PTR 16[esp] mov edx,DWORD PTR 20[esp] xor ecx,eax xor edx,ebx mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] mov DWORD PTR [edi],ecx mov DWORD PTR 4[edi],edx mov DWORD PTR 16[esp],eax mov DWORD PTR 20[esp],ebx add esi,8 add edi,8 sub ebp,8 jnz $L017decrypt_loop $L016decrypt_finish: mov ebp,DWORD PTR 52[esp] and ebp,7 jz $L005finish mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] bswap eax bswap ebx mov DWORD PTR 8[esp],eax mov DWORD PTR 12[esp],ebx call $L_CAST_decrypt_begin mov eax,DWORD PTR 8[esp] mov ebx,DWORD PTR 12[esp] bswap eax bswap ebx mov ecx,DWORD PTR 16[esp] mov edx,DWORD PTR 20[esp] xor ecx,eax xor edx,ebx mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] $L018dj7: ror edx,16 mov BYTE PTR 6[edi],dl shr edx,16 $L019dj6: mov BYTE PTR 5[edi],dh $L020dj5: mov BYTE PTR 4[edi],dl $L021dj4: mov DWORD PTR [edi],ecx jmp $L022djend $L023dj3: ror ecx,16 mov BYTE PTR 2[edi],cl shl ecx,16 $L024dj2: mov BYTE PTR 1[esi],ch $L025dj1: mov BYTE PTR [esi],cl $L022djend: jmp $L005finish $L005finish: mov ecx,DWORD PTR 60[esp] add esp,24 mov DWORD PTR [ecx],eax mov DWORD PTR 4[ecx],ebx pop edi pop esi pop ebx pop ebp ret ALIGN 64 $L007cbc_enc_jmp_table: DD 0 DD $L015ej1-$L006PIC_point DD $L014ej2-$L006PIC_point DD $L013ej3-$L006PIC_point DD $L011ej4-$L006PIC_point DD $L010ej5-$L006PIC_point DD $L009ej6-$L006PIC_point DD $L008ej7-$L006PIC_point ALIGN 64 _CAST_cbc_encrypt ENDP .text$ ENDS END
file_crypter.adb
python36/vibecrypt
0
1530
package body file_crypter is procedure init_key(key : key_s) is begin raiden.init_key(key); end init_key; procedure file_crypt(in_file : byte_io.File_Type; out_file : out byte_io.File_Type; mode_crypt : mode) is type raiden_access is access procedure (x : in byte_array_8; y : out byte_array_8); raiden_operation : raiden_access; t_b : byte; in_buf, out_buf : byte_array_8; in_ind : earth := 0; t_i : integer := 7; begin if mode_crypt = mode'(encrypt) then raiden_operation := raiden.raiden_encrypt'access; else raiden_operation := raiden.raiden_decrypt'access; end if; loop if byte_io.end_of_file(in_file) then if in_ind /= 0 then for i in in_ind..7 loop in_buf(integer(i)) := 0; end loop; else exit; end if; in_ind := 0; else byte_io.read(in_file, t_b); in_buf(integer(in_ind)) := t_b; increment(in_ind); end if; if in_ind = 0 then raiden_operation(in_buf, out_buf); if byte_io.end_of_file(in_file) then for i in reverse 0..7 loop if out_buf(i) /= 0 then t_i := i; exit; end if; end loop; end if; for i in 0..t_i loop byte_io.write(out_file, out_buf(i)); end loop; end if; end loop; end file_crypt; end file_crypter;
immutable_testdata/hana9/hana9.als
nowavailable/alloy_als_study
0
2539
module hana9 open util/boolean sig Boundary { val: disj one Int } one sig Now { val: one Int } { val = 6} sig City { cities_shops: set CitiesShop, order_details: set OrderDetail, label: one Boundary } sig CitiesShop { shop: one Shop, city: one City } sig Merchandise { order_details: set OrderDetail, rule_for_ships: set RuleForShip, label: one Boundary, price: one Boundary } sig OrderDetail { merchandise: one Merchandise, city: one City, order: one Order, requested_deliveries: set RequestedDelivery, seq_code: one Boundary, expected_date: one Boundary, quantity: one Boundary } sig Order { order_details: set OrderDetail, order_code: one Boundary, ordered_at: one Boundary } sig RequestedDelivery { shop: one Shop, order_detail: one OrderDetail, order_code: one Boundary, quantity: one Boundary } sig RuleForShip { shop: one Shop, merchandise: one Merchandise, interval_day: one Boundary, quantity_limit: one Boundary, quantity_available: one Boundary } sig ShipLimit { shop: one Shop, expected_date: one Boundary } sig Shop { cities_shops: set CitiesShop, requested_deliveries: set RequestedDelivery, rule_for_ships: set RuleForShip, ship_limits: set ShipLimit, code: one Boundary, label: one Boundary, delivery_limit_per_day: one Boundary, mergin: one Boundary } fact { Shop<:cities_shops = ~(CitiesShop<:shop) City<:cities_shops = ~(CitiesShop<:city) Merchandise<:order_details = ~(OrderDetail<:merchandise) City<:order_details = ~(OrderDetail<:city) Order<:order_details = ~(OrderDetail<:order) Shop<:requested_deliveries = ~(RequestedDelivery<:shop) OrderDetail<:requested_deliveries = ~(RequestedDelivery<:order_detail) Shop<:rule_for_ships = ~(RuleForShip<:shop) Merchandise<:rule_for_ships = ~(RuleForShip<:merchandise) Shop<:ship_limits = ~(ShipLimit<:shop) all e,e':CitiesShop | e != e' => (e.shop->e.city) != (e'.shop->e'.city) all e,e':OrderDetail | e != e' => (e.seq_code->e.order->e.merchandise) != (e'.seq_code->e'.order->e'.merchandise) all e,e':Order | e != e' => (e.order_code) != (e'.order_code) all e,e':RequestedDelivery | e != e' => (e.shop->e.order_detail) != (e'.shop->e'.order_detail) all e,e':RuleForShip | e != e' => (e.shop->e.merchandise) != (e'.shop->e'.merchandise) all e,e':ShipLimit | e != e' => (e.shop->e.expected_date) != (e'.shop->e'.expected_date) all e,e':Shop | e != e' => (e.code) != (e'.code) } -- ユーティリティ関数 pred b_gte(v,v': Int) { vCheck[v] implies eq[1,1] else gte[v,v'] } pred b_gt(v,v': Int) { vCheck[v] implies eq[1,1] else gt[v,v'] } pred b_lte(v,v': Int) { vCheck[v] implies eq[1,2] else lte[v,v'] } pred b_lt(v,v': Int) { vCheck[v] implies eq[1,2] else lt[v,v'] } pred vCheck(v: Int) {lt[v,0]}
assembly/intel_asm/Mem_Address.asm
FyodorK/operation_cwal
0
22069
.model flat, c .const ; read only sections FibVals dword 0, 1, 2, 3, 5, 8, 13 dword 21, 34, 55, 89, 144, 233, 377, 610 NumFibVals_ dword($ - FibVals) / sizeof dword ; analog of sizeof(FibVals)/sizeof(<Typeof>) public NumFibVals_ ; make symbol available to use in in test_mem_addr_01 function ; extern "C" int MemoryAddressing_(int i, int* v1, int* v2, int* v3, int* v4); ; ; Description: This function demonstrates various addressing ; modes that can be used to access operands in ; memory. ; ; Returns: 0 = error (invalid table index) ; 1 = success .code MemAddr proc push ebp mov ebp, esp push ebx push esi push edi ; Validate i xor eax, eax mov ecx, [ebp+8] cmp ecx, 0 jl InvalidIndex cmp ecx, [NumFibVals_] jge InvalidIndex ; Example #1 - base register mov ebx, offset FibVals ; ebx = FibVals mov esi, [ebx+8] ; esi = i shl esi, 2 ; esi = i * 4 ? add ebx,esi ; esi = FibVals + i * 4 mov eax, [ebx] ; load table value mov edi, [ebp+12] ; edi = v1 mov [edi], eax ; save to v1 ; Example #2 - base register + displacement mov esi, [ebp+8] ; esi = i - used as base register shl esi, 2 mov eax, [esi+FibVals] ; load able value mov edi, [ebp+16] mov [edi],eax ; save result to v2 ; Example #3 - base register + index register mov ebx,offset FibVals ;ebx = FibVals mov esi,[ebp+8] ;esi = i shl esi,2 ;esi = i * 4 mov eax,[ebx+esi] ;Load table value mov edi,[ebp+20] mov [edi],eax ;Save to 'v3' ; Example #4 - base register + index register * scale factor mov ebx,offset FibVals ;ebx = FibVals mov esi,[ebp+8] ;esi = i mov eax,[ebx+esi*4] ;Load table value mov edi,[ebp+24] mov [edi],eax ;Save to 'v4' mov eax,1 ;Set return code InvalidIndex: pop edi pop esi pop ebx pop ebp ret MemAddr endp end
data/github.com/asvarga/alloy-algebra/cf7561435ae7133532544aef1b33c90c1fe0ff9a/old/groups.als
ajnavarro/language-dataset
9
1017
<gh_stars>1-10 open util/ternary -------- sig Elem { rel: Elem -> one Elem }{ -- total rel.Elem = Elem } one sig Id extends Elem {} fact { -- identity //all x: Elem | rel[Id][x] = x and rel[x][Id] = x Id.rel in iden and Id.(flip12[rel]) in iden -- associativity all x,y,z: Elem | rel[rel[x][y]][z] = rel[x][rel[y][z]] -- inverse //all x: Elem | some inv: Elem | rel[x][inv] = Id and rel[inv][x] = Id (rel.Id).Elem = Elem and Elem.(rel.Id) = Elem } -------- fun closure(gen: set Elem): set Elem { Id.*(gen.rel) } pred generator(gen: set Elem) { closure[gen] = Elem } pred gen1 { -- aka cyclic some c: Elem | generator[c] } pred gen2 { some disj c1,c2: Elem | generator[c1+c2] } pred gen3 { some disj c1,c2,c3: Elem | generator[c1+c2+c3] } -------- run Some { some Elem } for exactly 6 Elem run Gen1 { gen1 } for exactly 6 Elem run Gen2 { gen2 and not gen1 } for exactly 6 Elem run Gen3 { gen3 and not gen2 } for exactly 8 Elem run D6 { some disj s,r: Elem-Id { rel[s][s] = Id rel[r][rel[r][r]] = Id } } for exactly 6 Elem
Transynther/x86/_processed/AVXALIGN/_st_zr_4k_/i7-7700_9_0xca_notsx.log_21829_946.asm
ljhsiun2/medusa
9
92613
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r15 push %rax push %rbp push %rdi push %rdx lea addresses_WT_ht+0x18e2e, %rdi nop nop nop add $63875, %r15 mov (%rdi), %eax nop nop nop nop nop add $59349, %r11 lea addresses_A_ht+0x1842e, %rbp nop nop and $59630, %r14 vmovups (%rbp), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %rdx nop cmp $54807, %r11 lea addresses_WT_ht+0x448e, %rax add $6037, %rdx mov $0x6162636465666768, %rbp movq %rbp, (%rax) nop nop nop cmp $60780, %r11 lea addresses_WC_ht+0x1e91e, %r14 xor $59801, %rbp movb $0x61, (%r14) nop nop nop nop cmp $25150, %rax lea addresses_D_ht+0x1b4ae, %r15 clflush (%r15) xor $6244, %r11 movb (%r15), %dl nop xor %rdx, %rdx lea addresses_normal_ht+0x1b42e, %r14 nop nop nop nop nop xor $25376, %rbp mov (%r14), %rdi nop nop nop xor $60680, %rdi lea addresses_D_ht+0x2c5e, %rdx nop nop nop nop nop sub %r14, %r14 mov $0x6162636465666768, %rdi movq %rdi, (%rdx) nop nop nop nop nop and $63918, %rdx lea addresses_D_ht+0xe42e, %rdx cmp $22360, %rax mov (%rdx), %r11w nop nop nop nop dec %rdi lea addresses_D_ht+0x1172e, %r14 and %r15, %r15 mov (%r14), %edx nop nop nop nop nop cmp $26141, %rax lea addresses_UC_ht+0xab2e, %rdi nop nop nop nop add $46225, %r11 movl $0x61626364, (%rdi) nop nop nop nop nop sub %rax, %rax pop %rdx pop %rdi pop %rbp pop %rax pop %r15 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r14 push %r8 push %rax push %rbp push %rdx // Store mov $0xc2e, %r14 nop nop nop nop sub $7275, %rbp mov $0x5152535455565758, %rdx movq %rdx, (%r14) nop add $52177, %r11 // Store lea addresses_WC+0x7a9e, %rdx nop nop dec %r8 movl $0x51525354, (%rdx) and $65019, %r14 // Store lea addresses_A+0x111ae, %r14 nop nop nop nop nop inc %r8 mov $0x5152535455565758, %rdx movq %rdx, %xmm3 movups %xmm3, (%r14) nop nop nop add $40024, %rax // Store mov $0x55684d000000062e, %r13 nop nop nop nop nop and %rdx, %rdx movb $0x51, (%r13) nop nop sub %rax, %rax // Store lea addresses_PSE+0x582e, %r13 add %r14, %r14 mov $0x5152535455565758, %r11 movq %r11, %xmm0 movups %xmm0, (%r13) nop nop add $60608, %rbp // Store mov $0xe2e, %r8 nop nop nop nop nop xor $45015, %rdx mov $0x5152535455565758, %rax movq %rax, %xmm2 vmovups %ymm2, (%r8) nop nop nop nop cmp $8843, %r11 // Store mov $0x4dc, %r8 nop nop add $34251, %r13 movb $0x51, (%r8) nop nop nop nop add $21794, %r11 // Store lea addresses_PSE+0x28fe, %rbp nop nop nop inc %r11 mov $0x5152535455565758, %rax movq %rax, (%rbp) nop nop nop nop nop sub %r11, %r11 // Store lea addresses_US+0x134d2, %r14 nop nop nop nop nop sub %r13, %r13 movw $0x5152, (%r14) sub %rbp, %rbp // Faulty Load mov $0x82e, %rdx nop nop nop nop nop sub %r8, %r8 movaps (%rdx), %xmm1 vpextrq $0, %xmm1, %r14 lea oracles, %rbp and $0xff, %r14 shlq $12, %r14 mov (%rbp,%r14,1), %r14 pop %rdx pop %rbp pop %rax pop %r8 pop %r14 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_P'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9, 'same': False, 'type': 'addresses_NC'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_US'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_P'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'dst': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 4, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'dst': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'00': 329, '58': 21500} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
programs/oeis/014/A014916.asm
neoneye/loda
22
95529
; A014916: a(1)=1, a(n) = n*4^(n-1) + a(n-1). ; 1,9,57,313,1593,7737,36409,167481,757305,3378745,14913081,65244729,283348537,1222872633,5249404473,22429273657,95443717689,404681363001,1710351420985,7207909559865,30297653743161,127054676987449,531674956009017,2220524816272953,9257399234039353,38530796811947577,160127986750950969,664531145016446521,2754201372116356665,11401112656667708985,47141679299479965241,194715631889156378169,803458186321571581497,3312215380346070601273,13642392061623419506233,56143690407450226429497,230871250273627099336249,948670955669813171818041,3895427640980471785164345,15984685837126763532226105,65550644441326559695179321,268650182136584261045816889,1100391146031449133243665977,4504726254066244889216257593,18431551696026772981831405113,75376793503154265627191119417,308109520888805757308226473529,1258847471059977808430753877561,5141027434258930350514407444025,20986659937111797869223197511225,85636840548751497345555060985401,349308165396223212856869327703609,1424275874389761745326073645862457,5805276348778522556898679923641913,23653796799991992529972261055335993,96345952819479579329399209664417337,392306873755964754155637500429962809 mov $1,$0 mul $0,3 add $0,2 mov $2,4 pow $2,$1 mul $0,$2 div $0,18 mul $0,8 add $0,1
Exp2_Sequence_structure_and_branch_structure_programming/Exp2_1_COMP_BCD_Plus.asm
LiamSho/assembly_language_course
0
18298
<filename>Exp2_Sequence_structure_and_branch_structure_programming/Exp2_1_COMP_BCD_Plus.asm ; 实验2-1 压缩BCD码加法 ; ; 压缩型BCD码加法运算,一共4组数据, ; 结果存储在 RESULT 中,无输出,需使用 ; 调试工具查看 DS:0000 - DS:000B DATAS SEGMENT BCD1 DB 34H, 55H, 12H, 92H BCD2 DB 56H, 23H, 15H, 11H RESULT DB 4 DUP(?) DATAS ENDS CODES SEGMENT ASSUME CS:CODES, DS:DATAS START: MOV AX, DATAS MOV DS, AX XOR AX, AX MOV CX, 04H ;计算循环计数 MOV BX, 00H ;计算顺序计数 CALT: MOV AL, BCD1[BX] ADC AL, BCD2[BX] DAA ;压缩型BCD码调整 MOV RESULT[BX], AL INC BX LOOP CALT FIN: MOV AH, 4CH INT 21H CODES ENDS END START
PRG/objects/4-5Bonus.asm
narfman0/smb3_pp1
0
241314
<reponame>narfman0/smb3_pp1<gh_stars>0 .byte $01 ; Unknown purpose .byte OBJ_BIGQBLOCK_TANOOKI, $0A, $13 .byte OBJ_ENDLEVELCARD, $48, $15 .byte $FF ; Terminator
titlescreen/titlescreen_layout.asm
hrw/my-first-8k
2
172903
<filename>titlescreen/titlescreen_layout.asm ; To use a minikernel, just list it below. They'll be drawn on the screen in ; in the order they were listed. ; ; If a minikernel isn't listed, it won't be compiled into your program, and ; it won't use any rom space. MAC titlescreenlayout draw_96x2_1 ENDM ; minikernel choices are: ; ; draw_48x1_1, draw_48x1_2, draw_48x1_3 ; The first, second, and third 48-wide single-line bitmap minikernels ; ; draw_48x2_1, draw_48x2_2, draw_48x2_3 ; The first, second, and third 48-wide double-line bitmap minikernels ; ; draw_96x2_1, draw_96x2_2, draw_96x2_3 ; The first, second, and third 96-wide double-line bitmap minikernels ; ; draw_gameselect ; The game selection display minikernel ; ; draw_score ; A minikernel that draws the score ; ; draw_space 10 ; A minikernel used to add blank space between other minikernels
Transynther/x86/_processed/NONE/_st_zr_/i7-8650U_0xd2_notsx.log_1802_1193.asm
ljhsiun2/medusa
9
10296
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x1404, %rdx nop nop nop nop nop sub %r10, %r10 mov (%rdx), %r11 nop nop nop nop nop and %rax, %rax lea addresses_UC_ht+0x129a4, %rsi and $63302, %r11 mov (%rsi), %r13w cmp %rax, %rax lea addresses_normal_ht+0x94d4, %rsi lea addresses_A_ht+0x3304, %rdi nop nop nop nop nop xor %r10, %r10 mov $120, %rcx rep movsb xor %rsi, %rsi lea addresses_WC_ht+0x1c604, %rdx clflush (%rdx) inc %rdi movb (%rdx), %al cmp %r11, %r11 lea addresses_WT_ht+0x1b604, %rcx clflush (%rcx) nop and $44691, %r11 mov (%rcx), %r13w nop nop nop nop add %rax, %rax lea addresses_D_ht+0x17c84, %rsi lea addresses_WC_ht+0x278c, %rdi clflush (%rdi) xor $62020, %r13 mov $99, %rcx rep movsq nop nop nop nop nop cmp $50210, %rsi lea addresses_UC_ht+0x504, %r11 nop nop nop sub %rcx, %rcx movb (%r11), %al nop add %rdx, %rdx lea addresses_D_ht+0x1625d, %rdx sub %rdi, %rdi mov (%rdx), %r10d nop nop and %r10, %r10 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r8 push %rbp push %rcx push %rdi // Store lea addresses_WC+0x6764, %rbp nop add $36667, %rdi mov $0x5152535455565758, %rcx movq %rcx, (%rbp) nop nop xor %r12, %r12 // Store lea addresses_PSE+0x5de4, %rdi nop nop xor %rbp, %rbp movw $0x5152, (%rdi) nop nop nop xor %r12, %r12 // Store lea addresses_normal+0x1d388, %rdi nop inc %r8 movl $0x51525354, (%rdi) nop nop and %rdi, %rdi // Store lea addresses_UC+0x1f404, %rdi nop nop nop xor $25735, %r11 mov $0x5152535455565758, %r12 movq %r12, %xmm1 vmovups %ymm1, (%rdi) dec %r8 // Store mov $0xe86, %rbp clflush (%rbp) xor %r8, %r8 movb $0x51, (%rbp) nop nop inc %rbp // Store lea addresses_D+0x111fc, %rdi nop nop nop nop and $51364, %r10 mov $0x5152535455565758, %r12 movq %r12, %xmm3 vmovntdq %ymm3, (%rdi) nop nop nop add $14044, %rcx // Faulty Load lea addresses_A+0x16404, %r10 nop cmp $34539, %r12 mov (%r10), %ecx lea oracles, %r11 and $0xff, %rcx shlq $12, %rcx mov (%r11,%rcx,1), %rcx pop %rdi pop %rcx pop %rbp pop %r8 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 3, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 8, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'58': 1164, '00': 638} 58 58 58 58 58 58 58 58 00 58 58 58 00 58 00 00 00 00 00 00 00 58 00 58 58 00 00 00 00 58 58 58 00 58 00 58 58 58 58 58 00 58 00 00 58 58 58 58 00 00 58 58 58 00 58 58 58 58 00 00 00 00 58 00 58 58 58 58 00 00 00 58 58 58 58 00 58 58 58 58 58 58 58 00 00 00 58 58 58 58 58 58 58 58 58 00 00 58 58 58 58 58 58 00 58 58 00 58 58 58 58 00 00 58 58 58 58 58 00 00 58 00 58 00 00 00 00 00 58 58 58 58 58 58 00 58 00 58 00 00 00 58 58 00 00 00 00 58 58 58 00 00 58 58 58 58 58 58 00 00 00 58 58 58 58 58 00 00 58 58 58 58 00 00 00 58 58 58 58 58 58 58 58 00 58 00 58 58 58 58 00 00 00 00 00 58 58 58 58 00 58 00 58 58 00 00 00 00 58 00 58 00 58 58 58 58 00 58 58 58 58 58 58 58 00 58 00 58 58 58 00 58 00 58 58 58 00 58 58 00 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 00 00 58 58 58 00 00 00 00 58 58 58 58 58 58 58 58 58 58 58 58 00 00 58 00 00 58 58 58 58 58 58 58 58 58 00 00 00 00 58 58 58 58 58 58 58 00 58 58 58 00 00 00 58 58 58 58 00 58 58 58 00 00 58 58 00 00 00 00 58 58 58 58 58 58 58 58 00 00 00 58 00 58 58 58 58 58 58 58 00 00 00 58 58 58 58 58 58 58 00 58 58 00 00 58 00 58 00 58 00 00 58 00 58 58 58 58 58 58 58 58 58 58 00 58 00 58 58 58 00 00 00 58 00 58 00 58 58 58 58 00 58 58 58 58 00 00 58 58 00 58 58 58 58 58 58 00 58 58 58 00 00 00 00 58 00 00 58 58 58 58 58 58 00 00 58 58 00 58 00 58 00 58 58 58 58 58 58 58 58 58 58 00 58 00 58 00 58 58 58 58 58 58 58 00 00 00 00 00 00 00 58 00 58 58 58 00 58 00 00 58 00 00 58 58 58 58 00 58 58 58 58 58 00 58 58 58 58 00 00 00 00 00 00 58 00 58 58 58 58 00 00 58 00 00 00 00 00 00 58 00 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 00 58 00 00 58 00 58 58 00 00 00 00 00 58 58 58 58 58 58 58 58 00 00 00 58 58 00 00 00 58 00 00 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 00 58 58 00 00 58 00 58 58 58 58 58 58 58 00 00 00 00 58 58 58 58 58 58 58 00 58 58 58 00 00 58 58 00 00 00 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 00 58 58 58 00 00 00 00 58 00 00 58 00 58 58 00 00 00 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 00 00 00 58 00 58 58 00 00 58 58 00 00 58 00 58 58 58 00 58 00 00 58 58 00 00 58 00 58 58 58 58 58 00 00 00 58 00 58 58 00 58 00 58 58 58 58 58 00 00 00 00 00 58 58 58 58 58 58 58 58 58 00 00 58 58 58 00 58 00 00 00 00 58 58 58 58 58 58 58 58 58 58 58 00 58 00 58 58 00 00 00 00 58 58 58 58 58 58 58 00 00 58 00 58 58 58 58 58 58 58 58 00 00 58 58 00 00 00 00 00 58 58 58 00 00 58 58 00 00 58 58 58 58 58 00 58 00 00 00 00 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 00 58 00 00 58 58 58 58 00 58 58 00 58 58 58 58 00 58 58 00 58 00 58 00 58 58 58 58 58 00 00 00 58 58 58 58 00 00 58 00 58 00 00 00 58 58 00 00 58 00 00 58 58 00 00 00 00 00 58 58 58 58 58 58 58 58 58 58 00 00 58 58 58 00 00 58 00 00 58 00 00 58 58 58 58 00 58 58 00 58 00 58 00 00 00 58 00 58 00 58 58 58 58 58 58 58 58 00 00 58 58 58 58 58 00 00 00 00 00 00 58 00 00 00 58 58 58 58 58 58 58 58 00 00 00 58 58 00 00 00 00 58 58 58 58 58 58 58 58 58 */
programs/oeis/074/A074280.asm
jmorken/loda
1
8420
; A074280: Duplicate of A000523. ; 0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5 add $0,1 lpb $0,$0 div $0,2 add $2,1 lpe mov $1,$2
src/apps/ls/ls.asm
tishion/PiscisOS
86
15486
DIRITEM_SIZE equ 20h FILEITEM_NAME equ 00h FILEITEM_EXTEND equ 08h FILEITEM_ATTR equ 0bh FATTR_RDONLY equ 00000001b FATTR_HIDDEN equ 00000010b FATTR_SYSTEM equ 00000100b FATTR_VOLLAB equ 00001000b FILEITEM_RESERVED equ 10h FILEITEM_WRITETIME equ 16h FILEITEM_WRITEDATE equ 18h FILEITEM_FIRSTCLUSTER equ 1ah FILEITEM_FILESIZE equ 1ch FULLFILENAME_LEN equ 0bh FATTR_SUBDIR equ 00010000b FATTR_DEVICE equ 00100000b FATTR_ARCHIV equ 01000000b FATTR_NOTUSE equ 10000000b use32 org 00h APP_HEADER: db 'PISCISAPP000' ;;00h Signature dd 0 ;;0ch Reserverd dd APP_START ;;10h Entry Point dd APP_ARGS ;;14h Arguments Buffer dd 0 ;;18h Reserved APP_ARGS: times (256) db 0 newline: db 0dh, 0ah, 0 notfoundstr db 'Directory not found:', 0 notsubdirstr db 'Path is not directory:', 0 openerrstr db 'Open directory error:', 0 APP_START: ; mov edi, APP_ARGS ; mov eax, 04h ; int 50h ; mov edi, newline ; mov eax, 04h ; int 50h mov esi, APP_ARGS call formatpath mov ebx, 00h mov edi, APP_ARGS mov ecx, .fitembuf mov eax, 20h int 50h cmp eax, 0ffffffffh je .not_found mov edi, .fitembuf mov bl, [edi+FILEITEM_ATTR] and bl, FATTR_SUBDIR jz .not_subdir mov ebx, 01h mov edi, APP_ARGS mov ecx, filebuf mov eax, 20h int 50h cmp eax, 0ffffffffh je .open_error mov esi, filebuf .next_fitem: cmp [esi], byte 00h je .end cmp [esi], byte 05h je .skip_item cmp [esi], byte 0e5h je .skip_item mov [.filename+0], dword 20202020h mov [.filename+4], dword 20202020h mov [.filename+8], dword 00002020h mov eax, [esi+0] mov [.filename+0], eax mov eax, [esi+4] mov [.filename+4], eax mov bl, [esi+FILEITEM_ATTR] and bl, FATTR_SUBDIR jz .show_itemname push esi mov esi, .filename mov bl, 20h call strchr mov [esi+eax], byte '\' pop esi .show_itemname: mov edi, .filename mov eax, 04h int 50h .skip_item: add esi, DIRITEM_SIZE jmp .next_fitem .not_found: mov edi, notfoundstr mov eax, 04h int 50h jmp .showpath .not_subdir: mov edi, notsubdirstr mov eax, 04h int 50h jmp .showpath .open_error: mov edi, openerrstr mov eax, 04h int 50h jmp .showpath .showpath: mov edi, APP_ARGS mov eax, 04h int 50h .end: mov eax, 11h int 50h .filename: times 12 db 20h .fitembuf: times 32 db 0 formatpath: ;;in esi:path buffer ;; ;;out ecx:strlen after deleted '\'s call strlen .loop_1: cmp ecx, 2 jb .final_ret cmp [esi+ecx-1], byte '\' jne .final_ret dec ecx mov [esi+ecx], byte 0 jmp .loop_1 .final_ret: ret include "..\include\string.inc" ;;dir data buffer 10k filebuf: times (1024*10+32) db 0
programs/oeis/134/A134154.asm
neoneye/loda
22
10157
; A134154: a(n) = 15n^2 - 9n + 1. ; 1,7,43,109,205,331,487,673,889,1135,1411,1717,2053,2419,2815,3241,3697,4183,4699,5245,5821,6427,7063,7729,8425,9151,9907,10693,11509,12355,13231,14137,15073,16039,17035,18061,19117,20203,21319,22465,23641 mov $1,$0 bin $1,2 mul $1,5 add $0,$1 mul $0,6 add $0,1
Structure/Relator/Apartness.agda
Lolirofle/stuff-in-agda
6
11446
module Structure.Relator.Apartness where import Lvl open import Logic open import Logic.Propositional open import Structure.Relator.Properties hiding (irreflexivity ; symmetry ; cotransitivity) open import Type private variable ℓ₁ ℓ₂ : Lvl.Level -- An apartness relation is a irreflexive, symmetric and cotransitive relation. record Apartness {T : Type{ℓ₁}} (_#_ : T → T → Stmt{ℓ₂}) : Stmt{ℓ₁ Lvl.⊔ ℓ₂} where instance constructor intro field instance ⦃ irreflexivity ⦄ : Irreflexivity (_#_) instance ⦃ symmetry ⦄ : Symmetry (_#_) instance ⦃ cotransitivity ⦄ : CoTransitivity (_#_)
ver0/3_osInPro/1_loader/loader.asm
RongbinZhuang/simpleOS
0
80452
<reponame>RongbinZhuang/simpleOS<filename>ver0/3_osInPro/1_loader/loader.asm org 0100h mov ax ,0B800h mov gs ,ax mov ah ,0f3h mov al ,'B' mov [gs:((80*6+40)*2)] ,ax jmp $
oeis/344/A344423.asm
neoneye/loda-programs
11
101923
<gh_stars>10-100 ; A344423: a(n) = 10^(2*n+2) + 111*10^n + 1. ; Submitted by <NAME> ; 212,11111,1011101,100111001,10001110001,1000011100001,100000111000001,10000001110000001,1000000011100000001,100000000111000000001,10000000001110000000001,1000000000011100000000001,100000000000111000000000001,10000000000001110000000000001 add $0,2 mov $1,10 pow $1,$0 add $1,56 bin $1,2 div $1,45 mov $0,$1 sub $0,268 div $0,10 mul $0,9 add $0,212
Jiffy.g4
Quentin-M/jiffy
8
4561
grammar Jiffy; root : timeexpr EOF ; timeexpr : timeatom timeatom* ; timeatom : microsecond | millisecond | second | minute | hour | day | month | year ; microsecond : decimalLiteral ( US | MICROSECOND | MICROSECONDS ) | realLiteral ( US | MICROSECOND | MICROSECONDS ) ; millisecond : decimalLiteral ( MS | MILLISECOND | MILLISECONDS ) | realLiteral ( MS | MILLISECOND | MILLISECONDS ) ; second : decimalLiteral ( S | SEC | SECOND | SECONDS ) | realLiteral ( S | SEC | SECOND | SECONDS ) ; minute : decimalLiteral ( M | MIN | MINUTE | MINUTES ) | realLiteral ( M | MIN | MINUTE | MINUTES ) ; hour : decimalLiteral ( H | HRS | HOUR | HOURS ) | realLiteral ( H | HRS | HOUR | HOURS ) ; day : decimalLiteral ( D | DAY | DAYS ) | realLiteral ( D | DAY | DAYS ) ; month : decimalLiteral ( MON | MONTH | MONTHS ) | realLiteral ( MON | MONTH | MONTHS ) ; year : decimalLiteral ( Y | YEAR | YEARS ) | realLiteral ( Y | YEAR | YEARS ) ; decimalLiteral : MINUS? DECIMAL_LITERAL ; realLiteral : MINUS? REAL_LITERAL ; // LEXER HERE fragment DEC_DIGIT : [0-9]; fragment A : [aA] ; fragment B : [bB] ; fragment C : [cC] ; D : [dD] ; fragment E : [eE] ; fragment F : [fF] ; fragment G : [gG] ; H : [hH] ; fragment I : [iI] ; fragment J : [jJ] ; fragment K : [kK] ; fragment L : [lL] ; M : [mM] ; fragment N : [nN] ; fragment O : [oO] ; fragment P : [pP] ; fragment Q : [qQ] ; fragment R : [rR] ; S : [sS] ; fragment T : [tT] ; fragment U : [uU] ; fragment V : [vV] ; fragment W : [wW] ; fragment X : [xX] ; Y : [yY] ; fragment Z : [zZ] ; fragment EXPONENT_NUM_PART : 'E' '-'? DEC_DIGIT+; MINUS : '-' ; US : U S ; MICROSECOND : M I C R O S E C O N D ; MICROSECONDS : M I C R O S E C O N D S ; MS : M S ; MILLISECOND : M I L L I S E C O N D ; MILLISECONDS : M I L L I S E C O N D S ; SEC : S E C ; SECOND : S E C O N D ; SECONDS : S E C O N D S ; MIN : M I N ; MINUTE : M I N U T E ; MINUTES : M I N U T E S ; HRS : H R S ; HOUR : H O U R ; HOURS : H O U R S ; DAY : D A Y ; DAYS : D A Y S ; MON : M O N ; MONTH : M O N T H ; MONTHS : M O N T H S ; YEAR : Y E A R ; YEARS : Y E A R S ; AND : A N D {l.Skip()} ; DECIMAL_LITERAL : DEC_DIGIT+; REAL_LITERAL : (DEC_DIGIT+)? '.' DEC_DIGIT+ | DEC_DIGIT+ '.' EXPONENT_NUM_PART | (DEC_DIGIT+)? '.' (DEC_DIGIT+ EXPONENT_NUM_PART) | DEC_DIGIT+ EXPONENT_NUM_PART ; SPACE : [ \t,]+ {l.Skip()} ;
Validation/pyFrame3DD-master/gcc-master/gcc/ada/exp_prag.adb
djamal2727/Main-Bearing-Analytical-Model
0
26391
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ P R A G -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-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 Casing; use Casing; with Checks; use Checks; with Debug; use Debug; with Einfo; use Einfo; with Elists; use Elists; with Errout; use Errout; with Exp_Ch11; use Exp_Ch11; with Exp_Util; use Exp_Util; with Expander; use Expander; with Inline; use Inline; with Lib; use Lib; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Restrict; use Restrict; with Rident; use Rident; with Rtsfind; use Rtsfind; with Sem; use Sem; with Sem_Aux; use Sem_Aux; with Sem_Ch8; use Sem_Ch8; with Sem_Prag; use Sem_Prag; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; with Sinput; use Sinput; with Snames; use Snames; with Stringt; use Stringt; with Stand; use Stand; with Tbuild; use Tbuild; with Uintp; use Uintp; with Validsw; use Validsw; package body Exp_Prag is ----------------------- -- Local Subprograms -- ----------------------- function Arg_N (N : Node_Id; Arg_Number : Positive) return Node_Id; -- Obtain specified pragma argument expression procedure Expand_Pragma_Abort_Defer (N : Node_Id); procedure Expand_Pragma_Check (N : Node_Id); procedure Expand_Pragma_Common_Object (N : Node_Id); procedure Expand_Pragma_CUDA_Execute (N : Node_Id); procedure Expand_Pragma_Import_Or_Interface (N : Node_Id); procedure Expand_Pragma_Inspection_Point (N : Node_Id); procedure Expand_Pragma_Interrupt_Priority (N : Node_Id); procedure Expand_Pragma_Loop_Variant (N : Node_Id); procedure Expand_Pragma_Psect_Object (N : Node_Id); procedure Expand_Pragma_Relative_Deadline (N : Node_Id); procedure Expand_Pragma_Suppress_Initialization (N : Node_Id); procedure Undo_Initialization (Def_Id : Entity_Id; N : Node_Id); -- This procedure is used to undo initialization already done for Def_Id, -- which is always an E_Variable, in response to the occurrence of the -- pragma N, a pragma Interface, Import, or Suppress_Initialization. In all -- these cases we want no initialization to occur, but we have already done -- the initialization by the time we see the pragma, so we have to undo it. ----------- -- Arg_N -- ----------- function Arg_N (N : Node_Id; Arg_Number : Positive) return Node_Id is Arg : Node_Id := First (Pragma_Argument_Associations (N)); begin if No (Arg) then return Empty; end if; for J in 2 .. Arg_Number loop Next (Arg); if No (Arg) then return Empty; end if; end loop; if Present (Arg) and then Nkind (Arg) = N_Pragma_Argument_Association then return Expression (Arg); else return Arg; end if; end Arg_N; --------------------- -- Expand_N_Pragma -- --------------------- procedure Expand_N_Pragma (N : Node_Id) is Pname : constant Name_Id := Pragma_Name (N); Prag_Id : constant Pragma_Id := Get_Pragma_Id (Pname); begin -- Suppress the expansion of an ignored assertion pragma. Such a pragma -- should not be transformed into a null statment because: -- -- * The pragma may be part of the rep item chain of a type, in which -- case rewriting it will destroy the chain. -- -- * The analysis of the pragma may involve two parts (see routines -- Analyze_xxx_In_Decl_Part). The second part of the analysis will -- not happen if the pragma is rewritten. if Assertion_Expression_Pragma (Prag_Id) and then Is_Ignored (N) then return; -- Rewrite the pragma into a null statement when it is ignored using -- pragma Ignore_Pragma, or denotes Default_Scalar_Storage_Order and -- compilation switch -gnatI is in effect. elsif Should_Ignore_Pragma_Sem (N) or else (Prag_Id = Pragma_Default_Scalar_Storage_Order and then Ignore_Rep_Clauses) then Rewrite (N, Make_Null_Statement (Sloc (N))); return; end if; case Prag_Id is -- Pragmas requiring special expander action when Pragma_Abort_Defer => Expand_Pragma_Abort_Defer (N); when Pragma_Check => Expand_Pragma_Check (N); when Pragma_Common_Object => Expand_Pragma_Common_Object (N); when Pragma_CUDA_Execute => Expand_Pragma_CUDA_Execute (N); when Pragma_Import => Expand_Pragma_Import_Or_Interface (N); when Pragma_Inspection_Point => Expand_Pragma_Inspection_Point (N); when Pragma_Interface => Expand_Pragma_Import_Or_Interface (N); when Pragma_Interrupt_Priority => Expand_Pragma_Interrupt_Priority (N); when Pragma_Loop_Variant => Expand_Pragma_Loop_Variant (N); when Pragma_Psect_Object => Expand_Pragma_Psect_Object (N); when Pragma_Relative_Deadline => Expand_Pragma_Relative_Deadline (N); when Pragma_Suppress_Initialization => Expand_Pragma_Suppress_Initialization (N); -- All other pragmas need no expander action (includes -- Unknown_Pragma). when others => null; end case; end Expand_N_Pragma; ------------------------------- -- Expand_Pragma_Abort_Defer -- ------------------------------- -- An Abort_Defer pragma appears as the first statement in a handled -- statement sequence (right after the begin). It defers aborts for -- the entire statement sequence, but not for any declarations or -- handlers (if any) associated with this statement sequence. -- The transformation is to transform -- pragma Abort_Defer; -- statements; -- into -- begin -- Abort_Defer.all; -- statements -- exception -- when all others => -- Abort_Undefer.all; -- raise; -- at end -- Abort_Undefer_Direct; -- end; procedure Expand_Pragma_Abort_Defer (N : Node_Id) is begin -- Abort_Defer has no useful effect if Abort's are not allowed if not Abort_Allowed then return; end if; -- Normal case where abort is possible declare Loc : constant Source_Ptr := Sloc (N); Stm : Node_Id; Stms : List_Id; HSS : Node_Id; Blk : constant Entity_Id := New_Internal_Entity (E_Block, Current_Scope, Sloc (N), 'B'); AUD : constant Entity_Id := RTE (RE_Abort_Undefer_Direct); begin Stms := New_List (Build_Runtime_Call (Loc, RE_Abort_Defer)); loop Stm := Remove_Next (N); exit when No (Stm); Append (Stm, Stms); end loop; HSS := Make_Handled_Sequence_Of_Statements (Loc, Statements => Stms, At_End_Proc => New_Occurrence_Of (AUD, Loc)); -- Present the Abort_Undefer_Direct function to the backend so that -- it can inline the call to the function. Add_Inlined_Body (AUD, N); Rewrite (N, Make_Block_Statement (Loc, Handled_Statement_Sequence => HSS)); Set_Scope (Blk, Current_Scope); Set_Etype (Blk, Standard_Void_Type); Set_Identifier (N, New_Occurrence_Of (Blk, Sloc (N))); Expand_At_End_Handler (HSS, Blk); Analyze (N); end; end Expand_Pragma_Abort_Defer; -------------------------- -- Expand_Pragma_Check -- -------------------------- procedure Expand_Pragma_Check (N : Node_Id) is Cond : constant Node_Id := Arg_N (N, 2); Nam : constant Name_Id := Chars (Arg_N (N, 1)); Msg : Node_Id; Loc : constant Source_Ptr := Sloc (First_Node (Cond)); -- Source location used in the case of a failed assertion: point to the -- failing condition, not Loc. Note that the source location of the -- expression is not usually the best choice here, because it points to -- the location of the topmost tree node, which may be an operator in -- the middle of the source text of the expression. For example, it gets -- located on the last AND keyword in a chain of boolean expressiond -- AND'ed together. It is best to put the message on the first character -- of the condition, which is the effect of the First_Node call here. -- This source location is used to build the default exception message, -- and also as the sloc of the call to the runtime subprogram raising -- Assert_Failure, so that coverage analysis tools can relate the -- call to the failed check. procedure Replace_Discriminals_Of_Protected_Op (Expr : Node_Id); -- Discriminants of the enclosing protected object may be referenced -- in the expression of a precondition of a protected operation. -- In the body of the operation these references must be replaced by -- the discriminal created for them, which are renamings of the -- discriminants of the object that is the target of the operation. -- This replacement is done by visibility when the references appear -- in the subprogram body, but in the case of a condition which appears -- on the specification of the subprogram it has be done separately -- because the condition has been replaced by a Check pragma and -- analyzed earlier, before the creation of the discriminal renaming -- declarations that are added to the subprogram body. ------------------------------------------ -- Replace_Discriminals_Of_Protected_Op -- ------------------------------------------ procedure Replace_Discriminals_Of_Protected_Op (Expr : Node_Id) is function Find_Corresponding_Discriminal (E : Entity_Id) return Entity_Id; -- Find the local entity that renames a discriminant of the enclosing -- protected type, and has a matching name. function Replace_Discr_Ref (N : Node_Id) return Traverse_Result; -- Replace a reference to a discriminant of the original protected -- type by the local renaming declaration of the discriminant of -- the target object. ------------------------------------ -- Find_Corresponding_Discriminal -- ------------------------------------ function Find_Corresponding_Discriminal (E : Entity_Id) return Entity_Id is R : Entity_Id; begin R := First_Entity (Current_Scope); while Present (R) loop if Nkind (Parent (R)) = N_Object_Renaming_Declaration and then Present (Discriminal_Link (R)) and then Chars (Discriminal_Link (R)) = Chars (E) then return R; end if; Next_Entity (R); end loop; return Empty; end Find_Corresponding_Discriminal; ----------------------- -- Replace_Discr_Ref -- ----------------------- function Replace_Discr_Ref (N : Node_Id) return Traverse_Result is R : Entity_Id; begin if Is_Entity_Name (N) and then Present (Discriminal_Link (Entity (N))) then R := Find_Corresponding_Discriminal (Entity (N)); Rewrite (N, New_Occurrence_Of (R, Sloc (N))); end if; return OK; end Replace_Discr_Ref; procedure Replace_Discriminant_References is new Traverse_Proc (Replace_Discr_Ref); -- Start of processing for Replace_Discriminals_Of_Protected_Op begin Replace_Discriminant_References (Expr); end Replace_Discriminals_Of_Protected_Op; -- Start of processing for Expand_Pragma_Check begin -- Nothing to do if pragma is ignored if Is_Ignored (N) then return; end if; -- Since this check is active, rewrite the pragma into a corresponding -- if statement, and then analyze the statement. -- The normal case expansion transforms: -- pragma Check (name, condition [,message]); -- into -- if not condition then -- System.Assertions.Raise_Assert_Failure (Str); -- end if; -- where Str is the message if one is present, or the default of -- name failed at file:line if no message is given (the "name failed -- at" is omitted for name = Assertion, since it is redundant, given -- that the name of the exception is Assert_Failure.) -- Also, instead of "XXX failed at", we generate slightly -- different messages for some of the contract assertions (see -- code below for details). -- An alternative expansion is used when the No_Exception_Propagation -- restriction is active and there is a local Assert_Failure handler. -- This is not a common combination of circumstances, but it occurs in -- the context of Aunit and the zero footprint profile. In this case we -- generate: -- if not condition then -- raise Assert_Failure; -- end if; -- This will then be transformed into a goto, and the local handler will -- be able to handle the assert error (which would not be the case if a -- call is made to the Raise_Assert_Failure procedure). -- We also generate the direct raise if the Suppress_Exception_Locations -- is active, since we don't want to generate messages in this case. -- Note that the reason we do not always generate a direct raise is that -- the form in which the procedure is called allows for more efficient -- breakpointing of assertion errors. -- Generate the appropriate if statement. Note that we consider this to -- be an explicit conditional in the source, not an implicit if, so we -- do not call Make_Implicit_If_Statement. -- Case where we generate a direct raise if ((Debug_Flag_Dot_G or else Restriction_Active (No_Exception_Propagation)) and then Present (Find_Local_Handler (RTE (RE_Assert_Failure), N))) or else (Opt.Exception_Locations_Suppressed and then No (Arg_N (N, 3))) then Rewrite (N, Make_If_Statement (Loc, Condition => Make_Op_Not (Loc, Right_Opnd => Cond), Then_Statements => New_List ( Make_Raise_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Assert_Failure), Loc))))); -- Case where we call the procedure else -- If we have a message given, use it if Present (Arg_N (N, 3)) then Msg := Get_Pragma_Arg (Arg_N (N, 3)); -- Here we have no string, so prepare one else declare Loc_Str : constant String := Build_Location_String (Loc); begin Name_Len := 0; -- For Assert, we just use the location if Nam = Name_Assert then null; -- For predicate, we generate the string "predicate failed at -- yyy". We prefer all lower case for predicate. elsif Nam = Name_Predicate then Add_Str_To_Name_Buffer ("predicate failed at "); -- For special case of Precondition/Postcondition the string is -- "failed xx from yy" where xx is precondition/postcondition -- in all lower case. The reason for this different wording is -- that the failure is not at the point of occurrence of the -- pragma, unlike the other Check cases. elsif Nam in Name_Precondition | Name_Postcondition then Get_Name_String (Nam); Insert_Str_In_Name_Buffer ("failed ", 1); Add_Str_To_Name_Buffer (" from "); -- For special case of Invariant, the string is "failed -- invariant from yy", to be consistent with the string that is -- generated for the aspect case (the code later on checks for -- this specific string to modify it in some cases, so this is -- functionally important). elsif Nam = Name_Invariant then Add_Str_To_Name_Buffer ("failed invariant from "); -- For all other checks, the string is "xxx failed at yyy" -- where xxx is the check name with appropriate casing. else Get_Name_String (Nam); Set_Casing (Identifier_Casing (Source_Index (Current_Sem_Unit))); Add_Str_To_Name_Buffer (" failed at "); end if; -- In all cases, add location string Add_Str_To_Name_Buffer (Loc_Str); -- Build the message Msg := Make_String_Literal (Loc, Name_Buffer (1 .. Name_Len)); end; end if; -- For a precondition, replace references to discriminants of a -- protected type with the local discriminals. if Is_Protected_Type (Scope (Current_Scope)) and then Has_Discriminants (Scope (Current_Scope)) and then From_Aspect_Specification (N) then Replace_Discriminals_Of_Protected_Op (Cond); end if; -- Now rewrite as an if statement Rewrite (N, Make_If_Statement (Loc, Condition => Make_Op_Not (Loc, Right_Opnd => Cond), Then_Statements => New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Raise_Assert_Failure), Loc), Parameter_Associations => New_List (Relocate_Node (Msg)))))); end if; Analyze (N); -- If new condition is always false, give a warning if Warn_On_Assertion_Failure and then Nkind (N) = N_Procedure_Call_Statement and then Is_RTE (Entity (Name (N)), RE_Raise_Assert_Failure) then -- If original condition was a Standard.False, we assume that this is -- indeed intended to raise assert error and no warning is required. if Is_Entity_Name (Original_Node (Cond)) and then Entity (Original_Node (Cond)) = Standard_False then null; elsif Nam = Name_Assert then Error_Msg_N ("?A?assertion will fail at run time", N); else Error_Msg_N ("?A?check will fail at run time", N); end if; end if; end Expand_Pragma_Check; --------------------------------- -- Expand_Pragma_Common_Object -- --------------------------------- -- Use a machine attribute to replicate semantic effect in DEC Ada -- pragma Machine_Attribute (intern_name, "common_object", extern_name); -- For now we do nothing with the size attribute ??? -- Note: Psect_Object shares this processing procedure Expand_Pragma_Common_Object (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Internal : constant Node_Id := Arg_N (N, 1); External : constant Node_Id := Arg_N (N, 2); Psect : Node_Id; -- Psect value upper cased as string literal Iloc : constant Source_Ptr := Sloc (Internal); Eloc : constant Source_Ptr := Sloc (External); Ploc : Source_Ptr; begin -- Acquire Psect value and fold to upper case if Present (External) then if Nkind (External) = N_String_Literal then String_To_Name_Buffer (Strval (External)); else Get_Name_String (Chars (External)); end if; Set_All_Upper_Case; Psect := Make_String_Literal (Eloc, Strval => String_From_Name_Buffer); else Get_Name_String (Chars (Internal)); Set_All_Upper_Case; Psect := Make_String_Literal (Iloc, Strval => String_From_Name_Buffer); end if; Ploc := Sloc (Psect); -- Insert the pragma Insert_After_And_Analyze (N, Make_Pragma (Loc, Chars => Name_Machine_Attribute, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Iloc, Expression => New_Copy_Tree (Internal)), Make_Pragma_Argument_Association (Eloc, Expression => Make_String_Literal (Sloc => Ploc, Strval => "common_object")), Make_Pragma_Argument_Association (Ploc, Expression => New_Copy_Tree (Psect))))); end Expand_Pragma_Common_Object; -------------------------------- -- Expand_Pragma_CUDA_Execute -- -------------------------------- -- Pragma CUDA_Execute is expanded in the following manner: -- Original Code -- pragma CUDA_Execute (My_Proc (X, Y), Blocks, Grids, Mem, Stream) -- Expanded Code -- declare -- Blocks_Id : CUDA.Vector_Types.Dim3 := Blocks; -- Grids_Id : CUDA.Vector_Types.Dim3 := Grids; -- Mem_Id : Integer := <Mem or 0>; -- Stream_Id : CUDA.Driver_Types.Stream_T := <Stream or null>; -- X_Id : <Type of X> := X; -- Y_Id : <Type of Y> := Y; -- Arg_Id : Array (1..2) of System.Address := -- (X'Address,_Id Y'Address);_Id -- begin -- CUDA.Internal.Push_Call_Configuration ( -- Grids_Id, -- Blocks_Id, -- Mem_Id, -- Stream_Id); -- CUDA.Internal.Pop_Call_Configuration ( -- Grids_Id'address, -- Blocks_Id'address, -- Mem_Id'address, -- Stream_Id'address), -- CUDA.Runtime_Api.Launch_Kernel ( -- My_Proc'Address, -- Blocks_Id, -- Grids_Id, -- Arg_Id'Address, -- Mem_Id, -- Stream_Id); -- end; procedure Expand_Pragma_CUDA_Execute (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); procedure Append_Copies (Params : List_Id; Decls : List_Id; Copies : Elist_Id); -- For each parameter in list Params, create an object declaration of -- the followinng form: -- -- Copy_Id : Param_Typ := Param_Val; -- -- Param_Typ is the type of the parameter. Param_Val is the initial -- value of the parameter. The declarations are stored in Decls, the -- entities of the new objects are collected in list Copies. function Build_Dim3_Declaration (Decl_Id : Entity_Id; Init_Val : Node_Id) return Node_Id; -- Build an object declaration of the form -- -- Decl_Id : CUDA.Vectory_Types.Dim3 := Val; -- -- Val depends on the nature of Init_Val, as follows: -- -- * If Init_Val is already of type CUDA.Vector_Types.Dim3, then -- Init_Val is used. -- -- * If Init_Val is a single Integer, Val has the following form: -- -- (Interfaces.C.Unsigned (Init_Val), -- Interfaces.C.Unsigned (1), -- Interfaces.C.Unsigned (1)) -- -- * If Init_Val is an aggregate of three values, Val has the -- following form: -- -- (Interfaces.C.Unsigned (Val_1), -- Interfaces.C.Unsigned (Val_2), -- Interfaces.C.Unsigned (Val_3)) function Build_Kernel_Args_Declaration (Kernel_Arg : Entity_Id; Var_Ids : Elist_Id) return Node_Id; -- Given a list of variables, return an object declaration of the -- following form: -- -- Kernel_Arg : ... := (Var_1'Address, ..., Var_N'Address); function Build_Launch_Kernel_Call (Proc : Entity_Id; Grid_Dims : Entity_Id; Block_Dims : Entity_Id; Kernel_Arg : Entity_Id; Memory : Entity_Id; Stream : Entity_Id) return Node_Id; -- Builds and returns a call to CUDA.Launch_Kernel using the given -- arguments. Proc is the entity of the procedure passed to the -- CUDA_Execute pragma. Grid_Dims and Block_Dims are entities of the -- generated declarations that hold the kernel's dimensions. Args is the -- entity of the temporary array that holds the arguments of the kernel. -- Memory and Stream are the entities of the temporaries that hold the -- fourth and fith arguments of CUDA_Execute or their default values. function Build_Shared_Memory_Declaration (Decl_Id : Entity_Id; Init_Val : Node_Id) return Node_Id; -- Builds a declaration the Defining_Identifier of which is Decl_Id, the -- type of which is CUDA.Driver_Types.Stream_T and the value of which is -- Init_Val if present or null if not. function Build_Simple_Declaration_With_Default (Decl_Id : Entity_Id; Init_Val : Entity_Id; Typ : Entity_Id; Default_Val : Entity_Id) return Node_Id; -- Build a declaration the Defining_Identifier of which is Decl_Id, the -- Object_Definition of which is Typ, the value of which is Init_Val if -- present or Default otherwise. function Build_Stream_Declaration (Decl_Id : Entity_Id; Init_Val : Node_Id) return Node_Id; -- Build a declaration the Defining_Identifier of which is Decl_Id, the -- type of which is Integer, the value of which is Init_Val if present -- and 0 otherwise. function To_Addresses (Elmts : Elist_Id) return List_Id; -- Returns a new list containing each element of Elmts wrapped in an -- 'address attribute reference. When passed No_Elist, returns an empty -- list. ------------------- -- Append_Copies -- ------------------- procedure Append_Copies (Params : List_Id; Decls : List_Id; Copies : Elist_Id) is Copy : Entity_Id; Param : Node_Id; begin Param := First (Params); while Present (Param) loop Copy := Make_Temporary (Loc, 'C'); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => Copy, Object_Definition => New_Occurrence_Of (Etype (Param), Loc), Expression => New_Copy_Tree (Param))); Append_Elmt (Copy, Copies); Next (Param); end loop; end Append_Copies; ---------------------------- -- Build_Dim3_Declaration -- ---------------------------- function Build_Dim3_Declaration (Decl_Id : Entity_Id; Init_Val : Node_Id) return Node_Id is Grid_Dim_X : Node_Id; Grid_Dim_Y : Node_Id; Grid_Dim_Z : Node_Id; Init_Value : Node_Id; begin if Etype (Init_Val) = RTE (RE_Dim3) then Init_Value := Init_Val; else -- If Init_Val is an aggregate, use each of its arguments if Nkind (Init_Val) = N_Aggregate then Grid_Dim_X := First (Expressions (Init_Val)); Grid_Dim_Y := Next (Grid_Dim_X); Grid_Dim_Z := Next (Grid_Dim_Y); -- Otherwise, we know it is an integer and the rest defaults to 1. else Grid_Dim_X := Init_Val; Grid_Dim_Y := Make_Integer_Literal (Loc, 1); Grid_Dim_Z := Make_Integer_Literal (Loc, 1); end if; -- Then cast every value to Interfaces.C.Unsigned and build an -- aggregate we can use to initialize the Dim3. Init_Value := Make_Aggregate (Loc, Expressions => New_List ( Make_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RO_IC_Unsigned), Loc), Expression => New_Copy_Tree (Grid_Dim_X)), Make_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RO_IC_Unsigned), Loc), Expression => New_Copy_Tree (Grid_Dim_Y)), Make_Type_Conversion (Loc, Subtype_Mark => New_Occurrence_Of (RTE (RO_IC_Unsigned), Loc), Expression => New_Copy_Tree (Grid_Dim_Z)))); end if; -- Finally return the declaration return Make_Object_Declaration (Loc, Defining_Identifier => Decl_Id, Object_Definition => New_Occurrence_Of (RTE (RE_Dim3), Loc), Expression => Init_Value); end Build_Dim3_Declaration; ----------------------------------- -- Build_Kernel_Args_Declaration -- ----------------------------------- function Build_Kernel_Args_Declaration (Kernel_Arg : Entity_Id; Var_Ids : Elist_Id) return Node_Id is Vals : constant List_Id := To_Addresses (Var_Ids); begin return Make_Object_Declaration (Loc, Defining_Identifier => Kernel_Arg, Object_Definition => Make_Constrained_Array_Definition (Loc, Discrete_Subtype_Definitions => New_List ( Make_Range (Loc, Low_Bound => Make_Integer_Literal (Loc, 1), High_Bound => Make_Integer_Literal (Loc, List_Length (Vals)))), Component_Definition => Make_Component_Definition (Loc, Subtype_Indication => New_Occurrence_Of (Etype (RTE (RE_Address)), Loc))), Expression => Make_Aggregate (Loc, Vals)); end Build_Kernel_Args_Declaration; ------------------------------- -- Build_Launch_Kernel_Call -- ------------------------------- function Build_Launch_Kernel_Call (Proc : Entity_Id; Grid_Dims : Entity_Id; Block_Dims : Entity_Id; Kernel_Arg : Entity_Id; Memory : Entity_Id; Stream : Entity_Id) return Node_Id is begin return Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Launch_Kernel), Loc), Parameter_Associations => New_List ( Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Proc, Loc), Attribute_Name => Name_Address), New_Occurrence_Of (Grid_Dims, Loc), New_Occurrence_Of (Block_Dims, Loc), Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Kernel_Arg, Loc), Attribute_Name => Name_Address), New_Occurrence_Of (Memory, Loc), New_Occurrence_Of (Stream, Loc))); end Build_Launch_Kernel_Call; ------------------------------------- -- Build_Shared_Memory_Declaration -- ------------------------------------- function Build_Shared_Memory_Declaration (Decl_Id : Entity_Id; Init_Val : Node_Id) return Node_Id is begin return Build_Simple_Declaration_With_Default (Decl_Id => Decl_Id, Init_Val => Init_Val, Typ => New_Occurrence_Of (RTE (RO_IC_Unsigned_Long_Long), Loc), Default_Val => Make_Integer_Literal (Loc, 0)); end Build_Shared_Memory_Declaration; ------------------------------------------- -- Build_Simple_Declaration_With_Default -- ------------------------------------------- function Build_Simple_Declaration_With_Default (Decl_Id : Entity_Id; Init_Val : Node_Id; Typ : Entity_Id; Default_Val : Node_Id) return Node_Id is Value : Node_Id := Init_Val; begin if No (Value) then Value := Default_Val; end if; return Make_Object_Declaration (Loc, Defining_Identifier => Decl_Id, Object_Definition => Typ, Expression => Value); end Build_Simple_Declaration_With_Default; ------------------------------ -- Build_Stream_Declaration -- ------------------------------ function Build_Stream_Declaration (Decl_Id : Entity_Id; Init_Val : Node_Id) return Node_Id is begin return Build_Simple_Declaration_With_Default (Decl_Id => Decl_Id, Init_Val => Init_Val, Typ => New_Occurrence_Of (RTE (RE_Stream_T), Loc), Default_Val => Make_Null (Loc)); end Build_Stream_Declaration; ------------------ -- To_Addresses -- ------------------ function To_Addresses (Elmts : Elist_Id) return List_Id is Result : constant List_Id := New_List; Elmt : Elmt_Id; begin if Elmts = No_Elist then return Result; end if; Elmt := First_Elmt (Elmts); while Present (Elmt) loop Append_To (Result, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Node (Elmt), Loc), Attribute_Name => Name_Address)); Next_Elmt (Elmt); end loop; return Result; end To_Addresses; -- Local variables -- Pragma arguments Procedure_Call : constant Node_Id := Get_Pragma_Arg (Arg_N (N, 1)); Grid_Dimensions : constant Node_Id := Get_Pragma_Arg (Arg_N (N, 2)); Block_Dimensions : constant Node_Id := Get_Pragma_Arg (Arg_N (N, 3)); Shared_Memory : constant Node_Id := Get_Pragma_Arg (Arg_N (N, 4)); CUDA_Stream : constant Node_Id := Get_Pragma_Arg (Arg_N (N, 5)); -- Entities of objects that capture the value of pragma arguments Grids_Id : constant Entity_Id := Make_Temporary (Loc, 'C'); Blocks_Id : constant Entity_Id := Make_Temporary (Loc, 'C'); Memory_Id : constant Entity_Id := Make_Temporary (Loc, 'C'); Stream_Id : constant Entity_Id := Make_Temporary (Loc, 'C'); -- List holding the entities of the copies of Procedure_Call's -- arguments. Kernel_Arg_Copies : constant Elist_Id := New_Elmt_List; -- Entity of the array that contains the address of each of the kernel's -- arguments. Kernel_Args_Id : constant Entity_Id := Make_Temporary (Loc, 'C'); -- Calls to the CUDA runtime API. Launch_Kernel_Call : Node_Id; Pop_Call : Node_Id; Push_Call : Node_Id; -- Declaration of all temporaries required for CUDA API Calls. Blk_Decls : constant List_Id := New_List; -- Start of processing for CUDA_Execute begin -- Build parameter declarations for CUDA API calls Append_To (Blk_Decls, Build_Dim3_Declaration (Grids_Id, Grid_Dimensions)); Append_To (Blk_Decls, Build_Dim3_Declaration (Blocks_Id, Block_Dimensions)); Append_To (Blk_Decls, Build_Shared_Memory_Declaration (Memory_Id, Shared_Memory)); Append_To (Blk_Decls, Build_Stream_Declaration (Stream_Id, CUDA_Stream)); Append_Copies (Parameter_Associations (Procedure_Call), Blk_Decls, Kernel_Arg_Copies); Append_To (Blk_Decls, Build_Kernel_Args_Declaration (Kernel_Args_Id, Kernel_Arg_Copies)); -- Build calls to the CUDA API Push_Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Push_Call_Configuration), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Grids_Id, Loc), New_Occurrence_Of (Blocks_Id, Loc), New_Occurrence_Of (Memory_Id, Loc), New_Occurrence_Of (Stream_Id, Loc))); Pop_Call := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Pop_Call_Configuration), Loc), Parameter_Associations => To_Addresses (New_Elmt_List (Grids_Id, Blocks_Id, Memory_Id, Stream_Id))); Launch_Kernel_Call := Build_Launch_Kernel_Call (Proc => Entity (Name (Procedure_Call)), Grid_Dims => Grids_Id, Block_Dims => Blocks_Id, Kernel_Arg => Kernel_Args_Id, Memory => Memory_Id, Stream => Stream_Id); -- Finally make the block that holds declarations and calls Rewrite (N, Make_Block_Statement (Loc, Declarations => Blk_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Push_Call, Pop_Call, Launch_Kernel_Call)))); Analyze (N); end Expand_Pragma_CUDA_Execute; ---------------------------------- -- Expand_Pragma_Contract_Cases -- ---------------------------------- -- Pragma Contract_Cases is expanded in the following manner: -- subprogram S is -- Count : Natural := 0; -- Flag_1 : Boolean := False; -- . . . -- Flag_N : Boolean := False; -- Flag_N+1 : Boolean := False; -- when "others" present -- Pref_1 : ...; -- . . . -- Pref_M : ...; -- <preconditions (if any)> -- -- Evaluate all case guards -- if Case_Guard_1 then -- Flag_1 := True; -- Count := Count + 1; -- end if; -- . . . -- if Case_Guard_N then -- Flag_N := True; -- Count := Count + 1; -- end if; -- -- Emit errors depending on the number of case guards that -- -- evaluated to True. -- if Count = 0 then -- raise Assertion_Error with "xxx contract cases incomplete"; -- <or> -- Flag_N+1 := True; -- when "others" present -- elsif Count > 1 then -- declare -- Str0 : constant String := -- "contract cases overlap for subprogram ABC"; -- Str1 : constant String := -- (if Flag_1 then -- Str0 & "case guard at xxx evaluates to True" -- else Str0); -- StrN : constant String := -- (if Flag_N then -- StrN-1 & "case guard at xxx evaluates to True" -- else StrN-1); -- begin -- raise Assertion_Error with StrN; -- end; -- end if; -- -- Evaluate all attribute 'Old prefixes found in the selected -- -- consequence. -- if Flag_1 then -- Pref_1 := <prefix of 'Old found in Consequence_1> -- . . . -- elsif Flag_N then -- Pref_M := <prefix of 'Old found in Consequence_N> -- end if; -- procedure _Postconditions is -- begin -- <postconditions (if any)> -- if Flag_1 and then not Consequence_1 then -- raise Assertion_Error with "failed contract case at xxx"; -- end if; -- . . . -- if Flag_N[+1] and then not Consequence_N[+1] then -- raise Assertion_Error with "failed contract case at xxx"; -- end if; -- end _Postconditions; -- begin -- . . . -- end S; procedure Expand_Pragma_Contract_Cases (CCs : Node_Id; Subp_Id : Entity_Id; Decls : List_Id; Stmts : in out List_Id) is Loc : constant Source_Ptr := Sloc (CCs); procedure Case_Guard_Error (Decls : List_Id; Flag : Entity_Id; Error_Loc : Source_Ptr; Msg : in out Entity_Id); -- Given a declarative list Decls, status flag Flag, the location of the -- error and a string Msg, construct the following check: -- Msg : constant String := -- (if Flag then -- Msg & "case guard at Error_Loc evaluates to True" -- else Msg); -- The resulting code is added to Decls procedure Consequence_Error (Checks : in out Node_Id; Flag : Entity_Id; Conseq : Node_Id); -- Given an if statement Checks, status flag Flag and a consequence -- Conseq, construct the following check: -- [els]if Flag and then not Conseq then -- raise Assertion_Error -- with "failed contract case at Sloc (Conseq)"; -- [end if;] -- The resulting code is added to Checks function Declaration_Of (Id : Entity_Id) return Node_Id; -- Given the entity Id of a boolean flag, generate: -- Id : Boolean := False; procedure Expand_Attributes_In_Consequence (Decls : List_Id; Evals : in out Node_Id; Flag : Entity_Id; Conseq : Node_Id); -- Perform specialized expansion of all attribute 'Old references found -- in consequence Conseq such that at runtime only prefixes coming from -- the selected consequence are evaluated. Similarly expand attribute -- 'Result references by replacing them with identifier _result which -- resolves to the sole formal parameter of procedure _Postconditions. -- Any temporaries generated in the process are added to declarations -- Decls. Evals is a complex if statement tasked with the evaluation of -- all prefixes coming from a single selected consequence. Flag is the -- corresponding case guard flag. Conseq is the consequence expression. function Increment (Id : Entity_Id) return Node_Id; -- Given the entity Id of a numerical variable, generate: -- Id := Id + 1; function Set (Id : Entity_Id) return Node_Id; -- Given the entity Id of a boolean variable, generate: -- Id := True; ---------------------- -- Case_Guard_Error -- ---------------------- procedure Case_Guard_Error (Decls : List_Id; Flag : Entity_Id; Error_Loc : Source_Ptr; Msg : in out Entity_Id) is New_Line : constant Character := Character'Val (10); New_Msg : constant Entity_Id := Make_Temporary (Loc, 'S'); begin Start_String; Store_String_Char (New_Line); Store_String_Chars (" case guard at "); Store_String_Chars (Build_Location_String (Error_Loc)); Store_String_Chars (" evaluates to True"); -- Generate: -- New_Msg : constant String := -- (if Flag then -- Msg & "case guard at Error_Loc evaluates to True" -- else Msg); Append_To (Decls, Make_Object_Declaration (Loc, Defining_Identifier => New_Msg, Constant_Present => True, Object_Definition => New_Occurrence_Of (Standard_String, Loc), Expression => Make_If_Expression (Loc, Expressions => New_List ( New_Occurrence_Of (Flag, Loc), Make_Op_Concat (Loc, Left_Opnd => New_Occurrence_Of (Msg, Loc), Right_Opnd => Make_String_Literal (Loc, End_String)), New_Occurrence_Of (Msg, Loc))))); Msg := New_Msg; end Case_Guard_Error; ----------------------- -- Consequence_Error -- ----------------------- procedure Consequence_Error (Checks : in out Node_Id; Flag : Entity_Id; Conseq : Node_Id) is Cond : Node_Id; Error : Node_Id; begin -- Generate: -- Flag and then not Conseq Cond := Make_And_Then (Loc, Left_Opnd => New_Occurrence_Of (Flag, Loc), Right_Opnd => Make_Op_Not (Loc, Right_Opnd => Relocate_Node (Conseq))); -- Generate: -- raise Assertion_Error -- with "failed contract case at Sloc (Conseq)"; Start_String; Store_String_Chars ("failed contract case at "); Store_String_Chars (Build_Location_String (Sloc (Conseq))); Error := Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Raise_Assert_Failure), Loc), Parameter_Associations => New_List ( Make_String_Literal (Loc, End_String))); if No (Checks) then Checks := Make_Implicit_If_Statement (CCs, Condition => Cond, Then_Statements => New_List (Error)); else if No (Elsif_Parts (Checks)) then Set_Elsif_Parts (Checks, New_List); end if; Append_To (Elsif_Parts (Checks), Make_Elsif_Part (Loc, Condition => Cond, Then_Statements => New_List (Error))); end if; end Consequence_Error; -------------------- -- Declaration_Of -- -------------------- function Declaration_Of (Id : Entity_Id) return Node_Id is begin return Make_Object_Declaration (Loc, Defining_Identifier => Id, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc), Expression => New_Occurrence_Of (Standard_False, Loc)); end Declaration_Of; -------------------------------------- -- Expand_Attributes_In_Consequence -- -------------------------------------- procedure Expand_Attributes_In_Consequence (Decls : List_Id; Evals : in out Node_Id; Flag : Entity_Id; Conseq : Node_Id) is Eval_Stmts : List_Id := No_List; -- The evaluation sequence expressed as assignment statements of all -- prefixes of attribute 'Old found in the current consequence. function Expand_Attributes (N : Node_Id) return Traverse_Result; -- Determine whether an arbitrary node denotes attribute 'Old or -- 'Result and if it does, perform all expansion-related actions. ----------------------- -- Expand_Attributes -- ----------------------- function Expand_Attributes (N : Node_Id) return Traverse_Result is Decl : Node_Id; Pref : Node_Id; Temp : Entity_Id; Indirect : Boolean := False; use Sem_Util.Old_Attr_Util.Indirect_Temps; procedure Append_For_Indirect_Temp (N : Node_Id; Is_Eval_Stmt : Boolean); -- Append either a declaration (which is to be elaborated -- unconditionally) or an evaluation statement (which is -- to be executed conditionally). ------------------------------- -- Append_For_Indirect_Temp -- ------------------------------- procedure Append_For_Indirect_Temp (N : Node_Id; Is_Eval_Stmt : Boolean) is begin if Is_Eval_Stmt then Append_To (Eval_Stmts, N); else Prepend_To (Decls, N); -- This use of Prepend (as opposed to Append) is why -- we have the Append_Decls_In_Reverse_Order parameter. end if; end Append_For_Indirect_Temp; procedure Declare_Indirect_Temporary is new Declare_Indirect_Temp ( Append_Item => Append_For_Indirect_Temp, Append_Decls_In_Reverse_Order => True); -- Start of processing for Expand_Attributes begin -- Attribute 'Old if Nkind (N) = N_Attribute_Reference and then Attribute_Name (N) = Name_Old then Pref := Prefix (N); Indirect := Indirect_Temp_Needed (Etype (Pref)); if Indirect then if No (Eval_Stmts) then Eval_Stmts := New_List; end if; Declare_Indirect_Temporary (Attr_Prefix => Pref, Indirect_Temp => Temp); -- Declare a temporary of the prefix type with no explicit -- initial value. If the appropriate contract case is selected -- at run time, then the temporary will be initialized via an -- assignment statement. else Temp := Make_Temporary (Loc, 'T', Pref); Set_Etype (Temp, Etype (Pref)); -- Generate a temporary to capture the value of the prefix: -- Temp : <Pref type>; Decl := Make_Object_Declaration (Loc, Defining_Identifier => Temp, Object_Definition => New_Occurrence_Of (Etype (Pref), Loc)); -- Place that temporary at the beginning of declarations, to -- prevent anomalies in the GNATprove flow-analysis pass in -- the precondition procedure that follows. Prepend_To (Decls, Decl); -- Initially Temp is uninitialized (which is required for -- correctness if default initialization might have side -- effects). Assign prefix value to temp on Eval_Statement -- list, so assignment will be executed conditionally. Set_Ekind (Temp, E_Variable); Set_Suppress_Initialization (Temp); Analyze (Decl); if No (Eval_Stmts) then Eval_Stmts := New_List; end if; Append_To (Eval_Stmts, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Temp, Loc), Expression => Pref)); end if; -- Ensure that the prefix is valid if Validity_Checks_On and then Validity_Check_Operands then Ensure_Valid (Pref); end if; -- Replace the original attribute 'Old by a reference to the -- generated temporary. if Indirect then Rewrite (N, Indirect_Temp_Value (Temp => Temp, Typ => Etype (Pref), Loc => Loc)); else Rewrite (N, New_Occurrence_Of (Temp, Loc)); end if; -- Attribute 'Result elsif Is_Attribute_Result (N) then Rewrite (N, Make_Identifier (Loc, Name_uResult)); end if; return OK; end Expand_Attributes; procedure Expand_Attributes_In is new Traverse_Proc (Expand_Attributes); -- Start of processing for Expand_Attributes_In_Consequence begin -- Inspect the consequence and expand any attribute 'Old and 'Result -- references found within. Expand_Attributes_In (Conseq); -- The consequence does not contain any attribute 'Old references if No (Eval_Stmts) then return; end if; -- Augment the machinery to trigger the evaluation of all prefixes -- found in the step above. If Eval is empty, then this is the first -- consequence to yield expansion of 'Old. Generate: -- if Flag then -- <evaluation statements> -- end if; if No (Evals) then Evals := Make_Implicit_If_Statement (CCs, Condition => New_Occurrence_Of (Flag, Loc), Then_Statements => Eval_Stmts); -- Otherwise generate: -- elsif Flag then -- <evaluation statements> -- end if; else if No (Elsif_Parts (Evals)) then Set_Elsif_Parts (Evals, New_List); end if; Append_To (Elsif_Parts (Evals), Make_Elsif_Part (Loc, Condition => New_Occurrence_Of (Flag, Loc), Then_Statements => Eval_Stmts)); end if; end Expand_Attributes_In_Consequence; --------------- -- Increment -- --------------- function Increment (Id : Entity_Id) return Node_Id is begin return Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Id, Loc), Expression => Make_Op_Add (Loc, Left_Opnd => New_Occurrence_Of (Id, Loc), Right_Opnd => Make_Integer_Literal (Loc, 1))); end Increment; --------- -- Set -- --------- function Set (Id : Entity_Id) return Node_Id is begin return Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Id, Loc), Expression => New_Occurrence_Of (Standard_True, Loc)); end Set; -- Local variables Aggr : constant Node_Id := Expression (First (Pragma_Argument_Associations (CCs))); Case_Guard : Node_Id; CG_Checks : Node_Id; CG_Stmts : List_Id; Conseq : Node_Id; Conseq_Checks : Node_Id := Empty; Count : Entity_Id; Count_Decl : Node_Id; Error_Decls : List_Id := No_List; -- init to avoid warning Flag : Entity_Id; Flag_Decl : Node_Id; If_Stmt : Node_Id; Msg_Str : Entity_Id := Empty; Multiple_PCs : Boolean; Old_Evals : Node_Id := Empty; Others_Decl : Node_Id; Others_Flag : Entity_Id := Empty; Post_Case : Node_Id; -- Start of processing for Expand_Pragma_Contract_Cases begin -- Do nothing if pragma is not enabled. If pragma is disabled, it has -- already been rewritten as a Null statement. if Is_Ignored (CCs) then return; -- Guard against malformed contract cases elsif Nkind (Aggr) /= N_Aggregate then return; end if; -- The expansion of contract cases is quite distributed as it produces -- various statements to evaluate the case guards and consequences. To -- preserve the original context, set the Is_Assertion_Expr flag. This -- aids the Ghost legality checks when verifying the placement of a -- reference to a Ghost entity. In_Assertion_Expr := In_Assertion_Expr + 1; Multiple_PCs := List_Length (Component_Associations (Aggr)) > 1; -- Create the counter which tracks the number of case guards that -- evaluate to True. -- Count : Natural := 0; Count := Make_Temporary (Loc, 'C'); Count_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Count, Object_Definition => New_Occurrence_Of (Standard_Natural, Loc), Expression => Make_Integer_Literal (Loc, 0)); Prepend_To (Decls, Count_Decl); Analyze (Count_Decl); -- Create the base error message for multiple overlapping case guards -- Msg_Str : constant String := -- "contract cases overlap for subprogram Subp_Id"; if Multiple_PCs then Msg_Str := Make_Temporary (Loc, 'S'); Start_String; Store_String_Chars ("contract cases overlap for subprogram "); Store_String_Chars (Get_Name_String (Chars (Subp_Id))); Error_Decls := New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Msg_Str, Constant_Present => True, Object_Definition => New_Occurrence_Of (Standard_String, Loc), Expression => Make_String_Literal (Loc, End_String))); end if; -- Process individual post cases Post_Case := First (Component_Associations (Aggr)); while Present (Post_Case) loop Case_Guard := First (Choices (Post_Case)); Conseq := Expression (Post_Case); -- The "others" choice requires special processing if Nkind (Case_Guard) = N_Others_Choice then Others_Flag := Make_Temporary (Loc, 'F'); Others_Decl := Declaration_Of (Others_Flag); Prepend_To (Decls, Others_Decl); Analyze (Others_Decl); -- Check possible overlap between a case guard and "others" if Multiple_PCs and Exception_Extra_Info then Case_Guard_Error (Decls => Error_Decls, Flag => Others_Flag, Error_Loc => Sloc (Case_Guard), Msg => Msg_Str); end if; -- Inspect the consequence and perform special expansion of any -- attribute 'Old and 'Result references found within. Expand_Attributes_In_Consequence (Decls => Decls, Evals => Old_Evals, Flag => Others_Flag, Conseq => Conseq); -- Check the corresponding consequence of "others" Consequence_Error (Checks => Conseq_Checks, Flag => Others_Flag, Conseq => Conseq); -- Regular post case else -- Create the flag which tracks the state of its associated case -- guard. Flag := Make_Temporary (Loc, 'F'); Flag_Decl := Declaration_Of (Flag); Prepend_To (Decls, Flag_Decl); Analyze (Flag_Decl); -- The flag is set when the case guard is evaluated to True -- if Case_Guard then -- Flag := True; -- Count := Count + 1; -- end if; If_Stmt := Make_Implicit_If_Statement (CCs, Condition => Relocate_Node (Case_Guard), Then_Statements => New_List ( Set (Flag), Increment (Count))); Append_To (Decls, If_Stmt); Analyze (If_Stmt); -- Check whether this case guard overlaps with another one if Multiple_PCs and Exception_Extra_Info then Case_Guard_Error (Decls => Error_Decls, Flag => Flag, Error_Loc => Sloc (Case_Guard), Msg => Msg_Str); end if; -- Inspect the consequence and perform special expansion of any -- attribute 'Old and 'Result references found within. Expand_Attributes_In_Consequence (Decls => Decls, Evals => Old_Evals, Flag => Flag, Conseq => Conseq); -- The corresponding consequence of the case guard which evaluated -- to True must hold on exit from the subprogram. Consequence_Error (Checks => Conseq_Checks, Flag => Flag, Conseq => Conseq); end if; Next (Post_Case); end loop; -- Raise Assertion_Error when none of the case guards evaluate to True. -- The only exception is when we have "others", in which case there is -- no error because "others" acts as a default True. -- Generate: -- Flag := True; if Present (Others_Flag) then CG_Stmts := New_List (Set (Others_Flag)); -- Generate: -- raise Assertion_Error with "xxx contract cases incomplete"; else Start_String; Store_String_Chars (Build_Location_String (Loc)); Store_String_Chars (" contract cases incomplete"); CG_Stmts := New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Raise_Assert_Failure), Loc), Parameter_Associations => New_List ( Make_String_Literal (Loc, End_String)))); end if; CG_Checks := Make_Implicit_If_Statement (CCs, Condition => Make_Op_Eq (Loc, Left_Opnd => New_Occurrence_Of (Count, Loc), Right_Opnd => Make_Integer_Literal (Loc, 0)), Then_Statements => CG_Stmts); -- Detect a possible failure due to several case guards evaluating to -- True. -- Generate: -- elsif Count > 0 then -- declare -- <Error_Decls> -- begin -- raise Assertion_Error with <Msg_Str>; -- end if; if Multiple_PCs then Set_Elsif_Parts (CG_Checks, New_List ( Make_Elsif_Part (Loc, Condition => Make_Op_Gt (Loc, Left_Opnd => New_Occurrence_Of (Count, Loc), Right_Opnd => Make_Integer_Literal (Loc, 1)), Then_Statements => New_List ( Make_Block_Statement (Loc, Declarations => Error_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Raise_Assert_Failure), Loc), Parameter_Associations => New_List ( New_Occurrence_Of (Msg_Str, Loc)))))))))); end if; Append_To (Decls, CG_Checks); Analyze (CG_Checks); -- Once all case guards are evaluated and checked, evaluate any prefixes -- of attribute 'Old founds in the selected consequence. if Present (Old_Evals) then Append_To (Decls, Old_Evals); Analyze (Old_Evals); end if; -- Raise Assertion_Error when the corresponding consequence of a case -- guard that evaluated to True fails. if No (Stmts) then Stmts := New_List; end if; Append_To (Stmts, Conseq_Checks); In_Assertion_Expr := In_Assertion_Expr - 1; end Expand_Pragma_Contract_Cases; --------------------------------------- -- Expand_Pragma_Import_Or_Interface -- --------------------------------------- procedure Expand_Pragma_Import_Or_Interface (N : Node_Id) is Def_Id : Entity_Id; begin -- In Relaxed_RM_Semantics, support old Ada 83 style: -- pragma Import (Entity, "external name"); if Relaxed_RM_Semantics and then List_Length (Pragma_Argument_Associations (N)) = 2 and then Pragma_Name (N) = Name_Import and then Nkind (Arg_N (N, 2)) = N_String_Literal then Def_Id := Entity (Arg_N (N, 1)); else Def_Id := Entity (Arg_N (N, 2)); end if; -- Variable case (we have to undo any initialization already done) if Ekind (Def_Id) = E_Variable then Undo_Initialization (Def_Id, N); -- Case of exception with convention C++ elsif Ekind (Def_Id) = E_Exception and then Convention (Def_Id) = Convention_CPP then -- Import a C++ convention declare Loc : constant Source_Ptr := Sloc (N); Rtti_Name : constant Node_Id := Arg_N (N, 3); Dum : constant Entity_Id := Make_Temporary (Loc, 'D'); Exdata : List_Id; Lang_Char : Node_Id; Foreign_Data : Node_Id; begin Exdata := Component_Associations (Expression (Parent (Def_Id))); Lang_Char := Next (First (Exdata)); -- Change the one-character language designator to 'C' Rewrite (Expression (Lang_Char), Make_Character_Literal (Loc, Chars => Name_uC, Char_Literal_Value => UI_From_Int (Character'Pos ('C')))); Analyze (Expression (Lang_Char)); -- Change the value of Foreign_Data Foreign_Data := Next (Next (Next (Next (Lang_Char)))); Insert_Actions (Def_Id, New_List ( Make_Object_Declaration (Loc, Defining_Identifier => Dum, Object_Definition => New_Occurrence_Of (Standard_Character, Loc)), Make_Pragma (Loc, Chars => Name_Import, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Expression => Make_Identifier (Loc, Name_Ada)), Make_Pragma_Argument_Association (Loc, Expression => Make_Identifier (Loc, Chars (Dum))), Make_Pragma_Argument_Association (Loc, Chars => Name_External_Name, Expression => Relocate_Node (Rtti_Name)))))); Rewrite (Expression (Foreign_Data), Unchecked_Convert_To (Standard_A_Char, Make_Attribute_Reference (Loc, Prefix => Make_Identifier (Loc, Chars (Dum)), Attribute_Name => Name_Address))); Analyze (Expression (Foreign_Data)); end; -- No special expansion required for any other case else null; end if; end Expand_Pragma_Import_Or_Interface; ------------------------------------- -- Expand_Pragma_Initial_Condition -- ------------------------------------- procedure Expand_Pragma_Initial_Condition (Pack_Id : Entity_Id; N : Node_Id) is procedure Extract_Package_Body_Lists (Pack_Body : Node_Id; Body_List : out List_Id; Call_List : out List_Id; Spec_List : out List_Id); -- Obtain the various declarative and statement lists of package body -- Pack_Body needed to insert the initial condition procedure and the -- call to it. The lists are as follows: -- -- * Body_List - used to insert the initial condition procedure body -- -- * Call_List - used to insert the call to the initial condition -- procedure. -- -- * Spec_List - used to insert the initial condition procedure spec procedure Extract_Package_Declaration_Lists (Pack_Decl : Node_Id; Body_List : out List_Id; Call_List : out List_Id; Spec_List : out List_Id); -- Obtain the various declarative lists of package declaration Pack_Decl -- needed to insert the initial condition procedure and the call to it. -- The lists are as follows: -- -- * Body_List - used to insert the initial condition procedure body -- -- * Call_List - used to insert the call to the initial condition -- procedure. -- -- * Spec_List - used to insert the initial condition procedure spec -------------------------------- -- Extract_Package_Body_Lists -- -------------------------------- procedure Extract_Package_Body_Lists (Pack_Body : Node_Id; Body_List : out List_Id; Call_List : out List_Id; Spec_List : out List_Id) is Pack_Spec : constant Entity_Id := Corresponding_Spec (Pack_Body); Dummy_1 : List_Id; Dummy_2 : List_Id; HSS : Node_Id; begin pragma Assert (Present (Pack_Spec)); -- The different parts of the invariant procedure are inserted as -- follows: -- package Pack is package body Pack is -- <IC spec> <IC body> -- private begin -- ... <IC call> -- end Pack; end Pack; -- The initial condition procedure spec is inserted in the visible -- declaration of the corresponding package spec. Extract_Package_Declaration_Lists (Pack_Decl => Unit_Declaration_Node (Pack_Spec), Body_List => Dummy_1, Call_List => Dummy_2, Spec_List => Spec_List); -- The initial condition procedure body is added to the declarations -- of the package body. Body_List := Declarations (Pack_Body); if No (Body_List) then Body_List := New_List; Set_Declarations (Pack_Body, Body_List); end if; -- The call to the initial condition procedure is inserted in the -- statements of the package body. HSS := Handled_Statement_Sequence (Pack_Body); if No (HSS) then HSS := Make_Handled_Sequence_Of_Statements (Sloc (Pack_Body), Statements => New_List); Set_Handled_Statement_Sequence (Pack_Body, HSS); end if; Call_List := Statements (HSS); end Extract_Package_Body_Lists; --------------------------------------- -- Extract_Package_Declaration_Lists -- --------------------------------------- procedure Extract_Package_Declaration_Lists (Pack_Decl : Node_Id; Body_List : out List_Id; Call_List : out List_Id; Spec_List : out List_Id) is Pack_Spec : constant Node_Id := Specification (Pack_Decl); begin -- The different parts of the invariant procedure are inserted as -- follows: -- package Pack is -- <IC spec> -- <IC body> -- private -- <IC call> -- end Pack; -- The initial condition procedure spec and body are inserted in the -- visible declarations of the package spec. Body_List := Visible_Declarations (Pack_Spec); if No (Body_List) then Body_List := New_List; Set_Visible_Declarations (Pack_Spec, Body_List); end if; Spec_List := Body_List; -- The call to the initial procedure is inserted in the private -- declarations of the package spec. Call_List := Private_Declarations (Pack_Spec); if No (Call_List) then Call_List := New_List; Set_Private_Declarations (Pack_Spec, Call_List); end if; end Extract_Package_Declaration_Lists; -- Local variables IC_Prag : constant Node_Id := Get_Pragma (Pack_Id, Pragma_Initial_Condition); Body_List : List_Id; Call : Node_Id; Call_List : List_Id; Call_Loc : Source_Ptr; Expr : Node_Id; Loc : Source_Ptr; Proc_Body : Node_Id; Proc_Body_Id : Entity_Id; Proc_Decl : Node_Id; Proc_Id : Entity_Id; Spec_List : List_Id; -- Start of processing for Expand_Pragma_Initial_Condition begin -- Nothing to do when the package is not subject to an Initial_Condition -- pragma. if No (IC_Prag) then return; end if; Expr := Get_Pragma_Arg (First (Pragma_Argument_Associations (IC_Prag))); Loc := Sloc (IC_Prag); -- Nothing to do when the pragma is ignored because its semantics are -- suppressed. if Is_Ignored (IC_Prag) then return; -- Nothing to do when the pragma or its argument are illegal because -- there is no valid expression to check. elsif Error_Posted (IC_Prag) or else Error_Posted (Expr) then return; end if; -- Obtain the various lists of the context where the individual pieces -- of the initial condition procedure are to be inserted. if Nkind (N) = N_Package_Body then Extract_Package_Body_Lists (Pack_Body => N, Body_List => Body_List, Call_List => Call_List, Spec_List => Spec_List); elsif Nkind (N) = N_Package_Declaration then Extract_Package_Declaration_Lists (Pack_Decl => N, Body_List => Body_List, Call_List => Call_List, Spec_List => Spec_List); -- This routine should not be used on anything other than packages else pragma Assert (False); return; end if; Proc_Id := Make_Defining_Identifier (Loc, Chars => New_External_Name (Chars (Pack_Id), "Initial_Condition")); Set_Ekind (Proc_Id, E_Procedure); Set_Is_Initial_Condition_Procedure (Proc_Id); -- Generate: -- procedure <Pack_Id>Initial_Condition; Proc_Decl := Make_Subprogram_Declaration (Loc, Make_Procedure_Specification (Loc, Defining_Unit_Name => Proc_Id)); Append_To (Spec_List, Proc_Decl); -- The initial condition procedure requires debug info when initial -- condition is subject to Source Coverage Obligations. if Generate_SCO then Set_Debug_Info_Needed (Proc_Id); end if; -- Generate: -- procedure <Pack_Id>Initial_Condition is -- begin -- pragma Check (Initial_Condition, <Expr>); -- end <Pack_Id>Initial_Condition; Proc_Body := Make_Subprogram_Body (Loc, Specification => Copy_Subprogram_Spec (Specification (Proc_Decl)), Declarations => Empty_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List ( Make_Pragma (Loc, Chars => Name_Check, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Expression => Make_Identifier (Loc, Name_Initial_Condition)), Make_Pragma_Argument_Association (Loc, Expression => New_Copy_Tree (Expr))))))); Append_To (Body_List, Proc_Body); -- The initial condition procedure requires debug info when initial -- condition is subject to Source Coverage Obligations. Proc_Body_Id := Defining_Entity (Proc_Body); if Generate_SCO then Set_Debug_Info_Needed (Proc_Body_Id); end if; -- The location of the initial condition procedure call must be as close -- as possible to the intended semantic location of the check because -- the ABE mechanism relies heavily on accurate locations. Call_Loc := End_Keyword_Location (N); -- Generate: -- <Pack_Id>Initial_Condition; Call := Make_Procedure_Call_Statement (Call_Loc, Name => New_Occurrence_Of (Proc_Id, Call_Loc)); Append_To (Call_List, Call); Analyze (Proc_Decl); Analyze (Proc_Body); Analyze (Call); end Expand_Pragma_Initial_Condition; ------------------------------------ -- Expand_Pragma_Inspection_Point -- ------------------------------------ -- If no argument is given, then we supply a default argument list that -- includes all objects declared at the source level in all subprograms -- that enclose the inspection point pragma. procedure Expand_Pragma_Inspection_Point (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); A : List_Id; Assoc : Node_Id; S : Entity_Id; E : Entity_Id; begin if No (Pragma_Argument_Associations (N)) then A := New_List; S := Current_Scope; while S /= Standard_Standard loop E := First_Entity (S); while Present (E) loop if Comes_From_Source (E) and then Is_Object (E) and then not Is_Entry_Formal (E) and then Ekind (E) /= E_Component and then Ekind (E) /= E_Discriminant and then Ekind (E) /= E_Generic_In_Parameter and then Ekind (E) /= E_Generic_In_Out_Parameter then Append_To (A, Make_Pragma_Argument_Association (Loc, Expression => New_Occurrence_Of (E, Loc))); end if; Next_Entity (E); end loop; S := Scope (S); end loop; Set_Pragma_Argument_Associations (N, A); end if; -- Expand the arguments of the pragma. Expanding an entity reference -- is a noop, except in a protected operation, where a reference may -- have to be transformed into a reference to the corresponding prival. -- Are there other pragmas that may require this ??? Assoc := First (Pragma_Argument_Associations (N)); while Present (Assoc) loop Expand (Expression (Assoc)); Next (Assoc); end loop; end Expand_Pragma_Inspection_Point; -------------------------------------- -- Expand_Pragma_Interrupt_Priority -- -------------------------------------- -- Supply default argument if none exists (System.Interrupt_Priority'Last) procedure Expand_Pragma_Interrupt_Priority (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); begin if No (Pragma_Argument_Associations (N)) then Set_Pragma_Argument_Associations (N, New_List ( Make_Pragma_Argument_Association (Loc, Expression => Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (RTE (RE_Interrupt_Priority), Loc), Attribute_Name => Name_Last)))); end if; end Expand_Pragma_Interrupt_Priority; -------------------------------- -- Expand_Pragma_Loop_Variant -- -------------------------------- -- Pragma Loop_Variant is expanded in the following manner: -- Original code -- for | while ... loop -- <preceding source statements> -- pragma Loop_Variant -- (Increases => Incr_Expr, -- Decreases => Decr_Expr); -- <succeeding source statements> -- end loop; -- Expanded code -- Curr_1 : <type of Incr_Expr>; -- Curr_2 : <type of Decr_Expr>; -- Old_1 : <type of Incr_Expr>; -- Old_2 : <type of Decr_Expr>; -- Flag : Boolean := False; -- for | while ... loop -- <preceding source statements> -- if Flag then -- Old_1 := Curr_1; -- Old_2 := Curr_2; -- end if; -- Curr_1 := <Incr_Expr>; -- Curr_2 := <Decr_Expr>; -- if Flag then -- if Curr_1 /= Old_1 then -- pragma Check (Loop_Variant, Curr_1 > Old_1); -- else -- pragma Check (Loop_Variant, Curr_2 < Old_2); -- end if; -- else -- Flag := True; -- end if; -- <succeeding source statements> -- end loop; procedure Expand_Pragma_Loop_Variant (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Last_Var : constant Node_Id := Last (Pragma_Argument_Associations (N)); Curr_Assign : List_Id := No_List; Flag_Id : Entity_Id := Empty; If_Stmt : Node_Id := Empty; Old_Assign : List_Id := No_List; Loop_Scop : Entity_Id; Loop_Stmt : Node_Id; Variant : Node_Id; procedure Process_Variant (Variant : Node_Id; Is_Last : Boolean); -- Process a single increasing / decreasing termination variant. Flag -- Is_Last should be set when processing the last variant. --------------------- -- Process_Variant -- --------------------- procedure Process_Variant (Variant : Node_Id; Is_Last : Boolean) is Expr : constant Node_Id := Expression (Variant); Expr_Typ : constant Entity_Id := Etype (Expr); Loc : constant Source_Ptr := Sloc (Expr); Loop_Loc : constant Source_Ptr := Sloc (Loop_Stmt); Curr_Id : Entity_Id; Old_Id : Entity_Id; Prag : Node_Id; begin -- All temporaries generated in this routine must be inserted before -- the related loop statement. Ensure that the proper scope is on the -- stack when analyzing the temporaries. Note that we also use the -- Sloc of the related loop. Push_Scope (Scope (Loop_Scop)); -- Step 1: Create the declaration of the flag which controls the -- behavior of the assertion on the first iteration of the loop. if No (Flag_Id) then -- Generate: -- Flag : Boolean := False; Flag_Id := Make_Temporary (Loop_Loc, 'F'); Insert_Action (Loop_Stmt, Make_Object_Declaration (Loop_Loc, Defining_Identifier => Flag_Id, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loop_Loc), Expression => New_Occurrence_Of (Standard_False, Loop_Loc))); -- Prevent an unwanted optimization where the Current_Value of -- the flag eliminates the if statement which stores the variant -- values coming from the previous iteration. -- Flag : Boolean := False; -- loop -- if Flag then -- condition rewritten to False -- Old_N := Curr_N; -- and if statement eliminated -- end if; -- . . . -- Flag := True; -- end loop; Set_Current_Value (Flag_Id, Empty); end if; -- Step 2: Create the temporaries which store the old and current -- values of the associated expression. -- Generate: -- Curr : <type of Expr>; Curr_Id := Make_Temporary (Loc, 'C'); Insert_Action (Loop_Stmt, Make_Object_Declaration (Loop_Loc, Defining_Identifier => Curr_Id, Object_Definition => New_Occurrence_Of (Expr_Typ, Loop_Loc))); -- Generate: -- Old : <type of Expr>; Old_Id := Make_Temporary (Loc, 'P'); Insert_Action (Loop_Stmt, Make_Object_Declaration (Loop_Loc, Defining_Identifier => Old_Id, Object_Definition => New_Occurrence_Of (Expr_Typ, Loop_Loc))); -- Restore original scope after all temporaries have been analyzed Pop_Scope; -- Step 3: Store value of the expression from the previous iteration if No (Old_Assign) then Old_Assign := New_List; end if; -- Generate: -- Old := Curr; Append_To (Old_Assign, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Old_Id, Loc), Expression => New_Occurrence_Of (Curr_Id, Loc))); -- Step 4: Store the current value of the expression if No (Curr_Assign) then Curr_Assign := New_List; end if; -- Generate: -- Curr := <Expr>; Append_To (Curr_Assign, Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Curr_Id, Loc), Expression => Relocate_Node (Expr))); -- Step 5: Create corresponding assertion to verify change of value -- Generate: -- pragma Check (Loop_Variant, Curr <|> Old); Prag := Make_Pragma (Loc, Chars => Name_Check, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Expression => Make_Identifier (Loc, Name_Loop_Variant)), Make_Pragma_Argument_Association (Loc, Expression => Make_Variant_Comparison (Loc, Mode => Chars (Variant), Curr_Val => New_Occurrence_Of (Curr_Id, Loc), Old_Val => New_Occurrence_Of (Old_Id, Loc))))); -- Generate: -- if Curr /= Old then -- <Prag>; if No (If_Stmt) then -- When there is just one termination variant, do not compare the -- old and current value for equality, just check the pragma. if Is_Last then If_Stmt := Prag; else If_Stmt := Make_If_Statement (Loc, Condition => Make_Op_Ne (Loc, Left_Opnd => New_Occurrence_Of (Curr_Id, Loc), Right_Opnd => New_Occurrence_Of (Old_Id, Loc)), Then_Statements => New_List (Prag)); end if; -- Generate: -- else -- <Prag>; -- end if; elsif Is_Last then Set_Else_Statements (If_Stmt, New_List (Prag)); -- Generate: -- elsif Curr /= Old then -- <Prag>; else if Elsif_Parts (If_Stmt) = No_List then Set_Elsif_Parts (If_Stmt, New_List); end if; Append_To (Elsif_Parts (If_Stmt), Make_Elsif_Part (Loc, Condition => Make_Op_Ne (Loc, Left_Opnd => New_Occurrence_Of (Curr_Id, Loc), Right_Opnd => New_Occurrence_Of (Old_Id, Loc)), Then_Statements => New_List (Prag))); end if; end Process_Variant; -- Start of processing for Expand_Pragma_Loop_Variant begin -- If pragma is not enabled, rewrite as Null statement. If pragma is -- disabled, it has already been rewritten as a Null statement. if Is_Ignored (N) then Rewrite (N, Make_Null_Statement (Loc)); Analyze (N); return; end if; -- The expansion of Loop_Variant is quite distributed as it produces -- various statements to capture and compare the arguments. To preserve -- the original context, set the Is_Assertion_Expr flag. This aids the -- Ghost legality checks when verifying the placement of a reference to -- a Ghost entity. In_Assertion_Expr := In_Assertion_Expr + 1; -- Locate the enclosing loop for which this assertion applies. In the -- case of Ada 2012 array iteration, we might be dealing with nested -- loops. Only the outermost loop has an identifier. Loop_Stmt := N; while Present (Loop_Stmt) loop if Nkind (Loop_Stmt) = N_Loop_Statement and then Present (Identifier (Loop_Stmt)) then exit; end if; Loop_Stmt := Parent (Loop_Stmt); end loop; Loop_Scop := Entity (Identifier (Loop_Stmt)); -- Create the circuitry which verifies individual variants Variant := First (Pragma_Argument_Associations (N)); while Present (Variant) loop Process_Variant (Variant, Is_Last => Variant = Last_Var); Next (Variant); end loop; -- Construct the segment which stores the old values of all expressions. -- Generate: -- if Flag then -- <Old_Assign> -- end if; Insert_Action (N, Make_If_Statement (Loc, Condition => New_Occurrence_Of (Flag_Id, Loc), Then_Statements => Old_Assign)); -- Update the values of all expressions Insert_Actions (N, Curr_Assign); -- Add the assertion circuitry to test all changes in expressions. -- Generate: -- if Flag then -- <If_Stmt> -- else -- Flag := True; -- end if; Insert_Action (N, Make_If_Statement (Loc, Condition => New_Occurrence_Of (Flag_Id, Loc), Then_Statements => New_List (If_Stmt), Else_Statements => New_List ( Make_Assignment_Statement (Loc, Name => New_Occurrence_Of (Flag_Id, Loc), Expression => New_Occurrence_Of (Standard_True, Loc))))); -- Note: the pragma has been completely transformed into a sequence of -- corresponding declarations and statements. We leave it in the tree -- for documentation purposes. It will be ignored by the backend. In_Assertion_Expr := In_Assertion_Expr - 1; end Expand_Pragma_Loop_Variant; -------------------------------- -- Expand_Pragma_Psect_Object -- -------------------------------- -- Convert to Common_Object, and expand the resulting pragma procedure Expand_Pragma_Psect_Object (N : Node_Id) renames Expand_Pragma_Common_Object; ------------------------------------- -- Expand_Pragma_Relative_Deadline -- ------------------------------------- procedure Expand_Pragma_Relative_Deadline (N : Node_Id) is P : constant Node_Id := Parent (N); Loc : constant Source_Ptr := Sloc (N); begin -- Expand the pragma only in the case of the main subprogram. For tasks -- the expansion is done in exp_ch9. Generate a call to Set_Deadline -- at Clock plus the relative deadline specified in the pragma. Time -- values are translated into Duration to allow for non-private -- addition operation. if Nkind (P) = N_Subprogram_Body then Rewrite (N, Make_Procedure_Call_Statement (Loc, Name => New_Occurrence_Of (RTE (RE_Set_Deadline), Loc), Parameter_Associations => New_List ( Unchecked_Convert_To (RTE (RO_RT_Time), Make_Op_Add (Loc, Left_Opnd => Make_Function_Call (Loc, New_Occurrence_Of (RTE (RO_RT_To_Duration), Loc), New_List (Make_Function_Call (Loc, New_Occurrence_Of (RTE (RE_Clock), Loc)))), Right_Opnd => Unchecked_Convert_To ( Standard_Duration, Arg_N (N, 1))))))); Analyze (N); end if; end Expand_Pragma_Relative_Deadline; -------------------------------------- -- Expand_Pragma_Subprogram_Variant -- -------------------------------------- -- Aspect Subprogram_Variant is expanded in the following manner: -- Original code -- procedure Proc (Param : T) with -- with Variant (Increases => Incr_Expr, -- Decreases => Decr_Expr) -- <declarations> -- is -- <source statements> -- Proc (New_Param_Value); -- end Proc; -- Expanded code -- procedure Proc (Param : T) is -- Old_Incr : constant <type of Incr_Expr> := <Incr_Expr>; -- Old_Decr : constant <type of Decr_Expr> := <Decr_Expr> ; -- -- procedure Variants (Param : T); -- -- procedure Variants (Param : T) is -- Curr_Incr : constant <type of Incr_Expr> := <Incr_Expr>; -- Curr_Decr : constant <type of Decr_Expr> := <Decr_Expr>; -- begin -- if Curr_Incr /= Old_Incr then -- pragma Check (Variant, Curr_Incr > Old_Incr); -- else -- pragma Check (Variant, Curr_Decr < Old_Decr); -- end if; -- end Variants; -- -- <declarations> -- begin -- <source statements> -- Variants (New_Param_Value); -- Proc (New_Param_Value); -- end Proc; procedure Expand_Pragma_Subprogram_Variant (Prag : Node_Id; Subp_Id : Node_Id; Body_Decls : List_Id) is Curr_Decls : List_Id; If_Stmt : Node_Id := Empty; function Formal_Param_Map (Old_Subp : Entity_Id; New_Subp : Entity_Id) return Elist_Id; -- Given two subprogram entities Old_Subp and New_Subp with the same -- number of formal parameters return a list of the form: -- -- old formal 1 -- new formal 1 -- old formal 2 -- new formal 2 -- ... -- -- as required by New_Copy_Tree to replace references to formal -- parameters of Old_Subp with references to formal parameters of -- New_Subp. procedure Process_Variant (Variant : Node_Id; Formal_Map : Elist_Id; Prev_Decl : in out Node_Id; Is_Last : Boolean); -- Process a single increasing / decreasing termination variant given by -- a component association Variant. Formal_Map is a list of formal -- parameters of the annotated subprogram and of the internal procedure -- that verifies the variant in the format required by New_Copy_Tree. -- The Old_... object created by this routine will be appended after -- Prev_Decl and is stored in this parameter for a next call to this -- routine. Is_Last is True when there are no more variants to process. ---------------------- -- Formal_Param_Map -- ---------------------- function Formal_Param_Map (Old_Subp : Entity_Id; New_Subp : Entity_Id) return Elist_Id is Old_Formal : Entity_Id := First_Formal (Old_Subp); New_Formal : Entity_Id := First_Formal (New_Subp); Param_Map : Elist_Id; begin if Present (Old_Formal) then Param_Map := New_Elmt_List; while Present (Old_Formal) and then Present (New_Formal) loop Append_Elmt (Old_Formal, Param_Map); Append_Elmt (New_Formal, Param_Map); Next_Formal (Old_Formal); Next_Formal (New_Formal); end loop; return Param_Map; else return No_Elist; end if; end Formal_Param_Map; --------------------- -- Process_Variant -- --------------------- procedure Process_Variant (Variant : Node_Id; Formal_Map : Elist_Id; Prev_Decl : in out Node_Id; Is_Last : Boolean) is Expr : constant Node_Id := Expression (Variant); Expr_Typ : constant Entity_Id := Etype (Expr); Loc : constant Source_Ptr := Sloc (Expr); Old_Id : Entity_Id; Old_Decl : Node_Id; Curr_Id : Entity_Id; Curr_Decl : Node_Id; Prag : Node_Id; begin -- Create temporaries that store the old values of the associated -- expression. -- Generate: -- Old : constant <type of Expr> := <Expr>; Old_Id := Make_Temporary (Loc, 'P'); Old_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Old_Id, Constant_Present => True, Object_Definition => New_Occurrence_Of (Expr_Typ, Loc), Expression => New_Copy_Tree (Expr)); Insert_After_And_Analyze (Prev_Decl, Old_Decl); Prev_Decl := Old_Decl; -- Generate: -- Curr : constant <type of Expr> := <Expr>; Curr_Id := Make_Temporary (Loc, 'C'); Curr_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Curr_Id, Constant_Present => True, Object_Definition => New_Occurrence_Of (Expr_Typ, Loc), Expression => New_Copy_Tree (Expr, Map => Formal_Map)); Append (Curr_Decl, Curr_Decls); -- Generate: -- pragma Check (Variant, Curr <|> Old); Prag := Make_Pragma (Loc, Chars => Name_Check, Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Loc, Expression => Make_Identifier (Loc, Name_Subprogram_Variant)), Make_Pragma_Argument_Association (Loc, Expression => Make_Variant_Comparison (Loc, Mode => Chars (First (Choices (Variant))), Curr_Val => New_Occurrence_Of (Curr_Id, Loc), Old_Val => New_Occurrence_Of (Old_Id, Loc))))); -- Generate: -- if Curr /= Old then -- <Prag>; if No (If_Stmt) then -- When there is just one termination variant, do not compare -- the old and current value for equality, just check the -- pragma. if Is_Last then If_Stmt := Prag; else If_Stmt := Make_If_Statement (Loc, Condition => Make_Op_Ne (Loc, Left_Opnd => New_Occurrence_Of (Curr_Id, Loc), Right_Opnd => New_Occurrence_Of (Old_Id, Loc)), Then_Statements => New_List (Prag)); end if; -- Generate: -- else -- <Prag>; -- end if; elsif Is_Last then Set_Else_Statements (If_Stmt, New_List (Prag)); -- Generate: -- elsif Curr /= Old then -- <Prag>; else if Elsif_Parts (If_Stmt) = No_List then Set_Elsif_Parts (If_Stmt, New_List); end if; Append_To (Elsif_Parts (If_Stmt), Make_Elsif_Part (Loc, Condition => Make_Op_Ne (Loc, Left_Opnd => New_Occurrence_Of (Curr_Id, Loc), Right_Opnd => New_Occurrence_Of (Old_Id, Loc)), Then_Statements => New_List (Prag))); end if; end Process_Variant; -- Local variables Loc : constant Source_Ptr := Sloc (Prag); Aggr : Node_Id; Formal_Map : Elist_Id; Last : Node_Id; Last_Variant : Node_Id; Proc_Bod : Node_Id; Proc_Decl : Node_Id; Proc_Id : Entity_Id; Proc_Spec : Node_Id; Variant : Node_Id; begin -- Do nothing if pragma is not present or is disabled if Is_Ignored (Prag) then return; end if; Aggr := Expression (First (Pragma_Argument_Associations (Prag))); -- The expansion of Subprogram Variant is quite distributed as it -- produces various statements to capture and compare the arguments. -- To preserve the original context, set the Is_Assertion_Expr flag. -- This aids the Ghost legality checks when verifying the placement -- of a reference to a Ghost entity. In_Assertion_Expr := In_Assertion_Expr + 1; -- Create declaration of the procedure that compares values of the -- variant expressions captured at the start of subprogram with their -- values at the recursive call of the subprogram. Proc_Id := Make_Defining_Identifier (Loc, Name_uVariants); Proc_Spec := Make_Procedure_Specification (Loc, Defining_Unit_Name => Proc_Id, Parameter_Specifications => Copy_Parameter_List (Subp_Id)); Proc_Decl := Make_Subprogram_Declaration (Loc, Proc_Spec); Insert_Before_First_Source_Declaration (Proc_Decl, Body_Decls); Analyze (Proc_Decl); -- Create a mapping between formals of the annotated subprogram (which -- are used to compute values of the variant expression at the start of -- subprogram) and formals of the internal procedure (which are used to -- compute values of of the variant expression at the recursive call). Formal_Map := Formal_Param_Map (Old_Subp => Subp_Id, New_Subp => Proc_Id); -- Process invidual increasing / decreasing variants Last := Proc_Decl; Curr_Decls := New_List; Last_Variant := Nlists.Last (Component_Associations (Aggr)); Variant := First (Component_Associations (Aggr)); while Present (Variant) loop Process_Variant (Variant => Variant, Formal_Map => Formal_Map, Prev_Decl => Last, Is_Last => Variant = Last_Variant); Next (Variant); end loop; -- Create a subprogram body with declarations of objects that capture -- the current values of variant expressions at a recursive call and an -- if-then-else statement that compares current with old values. Proc_Bod := Make_Subprogram_Body (Loc, Specification => Copy_Subprogram_Spec (Proc_Spec), Declarations => Curr_Decls, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc, Statements => New_List (If_Stmt), End_Label => Make_Identifier (Loc, Chars (Proc_Id)))); Insert_After_And_Analyze (Last, Proc_Bod); -- Restore assertion context In_Assertion_Expr := In_Assertion_Expr - 1; -- Rewrite the aspect expression, which is no longer needed, with -- a reference to the procedure that has just been created. We will -- generate a call to this procedure at each recursive call of the -- subprogram that has been annotated with Subprogram_Variant. Rewrite (Aggr, New_Occurrence_Of (Proc_Id, Loc)); end Expand_Pragma_Subprogram_Variant; ------------------------------------------- -- Expand_Pragma_Suppress_Initialization -- ------------------------------------------- procedure Expand_Pragma_Suppress_Initialization (N : Node_Id) is Def_Id : constant Entity_Id := Entity (Arg_N (N, 1)); begin -- Variable case (we have to undo any initialization already done) if Ekind (Def_Id) = E_Variable then Undo_Initialization (Def_Id, N); end if; end Expand_Pragma_Suppress_Initialization; ------------------------- -- Undo_Initialization -- ------------------------- procedure Undo_Initialization (Def_Id : Entity_Id; N : Node_Id) is Init_Call : Node_Id; begin -- When applied to a variable, the default initialization must not be -- done. As it is already done when the pragma is found, we just get rid -- of the call the initialization procedure which followed the object -- declaration. The call is inserted after the declaration, but validity -- checks may also have been inserted and thus the initialization call -- does not necessarily appear immediately after the object declaration. -- We can't use the freezing mechanism for this purpose, since we have -- to elaborate the initialization expression when it is first seen (so -- this elaboration cannot be deferred to the freeze point). -- Find and remove generated initialization call for object, if any Init_Call := Remove_Init_Call (Def_Id, Rep_Clause => N); -- Any default initialization expression should be removed (e.g. -- null defaults for access objects, zero initialization of packed -- bit arrays). Imported objects aren't allowed to have explicit -- initialization, so the expression must have been generated by -- the compiler. if No (Init_Call) and then Present (Expression (Parent (Def_Id))) then Set_Expression (Parent (Def_Id), Empty); end if; -- The object may not have any initialization, but in the presence of -- Initialize_Scalars code is inserted after then declaration, which -- must now be removed as well. The code carries the same source -- location as the declaration itself. if Initialize_Scalars and then Is_Array_Type (Etype (Def_Id)) then declare Init : Node_Id; Nxt : Node_Id; begin Init := Next (Parent (Def_Id)); while not Comes_From_Source (Init) and then Sloc (Init) = Sloc (Def_Id) loop Nxt := Next (Init); Remove (Init); Init := Nxt; end loop; end; end if; end Undo_Initialization; end Exp_Prag;
src/util-serialize-mappers-vector_mapper.ads
Letractively/ada-util
60
499
<reponame>Letractively/ada-util ----------------------------------------------------------------------- -- Util.Serialize.Mappers.Vector_Mapper -- Mapper for vector types -- Copyright (C) 2010, 2011 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Containers; with Ada.Containers.Vectors; with Util.Serialize.Contexts; with Util.Serialize.Mappers.Record_Mapper; with Util.Serialize.IO; generic -- Package that represents the vectors of elements. with package Vectors is new Ada.Containers.Vectors (<>); -- Package that maps the element into a record. with package Element_Mapper is new Record_Mapper (Element_Type => Vectors.Element_Type, others => <>); package Util.Serialize.Mappers.Vector_Mapper is subtype Element_Type is Vectors.Element_Type; subtype Vector is Vectors.Vector; subtype Index_Type is Vectors.Index_Type; type Vector_Type_Access is access all Vector; -- Procedure to give access to the <b>Vector</b> object from the context. type Process_Object is not null access procedure (Ctx : in out Util.Serialize.Contexts.Context'Class; Process : not null access procedure (Item : in out Vector)); -- ----------------------- -- Data context -- ----------------------- -- Data context to get access to the target element. type Vector_Data is new Util.Serialize.Contexts.Data with private; type Vector_Data_Access is access all Vector_Data'Class; -- Get the vector object. function Get_Vector (Data : in Vector_Data) return Vector_Type_Access; -- Set the vector object. procedure Set_Vector (Data : in out Vector_Data; Vector : in Vector_Type_Access); -- ----------------------- -- Record mapper -- ----------------------- type Mapper is new Util.Serialize.Mappers.Mapper with private; type Mapper_Access is access all Mapper'Class; -- Execute the mapping operation on the object associated with the current context. -- The object is extracted from the context and the <b>Execute</b> operation is called. procedure Execute (Handler : in Mapper; Map : in Mapping'Class; Ctx : in out Util.Serialize.Contexts.Context'Class; Value : in Util.Beans.Objects.Object); -- Set the <b>Data</b> vector in the context. procedure Set_Context (Ctx : in out Util.Serialize.Contexts.Context'Class; Data : in Vector_Type_Access); procedure Set_Mapping (Into : in out Mapper; Inner : in Element_Mapper.Mapper_Access); -- Find the mapper associated with the given name. -- Returns null if there is no mapper. function Find_Mapper (Controller : in Mapper; Name : in String) return Util.Serialize.Mappers.Mapper_Access; procedure Start_Object (Handler : in Mapper; Context : in out Util.Serialize.Contexts.Context'Class; Name : in String); procedure Finish_Object (Handler : in Mapper; Context : in out Util.Serialize.Contexts.Context'Class; Name : in String); -- Write the element on the stream using the mapper description. procedure Write (Handler : in Mapper; Stream : in out Util.Serialize.IO.Output_Stream'Class; Element : in Vectors.Vector); private type Vector_Data is new Util.Serialize.Contexts.Data with record Vector : Vector_Type_Access; Position : Index_Type; end record; type Mapper is new Util.Serialize.Mappers.Mapper with record Map : aliased Element_Mapper.Mapper; end record; overriding procedure Initialize (Controller : in out Mapper); end Util.Serialize.Mappers.Vector_Mapper;
PIM/TD3_Sous_Programmes/ecrire_entier.adb
Hathoute/ENSEEIHT
1
16317
<filename>PIM/TD3_Sous_Programmes/ecrire_entier.adb with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure Ecrire_Entier is -- Écrire un entier. -- Paramètres : -- Nombre : l'entier à écrire -- Nécessite : Nombre >= 0 -- Nombre positif -- Assure : -- Nombre est écrit procedure Ecrire_Recursif (Nombre: in Integer) is Chiffre: Integer; Char: Character; begin if Nombre < 10 then Put(Character'Val (Character'Pos('0') + Nombre)); return; end if; Chiffre := Nombre mod 10; Char := Character'Val (Character'Pos('0') + Chiffre); Ecrire_Recursif(Nombre / 10); Put(Char); end Ecrire_Recursif; -- Écrire un entier. -- Paramètres : -- Nombre : l'entier à écrire -- Nécessite : Nombre >= 0 -- Nombre positif -- Assure : -- Nombre est écrit procedure Ecrire_Iteratif (Nombre: in Integer) is Iteration: Integer; Nbr: Integer; begin Iteration := 0; Nbr := Nombre; while (Nombre / 10**Iteration) > 9 loop Iteration := Iteration + 1; end loop; for I in reverse 0 .. Iteration loop Put(Character'Val (Character'Pos('0') + (Nbr / 10 ** I))); Nbr := Nbr mod (10 ** I); end loop; end Ecrire_Iteratif; -- Écrire un entier. -- Paramètres : -- Nombre : l'entier à écrire -- Nécessite : --- -- Assure : -- Nombre est écrit procedure Ecrire (Nombre: in Integer) is begin -- Cas special: Integer'FIRST if Nombre = Integer'First then Put("-2"); Ecrire_Recursif((-1*Nombre) mod 1000000000); elsif Nombre < 0 then Put('-'); Ecrire_Recursif(-1*Nombre); else Ecrire_Recursif(Nombre); end if; end Ecrire; Un_Entier: Integer; -- un entier lu au clavier Message: constant String := "L'entier lu est "; begin -- Demander un entier Put ("Un entier : "); Get (Un_Entier); -- Afficher l'entier lu avec les différents sous-programmes if Un_Entier >= 0 then -- L'afficher avec Ecrire_Recursif Put (Message & "(Ecrire_Recursif) : "); Ecrire_Recursif (Un_Entier); New_Line; -- L'afficher avec Ecrire_Iteratif Put (Message & "(Ecrire_Iteratif) : "); Ecrire_Iteratif (Un_Entier); New_Line; else Put_Line ("Le nombre est négatif. " & "On ne peut utiliser ni Ecrire_Recursif ni Ecrire_Iteratif."); end if; -- L'afficher avec Ecrire Put (Message & "(Ecrire) : "); Ecrire (Un_Entier); New_Line; end Ecrire_Entier;
test/Fail/UselessAbstractAbstract.agda
redfish64/autonomic-agda
3
3548
module UselessAbstractAbstract where A : Set₁ abstract abstract A = Set
scripts/SaffronCity.asm
opiter09/ASM-Machina
1
103172
<gh_stars>1-10 SaffronCity_Script: jp EnableAutoTextBoxDrawing SaffronCity_TextPointers: dw SaffronCityText1 dw SaffronCityText2 dw SaffronCityText3 dw SaffronCityText4 dw SaffronCityText5 dw SaffronCityText6 dw SaffronCityText7 dw SaffronCityText8 dw SaffronCityText9 dw SaffronCityText10 dw SaffronCityText11 dw SaffronCityText12 dw SaffronCityText13 dw SaffronCityText14 dw SaffronCityText15 dw SaffronCityText16 dw SaffronCityText17 dw SaffronCityText18 dw MartSignText dw SaffronCityText20 dw SaffronCityText21 dw SaffronCityText22 dw PokeCenterSignText dw SaffronCityText24 dw SaffronCityText25 SaffronCityText1: text_far _SaffronCityText1 text_end SaffronCityText2: text_far _SaffronCityText2 text_end SaffronCityText3: text_far _SaffronCityText3 text_end SaffronCityText4: text_far _SaffronCityText4 text_end SaffronCityText5: text_far _SaffronCityText5 text_end SaffronCityText6: text_far _SaffronCityText6 text_end SaffronCityText7: text_far _SaffronCityText7 text_end SaffronCityText8: text_far _SaffronCityText8 text_end SaffronCityText9: text_far _SaffronCityText9 text_end SaffronCityText10: text_far _SaffronCityText10 text_end SaffronCityText11: text_far _SaffronCityText11 text_end SaffronCityText12: text_far _SaffronCityText12 sound_cry_pidgeot text_end SaffronCityText13: text_far _SaffronCityText13 text_end SaffronCityText14: text_far _SaffronCityText14 text_end SaffronCityText15: text_far _SaffronCityText15 text_end SaffronCityText16: text_far _SaffronCityText16 text_end SaffronCityText17: text_far _SaffronCityText17 text_end SaffronCityText18: text_far _SaffronCityText18 text_end SaffronCityText20: text_far _SaffronCityText20 text_end SaffronCityText21: text_far _SaffronCityText21 text_end SaffronCityText22: text_far _SaffronCityText22 text_end SaffronCityText24: text_far _SaffronCityText24 text_end SaffronCityText25: text_far _SaffronCityText25 text_end
agda-stdlib/src/Data/Integer/GCD.agda
DreamLinuxer/popl21-artifact
5
4239
<reponame>DreamLinuxer/popl21-artifact<filename>agda-stdlib/src/Data/Integer/GCD.agda ------------------------------------------------------------------------ -- The Agda standard library -- -- Greatest Common Divisor for integers ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Integer.GCD where open import Data.Integer.Base open import Data.Integer.Divisibility open import Data.Integer.Properties open import Data.Nat.Base import Data.Nat.GCD as ℕ open import Relation.Binary.PropositionalEquality ------------------------------------------------------------------------ -- Definition ------------------------------------------------------------------------ gcd : ℤ → ℤ → ℤ gcd i j = + ℕ.gcd ∣ i ∣ ∣ j ∣ ------------------------------------------------------------------------ -- Properties ------------------------------------------------------------------------ gcd[i,j]∣i : ∀ i j → gcd i j ∣ i gcd[i,j]∣i i j = ℕ.gcd[m,n]∣m ∣ i ∣ ∣ j ∣ gcd[i,j]∣j : ∀ i j → gcd i j ∣ j gcd[i,j]∣j i j = ℕ.gcd[m,n]∣n ∣ i ∣ ∣ j ∣ gcd-greatest : ∀ {i j c} → c ∣ i → c ∣ j → c ∣ gcd i j gcd-greatest c∣i c∣j = ℕ.gcd-greatest c∣i c∣j gcd[0,0]≡0 : gcd 0ℤ 0ℤ ≡ 0ℤ gcd[0,0]≡0 = cong (+_) ℕ.gcd[0,0]≡0 gcd[i,j]≡0⇒i≡0 : ∀ i j → gcd i j ≡ 0ℤ → i ≡ 0ℤ gcd[i,j]≡0⇒i≡0 i j eq = ∣n∣≡0⇒n≡0 (ℕ.gcd[m,n]≡0⇒m≡0 (+-injective eq)) gcd[i,j]≡0⇒j≡0 : ∀ {i j} → gcd i j ≡ 0ℤ → j ≡ 0ℤ gcd[i,j]≡0⇒j≡0 {i} eq = ∣n∣≡0⇒n≡0 (ℕ.gcd[m,n]≡0⇒n≡0 ∣ i ∣ (+-injective eq)) gcd-comm : ∀ i j → gcd i j ≡ gcd j i gcd-comm i j = cong (+_) (ℕ.gcd-comm ∣ i ∣ ∣ j ∣)
src/main/python/hello/Hello.g4
cjblink1/lang
0
2949
grammar Hello; r : 'hello' ID ; ID : [a-z]+ ; WS : [ \t\r\n]+ -> skip;
playground/Gen1/Serial.asm
marcelocaetano/XSharp
168
245060
<gh_stars>100-1000 ; Generated at 4/14/2019 1:59:47 AM %ifndef Exclude_IOPort_Based_SerialInit DebugStub_InitSerial: mov DX, 0x1 mov AL, 0x0 Call DebugStub_WriteRegister mov DX, 0x3 mov AL, 0x80 Call DebugStub_WriteRegister mov DX, 0x0 mov AL, 0x1 Call DebugStub_WriteRegister mov DX, 0x1 mov AL, 0x0 Call DebugStub_WriteRegister mov DX, 0x3 mov AL, 0x3 Call DebugStub_WriteRegister mov DX, 0x2 mov AL, 0xC7 Call DebugStub_WriteRegister mov DX, 0x4 mov AL, 0x3 Call DebugStub_WriteRegister DebugStub_InitSerial_Exit: mov dword [INTs_LastKnownAddress], DebugStub_InitSerial_Exit Ret DebugStub_ComReadAL: mov DX, 0x5 DebugStub_ComReadAL_Wait: Call DebugStub_ReadRegister test AL, 0x1 JE near DebugStub_ComReadAL_Wait mov DX, 0x0 Call DebugStub_ReadRegister DebugStub_ComReadAL_Exit: mov dword [INTs_LastKnownAddress], DebugStub_ComReadAL_Exit Ret DebugStub_ComWrite8: mov DX, 0x5 DebugStub_ComWrite8_Wait: Call DebugStub_ReadRegister test AL, 0x20 JE near DebugStub_ComWrite8_Wait mov DX, 0x0 mov AL, byte [ESI] Call DebugStub_WriteRegister inc dword ESI DebugStub_ComWrite8_Exit: mov dword [INTs_LastKnownAddress], DebugStub_ComWrite8_Exit Ret %endif
source/amf/utp/amf-internals-tables-utp_attributes.adb
svn2github/matreshka
24
23313
<reponame>svn2github/matreshka ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2013, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Internals.Links; with AMF.Internals.Tables.Primitive_Types_Notification; with AMF.Internals.Tables.UTP_Element_Table; with AMF.Internals.Tables.UTP_Types; with AMF.Internals.Tables.Utp_Metamodel; with AMF.Internals.Tables.Utp_Notification; package body AMF.Internals.Tables.UTP_Attributes is use type Matreshka.Internals.Strings.Shared_String_Access; -- CodingRule -- -- 2 CodingRule::base_Namespace -- 3 CodingRule::base_Property -- 1 CodingRule::base_ValueSpecification -- 4 CodingRule::coding -- -- DataPartition -- -- 1 DataPartition::base_Classifier -- -- DataPool -- -- 1 DataPool::base_Classifier -- 2 DataPool::base_Property -- -- DataSelector -- -- 1 DataSelector::base_Operation -- -- Default -- -- 1 Default::base_Behavior -- -- DefaultApplication -- -- 1 DefaultApplication::base_Dependency -- 2 DefaultApplication::repetition -- -- DetermAlt -- -- 1 DetermAlt::base_CombinedFragment -- -- FinishAction -- -- 2 FinishAction::base_InvocationAction -- 1 FinishAction::base_OpaqueAction -- -- GetTimezoneAction -- -- 1 GetTimezoneAction::base_ReadStructuralFeatureAction -- -- LiteralAny -- -- 1 LiteralAny::base_LiteralSpecification -- -- LiteralAnyOrNull -- -- 1 LiteralAnyOrNull::base_LiteralSpecification -- -- LogAction -- -- 1 LogAction::base_SendObjectAction -- -- ManagedElement -- -- 1 ManagedElement::base_Element -- 5 ManagedElement::criticality -- 3 ManagedElement::description -- 2 ManagedElement::owner -- 4 ManagedElement::version -- -- ReadTimerAction -- -- 1 ReadTimerAction::base_CallOperationAction -- -- SUT -- -- 1 SUT::base_Property -- -- SetTimezoneAction -- -- 1 SetTimezoneAction::base_WriteStructuralFeatureAction -- -- StartTimerAction -- -- 1 StartTimerAction::base_CallOperationAction -- -- StopTimerAction -- -- 1 StopTimerAction::base_CallOperationAction -- -- TestCase -- -- 4 TestCase::base_Behavior -- 5 TestCase::base_Operation -- 2 TestCase::compatibleSUTVariant -- 1 TestCase::compatibleSUTVersion -- 3 TestCase::priority -- -- TestComponent -- -- 3 TestComponent::base_StructuredClassifier -- 2 TestComponent::compatibleSUTVariant -- 1 TestComponent::compatibleSUTVersion -- -- TestContext -- -- 4 TestContext::base_BehavioredClassifier -- 3 TestContext::base_StructuredClassifier -- 2 TestContext::compatibleSUTVariant -- 1 TestContext::compatibleSUTVersion -- 5 TestContext::testLevel -- -- TestLog -- -- 1 TestLog::base_Behavior -- 4 TestLog::duration -- 3 TestLog::executedAt -- 7 TestLog::sutVersion -- 2 TestLog::tester -- 5 TestLog::verdict -- 6 TestLog::verdictReason -- -- TestLogApplication -- -- 1 TestLogApplication::base_Dependency -- -- TestObjective -- -- 1 TestObjective::base_Dependency -- 3 TestObjective::priority -- -- TestSuite -- -- 1 TestSuite::base_Behavior -- 3 TestSuite::priority -- -- 1 TestSuite::testCase -- TimeOut -- -- 1 TimeOut::base_TimeEvent -- -- TimeOutAction -- -- 1 TimeOutAction::base_AcceptEventAction -- -- TimeOutMessage -- -- 1 TimeOutMessage::base_Message -- -- TimerRunningAction -- -- 1 TimerRunningAction::base_ReadStructuralFeatureAction -- -- ValidationAction -- -- 1 ValidationAction::base_CallOperationAction -- ------------------------------------------- -- Internal_Get_Base_Accept_Event_Action -- ------------------------------------------- function Internal_Get_Base_Accept_Event_Action (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out_Action => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Accept_Event_Action; -------------------------------- -- Internal_Get_Base_Behavior -- -------------------------------- function Internal_Get_Base_Behavior (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Default => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Case => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Log => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Suite => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Behavior; --------------------------------------------- -- Internal_Get_Base_Behaviored_Classifier -- --------------------------------------------- function Internal_Get_Base_Behaviored_Classifier (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Context => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Behaviored_Classifier; --------------------------------------------- -- Internal_Get_Base_Call_Operation_Action -- --------------------------------------------- function Internal_Get_Base_Call_Operation_Action (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Read_Timer_Action => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Start_Timer_Action => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Stop_Timer_Action => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Validation_Action => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Call_Operation_Action; ---------------------------------- -- Internal_Get_Base_Classifier -- ---------------------------------- function Internal_Get_Base_Classifier (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Partition => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Pool => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Classifier; ----------------------------------------- -- Internal_Get_Base_Combined_Fragment -- ----------------------------------------- function Internal_Get_Base_Combined_Fragment (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Determ_Alt => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Combined_Fragment; ---------------------------------- -- Internal_Get_Base_Dependency -- ---------------------------------- function Internal_Get_Base_Dependency (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Default_Application => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Log_Application => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Objective => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Dependency; ------------------------------- -- Internal_Get_Base_Element -- ------------------------------- function Internal_Get_Base_Element (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Managed_Element => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Element; ----------------------------------------- -- Internal_Get_Base_Invocation_Action -- ----------------------------------------- function Internal_Get_Base_Invocation_Action (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Finish_Action => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Invocation_Action; --------------------------------------------- -- Internal_Get_Base_Literal_Specification -- --------------------------------------------- function Internal_Get_Base_Literal_Specification (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Literal_Any => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Literal_Any_Or_Null => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Literal_Specification; ------------------------------- -- Internal_Get_Base_Message -- ------------------------------- function Internal_Get_Base_Message (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out_Message => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Message; --------------------------------- -- Internal_Get_Base_Namespace -- --------------------------------- function Internal_Get_Base_Namespace (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Namespace; ------------------------------------- -- Internal_Get_Base_Opaque_Action -- ------------------------------------- function Internal_Get_Base_Opaque_Action (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Finish_Action => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Opaque_Action; --------------------------------- -- Internal_Get_Base_Operation -- --------------------------------- function Internal_Get_Base_Operation (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Selector => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Case => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Operation; -------------------------------- -- Internal_Get_Base_Property -- -------------------------------- function Internal_Get_Base_Property (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Pool => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_SUT => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Property; ------------------------------------------------------ -- Internal_Get_Base_Read_Structural_Feature_Action -- ------------------------------------------------------ function Internal_Get_Base_Read_Structural_Feature_Action (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Get_Timezone_Action => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Timer_Running_Action => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Read_Structural_Feature_Action; ------------------------------------------ -- Internal_Get_Base_Send_Object_Action -- ------------------------------------------ function Internal_Get_Base_Send_Object_Action (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Log_Action => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Send_Object_Action; --------------------------------------------- -- Internal_Get_Base_Structured_Classifier -- --------------------------------------------- function Internal_Get_Base_Structured_Classifier (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Component => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).Link, Self); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Context => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Structured_Classifier; ---------------------------------- -- Internal_Get_Base_Time_Event -- ---------------------------------- function Internal_Get_Base_Time_Event (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Time_Event; ------------------------------------------- -- Internal_Get_Base_Value_Specification -- ------------------------------------------- function Internal_Get_Base_Value_Specification (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Value_Specification; ------------------------------------------------------- -- Internal_Get_Base_Write_Structural_Feature_Action -- ------------------------------------------------------- function Internal_Get_Base_Write_Structural_Feature_Action (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Set_Timezone_Action => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Base_Write_Structural_Feature_Action; ------------------------- -- Internal_Get_Coding -- ------------------------- function Internal_Get_Coding (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value; end Internal_Get_Coding; ----------------------------------------- -- Internal_Get_Compatible_SUT_Variant -- ----------------------------------------- function Internal_Get_Compatible_SUT_Variant (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_String is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).String_Collection; end Internal_Get_Compatible_SUT_Variant; ----------------------------------------- -- Internal_Get_Compatible_SUT_Version -- ----------------------------------------- function Internal_Get_Compatible_SUT_Version (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_String is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (1).String_Collection; end Internal_Get_Compatible_SUT_Version; ------------------------------ -- Internal_Get_Criticality -- ------------------------------ function Internal_Get_Criticality (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).String_Value; end Internal_Get_Criticality; ------------------------------ -- Internal_Get_Description -- ------------------------------ function Internal_Get_Description (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value; end Internal_Get_Description; --------------------------- -- Internal_Get_Duration -- --------------------------- function Internal_Get_Duration (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value; end Internal_Get_Duration; ------------------------------ -- Internal_Get_Executed_At -- ------------------------------ function Internal_Get_Executed_At (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value; end Internal_Get_Executed_At; ------------------------ -- Internal_Get_Owner -- ------------------------ function Internal_Get_Owner (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).String_Value; end Internal_Get_Owner; --------------------------- -- Internal_Get_Priority -- --------------------------- function Internal_Get_Priority (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value; end Internal_Get_Priority; ----------------------------- -- Internal_Get_Repetition -- ----------------------------- function Internal_Get_Repetition (Self : AMF.Internals.AMF_Element) return AMF.Unlimited_Natural is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Unlimited_Natural_Value; end Internal_Get_Repetition; ------------------------------ -- Internal_Get_Sut_Version -- ------------------------------ function Internal_Get_Sut_Version (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (7).String_Value; end Internal_Get_Sut_Version; ---------------------------- -- Internal_Get_Test_Case -- ---------------------------- function Internal_Get_Test_Case (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Suite => return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (0).Collection + 1; when others => raise Program_Error; end case; end Internal_Get_Test_Case; ----------------------------- -- Internal_Get_Test_Level -- ----------------------------- function Internal_Get_Test_Level (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).String_Value; end Internal_Get_Test_Level; ------------------------- -- Internal_Get_Tester -- ------------------------- function Internal_Get_Tester (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_String is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).String_Collection; end Internal_Get_Tester; -------------------------- -- Internal_Get_Verdict -- -------------------------- function Internal_Get_Verdict (Self : AMF.Internals.AMF_Element) return AMF.Utp.Utp_Verdict is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).Verdict_Value; end Internal_Get_Verdict; --------------------------------- -- Internal_Get_Verdict_Reason -- --------------------------------- function Internal_Get_Verdict_Reason (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (6).String_Value; end Internal_Get_Verdict_Reason; -------------------------- -- Internal_Get_Version -- -------------------------- function Internal_Get_Version (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value; end Internal_Get_Version; ------------------------------------------- -- Internal_Set_Base_Accept_Event_Action -- ------------------------------------------- procedure Internal_Set_Base_Accept_Event_Action (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out_Action => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Time_Out_Action_Base_Accept_Event_Action_Extension_Time_Out_Action, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Accept_Event_Action; -------------------------------- -- Internal_Set_Base_Behavior -- -------------------------------- procedure Internal_Set_Base_Behavior (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Default => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Default_Base_Behavior_Extension_Default, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Case => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Case_Base_Behavior_Extension_Test_Case, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Log => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Log_Base_Behavior_Extension_Test_Log, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Suite => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Suite_Base_Behavior_Extension_Test_Suite, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Behavior; --------------------------------------------- -- Internal_Set_Base_Behaviored_Classifier -- --------------------------------------------- procedure Internal_Set_Base_Behaviored_Classifier (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Context => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Context_Base_Behaviored_Classifier_Extension_Test_Context, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Behaviored_Classifier; --------------------------------------------- -- Internal_Set_Base_Call_Operation_Action -- --------------------------------------------- procedure Internal_Set_Base_Call_Operation_Action (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Read_Timer_Action => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Read_Timer_Action_Base_Call_Operation_Action_Extension_Read_Timer_Action, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Start_Timer_Action => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Start_Timer_Action_Base_Call_Operation_Action_Extension_Start_Timer_Action, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Stop_Timer_Action => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Stop_Timer_Action_Base_Call_Operation_Action_Extension_Stop_Timer_Action, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Validation_Action => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Validation_Action_Base_Call_Operation_Action_Extension_Validation_Action, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Call_Operation_Action; ---------------------------------- -- Internal_Set_Base_Classifier -- ---------------------------------- procedure Internal_Set_Base_Classifier (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Partition => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Data_Partition_Base_Classifier_Extension_Data_Partition, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Pool => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Data_Pool_Base_Classifier_Extension_Data_Pool, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Classifier; ----------------------------------------- -- Internal_Set_Base_Combined_Fragment -- ----------------------------------------- procedure Internal_Set_Base_Combined_Fragment (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Determ_Alt => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Determ_Alt_Base_Combined_Fragment_Extension_Determ_Alt, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Combined_Fragment; ---------------------------------- -- Internal_Set_Base_Dependency -- ---------------------------------- procedure Internal_Set_Base_Dependency (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Default_Application => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Default_Application_Base_Dependency_Extension_Default_Application, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Log_Application => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Log_Application_Base_Dependency_Extension_Test_Log_Application, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Objective => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Objective_Base_Dependency_Extension_Test_Objective, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Dependency; ------------------------------- -- Internal_Set_Base_Element -- ------------------------------- procedure Internal_Set_Base_Element (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Managed_Element => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Managed_Element_Base_Element_Extension_Managed_Element, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Element; ----------------------------------------- -- Internal_Set_Base_Invocation_Action -- ----------------------------------------- procedure Internal_Set_Base_Invocation_Action (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Finish_Action => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Finish_Action_Base_Invocation_Action_Extension_Finish_Action, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Invocation_Action; --------------------------------------------- -- Internal_Set_Base_Literal_Specification -- --------------------------------------------- procedure Internal_Set_Base_Literal_Specification (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Literal_Any => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Literal_Any_Base_Literal_Specification_Extension_Literal_Any, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Literal_Any_Or_Null => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Literal_Any_Or_Null_Base_Literal_Specification_Extension_Literal_Any_Or_Null, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Literal_Specification; ------------------------------- -- Internal_Set_Base_Message -- ------------------------------- procedure Internal_Set_Base_Message (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out_Message => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Time_Out_Message_Base_Message_Extension_Time_Out_Message, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Message; --------------------------------- -- Internal_Set_Base_Namespace -- --------------------------------- procedure Internal_Set_Base_Namespace (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Coding_Rule_Base_Namespace_Extension_Coding_Rule, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Namespace; ------------------------------------- -- Internal_Set_Base_Opaque_Action -- ------------------------------------- procedure Internal_Set_Base_Opaque_Action (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Finish_Action => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Finish_Action_Base_Opaque_Action_Extension_Finish_Action, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Opaque_Action; --------------------------------- -- Internal_Set_Base_Operation -- --------------------------------- procedure Internal_Set_Base_Operation (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Selector => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Data_Selector_Base_Operation_Extension_Data_Selector, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Case => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Case_Base_Operation_Extension_Test_Case, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Operation; -------------------------------- -- Internal_Set_Base_Property -- -------------------------------- procedure Internal_Set_Base_Property (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Coding_Rule_Base_Property_Extension_Coding_Rule, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Data_Pool => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Data_Pool_Base_Property_Extension_Data_Pool, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_SUT => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_SUT_Base_Property_Extension_SUT, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Property; ------------------------------------------------------ -- Internal_Set_Base_Read_Structural_Feature_Action -- ------------------------------------------------------ procedure Internal_Set_Base_Read_Structural_Feature_Action (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Get_Timezone_Action => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Get_Timezone_Action_Base_Read_Structural_Feature_Action_Extension_Get_Timezone_Action, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Timer_Running_Action => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Timer_Running_Action_Base_Read_Structural_Feature_Action_Extension_Timer_Running_Action, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Read_Structural_Feature_Action; ------------------------------------------ -- Internal_Set_Base_Send_Object_Action -- ------------------------------------------ procedure Internal_Set_Base_Send_Object_Action (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Log_Action => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Log_Action_Base_Send_Object_Action_Extension_Log_Action, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Send_Object_Action; --------------------------------------------- -- Internal_Set_Base_Structured_Classifier -- --------------------------------------------- procedure Internal_Set_Base_Structured_Classifier (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Component => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Component_Base_Structured_Classifier_Extension_Test_Component, Self, To); when AMF.Internals.Tables.UTP_Types.E_Utp_Test_Context => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Test_Context_Base_Structured_Classifier_Extension_Test_Context, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Structured_Classifier; ---------------------------------- -- Internal_Set_Base_Time_Event -- ---------------------------------- procedure Internal_Set_Base_Time_Event (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Time_Out => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Time_Out_Base_Time_Event_Extension_Time_Out, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Time_Event; ------------------------------------------- -- Internal_Set_Base_Value_Specification -- ------------------------------------------- procedure Internal_Set_Base_Value_Specification (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Coding_Rule => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Coding_Rule_Base_Value_Specification_Extension_Coding_Rule, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Value_Specification; ------------------------------------------------------- -- Internal_Set_Base_Write_Structural_Feature_Action -- ------------------------------------------------------- procedure Internal_Set_Base_Write_Structural_Feature_Action (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.UTP_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.UTP_Types.E_Utp_Set_Timezone_Action => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.Utp_Metamodel.MA_Utp_Set_Timezone_Action_Base_Write_Structural_Feature_Action_Extension_Set_Timezone_Action, Self, To); when others => raise Program_Error; end case; end Internal_Set_Base_Write_Structural_Feature_Action; ------------------------- -- Internal_Set_Coding -- ------------------------- procedure Internal_Set_Coding (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value; UTP_Element_Table.Table (Self).Member (4).String_Value := To; Matreshka.Internals.Strings.Reference (UTP_Element_Table.Table (Self).Member (4).String_Value); AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Coding_Rule_Coding, Old, To); Matreshka.Internals.Strings.Dereference (Old); end Internal_Set_Coding; ------------------------------ -- Internal_Set_Criticality -- ------------------------------ procedure Internal_Set_Criticality (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).String_Value; UTP_Element_Table.Table (Self).Member (5).String_Value := To; if UTP_Element_Table.Table (Self).Member (5).String_Value /= null then Matreshka.Internals.Strings.Reference (UTP_Element_Table.Table (Self).Member (5).String_Value); end if; AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Managed_Element_Criticality, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Criticality; ------------------------------ -- Internal_Set_Description -- ------------------------------ procedure Internal_Set_Description (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value; UTP_Element_Table.Table (Self).Member (3).String_Value := To; if UTP_Element_Table.Table (Self).Member (3).String_Value /= null then Matreshka.Internals.Strings.Reference (UTP_Element_Table.Table (Self).Member (3).String_Value); end if; AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Managed_Element_Description, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Description; --------------------------- -- Internal_Set_Duration -- --------------------------- procedure Internal_Set_Duration (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value; UTP_Element_Table.Table (Self).Member (4).String_Value := To; if UTP_Element_Table.Table (Self).Member (4).String_Value /= null then Matreshka.Internals.Strings.Reference (UTP_Element_Table.Table (Self).Member (4).String_Value); end if; AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Log_Duration, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Duration; ------------------------------ -- Internal_Set_Executed_At -- ------------------------------ procedure Internal_Set_Executed_At (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value; UTP_Element_Table.Table (Self).Member (3).String_Value := To; if UTP_Element_Table.Table (Self).Member (3).String_Value /= null then Matreshka.Internals.Strings.Reference (UTP_Element_Table.Table (Self).Member (3).String_Value); end if; AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Log_Executed_At, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Executed_At; ------------------------ -- Internal_Set_Owner -- ------------------------ procedure Internal_Set_Owner (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).String_Value; UTP_Element_Table.Table (Self).Member (2).String_Value := To; if UTP_Element_Table.Table (Self).Member (2).String_Value /= null then Matreshka.Internals.Strings.Reference (UTP_Element_Table.Table (Self).Member (2).String_Value); end if; AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Managed_Element_Owner, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Owner; --------------------------- -- Internal_Set_Priority -- --------------------------- procedure Internal_Set_Priority (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (3).String_Value; UTP_Element_Table.Table (Self).Member (3).String_Value := To; if UTP_Element_Table.Table (Self).Member (3).String_Value /= null then Matreshka.Internals.Strings.Reference (UTP_Element_Table.Table (Self).Member (3).String_Value); end if; AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Case_Priority, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Priority; ----------------------------- -- Internal_Set_Repetition -- ----------------------------- procedure Internal_Set_Repetition (Self : AMF.Internals.AMF_Element; To : AMF.Unlimited_Natural) is Old : AMF.Unlimited_Natural; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Unlimited_Natural_Value; AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (2).Unlimited_Natural_Value := To; AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Default_Application_Repetition, Old, To); end Internal_Set_Repetition; ------------------------------ -- Internal_Set_Sut_Version -- ------------------------------ procedure Internal_Set_Sut_Version (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (7).String_Value; UTP_Element_Table.Table (Self).Member (7).String_Value := To; if UTP_Element_Table.Table (Self).Member (7).String_Value /= null then Matreshka.Internals.Strings.Reference (UTP_Element_Table.Table (Self).Member (7).String_Value); end if; AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Log_Sut_Version, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Sut_Version; ----------------------------- -- Internal_Set_Test_Level -- ----------------------------- procedure Internal_Set_Test_Level (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).String_Value; UTP_Element_Table.Table (Self).Member (5).String_Value := To; if UTP_Element_Table.Table (Self).Member (5).String_Value /= null then Matreshka.Internals.Strings.Reference (UTP_Element_Table.Table (Self).Member (5).String_Value); end if; AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Context_Test_Level, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Test_Level; -------------------------- -- Internal_Set_Verdict -- -------------------------- procedure Internal_Set_Verdict (Self : AMF.Internals.AMF_Element; To : AMF.Utp.Utp_Verdict) is Old : AMF.Utp.Utp_Verdict; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).Verdict_Value; AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (5).Verdict_Value := To; AMF.Internals.Tables.Utp_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Log_Verdict, Old, To); end Internal_Set_Verdict; --------------------------------- -- Internal_Set_Verdict_Reason -- --------------------------------- procedure Internal_Set_Verdict_Reason (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (6).String_Value; UTP_Element_Table.Table (Self).Member (6).String_Value := To; if UTP_Element_Table.Table (Self).Member (6).String_Value /= null then Matreshka.Internals.Strings.Reference (UTP_Element_Table.Table (Self).Member (6).String_Value); end if; AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Test_Log_Verdict_Reason, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Verdict_Reason; -------------------------- -- Internal_Set_Version -- -------------------------- procedure Internal_Set_Version (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.UTP_Element_Table.Table (Self).Member (4).String_Value; UTP_Element_Table.Table (Self).Member (4).String_Value := To; if UTP_Element_Table.Table (Self).Member (4).String_Value /= null then Matreshka.Internals.Strings.Reference (UTP_Element_Table.Table (Self).Member (4).String_Value); end if; AMF.Internals.Tables.Primitive_Types_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.Utp_Metamodel.MP_Utp_Managed_Element_Version, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Version; end AMF.Internals.Tables.UTP_Attributes;
_lessons/05-academy/code/academia-3.als
HanielB/2021.1-fm
0
3795
<filename>_lessons/05-academy/code/academia-3.als<gh_stars>0 ---------------- Signatures ---------------- abstract sig Person {} sig Faculty extends Person { incommittee: one Graduate } abstract sig Student extends Person { id: one Id, transcript: set Course, major: one Department } sig Undergrad extends Student {} sig Graduate extends Student { advisor: one Faculty } sig Instructor in Person { department: one Department } sig Course { taughtby: one Instructor, enrolled: some Student, waitlist: set Student, prerequisites: set Course } sig Id {} sig Department { courses: some Course, required: some Course } ---------------- Fact ---------------- fact { -- All instructors are either Faculty or Graduate Students all i: Instructor | i in Faculty+Graduate -- No one is waiting for a course unless someone is enrolled all c: Course | some c.waitlist => some c.enrolled -- Graduate students do not teach courses they are enrolled in -- or wainting to enroll in all c: Course | c.taughtby !in c.enrolled + c.waitlist -- No student is enrolled and on the waitlist for the same course all c: Course | no (c.enrolled & c.waitlist) -- No two distinct students have the same ID all s1,s2: Student | s1 != s2 => s1.id != s2.id -- There are no cycles in the prerequisite dependences all c: Course | c !in c.^prerequisites -- A student can only have, wait for or take a course for which they have the prerequisites all s: Student | (waitlist.s + enrolled.s + s.transcript).prerequisites in s.transcript -- Each department has at least one instructor all d: Department | some department.d -- Each course is in a single department all c: Course | one c.~courses and one c.~required -- Advisors are always on their student's committees all g: Graduate | some incommittee.g => g.advisor in incommittee.g -- Students are advised by faculty in their major all g: Graduate | g.advisor in department.(g.major) -- Required courses for a major are courses in that major all d: Department | d.required in d.courses -- Only faculty teach required courses all d: Department | d.required.taughtby in Faculty -- Faculty members only teach courses in their department all f: Faculty | courses.(taughtby.f) = f.department -- Students must be enrolled in at least one course from their major all s: Student | some (enrolled.s & s.major.courses) } ------------------- Run --------------------- pred RealismConstraints [] { -- There is a graduate student who is an instructor some Graduate & Instructor -- There are at least two courses #Course >= 2 -- There are at least three undergraduates #Undergrad > 2 -- There exists a course with prerequisites that someone is enrolled in some c: Course | some c.prerequisites and some c.enrolled -- There are at least two departments and some required courses. #Department > 1 some Department.required } run RealismConstraints ---------------- Assertion ---------------- -- No instructor is on the waitlist for a course that he/she teaches assert NoWaitingTeacher { all c: Course | no (c.taughtby & c.waitlist) } // check NoWaitingTeacher for 10 -- A student's committee members are faculty in his/her major. assert CommitteeMembersInMajor { all s: Student | (incommittee.s).department in s.major } // check CommitteeMembersInMajor
source/calendar/machine-apple-darwin/s-naexti.adb
ytomino/drake
33
241
<filename>source/calendar/machine-apple-darwin/s-naexti.adb with System.Native_Time; with C.sys.resource; with C.sys.time; package body System.Native_Execution_Time is use type C.signed_int; function To_Duration (D : C.sys.time.struct_timeval) return Duration; function To_Duration (D : C.sys.time.struct_timeval) return Duration is begin return Native_Time.To_Duration (Native_Time.To_timespec (D)); end To_Duration; -- implementation function Clock return CPU_Time is rusage : aliased C.sys.resource.struct_rusage; begin if C.sys.resource.getrusage ( C.sys.resource.RUSAGE_SELF, rusage'Access) < 0 then raise Program_Error; -- ??? else return To_Duration (rusage.ru_utime); end if; end Clock; end System.Native_Execution_Time;
other.7z/SFC.7z/SFC/ソースデータ/srd13-SFCマリオコレクション/export/mario-z/linkp/mario_n2/mn_hp_smending.asm
prismotizm/gigaleak
0
168174
Name: mn_hp_smending.asm Type: file Size: 14783 Last-Modified: '1993-08-25T07:33:50Z' SHA-1: 0ED3C8AE67A3F407A4C301347A7556D51E2FDB7A Description: null
src/Projects/eu_projects-nodes-risks.ads
fintatarta/eugen
0
16407
<reponame>fintatarta/eugen package EU_Projects.Nodes.Risks is type Risk_Descriptor is new Nodes.Node_Type with private; type Risk_Access is access Risk_Descriptor; type Risk_Label is new Dotted_Identifier; type Risk_Index is new Nodes.Node_Index; type Risk_Severity is (Very_Small, Small, Medium, Large, Very_Large); type Risk_Likeness is (Very_Small, Small, Medium, Large, Very_Large); function New_Risk (Label : Risk_Label; Description : String; Countermeasures : String; Severity : Risk_Severity; Likeness : Risk_Likeness) return Risk_Access; function Label (Item : Risk_Descriptor) return Risk_Label; function Description (Item : Risk_Descriptor) return String; function Countermeasures (Item : Risk_Descriptor) return String; function Severity (Item : Risk_Descriptor) return Risk_Severity; function Likeness (Item : Risk_Descriptor) return Risk_Likeness; function Full_Index (Item : Risk_Descriptor; Prefixed : Boolean) return String; pragma Warnings (Off); function Get_Symbolic_Instant (Item : Risk_Descriptor; Var : Simple_Identifier) return Times.Time_Expressions.Symbolic_Instant is (raise Unknown_Instant_Var); function Get_Symbolic_Duration (Item : Risk_Descriptor; Var : Simple_Identifier) return Times.Time_Expressions.Symbolic_Duration is (raise Unknown_Duration_Var); function Dependency_List (Item : Risk_Descriptor) return Node_Label_Lists.Vector is (Node_Label_Lists.Empty_Vector); pragma Warnings (On); private type Risk_Descriptor is new Nodes.Node_Type with record Countemeasures : Unbounded_String; Severity : Risk_Severity; Likeness : Risk_Likeness; end record; function Full_Index (Item : Risk_Descriptor; Prefixed : Boolean) return String is ("R" & Item.Index_Image); end EU_Projects.Nodes.Risks;
02 Audio Cue Tools/Set autoload off.applescript
streth11/Qlab-Scripts
0
1227
<gh_stars>0 -- @description Set autoload off -- @author <NAME> -- @link bensmithsound.uk -- @version 1.0 -- @testedmacos 10.13.6 -- @testedqlab 4.6.9 -- @about Turns off autoload for the selected cue -- @separateprocess FALSE -- @changelog -- v1.0 + init tell front workspace repeat with eachCue in (selected as list) set autoload of eachCue to false end repeat end tell
sound/sfxasm/9D.asm
NatsumiFox/Sonic-3-93-Nov-03
7
81432
<filename>sound/sfxasm/9D.asm<gh_stars>1-10 9D_Header: sHeaderInit ; Z80 offset is $D288 sHeaderPatch 9D_Patches sHeaderTick $01 sHeaderCh $02 sHeaderSFX $80, $A0, 9D_PSG2, $E1, $05 sHeaderSFX $80, $C0, 9D_PSG3, $E1, $05 9D_PSG2: ssModZ80 $0F, $01, $FF, $17 sVolEnvPSG v00 dc.b nA7, $20 sStop 9D_PSG3: sNoisePSG $E7 ssModZ80 $0F, $01, $FF, $47 sVolEnvPSG v00 dc.b nA7, $20 sStop 9D_Patches:
Sources/Globe_3d/unzip/zip.ads
ForYouEyesOnly/Space-Convoy
1
13045
<gh_stars>1-10 -- ________ ___ ______ ______ ___ -- /___ .. ._/ |.| |.___.\ /. __ .\ __|.| ____ -- / .. / |.| |.____/ |.|__|.| / .. ..| __\ .. \ -- _/ .. /___ |.| |.| === | .. __ .. ||. = .| | = .. | -- /_______/ |_| /__| /__| |_| \__\_| \__\_| -- Zip library -------------- -- Library for manipulating archive files in the Zip format -- -- Pure Ada 95 + code, 100% portable : OS - , CPU - and compiler - independent. -- -- Version / date / download info : see the version, reference, web strings -- defined at the end of the public part of this package. -- Legal licensing note: -- Copyright (c) 1999 .. 2012 <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. -- NB : this is the MIT License, as found 12 - Sep - 2007 on the site -- http://www.opensource.org/licenses/mit - license.php with Zip_Streams; with Ada.Calendar, Ada.Streams.Stream_IO, Ada.Text_IO, Ada.Strings.Unbounded; with Interfaces; package Zip is -------------- -- Zip_info -- -------------- -- Zip_info contains the Zip file name or input stream, -- and the archive's sorted directory type Zip_info is private; ----------------------------------------------------------------------- -- Load the whole .zip directory in archive (from) into a tree, for -- -- fast searching -- ----------------------------------------------------------------------- -- Load from a file procedure Load (info : out Zip_info; from : String; -- Zip file name case_sensitive : Boolean := False); -- Load from a stream procedure Load (info : out Zip_info; from : Zip_Streams.Zipstream_Class; case_sensitive : Boolean := False); Zip_file_Error, Zip_file_open_Error, Duplicate_name : exception; -- Parameter Form added to *_IO.[Open|Create] Form_For_IO_Open_N_Create : Ada.Strings.Unbounded.Unbounded_String := Ada.Strings.Unbounded.Null_Unbounded_String; -- See RM A.8.2 : File Management -- Example : "encoding=8bits" function Is_loaded (info : Zip_info) return Boolean; function Zip_name (info : Zip_info) return String; function Zip_comment (info : Zip_info) return String; function Zip_Stream (info : Zip_info) return Zip_Streams.Zipstream_Class; function Entries (info : Zip_info) return Natural; procedure Delete (info : in out Zip_info); Forgot_to_load_zip_info : exception; -- Data sizes in archive subtype File_size_type is Interfaces.Unsigned_32; --------- -- Compression methods or formats in the "official" PKWARE Zip format. -- Details in appnote.txt, part V.J -- C : supported for compressing -- D : supported for decompressing type PKZip_method is (store, -- C, D shrink, -- C, D reduce_1, -- C, D reduce_2, -- C, D reduce_3, -- C, D reduce_4, -- C, D implode, -- D tokenize, deflate, -- D deflate_e, -- D - Enhanced deflate bzip2, -- D lzma, ppmd, unknown ); -- Technical : translates the method code as set in zip archives function Method_from_code (x : Interfaces.Unsigned_16) return PKZip_method; function Method_from_code (x : Natural) return PKZip_method; -- Internal time definition subtype Time is Zip_Streams.Time; function Convert (date : Ada.Calendar.Time) return Time renames Zip_Streams.Calendar.Convert; function Convert (date : Time) return Ada.Calendar.Time renames Zip_Streams.Calendar.Convert; -- Traverse a whole Zip_info directory in sorted order, giving the -- name for each entry to an user - defined "Action" procedure. -- Concretely, you can process a whole Zip file that way, by extracting data -- with Extract, or open a reader stream with UnZip.Streams. -- See the Comp_Zip or Find_Zip tools as application examples. generic with procedure Action (name : String); -- 'name' is compressed entry's name procedure Traverse (z : Zip_info); -- Same as Traverse, but Action gives also technical informations about the -- compressed entry. generic with procedure Action ( name : String; -- 'name' is compressed entry's name file_index : Positive; comp_size : File_size_type; uncomp_size : File_size_type; crc_32 : Interfaces.Unsigned_32; date_time : Time; method : PKZip_method; unicode_file_name : Boolean ); procedure Traverse_verbose (z : Zip_info); -- Academic : see how well the name tree is balanced procedure Tree_stat (z : Zip_info; total : out Natural; max_depth : out Natural; avg_depth : out Float); -------------------------------------------------------------------------- -- Offsets - various procedures giving 1 - based indexes to local headers -- -------------------------------------------------------------------------- -- Find 1st offset in a Zip stream procedure Find_first_offset (file : Zip_Streams.Zipstream_Class; file_index : out Positive); -- Find offset of a certain compressed file -- in a Zip file (file opened and kept open) procedure Find_offset (file : Zip_Streams.Zipstream_Class; name : String; case_sensitive : Boolean; file_index : out Positive; comp_size : out File_size_type; uncomp_size : out File_size_type); -- Find offset of a certain compressed file in a Zip_info data procedure Find_offset (info : Zip_info; name : String; case_sensitive : Boolean; file_index : out Ada.Streams.Stream_IO.Positive_Count; comp_size : out File_size_type; uncomp_size : out File_size_type); File_name_not_found : exception; procedure Get_sizes (info : Zip_info; name : String; case_sensitive : Boolean; comp_size : out File_size_type; uncomp_size : out File_size_type); -- User - defined procedure for feedback occuring during -- compression or decompression (entry_skipped meaningful -- only for the latter) type Feedback_proc is access procedure (percents_done : Natural; -- %'s completed entry_skipped : Boolean; -- indicates one can show "skipped", no %'s user_abort : out Boolean); -- e.g. transmit a "click on Cancel" here ------------------------------------------------------------------------- -- Goodies - things used internally but that might be generally useful -- ------------------------------------------------------------------------- -- BlockRead : general - purpose procedure (nothing really specific to Zip / -- UnZip) : reads either the whole buffer from a file, or if the end of -- the file lays inbetween, a part of the buffer. -- -- The procedure's names and parameters match Borland Pascal / Delphi subtype Byte is Interfaces.Unsigned_8; type Byte_Buffer is array (Integer range <>) of aliased Byte; type p_Byte_Buffer is access Byte_Buffer; procedure BlockRead (file : Ada.Streams.Stream_IO.File_Type; buffer : out Byte_Buffer; actually_read : out Natural); -- = buffer'Length if no end of file before last buffer element -- Same for general streams -- procedure BlockRead (stream : Zip_Streams.Zipstream_Class; buffer : out Byte_Buffer; actually_read : out Natural); -- = buffer'Length if no end of stream before last buffer element -- Same, but instead of giving actually_read, raises End_Error if -- the buffer cannot be fully read. -- This mimics the 'Read stream attribute; can be a lot faster, depending -- on the compiler's run - time library. procedure BlockRead (stream : Zip_Streams.Zipstream_Class; buffer : out Byte_Buffer); -- This mimics the 'Write stream attribute; can be a lot faster, depending -- on the compiler's run - time library. -- NB : here we can use the root stream type : no question of size, index, .. . procedure BlockWrite (stream : in out Ada.Streams.Root_Stream_Type'Class; buffer : Byte_Buffer); -- This does the same as Ada 2005's Ada.Directories.Exists -- Just there as helper for Ada 95 only systems -- function Exists (name : String) return Boolean; -- Write a string containing line endings (possible from another system) -- into a text file, with the correct native line endings. -- Works for displaying/saving correctly -- CR&LF (DOS/Win), LF (UNIX), CR (Mac OS < 9) -- procedure Put_Multi_Line ( out_file : Ada.Text_IO.File_Type; text : String ); procedure Write_as_text ( out_file : Ada.Text_IO.File_Type; buffer : Byte_Buffer; last_char : in out Character -- track line - ending characters between writes ); -------------------------------------------------------------- -- Information about this package - e.g. for an "about" box -- -------------------------------------------------------------- version : constant String := "43 - pre"; reference : constant String := "14 - Jul - 2012"; web : constant String := "http://unzip - ada.sf.net/"; -- hopefully the latest version is at that URL .. . --- ^ ------------------- -- Private items -- ------------------- private -- Zip_info, 23.VI.1999. -- The PKZIP central directory is coded here as a binary tree -- to allow a fast retrieval of the searched offset in zip file. -- E.g. for a 1000 - file archive, the offset will be found in less -- than 11 moves : 2**10=1024 (balanced case), without any read -- in the archive. type Dir_node; type p_Dir_node is access Dir_node; type Dir_node (name_len : Natural) is record left, right : p_Dir_node; dico_name : String (1 .. name_len); -- UPPER if case - insensitive search file_name : String (1 .. name_len); file_index : Ada.Streams.Stream_IO.Positive_Count; comp_size : File_size_type; uncomp_size : File_size_type; crc_32 : Interfaces.Unsigned_32; date_time : Time; method : PKZip_method; unicode_file_name : Boolean; end record; type p_String is access String; type Zip_info is record loaded : Boolean := False; zip_file_name : p_String; -- a file name .. . zip_input_stream : Zip_Streams.Zipstream_Class; -- . .. or an input stream -- ^ when not null, we use this and not zip_file_name dir_binary_tree : p_Dir_node; total_entries : Natural; zip_file_comment : p_String; end record; end Zip;
test/Compiler/simple/Issue2469.agda
cruhland/agda
1,989
10313
<filename>test/Compiler/simple/Issue2469.agda module Issue2469 where open import Agda.Builtin.Nat open import Agda.Builtin.Unit open import Agda.Builtin.IO renaming (IO to BIO) open import Agda.Builtin.String open import Agda.Builtin.IO open import Common.IO open import Common.Prelude open import Common.Sum open import Common.Product data F : Nat → Set where [] : F zero _∷1 : ∀ {n} → F n → F (suc n) _∷2 : ∀ {n} → F n → F (suc (suc n)) f : ∀ k → F (suc k) → F k ⊎ Maybe ⊥ f zero a = inj₂ nothing f k (xs ∷1) = inj₂ nothing -- to (suc k) xs = inj₂ nothing -- This is fine f (suc k) = λ xs → inj₂ nothing -- This segfaults myshow : F 1 ⊎ Maybe ⊥ → String -- myshow (inj₁ b) = "" -- This is fine myshow (inj₁ (b ∷1)) = "bla" -- This segfaults myshow _ = "blub" main : IO ⊤ main = putStrLn (myshow (f 1 ([] ∷2)))
libsrc/_DEVELOPMENT/math/float/math32/c/sdcc/cm32_sdcc___fsneq_callee.asm
ahjelm/z88dk
640
25488
<gh_stars>100-1000 SECTION code_fp_math32 PUBLIC cm32_sdcc___fsneq_callee EXTERN cm32_sdcc_fsreadr_callee EXTERN m32_compare_callee ; Entry: stack: float right, float left, ret cm32_sdcc___fsneq_callee: call cm32_sdcc_fsreadr_callee ;Exit dehl = right call m32_compare_callee scf ret nz ccf dec hl ret
sysl2/sysl/sysl_js/SyslParser.g4
anz-rfc/sysl
0
2040
parser grammar SyslParser; options { tokenVocab=SyslLexer; } modifier : TILDE Name (PLUS Name)*; size_spec : OPEN_PAREN DIGITS ( DOT DIGITS)? CLOSE_PAREN; modifier_list : modifier (COMMA modifier)*; modifiers : SQ_OPEN modifier_list SQ_CLOSE; name_str : Name|TEXT_LINE|E_Name; reference : app_name ((E_DOT | DOT) name_str)+; doc_string : PIPE TEXT; quoted_string : QSTRING; array_of_strings : SQ_OPEN quoted_string (COMMA quoted_string)* SQ_CLOSE; array_of_arrays : SQ_OPEN array_of_strings (COMMA array_of_strings)* SQ_CLOSE; nvp : Name EQ (quoted_string | array_of_strings| array_of_arrays); attributes : SQ_OPEN nvp (COMMA nvp)* SQ_CLOSE; entry : nvp | modifier ; attribs_or_modifiers: SQ_OPEN entry (COMMA entry)* SQ_CLOSE; user_defined_type : name_str; types: user_defined_type | reference | NativeDataTypes; set_of: SET_OF | (E_SET_OF); set_type : set_of types size_spec?; sequence_of: SEQUENCE_OF | (E_SEQUENCE_OF); sequence_type : sequence_of types size_spec?; //TODO : allow for other collection types? collection_type : set_type | sequence_type; multi_line_docstring : COLON INDENT doc_string+ DEDENT; annotation_value : QSTRING | array_of_strings | multi_line_docstring; annotation : AT VAR_NAME EQ annotation_value; annotations : INDENT annotation+ DEDENT; field_type : collection_type | (types (array_size | size_spec)? QN? attribs_or_modifiers? (COLON annotations)?) ; array_size : OPEN_PAREN DIGITS DOTDOT DIGITS? CLOSE_PAREN; inplace_tuple: INDENT field+ DEDENT; field: name_str (array_size? LESS_COLON (field_type | inplace_tuple) QSTRING? )?; inplace_table : table; table : SYSL_COMMENT* (TABLE | TYPE) name_str attribs_or_modifiers? COLON ( WHATEVER | INDENT (SYSL_COMMENT | field | annotation | inplace_table | WHATEVER )+ DEDENT) ; union : SYSL_COMMENT* UNION name_str attribs_or_modifiers? COLON ( WHATEVER | INDENT (SYSL_COMMENT | user_defined_type | annotation | WHATEVER )+ DEDENT) ; package_name : name_str; sub_package : NAME_SEP package_name; app_name : package_name sub_package*; name_with_attribs : app_name QSTRING? attribs_or_modifiers?; model_name : Name COLON ; inplace_table_def : COLON INDENT (Name attribs_or_modifiers?)+ DEDENT; table_refs : (TABLE | TYPE | UNION) Name inplace_table_def?; facade : SYSL_COMMENT* WRAP model_name INDENT table_refs+ DEDENT; documentation_stmts : AT Name EQ QSTRING NEWLINE; var_in_curly : CURLY_OPEN Name CURLY_CLOSE; query_var : Name EQ (NativeDataTypes | name_str | var_in_curly) QN?; query_param : QN query_var (AMP query_var)*; http_path_part :name_str | DIGITS; http_path_var_with_type : CURLY_OPEN http_path_part LESS_COLON (NativeDataTypes | name_str) CURLY_CLOSE; http_path_static : http_path_part; http_path_suffix : FORWARD_SLASH (http_path_static | http_path_var_with_type); http_path : (FORWARD_SLASH | http_path_suffix+) query_param?; endpoint_name : name_str (FORWARD_SLASH name_str)*; ret_stmt : RETURN TEXT; target : app_name; target_endpoint : name_str; call_arg : (QSTRING | name_str)+ | (name_str LESS_COLON (name_str|NativeDataTypes)); call_args: OPEN_PAREN call_arg (COMMA call_arg)* CLOSE_PAREN; call_stmt : (DOT_ARROW | target ARROW_LEFT) target_endpoint call_args?; if_stmt : IF PREDICATE_VALUE COLON INDENT statements* DEDENT; else_stmt : ELSE PREDICATE_VALUE? COLON INDENT statements* DEDENT; if_else : if_stmt else_stmt*; for_stmt : (ALT | UNTIL | FOR_EACH | FOR | LOOP | WHILE ) PREDICATE_VALUE COLON INDENT statements* DEDENT; http_method_comment : SYSL_COMMENT; group_stmt : name_str COLON INDENT statements+ DEDENT; one_of_case_label: (Name | TEXT_LINE | QSTRING)+; one_of_cases: one_of_case_label? COLON INDENT statements+ DEDENT; one_of_stmt : ONE_OF COLON INDENT one_of_cases+ DEDENT; text_stmt : doc_string | QSTRING | app_name (ARROW_RIGHT name_str)? | WHATEVER ; mixin: MIXIN app_name; param: reference | field; param_list: param (COMMA param)*; params : OPEN_PAREN param_list CLOSE_PAREN; statements: ( if_else | for_stmt | ret_stmt | call_stmt | one_of_stmt | http_method_comment | group_stmt | text_stmt | annotation ) attribs_or_modifiers? ; method_def: HTTP_VERBS query_param? params? attribs_or_modifiers? COLON INDENT statements+ DEDENT ; shortcut : WHATEVER; simple_endpoint : WHATEVER | ( endpoint_name QSTRING? params? attribs_or_modifiers? COLON ( shortcut | (INDENT statements+ DEDENT) ) ) ; rest_endpoint: http_path attribs_or_modifiers? COLON (INDENT (method_def | rest_endpoint)+ DEDENT) ; collector_query_var: name_str EQ (NativeDataTypes | name_str); collector_query_param: QN collector_query_var (AMP collector_query_var)*; collector_call_stmt: target ARROW_LEFT target_endpoint; collector_http_stmt_part: name_str | CURLY_OPEN name_str CURLY_CLOSE ; collector_http_stmt_suffix: (FORWARD_SLASH collector_http_stmt_part)+ collector_query_param?; collector_http_stmt: HTTP_VERBS collector_http_stmt_suffix; publisher: app_name; subscriber: app_name; collector_pubsub_call: subscriber ARROW_LEFT publisher ARROW_RIGHT name_str; collector_action_stmt: name_str; collector_stmts: (collector_action_stmt | collector_call_stmt | collector_http_stmt | collector_pubsub_call) attribs_or_modifiers; collector: COLLECTOR COLON (WHATEVER | (INDENT collector_stmts+ DEDENT)); event: DISTANCE name_str params? attribs_or_modifiers? COLON (WHATEVER | INDENT statements+ DEDENT); subscribe: app_name ARROW_RIGHT name_str attribs_or_modifiers? COLON (WHATEVER | INDENT statements+ DEDENT); view_type_spec: collection_type | types; literal: E_DIGITS | E_DECIMAL | E_STRING | E_NULL | E_TRUE | E_FALSE; // expr_qualified_name: E_QN? E_RefName; expr_table_of_op: (E_DOT | E_NULLSAFE_DOT) E_TABLE_OF? E_Name; func_arg: expr; func_args: func_arg (E_COMMA func_arg)*; expr_func: ( E_FUNC | E_Name | NativeDataTypes) E_OPEN_PAREN func_args? E_CLOSE_PAREN; rank_expr: expr (E_ASC | E_DESC)?; rank_expr_list: rank_expr (E_COMMA rank_expr)*; expr_rank_func: E_RELOPS_RANK (E_ANGLE_OPEN view_type_spec E_ANGLE_CLOSE)? E_OPEN_PAREN rank_expr_list E_AS E_Name E_CLOSE_PAREN; expr_agg_func: E_RELOPS_AGG E_OPEN_PAREN e_scope_var? func_args E_CLOSE_PAREN; e_scope_var: E_Name E_COLON; first_func_target: E_NULL | expr; expr_first_func: E_RELOPS_FIRST first_func_target E_BY E_OPEN_PAREN e_scope_var? rank_expr_list E_CLOSE_PAREN; e_single_arg_func: E_RELOPS_WHERE | E_RELOPS_FLATTEN; expr_single_arg_func: e_single_arg_func E_OPEN_PAREN e_scope_var? expr E_CLOSE_PAREN; expr_any_func: E_RELOPS_ANY E_OPEN_PAREN expr E_CLOSE_PAREN; expr_single_or_null: E_RELOPS_SINGLE_NULL; expr_snapshot: E_RELOPS_SNAPSHOT; expr_count: E_RELOPS_COUNT; expr_navigate_attr: (E_DOT? E_Name); expr_navigate: E_QN? E_ARROW_RIGHT (E_SET_OF)? expr_navigate_attr (E_VIA E_Name)?; matching_rhs: expr_table_of_op | expr_navigate | atomT_paren | E_Name; squiggly_args: E_SQ_OPEN E_Name (E_COMMA E_Name)* E_SQ_CLOSE; expr_matching: E_NOT? E_TILDE squiggly_args? E_ANGLE_CLOSE matching_rhs; relop: expr_table_of_op | expr_rank_func | expr_agg_func | expr_single_arg_func | expr_any_func | expr_count | expr_single_or_null | expr_snapshot | expr_first_func | expr_navigate | expr_matching ; list_item: expr; expr_list: list_item (E_COMMA list_item)*; expr_set: E_CURLY_OPEN expr_list E_CURLY_CLOSE; empty_tuple: E_EMPTY_TUPLE; atom_dot_relop: E_DOT (expr_rank_func // 1 | expr_agg_func // 4 | expr_single_arg_func // 2 | expr_any_func // 1 | expr_count // 1 | expr_single_or_null // 2 | expr_snapshot // 1 | expr_first_func // 1 | expr_navigate | expr_matching ) ; atomT_implied_dot: atom_dot_relop | expr_navigate | expr_matching | expr_table_of_op ; atomT_name : E_Name | E_WHATEVER | E_DOT; atomT_paren: E_OPEN_PAREN expr E_CLOSE_PAREN; expr_atom_list: E_SQ_OPEN expr_list E_SQ_CLOSE; atomT: expr_func | expr_set | expr_atom_list | empty_tuple | atomT_paren | literal | atomT_implied_dot | atomT_name ; atom: atomT relop*; powerT: E_POW unaryTerm; power: atom powerT?; unaryTerm: (E_PLUS | E_MINUS | E_NOT | E_TILDE )? power; termT: (E_STAR | E_DIVIDE | E_MOD ) unaryTerm; term: unaryTerm termT*; binexprT: (E_PLUS | E_MINUS) term; binexpr: term binexprT*; e_compare_ops: E_REL | E_ANGLE_OPEN | E_ANGLE_CLOSE | E_DOUBLE_EQ; expr_rel: binexpr ( e_compare_ops binexpr)*; expr_bitand: expr_rel ((E_AMP | E_AND) expr_rel)*; expr_bitxor: expr_bitand (E_XOR expr_bitand)*; expr_bitor: expr_bitxor (E_BITOR expr_bitxor)*; expr_and: expr_bitor (E_DOUBLE_AMP expr_bitor)*; expr_or: expr_and (E_LOGIC_OR expr_and)*; expr_but_not: expr_or (E_BUTNOT expr_or)*; expr_coalesce: expr_but_not (E_COALESCE expr_but_not)*; if_one_liner: expr E_QN? E_THEN expr E_ELSE expr; else_block_stmt returns [nested = false;]: expr { $nested=$expr.nested;} ; control_item: expr; if_controls: control_item (E_COMMA control_item)*; cond_block: if_controls E_EQ_RIGHT else_block_stmt ( {$else_block_stmt.nested == true}?| E_NL) ; final_else: E_ELSE expr ( {$expr.nested == true}?| E_NL) ; ifvar: expr E_DOUBLE_EQ; if_multiple_lines: ifvar? E_COLON E_NL INDENT cond_block+ final_else? DEDENT; expr_if_else returns [nested = false;] : E_IF ( if_one_liner | if_multiple_lines { $nested=true;} ) ; // // EXPR // expr returns [nested = false;]: expr_if_else { $nested=$expr_if_else.nested;} | expr_coalesce ; expr_assign returns [nested = false;] : E_EQ (expr { $nested=$expr.nested;} | transform { $nested=true;}); expr_simple_assign returns [nested = false;] : E_Name expr_assign {$nested = $expr_assign.nested;}; expr_let_statement returns [nested = false;] : E_LET E_Name expr_assign {$nested = $expr_assign.nested;}; expr_table_of_statement returns [nested]: E_TABLE_OF E_Name expr_assign {$nested = $expr_assign.nested;}; expr_dot_assign: E_DOT_NAME_NL; expr_statement_no_nl: expr_dot_assign; expr_statement locals [nested = false;]: (expr_let_statement {$nested = $expr_let_statement.nested;} | expr_table_of_statement {$nested = $expr_table_of_statement.nested;} // NL is not required when we got nested expression (like if_multiple_lines or transform) // followed by new statement | expr_simple_assign {$nested = $expr_simple_assign.nested;} ) ( {$nested == true}? | E_NL) ; expr_inject_stmt: expr_func E_DOT E_STAR E_NL; expr_stmt: expr_statement_no_nl | expr_statement | expr_inject_stmt; transform_return_type: set_of | sequence_of | view_type_spec; view_return_type: view_type_spec; transform_scope_var: E_Name; transform_arg: expr; transform: transform_arg? E_ARROW_RIGHT (E_ANGLE_OPEN transform_return_type E_ANGLE_CLOSE)? E_OPEN_PAREN transform_scope_var? E_COLON E_NL INDENT (expr_stmt)+ DEDENT E_CLOSE_PAREN E_NL; expr_block: INDENT transform DEDENT; view_param: name_str LESS_COLON view_type_spec; view_params: view_param (COMMA view_param)*; abstract_view: ABSTRACT; view returns [abstractView = false;]: VIEW name_str OPEN_PAREN view_params CLOSE_PAREN (ARROW_RIGHT view_return_type)? ( attribs_or_modifiers? COLON expr_block | abstract_view {$abstractView=true;} ); app_decl locals [check = false;]: INDENT (table | union | facade | SYSL_COMMENT | rest_endpoint | simple_endpoint | collector | event | subscribe | annotation | mixin | view {$check == $view.abstractView} )+ ( { $check === true}? | DEDENT ); application: SYSL_COMMENT* name_with_attribs COLON app_decl ; path : FORWARD_SLASH? Name (FORWARD_SLASH Name)* ; import_stmt : IMPORT SYSL_COMMENT*; imports_decl : import_stmt+; sysl_file : imports_decl? application+ EOF;
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-taprop__vxworks.adb
djamal2727/Main-Bearing-Analytical-Model
0
14457
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . T A S K _ P R I M I T I V E S . O P E R A T I O N S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the VxWorks version of this package -- This package contains all the GNULL primitives that interface directly with -- the underlying OS. with Ada.Unchecked_Conversion; with Interfaces.C; with System.Multiprocessors; with System.Tasking.Debug; with System.Interrupt_Management; with System.Float_Control; with System.OS_Constants; with System.Soft_Links; -- We use System.Soft_Links instead of System.Tasking.Initialization -- because the later is a higher level package that we shouldn't depend -- on. For example when using the restricted run time, it is replaced by -- System.Tasking.Restricted.Stages. with System.Task_Info; with System.VxWorks.Ext; package body System.Task_Primitives.Operations is package OSC renames System.OS_Constants; package SSL renames System.Soft_Links; use System.Tasking.Debug; use System.Tasking; use System.OS_Interface; use System.Parameters; use type System.VxWorks.Ext.t_id; use type Interfaces.C.int; use type System.OS_Interface.unsigned; subtype int is System.OS_Interface.int; subtype unsigned is System.OS_Interface.unsigned; Relative : constant := 0; ---------------- -- Local Data -- ---------------- -- The followings are logically constants, but need to be initialized at -- run time. Environment_Task_Id : Task_Id; -- A variable to hold Task_Id for the environment task -- The followings are internal configuration constants needed Dispatching_Policy : Character; pragma Import (C, Dispatching_Policy, "__gl_task_dispatching_policy"); Foreign_Task_Elaborated : aliased Boolean := True; -- Used to identified fake tasks (i.e., non-Ada Threads) Locking_Policy : Character; pragma Import (C, Locking_Policy, "__gl_locking_policy"); Mutex_Protocol : Priority_Type; Single_RTS_Lock : aliased RTS_Lock; -- This is a lock to allow only one thread of control in the RTS at a -- time; it is used to execute in mutual exclusion from all other tasks. -- Used to protect All_Tasks_List Time_Slice_Val : Integer; pragma Import (C, Time_Slice_Val, "__gl_time_slice_val"); Null_Thread_Id : constant Thread_Id := 0; -- Constant to indicate that the thread identifier has not yet been -- initialized. -------------------- -- Local Packages -- -------------------- package Specific is procedure Initialize; pragma Inline (Initialize); -- Initialize task specific data function Is_Valid_Task return Boolean; pragma Inline (Is_Valid_Task); -- Does executing thread have a TCB? procedure Set (Self_Id : Task_Id); pragma Inline (Set); -- Set the self id for the current task, unless Self_Id is null, in -- which case the task specific data is deleted. function Self return Task_Id; pragma Inline (Self); -- Return a pointer to the Ada Task Control Block of the calling task end Specific; package body Specific is separate; -- The body of this package is target specific ---------------------------------- -- ATCB allocation/deallocation -- ---------------------------------- package body ATCB_Allocation is separate; -- The body of this package is shared across several targets --------------------------------- -- Support for foreign threads -- --------------------------------- function Register_Foreign_Thread (Thread : Thread_Id; Sec_Stack_Size : Size_Type := Unspecified_Size) return Task_Id; -- Allocate and initialize a new ATCB for the current Thread. The size of -- the secondary stack can be optionally specified. function Register_Foreign_Thread (Thread : Thread_Id; Sec_Stack_Size : Size_Type := Unspecified_Size) return Task_Id is separate; ----------------------- -- Local Subprograms -- ----------------------- procedure Abort_Handler (signo : Signal); -- Handler for the abort (SIGABRT) signal to handle asynchronous abort procedure Install_Signal_Handlers; -- Install the default signal handlers for the current task function Is_Task_Context return Boolean; -- This function returns True if the current execution is in the context of -- a task, and False if it is an interrupt context. type Set_Stack_Limit_Proc_Acc is access procedure; pragma Convention (C, Set_Stack_Limit_Proc_Acc); Set_Stack_Limit_Hook : Set_Stack_Limit_Proc_Acc; pragma Import (C, Set_Stack_Limit_Hook, "__gnat_set_stack_limit_hook"); -- Procedure to be called when a task is created to set stack limit. Used -- only for VxWorks 5 and VxWorks MILS guest OS. function To_Address is new Ada.Unchecked_Conversion (Task_Id, System.Address); ------------------- -- Abort_Handler -- ------------------- procedure Abort_Handler (signo : Signal) is pragma Unreferenced (signo); -- Do not call Self at this point as we're in a signal handler -- and it may not be available, in particular on targets where we -- support ZCX and where we don't do anything here anyway. Self_ID : Task_Id; Old_Set : aliased sigset_t; Unblocked_Mask : aliased sigset_t; Result : int; pragma Warnings (Off, Result); use System.Interrupt_Management; begin -- It is not safe to raise an exception when using ZCX and the GCC -- exception handling mechanism. if ZCX_By_Default then return; end if; Self_ID := Self; if Self_ID.Deferral_Level = 0 and then Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level and then not Self_ID.Aborting then Self_ID.Aborting := True; -- Make sure signals used for RTS internal purposes are unmasked Result := sigemptyset (Unblocked_Mask'Access); pragma Assert (Result = 0); Result := sigaddset (Unblocked_Mask'Access, Signal (Abort_Task_Interrupt)); pragma Assert (Result = 0); Result := sigaddset (Unblocked_Mask'Access, SIGBUS); pragma Assert (Result = 0); Result := sigaddset (Unblocked_Mask'Access, SIGFPE); pragma Assert (Result = 0); Result := sigaddset (Unblocked_Mask'Access, SIGILL); pragma Assert (Result = 0); Result := sigaddset (Unblocked_Mask'Access, SIGSEGV); pragma Assert (Result = 0); Result := pthread_sigmask (SIG_UNBLOCK, Unblocked_Mask'Access, Old_Set'Access); pragma Assert (Result = 0); raise Standard'Abort_Signal; end if; end Abort_Handler; ----------------- -- Stack_Guard -- ----------------- procedure Stack_Guard (T : ST.Task_Id; On : Boolean) is pragma Unreferenced (T); pragma Unreferenced (On); begin -- Nothing needed (why not???) null; end Stack_Guard; ------------------- -- Get_Thread_Id -- ------------------- function Get_Thread_Id (T : ST.Task_Id) return OSI.Thread_Id is begin return T.Common.LL.Thread; end Get_Thread_Id; ---------- -- Self -- ---------- function Self return Task_Id renames Specific.Self; ----------------------------- -- Install_Signal_Handlers -- ----------------------------- procedure Install_Signal_Handlers is act : aliased struct_sigaction; old_act : aliased struct_sigaction; Tmp_Set : aliased sigset_t; Result : int; begin act.sa_flags := 0; act.sa_handler := Abort_Handler'Address; Result := sigemptyset (Tmp_Set'Access); pragma Assert (Result = 0); act.sa_mask := Tmp_Set; Result := sigaction (Signal (Interrupt_Management.Abort_Task_Interrupt), act'Unchecked_Access, old_act'Unchecked_Access); pragma Assert (Result = 0); Interrupt_Management.Initialize_Interrupts; end Install_Signal_Handlers; --------------------- -- Initialize_Lock -- --------------------- procedure Initialize_Lock (Prio : System.Any_Priority; L : not null access Lock) is begin L.Mutex := semMCreate (SEM_Q_PRIORITY + SEM_INVERSION_SAFE); L.Prio_Ceiling := int (Prio); L.Protocol := Mutex_Protocol; pragma Assert (L.Mutex /= 0); end Initialize_Lock; procedure Initialize_Lock (L : not null access RTS_Lock; Level : Lock_Level) is pragma Unreferenced (Level); begin L.Mutex := semMCreate (SEM_Q_PRIORITY + SEM_INVERSION_SAFE); L.Prio_Ceiling := int (System.Any_Priority'Last); L.Protocol := Mutex_Protocol; pragma Assert (L.Mutex /= 0); end Initialize_Lock; ------------------- -- Finalize_Lock -- ------------------- procedure Finalize_Lock (L : not null access Lock) is Result : int; begin Result := semDelete (L.Mutex); pragma Assert (Result = 0); end Finalize_Lock; procedure Finalize_Lock (L : not null access RTS_Lock) is Result : int; begin Result := semDelete (L.Mutex); pragma Assert (Result = 0); end Finalize_Lock; ---------------- -- Write_Lock -- ---------------- procedure Write_Lock (L : not null access Lock; Ceiling_Violation : out Boolean) is Result : int; begin if L.Protocol = Prio_Protect and then int (Self.Common.Current_Priority) > L.Prio_Ceiling then Ceiling_Violation := True; return; else Ceiling_Violation := False; end if; Result := semTake (L.Mutex, WAIT_FOREVER); pragma Assert (Result = 0); end Write_Lock; procedure Write_Lock (L : not null access RTS_Lock) is Result : int; begin Result := semTake (L.Mutex, WAIT_FOREVER); pragma Assert (Result = 0); end Write_Lock; procedure Write_Lock (T : Task_Id) is Result : int; begin Result := semTake (T.Common.LL.L.Mutex, WAIT_FOREVER); pragma Assert (Result = 0); end Write_Lock; --------------- -- Read_Lock -- --------------- procedure Read_Lock (L : not null access Lock; Ceiling_Violation : out Boolean) is begin Write_Lock (L, Ceiling_Violation); end Read_Lock; ------------ -- Unlock -- ------------ procedure Unlock (L : not null access Lock) is Result : int; begin Result := semGive (L.Mutex); pragma Assert (Result = 0); end Unlock; procedure Unlock (L : not null access RTS_Lock) is Result : int; begin Result := semGive (L.Mutex); pragma Assert (Result = 0); end Unlock; procedure Unlock (T : Task_Id) is Result : int; begin Result := semGive (T.Common.LL.L.Mutex); pragma Assert (Result = 0); end Unlock; ----------------- -- Set_Ceiling -- ----------------- -- Dynamic priority ceilings are not supported by the underlying system procedure Set_Ceiling (L : not null access Lock; Prio : System.Any_Priority) is pragma Unreferenced (L, Prio); begin null; end Set_Ceiling; ----------- -- Sleep -- ----------- procedure Sleep (Self_ID : Task_Id; Reason : System.Tasking.Task_States) is pragma Unreferenced (Reason); Result : int; begin pragma Assert (Self_ID = Self); -- Release the mutex before sleeping Result := semGive (Self_ID.Common.LL.L.Mutex); pragma Assert (Result = 0); -- Perform a blocking operation to take the CV semaphore. Note that a -- blocking operation in VxWorks will reenable task scheduling. When we -- are no longer blocked and control is returned, task scheduling will -- again be disabled. Result := semTake (Self_ID.Common.LL.CV, WAIT_FOREVER); pragma Assert (Result = 0); -- Take the mutex back Result := semTake (Self_ID.Common.LL.L.Mutex, WAIT_FOREVER); pragma Assert (Result = 0); end Sleep; ----------------- -- Timed_Sleep -- ----------------- -- This is for use within the run-time system, so abort is assumed to be -- already deferred, and the caller should be holding its own ATCB lock. procedure Timed_Sleep (Self_ID : Task_Id; Time : Duration; Mode : ST.Delay_Modes; Reason : System.Tasking.Task_States; Timedout : out Boolean; Yielded : out Boolean) is pragma Unreferenced (Reason); Orig : constant Duration := Monotonic_Clock; Absolute : Duration; Ticks : int; Result : int; Wakeup : Boolean := False; begin Timedout := False; Yielded := True; if Mode = Relative then Absolute := Orig + Time; -- Systematically add one since the first tick will delay *at most* -- 1 / Rate_Duration seconds, so we need to add one to be on the -- safe side. Ticks := To_Clock_Ticks (Time); if Ticks > 0 and then Ticks < int'Last then Ticks := Ticks + 1; end if; else Absolute := Time; Ticks := To_Clock_Ticks (Time - Monotonic_Clock); end if; if Ticks > 0 then loop -- Release the mutex before sleeping Result := semGive (Self_ID.Common.LL.L.Mutex); pragma Assert (Result = 0); -- Perform a blocking operation to take the CV semaphore. Note -- that a blocking operation in VxWorks will reenable task -- scheduling. When we are no longer blocked and control is -- returned, task scheduling will again be disabled. Result := semTake (Self_ID.Common.LL.CV, Ticks); if Result = 0 then -- Somebody may have called Wakeup for us Wakeup := True; else if errno /= S_objLib_OBJ_TIMEOUT then Wakeup := True; else -- If Ticks = int'last, it was most probably truncated so -- let's make another round after recomputing Ticks from -- the absolute time. if Ticks /= int'Last then Timedout := True; else Ticks := To_Clock_Ticks (Absolute - Monotonic_Clock); if Ticks < 0 then Timedout := True; end if; end if; end if; end if; -- Take the mutex back Result := semTake (Self_ID.Common.LL.L.Mutex, WAIT_FOREVER); pragma Assert (Result = 0); exit when Timedout or Wakeup; end loop; else Timedout := True; -- Should never hold a lock while yielding Result := semGive (Self_ID.Common.LL.L.Mutex); Result := taskDelay (0); Result := semTake (Self_ID.Common.LL.L.Mutex, WAIT_FOREVER); end if; end Timed_Sleep; ----------------- -- Timed_Delay -- ----------------- -- This is for use in implementing delay statements, so we assume the -- caller is holding no locks. procedure Timed_Delay (Self_ID : Task_Id; Time : Duration; Mode : ST.Delay_Modes) is Orig : constant Duration := Monotonic_Clock; Absolute : Duration; Ticks : int; Timedout : Boolean; Aborted : Boolean := False; Result : int; pragma Warnings (Off, Result); begin if Mode = Relative then Absolute := Orig + Time; Ticks := To_Clock_Ticks (Time); if Ticks > 0 and then Ticks < int'Last then -- First tick will delay anytime between 0 and 1 / sysClkRateGet -- seconds, so we need to add one to be on the safe side. Ticks := Ticks + 1; end if; else Absolute := Time; Ticks := To_Clock_Ticks (Time - Orig); end if; if Ticks > 0 then -- Modifying State, locking the TCB Result := semTake (Self_ID.Common.LL.L.Mutex, WAIT_FOREVER); pragma Assert (Result = 0); Self_ID.Common.State := Delay_Sleep; Timedout := False; loop Aborted := Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level; -- Release the TCB before sleeping Result := semGive (Self_ID.Common.LL.L.Mutex); pragma Assert (Result = 0); exit when Aborted; Result := semTake (Self_ID.Common.LL.CV, Ticks); if Result /= 0 then -- If Ticks = int'last, it was most probably truncated, so make -- another round after recomputing Ticks from absolute time. if errno = S_objLib_OBJ_TIMEOUT and then Ticks /= int'Last then Timedout := True; else Ticks := To_Clock_Ticks (Absolute - Monotonic_Clock); if Ticks < 0 then Timedout := True; end if; end if; end if; -- Take back the lock after having slept, to protect further -- access to Self_ID. Result := semTake (Self_ID.Common.LL.L.Mutex, WAIT_FOREVER); pragma Assert (Result = 0); exit when Timedout; end loop; Self_ID.Common.State := Runnable; Result := semGive (Self_ID.Common.LL.L.Mutex); else Result := taskDelay (0); end if; end Timed_Delay; --------------------- -- Monotonic_Clock -- --------------------- function Monotonic_Clock return Duration is TS : aliased timespec; Result : int; begin Result := clock_gettime (OSC.CLOCK_RT_Ada, TS'Unchecked_Access); pragma Assert (Result = 0); return To_Duration (TS); end Monotonic_Clock; ------------------- -- RT_Resolution -- ------------------- function RT_Resolution return Duration is begin return 1.0 / Duration (sysClkRateGet); end RT_Resolution; ------------ -- Wakeup -- ------------ procedure Wakeup (T : Task_Id; Reason : System.Tasking.Task_States) is pragma Unreferenced (Reason); Result : int; begin Result := semGive (T.Common.LL.CV); pragma Assert (Result = 0); end Wakeup; ----------- -- Yield -- ----------- procedure Yield (Do_Yield : Boolean := True) is pragma Unreferenced (Do_Yield); Result : int; pragma Unreferenced (Result); begin Result := taskDelay (0); end Yield; ------------------ -- Set_Priority -- ------------------ procedure Set_Priority (T : Task_Id; Prio : System.Any_Priority; Loss_Of_Inheritance : Boolean := False) is pragma Unreferenced (Loss_Of_Inheritance); Result : int; begin Result := taskPrioritySet (T.Common.LL.Thread, To_VxWorks_Priority (int (Prio))); pragma Assert (Result = 0); -- Note: in VxWorks 6.6 (or earlier), the task is placed at the end of -- the priority queue instead of the head. This is not the behavior -- required by Annex D (RM D.2.3(5/2)), but we consider it an acceptable -- variation (RM 1.1.3(6)), given this is the built-in behavior of the -- operating system. VxWorks versions starting from 6.7 implement the -- required Annex D semantics. -- In older versions we attempted to better approximate the Annex D -- required behavior, but this simulation was not entirely accurate, -- and it seems better to live with the standard VxWorks semantics. T.Common.Current_Priority := Prio; end Set_Priority; ------------------ -- Get_Priority -- ------------------ function Get_Priority (T : Task_Id) return System.Any_Priority is begin return T.Common.Current_Priority; end Get_Priority; ---------------- -- Enter_Task -- ---------------- procedure Enter_Task (Self_ID : Task_Id) is begin -- Store the user-level task id in the Thread field (to be used -- internally by the run-time system) and the kernel-level task id in -- the LWP field (to be used by the debugger). Self_ID.Common.LL.Thread := taskIdSelf; Self_ID.Common.LL.LWP := getpid; Specific.Set (Self_ID); -- Properly initializes the FPU for PPC/MIPS systems System.Float_Control.Reset; -- Install the signal handlers -- This is called for each task since there is no signal inheritance -- between VxWorks tasks. Install_Signal_Handlers; -- If stack checking is enabled, set the stack limit for this task if Set_Stack_Limit_Hook /= null then Set_Stack_Limit_Hook.all; end if; end Enter_Task; ------------------- -- Is_Valid_Task -- ------------------- function Is_Valid_Task return Boolean renames Specific.Is_Valid_Task; ----------------------------- -- Register_Foreign_Thread -- ----------------------------- function Register_Foreign_Thread return Task_Id is begin if Is_Valid_Task then return Self; else return Register_Foreign_Thread (taskIdSelf); end if; end Register_Foreign_Thread; -------------------- -- Initialize_TCB -- -------------------- procedure Initialize_TCB (Self_ID : Task_Id; Succeeded : out Boolean) is begin Self_ID.Common.LL.CV := semBCreate (SEM_Q_PRIORITY, SEM_EMPTY); Self_ID.Common.LL.Thread := Null_Thread_Id; if Self_ID.Common.LL.CV = 0 then Succeeded := False; else Succeeded := True; Initialize_Lock (Self_ID.Common.LL.L'Access, ATCB_Level); end if; end Initialize_TCB; ----------------- -- Create_Task -- ----------------- procedure Create_Task (T : Task_Id; Wrapper : System.Address; Stack_Size : System.Parameters.Size_Type; Priority : System.Any_Priority; Succeeded : out Boolean) is Adjusted_Stack_Size : size_t; use type System.Multiprocessors.CPU_Range; begin -- Check whether both Dispatching_Domain and CPU are specified for -- the task, and the CPU value is not contained within the range of -- processors for the domain. if T.Common.Domain /= null and then T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU and then (T.Common.Base_CPU not in T.Common.Domain'Range or else not T.Common.Domain (T.Common.Base_CPU)) then Succeeded := False; return; end if; -- Ask for four extra bytes of stack space so that the ATCB pointer can -- be stored below the stack limit, plus extra space for the frame of -- Task_Wrapper. This is so the user gets the amount of stack requested -- exclusive of the needs. -- We also have to allocate n more bytes for the task name storage and -- enough space for the Wind Task Control Block which is around 0x778 -- bytes. VxWorks also seems to carve out additional space, so use 2048 -- as a nice round number. We might want to increment to the nearest -- page size in case we ever support VxVMI. -- ??? - we should come back and visit this so we can set the task name -- to something appropriate. Adjusted_Stack_Size := size_t (Stack_Size) + 2048; -- Since the initial signal mask of a thread is inherited from the -- creator, and the Environment task has all its signals masked, we do -- not need to manipulate caller's signal mask at this point. All tasks -- in RTS will have All_Tasks_Mask initially. -- We now compute the VxWorks task name and options, then spawn ... declare Name : aliased String (1 .. T.Common.Task_Image_Len + 1); Name_Address : System.Address; -- Task name we are going to hand down to VxWorks function Get_Task_Options return int; pragma Import (C, Get_Task_Options, "__gnat_get_task_options"); -- Function that returns the options to be set for the task that we -- are creating. We fetch the options assigned to the current task, -- so offering some user level control over the options for a task -- hierarchy, and force VX_FP_TASK because it is almost always -- required. begin -- If there is no Ada task name handy, let VxWorks choose one. -- Otherwise, tell VxWorks what the Ada task name is. if T.Common.Task_Image_Len = 0 then Name_Address := System.Null_Address; else Name (1 .. Name'Last - 1) := T.Common.Task_Image (1 .. T.Common.Task_Image_Len); Name (Name'Last) := ASCII.NUL; Name_Address := Name'Address; end if; -- Now spawn the VxWorks task for real T.Common.LL.Thread := taskSpawn (Name_Address, To_VxWorks_Priority (int (Priority)), Get_Task_Options, Adjusted_Stack_Size, Wrapper, To_Address (T)); end; -- Set processor affinity Set_Task_Affinity (T); -- Only case of failure is if taskSpawn returned 0 (aka Null_Thread_Id) if T.Common.LL.Thread = Null_Thread_Id then Succeeded := False; else Succeeded := True; Task_Creation_Hook (T.Common.LL.Thread); Set_Priority (T, Priority); end if; end Create_Task; ------------------ -- Finalize_TCB -- ------------------ procedure Finalize_TCB (T : Task_Id) is Result : int; begin Result := semDelete (T.Common.LL.L.Mutex); pragma Assert (Result = 0); T.Common.LL.Thread := Null_Thread_Id; Result := semDelete (T.Common.LL.CV); pragma Assert (Result = 0); if T.Known_Tasks_Index /= -1 then Known_Tasks (T.Known_Tasks_Index) := null; end if; ATCB_Allocation.Free_ATCB (T); end Finalize_TCB; --------------- -- Exit_Task -- --------------- procedure Exit_Task is begin Specific.Set (null); end Exit_Task; ---------------- -- Abort_Task -- ---------------- procedure Abort_Task (T : Task_Id) is Result : int; begin Result := kill (T.Common.LL.Thread, Signal (Interrupt_Management.Abort_Task_Interrupt)); pragma Assert (Result = 0); end Abort_Task; ---------------- -- Initialize -- ---------------- procedure Initialize (S : in out Suspension_Object) is begin -- Initialize internal state (always to False (RM D.10(6))) S.State := False; S.Waiting := False; -- Initialize internal mutex -- Use simpler binary semaphore instead of VxWorks mutual exclusion -- semaphore, because we don't need the fancier semantics and their -- overhead. S.L := semBCreate (SEM_Q_FIFO, SEM_FULL); -- Initialize internal condition variable S.CV := semBCreate (SEM_Q_FIFO, SEM_EMPTY); end Initialize; -------------- -- Finalize -- -------------- procedure Finalize (S : in out Suspension_Object) is pragma Unmodified (S); -- S may be modified on other targets, but not on VxWorks Result : STATUS; begin -- Destroy internal mutex Result := semDelete (S.L); pragma Assert (Result = OK); -- Destroy internal condition variable Result := semDelete (S.CV); pragma Assert (Result = OK); end Finalize; ------------------- -- Current_State -- ------------------- function Current_State (S : Suspension_Object) return Boolean is begin -- We do not want to use lock on this read operation. State is marked -- as Atomic so that we ensure that the value retrieved is correct. return S.State; end Current_State; --------------- -- Set_False -- --------------- procedure Set_False (S : in out Suspension_Object) is Result : STATUS; begin SSL.Abort_Defer.all; Result := semTake (S.L, WAIT_FOREVER); pragma Assert (Result = OK); S.State := False; Result := semGive (S.L); pragma Assert (Result = OK); SSL.Abort_Undefer.all; end Set_False; -------------- -- Set_True -- -------------- procedure Set_True (S : in out Suspension_Object) is Result : STATUS; begin -- Set_True can be called from an interrupt context, in which case -- Abort_Defer is undefined. if Is_Task_Context then SSL.Abort_Defer.all; end if; Result := semTake (S.L, WAIT_FOREVER); pragma Assert (Result = OK); -- If there is already a task waiting on this suspension object then we -- resume it, leaving the state of the suspension object to False, as it -- is specified in (RM D.10 (9)). Otherwise, it just leaves the state to -- True. if S.Waiting then S.Waiting := False; S.State := False; Result := semGive (S.CV); pragma Assert (Result = OK); else S.State := True; end if; Result := semGive (S.L); pragma Assert (Result = OK); -- Set_True can be called from an interrupt context, in which case -- Abort_Undefer is undefined. if Is_Task_Context then SSL.Abort_Undefer.all; end if; end Set_True; ------------------------ -- Suspend_Until_True -- ------------------------ procedure Suspend_Until_True (S : in out Suspension_Object) is Result : STATUS; begin SSL.Abort_Defer.all; Result := semTake (S.L, WAIT_FOREVER); if S.Waiting then -- Program_Error must be raised upon calling Suspend_Until_True -- if another task is already waiting on that suspension object -- (RM D.10(10)). Result := semGive (S.L); pragma Assert (Result = OK); SSL.Abort_Undefer.all; raise Program_Error; else -- Suspend the task if the state is False. Otherwise, the task -- continues its execution, and the state of the suspension object -- is set to False (RM D.10 (9)). if S.State then S.State := False; Result := semGive (S.L); pragma Assert (Result = 0); SSL.Abort_Undefer.all; else S.Waiting := True; -- Release the mutex before sleeping Result := semGive (S.L); pragma Assert (Result = OK); SSL.Abort_Undefer.all; Result := semTake (S.CV, WAIT_FOREVER); pragma Assert (Result = 0); end if; end if; end Suspend_Until_True; ---------------- -- Check_Exit -- ---------------- -- Dummy version function Check_Exit (Self_ID : ST.Task_Id) return Boolean is pragma Unreferenced (Self_ID); begin return True; end Check_Exit; -------------------- -- Check_No_Locks -- -------------------- function Check_No_Locks (Self_ID : ST.Task_Id) return Boolean is pragma Unreferenced (Self_ID); begin return True; end Check_No_Locks; ---------------------- -- Environment_Task -- ---------------------- function Environment_Task return Task_Id is begin return Environment_Task_Id; end Environment_Task; -------------- -- Lock_RTS -- -------------- procedure Lock_RTS is begin Write_Lock (Single_RTS_Lock'Access); end Lock_RTS; ---------------- -- Unlock_RTS -- ---------------- procedure Unlock_RTS is begin Unlock (Single_RTS_Lock'Access); end Unlock_RTS; ------------------ -- Suspend_Task -- ------------------ function Suspend_Task (T : ST.Task_Id; Thread_Self : Thread_Id) return Boolean is begin if T.Common.LL.Thread /= Null_Thread_Id and then T.Common.LL.Thread /= Thread_Self then return taskSuspend (T.Common.LL.Thread) = 0; else return True; end if; end Suspend_Task; ----------------- -- Resume_Task -- ----------------- function Resume_Task (T : ST.Task_Id; Thread_Self : Thread_Id) return Boolean is begin if T.Common.LL.Thread /= Null_Thread_Id and then T.Common.LL.Thread /= Thread_Self then return taskResume (T.Common.LL.Thread) = 0; else return True; end if; end Resume_Task; -------------------- -- Stop_All_Tasks -- -------------------- procedure Stop_All_Tasks is Thread_Self : constant Thread_Id := taskIdSelf; C : Task_Id; Dummy : int; Old : int; begin Old := Int_Lock; C := All_Tasks_List; while C /= null loop if C.Common.LL.Thread /= Null_Thread_Id and then C.Common.LL.Thread /= Thread_Self then Dummy := Task_Stop (C.Common.LL.Thread); end if; C := C.Common.All_Tasks_Link; end loop; Dummy := Int_Unlock (Old); end Stop_All_Tasks; --------------- -- Stop_Task -- --------------- function Stop_Task (T : ST.Task_Id) return Boolean is begin if T.Common.LL.Thread /= Null_Thread_Id then return Task_Stop (T.Common.LL.Thread) = 0; else return True; end if; end Stop_Task; ------------------- -- Continue_Task -- ------------------- function Continue_Task (T : ST.Task_Id) return Boolean is begin if T.Common.LL.Thread /= Null_Thread_Id then return Task_Cont (T.Common.LL.Thread) = 0; else return True; end if; end Continue_Task; --------------------- -- Is_Task_Context -- --------------------- function Is_Task_Context return Boolean is begin return System.OS_Interface.Interrupt_Context /= 1; end Is_Task_Context; ---------------- -- Initialize -- ---------------- procedure Initialize (Environment_Task : Task_Id) is Result : int; pragma Unreferenced (Result); begin Environment_Task_Id := Environment_Task; Interrupt_Management.Initialize; Specific.Initialize; if Locking_Policy = 'C' then Mutex_Protocol := Prio_Protect; elsif Locking_Policy = 'I' then Mutex_Protocol := Prio_Inherit; else Mutex_Protocol := Prio_None; end if; if Time_Slice_Val > 0 then Result := Set_Time_Slice (To_Clock_Ticks (Duration (Time_Slice_Val) / Duration (1_000_000.0))); elsif Dispatching_Policy = 'R' then Result := Set_Time_Slice (To_Clock_Ticks (0.01)); end if; -- Initialize the lock used to synchronize chain of all ATCBs Initialize_Lock (Single_RTS_Lock'Access, RTS_Lock_Level); -- Make environment task known here because it doesn't go through -- Activate_Tasks, which does it for all other tasks. Known_Tasks (Known_Tasks'First) := Environment_Task; Environment_Task.Known_Tasks_Index := Known_Tasks'First; Enter_Task (Environment_Task); -- Set processor affinity Set_Task_Affinity (Environment_Task); end Initialize; ----------------------- -- Set_Task_Affinity -- ----------------------- procedure Set_Task_Affinity (T : ST.Task_Id) is Result : int := 0; pragma Unreferenced (Result); use System.Task_Info; use type System.Multiprocessors.CPU_Range; begin -- Do nothing if the underlying thread has not yet been created. If the -- thread has not yet been created then the proper affinity will be set -- during its creation. if T.Common.LL.Thread = Null_Thread_Id then null; -- pragma CPU elsif T.Common.Base_CPU /= Multiprocessors.Not_A_Specific_CPU then -- Ada 2012 pragma CPU uses CPU numbers starting from 1, while on -- VxWorks the first CPU is identified by a 0, so we need to adjust. Result := taskCpuAffinitySet (T.Common.LL.Thread, int (T.Common.Base_CPU) - 1); -- Task_Info elsif T.Common.Task_Info /= Unspecified_Task_Info then Result := taskCpuAffinitySet (T.Common.LL.Thread, T.Common.Task_Info); -- Handle dispatching domains elsif T.Common.Domain /= null and then (T.Common.Domain /= ST.System_Domain or else T.Common.Domain.all /= (Multiprocessors.CPU'First .. Multiprocessors.Number_Of_CPUs => True)) then declare CPU_Set : unsigned := 0; begin -- Set the affinity to all the processors belonging to the -- dispatching domain. for Proc in T.Common.Domain'Range loop if T.Common.Domain (Proc) then -- The thread affinity mask is a bit vector in which each -- bit represents a logical processor. CPU_Set := CPU_Set + 2 ** (Integer (Proc) - 1); end if; end loop; Result := taskMaskAffinitySet (T.Common.LL.Thread, CPU_Set); end; end if; end Set_Task_Affinity; end System.Task_Primitives.Operations;
programs/oeis/137/A137933.asm
karttu/loda
0
246455
; A137933: Least common multiple of n^2 and 2. ; 2,4,18,16,50,36,98,64,162,100,242,144,338,196,450,256,578,324,722,400,882,484,1058,576,1250,676,1458,784,1682,900,1922,1024,2178,1156,2450,1296,2738,1444,3042,1600,3362,1764,3698,1936,4050,2116,4418,2304,4802,2500,5202,2704 mov $2,$0 gcd $0,2 mov $1,$0 add $2,1 pow $2,2 mul $1,$2
oeis/066/A066872.asm
neoneye/loda-programs
11
174318
<reponame>neoneye/loda-programs ; A066872: p^2 + 1 as p runs through the primes. ; Submitted by <NAME>(s3) ; 5,10,26,50,122,170,290,362,530,842,962,1370,1682,1850,2210,2810,3482,3722,4490,5042,5330,6242,6890,7922,9410,10202,10610,11450,11882,12770,16130,17162,18770,19322,22202,22802,24650,26570,27890,29930,32042,32762,36482,37250,38810,39602,44522,49730,51530,52442,54290,57122,58082,63002,66050,69170,72362,73442,76730,78962,80090,85850,94250,96722,97970,100490,109562,113570,120410,121802,124610,128882,134690,139130,143642,146690,151322,157610,160802,167282,175562,177242,185762,187490,192722,196250 mul $0,2 max $0,1 seq $0,173919 ; Numbers that are prime or one less than a prime. pow $0,2 add $0,1
ex/test.asm
jtzeng/herontitan
1
19726
; Test program that should do nothing and not be run. .WORD HUE 0xFE5A .WORD HUELL 0xFACE .BYTE LOL 19 .DATA heheXD 1 2 3 4 5 4 3 0x2 0x1 .RAW 0xca 0xfe 0xba 0xbe .ASCIZ MESSAGE "HELLO WORLD!!! <3" .ASCIZ MSG " x y z abc" START: NOP HLT ADD R1,R7 SUB R1,R1 NOT R0 INC R2 INT 0xee PSH R2 POP R2 PKR R3 CLR R3 MOV R3,R0 LDC 0xff,R5 ; Infinite loop LOOP: NOP JMP LOOP WINK: JRA R5,R6 JMP TEST RSB TEST: JMO R1,R2,0xfedc ; Unclear spec order, so probably wrong? LDM 0xffff,R5 LDR R3,R4,RA LMO R3,R4,0xbabe,R1 STM R5,0xffff SRA RA,R3,R4 SMO R1,R3,R4,0xbeef JMP HUE
examples/shared/hello_world_blinky/src/analog.adb
webgeeks/Ada_Drivers_Library
0
19808
package body analog is procedure ADC_Init (Input : GPIO_Point; Channel: UInt5) is Input_Channel: constant Analog_Input_Channel := Channel; All_Regular_Conversions : constant Regular_Channel_Conversions := (1 => (Channel => Input_Channel, Sample_Time => Sample_144_Cycles)); begin Configure_Analog_Input(Input); Enable_Clock (Converter); Reset_All_ADC_Units; Configure_Common_Properties (Mode => Independent, Prescalar => PCLK2_Div_2, DMA_Mode => Disabled, Sampling_Delay => Sampling_Delay_5_Cycles); Configure_Unit (Converter, Resolution => ADC_Resolution_12_Bits, Alignment => Right_Aligned); Configure_Regular_Conversions (Converter, Continuous => False, Trigger => Software_Triggered, Enable_EOC => True, Conversions => All_Regular_Conversions); Enable (Converter); end ADC_Init; procedure Configure_Analog_Input (Input : GPIO_Point) is begin Enable_Clock (Input); Configure_IO (Input, (Mode => Mode_Analog, Resistors => Floating)); end Configure_Analog_Input; function Analog_Read return uint16 is begin Start_Conversion (Converter); Poll_For_Status (Converter, Regular_Channel_Conversion_Complete, Successful); if not Successful then return 0; else return Conversion_Value (Converter); end if; end Analog_Read; end analog;
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_436.asm
ljhsiun2/medusa
9
178361
<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_436.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r8 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x13c19, %r10 add $31329, %rdi movb $0x61, (%r10) inc %rbp lea addresses_normal_ht+0x1a609, %rdx nop nop nop nop nop and %rsi, %rsi mov $0x6162636465666768, %r8 movq %r8, (%rdx) nop nop nop nop nop sub $19681, %rdi lea addresses_D_ht+0x93e9, %rsi lea addresses_normal_ht+0x718e, %rdi nop nop and $55633, %r10 mov $21, %rcx rep movsl nop nop nop and $63669, %r9 lea addresses_UC_ht+0x1459, %r9 clflush (%r9) and $32838, %rdx mov $0x6162636465666768, %rsi movq %rsi, %xmm7 vmovups %ymm7, (%r9) nop nop nop inc %rdi lea addresses_normal_ht+0x1259, %rsi lea addresses_WT_ht+0x19799, %rdi nop nop nop nop and %r8, %r8 mov $15, %rcx rep movsq nop nop nop cmp %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r15 push %rbp push %rbx // Faulty Load lea addresses_WC+0x1ca59, %r15 nop nop nop nop cmp %r13, %r13 movups (%r15), %xmm0 vpextrq $1, %xmm0, %rbx lea oracles, %r11 and $0xff, %rbx shlq $12, %rbx mov (%r11,%rbx,1), %rbx pop %rbx pop %rbp pop %r15 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_WC', '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': 1, 'NT': False, 'same': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 4}} {'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 9}} {'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}} {'38': 21829} 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 */
projects/batfish/src/main/antlr4/org/batfish/grammar/topology/GNS3TopologyParser.g4
sskausik08/Wilco
0
1467
parser grammar GNS3TopologyParser; options { superClass = 'org.batfish.grammar.BatfishParser'; tokenVocab = GNS3TopologyLexer; } topology : ( router_line | edge_line | ignored_line )* ; router_line : ROUTER_HEADING name=VARIABLE ROUTER_TAIL NEWLINE ; edge_line : int1 = INTERFACE EQUALS host2 = VARIABLE int2 = INTERFACE NEWLINE ; ignored_line : ~( ROUTER_HEADING | INTERFACE ) ~NEWLINE* NEWLINE ;
programs/oeis/151/A151781.asm
neoneye/loda
22
247164
<reponame>neoneye/loda ; A151781: Partial sums of A151779. ; 1,7,13,43,49,79,109,259,265,295,325,475,505,655,805,1555,1561,1591,1621,1771,1801,1951,2101,2851,2881,3031,3181,3931,4081,4831,5581,9331,9337,9367,9397,9547,9577,9727,9877,10627,10657,10807,10957,11707,11857,12607,13357,17107,17137,17287,17437,18187,18337,19087,19837,23587,23737,24487,25237,28987,29737,33487,37237,55987,55993,56023,56053,56203,56233,56383,56533,57283,57313,57463,57613,58363,58513,59263,60013,63763,63793,63943,64093,64843,64993,65743,66493,70243,70393,71143,71893,75643,76393,80143,83893,102643,102673,102823,102973,103723 mov $2,$0 mov $3,$0 add $3,1 lpb $3 mov $0,$2 sub $3,1 sub $0,$3 seq $0,151779 ; a(1)=1; for n > 1, a(n)=6*5^{wt(n-1)-1}. add $1,$0 lpe mov $0,$1
programs/oeis/176/A176409.asm
karttu/loda
0
20328
<reponame>karttu/loda ; A176409: Multiples of 3 or 7. ; 0,3,6,7,9,12,14,15,18,21,24,27,28,30,33,35,36,39,42,45,48,49,51,54,56,57,60,63,66,69,70,72,75,77,78,81,84,87,90,91,93,96,98,99,102,105,108,111,112,114,117,119,120,123,126,129,132,133,135,138,140,141,144,147,150,153,154,156,159,161,162,165,168,171,174,175,177,180,182,183,186,189,192,195,196,198,201,203,204,207,210,213,216,217,219,222,224,225,228,231,234,237,238,240,243,245,246,249,252,255,258,259,261,264,266,267,270,273,276,279,280,282,285,287,288,291,294,297,300,301,303,306,308,309,312,315,318,321,322,324,327,329,330,333,336,339,342,343,345,348,350,351,354,357,360,363,364,366,369,371,372,375,378,381,384,385,387,390,392,393,396,399,402,405,406,408,411,413,414,417,420,423,426,427,429,432,434,435,438,441,444,447,448,450,453,455,456,459,462,465,468,469,471,474,476,477,480,483,486,489,490,492,495,497,498,501,504,507,510,511,513,516,518,519,522,525,528,531,532,534,537,539,540,543,546,549,552,553,555,558,560,561,564,567,570,573,574,576,579,581 mov $7,$0 mov $9,$0 lpb $9,1 clr $0,7 mov $0,$7 sub $9,1 sub $0,$9 add $5,10 mul $0,$5 add $0,1 bin $0,4 sub $0,4 mod $0,3 mov $2,1 add $2,$0 add $8,$2 lpe mov $1,$8
programs/oeis/213/A213038.asm
neoneye/loda
22
243794
<filename>programs/oeis/213/A213038.asm ; A213038: a(n) = n^2 - 3*floor(n/2)^2. ; 0,1,1,6,4,13,9,22,16,33,25,46,36,61,49,78,64,97,81,118,100,141,121,166,144,193,169,222,196,253,225,286,256,321,289,358,324,397,361,438,400,481,441,526,484,573,529,622,576,673,625,726,676,781,729,838,784,897,841,958,900,1021,961,1086,1024,1153,1089,1222,1156,1293,1225,1366,1296,1441,1369,1518,1444,1597,1521,1678,1600,1761,1681,1846,1764,1933,1849,2022,1936,2113,2025,2206,2116,2301,2209,2398,2304,2497,2401,2598 mov $2,$0 lpb $2 add $3,$1 mov $1,$0 mov $0,$3 add $0,1 sub $2,1 mov $3,$2 lpe mov $0,$1
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_388.asm
ljhsiun2/medusa
9
8787
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r15 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0xd7e6, %rsi lea addresses_D_ht+0x994e, %rdi nop xor %r9, %r9 mov $90, %rcx rep movsq nop nop nop dec %r9 lea addresses_A_ht+0xc466, %rbx nop nop nop nop nop dec %r15 mov (%rbx), %edx nop nop xor %r9, %r9 lea addresses_WT_ht+0xc5e6, %rdi nop nop nop and $35707, %rcx movb $0x61, (%rdi) nop nop nop nop inc %r9 lea addresses_WT_ht+0x107e6, %rsi lea addresses_D_ht+0xd3e6, %rdi nop nop add %rbx, %rbx mov $51, %rcx rep movsw nop nop nop nop nop inc %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %rax push %rcx push %rdi push %rdx push %rsi // REPMOV lea addresses_UC+0x1c266, %rsi lea addresses_WC+0xdac6, %rdi clflush (%rsi) nop lfence mov $110, %rcx rep movsw nop nop nop add %rdi, %rdi // Faulty Load lea addresses_UC+0x16be6, %rcx nop nop sub %rax, %rax movb (%rcx), %r15b lea oracles, %rsi and $0xff, %r15 shlq $12, %r15 mov (%rsi,%r15,1), %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 8, 'AVXalign': True}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC', 'congruent': 4, 'same': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}} {'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False}} {'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': True}} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
fiat-amd64/56.19_ratio11707_seed2109513243355895_square_p224.asm
dderjoel/fiat-crypto
491
104804
SECTION .text GLOBAL square_p224 square_p224: sub rsp, 0xc8 ; last 0x30 (6) for Caller - save regs mov [ rsp + 0x98 ], rbx; saving to stack mov [ rsp + 0xa0 ], rbp; saving to stack mov [ rsp + 0xa8 ], r12; saving to stack mov [ rsp + 0xb0 ], r13; saving to stack mov [ rsp + 0xb8 ], r14; saving to stack mov [ rsp + 0xc0 ], r15; saving to stack mov rax, [ rsi + 0x0 ]; load m64 x4 to register64 mov rdx, [ rsi + 0x0 ]; arg1[0] to rdx mulx r10, r11, rax; x12, x11<- x4 * arg1[0] mov rdx, [ rsi + 0x8 ]; arg1[1] to rdx mulx rbx, rbp, rax; x10, x9<- x4 * arg1[1] mov r12, [ rsi + 0x8 ]; load m64 x1 to register64 mov r13, 0xffffffffffffffff ; moving imm to reg mov rdx, r11; x11 to rdx mulx r11, r14, r13; _, x20<- x11 * 0xffffffffffffffff mov r11, r14; _, copying x20 here, cause x20 is needed in a reg for other than _, namely all: , x24--x25, x26--x27, _--x34, x22--x23, size: 4 add r11, rdx; could be done better, if r0 has been u8 as well mov r11, 0xffffffff00000000 ; moving imm to reg mov rdx, r11; 0xffffffff00000000 to rdx mulx r11, r15, r14; x27, x26<- x20 * 0xffffffff00000000 mov rcx, rdx; preserving value of 0xffffffff00000000 into a new reg mov rdx, [ rsi + 0x0 ]; saving arg1[0] in rdx. mulx r8, r9, r12; x50, x49<- x1 * arg1[0] mov rdx, -0x2 ; moving imm to reg inc rdx; OF<-0x0, preserve CF (debug: 6; load -2, increase it, save as -1) adox rbp, r10 adcx r15, rbp setc r10b; spill CF x36 to reg (r10) clc; adcx r9, r15 mov rdx, r13; 0xffffffffffffffff to rdx mulx r13, rbp, r9; _, x68<- x58 * 0xffffffffffffffff mulx r13, r15, rbp; x73, x72<- x68 * 0xffffffffffffffff xchg rdx, rcx; 0xffffffff00000000, swapping with 0xffffffffffffffff, which is currently in rdx mov [ rsp + 0x0 ], rdi; spilling out1 to mem mulx rcx, rdi, rbp; x75, x74<- x68 * 0xffffffff00000000 mov rdx, 0xffffffff ; moving imm to reg mov [ rsp + 0x8 ], rdi; spilling x74 to mem mov byte [ rsp + 0x10 ], r10b; spilling byte x36 to mem mulx rdi, r10, rbp; x71, x70<- x68 * 0xffffffff mov rdx, [ rsi + 0x10 ]; load m64 x2 to register64 mov [ rsp + 0x18 ], r8; spilling x50 to mem setc r8b; spill CF x59 to reg (r8) clc; adcx r15, rcx adcx r10, r13 mov r13, 0x0 ; moving imm to reg adcx rdi, r13 mulx rcx, r13, [ rsi + 0x18 ]; x93, x92<- x2 * arg1[3] mov [ rsp + 0x20 ], rdi; spilling x80 to mem mov [ rsp + 0x28 ], r10; spilling x78 to mem mulx rdi, r10, [ rsi + 0x8 ]; x97, x96<- x2 * arg1[1] mov [ rsp + 0x30 ], r15; spilling x76 to mem mov byte [ rsp + 0x38 ], r8b; spilling byte x59 to mem mulx r15, r8, [ rsi + 0x0 ]; x99, x98<- x2 * arg1[0] clc; adcx r10, r15 mulx rdx, r15, [ rsi + 0x10 ]; x95, x94<- x2 * arg1[2] adcx r15, rdi adcx r13, rdx mov rdi, 0x0 ; moving imm to reg adcx rcx, rdi mov rdx, [ rsi + 0x10 ]; arg1[2] to rdx mov [ rsp + 0x40 ], rcx; spilling x106 to mem mulx rdi, rcx, rax; x8, x7<- x4 * arg1[2] mov rdx, 0xffffffffffffffff ; moving imm to reg mov [ rsp + 0x48 ], r13; spilling x104 to mem mov [ rsp + 0x50 ], r15; spilling x102 to mem mulx r13, r15, r14; x25, x24<- x20 * 0xffffffffffffffff clc; adcx r15, r11 adox rcx, rbx setc bl; spill CF x29 to reg (rbx) clc; adcx rbp, r9 mov rbp, rdx; preserving value of 0xffffffffffffffff into a new reg mov rdx, [ rsi + 0x8 ]; saving arg1[1] in rdx. mulx r11, r9, r12; x48, x47<- x1 * arg1[1] setc dl; spill CF x82 to reg (rdx) clc; adcx r9, [ rsp + 0x18 ] setc bpl; spill CF x52 to reg (rbp) mov [ rsp + 0x58 ], r10; spilling x100 to mem movzx r10, byte [ rsp + 0x10 ]; load byte memx36 to register64 clc; mov [ rsp + 0x60 ], r11; spilling x48 to mem mov r11, -0x1 ; moving imm to reg adcx r10, r11; loading flag adcx rcx, r15 setc r10b; spill CF x38 to reg (r10) movzx r15, byte [ rsp + 0x38 ]; load byte memx59 to register64 clc; adcx r15, r11; loading flag adcx rcx, r9 setc r15b; spill CF x61 to reg (r15) clc; movzx rdx, dl adcx rdx, r11; loading flag adcx rcx, [ rsp + 0x8 ] setc dl; spill CF x84 to reg (rdx) clc; adcx r8, rcx mov r9b, dl; preserving value of x84 into a new reg mov rdx, [ rsi + 0x18 ]; saving arg1[3] in rdx. mulx rax, rcx, rax; x6, x5<- x4 * arg1[3] mov rdx, 0xffffffffffffffff ; moving imm to reg mov byte [ rsp + 0x68 ], r9b; spilling byte x84 to mem mulx r11, r9, r8; _, x117<- x107 * 0xffffffffffffffff mov r11, rdx; preserving value of 0xffffffffffffffff into a new reg mov rdx, [ rsi + 0x10 ]; saving arg1[2] in rdx. mov byte [ rsp + 0x70 ], r15b; spilling byte x61 to mem mov [ rsp + 0x78 ], rax; spilling x6 to mem mulx r15, rax, r12; x46, x45<- x1 * arg1[2] mov rdx, 0xffffffff ; moving imm to reg mulx r14, r11, r14; x23, x22<- x20 * 0xffffffff adox rcx, rdi setc dil; spill CF x108 to reg (rdi) clc; mov rdx, -0x1 ; moving imm to reg movzx rbx, bl adcx rbx, rdx; loading flag adcx r13, r11 seto bl; spill OF x18 to reg (rbx) inc rdx; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0)) mov r11, -0x1 ; moving imm to reg movzx r10, r10b adox r10, r11; loading flag adox rcx, r13 mov r10, r9; _, copying x117 here, cause x117 is needed in a reg for other than _, namely all: , x119--x120, _--x131, x121--x122, x123--x124, size: 4 setc r13b; spill CF x31 to reg (r13) clc; adcx r10, r8 setc r10b; spill CF x131 to reg (r10) clc; movzx rbp, bpl adcx rbp, r11; loading flag adcx rax, [ rsp + 0x60 ] movzx rbp, bl; x19, copying x18 here, cause x18 is needed in a reg for other than x19, namely all: , x19, size: 1 mov r8, [ rsp + 0x78 ]; load m64 x6 to register64 lea rbp, [ rbp + r8 ]; r8/64 + m8 setc r8b; spill CF x54 to reg (r8) movzx rbx, byte [ rsp + 0x70 ]; load byte memx61 to register64 clc; adcx rbx, r11; loading flag adcx rcx, rax seto bl; spill OF x40 to reg (rbx) movzx rax, byte [ rsp + 0x68 ]; load byte memx84 to register64 dec rdx; OF<-0x0, preserve CF (debug: state 1(0x0) (thanks Paul)) adox rax, rdx; loading flag adox rcx, [ rsp + 0x30 ] movzx r11, r13b; x32, copying x31 here, cause x31 is needed in a reg for other than x32, namely all: , x32, size: 1 lea r11, [ r11 + r14 ] mov rdx, [ rsi + 0x18 ]; arg1[3] to rdx mulx r12, rax, r12; x44, x43<- x1 * arg1[3] seto dl; spill OF x86 to reg (rdx) mov r14, -0x1 ; moving imm to reg inc r14; OF<-0x0, preserve CF (debug: state 5 (thanks Paul)) mov r13, -0x1 ; moving imm to reg movzx r8, r8b adox r8, r13; loading flag adox r15, rax mov r8, 0xffffffff00000000 ; moving imm to reg xchg rdx, r8; 0xffffffff00000000, swapping with x86, which is currently in rdx mulx rax, r14, r9; x124, x123<- x117 * 0xffffffff00000000 seto r13b; spill OF x56 to reg (r13) mov rdx, 0x0 ; moving imm to reg dec rdx; OF<-0x0, preserve CF (debug: state 4 (thanks Paul)) movzx rdi, dil adox rdi, rdx; loading flag adox rcx, [ rsp + 0x58 ] movzx rdi, r13b; x57, copying x56 here, cause x56 is needed in a reg for other than x57, namely all: , x57, size: 1 lea rdi, [ rdi + r12 ] seto r12b; spill OF x110 to reg (r12) inc rdx; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0)) mov r13, -0x1 ; moving imm to reg movzx r10, r10b adox r10, r13; loading flag adox rcx, r14 setc r10b; spill CF x63 to reg (r10) clc; movzx rbx, bl adcx rbx, r13; loading flag adcx rbp, r11 setc bl; spill CF x42 to reg (rbx) clc; movzx r10, r10b adcx r10, r13; loading flag adcx rbp, r15 movzx r10, bl; x66, copying x42 here, cause x42 is needed in a reg for other than x66, namely all: , x66--x67, size: 1 adcx r10, rdi setc r11b; spill CF x67 to reg (r11) clc; movzx r8, r8b adcx r8, r13; loading flag adcx rbp, [ rsp + 0x28 ] mov r8, 0xffffffff ; moving imm to reg xchg rdx, r9; x117, swapping with 0x0, which is currently in rdx mulx r15, r14, r8; x120, x119<- x117 * 0xffffffff mov rdi, 0xffffffffffffffff ; moving imm to reg mulx rdx, rbx, rdi; x122, x121<- x117 * 0xffffffffffffffff mov r9, [ rsp + 0x20 ]; x89, copying x80 here, cause x80 is needed in a reg for other than x89, namely all: , x89--x90, size: 1 adcx r9, r10 movzx r10, r11b; x91, copying x67 here, cause x67 is needed in a reg for other than x91, namely all: , x91, size: 1 mov r13, 0x0 ; moving imm to reg adcx r10, r13 clc; adcx rbx, rax mov rax, [ rsi + 0x18 ]; load m64 x3 to register64 mov r11, rdx; preserving value of x122 into a new reg mov rdx, [ rsi + 0x8 ]; saving arg1[1] in rdx. mulx r13, r8, rax; x146, x145<- x3 * arg1[1] adcx r14, r11 setc dl; spill CF x128 to reg (rdx) clc; mov r11, -0x1 ; moving imm to reg movzx r12, r12b adcx r12, r11; loading flag adcx rbp, [ rsp + 0x50 ] mov r12, [ rsp + 0x48 ]; x113, copying x104 here, cause x104 is needed in a reg for other than x113, namely all: , x113--x114, size: 1 adcx r12, r9 adox rbx, rbp mov r9, [ rsp + 0x40 ]; x115, copying x106 here, cause x106 is needed in a reg for other than x115, namely all: , x115--x116, size: 1 adcx r9, r10 movzx r10, dl; x129, copying x128 here, cause x128 is needed in a reg for other than x129, namely all: , x129, size: 1 lea r10, [ r10 + r15 ] mov rdx, [ rsi + 0x18 ]; arg1[3] to rdx mulx r15, rbp, rax; x142, x141<- x3 * arg1[3] adox r14, r12 mov rdx, rax; x3 to rdx mulx rax, r12, [ rsi + 0x0 ]; x148, x147<- x3 * arg1[0] adox r10, r9 seto r9b; spill OF x139 to reg (r9) inc r11; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0)) adox r12, rcx movzx rcx, r9b; x140, copying x139 here, cause x139 is needed in a reg for other than x140, namely all: , x140, size: 1 adcx rcx, r11 mulx rdx, r9, [ rsi + 0x10 ]; x144, x143<- x3 * arg1[2] clc; adcx r8, rax adcx r9, r13 adcx rbp, rdx mov rdx, rdi; 0xffffffffffffffff to rdx mulx r13, rax, r12; _, x166<- x156 * 0xffffffffffffffff adox r8, rbx mulx r13, rbx, rax; x171, x170<- x166 * 0xffffffffffffffff adcx r15, r11 mov r11, 0xffffffff ; moving imm to reg xchg rdx, r11; 0xffffffff, swapping with 0xffffffffffffffff, which is currently in rdx mov [ rsp + 0x80 ], r15; spilling x155 to mem mulx r11, r15, rax; x169, x168<- x166 * 0xffffffff mov rdx, 0xffffffff00000000 ; moving imm to reg mov [ rsp + 0x88 ], rcx; spilling x140 to mem mov [ rsp + 0x90 ], r8; spilling x158 to mem mulx rcx, r8, rax; x173, x172<- x166 * 0xffffffff00000000 clc; adcx rbx, rcx adcx r15, r13 adox r9, r14 mov r14, 0x0 ; moving imm to reg adcx r11, r14 clc; adcx rax, r12 adox rbp, r10 mov rax, [ rsp + 0x90 ]; x181, copying x158 here, cause x158 is needed in a reg for other than x181, namely all: , x181--x182, size: 1 adcx rax, r8 mov r10, [ rsp + 0x80 ]; load m64 x155 to register64 mov r12, [ rsp + 0x88 ]; x164, copying x140 here, cause x140 is needed in a reg for other than x164, namely all: , x164--x165, size: 1 adox r12, r10 adcx rbx, r9 setc r13b; spill CF x184 to reg (r13) seto r10b; spill OF x165 to reg (r10) mov rcx, rax; x190, copying x181 here, cause x181 is needed in a reg for other than x190, namely all: , x190--x191, x200, size: 2 sub rcx, 0x00000001 mov r8, rbx; x192, copying x183 here, cause x183 is needed in a reg for other than x192, namely all: , x192--x193, x201, size: 2 sbb r8, rdx dec r14; OF<-0x0, preserve CF (debug: state 3 (y: 0, n: -1)) movzx r13, r13b adox r13, r14; loading flag adox rbp, r15 adox r11, r12 movzx r15, r10b; x189, copying x165 here, cause x165 is needed in a reg for other than x189, namely all: , x189, size: 1 mov r9, 0x0 ; moving imm to reg adox r15, r9 mov r10, rbp; x194, copying x185 here, cause x185 is needed in a reg for other than x194, namely all: , x202, x194--x195, size: 2 mov r12, 0xffffffffffffffff ; moving imm to reg sbb r10, r12 mov r13, r11; x196, copying x187 here, cause x187 is needed in a reg for other than x196, namely all: , x203, x196--x197, size: 2 mov r9, 0xffffffff ; moving imm to reg sbb r13, r9 sbb r15, 0x00000000 cmovc r13, r11; if CF, x203<- x187 (nzVar) cmovc r8, rbx; if CF, x201<- x183 (nzVar) mov r15, [ rsp + 0x0 ]; load m64 out1 to register64 mov [ r15 + 0x8 ], r8; out1[1] = x201 cmovc r10, rbp; if CF, x202<- x185 (nzVar) cmovc rcx, rax; if CF, x200<- x181 (nzVar) mov [ r15 + 0x10 ], r10; out1[2] = x202 mov [ r15 + 0x18 ], r13; out1[3] = x203 mov [ r15 + 0x0 ], rcx; out1[0] = x200 mov rbx, [ rsp + 0x98 ]; restoring from stack mov rbp, [ rsp + 0xa0 ]; restoring from stack mov r12, [ rsp + 0xa8 ]; restoring from stack mov r13, [ rsp + 0xb0 ]; restoring from stack mov r14, [ rsp + 0xb8 ]; restoring from stack mov r15, [ rsp + 0xc0 ]; restoring from stack add rsp, 0xc8 ret ; cpu 11th Gen Intel(R) Core(TM) i7-11700KF @ 3.60GHz ; clocked at 3600 MHz ; first cyclecount 69.82, best 55.437086092715234, lastGood 56.18543046357616 ; seed 2109513243355895 ; CC / CFLAGS clang / -march=native -mtune=native -O3 ; time needed: 695363 ms / 60000 runs=> 11.589383333333334ms/run ; Time spent for assembling and measureing (initial batch_size=151, initial num_batches=101): 156908 ms ; Ratio (time for assembling + measure)/(total runtime for 60000runs): 0.22564904948925957 ; number reverted permutation/ tried permutation: 25225 / 30023 =84.019% ; number reverted decision/ tried decision: 23446 / 29978 =78.211%
Java/src/com/samuelyvon/BrainCramp/Compilation/nasm/out/mandelbrot.asm
SamuelYvon/BrainCramp
3
241733
<gh_stars>1-10 section .data buffer times 500 db 0 value db 0 section .text global _start _start: mov ESI , 0 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 13 mov [buffer + ESI] , AH loop_start_1: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 2 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 2 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1 loop_end_1: ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 6 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 3 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_19: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_19 loop_start_20: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_20 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_20 loop_end_20: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_24: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_24 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_24 loop_end_24: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_19 loop_end_19: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_31: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_31 ; RIGHT ADD ESI , 8 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_31 loop_end_31: ; LEFT SUB ESI , 9 loop_start_37: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_37 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_37 loop_end_37: ; RIGHT ADD ESI , 8 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH loop_start_45: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_45 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_47: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_47 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_47 loop_end_47: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_45 loop_end_45: ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 27 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 17 loop_start_60: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_60 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_60 loop_end_60: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_66: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_66 ; RIGHT ADD ESI , 6 loop_start_68: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_68 ; RIGHT ADD ESI , 7 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_68 loop_end_68: ; LEFT SUB ESI , 9 loop_start_74: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_74 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_74 loop_end_74: ; RIGHT ADD ESI , 7 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 4 mov [buffer + ESI] , AH loop_start_82: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_82 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_84: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_84 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_84 loop_end_84: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_82 loop_end_82: ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 7 mov [buffer + ESI] , AH loop_start_96: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_96 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_98: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_98 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_98 loop_end_98: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_96 loop_end_96: ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 16 loop_start_109: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_109 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_109 loop_end_109: ; RIGHT ADD ESI , 3 loop_start_113: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_113 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_116: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_116 ; RIGHT ADD ESI , 7 loop_start_118: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_118 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_118 loop_end_118: ; LEFT SUB ESI , 6 loop_start_125: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_125 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_125 loop_end_125: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_116 loop_end_116: ; LEFT SUB ESI , 9 loop_start_138: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_138 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_138 loop_end_138: ; RIGHT ADD ESI , 9 loop_start_142: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_142 ; RIGHT ADD ESI , 8 loop_start_144: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_144 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_144 loop_end_144: ; LEFT SUB ESI , 7 loop_start_151: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_151 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_151 loop_end_151: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_142 loop_end_142: ; LEFT SUB ESI , 9 loop_start_164: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_164 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_164 loop_end_164: ; RIGHT ADD ESI , 7 loop_start_168: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_168 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_168 loop_end_168: ; LEFT SUB ESI , 7 loop_start_175: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_175 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_175 loop_end_175: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_185: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_185 loop_start_186: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_186 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_186 loop_end_186: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_209: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_209 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_209 loop_end_209: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_185 loop_end_185: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_216: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_216 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_216 loop_end_216: ; LEFT SUB ESI , 9 loop_start_222: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_222 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_222 loop_end_222: ; RIGHT ADD ESI , 9 loop_start_226: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_226 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_230: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_230 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_230 loop_end_230: ; LEFT SUB ESI , 4 loop_start_237: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_237 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_242: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_242 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_245: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_245 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_245 loop_end_245: ; LEFT SUB ESI , 2 loop_start_252: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_252 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_252 loop_end_252: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_242 loop_end_242: ; LEFT SUB ESI , 8 loop_start_264: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_264 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_264 loop_end_264: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_237 loop_end_237: ; RIGHT ADD ESI , 9 loop_start_269: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_269 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_269 loop_end_269: ; LEFT SUB ESI , 9 loop_start_273: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_273 ; RIGHT ADD ESI , 1 loop_start_275: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_275 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_275 loop_end_275: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_273 loop_end_273: ; RIGHT ADD ESI , 1 loop_start_284: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_284 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_284 loop_end_284: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_226 loop_end_226: ; LEFT SUB ESI , 9 loop_start_295: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_295 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_301: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_301 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_306: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_306 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_306 loop_end_306: ; LEFT SUB ESI , 1 loop_start_316: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_316 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_316 loop_end_316: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_301 loop_end_301: ; LEFT SUB ESI , 3 loop_start_325: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_325 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_325 loop_end_325: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_295 loop_end_295: ; RIGHT ADD ESI , 9 loop_start_336: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_336 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_336 loop_end_336: ; LEFT SUB ESI , 9 loop_start_342: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_342 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_342 loop_end_342: ; RIGHT ADD ESI , 9 loop_start_346: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_346 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_350: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_350 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_350 loop_end_350: ; LEFT SUB ESI , 5 loop_start_357: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_357 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_362: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_362 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_365: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_365 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_365 loop_end_365: ; LEFT SUB ESI , 3 loop_start_372: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_372 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_372 loop_end_372: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_362 loop_end_362: ; LEFT SUB ESI , 8 loop_start_384: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_384 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_384 loop_end_384: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_357 loop_end_357: ; RIGHT ADD ESI , 9 loop_start_389: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_389 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_389 loop_end_389: ; LEFT SUB ESI , 9 loop_start_393: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_393 ; RIGHT ADD ESI , 2 loop_start_395: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_395 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_395 loop_end_395: ; LEFT SUB ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_393 loop_end_393: ; RIGHT ADD ESI , 2 loop_start_404: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_404 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_404 loop_end_404: ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_346 loop_end_346: ; LEFT SUB ESI , 9 loop_start_415: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_415 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_421: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_421 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_426: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_426 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_426 loop_end_426: ; LEFT SUB ESI , 1 loop_start_436: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_436 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_436 loop_end_436: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_421 loop_end_421: ; LEFT SUB ESI , 3 loop_start_445: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_445 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_445 loop_end_445: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_415 loop_end_415: ; RIGHT ADD ESI , 9 loop_start_456: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_456 ; RIGHT ADD ESI , 4 loop_start_458: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_458 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 36 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 36 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_458 loop_end_458: ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_456 loop_end_456: ; LEFT SUB ESI , 9 loop_start_467: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_467 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_467 loop_end_467: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_472: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_472 loop_start_473: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_473 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_473 loop_end_473: ; LEFT SUB ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_479: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_479 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_479 loop_end_479: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_472 loop_end_472: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 21 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_489: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_489 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_489 loop_end_489: ; RIGHT ADD ESI , 9 loop_start_493: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_493 ; RIGHT ADD ESI , 3 loop_start_495: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_495 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_495 loop_end_495: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_503: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_503 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_508: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_508 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_508 loop_end_508: ; LEFT SUB ESI , 4 loop_start_515: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_515 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 loop_start_520: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_520 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_520 loop_end_520: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_527: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_527 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_527 loop_end_527: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_515 loop_end_515: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_503 loop_end_503: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_537: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_537 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_537 loop_end_537: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_545: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_545 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_550: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_550 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_550 loop_end_550: ; LEFT SUB ESI , 3 loop_start_557: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_557 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 12 loop_start_562: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_562 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_562 loop_end_562: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_569: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_569 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_569 loop_end_569: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_557 loop_end_557: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_545 loop_end_545: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_580: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_580 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_583: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_583 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_583 loop_end_583: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_580 loop_end_580: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_493 loop_end_493: ; LEFT SUB ESI , 9 loop_start_591: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_591 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_591 loop_end_591: ; LEFT SUB ESI , 7 loop_start_595: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_595 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_595 loop_end_595: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 26 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_606: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_606 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_606 loop_end_606: ; LEFT SUB ESI , 4 loop_start_613: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_613 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_613 loop_end_613: ; RIGHT ADD ESI , 2 loop_start_622: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_622 ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_626: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_626 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_626 loop_end_626: ; RIGHT ADD ESI , 1 loop_start_636: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_636 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_639: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_639 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_639 loop_end_639: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_636 loop_end_636: ; RIGHT ADD ESI , 13 loop_start_650: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_650 ; RIGHT ADD ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_650 loop_end_650: ; LEFT SUB ESI , 9 loop_start_660: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_660 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_660 loop_end_660: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_666: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_666 ; RIGHT ADD ESI , 5 loop_start_668: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_668 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_668 loop_end_668: ; LEFT SUB ESI , 4 loop_start_675: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_675 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_675 loop_end_675: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_666 loop_end_666: ; LEFT SUB ESI , 9 loop_start_686: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_686 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_686 loop_end_686: ; RIGHT ADD ESI , 9 loop_start_690: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_690 ; RIGHT ADD ESI , 2 loop_start_692: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_692 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_692 loop_end_692: ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_690 loop_end_690: ; LEFT SUB ESI , 9 loop_start_701: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_701 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_701 loop_end_701: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_706: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_706 loop_start_707: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_707 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_707 loop_end_707: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_730: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_730 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_730 loop_end_730: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_706 loop_end_706: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_737: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_737 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_737 loop_end_737: ; LEFT SUB ESI , 9 loop_start_743: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_743 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_743 loop_end_743: ; RIGHT ADD ESI , 9 loop_start_747: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_747 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_751: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_751 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_751 loop_end_751: ; LEFT SUB ESI , 5 loop_start_758: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_758 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_763: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_763 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_766: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_766 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_766 loop_end_766: ; LEFT SUB ESI , 2 loop_start_773: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_773 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_773 loop_end_773: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_763 loop_end_763: ; LEFT SUB ESI , 8 loop_start_785: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_785 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_785 loop_end_785: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_758 loop_end_758: ; RIGHT ADD ESI , 9 loop_start_790: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_790 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_790 loop_end_790: ; LEFT SUB ESI , 9 loop_start_794: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_794 ; RIGHT ADD ESI , 1 loop_start_796: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_796 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_796 loop_end_796: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_794 loop_end_794: ; RIGHT ADD ESI , 1 loop_start_805: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_805 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_805 loop_end_805: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_747 loop_end_747: ; LEFT SUB ESI , 9 loop_start_816: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_816 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_822: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_822 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_827: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_827 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_827 loop_end_827: ; LEFT SUB ESI , 1 loop_start_837: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_837 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_837 loop_end_837: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_822 loop_end_822: ; LEFT SUB ESI , 2 loop_start_846: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_846 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_846 loop_end_846: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_816 loop_end_816: ; RIGHT ADD ESI , 9 loop_start_857: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_857 ; RIGHT ADD ESI , 6 loop_start_859: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_859 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_859 loop_end_859: ; LEFT SUB ESI , 5 loop_start_866: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_866 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_866 loop_end_866: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_857 loop_end_857: ; LEFT SUB ESI , 9 loop_start_877: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_877 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_877 loop_end_877: ; RIGHT ADD ESI , 9 loop_start_881: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_881 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_881 loop_end_881: ; LEFT SUB ESI , 9 loop_start_887: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_887 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_887 loop_end_887: ; RIGHT ADD ESI , 9 loop_start_891: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_891 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_895: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_895 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_895 loop_end_895: ; LEFT SUB ESI , 5 loop_start_902: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_902 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_907: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_907 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_910: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_910 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_910 loop_end_910: ; LEFT SUB ESI , 2 loop_start_917: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_917 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_917 loop_end_917: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_907 loop_end_907: ; LEFT SUB ESI , 8 loop_start_929: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_929 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_929 loop_end_929: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_902 loop_end_902: ; RIGHT ADD ESI , 9 loop_start_934: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_934 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_934 loop_end_934: ; LEFT SUB ESI , 9 loop_start_938: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_938 ; RIGHT ADD ESI , 1 loop_start_940: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_940 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_940 loop_end_940: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_938 loop_end_938: ; RIGHT ADD ESI , 1 loop_start_949: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_949 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_949 loop_end_949: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_891 loop_end_891: ; LEFT SUB ESI , 9 loop_start_960: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_960 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_966: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_966 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_971: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_971 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_971 loop_end_971: ; LEFT SUB ESI , 1 loop_start_981: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_981 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_981 loop_end_981: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_966 loop_end_966: ; LEFT SUB ESI , 3 loop_start_990: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_990 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_990 loop_end_990: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_960 loop_end_960: ; RIGHT ADD ESI , 9 loop_start_1001: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1001 ; RIGHT ADD ESI , 4 loop_start_1003: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1003 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 36 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 36 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1003 loop_end_1003: ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1001 loop_end_1001: ; LEFT SUB ESI , 9 loop_start_1012: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1012 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1012 loop_end_1012: ; RIGHT ADD ESI , 9 loop_start_1016: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1016 ; RIGHT ADD ESI , 3 loop_start_1018: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1018 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 36 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 36 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1018 loop_end_1018: ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1016 loop_end_1016: ; LEFT SUB ESI , 9 loop_start_1027: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1027 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1027 loop_end_1027: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_1032: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1032 loop_start_1033: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1033 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1033 loop_end_1033: ; LEFT SUB ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_1039: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1039 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1039 loop_end_1039: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1032 loop_end_1032: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_1046: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1046 ; RIGHT ADD ESI , 8 loop_start_1048: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1048 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1048 loop_end_1048: ; LEFT SUB ESI , 7 loop_start_1055: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1055 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1055 loop_end_1055: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1046 loop_end_1046: ; LEFT SUB ESI , 9 loop_start_1066: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1066 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1066 loop_end_1066: ; RIGHT ADD ESI , 9 loop_start_1070: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1070 ; RIGHT ADD ESI , 6 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1070 loop_end_1070: ; LEFT SUB ESI , 9 loop_start_1076: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1076 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1076 loop_end_1076: ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1082: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1082 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1082 loop_end_1082: ; RIGHT ADD ESI , 1 loop_start_1091: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1091 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_1094: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1094 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 2 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1094 loop_end_1094: ; RIGHT ADD ESI , 5 loop_start_1103: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1103 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1103 loop_end_1103: ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1091 loop_end_1091: ; LEFT SUB ESI , 1 loop_start_1116: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1116 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1116 loop_end_1116: ; LEFT SUB ESI , 5 loop_start_1123: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1123 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1123 loop_end_1123: ; RIGHT ADD ESI , 6 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_1134: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1134 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1134 loop_end_1134: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_1142: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1142 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1147: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1147 ; RIGHT ADD ESI , 2 loop_start_1149: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1149 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1149 loop_end_1149: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_1157: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1157 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1162: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1162 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1162 loop_end_1162: ; LEFT SUB ESI , 3 loop_start_1169: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1169 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 12 loop_start_1174: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1174 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1174 loop_end_1174: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_1181: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1181 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1181 loop_end_1181: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1169 loop_end_1169: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1157 loop_end_1157: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_1191: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1191 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1191 loop_end_1191: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_1199: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1199 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1204: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1204 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1204 loop_end_1204: ; LEFT SUB ESI , 2 loop_start_1211: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1211 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 11 loop_start_1216: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1216 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1216 loop_end_1216: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1223: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1223 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1223 loop_end_1223: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1211 loop_end_1211: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1199 loop_end_1199: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1234: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1234 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1237: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1237 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1237 loop_end_1237: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1234 loop_end_1234: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1147 loop_end_1147: ; LEFT SUB ESI , 9 loop_start_1245: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1245 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1245 loop_end_1245: ; RIGHT ADD ESI , 4 loop_start_1249: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1249 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1249 loop_end_1249: ; LEFT SUB ESI , 4 loop_start_1256: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1256 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1261: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1261 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_1265: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1265 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1265 loop_end_1265: ; LEFT SUB ESI , 2 loop_start_1272: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1272 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1272 loop_end_1272: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1261 loop_end_1261: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1283: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1283 ; RIGHT ADD ESI , 1 loop_start_1285: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1285 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_1290: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1290 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 loop_start_1297: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1297 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1297 loop_end_1297: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1290 loop_end_1290: ; RIGHT ADD ESI , 1 loop_start_1306: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1306 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1306 loop_end_1306: ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1285 loop_end_1285: ; RIGHT ADD ESI , 1 loop_start_1317: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1317 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_1322: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1322 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1322 loop_end_1322: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1317 loop_end_1317: ; RIGHT ADD ESI , 1 loop_start_1333: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1333 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1333 loop_end_1333: ; LEFT SUB ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1283 loop_end_1283: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1256 loop_end_1256: ; RIGHT ADD ESI , 3 loop_start_1346: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1346 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1346 loop_end_1346: ; LEFT SUB ESI , 3 loop_start_1353: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1353 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_1358: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1358 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1362: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1362 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1362 loop_end_1362: ; LEFT SUB ESI , 1 loop_start_1369: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1369 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1369 loop_end_1369: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1358 loop_end_1358: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1380: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1380 ; RIGHT ADD ESI , 1 loop_start_1382: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1382 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_1387: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1387 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 loop_start_1394: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1394 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1394 loop_end_1394: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1387 loop_end_1387: ; LEFT SUB ESI , 1 loop_start_1403: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1403 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1403 loop_end_1403: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1382 loop_end_1382: ; RIGHT ADD ESI , 2 loop_start_1414: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1414 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_1419: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1419 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1419 loop_end_1419: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1414 loop_end_1414: ; LEFT SUB ESI , 1 loop_start_1430: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1430 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1430 loop_end_1430: ; LEFT SUB ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1380 loop_end_1380: ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1353 loop_end_1353: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1142 loop_end_1142: ; RIGHT ADD ESI , 4 loop_start_1444: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1444 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1444 loop_end_1444: ; LEFT SUB ESI , 4 loop_start_1451: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1451 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1456: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1456 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1456 loop_end_1456: ; LEFT SUB ESI , 9 loop_start_1460: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1460 ; RIGHT ADD ESI , 1 loop_start_1462: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1462 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_1467: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1467 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 loop_start_1474: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1474 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1474 loop_end_1474: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1467 loop_end_1467: ; RIGHT ADD ESI , 1 loop_start_1483: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1483 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1483 loop_end_1483: ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1462 loop_end_1462: ; RIGHT ADD ESI , 1 loop_start_1494: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1494 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_1499: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1499 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1499 loop_end_1499: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1494 loop_end_1494: ; RIGHT ADD ESI , 1 loop_start_1510: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1510 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1510 loop_end_1510: ; LEFT SUB ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1460 loop_end_1460: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1451 loop_end_1451: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1526: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1526 ; RIGHT ADD ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1526 loop_end_1526: ; LEFT SUB ESI , 9 loop_start_1534: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1534 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1534 loop_end_1534: ; RIGHT ADD ESI , 9 loop_start_1538: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1538 ; RIGHT ADD ESI , 5 loop_start_1540: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1540 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1540 loop_end_1540: ; LEFT SUB ESI , 4 loop_start_1547: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1547 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1547 loop_end_1547: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1538 loop_end_1538: ; LEFT SUB ESI , 9 loop_start_1558: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1558 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1558 loop_end_1558: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_1563: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1563 loop_start_1564: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1564 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1564 loop_end_1564: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_1587: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1587 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1587 loop_end_1587: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1563 loop_end_1563: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_1594: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1594 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1594 loop_end_1594: ; LEFT SUB ESI , 9 loop_start_1600: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1600 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1600 loop_end_1600: ; RIGHT ADD ESI , 9 loop_start_1604: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1604 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_1608: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1608 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1608 loop_end_1608: ; LEFT SUB ESI , 4 loop_start_1615: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1615 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_1620: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1620 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_1623: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1623 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1623 loop_end_1623: ; LEFT SUB ESI , 2 loop_start_1630: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1630 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1630 loop_end_1630: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1620 loop_end_1620: ; LEFT SUB ESI , 8 loop_start_1642: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1642 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1642 loop_end_1642: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1615 loop_end_1615: ; RIGHT ADD ESI , 9 loop_start_1647: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1647 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1647 loop_end_1647: ; LEFT SUB ESI , 9 loop_start_1651: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1651 ; RIGHT ADD ESI , 1 loop_start_1653: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1653 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1653 loop_end_1653: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1651 loop_end_1651: ; RIGHT ADD ESI , 1 loop_start_1662: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1662 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1662 loop_end_1662: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1604 loop_end_1604: ; LEFT SUB ESI , 9 loop_start_1673: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1673 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_1679: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1679 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1684: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1684 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1684 loop_end_1684: ; LEFT SUB ESI , 1 loop_start_1694: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1694 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1694 loop_end_1694: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1679 loop_end_1679: ; LEFT SUB ESI , 2 loop_start_1703: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1703 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1703 loop_end_1703: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1673 loop_end_1673: ; RIGHT ADD ESI , 9 loop_start_1714: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1714 ; RIGHT ADD ESI , 3 loop_start_1716: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1716 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 36 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 36 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1716 loop_end_1716: ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1714 loop_end_1714: ; LEFT SUB ESI , 9 loop_start_1725: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1725 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1725 loop_end_1725: ; RIGHT ADD ESI , 5 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_1732: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1732 loop_start_1733: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1733 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1733 loop_end_1733: ; LEFT SUB ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_1739: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1739 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1739 loop_end_1739: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1732 loop_end_1732: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_1746: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1746 ; RIGHT ADD ESI , 3 loop_start_1748: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1748 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1748 loop_end_1748: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_1756: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1756 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1761: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1761 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1761 loop_end_1761: ; LEFT SUB ESI , 4 loop_start_1768: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1768 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 loop_start_1773: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1773 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1773 loop_end_1773: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1780: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1780 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1780 loop_end_1780: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1768 loop_end_1768: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1756 loop_end_1756: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_1790: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1790 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1790 loop_end_1790: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_1798: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1798 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1803: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1803 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1803 loop_end_1803: ; LEFT SUB ESI , 3 loop_start_1810: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1810 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 12 loop_start_1815: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1815 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1815 loop_end_1815: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_1822: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1822 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1822 loop_end_1822: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1810 loop_end_1810: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1798 loop_end_1798: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1833: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1833 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1836: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1836 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1836 loop_end_1836: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1833 loop_end_1833: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1746 loop_end_1746: ; LEFT SUB ESI , 9 loop_start_1844: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1844 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1844 loop_end_1844: ; RIGHT ADD ESI , 3 loop_start_1848: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1848 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1848 loop_end_1848: ; LEFT SUB ESI , 3 loop_start_1855: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1855 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_1860: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1860 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_1864: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1864 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1864 loop_end_1864: ; LEFT SUB ESI , 3 loop_start_1871: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1871 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1871 loop_end_1871: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1860 loop_end_1860: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1882: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1882 ; RIGHT ADD ESI , 1 loop_start_1884: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1884 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_1889: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1889 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 12 loop_start_1896: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1896 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1896 loop_end_1896: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1889 loop_end_1889: ; RIGHT ADD ESI , 1 loop_start_1905: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1905 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1905 loop_end_1905: ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1884 loop_end_1884: ; RIGHT ADD ESI , 2 loop_start_1916: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1916 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_1921: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1921 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1921 loop_end_1921: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1916 loop_end_1916: ; RIGHT ADD ESI , 1 loop_start_1932: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1932 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1932 loop_end_1932: ; LEFT SUB ESI , 13 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1882 loop_end_1882: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1855 loop_end_1855: ; RIGHT ADD ESI , 4 loop_start_1942: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1942 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1942 loop_end_1942: ; LEFT SUB ESI , 4 loop_start_1949: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1949 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_1954: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1954 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_1958: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1958 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1958 loop_end_1958: ; LEFT SUB ESI , 2 loop_start_1965: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1965 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1965 loop_end_1965: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1954 loop_end_1954: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_1976: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1976 ; RIGHT ADD ESI , 1 loop_start_1978: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1978 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_1983: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1983 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 loop_start_1990: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1990 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1990 loop_end_1990: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1983 loop_end_1983: ; LEFT SUB ESI , 1 loop_start_1999: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_1999 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1999 loop_end_1999: ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1978 loop_end_1978: ; RIGHT ADD ESI , 3 loop_start_2010: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2010 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2015: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2015 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 10 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2015 loop_end_2015: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2010 loop_end_2010: ; LEFT SUB ESI , 1 loop_start_2026: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2026 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2026 loop_end_2026: ; LEFT SUB ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1976 loop_end_1976: ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_1949 loop_end_1949: ; RIGHT ADD ESI , 9 loop_start_2039: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2039 ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2039 loop_end_2039: ; LEFT SUB ESI , 9 loop_start_2049: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2049 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2049 loop_end_2049: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2057: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2057 ; RIGHT ADD ESI , 7 loop_start_2059: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2059 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2059 loop_end_2059: ; LEFT SUB ESI , 6 loop_start_2066: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2066 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2066 loop_end_2066: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2057 loop_end_2057: ; LEFT SUB ESI , 9 loop_start_2077: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2077 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2077 loop_end_2077: ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2083: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2083 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2083 loop_end_2083: ; RIGHT ADD ESI , 2 loop_start_2092: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2092 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 loop_start_2095: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2095 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 2 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2095 loop_end_2095: ; RIGHT ADD ESI , 5 loop_start_2104: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2104 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2104 loop_end_2104: ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2092 loop_end_2092: ; LEFT SUB ESI , 2 loop_start_2117: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2117 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2117 loop_end_2117: ; LEFT SUB ESI , 5 loop_start_2124: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2124 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2124 loop_end_2124: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_2132: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2132 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2132 loop_end_2132: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_2140: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2140 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2145: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2145 ; RIGHT ADD ESI , 3 loop_start_2147: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2147 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2147 loop_end_2147: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2155: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2155 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_2160: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2160 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2160 loop_end_2160: ; LEFT SUB ESI , 2 loop_start_2167: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2167 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 11 loop_start_2172: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2172 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2172 loop_end_2172: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2179: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2179 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2179 loop_end_2179: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2167 loop_end_2167: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2155 loop_end_2155: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_2189: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2189 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2189 loop_end_2189: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_2197: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2197 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2202: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2202 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2202 loop_end_2202: ; LEFT SUB ESI , 3 loop_start_2209: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2209 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 12 loop_start_2214: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2214 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2214 loop_end_2214: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_2221: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2221 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2221 loop_end_2221: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2209 loop_end_2209: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2197 loop_end_2197: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2232: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2232 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_2235: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2235 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2235 loop_end_2235: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2232 loop_end_2232: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2145 loop_end_2145: ; LEFT SUB ESI , 9 loop_start_2243: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2243 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2243 loop_end_2243: ; RIGHT ADD ESI , 3 loop_start_2247: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2247 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2247 loop_end_2247: ; LEFT SUB ESI , 3 loop_start_2254: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2254 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_2259: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2259 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2263: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2263 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2263 loop_end_2263: ; LEFT SUB ESI , 1 loop_start_2270: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2270 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2270 loop_end_2270: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2259 loop_end_2259: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_2281: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2281 ; RIGHT ADD ESI , 1 loop_start_2283: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2283 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_2288: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2288 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 loop_start_2295: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2295 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2295 loop_end_2295: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2288 loop_end_2288: ; LEFT SUB ESI , 1 loop_start_2304: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2304 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2304 loop_end_2304: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2283 loop_end_2283: ; RIGHT ADD ESI , 2 loop_start_2315: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2315 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2320: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2320 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2320 loop_end_2320: ; RIGHT ADD ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2315 loop_end_2315: ; LEFT SUB ESI , 1 loop_start_2331: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2331 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2331 loop_end_2331: ; LEFT SUB ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2281 loop_end_2281: ; RIGHT ADD ESI , 5 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_2342: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2342 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2342 loop_end_2342: ; LEFT SUB ESI , 7 loop_start_2349: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2349 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2349 loop_end_2349: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2254 loop_end_2254: ; RIGHT ADD ESI , 4 loop_start_2359: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2359 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2359 loop_end_2359: ; LEFT SUB ESI , 4 loop_start_2366: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2366 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2371: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2371 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_2375: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2375 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2375 loop_end_2375: ; LEFT SUB ESI , 2 loop_start_2382: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2382 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2382 loop_end_2382: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2371 loop_end_2371: ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_2393: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2393 ; RIGHT ADD ESI , 1 loop_start_2395: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2395 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2400: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2400 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 loop_start_2407: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2407 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2407 loop_end_2407: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2400 loop_end_2400: ; RIGHT ADD ESI , 1 loop_start_2416: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2416 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2416 loop_end_2416: ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2395 loop_end_2395: ; RIGHT ADD ESI , 1 loop_start_2427: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2427 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_2432: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2432 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2432 loop_end_2432: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2427 loop_end_2427: ; RIGHT ADD ESI , 1 loop_start_2443: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2443 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2443 loop_end_2443: ; LEFT SUB ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2393 loop_end_2393: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2366 loop_end_2366: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2140 loop_end_2140: ; RIGHT ADD ESI , 4 loop_start_2457: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2457 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2457 loop_end_2457: ; LEFT SUB ESI , 4 loop_start_2464: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2464 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_2471: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2471 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2471 loop_end_2471: ; LEFT SUB ESI , 7 loop_start_2478: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2478 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2478 loop_end_2478: ; RIGHT ADD ESI , 9 loop_start_2487: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2487 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2487 loop_end_2487: ; LEFT SUB ESI , 9 loop_start_2491: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2491 ; RIGHT ADD ESI , 1 loop_start_2493: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2493 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2498: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2498 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 loop_start_2505: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2505 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2505 loop_end_2505: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2498 loop_end_2498: ; RIGHT ADD ESI , 1 loop_start_2514: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2514 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2514 loop_end_2514: ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2493 loop_end_2493: ; RIGHT ADD ESI , 1 loop_start_2525: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2525 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_2530: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2530 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2530 loop_end_2530: ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2525 loop_end_2525: ; RIGHT ADD ESI , 1 loop_start_2541: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2541 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2541 loop_end_2541: ; LEFT SUB ESI , 12 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2491 loop_end_2491: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2464 loop_end_2464: ; RIGHT ADD ESI , 9 loop_start_2551: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2551 ; RIGHT ADD ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2551 loop_end_2551: ; LEFT SUB ESI , 9 loop_start_2559: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2559 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2559 loop_end_2559: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2567: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2567 ; RIGHT ADD ESI , 5 loop_start_2569: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2569 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2569 loop_end_2569: ; LEFT SUB ESI , 4 loop_start_2576: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2576 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2576 loop_end_2576: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2567 loop_end_2567: ; LEFT SUB ESI , 9 loop_start_2587: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2587 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2587 loop_end_2587: ; RIGHT ADD ESI , 9 loop_start_2591: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2591 ; RIGHT ADD ESI , 6 loop_start_2593: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2593 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2593 loop_end_2593: ; LEFT SUB ESI , 5 loop_start_2600: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2600 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2600 loop_end_2600: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2591 loop_end_2591: ; LEFT SUB ESI , 9 loop_start_2611: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2611 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2611 loop_end_2611: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_2616: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2616 loop_start_2617: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2617 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2617 loop_end_2617: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_2640: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2640 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2640 loop_end_2640: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2616 loop_end_2616: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH loop_start_2647: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2647 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2647 loop_end_2647: ; LEFT SUB ESI , 9 loop_start_2653: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2653 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2653 loop_end_2653: ; RIGHT ADD ESI , 9 loop_start_2657: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2657 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_2661: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2661 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2661 loop_end_2661: ; LEFT SUB ESI , 4 loop_start_2668: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2668 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_2673: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2673 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_2676: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2676 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2676 loop_end_2676: ; LEFT SUB ESI , 2 loop_start_2683: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2683 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2683 loop_end_2683: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2673 loop_end_2673: ; LEFT SUB ESI , 8 loop_start_2695: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2695 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2695 loop_end_2695: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2668 loop_end_2668: ; RIGHT ADD ESI , 9 loop_start_2700: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2700 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2700 loop_end_2700: ; LEFT SUB ESI , 9 loop_start_2704: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2704 ; RIGHT ADD ESI , 1 loop_start_2706: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2706 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2706 loop_end_2706: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2704 loop_end_2704: ; RIGHT ADD ESI , 1 loop_start_2715: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2715 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2715 loop_end_2715: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2657 loop_end_2657: ; LEFT SUB ESI , 9 loop_start_2726: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2726 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_2732: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2732 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2737: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2737 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2737 loop_end_2737: ; LEFT SUB ESI , 1 loop_start_2747: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2747 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2747 loop_end_2747: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2732 loop_end_2732: ; LEFT SUB ESI , 3 loop_start_2756: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2756 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2756 loop_end_2756: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2726 loop_end_2726: ; RIGHT ADD ESI , 9 loop_start_2767: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2767 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2767 loop_end_2767: ; LEFT SUB ESI , 9 loop_start_2773: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2773 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2773 loop_end_2773: ; RIGHT ADD ESI , 9 loop_start_2777: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2777 ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2781: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2781 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2781 loop_end_2781: ; LEFT SUB ESI , 5 loop_start_2788: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2788 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_2793: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2793 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_2796: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2796 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2796 loop_end_2796: ; LEFT SUB ESI , 3 loop_start_2803: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2803 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2803 loop_end_2803: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2793 loop_end_2793: ; LEFT SUB ESI , 8 loop_start_2815: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2815 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2815 loop_end_2815: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2788 loop_end_2788: ; RIGHT ADD ESI , 9 loop_start_2820: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2820 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2820 loop_end_2820: ; LEFT SUB ESI , 9 loop_start_2824: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2824 ; RIGHT ADD ESI , 2 loop_start_2826: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2826 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2826 loop_end_2826: ; LEFT SUB ESI , 11 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2824 loop_end_2824: ; RIGHT ADD ESI , 2 loop_start_2835: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2835 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2835 loop_end_2835: ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2777 loop_end_2777: ; LEFT SUB ESI , 9 loop_start_2846: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2846 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_2852: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2852 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2857: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2857 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2857 loop_end_2857: ; LEFT SUB ESI , 1 loop_start_2867: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2867 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2867 loop_end_2867: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2852 loop_end_2852: ; LEFT SUB ESI , 3 loop_start_2876: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2876 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2876 loop_end_2876: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2846 loop_end_2846: ; RIGHT ADD ESI , 9 loop_start_2887: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2887 ; RIGHT ADD ESI , 4 loop_start_2889: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2889 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 36 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 36 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2889 loop_end_2889: ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2887 loop_end_2887: ; LEFT SUB ESI , 9 loop_start_2898: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2898 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2898 loop_end_2898: ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 15 mov [buffer + ESI] , AH loop_start_2903: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2903 loop_start_2904: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2904 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2904 loop_end_2904: ; LEFT SUB ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 loop_start_2910: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2910 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2910 loop_end_2910: ; RIGHT ADD ESI , 9 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2903 loop_end_2903: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 21 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2920: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2920 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2920 loop_end_2920: ; RIGHT ADD ESI , 9 loop_start_2924: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2924 ; RIGHT ADD ESI , 3 loop_start_2926: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2926 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2926 loop_end_2926: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 loop_start_2934: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2934 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_2939: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2939 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2939 loop_end_2939: ; LEFT SUB ESI , 4 loop_start_2946: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2946 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 13 loop_start_2951: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2951 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2951 loop_end_2951: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_2958: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2958 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2958 loop_end_2958: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2946 loop_end_2946: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2934 loop_end_2934: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_2968: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2968 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2968 loop_end_2968: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_2976: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2976 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_2981: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2981 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2981 loop_end_2981: ; LEFT SUB ESI , 3 loop_start_2988: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2988 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 12 loop_start_2993: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_2993 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2993 loop_end_2993: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_3000: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3000 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3000 loop_end_3000: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2988 loop_end_2988: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2976 loop_end_2976: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3011: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3011 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_3014: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3014 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3014 loop_end_3014: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3011 loop_end_3011: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_2924 loop_end_2924: ; LEFT SUB ESI , 9 loop_start_3022: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3022 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3022 loop_end_3022: ; RIGHT ADD ESI , 2 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3028: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3028 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3028 loop_end_3028: ; LEFT SUB ESI , 4 loop_start_3035: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3035 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3035 loop_end_3035: ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_622 loop_end_622: ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_3048: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3048 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3048 loop_end_3048: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 loop_start_3056: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3056 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PRINT TO STDOUT mov AH , [buffer + ESI] mov [value] , AH mov EAX , 4 mov EBX , 1 mov ECX , value mov EDX , 1 int 0x80 ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3056 loop_end_3056: ; RIGHT ADD ESI , 4 loop_start_3065: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3065 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PRINT TO STDOUT mov AH , [buffer + ESI] mov [value] , AH mov EAX , 4 mov EBX , 1 mov ECX , value mov EDX , 1 int 0x80 ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3065 loop_end_3065: ; LEFT SUB ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 loop_start_3084: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3084 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3084 loop_end_3084: ; LEFT SUB ESI , 9 loop_start_3100: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3100 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3100 loop_end_3100: ; RIGHT ADD ESI , 9 loop_start_3104: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3104 ; RIGHT ADD ESI , 5 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3104 loop_end_3104: ; LEFT SUB ESI , 9 loop_start_3110: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3110 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3110 loop_end_3110: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 11 mov [buffer + ESI] , AH loop_start_3115: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3115 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3117: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3117 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3117 loop_end_3117: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3115 loop_end_3115: ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 loop_start_3130: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3130 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3130 loop_end_3130: ; RIGHT ADD ESI , 7 loop_start_3134: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3134 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3134 loop_end_3134: ; LEFT SUB ESI , 7 loop_start_3141: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3141 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3147: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3147 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3147 loop_end_3147: ; LEFT SUB ESI , 9 loop_start_3151: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3151 ; RIGHT ADD ESI , 7 loop_start_3153: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3153 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3153 loop_end_3153: ; LEFT SUB ESI , 6 loop_start_3160: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3160 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 loop_start_3165: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3165 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3165 loop_end_3165: ; RIGHT ADD ESI , 7 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3160 loop_end_3160: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3151 loop_end_3151: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3141 loop_end_3141: ; RIGHT ADD ESI , 7 loop_start_3177: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3177 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3177 loop_end_3177: ; LEFT SUB ESI , 7 loop_start_3184: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3184 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3189: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3189 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 loop_start_3193: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3193 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3193 loop_end_3193: ; LEFT SUB ESI , 4 loop_start_3200: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3200 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3200 loop_end_3200: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3189 loop_end_3189: ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 loop_start_3211: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3211 ; RIGHT ADD ESI , 5 loop_start_3213: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3213 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3213 loop_end_3213: ; LEFT SUB ESI , 14 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3211 loop_end_3211: ; RIGHT ADD ESI , 9 loop_start_3222: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3222 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3222 loop_end_3222: ; LEFT SUB ESI , 9 loop_start_3226: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3226 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 loop_start_3232: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3232 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3237: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3237 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3237 loop_end_3237: ; LEFT SUB ESI , 1 loop_start_3247: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3247 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3247 loop_end_3247: ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3232 loop_end_3232: ; LEFT SUB ESI , 6 loop_start_3256: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3256 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3256 loop_end_3256: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3226 loop_end_3226: ; RIGHT ADD ESI , 7 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3184 loop_end_3184: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 loop_start_3275: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3275 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3275 loop_end_3275: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 loop_start_3283: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3283 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3288: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3288 ; RIGHT ADD ESI , 5 loop_start_3290: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3290 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3290 loop_end_3290: ; RIGHT ADD ESI , 4 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3288 loop_end_3288: ; LEFT SUB ESI , 9 loop_start_3299: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3299 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 loop_start_3305: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3305 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3310: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3310 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3310 loop_end_3310: ; LEFT SUB ESI , 1 loop_start_3320: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3320 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3320 loop_end_3320: ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3305 loop_end_3305: ; LEFT SUB ESI , 6 loop_start_3329: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3329 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3329 loop_end_3329: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3299 loop_end_3299: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH loop_start_3341: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3341 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3343: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3343 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3343 loop_end_3343: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3341 loop_end_3341: ; RIGHT ADD ESI , 4 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_3354: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3354 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3354 loop_end_3354: ; RIGHT ADD ESI , 9 loop_start_3358: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3358 ; RIGHT ADD ESI , 5 loop_start_3360: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3360 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3360 loop_end_3360: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_3368: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3368 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3373: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3373 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3373 loop_end_3373: ; LEFT SUB ESI , 7 loop_start_3380: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3380 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 16 loop_start_3385: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3385 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3385 loop_end_3385: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_3392: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3392 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3392 loop_end_3392: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3380 loop_end_3380: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3368 loop_end_3368: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 loop_start_3402: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3402 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3402 loop_end_3402: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 loop_start_3410: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3410 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_3415: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3415 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3415 loop_end_3415: ; LEFT SUB ESI , 5 loop_start_3422: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3422 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 14 loop_start_3427: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3427 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3427 loop_end_3427: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_3434: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3434 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3434 loop_end_3434: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3422 loop_end_3422: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3410 loop_end_3410: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3445: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3445 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_3448: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3448 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3448 loop_end_3448: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3445 loop_end_3445: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3358 loop_end_3358: ; LEFT SUB ESI , 9 loop_start_3456: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3456 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3456 loop_end_3456: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH loop_start_3463: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3463 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3465: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3465 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3465 loop_end_3465: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3463 loop_end_3463: ; RIGHT ADD ESI , 4 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 loop_start_3476: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3476 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3476 loop_end_3476: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3283 loop_end_3283: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_113 loop_end_113: ; LEFT SUB ESI , 4 ; PRINT TO STDOUT mov AH , [buffer + ESI] mov [value] , AH mov EAX , 4 mov EBX , 1 mov ECX , value mov EDX , 1 int 0x80 ; RIGHT ADD ESI , 10 loop_start_3485: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3485 ; RIGHT ADD ESI , 6 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3485 loop_end_3485: ; LEFT SUB ESI , 9 loop_start_3491: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3491 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3491 loop_end_3491: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 10 mov [buffer + ESI] , AH loop_start_3496: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3496 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3498: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3498 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3498 loop_end_3498: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3496 loop_end_3496: ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 15 loop_start_3511: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3511 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3511 loop_end_3511: ; RIGHT ADD ESI , 8 loop_start_3515: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3515 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3515 loop_end_3515: ; LEFT SUB ESI , 8 loop_start_3522: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3522 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3528: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3528 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3528 loop_end_3528: ; LEFT SUB ESI , 9 loop_start_3532: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3532 ; RIGHT ADD ESI , 8 loop_start_3534: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3534 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3534 loop_end_3534: ; LEFT SUB ESI , 7 loop_start_3541: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3541 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 loop_start_3546: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3546 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3546 loop_end_3546: ; RIGHT ADD ESI , 8 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3541 loop_end_3541: ; LEFT SUB ESI , 10 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3532 loop_end_3532: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3522 loop_end_3522: ; RIGHT ADD ESI , 8 loop_start_3558: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3558 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3558 loop_end_3558: ; LEFT SUB ESI , 8 loop_start_3565: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3565 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3570: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3570 ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_3574: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3574 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3574 loop_end_3574: ; LEFT SUB ESI , 5 loop_start_3581: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3581 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3581 loop_end_3581: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3570 loop_end_3570: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 loop_start_3592: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3592 ; RIGHT ADD ESI , 6 loop_start_3594: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3594 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3594 loop_end_3594: ; LEFT SUB ESI , 15 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3592 loop_end_3592: ; RIGHT ADD ESI , 9 loop_start_3603: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3603 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3603 loop_end_3603: ; LEFT SUB ESI , 9 loop_start_3607: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3607 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 loop_start_3613: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3613 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3618: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3618 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3618 loop_end_3618: ; LEFT SUB ESI , 1 loop_start_3628: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3628 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3628 loop_end_3628: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3613 loop_end_3613: ; LEFT SUB ESI , 7 loop_start_3637: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3637 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3637 loop_end_3637: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3607 loop_end_3607: ; RIGHT ADD ESI , 8 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 5 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3565 loop_end_3565: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 loop_start_3656: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3656 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3656 loop_end_3656: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 loop_start_3664: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3664 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3669: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3669 ; RIGHT ADD ESI , 6 loop_start_3671: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3671 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3671 loop_end_3671: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3669 loop_end_3669: ; LEFT SUB ESI , 9 loop_start_3680: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3680 ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 loop_start_3686: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3686 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3691: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3691 ; LEFT SUB ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3691 loop_end_3691: ; LEFT SUB ESI , 1 loop_start_3701: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3701 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3701 loop_end_3701: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3686 loop_end_3686: ; LEFT SUB ESI , 7 loop_start_3710: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3710 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 7 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 7 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3710 loop_end_3710: ; LEFT SUB ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3680 loop_end_3680: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH loop_start_3722: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3722 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3724: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3724 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3724 loop_end_3724: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3722 loop_end_3722: ; RIGHT ADD ESI , 5 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 27 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_3737: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3737 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3737 loop_end_3737: ; RIGHT ADD ESI , 9 loop_start_3741: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3741 ; RIGHT ADD ESI , 6 loop_start_3743: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3743 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3743 loop_end_3743: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_3751: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3751 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 2 loop_start_3756: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3756 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3756 loop_end_3756: ; LEFT SUB ESI , 8 loop_start_3763: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3763 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 17 loop_start_3768: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3768 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3768 loop_end_3768: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 5 loop_start_3775: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3775 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3775 loop_end_3775: ; RIGHT ADD ESI , 1 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3763 loop_end_3763: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3751 loop_end_3751: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 loop_start_3785: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3785 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3785 loop_end_3785: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 8 loop_start_3793: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3793 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 8 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 2 loop_start_3798: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3798 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3798 loop_end_3798: ; LEFT SUB ESI , 6 loop_start_3805: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3805 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 15 loop_start_3810: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3810 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3810 loop_end_3810: ; RIGHT ADD ESI , 3 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 6 loop_start_3817: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3817 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3817 loop_end_3817: ; RIGHT ADD ESI , 1 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3805 loop_end_3805: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3793 loop_end_3793: ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 1 loop_start_3828: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3828 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 1 loop_start_3831: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3831 ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3831 loop_end_3831: ; LEFT SUB ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3828 loop_end_3828: ; RIGHT ADD ESI , 8 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3741 loop_end_3741: ; LEFT SUB ESI , 9 loop_start_3839: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3839 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3839 loop_end_3839: ; RIGHT ADD ESI , 4 ;Reset to zero mov AH , byte [buffer + ESI] mov AH , 0 mov [buffer + ESI] , AH ; LEFT SUB ESI , 3 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 5 mov [buffer + ESI] , AH loop_start_3846: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3846 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH loop_start_3848: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3848 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 9 ; PLUS mov AH , byte [buffer + ESI] ADD AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3848 loop_end_3848: ; RIGHT ADD ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3846 loop_end_3846: ; RIGHT ADD ESI , 5 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; RIGHT ADD ESI , 27 ; MINUS mov AH , byte [buffer + ESI] SUB AH , 1 mov [buffer + ESI] , AH ; LEFT SUB ESI , 6 loop_start_3861: mov AH , byte [buffer + ESI] cmp AH , 0 je loop_end_3861 ; LEFT SUB ESI , 9 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3861 loop_end_3861: mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_3664 loop_end_3664: ; RIGHT ADD ESI , 3 mov AH , byte [buffer + ESI] cmp AH , 0 jne loop_start_66 loop_end_66: ;exit mov EAX , 1 int 0x80 ;exit
intro-to-agda/Begin.agda
curriedbanana/agda-exercises
0
9527
open import Agda.Primitive using (_⊔_) -- Set being type of all types (which is infinitely nested as Set₀ Set₁ etc postulate String : Set {-# BUILTIN STRING String #-} data bool : Set where tt : bool ff : bool ex₀ : bool → String ex₀ tt = "true" ex₀ ff = "false" -- parameterization over all "Sets" -- otherwise we are limited to types that ∈ Set if_then_else_ : ∀ { ℓ } { A : Set ℓ } → bool → A → A → A if tt then x else y = x if ff then x else y = y data ℕ : Set where zero : ℕ succ : ℕ → ℕ {-# BUILTIN NATURAL ℕ #-} _plus_ : ℕ → ℕ → ℕ zero plus n = n succ m plus n = succ (m plus n) ex₁ : ℕ ex₁ = 5 data [_] (A : Set) : Set where ♢ : [ A ] _,_ : A → [ A ] → [ A ] infixr 6 _,_ _++_ : ∀{ α } → [ α ] → [ α ] → [ α ] ♢ ++ ys = ys (x , xs) ++ ys = x , xs ++ ys ex₂ : [ ℕ ] ex₂ = 5 , 6 , ♢ -- why is this equivalent to --data _≡_ { α : Set } (x : α) : α → Set where -- refl : x ≡ x -- syntactical identity data _≡_ { ℓ } { α : Set ℓ} : α → α → Set ℓ where refl : ∀ { x : α } → x ≡ x {-# BUILTIN EQUALITY _≡_ #-} {-# BUILTIN REFL refl #-} data ⊥ : Set where ex₃ : (2 plus 3) ≡ 5 ex₃ = refl -- logical negation in intutionistic logic ex₄ : 0 ≡ 1 → ⊥ ex₄ () cong : ∀ { ℓ } { A B : Set ℓ } → { a b : A } { f : A → B } → a ≡ b → f a ≡ f b cong refl = refl ex₅ : ∀ { n } → (n plus 0) ≡ n ex₅ {zero} = refl ex₅ {succ n1} = cong { f = succ } ex₅ -- rewrites and dot patterns ?? data _+_ (α : Set) (β : Set) : Set where left : α → α + β right : β → α + β ex₆ : String + ℕ ex₆ = left "foo" ex₇ : String + ℕ ex₇ = right 5 record _∨_ (α β : Set) : Set where constructor _,_ field fst : bool snd : if fst then β else α tosum : ∀ { α β } → α + β → α ∨ β tosum (left a) = ff , a tosum (right b) = tt , b unsum : ∀ { α β } → α ∨ β → α + β unsum (ff , a) = left a unsum (tt , b) = right b tosum∘unsum : ∀ { α β } → (p : α ∨ β) → (tosum (unsum p)) ≡ p tosum∘unsum (tt , b) = refl tosum∘unsum (ff , b) = refl unsum∘tosum : ∀ { α β } → (p : α + β) → (unsum (tosum p)) ≡ p unsum∘tosum (left a) = refl unsum∘tosum (right b) = refl --- Thus α + β is same as dependently typed α ∨ β. Further generalizing record Σ (I : Set) (V : I -> Set) : Set where constructor _,_ field fst : I snd : V fst --- now α ∨ β can be written as -- this is on the types, not on values or : Set → Set → Set or x y = Σ bool (λ b → if b then x else y) -- assume V does not depend on I, we get products twice : Set → Set twice x = Σ bool (λ b → x)
FASM/x32/console_if_call.asm
secana/Assembler-Examples
8
97118
<reponame>secana/Assembler-Examples ; Check if a given number is smaller than 100 format PE console entry start include 'win32a.inc' section '.idata' import data readable writeable library kernel32, 'kernel32.dll', \ msvcrt, 'MSVCRT.DLL' import kernel32, \ ExitProcess, 'ExitProcess' import msvcrt, \ printf, 'printf', \ scanf, 'scanf' section '.data' data readable szEnterNum db 'Please enter a number: ',0 szLower db '%d is lower than 100',10,0 szGreaterOrEqual db '%d is greater or equal than 100',10,0 szReadNumFormat db '%d',0 section '.bss' data readable writeable dwNumber rd 1 section '.text' code readable executable start: push szEnterNum call [printf] add esp, 4 push dwNumber push szReadNumFormat call [scanf] add esp, 8 cmp [dwNumber], 100 jl lowerThanHundert push [dwNumber] push szGreaterOrEqual call [printf] add esp, 8 jmp exit lowerThanHundert: push [dwNumber] push szLower call [printf] add esp, 8 exit: push 0 call [ExitProcess]
oeis/319/A319172.asm
neoneye/loda-programs
11
18163
; A319172: a(n) = 2*(a(n-1) + a(n-3)) - a(n-4), with a(0) = 1, a(1) = 2, a(2) = 5 and a(3) = 12. ; Submitted by <NAME> ; 1,2,5,12,27,62,143,328,753,1730,3973,9124,20955,48126,110527,253840,582977,1338882,3074917,7061948,16218683,37248318,85545615,196466648,451211249,1036265410,2379918501,5465792852,12552905275,28829382142,66210431487,152060880672,349227620353,802046721538,1842004772933,4230403905900,9715673634523,22313310093374,51245423225615,117691789814376,270294526180977,620766588719810,1425671333842757,3274239930233092,7519718511724827,17270013102415358,39662834731454143,91090866556124848,209202040805355585 mov $1,1 lpb $0 sub $0,1 add $2,$1 add $3,$4 add $1,$3 add $1,1 add $4,$2 sub $4,$3 add $3,$4 lpe mov $0,$1
programs/oeis/182/A182771.asm
neoneye/loda
22
21326
; A182771: Beatty sequence for (6+sqrt(3))/3. ; 2,5,7,10,12,15,18,20,23,25,28,30,33,36,38,41,43,46,48,51,54,56,59,61,64,67,69,72,74,77,79,82,85,87,90,92,95,97,100,103,105,108,110,113,115,118,121,123,126,128,131,134,136,139,141,144,146,149 mov $2,$0 seq $0,186539 ; Adjusted joint rank sequence of (f(i)) and (g(j)) with f(i) before g(j) when f(i)=g(j), where f(i)=i^2 and g(j)=-2+3j^2. Complement of A186540. add $0,$2 add $0,1
oeis/236/A236376.asm
neoneye/loda-programs
11
5130
<reponame>neoneye/loda-programs ; A236376: Riordan array ((1-x+x^2)/(1-x)^2, x/(1-x)^2). ; Submitted by <NAME> ; 1,1,1,2,3,1,3,7,5,1,4,14,16,7,1,5,25,41,29,9,1,6,41,91,92,46,11,1,7,63,182,246,175,67,13,1,8,92,336,582,550,298,92,15,1,9,129,582,1254,1507,1079,469,121,17,1,10,175,957,2508,3718,3367,1925,696,154 mov $3,2 mov $4,$0 lpb $3 mov $0,$4 add $0,1 seq $0,128908 ; Riordan array (1, x/(1-x)^2). add $0,$2 sub $3,1 mov $2,$3 mul $2,$0 sub $4,$3 lpe
oeis/047/A047866.asm
neoneye/loda-programs
11
23220
; A047866: a(n) = ceiling(n*(n+1)*(n+2)/8). ; Submitted by <NAME>(s2.) ; 0,1,3,8,15,27,42,63,90,124,165,215,273,342,420,510,612,727,855,998,1155,1329,1518,1725,1950,2194,2457,2741,3045,3372,3720,4092,4488,4909,5355,5828,6327,6855,7410,7995,8610,9256,9933,10643,11385,12162,12972,13818,14700,15619,16575,17570,18603,19677,20790,21945,23142,24382,25665,26993,28365,29784,31248,32760,34320,35929,37587,39296,41055,42867,44730,46647,48618,50644,52725,54863,57057,59310,61620,63990,66420,68911,71463,74078,76755,79497,82302,85173,88110,91114,94185,97325,100533,103812,107160 add $0,2 bin $0,3 add $0,1 mul $0,3 div $0,4
src/message-reader.adb
zenharris/ada-bbs
2
18085
<reponame>zenharris/ada-bbs with Text_File_Scroller; with Texaco; use Texaco; with Message.Post; package body Message.Reader is -- CurrentLine : Line_Position := 0; -- CurrentCurs : Cursor; -- TopLine : Line_Position; -- TermLnth : Line_Position; -- TermWdth : Column_Position; -- BottomLine : Line_Position ; -- Curr_Dir : string := Current_Directory; procedure Scroll_Up is begin Move_Cursor(Line => TopLine,Column => 0); Delete_Line; Move_Cursor(Line => BottomLine,Column => 0); Insert_Line; Box; Refresh; end Scroll_Up; procedure Scroll_Down is begin Move_Cursor(Line => BottomLine,Column => 0); Delete_Line; Move_Cursor(Line => TopLine,Column => 0); Insert_Line; Box; Refresh; end Scroll_Down; Procedure Clear_Region is begin for i in TopLine .. BottomLine loop Move_Cursor(Line => i,Column => 2); Clear_To_End_Of_Line; end loop; -- CurrentLine := 0; end Clear_Region; procedure Increment (IncLine : in out Line_Position) is begin if TopLine + Incline < BottomLine then IncLine := IncLine + 1; else Scroll_Up; end if; end Increment; procedure Decrement (IncLine : in out Line_Position) is begin if Incline > 0 then IncLine := IncLine - 1; else Scroll_Down; end if; end Decrement; procedure HiLite (Win : Window; Prompt : Unbounded_String; Line_Num : Line_Position) is begin Set_Character_Attributes(Win, (Reverse_Video => True,others => False)); Add (Win => Win, Line => Line_Num, Column => 2, Str => To_String(Prompt)); Refresh(Win); Set_Character_Attributes(Win, Normal_Video); end HiLite; procedure LoLite (Win : Window; Prompt : Unbounded_String; Line_Num : Line_Position) is begin Set_Character_Attributes(Win, Normal_Video); Add (Win => Win, Line => Line_Num, Column => 2, Str => To_String(Prompt)); Refresh(Win); end LoLite; procedure Redraw_Screen is curs2 : Cursor; LineNum : Line_Position := 0; begin Clear_Region; if not Directory_Buffer.Is_Empty then curs2 := CurrentCurs; for i in 1 .. CurrentLine loop if curs2 /= Directory_Buffer.First then Directory_List.Previous(curs2); end if; end loop; while curs2 /= Directory_Buffer.Last loop Add(Standard_Window,Line => TopLine + LineNum,Column => 2,Str => To_String(Element(curs2).Prompt) ); Clear_To_End_Of_Line; Refresh; Directory_List.Next(curs2); LineNum := LineNum +1; exit when LineNum+ TopLine >= BottomLine; end loop; Add(Standard_Window,Line => TopLine + LineNum,Column => 2,Str => To_String(Element(curs2).Prompt) ); Clear_To_End_Of_Line; Refresh; Add (Line => TermLnth - 2,Column => 1, Str => " | Func 2 | Esc to exit"); Clear_To_End_Of_Line; Box; end if; end Redraw_Screen; procedure Read_Header (FileName : in String; Sender : out Unbounded_String; Subject : out Unbounded_String; Msgid : out Unbounded_String; ReplyTo : out Unbounded_String) is HeaderType, HeaderText, scratch : Unbounded_String; File : File_Type; begin Open (File => File, Mode => In_File, Name => Filename); scratch := SUIO.Get_Line(File); while scratch /= "" loop HeaderType := To_Unbounded_String(SU.Slice(scratch,1,SU.Index(scratch,":")-1)); HeaderText := To_Unbounded_String(SU.Slice(scratch,SU.Index(scratch,":")+2,SU.Length(scratch))); if HeaderType = "Sender" then Sender := HeaderText; elsif HeaderType = "Subject" then Subject := HeaderText; elsif HeaderType = "Msgid" then Msgid := HeaderText; elsif HeaderType = "ReplyTo" then ReplyTo := HeaderText; end if; scratch := SUIO.Get_Line(File); end loop; Close (File); exception when End_Error => Close (File); null; end Read_Header; function CharPad(InStr : Unbounded_String; PadWidth : Integer) return String is padstr : Unbounded_String; begin if SU.Length(InStr) <= PadWidth then for i in SU.Length(InStr) .. PadWidth loop padstr := padstr & " "; end loop; end if; return To_String(Instr & padstr); end CharPad; procedure Read_Directory (ReplyID : Unbounded_String := To_Unbounded_String("")) is Dir : Directory_Entry_Type; Dir_Search : Search_Type; -- Curr_Dir : string := Current_Directory; Sender, Subject,Msgid,ReplyTo : Unbounded_String; I, J, SortCurs : Cursor; swapped : Boolean; begin Clear(Directory_Buffer); Start_Search(Search => Dir_Search, Directory => Curr_Dir&"/messages", Pattern => "*.msg"); loop Get_Next_Entry(Dir_Search, Dir); ReplyTo := To_Unbounded_String(""); Msgid := To_Unbounded_String(""); Read_Header(Full_Name(Dir),Sender => Sender, Subject => Subject,Msgid => Msgid,ReplyTo => ReplyTo); if SU.Length(ReplyID) > 0 then if ReplyTo = ReplyID or else Msgid = ReplyID then Directory_Buffer.Append(New_Item => (To_Unbounded_String(Full_Name(Dir)), CharPad(Sender,15) & Subject) ); end if; else Directory_Buffer.Append(New_Item => (To_Unbounded_String(Full_Name(Dir)), CharPad(Sender,15) & Subject) ); end if; exit when not More_Entries(Dir_Search); end loop; End_Search(Dir_Search); -- Bubble Sort Director Buffer loop SortCurs := Directory_Buffer.First; swapped := False; while SortCurs /= Directory_Buffer.Last loop I := SortCurs; Directory_List.Next(SortCurs); J := SortCurs; if Element(J).FileName < Element(I).FileName then Swap(Directory_Buffer,I,J); swapped := True; end if; end loop; exit when not swapped; end loop; end Read_Directory; procedure ReRead_Directory is begin Read_Directory; end ReRead_Directory; procedure Post_Reply is Sender, Subject, MsgId, ReplyTo : Unbounded_String; begin Read_Header(To_String(Element(CurrentCurs).FileName) ,Sender => Sender, Subject => Subject,Msgid => Msgid,ReplyTo => ReplyTo); Subject := "Re. " & Subject; Message.Post.Quote(Msgid => Msgid); Message.Post.Post_Message(MsgId,Subject); end; procedure Post_Thread_Reply is Sender, Subject, MsgId, ReplyTo : Unbounded_String; begin Read_Header(To_String(Element(CurrentCurs).FileName) ,Sender => Sender, Subject => Subject,Msgid => Msgid,ReplyTo => ReplyTo); if SU.Length(ReplyTo) > 0 then Message.Post.Quote(Msgid => Msgid); Message.Post.Post_Message(ReplyTo,Subject); else Display_Warning.Warning("Selected message not part of a thread"); end if; end Post_Thread_Reply; procedure Show_Thread is Sender, Subject, MsgId, ReplyTo : Unbounded_String; DefaultLength : Ada.Containers.Count_Type := 1; begin Read_Header(To_String(Element(CurrentCurs).FileName) ,Sender => Sender, Subject => Subject,Msgid => Msgid,ReplyTo => ReplyTo); if SU.Length(ReplyTo) = 0 then Read_Directory(ReplyID => MsgId); if Directory_Buffer.Length = DefaultLength then Display_Warning.Warning("No Replys to this message"); Read_Directory; end if; if CurrentLine > Line_Position(Directory_Buffer.Length-1) then CurrentLine := Line_Position(Directory_Buffer.Length-1); end if; -- CurrentLine := 0; -- CurrentCurs := Directory_Buffer.First; else Read_Directory(ReplyID => ReplyTo); if CurrentLine > Line_Position(Directory_Buffer.Length) then -- CurrentLine := 0; -- Line_Position(Directory_Buffer.Length); -- CurrentCurs := Directory_Buffer.Last; null; end if; -- CurrentLine := 0; -- CurrentCurs := Directory_Buffer.First; end if; end Show_Thread; procedure Run_Post_Message is begin Text_Buffer.Clear; Message.Post.Post_Message; end Run_Post_Message; MessageMenu : Process_Menu.Menu_Type := ((new String'("Show Reply Thread"),Show_Thread'Access), (new String'("Reply To Thread"),Post_Thread_Reply'Access), (new String'("Reply To Message"),Post_Reply'Access), (new String'("Post New Message"),Run_Post_Message'Access), (new String'("Reload Messages"),ReRead_Directory'Access), (new String'("User Login"),Message.Login.Login_User'Access), (new String'("Create User"),Message.Login.Create_User'Access)); function Count_Back(Csr : Cursor) return integer is CountCsr : Cursor := Csr; Counter : Integer := 1; begin loop exit when CountCsr = Directory_Buffer.First; Directory_List.Previous(CountCsr); Counter := Counter +1; end loop; return Counter; end Count_Back; procedure Read_Messages is c : Key_Code; FindElement : Directory_Record; begin Clear; Get_Size(Standard_Window,Number_Of_Lines => TermLnth,Number_Of_Columns => TermWdth); TopLine := 4; BottomLine := TermLnth - 4; CurrentLine := 0; Read_Directory; CurrentCurs := Directory_Buffer.First; Redraw_Screen; Refresh; loop HiLite(Standard_Window,Element(CurrentCurs).Prompt,CurrentLine+TopLine); c := Get_Keystroke; if c in Special_Key_Code'Range then case c is when Key_F2 => FindElement := Element(CurrentCurs); Process_Menu.Open_Menu (Function_Number => 2,Menu_Array => MessageMenu ); CurrentCurs := Directory_Buffer.Find(Item => FindElement); if CurrentCurs = No_Element then CurrentCurs := Directory_Buffer.Last; end if; -- Try to make CurrentLine right for repositioned CurrentCurs if Line_Position(Directory_Buffer.Length) < BottomLine-TopLine then declare CountCurs : Cursor := Directory_Buffer.First; Counter : Integer := 0; begin while CountCurs /= Directory_Buffer.Last loop exit when CountCurs = CurrentCurs; Counter := Counter +1; CountCurs := Directory_List.Next(CountCurs); end loop; CurrentLine := Line_Position(Counter); end; end if; Clear; Redraw_Screen; when Key_Cursor_Down => if (CurrentCurs /= Directory_Buffer.Last) then LoLite(Standard_Window,Element(CurrentCurs).Prompt,CurrentLine+TopLine); Increment(CurrentLine); Directory_List.Next(CurrentCurs); end if; when Key_Cursor_Up => if (CurrentCurs /= Directory_Buffer.First) then LoLite(Standard_Window,Element(CurrentCurs).Prompt,CurrentLine+TopLine); Decrement(CurrentLine); Directory_List.Previous(CurrentCurs); end if; when Key_Next_Page => for i in 0 .. BottomLine-TopLine loop if CurrentCurs /= Directory_Buffer.Last then Directory_List.Next(CurrentCurs); end if; end loop; Redraw_Screen; when Key_Previous_Page => for i in 0 .. BottomLine-TopLine loop if CurrentCurs /= Directory_Buffer.First then Directory_List.Previous(CurrentCurs); end if; end loop; if Line_Position(Count_Back(CurrentCurs)) < BottomLine-TopLine then CurrentLine := 0; end if; Redraw_Screen; when Key_Home => CurrentCurs := Directory_Buffer.First; CurrentLine := 0; Redraw_Screen; when Key_End => CurrentCurs := Directory_Buffer.Last; CurrentLine := BottomLine-TopLine; Redraw_Screen; when Key_Resize => Get_Size(Standard_Window,Number_Of_Lines => TermLnth,Number_Of_Columns => TermWdth); BottomLine := TermLnth - 4; Clear; Redraw_Screen; -- when Key_End => exit; when others => null; end case; elsif c in Real_Key_Code'Range then -- Ch := Character'Val (c); case Character'Val (c) is when LF | CR => begin if Exists(To_String(Element(CurrentCurs).FileName)) then Text_File_Scroller(To_String(Element(CurrentCurs).FileName)); Redraw_Screen; else Display_Warning.Warning("Message Has been deleted"); end if; end; when ESC => Exit; when others => null; end case; end if; end loop; end Read_Messages; end Message.Reader;
libsrc/_DEVELOPMENT/arch/ts2068/display/c/sdcc/tshc_saddrpright_callee.asm
jpoikela/z88dk
640
23523
; void *tshc_saddrpright(void *saddr, uint bitmask) SECTION code_clib SECTION code_arch PUBLIC _tshc_saddrpright_callee EXTERN _zx_saddrpright_callee defc _tshc_saddrpright_callee = _zx_saddrpright_callee
ASM/LeerEntero.asm
Jouna77/Compilador
0
9853
.model small .stack .data ;========================================================= SGN1 db 0 NUM1 db 0,0,0,0 DEC1 db 0,0,0,0 OVERFLOW DB 'STACK OVERFLOW!','$' NUMERO_INVALIDO DB 'NUMERO INVALIDO!','$' EXCEPCION_NO_CONTROLADA DB 'EXCEPCION NO CONTROLADA:','$' AUXILIAR DB 0 .code ;INICIA PROCEDIMIENTO PRINCIPAL begin proc FAR MOV AX,@data MOV DS,AX ;================>[LIMPIAR PANTALLA]<================ mov ax,0600h ;ah 06(es un recorrido), al 00(pantalla completa) mov bh,01Fh ;fondo blanco(7), sobre azul(1) mov cx,0000h ;es la esquina superior izquierda reglon: columna mov dx,184Fh ;es la esquina inferior derecha reglon: columna int 10h ;interrupcion que llama al BIOS ;================>[MOVER CURSOR A 0]<================ XOR DX,DX; dl Columna,dh fila MOV bh,0 ;PAGINA mov ah, 02h ;mover cursor int 10h; ;servicio de video LEA DI,SGN1 CALL LEER_ENTERO MOV AH,4CH INT 21H RET ;================>[CODIGO GENERADO POR EL COMPILADOR]<================ LEER_ENTERO PROC NEAR XOR CX,CX ;CUENTA EL NUMERO DE ENTEROS MOV SI,DI MOV AH,01H INT 21H MOV AH,'-' CMP AL,AH JE lectura_entero_negativo INC DI INC CX JMP validar_numero_entero lectura_entero_negativo: MOV AL,0FFH MOV [DI],AL ;NUMEROS lectura_numeros: INC CX INC DI CMP CX,06H JAE overflow_numerico MOV AH,01H INT 21H CMP AL,0DH JE fin_lectura_entero CMP AL,2EH JE lectura_numeros_decimales validar_numero_entero: CMP AL,30H JL numero_invalido_enteros CMP AL,39H JA numero_invalido_enteros SUB AL,30H MOV [DI],AL JMP lectura_numeros lectura_numeros_decimales: MOV DI,SI ADD DI,05H lectura_numero_decimal: CMP AUXILIAR,09H JA overflow_numerico MOV AH,01H INT 21H CMP AL,0DH JE fin_lectura_entero CMP AL,30H JL numero_invalido_enteros CMP AL,39H JA numero_invalido_enteros SUB AL,30H MOV [DI],AL INC AUXILIAR INC DI JMP lectura_numero_decimal fin_lectura_entero: ;AJUSTAR LA PARTE DECIMAL DEC CX CMP CX,04H JL ajuste_entero_necesario JMP sin_ajuste_entero ajuste_entero_necesario: MOV AL,CL MOV AH,04H SUB AH,AL XOR DX,DX MOV DL,AH MOV DI,SI INC DI MOV BX,DI DEC CX siguiente_ajuste_entero: MOV DI,BX ADD DI,CX MOV AL,[DI] MOV AH,0H MOV [DI],AH ADD DI,DX MOV [DI],AL DEC CX JNS siguiente_ajuste_entero sin_ajuste_entero: RET overflow_numerico: LEA DI,OVERFLOW CALL EXCEPCION numero_invalido_enteros: LEA DI,NUMERO_INVALIDO CALL EXCEPCION RET LEER_ENTERO ENDP EXCEPCION PROC NEAR MOV AH, 06h ; Scroll up function XOR AL, AL ; Clear entire screen XOR CX, CX ; Upper left corner CH=row, CL=column MOV DX, 184FH ; lower right corner DH=row, DL=column MOV BH, 4Eh ; YellowOnBlue INT 10H MOV DL,1AH MOV DH,0AH MOV bh,0 ;PAGINA mov ah, 02h ;mover cursor int 10h; ;servicio de video LEA DX,EXCEPCION_NO_CONTROLADA MOV AH,09H INT 21H MOV DL,1AH MOV DH,0CH MOV bh,0 ;PAGINA mov ah, 02h ;mover cursor int 10h; ;servicio de video MOV DX,DI MOV AH,09H INT 21H XOR AX,AX INT 16H MOV AH,4CH INT 21H EXCEPCION ENDP end begin
agda-stdlib/src/Tactic/RingSolver.agda
DreamLinuxer/popl21-artifact
5
6059
------------------------------------------------------------------------ -- The Agda standard library -- -- A solver that uses reflection to automatically obtain and solve -- equations over rings. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Tactic.RingSolver where open import Agda.Builtin.Reflection open import Algebra open import Data.Fin as Fin using (Fin) open import Data.Vec as Vec using (Vec; _∷_; []) open import Data.List as List using (List; _∷_; []) open import Data.Maybe.Base as Maybe using (Maybe; just; nothing; fromMaybe) open import Data.Nat using (ℕ; suc; zero; _<ᵇ_) open import Data.Nat.Reflection using (toTerm; toFinTerm) open import Data.Bool using (Bool; if_then_else_; true; false) open import Data.Unit using (⊤) open import Data.String using (String) open import Data.Product using (_,_) open import Function open import Reflection.Argument open import Reflection.Term open import Reflection.TypeChecking.MonadSyntax open import Tactic.RingSolver.NonReflective renaming (solve to solve-fn) open import Tactic.RingSolver.Core.AlmostCommutativeRing open import Tactic.RingSolver.Core.NatSet as NatSet open import Tactic.RingSolver.Core.ReflectionHelp open AlmostCommutativeRing ------------------------------------------------------------------------ -- Processing ------------------------------------------------------------------------ private record RingNames : Set where constructor +⇒_*⇒_^⇒_-⇒_ field +′ *′ ^′ -′ : Maybe Name checkIsRing : Term → TC Term checkIsRing ring = checkType ring (def (quote AlmostCommutativeRing) (2 ⋯⟨∷⟩ [])) getVariableIDs : Term → Maybe NatSet getVariableIDs = go [] where go : NatSet → Term → Maybe NatSet go t (con (quote List._∷_) (_ ∷ _ ∷ var i [] ⟨∷⟩ xs ⟨∷⟩ _)) = go (insert i t) xs go t (con (quote List.List.[]) _) = just t go _ _ = nothing module OverRing (ring : Term) where -- Takes the name of a function that takes the ring as it's first -- explicit argument and the terms of it's arguments and inserts -- the required ring arguments -- e.g. "_+_" $ʳ xs = "_+_ {_} {_} ring xs" _$ʳ_ : Name → Args Term → Term nm $ʳ args = def nm (2 ⋯⟅∷⟆ ring ⟨∷⟩ args) checkIsListOfVariables : Term → TC Term checkIsListOfVariables xs = checkType xs (def (quote List) (1 ⋯⟅∷⟆ (quote Carrier $ʳ []) ⟨∷⟩ [])) >>= normalise getFieldName : Name → TC (Maybe Name) getFieldName nm = normalise (nm $ʳ []) <&> λ where (def f args) → just f _ → nothing getRingOperatorNames : TC RingNames getRingOperatorNames = ⦇ +⇒ getFieldName (quote _+_) *⇒ getFieldName (quote _*_) ^⇒ getFieldName (quote _^_) -⇒ getFieldName (quote -_) ⦈ module _ (nms : RingNames) (numVars : ℕ) where open RingNames nms -- This function applies the hidden arguments that the constructors -- that Expr needs. The first is the universe level, the second is the -- type it contains, and the third is the number of variables it's -- indexed by. All three of these could likely be inferred, but to -- make things easier we supply the third because we know it. _$ᵉ_ : Name → List (Arg Term) → Term e $ᵉ xs = con e (1 ⋯⟅∷⟆ quote Carrier $ʳ [] ⟅∷⟆ toTerm numVars ⟅∷⟆ xs) -- A constant expression. Κ′ : Term → Term Κ′ x = quote Κ $ᵉ (x ⟨∷⟩ []) _⇓≟_ : Maybe Name → Name → Bool nothing ⇓≟ _ = false just x ⇓≟ y = primQNameEquality x y {-# INLINE _⇓≟_ #-} module ToExpr (Ι′ : ℕ → Maybe Term) where mutual -- Application of a ring operator often doesn't have a type as -- simple as "Carrier → Carrier → Carrier": there may be hidden -- arguments, etc. Here, we do our best to handle those cases, -- by just taking the last two explicit arguments. E⟨_⟩₂ : Name → List (Arg Term) → Term E⟨ nm ⟩₂ (x ⟨∷⟩ y ⟨∷⟩ []) = nm $ᵉ (E x ⟨∷⟩ E y ⟨∷⟩ []) E⟨ nm ⟩₂ (x ∷ xs) = E⟨ nm ⟩₂ xs E⟨ nm ⟩₂ _ = unknown E⟨_⟩₁ : Name → List (Arg Term) → Term E⟨ nm ⟩₁ (x ⟨∷⟩ []) = nm $ᵉ (E x ⟨∷⟩ []) E⟨ nm ⟩₁ (x ∷ xs) = E⟨ nm ⟩₁ xs E⟨ _ ⟩₁ _ = unknown E⟨^⟩ : List (Arg Term) → Term E⟨^⟩ (x ⟨∷⟩ y ⟨∷⟩ []) = quote _⊛_ $ᵉ (E x ⟨∷⟩ y ⟨∷⟩ []) E⟨^⟩ (x ∷ xs) = E⟨^⟩ xs E⟨^⟩ _ = unknown -- When trying to figure out the shape of an expression, one of -- the difficult tasks is recognizing where constants in the -- underlying ring are used. If we were only dealing with ℕ, we -- might look for its constructors: however, we want to deal with -- arbitrary types which implement AlmostCommutativeRing. If the -- Term type contained type information we might be able to -- recognize it there, but it doesn't. -- -- We're in luck, though, because all other cases in the following -- function *are* recognizable. As a result, the "catch-all" case -- will just assume that it has a constant expression. E : Term → Term -- Recognise the ring's fields E (def (quote _+_) xs) = E⟨ quote _⊕_ ⟩₂ xs E (def (quote _*_) xs) = E⟨ quote _⊗_ ⟩₂ xs E (def (quote _^_) xs) = E⟨^⟩ xs E (def (quote -_) xs) = E⟨ quote ⊝_ ⟩₁ xs -- Recognise the underlying implementation of the ring's fields E (def nm xs) = if +′ ⇓≟ nm then E⟨ quote _⊕_ ⟩₂ xs else if *′ ⇓≟ nm then E⟨ quote _⊗_ ⟩₂ xs else if ^′ ⇓≟ nm then E⟨^⟩ xs else if -′ ⇓≟ nm then E⟨ quote ⊝_ ⟩₁ xs else Κ′ (def nm xs) -- Variables E v@(var x _) = fromMaybe (Κ′ v) (Ι′ x) -- Special case to recognise "suc" for naturals E (con (quote ℕ.suc) (x ⟨∷⟩ [])) = quote _⊕_ $ᵉ (Κ′ (toTerm 1) ⟨∷⟩ E x ⟨∷⟩ []) E t = Κ′ t callSolver : Vec String numVars → Term → Term → Args Type callSolver nms lhs rhs = 2 ⋯⟅∷⟆ ring ⟨∷⟩ toTerm numVars ⟨∷⟩ vlams nms (quote _⊜_ $ʳ (toTerm numVars ⟨∷⟩ E lhs ⟨∷⟩ E rhs ⟨∷⟩ [])) ⟨∷⟩ hlams nms (quote refl $ʳ (1 ⋯⟅∷⟆ [])) ⟨∷⟩ [] where Ι′ : ℕ → Maybe Term Ι′ i = if i <ᵇ numVars then just (var i []) else nothing open ToExpr Ι′ constructSoln : NatSet → Term → Term → Term constructSoln t lhs rhs = quote trans $ʳ (3 ⋯⟅∷⟆ quote sym $ʳ (2 ⋯⟅∷⟆ quote Ops.correct $ʳ (1 ⋯⟅∷⟆ E lhs ⟨∷⟩ ρ ⟨∷⟩ []) ⟨∷⟩ []) ⟨∷⟩ (quote Ops.correct $ʳ (1 ⋯⟅∷⟆ E rhs ⟨∷⟩ ρ ⟨∷⟩ [])) ⟨∷⟩ []) where Ι′ : ℕ → Maybe Term Ι′ i = Maybe.map (λ x → quote Ι $ᵉ (toFinTerm x ⟨∷⟩ [])) (lookup i t) open ToExpr Ι′ ρ : Term ρ = curriedTerm t ------------------------------------------------------------------------ -- Macros ------------------------------------------------------------------------ -- This is the main macro which solves for equations in which the variables -- are universally quantified over: -- -- lemma : ∀ x y → x + y ≈ y + x -- lemma = solve-∀ TypeRing -- -- where TypRing is your implementation of AlmostCommutativeRing. (Find some -- example implementations in Polynomial.Solver.Ring.AlmostCommutativeRing.Instances). solve-∀-macro : Name → Term → TC ⊤ solve-∀-macro ring hole = do ring′ ← checkIsRing (def ring []) commitTC let open OverRing ring′ operatorNames ← getRingOperatorNames hole′ ← inferType hole >>= reduce let variables , k , equation = underPi hole′ just (lhs ∷ rhs ∷ []) ← pure (getArgs 2 equation) where nothing → typeError (strErr "Malformed call to solve." ∷ strErr "Expected target type to be like: ∀ x y → x + y ≈ y + x." ∷ strErr "Instead: " ∷ termErr hole′ ∷ []) unify hole (def (quote solve-fn) (callSolver operatorNames variables k lhs rhs)) macro solve-∀ : Name → Term → TC ⊤ solve-∀ = solve-∀-macro -- Use this macro when you want to solve something *under* a lambda. For example: -- say you have a long proof, and you just want the solver to deal with an -- intermediate step. Call it like so: -- -- lemma₃ : ∀ x y → x + y * 1 + 3 ≈ 2 + 1 + y + x -- lemma₃ x y = begin -- x + y * 1 + 3 ≈⟨ +-comm x (y * 1) ⟨ +-cong ⟩ refl ⟩ -- y * 1 + x + 3 ≈⟨ solve (x ∷ y ∷ []) Int.ring ⟩ -- 3 + y + x ≡⟨ refl ⟩ -- 2 + 1 + y + x ∎ -- -- The first argument is the free variables, and the second is the -- ring implementation (as before). -- -- One thing to note here is that we need to be able to infer *both* sides of -- the equality, which the normal equaltional reasoning combinators don't let you -- do. You'll need the combinators defined in Relation.Binary.Reasoning.Inference. -- These are just as powerful as the others, but have slightly better inference properties. solve-macro : Term → Name → Term → TC ⊤ solve-macro i ring hole = do ring′ ← checkIsRing (def ring []) commitTC let open OverRing ring′ operatorNames ← getRingOperatorNames listOfVariables′ ← checkIsListOfVariables i commitTC hole′ ← inferType hole >>= reduce just vars′ ← pure (getVariableIDs listOfVariables′) where nothing → typeError (strErr "Malformed call to solve." ∷ strErr "First argument should be a list of free variables." ∷ strErr "Instead: " ∷ termErr listOfVariables′ ∷ []) just (lhs ∷ rhs ∷ []) ← pure (getArgs 2 hole′) where nothing → typeError (strErr "Malformed call to solve." ∷ strErr "First argument should be a list of free variables." ∷ strErr "Instead: " ∷ termErr hole′ ∷ []) unify hole (constructSoln operatorNames (List.length vars′) vars′ lhs rhs) macro solve : Term → Name → Term → TC ⊤ solve = solve-macro
programs/oeis/129/A129362.asm
neoneye/loda
22
87860
; A129362: a(n) = Sum_{k=floor((n+1)/2)..n} J(k+1), J(k) = A001045(k). ; 1,1,4,8,19,37,80,160,331,661,1344,2688,5419,10837,21760,43520,87211,174421,349184,698368,1397419,2794837,5591040,11182080,22366891,44733781,89473024,178946048,357903019,715806037,1431633920,2863267840,5726579371,11453158741,22906404864,45812809728,91625794219,183251588437,366503526400,733007052800,1466014804651,2932029609301,5864060616704,11728121233408,23456245263019,46912490526037,93824986644480,187649973288960,375299957762731,750599915525461,1501199853420544,3002399706841088,6004799458421419,12009598916842837,24019197923164160,48038395846328320,96076791871613611,192153583743227221,384307167844368384,768614335688736768,1537228672093301419,3074457344186602837,6148914689804861440,12297829379609722880,24595658762082757291,49191317524165514581,98382635054057652224,196765270108115304448,393530540227683855019,787061080455367710037,1574122160933641912320,3148244321867283824640,6296488643780380633771,12592977287560761267541,25185954575213148504064,50371909150426297008128,100743818301035845954219,201487636602071691908437,402975273204509887692800,805950546409019775385600,1611901092818772558523051,3223802185637545117046101,6447604371276556249595904,12895208742553112499191808,25790417485109157029391019,51580834970218314058782037,103161669940442492179578880,206323339880884984359157760,412646679761781696842345131,825293359523563393684690261,1650586719047150243617439744,3301173438094300487234879488,6602346876188647886965877419,13204693752377295773931754837,26409387504754685372855746560,52818775009509370745711493120,105637550019018929141407460011,211275100038037858282814920021,422550200076076091865598787584,845100400152152183731197575168 add $0,2 seq $0,297619 ; a(n) = 2*a(n-1) + 2*a(n-2) - 4*a(n-3), a(1) = 0, a(2) = 0, a(3) = 8. sub $0,8 div $0,12 add $0,1
oeis/091/A091084.asm
neoneye/loda-programs
11
92212
<reponame>neoneye/loda-programs ; A091084: a(n) = A001045(n) mod 10. ; Submitted by <NAME> ; 0,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5,1,1,3 mov $2,12 pow $2,$0 add $2,1 mov $0,$2 div $0,13 mod $0,10
alloy4fun_models/trashltl/models/4/HAKsJPTPXRKii7Q2n.als
Kaixi26/org.alloytools.alloy
0
1238
<filename>alloy4fun_models/trashltl/models/4/HAKsJPTPXRKii7Q2n.als<gh_stars>0 open main pred idHAKsJPTPXRKii7Q2n_prop5 { eventually ( File != File' and File' in File ) } pred __repair { idHAKsJPTPXRKii7Q2n_prop5 } check __repair { idHAKsJPTPXRKii7Q2n_prop5 <=> prop5o }
sources/supervisor/hal-x64-uefi/src/start_util.asm
twrl/conurbation
5
22266
[BITS 64] [SECTION .text] [GLOBAL enable_sse:function (enable_sse.end - enable_sse)] enable_sse: mov rax, cr0 and ax, 0xFFFB ;clear coprocessor emulation CR0.EM or ax, 0x2 ;set coprocessor monitoring CR0.MP mov cr0, rax mov rax, cr4 or ax, 3 << 9 ;set CR4.OSFXSR and CR4.OSXMMEXCPT at the same time mov cr4, rax ret .end:
src/H-level/Closure.agda
nad/equality
3
644
------------------------------------------------------------------------ -- Closure properties for h-levels ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} -- Partly based on Voevodsky's work on so-called univalent -- foundations. open import Equality module H-level.Closure {reflexive} (eq : ∀ {a p} → Equality-with-J a p reflexive) where open import Bijection eq as Bijection hiding (id; _∘_) open Derived-definitions-and-properties eq import Equality.Decidable-UIP eq as DUIP open import Equality.Decision-procedures eq open import H-level eq open import Logical-equivalence hiding (id; _∘_) open import Nat eq as Nat open import Prelude open import Surjection eq as Surjection hiding (id; _∘_) ------------------------------------------------------------------------ -- The unit type -- The unit type is contractible. ⊤-contractible : Contractible ⊤ ⊤-contractible = (_ , λ _ → refl _) -- A type is contractible iff it is in bijective correspondence with -- the unit type. contractible⇔↔⊤ : ∀ {a} {A : Type a} → Contractible A ⇔ (A ↔ ⊤) contractible⇔↔⊤ = record { to = flip contractible-isomorphic ⊤-contractible ; from = λ A↔⊤ → respects-surjection (_↔_.surjection (Bijection.inverse A↔⊤)) 0 ⊤-contractible } ------------------------------------------------------------------------ -- The empty type abstract -- The empty type is not contractible. ¬-⊥-contractible : ∀ {ℓ} → ¬ Contractible (⊥ {ℓ = ℓ}) ¬-⊥-contractible = ⊥-elim ∘ proj₁ -- The empty type is propositional. ⊥-propositional : ∀ {ℓ} → Is-proposition (⊥ {ℓ = ℓ}) ⊥-propositional x = ⊥-elim x -- Thus any uninhabited type is also propositional. uninhabited-propositional : ∀ {a} {A : Type a} → ¬ A → Is-proposition A uninhabited-propositional ¬A = respects-surjection (_↔_.surjection $ ⊥↔uninhabited {ℓ = # 0} ¬A) 1 ⊥-propositional ------------------------------------------------------------------------ -- Booleans abstract -- The booleans are not propositional. ¬-Bool-propositional : ¬ Is-proposition Bool ¬-Bool-propositional propositional = Bool.true≢false $ propositional true false -- The booleans form a set. Bool-set : Is-set Bool Bool-set = DUIP.decidable⇒set Bool._≟_ ------------------------------------------------------------------------ -- Natural numbers abstract -- ℕ is not propositional. ¬-ℕ-propositional : ¬ Is-proposition ℕ ¬-ℕ-propositional ℕ-prop = 0≢+ $ ℕ-prop 0 1 -- ℕ is a set. ℕ-set : Is-set ℕ ℕ-set = DUIP.decidable⇒set Nat._≟_ -- Nat._≤_ is not a family of contractible types. ¬-≤-contractible : ¬ (∀ {m n} → Contractible (m Nat.≤ n)) ¬-≤-contractible ≤-contr with proj₁ (≤-contr {m = 1} {n = 0}) ... | ≤-refl′ 1≡0 = 0≢+ (sym 1≡0) ... | ≤-step′ _ +≡0 = 0≢+ (sym +≡0) -- Nat._≤_ is a family of propositions. ≤-propositional : ∀ {m n} → Is-proposition (m Nat.≤ n) ≤-propositional = irr where lemma : ∀ {m n k} → m ≡ n → m ≤ k → suc k ≡ n → ⊥₀ lemma {m} {n} {k} m≡n m≤k 1+k≡n = <-irreflexive ( suc n ≡⟨ cong suc $ sym m≡n ⟩≤ suc m ≤⟨ suc≤suc m≤k ⟩ suc k ≡⟨ 1+k≡n ⟩≤ n ∎≤) cong-≤-step′ : ∀ {m n k₁ k₂} {p₁ : m ≤ k₁} {q₁ : suc k₁ ≡ n} {p₂ : m ≤ k₂} {q₂ : suc k₂ ≡ n} → (k₁≡k₂ : k₁ ≡ k₂) → subst (m ≤_) k₁≡k₂ p₁ ≡ p₂ → subst (λ k → suc k ≡ n) k₁≡k₂ q₁ ≡ q₂ → ≤-step′ p₁ q₁ ≡ ≤-step′ p₂ q₂ cong-≤-step′ {p₁ = p₁} {q₁} {p₂} {q₂} k₁≡k₂ p-eq q-eq = cong (λ { (k , p , q) → ≤-step′ {k = k} p q }) (Σ-≡,≡→≡ k₁≡k₂ (subst (λ k → _ ≤ k × suc k ≡ _) k₁≡k₂ (p₁ , q₁) ≡⟨ push-subst-, _ _ ⟩ (subst (_ ≤_) k₁≡k₂ p₁ , subst (λ k → suc k ≡ _) k₁≡k₂ q₁) ≡⟨ cong₂ _,_ p-eq q-eq ⟩∎ (p₂ , q₂) ∎)) irr : ∀ {m n} → Is-proposition (m Nat.≤ n) irr (≤-refl′ q₁) (≤-refl′ q₂) = cong ≤-refl′ $ ℕ-set q₁ q₂ irr (≤-refl′ q₁) (≤-step′ p₂ q₂) = ⊥-elim (lemma q₁ p₂ q₂) irr (≤-step′ p₁ q₁) (≤-refl′ q₂) = ⊥-elim (lemma q₂ p₁ q₁) irr {n = n} (≤-step′ {k = k₁} p₁ q₁) (≤-step′ {k = k₂} p₂ q₂) = cong-≤-step′ (cancel-suc (suc k₁ ≡⟨ q₁ ⟩ n ≡⟨ sym q₂ ⟩∎ suc k₂ ∎)) (irr _ p₂) (ℕ-set _ _) -- Nat.Distinct is not a family of contractible types. ¬-Distinct-contractible : ¬ (∀ m n → Contractible (Nat.Distinct m n)) ¬-Distinct-contractible Distinct-contr = proj₁ (Distinct-contr 0 0) -- Distinct is a family of propositions. Distinct-propositional : ∀ m n → Is-proposition (Distinct m n) Distinct-propositional zero zero = ⊥-propositional Distinct-propositional zero (suc n) = mono₁ 0 ⊤-contractible Distinct-propositional (suc m) zero = mono₁ 0 ⊤-contractible Distinct-propositional (suc m) (suc n) = Distinct-propositional m n ------------------------------------------------------------------------ -- Π-types -- Closure of contractibility under Π A is logically equivalent to -- having extensional equality for functions from A. Π-closure-contractible⇔extensionality : ∀ {a b} {A : Type a} → ({B : A → Type b} → (∀ x → Contractible (B x)) → Contractible ((x : A) → B x)) ⇔ ({B : A → Type b} → Extensionality′ A B) Π-closure-contractible⇔extensionality {b = b} {A} = record { to = ⇒ ; from = λ ext cB → ((λ x → proj₁ (cB x)) , λ f → ext λ x → proj₂ (cB x) (f x)) } where ⇒ : ({B : A → Type b} → (∀ x → Contractible (B x)) → Contractible ((x : A) → B x)) → (∀ {B} → Extensionality′ A B) ⇒ closure {B} {f} {g} f≡g = f ≡⟨ sym (cong (λ c → λ x → proj₁ (c x)) $ proj₂ contractible (λ x → (f x , f≡g x))) ⟩ (λ x → proj₁ (proj₁ contractible x)) ≡⟨ cong (λ c → λ x → proj₁ (c x)) $ proj₂ contractible (λ x → (g x , refl (g x))) ⟩∎ g ∎ where contractible : Contractible ((x : A) → Singleton (g x)) contractible = closure (singleton-contractible ∘ g) abstract -- Given (generalised) extensionality one can define an -- extensionality proof which is well-behaved. extensionality⇒well-behaved-extensionality : ∀ {a b} {A : Type a} → ({B : A → Type b} → Extensionality′ A B) → {B : A → Type b} → Well-behaved-extensionality A B extensionality⇒well-behaved-extensionality {A = A} ext {B} = (λ {_} → ext′) , λ f → ext′ (refl ∘ f) ≡⟨ trans-symˡ _ ⟩∎ refl f ∎ where ext′ : Extensionality′ A B ext′ = to (from ext) where open _⇔_ Π-closure-contractible⇔extensionality -- A potential inverse of extensionality. (See Equivalence for a proof -- which shows that this function has an inverse, assuming -- extensionality.) ext⁻¹ : ∀ {a b} {A : Type a} {B : A → Type b} {f g : (x : A) → B x} → f ≡ g → (∀ x → f x ≡ g x) ext⁻¹ f≡g = λ x → cong (λ h → h x) f≡g abstract -- "Evaluation rule" for ext⁻¹. ext⁻¹-refl : ∀ {a b} {A : Type a} {B : A → Type b} (f : (x : A) → B x) {x} → ext⁻¹ (refl f) x ≡ refl (f x) ext⁻¹-refl f {x} = cong-refl (λ h → h x) -- Given extensionality there is a (split) surjection from -- ∀ x → f x ≡ g x to f ≡ g. ext-surj : ∀ {a b} → Extensionality a b → {A : Type a} {B : A → Type b} {f g : (x : A) → B x} → (∀ x → f x ≡ g x) ↠ (f ≡ g) ext-surj {b = b} ext {A} {B} = record { logical-equivalence = record { to = to ; from = ext⁻¹ } ; right-inverse-of = elim (λ {f g} f≡g → to (ext⁻¹ f≡g) ≡ f≡g) λ h → proj₁ ext′ (ext⁻¹ (refl h)) ≡⟨ cong (proj₁ ext′) (proj₁ ext′ λ _ → ext⁻¹-refl h) ⟩ proj₁ ext′ (refl ∘ h) ≡⟨ proj₂ ext′ h ⟩∎ refl h ∎ } where ext′ : {B : A → Type b} → Well-behaved-extensionality A B ext′ = extensionality⇒well-behaved-extensionality (apply-ext ext) to : {f g : (x : A) → B x} → (∀ x → f x ≡ g x) → f ≡ g to = proj₁ ext′ -- H-level′ is closed under Π A (assuming extensionality). Π-closure′ : ∀ {a b} {A : Type a} {B : A → Type b} → Extensionality a b → ∀ n → (∀ x → H-level′ n (B x)) → H-level′ n ((x : A) → B x) Π-closure′ ext zero = _⇔_.from Π-closure-contractible⇔extensionality (apply-ext ext) Π-closure′ ext (suc n) = λ h f g → respects-surjection′ (ext-surj ext) n $ Π-closure′ ext n (λ x → h x (f x) (g x)) -- H-level is closed under Π A (assuming extensionality). Π-closure : ∀ {a b} {A : Type a} {B : A → Type b} → Extensionality a b → ∀ n → (∀ x → H-level n (B x)) → H-level n ((x : A) → B x) Π-closure ext n h = _⇔_.from H-level⇔H-level′ $ Π-closure′ ext n (λ x → _⇔_.to H-level⇔H-level′ (h x)) -- This also applies to the implicit function space. implicit-Π-closure : ∀ {a b} {A : Type a} {B : A → Type b} → Extensionality a b → ∀ n → (∀ x → H-level n (B x)) → H-level n ({x : A} → B x) implicit-Π-closure ext n = respects-surjection (_↔_.surjection $ Bijection.inverse implicit-Π↔Π) n ∘ Π-closure ext n abstract -- Negated types are propositional, assuming extensionality. ¬-propositional : ∀ {a} {A : Type a} → Extensionality a lzero → Is-proposition (¬ A) ¬-propositional ext = Π-closure ext 1 (λ _ → ⊥-propositional) -- The type ∀ y → x ≡ y is a proposition (assuming extensionality). -- -- This is Lemma 4.1 from van Doorn's "Constructing the Propositional -- Truncation using Non-recursive HITs" (perhaps the proof is not -- quite identical to van Doorn's). Π≡-proposition : ∀ {a} {A : Type a} → Extensionality a a → (x : A) → Is-proposition (∀ y → x ≡ y) Π≡-proposition {A = A} ext x = [inhabited⇒+]⇒+ 0 λ f → let prop : Is-proposition A prop u v = u ≡⟨ sym (f u) ⟩ x ≡⟨ f v ⟩∎ v ∎ in Π-closure ext 1 λ _ → mono₁ 1 prop ------------------------------------------------------------------------ -- Σ-types -- H-level′ is closed under Σ. Σ-closure′ : ∀ {a b} {A : Type a} {B : A → Type b} n → H-level′ n A → (∀ x → H-level′ n (B x)) → H-level′ n (Σ A B) Σ-closure′ {A = A} {B} zero (x , irrA) hB = ((x , proj₁ (hB x)) , λ p → (x , proj₁ (hB x)) ≡⟨ elim (λ {x y} _ → _≡_ {A = Σ A B} (x , proj₁ (hB x)) (y , proj₁ (hB y))) (λ _ → refl _) (irrA (proj₁ p)) ⟩ (proj₁ p , proj₁ (hB (proj₁ p))) ≡⟨ cong (_,_ (proj₁ p)) (proj₂ (hB (proj₁ p)) (proj₂ p)) ⟩∎ p ∎) Σ-closure′ {B = B} (suc n) hA hB = λ p₁ p₂ → respects-surjection′ (_↔_.surjection Σ-≡,≡↔≡) n $ Σ-closure′ n (hA (proj₁ p₁) (proj₁ p₂)) (λ pr₁p₁≡pr₁p₂ → hB (proj₁ p₂) (subst B pr₁p₁≡pr₁p₂ (proj₂ p₁)) (proj₂ p₂)) -- H-level is closed under Σ. Σ-closure : ∀ {a b} {A : Type a} {B : A → Type b} n → H-level n A → (∀ x → H-level n (B x)) → H-level n (Σ A B) Σ-closure n hA hB = _⇔_.from H-level⇔H-level′ (Σ-closure′ n (_⇔_.to H-level⇔H-level′ hA) (_⇔_.to H-level⇔H-level′ ∘ hB)) abstract -- In the case of contractibility the codomain only needs to have -- the right h-level (0) for a single index. Σ-closure-contractible : ∀ {a b} {A : Type a} {B : A → Type b} → (c : Contractible A) → Contractible (B (proj₁ c)) → Contractible (Σ A B) Σ-closure-contractible {B = B} cA (b , irrB) = Σ-closure 0 cA cB where cB : ∀ a → Contractible (B a) cB a = subst B (proj₂ cA a) b , λ b′ → subst B (proj₂ cA a) b ≡⟨ cong (subst B (proj₂ cA a)) $ irrB (subst B (sym $ proj₂ cA a) b′) ⟩ subst B (proj₂ cA a) (subst B (sym $ proj₂ cA a) b′) ≡⟨ subst-subst-sym _ _ _ ⟩∎ b′ ∎ -- H-level is closed under _×_. ×-closure : ∀ {a b} {A : Type a} {B : Type b} n → H-level n A → H-level n B → H-level n (A × B) ×-closure n hA hB = Σ-closure n hA (const hB) -- If B a is inhabited for all a, and Σ A B has h-level n, then A -- also has h-level n. -- -- One cannot, in general, replace ∀ a → B a with ∀ a → ∥ B a ∥ (see -- Circle.¬-generalised-proj₁-closure). However, this is possible if -- B is constant (see H-level.Truncation.Propositional.H-level-×₁). proj₁-closure : ∀ {a b} {A : Type a} {B : A → Type b} → (∀ a → B a) → ∀ n → H-level n (Σ A B) → H-level n A proj₁-closure {A = A} {B} inhabited = respects-surjection surj where surj : Σ A B ↠ A surj = record { logical-equivalence = record { to = proj₁ ; from = λ x → x , inhabited x } ; right-inverse-of = refl } -- If A is inhabited and A × B has h-level n, then B also has -- h-level n. proj₂-closure : ∀ {a b} {A : Type a} {B : Type b} → A → ∀ n → H-level n (A × B) → H-level n B proj₂-closure {A = A} {B} inhabited = respects-surjection surj where surj : A × B ↠ B surj = record { logical-equivalence = record { to = proj₂ ; from = λ x → inhabited , x } ; right-inverse-of = refl } ------------------------------------------------------------------------ -- Logical equivalences, split surjections and bijections -- H-level n is closed under the type formers _⇔_, _↠_ and _↔_ -- (assuming extensionality). ⇔-closure : ∀ {a b} {A : Type a} {B : Type b} → Extensionality (a ⊔ b) (a ⊔ b) → ∀ n → H-level n A → H-level n B → H-level n (A ⇔ B) ⇔-closure {a} {b} ext n hA hB = respects-surjection (record { logical-equivalence = record { to = _ ; from = λ A⇔B → _⇔_.to A⇔B , _⇔_.from A⇔B } ; right-inverse-of = λ _ → refl _ }) n (×-closure n (Π-closure (lower-extensionality b a ext) n (λ _ → hB)) (Π-closure (lower-extensionality a b ext) n (λ _ → hA))) ↠-closure : ∀ {a b} {A : Type a} {B : Type b} → Extensionality (a ⊔ b) (a ⊔ b) → ∀ n → H-level n A → H-level n B → H-level n (A ↠ B) ↠-closure {a} {b} ext n hA hB = respects-surjection (record { logical-equivalence = record { to = _ ; from = λ A↠B → _↠_.logical-equivalence A↠B , _↠_.right-inverse-of A↠B } ; right-inverse-of = λ _ → refl _ }) n (Σ-closure n (⇔-closure ext n hA hB) λ _ → Π-closure (lower-extensionality a a ext) n λ _ → ⇒≡ _ hB) ↔-closure : ∀ {a b} {A : Type a} {B : Type b} → Extensionality (a ⊔ b) (a ⊔ b) → ∀ n → H-level n A → H-level n B → H-level n (A ↔ B) ↔-closure {a} {b} ext n hA hB = respects-surjection (record { logical-equivalence = record { to = _ ; from = λ A↔B → _↔_.surjection A↔B , _↔_.left-inverse-of A↔B } ; right-inverse-of = λ _ → refl _ }) n (Σ-closure n (↠-closure ext n hA hB) λ _ → Π-closure (lower-extensionality b b ext) n λ _ → ⇒≡ _ hA) ------------------------------------------------------------------------ -- Lifted types -- All H-levels are closed under lifting. ↑-closure : ∀ {a b} {A : Type a} n → H-level n A → H-level n (↑ b A) ↑-closure = respects-surjection (_↔_.surjection (Bijection.inverse ↑↔)) -- All H-levels are also closed under removal of lifting. ↑⁻¹-closure : ∀ {a b} {A : Type a} n → H-level n (↑ b A) → H-level n A ↑⁻¹-closure = respects-surjection (_↔_.surjection ↑↔) ------------------------------------------------------------------------ -- W-types -- W-types are isomorphic to Σ-types containing W-types. W-unfolding : ∀ {a b} {A : Type a} {B : A → Type b} → W A B ↔ ∃ λ (x : A) → B x → W A B W-unfolding = record { surjection = record { logical-equivalence = record { to = λ w → headᵂ w , tailᵂ w ; from = uncurry sup } ; right-inverse-of = refl } ; left-inverse-of = left-inverse-of } where left-inverse-of : (w : W _ _) → sup (headᵂ w) (tailᵂ w) ≡ w left-inverse-of (sup x f) = refl (sup x f) abstract -- Equality between elements of a W-type can be proved using a pair -- of equalities (assuming extensionality). W-≡,≡↠≡ : ∀ {a b} {A : Type a} {B : A → Type b} → Extensionality b (a ⊔ b) → ∀ {x y} {f : B x → W A B} {g : B y → W A B} → (∃ λ (p : x ≡ y) → ∀ i → f i ≡ g (subst B p i)) ↠ (sup x f ≡ sup y g) W-≡,≡↠≡ {a} {A = A} {B} ext {x} {y} {f} {g} = (∃ λ (p : x ≡ y) → ∀ i → f i ≡ g (subst B p i)) ↠⟨ Surjection.∃-cong lemma ⟩ (∃ λ (p : x ≡ y) → subst (λ x → B x → W A B) p f ≡ g) ↠⟨ _↔_.surjection Σ-≡,≡↔≡ ⟩ (_≡_ {A = ∃ λ (x : A) → B x → W A B} (x , f) (y , g)) ↠⟨ ↠-≡ (_↔_.surjection (Bijection.inverse (W-unfolding {A = A} {B = B}))) ⟩□ (sup x f ≡ sup y g) □ where lemma : (p : x ≡ y) → (∀ i → f i ≡ g (subst B p i)) ↠ (subst (λ x → B x → W A B) p f ≡ g) lemma p = elim (λ {x y} p → (f : B x → W A B) (g : B y → W A B) → (∀ i → f i ≡ g (subst B p i)) ↠ (subst (λ x → B x → W A B) p f ≡ g)) (λ x f g → (∀ i → f i ≡ g (subst B (refl x) i)) ↠⟨ subst (λ h → (∀ i → f i ≡ g (h i)) ↠ (∀ i → f i ≡ g i)) (sym (apply-ext (lower-extensionality lzero a ext) (subst-refl B))) Surjection.id ⟩ (∀ i → f i ≡ g i) ↠⟨ ext-surj ext ⟩ (f ≡ g) ↠⟨ subst (λ h → (f ≡ g) ↠ (h ≡ g)) (sym $ subst-refl (λ x' → B x' → W A B) f) Surjection.id ⟩□ (subst (λ x → B x → W A B) (refl x) f ≡ g) □) p f g -- H-level is not closed under W. ¬-W-closure-contractible : ∀ {a b} → ¬ (∀ {A : Type a} {B : A → Type b} → Contractible A → (∀ x → Contractible (B x)) → Contractible (W A B)) ¬-W-closure-contractible closure = inhabited⇒W-empty (const (lift tt)) $ proj₁ $ closure (↑-closure 0 ⊤-contractible) (const (↑-closure 0 ⊤-contractible)) ¬-W-closure : ∀ {a b} → ¬ (∀ {A : Type a} {B : A → Type b} n → H-level n A → (∀ x → H-level n (B x)) → H-level n (W A B)) ¬-W-closure closure = ¬-W-closure-contractible (closure 0) -- However, all positive h-levels are closed under W (assuming -- extensionality). W-closure′ : ∀ {a b} {A : Type a} {B : A → Type b} → Extensionality b (a ⊔ b) → ∀ n → H-level′ (1 + n) A → H-level′ (1 + n) (W A B) W-closure′ {A = A} {B} ext n h = closure where closure : (x y : W A B) → H-level′ n (x ≡ y) closure (sup x f) (sup y g) = respects-surjection′ (W-≡,≡↠≡ ext) n $ Σ-closure′ n (h x y) (λ _ → Π-closure′ ext n (λ i → closure (f _) (g _))) W-closure : ∀ {a b} {A : Type a} {B : A → Type b} → Extensionality b (a ⊔ b) → ∀ n → H-level (1 + n) A → H-level (1 + n) (W A B) W-closure ext n h = _⇔_.from H-level⇔H-level′ (W-closure′ ext n (_⇔_.to H-level⇔H-level′ h)) ------------------------------------------------------------------------ -- H-levels abstract -- Contractible is /not/ a comonad in the category of types and -- functions, because map cannot be defined, but we can at least -- define the following functions. counit : ∀ {a} {A : Type a} → Contractible A → A counit = proj₁ cojoin : ∀ {a} {A : Type a} → Extensionality a a → Contractible A → Contractible (Contractible A) cojoin {A = A} ext contr = contr₃ where x : A x = proj₁ contr contr₁ : Contractible (∀ y → x ≡ y) contr₁ = Π-closure′ ext 0 (mono₁′ 0 contr x) contr₂ : (x : A) → Contractible (∀ y → x ≡ y) contr₂ x = subst (λ x → Contractible (∀ y → x ≡ y)) (proj₂ contr x) contr₁ contr₃ : Contractible (∃ λ (x : A) → ∀ y → x ≡ y) contr₃ = Σ-closure 0 contr contr₂ -- Contractible is not necessarily contractible. ¬-Contractible-contractible : ¬ ({A : Type} → Contractible (Contractible A)) ¬-Contractible-contractible contr = proj₁ $ proj₁ $ contr {A = ⊥} -- Contractible is propositional (assuming extensionality). Contractible-propositional : ∀ {a} {A : Type a} → Extensionality a a → Is-proposition (Contractible A) Contractible-propositional ext = [inhabited⇒contractible]⇒propositional (cojoin ext) -- H-level′ is closed under λ P → For-iterated-equality n P A. H-level′-For-iterated-equality : ∀ {p A} {P : Type p → Type p} → Extensionality p p → ∀ m n → (∀ {A} → H-level′ m (P A)) → H-level′ m (For-iterated-equality n P A) H-level′-For-iterated-equality ext m zero hyp = hyp H-level′-For-iterated-equality ext m (suc n) hyp = Π-closure′ ext m λ _ → Π-closure′ ext m λ _ → H-level′-For-iterated-equality ext m n hyp -- A variant of the previous result. H-level′-For-iterated-equality′ : ∀ {p A} {P : Type p → Type p} → Extensionality p p → ∀ m n {o} → H-level′ (n + o) A → (∀ {A} → H-level′ o A → H-level′ m (P A)) → H-level′ m (For-iterated-equality n P A) H-level′-For-iterated-equality′ ext m zero hyp₁ hyp₂ = hyp₂ hyp₁ H-level′-For-iterated-equality′ ext m (suc n) hyp₁ hyp₂ = Π-closure′ ext m λ _ → Π-closure′ ext m λ _ → H-level′-For-iterated-equality′ ext m n (hyp₁ _ _) hyp₂ -- H-level is closed under λ P → For-iterated-equality n P A. H-level-For-iterated-equality : ∀ {p A} {P : Type p → Type p} → Extensionality p p → ∀ m n → (∀ {A} → H-level m (P A)) → H-level m (For-iterated-equality n P A) H-level-For-iterated-equality ext m n hyp = _⇔_.from H-level⇔H-level′ $ H-level′-For-iterated-equality ext m n $ _⇔_.to H-level⇔H-level′ hyp -- A variant of the previous result. H-level-For-iterated-equality′ : ∀ {p A} {P : Type p → Type p} → Extensionality p p → ∀ m n {o} → H-level (n + o) A → (∀ {A} → H-level o A → H-level m (P A)) → H-level m (For-iterated-equality n P A) H-level-For-iterated-equality′ ext m n hyp₁ hyp₂ = _⇔_.from (H-level⇔H-level′ {n = m}) $ H-level′-For-iterated-equality′ ext m n (_⇔_.to H-level⇔H-level′ hyp₁) (_⇔_.to H-level⇔H-level′ ∘ hyp₂ ∘ _⇔_.from H-level⇔H-level′) -- H-level′ is pointwise propositional (assuming extensionality). H-level′-propositional : ∀ {a} → Extensionality a a → ∀ {A : Type a} n → Is-proposition (H-level′ n A) H-level′-propositional ext n = _⇔_.from (H-level⇔H-level′ {n = 1}) $ H-level′-For-iterated-equality ext 1 n $ _⇔_.to (H-level⇔H-level′ {n = 1}) $ Contractible-propositional ext -- The property Is-proposition A is a proposition (assuming -- extensionality). -- -- This result is proved in the HoTT book (first edition, -- Lemma 3.3.5). Is-proposition-propositional : ∀ {a} {A : Type a} → Extensionality a a → Is-proposition (Is-proposition A) Is-proposition-propositional ext = [inhabited⇒+]⇒+ 0 λ p → Π-closure ext 1 λ _ → Π-closure ext 1 λ _ → ⇒≡ 1 p -- All h-levels are propositional (assuming extensionality). H-level-propositional : ∀ {a} → Extensionality a a → ∀ {A : Type a} n → Is-proposition (H-level n A) H-level-propositional ext zero = Contractible-propositional ext H-level-propositional ext (suc zero) = Is-proposition-propositional ext H-level-propositional {A} ext (suc (suc n)) = implicit-Π-closure ext 1 λ x → implicit-Π-closure ext 1 λ y → H-level-propositional ext {A = x ≡ y} (suc n) -- Uniqueness-of-identity-proofs is pointwise propositional -- (assuming extensionality). UIP-propositional : ∀ {ℓ} → Extensionality (lsuc ℓ) ℓ → Is-proposition (Uniqueness-of-identity-proofs ℓ) UIP-propositional ext = implicit-Π-closure ext 1 λ A → H-level-propositional (lower-extensionality _ lzero ext) 2 ------------------------------------------------------------------------ -- Binary sums abstract -- Binary sums can be expressed using Σ and Bool (with large -- elimination). sum-as-pair : ∀ {a b} {A : Type a} {B : Type b} → (A ⊎ B) ↔ (∃ λ (x : Bool) → if x then ↑ b A else ↑ a B) sum-as-pair {a} {b} {A} {B} = record { surjection = record { logical-equivalence = record { to = to ; from = from } ; right-inverse-of = to∘from } ; left-inverse-of = [ refl ∘ inj₁ {B = B} , refl ∘ inj₂ {A = A} ] } where to : A ⊎ B → (∃ λ (x : Bool) → if x then ↑ b A else ↑ a B) to = [ _,_ true ∘ lift , _,_ false ∘ lift ] from : (∃ λ (x : Bool) → if x then ↑ b A else ↑ a B) → A ⊎ B from (true , x) = inj₁ $ lower x from (false , y) = inj₂ $ lower y to∘from : (y : ∃ λ x → if x then ↑ b A else ↑ a B) → to (from y) ≡ y to∘from (true , x) = refl _ to∘from (false , y) = refl _ -- H-level is not closed under _⊎_. ¬-⊎-propositional : ∀ {a b} {A : Type a} {B : Type b} → A → B → ¬ Is-proposition (A ⊎ B) ¬-⊎-propositional x y hA⊎B = ⊎.inj₁≢inj₂ $ hA⊎B (inj₁ x) (inj₂ y) ¬-⊎-closure : ∀ {a b} → ¬ (∀ {A : Type a} {B : Type b} n → H-level n A → H-level n B → H-level n (A ⊎ B)) ¬-⊎-closure ⊎-closure = ¬-⊎-propositional (lift tt) (lift tt) $ mono₁ 0 $ ⊎-closure 0 (↑-closure 0 ⊤-contractible) (↑-closure 0 ⊤-contractible) -- However, all levels greater than or equal to 2 are closed under -- _⊎_. ⊎-closure : ∀ {a b} {A : Type a} {B : Type b} n → H-level (2 + n) A → H-level (2 + n) B → H-level (2 + n) (A ⊎ B) ⊎-closure {a} {b} {A} {B} n hA hB = respects-surjection (_↔_.surjection $ Bijection.inverse sum-as-pair) (2 + n) (Σ-closure (2 + n) Bool-2+n if-2+n) where Bool-2+n : H-level (2 + n) Bool Bool-2+n = mono (m≤m+n 2 n) Bool-set if-2+n : (x : Bool) → H-level (2 + n) (if x then ↑ b A else ↑ a B) if-2+n true = respects-surjection (_↔_.surjection $ Bijection.inverse ↑↔) (2 + n) hA if-2+n false = respects-surjection (_↔_.surjection $ Bijection.inverse ↑↔) (2 + n) hB -- Furthermore, if A and B are propositions and mutually exclusive, -- then A ⊎ B is a proposition. ⊎-closure-propositional : ∀ {a b} {A : Type a} {B : Type b} → (A → B → ⊥₀) → Is-proposition A → Is-proposition B → Is-proposition (A ⊎ B) ⊎-closure-propositional A→B→⊥ A-prop B-prop = λ where (inj₁ a₁) (inj₁ a₂) → cong inj₁ (A-prop a₁ a₂) (inj₁ a₁) (inj₂ b₂) → ⊥-elim (A→B→⊥ a₁ b₂) (inj₂ b₁) (inj₁ a₂) → ⊥-elim (A→B→⊥ a₂ b₁) (inj₂ b₁) (inj₂ b₂) → cong inj₂ (B-prop b₁ b₂) -- All levels greater than or equal to 2 are also closed under -- Maybe. Maybe-closure : ∀ {a} {A : Type a} n → H-level (2 + n) A → H-level (2 + n) (Maybe A) Maybe-closure n h = ⊎-closure n (mono (zero≤ (2 + n)) ⊤-contractible) h -- T is pointwise propositional. T-propositional : ∀ {a b} {A : Type a} {B : Type b} → (x : A ⊎ B) → Is-proposition (T x) T-propositional (inj₁ _) = mono₁ 0 ⊤-contractible T-propositional (inj₂ _) = ⊥-propositional -- Furthermore Is-proposition is closed under Dec (assuming -- extensionality). Dec-closure-propositional : ∀ {a} {A : Type a} → Extensionality a lzero → Is-proposition A → Is-proposition (Dec A) Dec-closure-propositional {A = A} ext p = λ where (yes a) (yes a′) → cong yes $ p a a′ (yes a) (no ¬a) → ⊥-elim (¬a a) (no ¬a) (yes a) → ⊥-elim (¬a a) (no ¬a) (no ¬a′) → cong no $ ¬-propositional ext ¬a ¬a′ -- Is-proposition is also closed under _Xor_ (assuming -- extensionality). Xor-closure-propositional : ∀ {a b} {A : Type a} {B : Type b} → Extensionality (a ⊔ b) (# 0) → Is-proposition A → Is-proposition B → Is-proposition (A Xor B) Xor-closure-propositional {ℓa} {ℓb} {A} {B} ext pA pB = λ where (inj₁ (a , ¬b)) (inj₂ (¬a , b)) → ⊥-elim (¬a a) (inj₂ (¬a , b)) (inj₁ (a , ¬b)) → ⊥-elim (¬b b) (inj₁ (a , ¬b)) (inj₁ (a′ , ¬b′)) → cong₂ (λ x y → inj₁ (x , y)) (pA a a′) (apply-ext (lower-extensionality ℓa _ ext) λ b → ⊥-elim (¬b b)) (inj₂ (¬a , b)) (inj₂ (¬a′ , b′)) → cong₂ (λ x y → inj₂ (x , y)) (apply-ext (lower-extensionality ℓb _ ext) λ a → ⊥-elim (¬a a)) (pB b b′) -- However, H-level is not closed under _Xor_. ¬-Xor-closure-contractible : ∀ {a b} → ¬ ({A : Type a} {B : Type b} → Contractible A → Contractible B → Contractible (A Xor B)) ¬-Xor-closure-contractible closure with proj₁ $ closure (↑-closure 0 ⊤-contractible) (↑-closure 0 ⊤-contractible) ... | inj₁ (_ , ¬⊤) = ¬⊤ _ ... | inj₂ (¬⊤ , _) = ¬⊤ _ -- Alternative definition of ⊎-closure (for Type₀). module Alternative-proof where -- Is-set is closed under _⊎_, by an argument similar to the one -- Hedberg used to prove that decidable equality implies -- uniqueness of identity proofs. ⊎-closure-set : {A B : Type} → Is-set A → Is-set B → Is-set (A ⊎ B) ⊎-closure-set {A} {B} A-set B-set = DUIP.constant⇒set c where c : (x y : A ⊎ B) → ∃ λ (f : x ≡ y → x ≡ y) → DUIP.Constant f c (inj₁ x) (inj₁ y) = (cong inj₁ ∘ ⊎.cancel-inj₁ , λ p q → cong (cong inj₁) $ A-set (⊎.cancel-inj₁ p) (⊎.cancel-inj₁ q)) c (inj₂ x) (inj₂ y) = (cong inj₂ ∘ ⊎.cancel-inj₂ , λ p q → cong (cong inj₂) $ B-set (⊎.cancel-inj₂ p) (⊎.cancel-inj₂ q)) c (inj₁ x) (inj₂ y) = (⊥-elim ∘ ⊎.inj₁≢inj₂ , λ _ → ⊥-elim ∘ ⊎.inj₁≢inj₂) c (inj₂ x) (inj₁ y) = (⊥-elim ∘ ⊎.inj₁≢inj₂ ∘ sym , λ _ → ⊥-elim ∘ ⊎.inj₁≢inj₂ ∘ sym) -- H-level is closed under _⊎_ for other levels greater than or equal -- to 2 too. ⊎-closure′ : ∀ {A B : Type} n → H-level (2 + n) A → H-level (2 + n) B → H-level (2 + n) (A ⊎ B) ⊎-closure′ zero = ⊎-closure-set ⊎-closure′ {A} {B} (suc n) = clos where clos : H-level (3 + n) A → H-level (3 + n) B → H-level (3 + n) (A ⊎ B) clos hA hB {x = inj₁ x} {y = inj₁ y} = respects-surjection (_↔_.surjection ≡↔inj₁≡inj₁) (2 + n) hA clos hA hB {x = inj₂ x} {y = inj₂ y} = respects-surjection (_↔_.surjection ≡↔inj₂≡inj₂) (2 + n) hB clos hA hB {x = inj₁ x} {y = inj₂ y} {x = p} = ⊥-elim (⊎.inj₁≢inj₂ p) clos hA hB {x = inj₂ x} {y = inj₁ y} {x = p} = ⊥-elim (⊎.inj₁≢inj₂ (sym p))
3-mid/opengl/source/platform/osmesa/private/opengl-surface-privvy.adb
charlie5/lace
20
27594
package body openGL.Surface.privvy is -- function to_glx (Self : in Surface.item'Class) return glx.GLXDrawable -- is -- begin -- return Self.glx_Surface; -- end to_glx; procedure dummy is begin null; end; end openGL.Surface.privvy;
agda/MoreLogic/Properties.agda
mchristianl/synthetic-reals
3
6636
{-# OPTIONS --cubical --no-import-sorts #-} module MoreLogic.Properties where -- hProp logic open import Agda.Primitive renaming (_⊔_ to ℓ-max; lsuc to ℓ-suc; lzero to ℓ-zero) private variable ℓ ℓ' ℓ'' : Level open import Cubical.Foundations.Everything renaming (_⁻¹ to _⁻¹ᵖ; assoc to ∙-assoc) open import Cubical.Data.Sigma renaming (_×_ to infixr 4 _×_) open import Cubical.Data.Sum.Base renaming (_⊎_ to infixr 4 _⊎_) open import Function.Base using (_∋_) open import Cubical.Relation.Nullary.Base renaming (¬_ to ¬ᵗ_) open import Cubical.Foundations.Logic renaming (inl to inlᵖ; inr to inrᵖ) open import Cubical.Data.Empty renaming (elim to ⊥-elim) renaming (⊥ to ⊥⊥) -- `⊥` and `elim` open import Cubical.HITs.PropositionalTruncation.Base -- ∣_∣ import Cubical.Data.Empty as Empty open import Cubical.Data.Unit.Base open import Utils -- lifted versions of ⊥ and ⊤ open import MoreLogic.Reasoning open import MoreLogic.Definitions isProp⊤ : isProp [ ⊤ ] isProp⊤ tt tt = refl symₚ : ∀{ℓ} → {A : Type ℓ} {x y : A} → [ x ≡ₚ y ] → [ y ≡ₚ x ] symₚ {x = x} x≡y = substₚ (λ p → p ≡ₚ x) x≡y ∣ refl ∣ ⊔-identityˡ-↑ : (P : hProp ℓ) → ⊥↑ {ℓ} ⊔ P ≡ P ⊔-identityˡ-↑ P = ⇒∶ (⊔-elim ⊥↑ P (λ _ → P) (λ ()) (λ x → x)) ⇐∶ inrᵖ ⊔-identityʳ-↑ : (P : hProp ℓ) → P ⊔ ⊥↑ {ℓ} ≡ P ⊔-identityʳ-↑ P = ⇔toPath (⊔-elim P ⊥↑ (λ _ → P) (λ x → x) λ ()) inlᵖ ⊓-identityˡ-↑ : (P : hProp ℓ) → ⊤↑ {ℓ} ⊓ P ≡ P ⊓-identityˡ-↑ _ = ⇔toPath snd λ x → lift tt , x ⊓-identityʳ-↑ : (P : hProp ℓ) → P ⊓ ⊤↑ {ℓ} ≡ P ⊓-identityʳ-↑ _ = ⇔toPath fst λ x → x , lift tt ¬↑≡¬ : ∀{ℓ} → {P : hProp ℓ} → (¬↑ P) ≡ (¬ P) ¬↑≡¬ = ⇒∶ (λ ¬↑P P → lower (¬↑P P)) ⇐∶ (λ ¬P P → lift ( ¬P P)) ¬¬-introᵗ : (P : Type ℓ) → P → ¬ᵗ ¬ᵗ P ¬¬-introᵗ _ p ¬p = ¬p p ¬¬-elimᵗ : (P : Type ℓ) → ¬ᵗ ¬ᵗ ¬ᵗ P → ¬ᵗ P ¬¬-elimᵗ _ ¬¬¬p p = ¬¬¬p (λ ¬p → ¬p p) ¬¬-intro : (P : hProp ℓ) → [ P ] → [ ¬ ¬ P ] ¬¬-intro _ p ¬p = ¬p p ¬¬-elim : (P : hProp ℓ) → [ ¬ ¬ ¬ P ] → [ ¬ P ] ¬¬-elim _ ¬¬¬p p = ¬¬¬p (λ ¬p → ¬p p) ¬¬-involutive : (P : hProp ℓ) → [ ¬ ¬ ¬ P ⇔ ¬ P ] ¬¬-involutive P .fst = ¬¬-elim P ¬¬-involutive P .snd = ¬¬-intro (¬ P) ⇔toPath' : ∀{ℓ} {P Q : hProp ℓ} → [ P ⇔ Q ] → P ≡ Q ⇔toPath' = uncurry ⇔toPath pathTo⇔ : ∀{ℓ} {P Q : hProp ℓ} → P ≡ Q → [ P ⇔ Q ] pathTo⇔ p≡q = (pathTo⇒ p≡q , pathTo⇐ p≡q) ⊓⇔⊓ : ∀{ℓ ℓ' ℓ'' ℓ'''} {P : hProp ℓ} {Q : hProp ℓ'} {R : hProp ℓ''} {S : hProp ℓ'''} → [ (P ⇔ R) ⊓ (Q ⇔ S) ] → [ (P ⊓ Q) ⇔ (R ⊓ S) ] ⊓⇔⊓ (p⇔r , q⇔s) .fst (p , q) = p⇔r .fst p , q⇔s .fst q ⊓⇔⊓ (p⇔r , q⇔s) .snd (r , s) = p⇔r .snd r , q⇔s .snd s ⊓≡⊓ : ∀{ℓ} {P Q R S : hProp ℓ} → P ≡ R → Q ≡ S → (P ⊓ Q) ≡ (R ⊓ S) ⊓≡⊓ p≡r q≡s i = p≡r i ⊓ q≡s i [path]To⇒ : (P Q : hProp ℓ) → [ P ] ≡ [ Q ] → [ P ⇒ Q ] [path]To⇒ P Q [P]≡[Q] p = transport [P]≡[Q] p [path]To⇐ : (P Q : hProp ℓ) → [ P ] ≡ [ Q ] → [ Q ⇒ P ] [path]To⇐ P Q [P]≡[Q] q = transport (sym [P]≡[Q]) q ¬¬-involutiveᵗ : (A : Type ℓ) → (¬ᵗ ¬ᵗ ¬ᵗ A) ≡ (¬ᵗ A) abstract ¬¬-involutiveᵗ A = isoToPath λ where .Iso.fun ¬¬¬a a → ¬¬¬a (λ ¬a → ¬a a) .Iso.inv ¬a ¬¬a → ¬¬a ¬a .Iso.rightInv ¬a → refl -- the following proof is `... ≡ ¬¬¬a` and uses funext to reduce this to a proof `∀ x → ... x ≡ ¬¬¬a x` -- but this does not matter, since we have `¬¬¬a x` which is `⊥` and then we can use ⊥-elim to obtain whatever is necessary -- `⊥-elim` needed a detailed hint what to produce and this might not be the most elegant way to proof this .Iso.leftInv ¬¬¬a → funExt {A = (¬ᵗ ¬ᵗ A)} {B = λ _ i → ⊥⊥} {f = (λ ¬¬a → ¬¬a (λ a → ¬¬¬a (λ ¬a → ¬a a)))} {g = ¬¬¬a} (λ x → ⊥-elim {A = λ _ → (x (λ a → ¬¬¬a (λ ¬a → ¬a a)) ≡ ¬¬¬a x)} (¬¬¬a x)) -- taken from https://ncatlab.org/nlab/show/excluded+middle#DoubleNegatedPEM -- Double-negated PEM weak-LEM : ∀(P : hProp ℓ) → [ ¬ ¬ (P ⊔ ¬ P) ] weak-LEM _ ¬[p⊔¬p] = ¬[p⊔¬p] (inrᵖ (λ p → ¬[p⊔¬p] (inlᵖ p))) weak-LEMᵗ : ∀(P : Type ℓ) → ¬ᵗ ¬ᵗ (P ⊎ (¬ᵗ P)) weak-LEMᵗ _ ¬[p⊔¬p] = ¬[p⊔¬p] (inr (λ p → ¬[p⊔¬p] (inl p))) ⊤-introᵖ : {P : hProp ℓ} → [ P ] → P ≡ ⊤↑ ⊤-introᵖ {ℓ = ℓ} {P = P} p = let P⇔⊤↑ : [ P ⇔ ⊤↑ {ℓ} ] P⇔⊤↑ = (λ _ → lift tt) , (λ _ → p) in ⇔toPath (fst P⇔⊤↑) (snd P⇔⊤↑) ⊤-elimᵖ : {P : hProp ℓ} → P ≡ ⊤↑ → [ P ] ⊤-elimᵖ {ℓ = ℓ} {P = P} p≡⊤ = ( [ ⊤↑ {ℓ} ] ⇒⟨ transport ( λ i → [ p≡⊤ (~ i) ]) ⟩ [ P ] ◼) (lift tt) contraposition : (P : hProp ℓ) (Q : hProp ℓ') → [ P ⇒ Q ] → [ ¬ Q ⇒ ¬ P ] contraposition P Q f ¬q p = ⊥-elim (¬q (f p)) instance≡ : ∀{ℓ ℓ'} {A : Type ℓ} {B : A → Type ℓ'} → ({{x : A}} → B x) ≡ ((x : A) → B x) instance≡ = isoToPath (iso (λ f a → f {{a}}) (λ f {{a}} → f a) (λ f i → f) (λ f i → f)) implicit≡ : ∀{ℓ ℓ'} {A : Type ℓ} {B : A → Type ℓ'} → ({x : A} → B x) ≡ ((x : A) → B x) implicit≡ = isoToPath (iso (λ f a → f {a}) (λ f {a} → f a) (λ f i → f) (λ f i → f)) instanceFunExt : {A : Type ℓ} {B : A → I → Type ℓ'} {f : {{x : A}} → B x i0} {g : {{x : A}} → B x i1} → ({{x : A}} → PathP (B x) (f {{x}}) (g {{x}})) → PathP (λ i → {{x : A}} → B x i) f g instanceFunExt p i {{x}} = p {{x}} i funExt-⊥ : {A : Type ℓ} (f g : A → Empty.⊥) → f ≡ g funExt-⊥ f g = funExt (λ x → ⊥-elim {A = λ _ → f x ≡ g x} (f x)) -- ⊥-elim needed a hint here -- uncurry-preserves-≡ -- : {A : Type ℓ} {B : A → Type ℓ'} {C : (a : A) → B a → Type ℓ''} -- → (f : (a : A) → (b : B a) → C a b) -- ------------------------------------------------------------- -- → ∀ a b → f a b ≡ (uncurry f) (a , b) -- uncurry-preserves-≡ f a b = refl Σ-preserves-≡ : {A : Type ℓ} {B : A → Type ℓ'} {C : (a : A) → (b : B a) → Type ℓ''} {f g : ((a , b) : Σ A B) → C a b} → ((a : A) (b : B a) → (f (a , b)) ≡ (g (a , b))) → ((ab : Σ A B) → (f ab ) ≡ (g (ab) )) Σ-preserves-≡ p (a , b) = p a b Σ-reflects-≡ : {A : Type ℓ} {B : A → Type ℓ'} {a b : Σ A B} → a ≡ b → Σ[ p ∈ (fst a ≡ fst b) ] transport (λ i → B (p i)) (snd a) ≡ snd b -- Σ[ q ∈ (fst a ≡ fst b) ] (PathP (λ i → B (q i)) (snd a) (snd b)) Σ-reflects-≡ a≡b with PathΣ→ΣPathTransport _ _ a≡b ... | fst≡fst , snd≡snd = fst≡fst , snd≡snd uncurry-reflects-≡ : {A : Type ℓ} {B : A → Type ℓ'} {C : (a : A) → B a → Type ℓ''} → (f g : (a : A) → (b : B a) → C a b) ------------------------------------------------------------- → (uncurry f ≡ uncurry g) → f ≡ g uncurry-reflects-≡ f g p = funExt (λ x → f x ≡⟨ refl ⟩ (λ y → (uncurry f) (x , y)) ≡⟨ ( λ i → λ y → (p i) (x , y)) ⟩ (λ y → (uncurry g) (x , y)) ≡⟨ refl ⟩ g x ∎) -- "constant" version of funExt funExt₂ᶜ : {A : Type ℓ} {B : A → Type ℓ'} {C : (a : A) → (b : B a) → Type ℓ''} {f g : (a : A) → (b : B a) → C a b} → ((a : A) → (b : B a) → (f a b) ≡ (g a b)) → f ≡ g funExt₂ᶜ {A = A} {B = B} {C = C} {f = f} {g = g} = ( ((a : A) (b : B a) → ( f a b) ≡ ( g a b) ) ⇒⟨ (λ z → z) ⟩ -- holds definitionally ((a : A) (b : B a) → ((uncurry f) (a , b)) ≡ ((uncurry g) (a , b))) ⇒⟨ Σ-preserves-≡ ⟩ ((ab : Σ A B) → ((uncurry f) ab ) ≡ ((uncurry g) ( ab ))) ⇒⟨ funExt ⟩ (uncurry f) ≡ (uncurry g) ⇒⟨ uncurry-reflects-≡ f g ⟩ f ≡ g ◼) funExt-⊥₂ : {A B : Type ℓ} (f g : A → B → Empty.⊥) → f ≡ g funExt-⊥₂ f g = funExt₂ᶜ λ a b → ⊥-elim {A = λ _ → f a b ≡ g a b} (g a b) -- weak deMorgan laws: only these three hold without further assumptions deMorgan₂ : (P : hProp ℓ) (Q : hProp ℓ') → [ ¬ (P ⊔ Q) ] → [ ¬ P ⊓ ¬ Q ] abstract deMorgan₂ P Q ¬[p⊔q] = (λ p → ⊥-elim (¬[p⊔q] (inlᵖ p))) , λ q → ⊥-elim (¬[p⊔q] (inrᵖ q)) deMorgan₂-back : (P : hProp ℓ) (Q : hProp ℓ') → [ ¬ P ⊓ ¬ Q ] → [ ¬ (P ⊔ Q) ] abstract deMorgan₂-back P Q (¬p , ¬q) p⊔q = ⊔-elim P Q (λ p⊔q → ⊥) ¬p ¬q p⊔q deMorgan₁-back : (P : hProp ℓ) (Q : hProp ℓ') → [ ¬ P ⊔ ¬ Q ] → [ ¬ (P ⊓ Q) ] abstract deMorgan₁-back {ℓ = ℓ} P Q [¬p⊔¬q] (p , q) = ⊔-elim (¬ P) (¬ Q) (λ [¬p⊔¬q] → ⊥) (λ ¬p → ¬p p) (λ ¬q → ¬q q) [¬p⊔¬q] ¬-⊓-distrib : (P : hProp ℓ) (Q : hProp ℓ') → [ ¬ (P ⊓ Q) ] → [ (P ⇒ ¬ Q) ⊓ (Q ⇒ ¬ P) ] ¬-⊓-distrib P Q ¬p⊓q = (λ p q → ¬p⊓q (p , q)) , (λ q p → ¬p⊓q (p , q)) implication : (P : hProp ℓ) (Q : hProp ℓ') → [ ¬ (P ⊓ Q) ] → [ P ⇒ ¬ Q ] implication {ℓ = ℓ} P Q ¬[p⊓q] p q = ⊥-elim (¬[p⊓q] (p , q)) uncurryₚ : ∀{ℓ ℓ' ℓ''} (P : hProp ℓ) (Q : hProp ℓ')(R : hProp ℓ'') → (f : [ P ] → [ Q ] → [ R ]) → [ P ⊓ Q ] → [ R ] uncurryₚ P Q R f = uncurry f ⊓¬¬⇒¬¬⊓ : ∀{ℓ ℓ'} (P : hProp ℓ) (Q : hProp ℓ') → [ ¬ ¬ P ] → [ ¬ ¬ Q ] → [ ¬ ¬ (P ⊓ Q) ] ⊓¬¬⇒¬¬⊓ P Q ¬¬p ¬¬q = contraposition (¬ (P ⊓ Q)) (P ⇒ ¬ Q) (implication P Q) λ p⇒¬q → ¬¬p (contraposition P (¬ Q) p⇒¬q ¬¬q) -- Q and P are disjoint if P ⇒ ¬ Q or equivalently Q ⇒ ¬ P abstract -- we have that (P ⇒ ¬ Q) ≡ (Q ⇒ ¬ P) -- normalizes to (P ⇒ Q ⇒ ⊥) ≡ (Q ⇒ P ⇒ ⊥) -- which is just flipping of the arguments [P⇒¬Q]≡[Q⇒¬P] : ∀{ℓ ℓ'} (P : hProp ℓ) (Q : hProp ℓ') → (P ⇒ ¬ Q) ≡ (Q ⇒ ¬ P) [P⇒¬Q]≡[Q⇒¬P] P Q = ⇒∶ flip ⇐∶ flip -- ⇒∶ (λ p⇒¬q q p → p⇒¬q p q) -- ⇐∶ (λ q⇒¬p p q → q⇒¬p q p) [P⇒¬Q]⇒[Q⇒¬P] : ∀{ℓ ℓ'} (P : hProp ℓ) (Q : hProp ℓ') → [ (P ⇒ ¬ Q) ] → [ (Q ⇒ ¬ P) ] [P⇒¬Q]⇒[Q⇒¬P] P Q = flip -- pathTo⇒ ([P⇒¬Q]≡[Q⇒¬P] P Q) [P⇒¬Q]≡¬[P⊓Q] : ∀{ℓ ℓ'} (P : hProp ℓ) (Q : hProp ℓ') → (P ⇒ ¬ Q) ≡ ¬ (P ⊓ Q) [P⇒¬Q]≡¬[P⊓Q] P Q = ⇒∶ uncurry ⇐∶ curry -- ⇒∶ (λ{ p⇒¬q (p , q) → p⇒¬q p q }) -- ⇐∶ (λ ¬[p⊓q] p q → ¬[p⊓q] (p , q) ) -- [¬P⇒Q]⇒[¬Q⇒¬¬P] -- [¬P⇒¬¬Q]≡[¬Q⇒¬¬P] -- ≡¬[¬P⊓¬Q] -- ≡¬¬[P⊔Q] -- [¬P≡Q]⇒¬[P⊓Q]≡¬[P⊓¬P] ¬[P⊓¬P] : ∀{ℓ} (P : hProp ℓ) → [ ¬ (P ⊓ ¬ P) ] ¬[P⊓¬P] P (p , ¬p) = ¬p p -- NOTE: I think that we do not have ¬ P ≡ ¬ Q → P ≡ Q -- since this might be equivalent to some LEM ? -- ¬-reflects-≡ : ∀{ℓ} (P Q : hProp ℓ) → ¬ P ≡ ¬ Q → P ≡ Q -- ¬-reflects-≡ P Q ¬p≡¬q with Σ-reflects-≡ ¬p≡¬q -- ... | fst≡fst , snd≡snd = ΣPathP ({! !} , {! !}) -- -- -- (∀ x → P x ≡ P y) → x ≡ y -- -- postulate dne : ∀{ℓ} (P : hProp ℓ) → ¬ ¬ P ≡ P -- -- ¬-isEquiv : ∀ ℓ → isEquiv (¬_ {ℓ = ℓ}) -- ¬-isEquiv ℓ = λ where -- .equiv-proof P → ((¬ P) , dne P) , λ{ (Q , ¬Q≡P) → -- let γ = {! isPropIsProp (isProp[] Q) (isProp[] Q) !} -- in {! !} } -- fst (fst (equiv-proof (¬-isEquiv ℓ) P)) = ¬ P -- snd (fst (equiv-proof (¬-isEquiv ℓ) P)) = dne P -- snd (equiv-proof (¬-isEquiv ℓ) P) (Q , ¬Q≡P) = {! !} -- ¬[P⊓¬P]≡¬[P⊓Q]⇒[¬P≡Q] : ∀{ℓ } (P Q : hProp ℓ) → [ ¬ (P ⊓ ¬ P) ] ≡ [ ¬ (P ⊓ Q) ] → [ P ] ≡ [ ¬ Q ] -- ¬[P⊓¬P]≡¬[P⊓Q]⇒[¬P≡Q] P Q p = {! [P⇒¬Q]≡¬[P⊓Q] P Q !} -- -- ¬[P⊓¬P]≡¬[P⊓Q]≡[P⇒¬Q]≡[P⇒¬¬P] -- foo : ∀{ℓ ℓ'} (P : hProp ℓ) (Q : hProp ℓ') → [ (P ⇒ ¬ Q) ] → [ (¬ Q ⇒ P) ] → P ≡ ¬ Q -- bar : ∀{ℓ} (P Q : hProp ℓ) → [ ¬ (P ⊓ Q) ] → P ≡ ¬ Q -- -- ¬-⊓-distrib P Q ¬p⊓q -- bar P Q ¬p⊓q = let r1 : [ (P ⇒ ¬ Q) ⊓ (Q ⇒ ¬ P) ] -- r1 = -- r2 : [ (Q ⇒ ¬ P) ⊓ (P ⇒ ¬ Q) ] -- r2 = -- in {! ¬-⊓-distrib Q P (transport (λ i → [ ¬ ⊓-comm P Q i ]) ¬p⊓q) !} -- more logic ⊓-⊔-distribʳ : (P : hProp ℓ) (Q : hProp ℓ')(R : hProp ℓ'') → (Q ⊔ R) ⊓ P ≡ (Q ⊓ P) ⊔ (R ⊓ P) ⊓-⊔-distribʳ P Q R = ( (Q ⊔ R) ⊓ P ≡⟨ ⊓-comm _ _ ⟩ P ⊓ (Q ⊔ R) ≡⟨ ⊓-⊔-distribˡ P Q R ⟩ (P ⊓ Q) ⊔ (P ⊓ R) ≡⟨ ( λ i → ⊓-comm P Q i ⊔ ⊓-comm P R i) ⟩ (Q ⊓ P) ⊔ (R ⊓ P) ∎) -- NOTE: this is in the standard library -- ⊓-∀-distrib : (P : A → hProp ℓ) (Q : A → hProp ℓ') -- → (∀[ a ∶ A ] P a) ⊓ (∀[ a ∶ A ] Q a) ≡ (∀[ a ∶ A ] (P a ⊓ Q a)) -- ⊓-∀-distrib P Q = -- ⇒∶ (λ {(p , q) a → p a , q a}) -- ⇐∶ λ pq → (fst ∘ pq ) , (snd ∘ pq) -- well, we do not have `∀-⊔-distrib` -- ∀-⊔-distrib : ∀{ℓ ℓ' ℓ''} {A : Type ℓ} → (P : A → hProp ℓ') → (Q : A → hProp ℓ'') -- → ((∀[ x ∶ A ] P x) ⊔ (∀[ x ∶ A ] Q x)) ≡ (∀[ x ∶ A ] (P x ⊔ Q x)) -- ∀-⊔-distrib {A = A} P Q = -- ⇒∶ (λ [∀xPx]⊔[∀xQx] x → ⊔-elim (∀[ x ] P x) (∀[ x ] Q x) (λ _ → P x ⊔ Q x) (λ ∀xPx → inlᵖ (∀xPx x)) (λ ∀xQx → inrᵖ (∀xQx x)) [∀xPx]⊔[∀xQx]) -- ⇐∶ λ ∀x[Px⊔Qx] → {! !} -- ∀-⊔-distribʳ : ∀{ℓ ℓ' ℓ''} {A : Type ℓ} → (P : hProp ℓ') → (Q : A → hProp ℓ'') -- → (P ⊔ (∀[ x ∶ A ] Q x)) ≡ (∀[ x ∶ A ] (P ⊔ Q x)) -- ∀-⊔-distribʳ {A = A} P Q = -- ⇒∶ (λ [P]⊔[∀xQx] x → ⊔-elim P (∀[ x ] Q x) (λ _ → P ⊔ Q x) (λ p → inlᵖ p) (λ ∀xQx → inrᵖ (∀xQx x)) [P]⊔[∀xQx]) -- ⇐∶ λ ∀x[P⊔Qx] → {! !} -- ∀-⊎-distribʳ : ∀{ℓ ℓ' ℓ''} (a : Type ℓ) {B : Type ℓ'} (f : B → Type ℓ'') -- → (a → ∀ b → ¬ᵗ f b) -- a implies that fb is wrong -- → (∀ b → f b → ¬ᵗ a) -- b implies that a is wrong -- → (∀ b → a ⊎ f b) -- for all b, either a holds or fb holds -- → a ⊎ (∀ b → f b) -- either a holds or fb holds forall b -- ∀-⊎-distribʳ a f a→¬fb fb→¬a g = {! !} -- hProp-union and Σ-Type-union are equivalent when the two disjuncts are disjoint such that one disproves the other and vice versa ⊎-Level : ∀{A : Type ℓ}{B : Type ℓ'} → A ⊎ B → Level ⊎-Level {ℓ = ℓ } (inl x) = ℓ ⊎-Level {ℓ' = ℓ'} (inr x) = ℓ' ⊎-Type : ∀{A : Type ℓ}{B : Type ℓ'}(x : A ⊎ B) → Type (⊎-Level x) ⊎-Type {A = A} (inl x) = A ⊎-Type {B = B} (inr x) = B ⊎-pred : ∀{A : Type ℓ}{B : Type ℓ'}(x : A ⊎ B) → ⊎-Type x ⊎-pred (inl x) = x ⊎-pred (inr x) = x ⊎-predˡ : ∀{A : Type ℓ}{B : Type ℓ'}(z : A ⊎ B) → {y : A} → z ≡ inl y → A ⊎-predˡ (inl x) {y} p = x ⊎-predˡ (inr x) {y} p = y inl-reflects-≡ : ∀{A : Type ℓ}{B : Type ℓ'} {x y : A} → ((A ⊎ B) ∋ inl x) ≡ inl y → x ≡ y inl-reflects-≡ {A = A} {B = B} {x = x} {y = y} p = cong γ p where γ : (z : A ⊎ B) → A γ (inl y) = y γ (inr y) = x inr-reflects-≡ : ∀{A : Type ℓ}{B : Type ℓ'} {x y : B} → ((A ⊎ B) ∋ inr x) ≡ inr y → x ≡ y inr-reflects-≡ {A = A} {B = B} {x = x} {y = y} p = cong γ p where γ : (z : A ⊎ B) → B γ (inl y) = x γ (inr y) = y isProp⊎ : ∀{ℓ ℓ'} {A : Type ℓ} {B : Type ℓ'} → isProp A → isProp B → (A → ¬ᵗ B) ⊎ (B → ¬ᵗ A) → isProp (A ⊎ B) isProp⊎ pA pB X⇒¬Y (inl x) (inl y) = cong inl (pA x y) isProp⊎ pA pB X⇒¬Y (inr x) (inr y) = cong inr (pB x y) isProp⊎ pA pB (inl A⇒¬B) (inl x) (inr y) = ⊥-elim (A⇒¬B x y) isProp⊎ pA pB (inr B⇒¬A) (inl x) (inr y) = ⊥-elim (B⇒¬A y x) isProp⊎ pA pB (inl A⇒¬B) (inr x) (inl y) = ⊥-elim (A⇒¬B y x) isProp⊎ pA pB (inr B⇒¬A) (inr x) (inl y) = ⊥-elim (B⇒¬A x y) module _ {ℓ ℓ'} (P : hProp ℓ) (Q : hProp ℓ') (X⇒¬Y : [ P ⇒ ¬ Q ] ⊎ [ Q ⇒ ¬ P ]) where ⊎-isProp : isProp ([ P ] ⊎ [ Q ]) ⊎-isProp = isProp⊎ (isProp[] P) (isProp[] Q) X⇒¬Y P⊎Qᵖ : hProp (ℓ-max ℓ ℓ') P⊎Qᵖ = ([ P ] ⊎ [ Q ]) , ⊎-isProp -- ⊎⇒⊔' : [ P⊎Qᵖ ] → [ P ⊔ Q ] -- ⊎⇒⊔' x = ∣ x ∣ ⊔⇒⊎ : [ P ⊔ Q ] → [ P⊎Qᵖ ] abstract ⊔⇒⊎ x = ⊔-elim P Q (λ x → ([ P ] ⊎ [ Q ]) , ⊎-isProp) (λ p → inl p) (λ q → inr q) x ⊔⊎-equiv : [ P⊎Qᵖ ⇔ P ⊔ Q ] ⊔⊎-equiv = ⊎⇒⊔ P Q , ⊔⇒⊎ ⊔⊎-≡ : P⊎Qᵖ ≡ P ⊔ Q abstract ⊔⊎-≡ with ⊔⊎-equiv ... | p , q = ⇔toPath p q
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gstsystemclock_h.ads
persan/A-gst
1
17548
<filename>src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gstsystemclock_h.ads pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h; -- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h; with System; with glib; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsystemclock_h is -- unsupported macro: GST_TYPE_SYSTEM_CLOCK (gst_system_clock_get_type ()) -- arg-macro: function GST_SYSTEM_CLOCK (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SYSTEM_CLOCK, GstSystemClock); -- arg-macro: function GST_SYSTEM_CLOCK_CAST (obj) -- return (GstSystemClock *)(obj); -- arg-macro: function GST_IS_SYSTEM_CLOCK (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SYSTEM_CLOCK); -- arg-macro: function GST_SYSTEM_CLOCK_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_SYSTEM_CLOCK, GstSystemClockClass); -- arg-macro: function GST_IS_SYSTEM_CLOCK_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_SYSTEM_CLOCK); -- arg-macro: function GST_SYSTEM_CLOCK_GET_CLASS (obj) -- return G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_SYSTEM_CLOCK, GstSystemClockClass); -- GStreamer -- * Copyright (C) 1999,2000 <NAME> <<EMAIL>> -- * 2000 <NAME> <<EMAIL>> -- * 2005 <NAME> <<EMAIL>> -- * -- * gstsystemclock.h: A clock implementation based on system time -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library General Public -- * License along with this library; if not, write to the -- * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- * Boston, MA 02111-1307, USA. -- type GstSystemClock; type u_GstSystemClock_u_gst_reserved_array is array (0 .. 2) of System.Address; --subtype GstSystemClock is u_GstSystemClock; -- gst/gstsystemclock.h:41 type GstSystemClockClass; type u_GstSystemClockClass_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstSystemClockClass is u_GstSystemClockClass; -- gst/gstsystemclock.h:42 -- skipped empty struct u_GstSystemClockPrivate -- skipped empty struct GstSystemClockPrivate --* -- * GstClockType: -- * @GST_CLOCK_TYPE_REALTIME: time since Epoch -- * @GST_CLOCK_TYPE_MONOTONIC: monotonic time since some unspecified starting -- * point -- * -- * The different kind of clocks. -- type GstClockType is (GST_CLOCK_TYPE_REALTIME, GST_CLOCK_TYPE_MONOTONIC); pragma Convention (C, GstClockType); -- gst/gstsystemclock.h:56 --* -- * GstSystemClock: -- * -- * The default implementation of a #GstClock that uses the system time. -- type GstSystemClock is record clock : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClock; -- gst/gstsystemclock.h:64 thread : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread; -- gst/gstsystemclock.h:67 stopping : aliased GLIB.gboolean; -- gst/gstsystemclock.h:68 priv : System.Address; -- gst/gstsystemclock.h:71 u_gst_reserved : u_GstSystemClock_u_gst_reserved_array; -- gst/gstsystemclock.h:73 end record; pragma Convention (C_Pass_By_Copy, GstSystemClock); -- gst/gstsystemclock.h:63 --< private > -- thread for async notify -- ABI added type GstSystemClockClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockClass; -- gst/gstsystemclock.h:77 u_gst_reserved : u_GstSystemClockClass_u_gst_reserved_array; -- gst/gstsystemclock.h:80 end record; pragma Convention (C_Pass_By_Copy, GstSystemClockClass); -- gst/gstsystemclock.h:76 --< private > function gst_system_clock_get_type return GLIB.GType; -- gst/gstsystemclock.h:83 pragma Import (C, gst_system_clock_get_type, "gst_system_clock_get_type"); function gst_system_clock_obtain return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClock; -- gst/gstsystemclock.h:85 pragma Import (C, gst_system_clock_obtain, "gst_system_clock_obtain"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsystemclock_h;
dino/lcs/123p/BD.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
4075
<filename>dino/lcs/123p/BD.asm copyright zengfr site:http://github.com/zengfr/romhack 01924E move.b ($bd,A6), D2 019252 move.b ($3e,PC,D2.w), D2 [123p+ BD] 0192C0 move.b D0, ($bd,A6) 0192C4 bsr $192a2 [123p+ BD] copyright zengfr site:http://github.com/zengfr/romhack
Cubical/Categories/Category.agda
dan-iel-lee/cubical
0
7391
{- Definition of various kinds of categories. This library follows the UniMath terminology, that is: Concept Ob C Hom C Univalence Precategory Type Type No Category Type Set No Univalent Category Type Set Yes This file also contains - pathToIso : Turns a path between two objects into an isomorphism between them - opposite categories -} {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Categories.Category where open import Cubical.Categories.Category.Base public open import Cubical.Categories.Category.Properties public
llvm-gcc-4.2-2.9/gcc/ada/a-nselfu.ads
vidkidz/crossbridge
1
27711
<filename>llvm-gcc-4.2-2.9/gcc/ada/a-nselfu.ads ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- ADA.NUMERICS.SHORT_ELEMENTARY_FUNCTIONS -- -- -- -- S p e c -- -- -- -- This specification is adapted from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ with Ada.Numerics.Generic_Elementary_Functions; package Ada.Numerics.Short_Elementary_Functions is new Ada.Numerics.Generic_Elementary_Functions (Short_Float); pragma Pure (Short_Elementary_Functions);
programs/oeis/029/A029028.asm
neoneye/loda
22
83126
; A029028: Expansion of 1/((1-x)(1-x^2)(1-x^9)(1-x^11)). ; 1,1,2,2,3,3,4,4,5,6,7,9,10,12,13,15,16,18,20,22,25,27,31,33,37,39,43,46,50,54,58,63,67,73,77,83,88,94,100,106,113,119,127,133,142,149,158,166,175,184,193,203,212,223 lpb $0 mov $2,$0 sub $0,2 seq $2,25792 ; Expansion of 1/((1-x)(1-x^9)(1-x^11)). add $1,$2 add $1,$2 lpe div $1,2 add $1,1 mov $0,$1
solutions/32 - Creative Writhing/size-6_speed-283.asm
dpflug/7billionhumans
0
5102
-- 7 Billion Humans (2144) -- -- 32: Creative Writhing -- -- Author: dpflug -- Size: 6 -- Speed: 283 a: step nw,w,sw,n,s,ne,e,se if c < 99: pickup c write 99 drop endif jump a
oeis/050/A050403.asm
neoneye/loda-programs
11
81176
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A050403: Partial sums of A051877. ; Submitted by <NAME>(s1.) ; 1,13,70,252,714,1722,3696,7260,13299,23023,38038,60424,92820,138516,201552,286824,400197,548625,740278,984676,1292830,1677390,2152800,2735460,3443895,4298931,5323878,6544720,7990312,9692584,11686752,14011536,16709385,19826709,23414118,27526668,32224114,37571170,43637776,50499372,58237179,66938487,76696950,87612888,99793596,113353660,128415280,145108600,163572045,183952665,206406486,231098868,258204870,287909622,320408704,355908532,394626751,436792635,482647494,532445088,586452048,644948304 mov $2,$0 mul $0,7 add $0,7 add $2,5 mov $1,$2 bin $1,5 mul $0,$1 sub $0,$1 div $0,6
boot/stage1/disk_read.asm
arushsharma24/KSOS
87
4956
[bits 16] BootDiskNumber: db 0 disk_read_16: ;bx is an argument, es is argument ,cl is also an argument, al is also an argument pusha mov dl,[BootDiskNumber] mov ah,0x02 ;interrupt function int 0x13 popa ret
examples/textio.adb
ytomino/drake
33
16202
with Ada.Directories.Temporary; with Ada.Streams; with Ada.Text_IO.Text_Streams; with Ada.Wide_Text_IO; with Ada.Wide_Wide_Text_IO; with System.Form_Parameters; with System.System_Allocators; procedure textio is use type Ada.Streams.Stream_Element_Offset; package System_Allocators renames System.System_Allocators; subtype C is Character; subtype WC is Wide_Character; subtype WWC is Wide_Wide_Character; AIUEO : constant String := ( C'Val (16#e3#), C'Val (16#81#), C'Val (16#82#), C'Val (16#e3#), C'Val (16#81#), C'Val (16#84#), C'Val (16#e3#), C'Val (16#81#), C'Val (16#86#), C'Val (16#e3#), C'Val (16#81#), C'Val (16#88#), C'Val (16#e3#), C'Val (16#81#), C'Val (16#8a#)); Wide_AIUEO : constant Wide_String := ( WC'Val (16#3042#), WC'Val (16#3044#), WC'Val (16#3046#), WC'Val (16#3048#), WC'Val (16#304a#)); Wide_Wide_AIUEO : constant Wide_Wide_String := ( WWC'Val (16#3042#), WWC'Val (16#3044#), WWC'Val (16#3046#), WWC'Val (16#3048#), WWC'Val (16#304a#)); begin Ada.Text_IO.Put_Line ("Hello, Drake runtime!"); Ada.Wide_Text_IO.Put_Line ("Hello, Drake runtime!"); Ada.Wide_Wide_Text_IO.Put_Line ("Hello, Drake runtime!"); Ada.Text_IO.Put_Line (AIUEO); Ada.Wide_Text_IO.Put_Line (Wide_AIUEO); Ada.Wide_Wide_Text_IO.Put_Line (Wide_Wide_AIUEO); -- check inheritance Ada.Wide_Text_IO.Set_Col ( Ada.Wide_Text_IO.Current_Output.all, Ada.Wide_Text_IO.Col (Ada.Wide_Text_IO.Current_Output.all)); Ada.Wide_Wide_Text_IO.Set_Col ( Ada.Wide_Wide_Text_IO.Current_Output.all, Ada.Wide_Wide_Text_IO.Col (Ada.Wide_Wide_Text_IO.Current_Output.all)); -- check sharing mode declare Test_File_Name : constant String := Ada.Directories.Temporary.Create_Temporary_File; File_1, File_2 : Ada.Text_IO.File_Type; begin Ada.Debug.Put (Test_File_Name); -- prepare the file beforehand because Create always acquires write-lock Ada.Text_IO.Create (File_1, Ada.Text_IO.Out_File, Test_File_Name); Ada.Text_IO.Close (File_1); -- double open Ada.Text_IO.Open (File_1, Ada.Text_IO.Out_File, Test_File_Name, "shared=read"); -- shared lock (default is exclusive lock) Ada.Text_IO.Open (File_2, Ada.Text_IO.In_File, Test_File_Name, "shared=yes"); -- dead lock when File_1 acquired exclusive lock Ada.Text_IO.Close (File_2); Ada.Text_IO.Delete (File_1); end; -- check Append_File declare Page_Size : constant Ada.Streams.Stream_Element_Positive_Count := Ada.Streams.Stream_Element_Offset (System_Allocators.Page_Size); Test_File_Name : constant String := Ada.Directories.Temporary.Create_Temporary_File; File : Ada.Text_IO.File_Type; begin Ada.Debug.Put (Test_File_Name); Ada.Text_IO.Create (File, Ada.Text_IO.Out_File, Test_File_Name); Ada.Text_IO.Put (File, "ABC"); Ada.Text_IO.Close (File); Ada.Text_IO.Open (File, Ada.Text_IO.Append_File, Test_File_Name); pragma Assert (Ada.Streams.Index (Ada.Streams.Seekable_Stream_Type'Class (Ada.Text_IO.Text_Streams.Stream (File).all)) = 4); Ada.Text_IO.Put (File, (1 .. Natural (Page_Size) => ' ')); Ada.Text_IO.Close (File); Ada.Text_IO.Open (File, Ada.Text_IO.Append_File, Test_File_Name); pragma Assert (Ada.Streams.Index (Ada.Streams.Seekable_Stream_Type'Class (Ada.Text_IO.Text_Streams.Stream (File).all)) = 4 + Page_Size); Ada.Text_IO.Put_Line (File, "DEF"); Ada.Text_IO.Close (File); Ada.Text_IO.Open (File, Ada.Text_IO.In_File, Test_File_Name); declare Line : constant String := Ada.Text_IO.Get_Line (File); begin pragma Assert (Line = "ABC" & (1 .. Natural (Page_Size) => ' ') & "DEF"); null; end; Ada.Text_IO.Delete (File); end; -- test form parameter declare Keyword_First : Positive; Keyword_Last : Natural; Value_First : Positive; Value_Last : Natural; Last : Natural; Form_1 : constant String := "abc=def"; Form_2 : constant String := "abc=def,ghi"; Form_3 : constant String := "ghi"; Form_4 : constant String := "ghi,abc=def"; begin System.Form_Parameters.Get (Form_1, Keyword_First, Keyword_Last, Value_First, Value_Last, Last); pragma Assert (Form_1 (Keyword_First .. Keyword_Last) = "abc"); pragma Assert (Form_1 (Value_First .. Value_Last) = "def"); pragma Assert (Last = Form_1'Last); System.Form_Parameters.Get (Form_2, Keyword_First, Keyword_Last, Value_First, Value_Last, Last); pragma Assert (Form_2 (Keyword_First .. Keyword_Last) = "abc"); pragma Assert (Form_2 (Value_First .. Value_Last) = "def"); pragma Assert (Form_2 (Last) = ','); System.Form_Parameters.Get (Form_2 (Last + 1 .. Form_2'Last), Keyword_First, Keyword_Last, Value_First, Value_Last, Last); pragma Assert (Form_2 (Keyword_First .. Keyword_Last) = "ghi"); pragma Assert (Form_2 (Value_First .. Value_Last) = ""); pragma Assert (Last = Form_2'Last); System.Form_Parameters.Get (Form_3, Keyword_First, Keyword_Last, Value_First, Value_Last, Last); pragma Assert (Form_3 (Keyword_First .. Keyword_Last) = "ghi"); pragma Assert (Form_3 (Value_First .. Value_Last) = ""); pragma Assert (Last = Form_3'Last); System.Form_Parameters.Get (Form_4, Keyword_First, Keyword_Last, Value_First, Value_Last, Last); pragma Assert (Form_4 (Keyword_First .. Keyword_Last) = "ghi"); pragma Assert (Form_4 (Value_First .. Value_Last) = ""); pragma Assert (Form_4 (Last) = ','); System.Form_Parameters.Get (Form_4 (Last + 1 .. Form_4'Last), Keyword_First, Keyword_Last, Value_First, Value_Last, Last); pragma Assert (Form_4 (Keyword_First .. Keyword_Last) = "abc"); pragma Assert (Form_4 (Value_First .. Value_Last) = "def"); pragma Assert (Last = Form_4'Last); end; pragma Debug (Ada.Debug.Put ("OK")); end textio;
firmware/kernal/uart_commands.asm
QuorumComp/hc800
2
5880
INCLUDE "lowlevel/uart.i" INCLUDE "stdlib/string.i" INCLUDE "uart_commands.i" IDENT_NONCE EQU $1234 ; -- Print value as hexadecimal ; -- ; -- Inputs: ; -- ft - value to print SECTION "ComPrintHexWord",CODE ComPrintHexWord: push hl exg f,t jal ComPrintHexByte exg f,t jal ComPrintHexByte pop hl j (hl) ; -- Print memory as hexadecimal ; -- ; -- Inputs: ; -- bc - pointer to data segment ; -- de - number of bytes to print SECTION "ComDumpMemory",CODE ComDumpMemory: pusha ld ft,bc jal ComPrintHexWord ld t,':' jal ComPrintChar sub de,1 add d,1 add e,1 .loop ld t,(bc) jal ComPrintHexByte ld t,' ' jal ComPrintChar add bc,1 dj e,.loop dj d,.loop ld t,10 jal ComPrintChar popa j (hl) ; -- Print value as hexadecimal ; -- ; -- Inputs: ; -- t - value to print SECTION "ComPrintHexByte",CODE ComPrintHexByte: pusha push ft ld f,0 rs ft,4 jal ComPrintDigit pop ft and t,$F jal ComPrintDigit popa j (hl) ; -- ; -- Print single digit ; -- ; -- t - digit ($0-$F) ; -- SECTION "ComPrintDigit",CODE ComPrintDigit: pusha jal DigitToAscii jal ComPrintChar popa j (hl) ; -- ; -- Print character to attached terminal ; -- ; -- Inputs: ; -- t - character ; -- ; -- Outputs: ; -- f - "eq" condition if success ; -- SECTION "ComPrintChar",CODE ComPrintChar: pusha ld t,COMMAND_PRINT_CHAR jal ComSendCommand pop ft jal UartByteOutSync jal ComSyncResponse pop bc-hl j (hl) ; -- ; -- Request character from attached terminal ; -- ; -- Outputs: ; -- f - "eq" condition if success ; -- t - character ; -- SECTION "ComRequestChar",CODE ComRequestChar: push bc-hl ld t,COMMAND_REQUEST_CHAR jal ComSendCommand jal ComSyncResponse j/ne .done jal UartByteInSync .done pop bc-hl j (hl) ; -- ; -- Attempts to identify UART file server ; -- ; -- Returns: ; -- t - error code, 0 is success ; -- f - "eq" condition if success ; -- SECTION "ComIdentify",CODE ComIdentify: push bc-hl jal comSendIdentify jal comReadIdentify pop bc-hl j (hl) ; -- ; -- Send load file command ; -- ; -- Inputs: ; -- bc - file name (Pascal string, data segment) ; -- SECTION "ComSendLoadFileString",CODE ComSendLoadFileString: pusha ld t,COMMAND_LOAD_FILE jal ComSendCommand ld t,(bc) add bc,1 ld f,0 jal UartWordOutSync ; filename length ld f,t .write_string ld t,(bc) jal UartByteOutSync add bc,1 dj f,.write_string ld ft,0 jal UartWordOutSync ; offset jal UartWordOutSync ; offset jal UartWordOutSync ; length jal UartWordOutSync ; length popa j (hl) ; -- ; -- Read protocol response, return error code ; -- ; -- Outputs: ; -- f - "eq" condition if success ; -- t - error code, 0 = success ; -- SECTION "ComSyncResponse",CODE ComSyncResponse: push bc-hl jal UartByteInSync j/ne .timeout cmp t,'!' j/ne .protocol_error jal UartByteInSync j .done .protocol_error ld t,ERROR_PROTOCOL j .done .timeout ld t,ERROR_TIMEOUT .done cmp t,0 pop bc-hl j (hl) ; -- ; -- Send command byte ; -- ; -- Inputs: ; -- t - command ; -- SECTION "SendCommand",CODE ComSendCommand: pusha ld f,'?' exg f,t jal UartWordOutSync popa j (hl) ; -- ; -- Send string in UART format ; -- ; -- Inputs: ; -- bc - Pascal string ; -- SECTION "ComSendDataString",CODE ComSendDataString: pusha ld f,0 ld t,(bc) add bc,1 jal UartWordOutSync ; filename length ld de,ft jal UartMemoryOutSync popa j (hl) ; -- ; -- Read string in UART format ; -- ; -- Inputs: ; -- bc - Pascal string destination ; -- ; -- Outputs: ; -- f - "eq" condition if success ; -- SECTION "ComReadDataString",CODE ComReadDataString: push bc-hl ld ft,bc ld de,ft jal UartWordInSync j/ne .error exg bc,de ld t,e ld (bc),t add bc,1 jal UartMemoryInSync .error pop bc-hl j (hl) ; -- ; -- Internal functions ; -- ; -- ; -- Receive file ; -- ; -- Inputs: ; -- de - destination ; -- ; -- Outputs: ; -- t - error code (0 = success) ; -- f - "eq" condition if success ; -- bc - bytes read ; -- SECTION "ComReadFile",CODE comReadFile: push de-hl jal ComSyncResponse j/ne .done jal UartWordInSync j/ne .timeout ld ft,bc push ft .loop jal UartByteInSync j/ne .timeout_pop ld (de),t add de,1 sub bc,1 tst bc j/nz .loop pop ft ld bc,ft ld t,ERROR_SUCCESS j .done .timeout_pop pop ft sub ft,bc ld bc,ft .timeout ld t,ERROR_TIMEOUT .done cmp t,0 pop de-hl j (hl) ; -- ; -- Send load file command ; -- ; -- Inputs: ; -- t - file name length ; -- bc - file name (code segment) ; -- SECTION "ComSendLoadFile",CODE comSendLoadFile: pusha push ft ld t,COMMAND_LOAD_FILE jal ComSendCommand pop ft ; t - already filename length ld f,0 jal UartWordOutSync ; filename length ld f,t .write_string lco t,(bc) jal UartByteOutSync add bc,1 dj f,.write_string ld ft,0 jal UartWordOutSync ; offset jal UartWordOutSync ; offset jal UartWordOutSync ; length jal UartWordOutSync ; length popa j (hl) ; -- Outputs: ; -- t - error code, 0 = success ; -- f - "eq" if success SECTION "ReadIdentify",CODE comReadIdentify: push bc-hl jal ComSyncResponse j/ne .done jal UartWordInSync j/ne .timeout ld ft,~IDENT_NONCE cmp bc j/ne .protocol ld t,ERROR_SUCCESS j .test .protocol ld t,ERROR_PROTOCOL j .test .timeout ld t,ERROR_TIMEOUT .test cmp t,0 .done pop bc-hl j (hl) SECTION "SendIdentify",CODE comSendIdentify: pusha ld t,COMMAND_IDENTIFY jal ComSendCommand ld ft,IDENT_NONCE jal UartWordOutSync popa j (hl)
src/dw1000-driver.ads
SALLYPEMDAS/DW1000
9
14153
<reponame>SALLYPEMDAS/DW1000 ------------------------------------------------------------------------------- -- Copyright (c) 2016 <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. ------------------------------------------------------------------------------- pragma Profile (Ravenscar); pragma Partition_Elaboration_Policy (Sequential); with Ada.Real_Time; with DW1000.Constants; with DW1000.BSP; with DW1000.Register_Types; use DW1000.Register_Types; with DW1000.System_Time; use DW1000.System_Time; with DW1000.Types; use DW1000.Types; with Interfaces; use Interfaces; -- This package contains high-level procedures for using the DW1000. package DW1000.Driver with SPARK_Mode => On is type Result_Type is (Success, Error); type Clocks is (Enable_All_Seq, Force_Sys_XTI, Force_Sys_PLL, Read_Acc_On, Read_Acc_Off, Force_OTP_On, Force_OTP_Off, Force_Tx_PLL); type Data_Rates is (Data_Rate_110k, -- 110 kbps Data_Rate_850k, -- 850 kbps Data_Rate_6M8); -- 6.8 Mbps for Data_Rates use (Data_Rate_110k => 2#00#, Data_Rate_850k => 2#01#, Data_Rate_6M8 => 2#10#); type Channel_Number is range 1 .. 7 with Static_Predicate => Channel_Number in 1 .. 5 | 7; -- Channels 1 .. 5 and 7 are supported by the DW1000. type PRF_Type is (PRF_16MHz, PRF_64MHz); for PRF_Type use (PRF_16MHz => 2#01#, PRF_64MHz => 2#10#); type Preamble_Lengths is (PLEN_64, PLEN_128, PLEN_256, PLEN_512, PLEN_1024, PLEN_1536, PLEN_2048, PLEN_4096); type Preamble_Acq_Chunk_Length is (PAC_8, PAC_16, PAC_32, PAC_64); type Preamble_Code_Number is new Positive range 1 .. 24; type Physical_Header_Modes is (Standard_Frames, Extended_Frames); for Physical_Header_Modes use (Standard_Frames => 2#00#, Extended_Frames => 2#11#); type SFD_Timeout_Number is new Natural range 0 .. (2**16) - 1; type SFD_Length_Number is new Natural range 8 .. 64 with Static_Predicate => SFD_Length_Number in 8 .. 16 | 64; type AON_Address_Array is array (Index range <>) of AON_ADDR_Field; -- Array of addresses within the AON address space. type Rx_Modes is (Normal, Sniff); type Tx_Power_Config_Type (Smart_Tx_Power_Enabled : Boolean := True) is record case Smart_Tx_Power_Enabled is when True => Boost_Normal : TX_POWER_Field; Boost_500us : TX_POWER_Field; Boost_250us : TX_POWER_Field; Boost_125us : TX_POWER_Field; when False => Boost_SHR : TX_POWER_Field; Boost_PHR : TX_POWER_Field; end case; end record; type Tx_Power_Config_Table is array (Positive range 1 .. 7, PRF_Type) of Tx_Power_Config_Type; function To_Positive (PAC : in Preamble_Acq_Chunk_Length) return Positive is (case PAC is when PAC_8 => 8, when PAC_16 => 16, when PAC_32 => 32, when PAC_64 => 64); function To_Positive (Preamble_Length : in Preamble_Lengths) return Positive is (case Preamble_Length is when PLEN_64 => 64, when PLEN_128 => 128, when PLEN_256 => 256, when PLEN_512 => 512, when PLEN_1024 => 1024, when PLEN_1536 => 1536, when PLEN_2048 => 2048, when PLEN_4096 => 4096); function Recommended_PAC (Preamble_Length : in Preamble_Lengths) return Preamble_Acq_Chunk_Length is (case Preamble_Length is when PLEN_64 => PAC_8, when PLEN_128 => PAC_8, when PLEN_256 => PAC_16, when PLEN_512 => PAC_16, when PLEN_1024 => PAC_32, when PLEN_1536 => PAC_64, when PLEN_2048 => PAC_64, when PLEN_4096 => PAC_64); -- Get the recommended preamble acquisition chunk (PAC) length based -- on the preamble length. -- -- These recommendations are from Section 4.1.1 of the DW1000 User Manual. function Recommended_SFD_Timeout (Preamble_Length : in Preamble_Lengths; SFD_Length : in SFD_Length_Number; PAC : in Preamble_Acq_Chunk_Length) return SFD_Timeout_Number is (SFD_Timeout_Number ((To_Positive (Preamble_Length) + Positive (SFD_Length) + 1) - To_Positive (PAC))); -- Compute the recommended SFD timeout for a given preamble length, SFD -- length, and preamble acquisition chunk length. -- -- For example, with a preable length of 1024 symbols, an SFD length of -- 64 symbols, and a PAC length of 32 symbols the recommended SFD timeout -- is 1024 + 64 + 1 - 32 = 1057 symbols. -- -- @param Preamble_Length The length of the preamble in symbols. -- -- @param SFD_Length The length of the SFD in symbols. The SFD length -- depends on whether or not a non-standard SFD is used, and the data -- rate. For a data rate of 110 kbps the SFD length is 64 symbols for -- the standard SFD and DecaWave-defined SFD. For a data rate of 850 -- kbps and above the SFD length is 8 symbols for a standard SFD, and 8 -- or 16 symbols for the DecaWave-defined SFD sequence. -- -- @param PAC The preamble acquisition chunk length. procedure Load_LDE_From_ROM with Global => (In_Out => DW1000.BSP.Device_State, Input => Ada.Real_Time.Clock_Time), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, null => Ada.Real_Time.Clock_Time); -- Loads the leading edge detection (LDE) microcode from ROM. -- -- The LDE code must be loaded in order to use the LDE algorithm. If the -- LDE code is not loaded then the LDERUNE bit in the PMSC_CTRL1 register -- must be set to 0. -- -- Note: This procedure modifies the clocks setting in PMSC_CTRL0. procedure Enable_Clocks (Clock : in Clocks) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Clock); -- Enables and configures the specified clock. -- -- This procedure configures the following registers: -- * PMSC_CTRL0 procedure Read_OTP (Address : in OTP_ADDR_Field; Word : out Bits_32) with Global => (In_Out => DW1000.BSP.Device_State), Depends => ((DW1000.BSP.Device_State, Word) => (DW1000.BSP.Device_State, Address)); -- Reads a 32-bit word from the DW1000 one-time programmable (OTP) memory. -- -- The package DW1000.Constants defines the addresses used to store the -- various data stored in the OTP memory. procedure Read_OTP_Tx_Power_Level (Channel : in Channel_Number; PRF : in PRF_Type; Power_Level : out TX_POWER_Type) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Channel, PRF), Power_Level => (DW1000.BSP.Device_State, Channel, PRF)); procedure Read_OTP_Antenna_Delay (Antenna_Delay_16_MHz : out Antenna_Delay_Time; Antenna_Delay_64_MHz : out Antenna_Delay_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, Antenna_Delay_16_MHz => DW1000.BSP.Device_State, Antenna_Delay_64_MHz => DW1000.BSP.Device_State); procedure Configure_Tx_Power (Config : Tx_Power_Config_Type) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Config); -- Configure the transmit power of the DW1000 transmitter. -- -- This procedure is used to configure both smart transmit power and -- manual transmit power. The @Smart_Tx_Power_Enabled@ field of the -- @Tx_Power_Config_Type@ record determines whether or not smart tx is -- enabled or disabled. -- -- Depending on whether or not smart transmit power is enabled or disabled -- the @Tx_Power_Config_Type@ record contains different fields. -- -- An example of configuring a specific smart transmit power configuration -- is demonstrated below: -- -- Configure_Tx_Power (Tx_Power_Config_Type' -- (Smart_Tx_Power_Enabled => True, -- Boost_Normal => (Coarse_Gain_Enabled => True, -- Fine_Gain => 10.5, -- Coarse_Gain => 9.0), -- Boost_500us => (Coarse_Gain_Enabled => True, -- Fine_Gain => 10.5, -- Coarse_Gain => 12.0), -- Boost_250us => (Coarse_Gain_Enabled => True, -- Fine_Gain => 10.5, -- Coarse_Gain => 15.0), -- Boost_125us => (Coarse_Gain_Enabled => True, -- Fine_Gain => 10.5, -- Coarse_Gain => 18.0))); -- -- An example manual transmit power configuration is shown below: -- -- Configure_Tx_Power (Tx_Power_Config_Type' -- (Smart_Tx_Power_Enabled => False, -- Boost_SHR => (Coarse_Gain_Enabled => True, -- Fine_Gain => 3.5, -- Coarse_Gain => 9.0), -- Boost_PHR => (Coarse_Gain_Enabled => True, -- Fine_Gain => 3.5, -- Coarse_Gain => 9.0)); -- -- @param Config Record containing the transmit power configuration. procedure Read_EUID (EUID : out Bits_64) with Global => (In_Out => DW1000.BSP.Device_State), Depends => ((DW1000.BSP.Device_State, EUID) => DW1000.BSP.Device_State); -- Read the extended unique identifier (EUID). procedure Write_EUID (EUID : in Bits_64) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ EUID); -- Write the extended unique identifier (EUID). procedure Read_PAN_ID (PAN_ID : out Bits_16) with Global => (In_Out => DW1000.BSP.Device_State), Depends => ((DW1000.BSP.Device_State, PAN_ID) => DW1000.BSP.Device_State); procedure Write_PAN_ID (PAN_ID : in Bits_16) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ PAN_ID); procedure Read_Short_Address (Short_Address : out Bits_16) with Global => (In_Out => DW1000.BSP.Device_State), Depends => ((DW1000.BSP.Device_State, Short_Address) => DW1000.BSP.Device_State); procedure Write_Short_Address (Short_Address : in Bits_16) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Short_Address); procedure Read_PAN_ID_And_Short_Address (PAN_ID : out Bits_16; Short_Address : out Bits_16) with Global => (In_Out => DW1000.BSP.Device_State), Depends => ((DW1000.BSP.Device_State, PAN_ID, Short_Address) => DW1000.BSP.Device_State); procedure Write_PAN_ID_And_Short_Address (PAN_ID : in Bits_16; Short_Address : in Bits_16) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ (PAN_ID, Short_Address)); procedure Read_Tx_Antenna_Delay (Antenna_Delay : out Antenna_Delay_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => ((DW1000.BSP.Device_State, Antenna_Delay) => DW1000.BSP.Device_State); -- Read the currently configured Tx antenna delay. -- -- The antenna delay is a 16-bit value using the same unit as the system -- time and time stamps, i.e. 499.2 MHz * 128, so the least significant -- bit is approximately 15.65 picoseconds. procedure Write_Tx_Antenna_Delay (Antenna_Delay : in Antenna_Delay_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Antenna_Delay)), Pre => Antenna_Delay <= (2.0**16 - 1.0) * Fine_System_Time'Delta; -- Set the Tx antenna delay. -- -- The antenna delay is a 16-bit value using the same unit as the system -- time and time stamps, i.e. 499.2 MHz * 128, so the least significant -- bit is approximately 15.65 picoseconds. -- -- This procedure configures the following registers: -- * TX_ANTD -- -- @param Antenna_Delay The antenna delay. The maximum allowed value is -- 1025.625 nanoseconds. procedure Read_Rx_Antenna_Delay (Antenna_Delay : out Antenna_Delay_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => ((DW1000.BSP.Device_State, Antenna_Delay) => DW1000.BSP.Device_State); -- Read the currently configured Rx antenna delay. -- -- The antenna delay is a 16-bit value using the same unit as the system -- time and time stamps, i.e. 499.2 MHz * 128, so the least significant -- bit is approximately 15.65 picoseconds. procedure Write_Rx_Antenna_Delay (Antenna_Delay : in Antenna_Delay_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Antenna_Delay)), Pre => Antenna_Delay <= (2.0**16 - 1.0) * Fine_System_Time'Delta; -- Set the Rx antenna delay. -- -- The antenna delay is a 16-bit value using the same unit as the system -- time and time stamps, i.e. 499.2 MHz * 128, so the least significant -- bit is approximately 15.65 picoseconds. -- -- This procedure configures the following registers: -- * LDE_RXANTD -- -- @param Antenna_Delay The antenna delay. The maximum allowed value is -- 1025.625 nanoseconds. procedure Configure_LDE (PRF : in PRF_Type; Rx_Preamble_Code : in Preamble_Code_Number; Data_Rate : in Data_Rates) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, PRF, Rx_Preamble_Code, Data_Rate)); -- Configures the LDE subsystem for the specified pulse repetition -- frequency (PRF), receiver preamble code, and data rate. -- -- This procedure configures the following registers: -- * LDE_CFG1 -- * LDE_CFG2 -- * LDE_REPC procedure Configure_PLL (Channel : in Channel_Number) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Channel)); -- Configures the PLL subsystem for the specified UWB channel. -- -- This procedure configures the following registers: -- * FS_PLLCFG -- * FS_PLLTUNE -- * FS_XTALT procedure Configure_RF (Channel : in Channel_Number) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Channel)); -- Configures the RF subsystem for the specified UWB channel. -- -- This procedure configures the following registers: -- * RF_RXCTRLH -- * RF_TXCTRL procedure Configure_DRX (PRF : in PRF_Type; Data_Rate : in Data_Rates; Tx_Preamble_Length : in Preamble_Lengths; PAC : in Preamble_Acq_Chunk_Length; SFD_Timeout : in SFD_Timeout_Number; Nonstandard_SFD : in Boolean) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, PRF, Data_Rate, Tx_Preamble_Length, PAC, SFD_Timeout, Nonstandard_SFD)); -- Configures the DRX subsystem for the specified configuration. -- -- This procedure configures the following registers: -- * DRX_TUNE0b -- * DRX_TUNE1a -- * DRX_TUNE1b -- * DRX_TUNE4H -- * DRX_TUNE2 -- * DRX_SFDTOC procedure Configure_AGC (PRF : in PRF_Type) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ PRF); -- Configures the automatic gain control (AGC) subsystem. -- -- This procedure configures the following registers: -- * AGC_TUNE2 -- * AGC_TUNE1 procedure Configure_TC (Channel : in Channel_Number) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Channel); -- Configure the transmit calibration (TC) block for the specified channel. procedure Configure_TX_FCTRL (Frame_Length : in Natural; Tx_Data_Rate : in Data_Rates; Tx_PRF : in PRF_Type; Ranging : in Boolean; Preamble_Length : in Preamble_Lengths; Tx_Buffer_Offset : in Natural; Inter_Frame_Spacing : in Natural) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Frame_Length, Tx_Data_Rate, Tx_PRF, Ranging, Preamble_Length, Tx_Buffer_Offset, Inter_Frame_Spacing)), Pre => (Frame_Length < Constants.TX_BUFFER_Length and then Tx_Buffer_Offset < Constants.TX_BUFFER_Length and then Frame_Length + Tx_Buffer_Offset <= Constants.TX_BUFFER_Length and then Inter_Frame_Spacing < 256); procedure Configure_CHAN_CTRL (Tx_Channel : in Channel_Number; Rx_Channel : in Channel_Number; Use_DecaWave_SFD : in Boolean; Use_Tx_User_Defined_SFD : in Boolean; Use_Rx_User_Defined_SFD : in Boolean; Rx_PRF : in PRF_Type; Tx_Preamble_Code : in Preamble_Code_Number; Rx_Preamble_Code : in Preamble_Code_Number) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Tx_Channel, Rx_Channel, Use_DecaWave_SFD, Use_Tx_User_Defined_SFD, Use_Rx_User_Defined_SFD, Rx_PRF, Tx_Preamble_Code, Rx_Preamble_Code)), Pre => ((if Use_Tx_User_Defined_SFD then not Use_DecaWave_SFD) and (if Use_Rx_User_Defined_SFD then not Use_DecaWave_SFD)); procedure Configure_Nonstandard_SFD_Length (Data_Rate : in Data_Rates) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Data_Rate); -- Configures the length of the non-standard SFD for the specified -- data rate. -- -- This procedure configures the following registers: -- * USR_SFD procedure Configure_Non_Standard_SFD (Rx_SFD : in String; Tx_SFD : in String) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ (Rx_SFD, Tx_SFD)), Pre => (Rx_SFD'Length in 8 .. 16 | 64 and Tx_SFD'Length = Rx_SFD'Length and (for all I in Rx_SFD'Range => Rx_SFD (I) in '+' | '-' | '0') and (for all I in Tx_SFD'Range => Tx_SFD (I) in '+' | '-' | '0') ); -- Configure a non-standard SFD sequence. -- -- WARNING: Only experts should consider designing their own SFD sequence. -- Designing an SFD is a complicated task, and is outside the scope of this -- documentation. It is strongly recommended to use either the standard -- defined SFD sequence, or the DecaWave defined SFD sequence. -- -- The Rx_SFD and Tx_SFD strings must be strings containing only '+', '-', -- and '0' characters. No other characters are permitted. -- Below is an example of calling this procedure, using the -- DecaWave defined 16-symbol SFD sequence as an example SFD sequence: -- -- Configure_Non_Standard_SFD (Rx_SFD => "----+-+--++--+00", -- Tx_SFD => "----+-+--++--+00"); -- -- Note that the Tx and Rx SFD must have the same length. -- -- @param Rx_SFD The SFD sequence to use in the receiver. -- -- @param Tx_SFD The SFD sequence to use in the transmitter. procedure Set_Frame_Filtering_Enabled (Enable : in Boolean) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Enable); -- Enable or disable frame filtering. -- -- Frame filtering allows the DW1000 to automatically reject frames -- according to certain criterea according to the IEEE 802.15.4-2011 -- MAC layer. -- -- To configure which frames are accepted or rejected by the DW1000 see the -- Configure_Frame_Filtering procedure. -- -- @param Enabled When set to True frame filtering is enabled. Otherwise, -- it is disabled. procedure Set_FCS_Check_Enabled (Enable : in Boolean) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Enable); -- Enable or disable the automatic frame check sequence (FCS) on received -- frames. -- -- By default, the DW1000 automatically checks the 16-bit CRC FCS on each -- received frame. The last two octets in the received frame are assumed -- as the 16-bit CRC, and is compared against the actual FCS computed -- against all but the last two octets in the received frame. -- -- If the DW1000 detects that the actual FCS does not match the FCS in the -- received frame, then it generates an FCS error. If double-buffered mode -- is enabled then the received frame is discarded and the buffer re-used -- for the next received frame. -- -- This procedure enables or disables the FCS check. -- -- @param Enabled When True (default after DW1000 reset) the DW1000 will -- check the FCS of each received frame. Set this to false to disable -- the FCS check for each packet. procedure Configure_Frame_Filtering (Behave_As_Coordinator : in Boolean; Allow_Beacon_Frame : in Boolean; Allow_Data_Frame : in Boolean; Allow_Ack_Frame : in Boolean; Allow_MAC_Cmd_Frame : in Boolean; Allow_Reserved_Frame : in Boolean; Allow_Frame_Type_4 : in Boolean; Allow_Frame_Type_5 : in Boolean) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Behave_As_Coordinator, Allow_Beacon_Frame, Allow_Data_Frame, Allow_Ack_Frame, Allow_MAC_Cmd_Frame, Allow_Reserved_Frame, Allow_Frame_Type_4, Allow_Frame_Type_5)); -- Configure which MAC frame types are automatically filtered by the -- DW1000. -- -- Note that the frame filtering configuration only takes effect when -- frame filtering is enabled (see Set_Frame_Filtering_Enabled). -- -- @param Behave_As_Coordinator When set to True the DW1000 will accept -- a frame without a destination address if the source address has -- the PAN ID matching the coordinator's PAN ID. When set to False -- and when filtering is enabled the DW1000 will reject these frames. -- -- @param Allow_Beacon_Frame When set to True the DW1000 will accept -- frames whose frame type is a beacon frame. When set to False -- and when filtering is enabled the DW1000 will reject these frames. -- -- @param Allow_Data_Frame When set to True the DW1000 will accept -- frames whose frame type is a data frame. When set to False -- and when filtering is enabled the DW1000 will reject these frames. -- -- @param Allow_Ack_Frame When set to True the DW1000 will accept frames -- whose frame type is an acknowledgement frame. When set to False -- and when filtering is enabled the DW1000 will reject these frames. -- -- @param Allow_MAC_Cmd_Frame When set to True the DW1000 will accept -- frames whose frame type is a MAC command frame. When set to False -- and when filtering is enabled the DW1000 will reject these frames. -- -- @param Allow_Reserved_Frame When set to True the DW1000 will accept -- frames whose frame type is set to a reserved value (values 2#100# -- to 2#111#) as defined by IEEE 802.15.4-2011. When set to False -- and when filtering is enabled the DW1000 will reject these frames. -- -- @param Allow_Frame_Type_4 When set to True the DW1000 will accept -- frames whose frame type is set to the value 2#100#, i.e. 4. -- When set to False and when frame filtering is enabled the DW1000 -- will reject these frames. -- -- @param Allow_Frame_Type_5 When set to True the DW1000 will accept -- frames whose frame type is set to the value 2#101#, i.e. 5. -- When set to False and when frame filtering is enabled the DW1000 -- will reject these frames. procedure Set_Smart_Tx_Power (Enable : in Boolean) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Enable); -- Enables or disables smart Tx power control. -- -- Regulations for UWB typically specify a maximum transmit power limit of -- -41.3 dBm / MHz, typically measured with a dwell time of 1 ms. Short -- frames transmitted at a data rate of 6.8 Mbps and a short preamble -- length are transmitted in a fraction of a millisecond. If only a single -- short frame is transmitted with in 1 ms then the frame can be -- transmitted at a higher power than the -41.3 dBm / MHz regulatory limit. -- -- When the smart tx power control is enabled then the DW1000 will -- boost the power for short transmissions. It is the user's responsibility -- to avoid sending multiple short frames within the same millisecond to -- remain within the regulatory limits. -- -- This procedure configures the following registers: -- * SYS_CFG procedure Set_Tx_Data (Data : in Types.Byte_Array; Offset : in Natural) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Data, Offset)), Pre => (Data'Length <= DW1000.Constants.TX_BUFFER_Length and then Offset < DW1000.Constants.TX_BUFFER_Length and then Data'Length + Offset <= DW1000.Constants.TX_BUFFER_Length); -- Write data to the DW1000 TX buffer. -- -- Before starting the transmission, the frame length and offset must be -- programmed into the DW1000 separately using the Set_Tx_Frame_Length -- procedure. -- -- The frame is not transmitted until the Start_Tx procedure is called. -- -- This procedure configures the following registers: -- * TX_BUFFER procedure Set_Tx_Frame_Length (Length : in Natural; Offset : in Natural) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ (Length, Offset)), Pre => (Length < DW1000.Constants.TX_BUFFER_Length and then Offset < DW1000.Constants.TX_BUFFER_Length and then Length + Offset <= DW1000.Constants.TX_BUFFER_Length); -- Configures the frame length and offset within the transmit buffer -- (TX_BUFFER) to use when transmitting the next packet. -- -- This procedure configures the following registers: -- * TX_FCTRL procedure Read_Rx_Data (Data : out Types.Byte_Array; Offset : in Natural) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ (Offset, Data), Data => (DW1000.BSP.Device_State, Offset)), Pre => (Data'Length > 0 and then Data'Length <= DW1000.Constants.RX_BUFFER_Length and then Offset < DW1000.Constants.RX_BUFFER_Length and then Data'Length + Offset <= DW1000.Constants.RX_BUFFER_Length); -- Read the received frame from the Rx buffer. procedure Start_Tx_Immediate (Rx_After_Tx : in Boolean; Auto_Append_FCS : in Boolean) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ (Rx_After_Tx, Auto_Append_FCS)); procedure Start_Tx_Delayed (Rx_After_Tx : in Boolean; Result : out Result_Type) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Rx_After_Tx, Result => (DW1000.BSP.Device_State, Rx_After_Tx)); -- Transmit the contents of the TX buffer with a delay. -- -- The time at which the packet is to be transmitted must be set before -- calling this procedure by using the Set_Delayed_Tx_Rx_Time procedure. -- -- When Rx_After_Tx is True then the receiver is automatically enabled -- after the transmission is completed. -- -- This procedure configures the following registers: -- * SYS_CTRL procedure Set_Delayed_Tx_Rx_Time (Delay_Time : in Coarse_System_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Delay_Time); -- Set the receive and transmit delay. -- -- Both Rx and Tx share the same delay. It is not possible for the receiver -- and transmitter to use different delays simultaneously. -- -- The delay time is measured in units of 499.2 MHz * 128, i.e. the least -- significant bit of the delay time is approximately 15.65 ps. -- -- Note that the 9 low order bits of the input value are ignored by the -- DW1000, as described in Section 7.2.12 of the DW1000 User Manual -- (DX_TIME register). -- -- This procedure configures the following registers: -- * DX_TIME procedure Set_Sleep_After_Tx (Enable : in Boolean) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Enable); -- Configures the DW1000 to enter sleep more (or not) after transmitting a -- frame. -- -- When Enable is True, the DW1000 will automatically enter sleep mode -- after each frame is sent. Otherwise, when Enable is False the DW1000 -- will not enter sleep mode after each frame is sent. -- -- This procedure configures the following registers: -- * PMSC_CTRL1 procedure Read_Rx_Adjusted_Timestamp (Timestamp : out Fine_System_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, Timestamp => DW1000.BSP.Device_State); -- Read the corrected timestamp associated with the last received packet. -- -- This timestamp is the timestamp that has been fully corrected for the -- time of packet reception. The timestamp is in units of approximately -- 15.65 picoseconds. procedure Read_Rx_Raw_Timestamp (Timestamp : out Coarse_System_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, Timestamp => DW1000.BSP.Device_State); -- Read the raw timestamp associated with the last received packet. -- -- This timestamp is the timestamp before the various corrections for the -- time of reception have been applied. The timestamp is in units of -- approximately 8.013 nanoseconds. procedure Read_Rx_Timestamps (Adjusted : out Fine_System_Time; Raw : out Coarse_System_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, (Adjusted, Raw) => DW1000.BSP.Device_State); -- Read both the raw and adjusted timestamps for the last received packet. procedure Read_Tx_Adjusted_Timestamp (Timestamp : out Fine_System_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, Timestamp => DW1000.BSP.Device_State); -- Read the corrected timestamp associated with the last transmitted -- packet. -- -- This timestamp is the timestamp that has been fully corrected for the -- time of packet transmission. The timestamp is in units of approximately -- 15.65 picoseconds. procedure Read_Tx_Raw_Timestamp (Timestamp : out Coarse_System_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, Timestamp => DW1000.BSP.Device_State); -- Read the raw timestamp associated with the last transmitted packet. -- -- This timestamp is the timestamp before the various corrections for the -- time of transmission have been applied. The timestamp is in units of -- approximately 8.013 nanoseconds. procedure Read_Tx_Timestamps (Adjusted : out Fine_System_Time; Raw : out Coarse_System_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, (Adjusted, Raw) => DW1000.BSP.Device_State); procedure Read_System_Timestamp (Timestamp : out Coarse_System_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, Timestamp => DW1000.BSP.Device_State); -- Read the current value of the DW1000's system timestamp. -- -- The timestamp is measured in units of 499.2 MHz * 128, i.e. the least -- significant bit of the timestamp is approximately 15.65 ps. procedure Check_Overrun (Overrun : out Boolean) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, Overrun => DW1000.BSP.Device_State); -- Check if an overrun condition has occurred. -- -- An overrun condition occurs if the DW1000 receives a new packet before -- the host processor has been able to read the previously received packet. -- -- See Section 4.3.5 of the DW1000 User Manual for more information of the -- overrun condition. procedure Force_Tx_Rx_Off with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State); -- Force off the tranceiver. -- -- This also clears the status registers. -- -- Turning off the tranceiver will cancel any pending receive or -- transmit operation. procedure Reset_Rx with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State); -- Perform a soft reset of the receiver only. procedure Toggle_Host_Side_Rx_Buffer_Pointer with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State); -- Toggle the host side receive buffer pointer (HSRBP). -- -- This procedure is only relevant when double-buffer mode is enabled. -- Calling this procedure signals to the DW1000 that the host IC is -- finished with the contents of the current double-buffered set. -- -- It should be called after the host IC has finished reading the receive -- registers after a packet has been received. procedure Sync_Rx_Buffer_Pointers with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State); -- Synchronize the Rx buffer pointers for double-buffer operation. -- -- This procedure synchronizes the ICRBP and HSRBP bits in the SYS_CTRL -- register so that they are the same. This is only relevant when the -- DW1000 is operating in double-buffer mode. -- -- This procedure configures the following registers: -- * SYS_CTRL procedure Start_Rx_Immediate with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State); -- Enable the receiver immediately (without a delay). -- -- This procedure configures the following registers: -- * SYS_CTRL procedure Start_Rx_Delayed (Result : out Result_Type) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, Result => DW1000.BSP.Device_State); -- Enable the receiver after a delay. -- -- The receiver is enabled only at the time configured by calling the -- Set_Tx_Rx_Delay_Time procedure, which must be set before calling this -- procedure. -- -- This procedure configures the following registers: -- * SYS_CTRL procedure Set_Rx_Mode (Mode : in Rx_Modes; Rx_On_Time : in RX_SNIFF_SNIFF_ONT_Field; Rx_Off_Time : in Sniff_Off_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ (Mode, Rx_On_Time, Rx_Off_Time)), Pre => (if Mode = Sniff then Rx_Off_Time > 0.0); -- Enables or disables the receiver sniff mode. -- -- When Mode is set to Normal then when the receiver is turned on (see -- the Enable_Rx procedure) then it will operate until either a frame is -- received, or until the receiver timeout time is reached. In the Normal -- mode the Rx_On_Time and Rx_Off_Time parameters are not used. -- -- When Mode is set to Sniff then the receiver will be activated for the -- duration of the Rx_On_Time, searching for a preamble. If a preamble is -- detected within this duration then the receiver continues operation to -- try to receive the packet. Otherwise, if no preamble is detected then -- the receiver is then disabled for the Rx_Off_Time, after which it is -- re-enabled to repeat the process. -- -- The Rx_On_Time is measured in units of the preamble acquisition count -- (PAC) see Section 4.1.1 of the DW100 User Manual for more information. -- -- The Rx_Off_Time is measured in units of the 128 system clock cycles, or -- approximately 1 us. If the Mode is set to Sniff then the Rx_Off_Time -- must be non-zero (a value of 0 would disable the sniff mode on the -- DW1000). -- -- The Rx_Off_Time must be less than 15.385 microseconds. -- -- This procedure configures the following registers: -- * RX_SNIFF procedure Set_Auto_Rx_Reenable (Enable : in Boolean) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Enable); -- Enable or disable the Rx auto re-enable feature. -- -- This feature has different behaviour depending on whether or not the -- receiver is operating in double-buffer mode. -- -- When Rx auto re-enable is disabled the receiver will stop receiving -- when any receive event happens (e.g. an error occurred, or a frame -- was received OK). -- -- When Rx auto re-enable is enabled then the receiver behaviour -- depends on the double-buffer configuration: -- * In single-buffer mode the receiver is automatically re-enabled -- after a receive error occurs (e.g. physical header error), -- EXCEPT a frame wait timeout error. -- * In double-buffer mode the receiver is automatically re-enabled -- when a frame is received, or when an error occurs (e.g. physical -- header error), EXCEPT a frame wait timeout error. -- -- This procedure configures the following registers: -- * SYS_CFG procedure Set_Rx_Double_Buffer (Enable : in Boolean) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Enable); -- Configures double-buffer mode. -- -- By default the DW1000 operates in single-buffer mode. Double-buffer -- mode can be enabled to allow the host application to read the previously -- received frame at the same time as the DW1000 is receiving the next -- frame. -- -- Also see the Sync_Rx_Buffer_Pointers procedure. -- -- This procedure configures the following registers: -- * SYS_CFG procedure Set_Rx_Frame_Wait_Timeout (Timeout : in Frame_Wait_Timeout_Time) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Timeout); -- Configure the receive timeout. -- -- When the receiver is enabled the receive timeout is started. -- If no complete frame is received within the configured Rx timeout -- then the receiver is automatically disabled. -- -- The Rx timeout can be disabled by setting the Timeout to 0.0. -- -- The Rx timeout is measured in units of 499.2 MHz / 512, i.e. in units -- of approximately 1.026 us. The maximum timeout is approximately -- 67.215385 ms. -- -- This procedure configures the following registers: -- * SYS_CFG -- -- @param Timeout The maximum time (in seconds) to wait for a frame. -- E.g. a value of 0.001 is 1 millisecond. The maximum permitted value -- is 0.067_215_385, i.e. a little over 67 milliseconds. procedure Set_Preamble_Detect_Timeout (Timeout : in DRX_PRETOC_Field) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Timeout); -- Configure the preamble detection timeout. -- -- When the receiver is enabled the preamble timeout is started. -- If no preamble is detected within the configured preamble detection -- timeout then the receiver is automatically disabled. -- -- The preamble detect timeout can be disabled by setting the Timeout to 0. -- -- The preamble detect timeout is measured in units of preamble acquisition -- chunk (PAC) size, which can be 8, 16, 32, or 64. See Section 7.2.40.9 of -- the DW1000 User Manual for more information. -- -- This procedure configures the following registers: -- * DRX_PRETOC procedure Calibrate_Sleep_Count (Half_XTAL_Cycles_Per_LP_Osc_Cycle : out Types.Bits_16) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State, Half_XTAL_Cycles_Per_LP_Osc_Cycle => DW1000.BSP.Device_State); procedure Upload_AON_Config with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State); -- Upload the AON block configurations to the AON. -- -- This uploads the configuration from the AON_CFG0 and AON_CFG1 registers -- into the AON block. procedure Save_Registers_To_AON with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State); -- Copy the user configurations from the host interface register set into -- the AON memory. -- -- If enabled to do so, after exiting sleep mode the DW1000 will reload the -- user configuration from the AON memory into the host interface register -- set. -- -- The behaviour of the AON subsystem when exiting sleep or deep-sleep -- states can be configured via the AON_WCFG register. procedure Restore_Registers_From_AON with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => DW1000.BSP.Device_State); -- Load the user configuration from the AON memory into the host interface -- register set. procedure AON_Read_Byte (Address : in AON_ADDR_Field; Data : out Types.Bits_8) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Address), Data => (DW1000.BSP.Device_State, Address)); -- Reads a single byte from the Always-On block. procedure AON_Contiguous_Read (Start_Address : in AON_ADDR_Field; Data : out Types.Byte_Array) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Start_Address, Data), Data =>+ (DW1000.BSP.Device_State, Start_Address)), Pre => (Data'Length <= 256 and then Natural (Start_Address) + Data'Length <= 256); -- Reads a contiguous sequence of bytes from the Always-On block. procedure AON_Scatter_Read (Addresses : in AON_Address_Array; Data : out Types.Byte_Array) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Addresses, Data), Data =>+ (DW1000.BSP.Device_State, Addresses)), Pre => Addresses'Length = Data'Length; -- Reads a non-contiguous set of bytes from the Always-on block. -- -- This procedure reads bytes from the sequence of addresses in the -- Addresses array, and stores the byte that was read in the corresponding -- position in the Data array. procedure Configure_Sleep_Count (Sleep_Count : in AON_CFG0_SLEEP_TIM_Field) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Sleep_Count); procedure Set_XTAL_Trim (Trim : in FS_XTALT_Field) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State =>+ Trim); procedure Configure_LEDs (Tx_LED_Enable : in Boolean; Rx_LED_Enable : in Boolean; Rx_OK_LED_Enable : in Boolean; SFD_LED_Enable : in Boolean; Test_Flash : in Boolean) with Global => (In_Out => DW1000.BSP.Device_State), Depends => (DW1000.BSP.Device_State => (DW1000.BSP.Device_State, Tx_LED_Enable, Rx_LED_Enable, Rx_OK_LED_Enable, SFD_LED_Enable, Test_Flash)); -- Configure the behaviour of the LEDs. -- -- @param Tx_LED_Enable When set to True the DW1000 will flash the Tx LED -- while the transmitter is on. -- -- @param Rx_LED_Enable When set to True the DW1000 will flash the Rx LED -- while the receiver is on. -- -- @param Rx_OK_LED_Enable When set to True the DW1000 will flash the LED -- when a packet is received without errors. -- -- @param SFD_LED_Enable When set to True the DW1000 will flash the LED -- when an SFD is detected. -- -- @param Test_Flash When set to True the DW1000 will flash the configured -- LEDs once, immediately after the LEDs are configured. end DW1000.Driver;
Microsoft Word for Windows Version 1.1a/Word 1.1a CHM Distribution/Opus/asm/editn.asm
lborgav/Historical-Source-Codes
7
82326
include w2.inc include noxport.inc include consts.inc include structs.inc createSeg edit_PCODE,edit,byte,public,CODE ; DEBUGGING DECLARATIONS ifdef DEBUG midEditn equ 15 ; module ID, for native asserts endif ; EXTERNAL FUNCTIONS externFP <CorrectDodPlcs> externFP <N_PdodMother> externFP <GetSelCurChp> externFP <ErrorEidProc> externFP <ReloadSb> externFP <IInPlcRef> externFP <CpPlc> externFP <GetPlc> externFP <PutCpPlc> externFP <N_PdrFetch> externFP <N_FreePdrf> externFP <N_FStretchPlc> externFP <FStretchSttbCb> externFP <CloseUpSttb> externFP <DisposeWwHdr> externFP <CloseBkmkStructs> externFP <FChngSizePhqLcb> externFP <SetSelCellBits> externNP <LN_PdodDocEdit> ifdef DEBUG externFP <S_AdjustHplcedlCps> externFP <S_PdrFetch> externFP <S_FreePdrf> externFP <AssertProcForNative> externFP <ScribbleProc> externFP <N_PwwdWw> externFP <S_FStretchPlc> externFP <FCheckHandle> externNP <LN_FreezeHpEdit> externNP <LN_MeltHpEdit> endif ;DEBUG sBegin data ; EXTERNALS externW caAdjust externW caAdjustL externW caHdt externW caPage externW caPara externW caSect externW caTable externW caTap externW mpdochdod externW mpwwhwwd externW rgselsInsert externW selCur externW vdocFetch externW vfls externW vitcMic externW vmpitccp externW vlcb externW vrulss externW vsccAbove externW vtapFetch externW vtcc externW vtcxs externW vsab externW mpsbps externW vfInCommit externW vmerr externW caTapAux externW vhplbmc ifdef DEBUG externW cCaAdjust externW cCaAdjustL externW cHpFreeze externW vdbs externW wFillBlock externW wwMac externW vpdrfHead externW caTapAux externW vmpitccpAux externW vtapFetchAux externW vitcMicAux endif ;DEBUG sEnd data ; CODE SEGMENT _EDIT sBegin edit assumes cs,edit assumes ds,dgroup assumes ss,dgroup include asserth.asm ;------------------------------------------------------------------------- ; AdjustCp(pca, dcpIns) ;------------------------------------------------------------------------- ;/* A D J U S T C P */ ;/* Adjust all cp's > cpFirst by dcpIns - dcpDel. ;Invalidation must have been done prior to this. ;Piece tables are adjusted elsewhere. ;*/ ;AdjustCp(pca, dcpIns) ;struct CA *pca; ;CP dcpIns; ;{ ; int ww; ; int doc = pca->doc; ; struct WWD *pwwd; ; struct DOD *pdod = PdodDoc(doc); ; int fFixMacEntry; ; int isels; ; int idr, idrMac; ; struct DR *pdr; ; struct SELS *pselsT; ; CP dcpAdj = dcpIns - DcpCa(pca); ; CP cp1, cpFirstDel, cpLimDel, cpMac, cpT; ; extern struct PL **vhplbmc; ; %%Function:N_AdjustCp %%Owner:BRADV cProc N_AdjustCp,<PUBLIC,FAR>,<si,di> ParmW <pca> ParmD <dcpIns> LocalW doc LocalW pdod LocalW fDontFixMacEntry LocalW pselsLim LocalW pcpMac LocalW pdrMac LocalD dcpAdj LocalD cp1 LocalW pbmcFirst ifdef DEBUG LocalV rgchAdjustCp,10 endif ;DEBUG cBegin ifdef DEBUG push cx push si push di push ds push es push cs pop ds push ss pop es mov si,offset szAdjustCp lea di,[rgchAdjustCp] mov cx,cbSzAdjustCp rep movsb jmp short AC005 szAdjustCp: db 'AdjustCp',0 cbSzAdjustCp equ $ - szAdjustCp errnz <cbSzAdjustCp - 9> AC005: pop es pop ds pop di pop si pop cx endif ;DEBUG mov si,[pca] mov bx,[si.docCa] mov [doc],bx ;LN_PdodDocEdit assumes doc passed in bx and performs ;PdodDoc(doc). Only bx is altered. call LN_PdodDocEdit mov [pdod],bx ; CP dcpAdj = dcpIns - DcpCa(pca); mov ax,[OFF_dcpIns] mov dx,[SEG_dcpIns] ;***Begin in line DcpCa ;return (pca->cpLim - pca->cpFirst); sub ax,[si.LO_cpLimCa] sbb dx,[si.HI_cpLimCa] add ax,[si.LO_cpFirstCa] adc dx,[si.HI_cpFirstCa] ;***End in line DcpCa mov [OFF_dcpAdj],ax mov [SEG_dcpAdj],dx ; Scribble(ispAdjustCp,'A'); ifdef DEBUG cmp [vdbs.grpfScribbleDbs],0 jz AC01 push ax push bx push cx push dx mov ax,ispAdjustCp mov bx,'A' cCall ScribbleProc,<ax,bx> pop dx pop cx pop bx pop ax AC01: endif ;DEBUG ; if (dcpAdj == 0) ; return; mov cx,ax or cx,dx jne Ltemp003 jmp AC37 Ltemp003: ; Assert(cHpFreeze==0); ifdef DEBUG cmp [cHpFreeze],0 je AC02 push ax push bx push cx push dx mov ax,midEditn mov bx,1001 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax AC02: endif ;DEBUG ; FreezeHp(); ifdef DEBUG call LN_FreezeHpEdit endif ;DEBUG ; pdod = PdodDoc(doc); ;Assembler note: pdod already exists in bx. ; fFixMacEntry = (pca->cpFirst == CpMac2Doc(doc)); mov cx,[si.LO_cpFirstCa] mov di,[si.HI_cpFirstCa] ;***Begin in line CpMac2Doc ;return ((*mpdochdod[doc]->cpMac); sub cx,[bx.LO_cpMacDod] sbb di,[bx.HI_cpMacDod] ;***End in line CpMac2Doc or cx,di mov [fDontFixMacEntry],cx ; cpMac = (pdod->cpMac += dcpAdj); add [bx.LO_cpMacDod],ax adc [bx.HI_cpMacDod],dx mov ax,[bx.LO_cpMacDod] mov dx,[bx.HI_cpMacDod] ; if (cpMac >= cpWarnTooBig || cpMac < 0) ; { or dx,dx jl AC03 errnz <LO_cpWarnTooBig> cmp dx,HI_cpWarnTooBig jb AC05 AC03: ; MeltHp(); ifdef DEBUG call LN_MeltHpEdit endif ;DEBUG ; /* this alert will probably be our last act... */ ; ErrorEid(eidCpRollOver, "AdjustCp"); mov ax,eidCpRollOver push ax ifdef DEBUG lea ax,[rgchAdjustCp] push ax endif ;DEBUG cCall ErrorEidProc,<> ; FreezeHp(); ifdef DEBUG call LN_FreezeHpEdit endif ;DEBUG mov bx,[doc] ;LN_PdodDocEdit assumes doc passed in bx and performs ;PdodDoc(doc). Only bx is altered. call LN_PdodDocEdit mov [pdod],bx ; } AC05: ; cp1 = pca->cpFirst + 1; mov ax,1 cwd add ax,[si.LO_cpFirstCa] adc dx,[si.HI_cpFirstCa] mov [OFF_cp1],ax mov [SEG_cp1],dx ; /* note: this corrects hplchdd, hplcfnd, hplcglsy which all reside at ; the same dod location */ ; AdjustHplc(pdod->hplchdd, cp1, dcpAdj, -1); ; AdjustHplc(hplc = pdod->hplcphe, cp1, dcpAdj, -1); ; if (hplc && (CpPlc(hplc, 0) < cp0)) ; PutCpPlc(hplc, 0, cp0); ; AdjustHplc(pdod->hplcpgd, cp1, dcpAdj, -1); ; AdjustHplc(pdod->hplcfld, pca->cpFirst, dcpAdj, -1); ; if (!pdod->fShort) ; { ; AdjustHplc(pdod->hplcbkf, cp1, dcpAdj, -1); ; AdjustHplc(pdod->hplcbkl, cp1, dcpAdj, -1); ; AdjustHplc(pdod->hplcatrd, pca->cpFirst/*sic*/, dcpAdj, -1); ; AdjustHplc(pdod->hplcfrd, pca->cpFirst/*sic*/, dcpAdj, -1); ; AdjustHplc(pdod->hplcsed, cp1, dcpAdj, -1); ; if (pdod->fSea) ; AdjustHplc(pdod->hplcsea, cp1, dcpAdj, -1); ; AdjustHplc(pdod->hplcpad, cp1, dcpAdj, -1); ; } mov si,offset rgOffsetHplcShort mov di,offset rgOffsetHplcLong AC06: lods wptr cs:[si] mov bl,ah xor bh,bh add bx,[pdod] mov cx,[bx] errnz <hNil> jcxz AC08 push cx ;push hplc cbw cwd add ax,[OFF_cp1] adc dx,[SEG_cp1] push dx push ax push [SEG_dcpAdj] push [OFF_dcpAdj] mov cx,-1 push cx push cs call near ptr AdjustHplc AC08: cmp si,di jb AC06 cmp di,offset rgOffsetHplcMac je AC10 mov bx,[pdod] ; if (hplc && (CpPlc(hplc, 0) < cp0)) ; PutCpPlc(hplc, 0, cp0); mov cx,[bx.hplcPheDod] jcxz AC087 push bx ;save pdod push cx ;save hplc xor ax,ax cCall CpPlc,<cx, ax> pop cx ;restore hplc or dx,dx jge AC083 xor ax,ax cCall PutCpPlc,<cx, ax, ax, ax> AC083: pop bx ;restore pdod AC087: cmp [bx.fShortDod],fFalse jne AC10 mov di,offset rgOffsetHplcMac ;Assert (pdod->fSea || pdod->hplcsea == hNil); ifdef DEBUG call AC42 endif ;DEBUG jmp short AC06 rgOffsetHplcShort: dw 00000h + ((hplchddDod) SHL 8) dw 00000h + ((hplcpheDod) SHL 8) dw 00000h + ((hplcpgdDod) SHL 8) dw 000FFh + ((hplcfldDod) SHL 8) rgOffsetHplcLong: dw 00000h + ((hplcbkfDod) SHL 8) dw 00000h + ((hplcbklDod) SHL 8) dw 000FFh + ((hplcatrdDod) SHL 8) dw 000FFh + ((hplcfrdDod) SHL 8) dw 00000h + ((hplcsedDod) SHL 8) dw 00000h + ((hplcseaDod) SHL 8) dw 00000h + ((hplcpadDod) SHL 8) rgOffsetHplcMac: AC10: ; /* if we were inserting at end of document, the CP for iMac will still ; be set to cpFirst for those PLCs for which no entries were added. ; We force the iMac CP for each PLC to be the newly adjusted ; CpMacDoc() value. */ ; if (fFixMacEntry) ; CorrectDodPlcs(doc, CpMac2Doc(doc)); cmp [fDontFixMacEntry],fFalse jne AC11 push [doc] ;***Begin in line CpMac2Doc ;return ((*mpdochdod[doc]->cpMac); mov bx,[pdod] push [bx.HI_cpMacDod] push [bx.LO_cpMacDod] ;***End in line CpMac2Doc cCall CorrectDodPlcs,<> AC11: ; /* no need to adjust caRulerSprm, it should have been flushed */ ; Assert( doc == docUndo || vrulss.caRulerSprm.doc == docNil ); ifdef DEBUG cmp [doc],docUndo je AC12 cmp [vrulss.caRulerSprmRulss.docCa],docNil je AC12 push ax push bx push cx push dx mov ax,midEditn mov bx,1003 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax AC12: endif ;DEBUG ; AdjustCa(&caPara, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; AdjustCa(&caPage, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; AdjustCa(&caSect, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; AdjustCa(&caHdt, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; AdjustCa(&vfls.ca, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; AdjustCa(&caTable, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; AdjustCa(&caTap, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; AdjustCa(&vtcc.ca, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; AdjustCa(&caTapAux, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; AdjustCa(&vtcxs.ca, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; AdjustCa(&vlcb.ca, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; AdjustCa(&vsab.caCopy, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; Assert(caAdjust.doc == docNil || cCaAdjust == 1); ; AdjustCa(&caAdjust, doc, pca->cpFirst, pca->cpLim, dcpAdj); ; Assert(caAdjustL.doc == docNil || cCaAdjustL == 1); ; AdjustCa(&caAdjustL, doc, pca->cpFirst, pca->cpLim, dcpAdj); ifdef DEBUG cmp [caAdjust.docCa],docNil je AC13 cmp [cCaAdjust],1 jne AC131 AC13: cmp [caAdjustL.docCa],docNil je AC132 cmp [cCaAdjustL],1 je AC132 AC131: push ax push bx push cx push dx mov ax,midEditn mov bx,1004 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax AC132: endif ;DEBUG mov cx,[doc] mov di,[pca] mov si,offset rgOffsetCa - 2 push si AC14: pop si cmp si,offset rgOffsetCaMac - 2 je AC145 inc si inc si push si mov si,cs:[si] ;LN_AdjustCa can only be used as a near call from AdjustCp ;or near subroutines of AdjustCp. ;It takes pca in si, doc in cx, cpFirstDel in di.cpFirstCa, ;cpLimDel in di.cpLimCa, dcp in AdjustCp's dcpAdj. ;ax, bx and dx are altered. call LN_AdjustCa jmp short AC14 ; } ;} rgOffsetCa: dw dataoffset [caPara] dw dataoffset [caPage] dw dataoffset [caSect] dw dataoffset [caHdt] dw dataoffset [vfls.caFls] dw dataoffset [caTable] dw dataoffset [caTap] dw dataoffset [vtcc.caTcc] dw dataoffset [vtcc.caTapTcc] dw dataoffset [caTapAux] dw dataoffset [vtcxs.caTcxs] dw dataoffset [vlcb.caLcb] dw dataoffset [vsab.caCopySab] dw dataoffset [caAdjust] dw dataoffset [caAdjustL] rgOffsetCaMac: AC145: ; if (vhplbmc != hNil) ; { ifdef DEBUG call LN_FreezeHpEdit endif ;DEBUG mov si,[vhplbmc] errnz <hNil> or si,si je AC16 ; int ibmc; ; struct BMC *pbmc; ; ; FreezeHp(); ; for (ibmc = (*vhplbmc)->iMac - 1, pbmc = PInPl(vhplbmc,ibmc); ; ibmc >= 0; ibmc--, pbmc--) ; { mov si,[si] ifdef DEBUG push ax push bx push cx push dx cmp [si.fExternalPl],fFalse je AC147 mov ax,midEditn mov bx,1060 cCall AssertProcForNative,<ax,bx> AC147: cmp [si.cbPl],cbBmcMin je AC148 mov ax,midEditn mov bx,1061 cCall AssertProcForNative,<ax,bx> AC148: pop dx pop cx pop bx pop ax endif ;DEBUG mov ax,cbBmcMin mul [si.iMacPl] add si,[si.brgfooPl] mov [pbmcFirst],si add si,ax AC15: sub si,cbBmcMin cmp si,[pbmcFirst] jb AC16 ; AdjustCa(&pbmc->ca, doc, cpFirstDel, cpLimDel, dcpAdj); ; } ; MeltHp(); ; } ;LN_AdjustCa can only be used as a near call from AdjustCp ;or near subroutines of AdjustCp. ;It takes pca in si, doc in cx, cpFirstDel in di.cpFirstCa, ;cpLimDel in di.cpLimCa, dcp in AdjustCp's dcpAdj. ;ax, bx and dx are altered. errnz <(caBmc) - 0> call LN_AdjustCa jmp short AC15 AC16: ifdef DEBUG call LN_MeltHpEdit endif ;DEBUG ; /* BLOCK - Adjust vmpitccp used to cache known cell boundaries for ; the current table row. */ ; { ; CP *pcp, *pcpMac; ; int ccp; ; ; if ( caTap.doc==doc && caTap.cpLim >= cp1 && ; (ccp=vtapFetch.itcMac+1+1-vitcMic) > 0 ) ; /* plus 1 for ttp, 1 for fencepost rule */ ; { ifdef DEBUG push ax push bx push cx push dx mov ax,dataoffset [caTap] sub ax,dataoffset [caTapAux] mov bx,dataoffset [vmpitccp] sub bx,dataoffset [vmpitccpAux] cmp ax,bx je AC162 mov ax,midEditn mov bx,1050 cCall AssertProcForNative,<ax,bx> AC162: mov ax,dataoffset [caTap] sub ax,dataoffset [caTapAux] mov bx,dataoffset [vtapFetch] sub bx,dataoffset [vtapFetchAux] cmp ax,bx je AC163 mov ax,midEditn mov bx,1053 cCall AssertProcForNative,<ax,bx> AC163: mov ax,dataoffset [caTap] sub ax,dataoffset [caTapAux] mov bx,dataoffset [vitcMic] sub bx,dataoffset [vitcMicAux] cmp ax,bx je AC164 mov ax,midEditn mov bx,1054 cCall AssertProcForNative,<ax,bx> AC164: pop dx pop cx pop bx pop ax endif ;DEBUG xor di,di AC165: mov bx,[pca] mov cx,[bx.HI_cpFirstCa] mov bx,[bx.LO_cpFirstCa] mov ax,[OFF_dcpAdj] mov dx,[SEG_dcpAdj] mov si,[doc] cmp [di.caTap.docCa],si jne AC20 ;Assembler note: we are really using one less than the cp1, so ;we are looking for "<=" rather than "<" here. cmp bx,[di.caTap.LO_cpLimCa] push cx sbb cx,[di.caTap.HI_cpLimCa] pop cx jge AC20 mov si,[di.vtapFetch.itcMacTap] inc si inc si sub si,[di.vitcMic] jle AC20 ; pcpMac = (pcp = &vmpitccp[vitcMic]) + ccp; shl si,1 shl si,1 mov [pcpMac],si mov si,[di.vitcMic] shl si,1 shl si,1 add si,dataoffset [vmpitccp] add si,di add [pcpMac],si ;Assembler note: we are really using one less than the cp1, so ;we are looking for "<=" rather than "<" here. ; while ( *(pcp++) < cp1 ) ; ; AC17: add si,4 cmp bx,[si-4] push cx sbb cx,[si-2] pop cx jge AC17 ; --pcp; sub si,8 ; while ( pcp < pcpMac ) ; *(pcp++) += dcpAdj; jmp short AC19 AC18: add [si],ax adc [si+2],dx AC19: add si,4 cmp si,[pcpMac] jb AC18 ; } ; } AC20: ; if ( caTapAux.doc==doc && caTapAux.cpLim >= cp1 && ; (ccp=vtapFetchAux.itcMac+1+1-vitcMicAux) > 0 ) ; /* plus 1 for ttp, 1 for fencepost rule */ ; { ; pcpMac = (pcp = &vmpitccpAux[vitcMicAux]) + ccp; ; while ( *(pcp++) < cp1 ) ; ; ; --pcp; ; while ( pcp < pcpMac ) ; *(pcp++) += dcpAdj; ; } mov cx,di mov di,dataoffset [caTapAux] sub di,dataoffset [caTap] jcxz AC165 mov di,[doc] ; for (isels = 0, pselsT = &rgselsInsert[0]; isels < iselsInsertMax; isels++, pselsT++) ; { ; if (pselsT->doc == doc) ; { ; AdjustSels(pselsT, cp1, dcpAdj); ; if (pselsT->sk == skBlock) ; pselsT->sk = skSel; /* prevent illegal block sel */ ; } ; } mov [pselsLim],dataoffset [rgselsInsert + iselsInsertMax * cbSelsMin] mov si,dataoffset [rgselsInsert] AC21: errnz <iselsInsertMax - 4> cmp [si.docSel],di jne AC22 ;AC44 takes psel in si, doc in di, and pca, dcpAdjust from AdjustCp's ;stack. It performs AdjustSels(psel, cpFirst, cpLim, dcpAdj) and ;if (psels->sk == skBlock) ; psels->sk = skSel; /* prevent illegal block sel */ ;ax, bx, cx, dx are altered. call AC44 AC22: add si,cbSelsMin cmp si,[pselsLim] jb AC21 ; FreezeHp(); ifdef DEBUG call LN_FreezeHpEdit endif ;DEBUG ; /* adjust all dr's in all wwd's displaying doc */ ; for (ww = PdodMother(doc)->wwDisp; ww != wwNil; ww = pwwd->wwDisp) ; { cCall N_PdodMother,<di> xchg ax,si mov al,[si.wwDispDod] xor ah,ah xchg ax,si AC23: errnz <wwNil - 0> or si,si je Ltemp002 ; pwwd = PwwdWw(ww); shl si,1 mov si,[si.mpwwhwwd] ;Assert (hwwd != hNil) with a call so as not to mess up short jumps. ifdef DEBUG call AC40 endif ;DEBUG mov si,[si] ; idrMac = pwwd->idrMac; push si ;save pwwd mov ax,cbDrMin mul [si.idrMacWwd] add si,(rgdrWwd) add ax,si mov [pdrMac],ax jmp short AC245 Ltemp002: jmp AC335 ;Assembler note: fDocFound is not used, so don't set it. ; fDocFound = fFalse; ; for (pdr = pwwd->rgdr, idr = 0; idr < idrMac; ++idr, ++pdr) ; { AC24: add si,cbDrMin AC245: cmp si,[pdrMac] jb Ltemp001 jmp AC31 Ltemp001: ; if (pdr->doc != doc) ; continue; cmp [si.docDr],di jne AC24 ;Assembler note: fDocFound is not used, so don't set it. ; fDocFound = fTrue; ; /* check dr.cpFirst */ ; if (pdr->cpFirst >= cp1) ; { mov ax,[si.LO_cpFirstDr] mov dx,[si.HI_cpFirstDr] cmp ax,[OFF_cp1] push dx sbb dx,[SEG_cp1] pop dx jl AC25 ; if (pdr->cpFirst < pca->cpLim) ; { ; pdr->cpFirst = pca->cpFirst; ; pdr->fCpBad = fTrue; ; pwwd->fSetElev = fTrue; ; } ; else ; pdr->cpFirst += dcpAdj; mov cx,[OFF_dcpAdj] add [si.LO_cpFirstDr],cx mov cx,[SEG_dcpAdj] adc [si.HI_cpFirstDr],cx mov bx,[pca] sub ax,[bx.LO_cpLimCa] sbb dx,[bx.HI_cpLimCa] jge AC25 mov ax,[bx.LO_cpFirstCa] mov dx,[bx.HI_cpFirstCa] mov [si.LO_cpFirstDr],ax mov [si.HI_cpFirstDr],dx or [si.fCpBadDr],maskFCpBadDr pop bx ;restore pwwd push bx ;save pwwd or [bx.fSetElevWwd],maskFSetElevWwd ; } AC25: ; /* check dr.cpLim */ ; if (pdr->cpLim != cpNil && pdr->cpLim >= cp1) ; { mov ax,[si.LO_cpLimDr] mov dx,[si.HI_cpLimDr] errnz <LO_cpNil - 0FFFFh> errnz <HI_cpNil - 0FFFFh> mov cx,ax and cx,dx inc cx je AC29 cmp ax,[OFF_cp1] push dx sbb dx,[SEG_cp1] pop dx jl AC29 ; if (pdr->cpLim < pca->cpLim && pdr->idrFlow != idrNil) ; { mov bx,[pca] cmp ax,[bx.LO_cpLimCa] push dx sbb dx,[bx.HI_cpLimCa] pop dx jge AC26 cmp [si.idrFlowDr],idrNil je AC26 ; pdr->cpLim = cpNil; ; /* REVIEW: pwwd->fSetElev = fTrue; */ ; } errnz <LO_cpNil - 0FFFFh> errnz <HI_cpNil - 0FFFFh> mov ax,LO_cpNil cwd jmp short AC28 ; else ; { AC26: ; /* adjust dr.cpLim; it is now suspect */ ; pdr->cpLim += dcpAdj; ; pdr->fLimSuspect = pdr->idrFlow != idrNil; and [si.fLimSuspectDr],NOT maskFLimSuspectDr cmp [si.idrFlowDr],idrNil je AC27 or [si.fLimSuspectDr],maskFLimSuspectDr AC27: add ax,[OFF_dcpAdj] adc dx,[SEG_dcpAdj] AC28: mov [si.LO_cpLimDr],ax mov [si.HI_cpLimDr],dx ; } ; } AC29: ; if (pdr->hplcedl != hNil) ; AdjustHplcedlCps(pdr->hplcedl, cp1, dcpAdj); mov cx,[si.hplcedlDr] ;AC38 performs AdjustHplcedlCps(cx,cp1,dcpAdj) if cx != 0; ;ax, bx, cx, dx are altered. call AC38 AC30: ; } /* next dr */ jmp AC24 AC31: pop si ;restore pwwd ; if (doc == pwwd->sels.doc) ; { ; AdjustSels(&pwwd->sels, cp1, dcpAdj); ; if (pwwd->sels.sk == skBlock) ; pwwd->sels.sk = skSel; /* prevent illegal block sel */ ; } cmp di,[si.selsWwd.docSel] jne AC32 push si ;save pwwd add si,(selsWwd) ;AC44 takes psel in si, doc in di, and pca, dcpAdjust from AdjustCp's ;stack. It performs AdjustSels(psel, cpFirst, cpLim, dcpAdj) and ;if (psels->sk == skBlock) ; psels->sk = skSel; /* prevent illegal block sel */ ;ax, bx, cx, dx are altered. call AC44 pop si ;restore pwwd AC32: ; } /* next ww */ mov si,[si.wwDispWwd] jmp AC23 AC335: ; MeltHp(); ifdef DEBUG call LN_MeltHpEdit endif ;DEBUG ; if (doc == selCur.doc) ; { cmp di,[selCur.docSel] jne AC33 ; selCur.cpFirstLine = cpNil; /* no anchor for block sel */ errnz <LO_cpNil - 0FFFFh> errnz <HI_cpNil - 0FFFFh> mov ax,LO_cpNil mov [selCur.LO_cpFirstLineSel],ax mov [selCur.HI_cpFirstLineSel],ax ; AdjustSels(&selCur, cp1, dcpAdj); ;LN_AdjustSels takes psel in si, doc in di, and pca, dcpAdjust ;from AdjustCp's stack. ax, bx, cx, dx are altered. mov si,dataoffset [selCur] call LN_AdjustSels ; } AC33: ; if (doc == vsccAbove.doc) ; AdjustHplcedlCps(vsccAbove.hplcedl, cp1, dcpAdj); cmp di,[vsccAbove.rgdrWwd.docDr] jne AC35 mov cx,[vsccAbove.rgdrWwd.hplcedlDr] ;AC38 performs AdjustHplcedlCps(cx,cp1,dcpAdj) if cx != 0; ;ax, bx, cx, dx are altered. call AC38 AC35: ;/* invalidate sequential fetch */ ; if (doc == vdocFetch) ; vdocFetch = docNil; cmp di,[vdocFetch] jne AC355 mov [vdocFetch],docNil AC355: ; Scribble(ispAdjustCp,' '); ifdef DEBUG cmp [vdbs.grpfScribbleDbs],0 jz AC36 push ax push bx push cx push dx mov ax,ispAdjustCp mov bx,' ' cCall ScribbleProc,<ax,bx> pop dx pop cx pop bx pop ax AC36: endif ;DEBUG ; MeltHp(); ifdef DEBUG call LN_MeltHpEdit endif ;DEBUG AC37: ;} cEnd ;AC38 performs AdjustHplcedlCps(cx,cp1,dcpAdj) if cx != 0; ;ax, bx, cx, dx are altered. AC38: jcxz AC39 ifdef DEBUG cCall S_AdjustHplcedlCps,<cx,[SEG_cp1],[OFF_cp1],[SEG_dcpAdj],[OFF_dcpAdj]> else ;!DEBUG cCall LN_AdjustHplcedlCps,<cx,[SEG_cp1],[OFF_cp1],[SEG_dcpAdj],[OFF_dcpAdj]> endif ;!DEBUG AC39: ret ;Assert (hwwd != hNil); ifdef DEBUG AC40: cmp si,hNil jne AC41 push ax push bx push cx push dx mov ax,midEditn mov bx,1005 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax AC41: ret endif ;DEBUG ;Assert (pdod->fSea || pdod->hplcsea == hNil); ifdef DEBUG AC42: test [bx.fSeaDod],maskFSeaDod jne AC43 cmp [bx.hplcseaDod],hNil je AC43 push ax push bx push cx push dx mov ax,midEditn mov bx,1002 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax AC43: ret endif ;DEBUG ;AC44 takes psel in si, doc in di, and pca, dcpAdjust from AdjustCp's ;stack. It performs AdjustSels(psel, cpFirst, cpLim, dcpAdj) and ;if (psels->sk == skBlock) ; psels->sk = skSel; /* prevent illegal block sel */ ;ax, bx, cx, dx are altered. AC44: ;LN_AdjustSels takes psel in si, doc in di, and pca, dcpAdjust ;from AdjustCp's stack. ax, bx, cx, dx are altered. call LN_AdjustSels mov al,[si.skSel] and al,maskSkSel cmp al,skBlock SHL ibitSkSel jne AC45 errnz <skSelConst> and [si.skSel],NOT maskSkSel AC45: ret ;/* A D J U S T S E L S */ ;/* adjust selection ;*/ ;AdjustSels(psels, cpFirst, cpLim, dcpAdj) ;struct SELS *psels; ;CP cpFirst, cpLim, dcpAdj; ;{ ;LN_AdjustSels takes psel in si, doc in di, and pca, dcpAdjust ;from AdjustCp's stack. ax, bx, cx, dx are altered. PUBLIC LN_AdjustSels LN_AdjustSels: ;Assert (psels->doc == doc); ifdef DEBUG cmp [si.docSel],di je AS003 push ax push bx push cx push dx mov ax,midEditn mov bx,1006 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax AS003: endif ;DEBUG ; if (psels->cpFirst >= cpFirst && psels->cpFirst < cpLim || ; psels->fTable && psels->cpLim > cpFirst && psels->cpFirst <= cpLim) ; coded as (you're gonna love this...): ; if (psels->cpFirst <= cpLim && ; (psels->cpFirst != cpLim && psels->cpFirst >= cpFirst ; || psels->fTable && psels->cpLim > cpFirst)) ;/* part of selection has been deleted */ ; { mov bx,[pca] mov ax,[bx.LO_cpLimCa] mov dx,[bx.HI_cpLimCa] sub ax,[si.LO_cpFirstSel] sbb dx,[si.HI_cpFirstSel] jl AS01 or ax,dx jz AS0045 AS004: mov ax,[si.LO_cpFirstSel] mov dx,[si.HI_cpFirstSel] sub ax,[bx.LO_cpFirstCa] sbb dx,[bx.HI_cpFirstCa] jge AS005 AS0045: test [si.fTableSel],maskfTableSel jz AS01 mov ax,[bx.LO_cpFirstCa] mov dx,[bx.HI_cpFirstCa] sub ax,[si.LO_cpLimSel] sbb dx,[si.HI_cpLimSel] jge AS01 AS005: ; psels->cpFirst = cpFirst; ; psels->cpLim = cpFirst; ; psels->cpAnchor = cpFirst; ; psels->cpAnchorShrink = cpFirst; ; /*psels->sk = skIns; done below */ mov ax,[bx.LO_cpFirstCa] mov dx,[bx.HI_cpFirstCa] mov [si.LO_cpFirstSel],ax mov [si.HI_cpFirstSel],dx mov [si.LO_cpLimSel],ax mov [si.HI_cpLimSel],dx mov [si.LO_cpAnchorSel],ax mov [si.HI_cpAnchorSel],dx mov [si.LO_cpAnchorShrinkSel],ax mov [si.HI_cpAnchorShrinkSel],dx jmp AS07 ; } ; else AS01: ; { ;FUTURE: bradv (bcv): The following two lines appear to be attempting ;redundant coding of what is being done in AdjustCa, but I can't ;be sure. I would love to get rid of this, but I don't dare on ;the eve of RC2. ; if (psels->cpLim >= cpFirst && psels->cpLim < cpLim) ; dcpAdj = cpFirst - psels->cpLim; push [SEG_dcpAdj] push [OFF_dcpAdj] ;save dcpAdj mov ax,[si.LO_cpLimSel] mov dx,[si.HI_cpLimSel] cmp ax,[bx.LO_cpLimCa] push dx sbb dx,[bx.HI_cpLimCa] pop dx jns AS02 sub ax,[bx.LO_cpFirstCa] sbb dx,[bx.HI_cpFirstCa] js AS02 neg dx neg ax sbb dx,0 mov [OFF_dcpAdj],ax mov [SEG_dcpAdj],dx AS02: ; AdjustCa(&psels->ca, psels->doc, cpFirst, cpLim, dcpAdj); ;LN_AdjustCa can only be used as a near call from AdjustCp ;or near subroutines of AdjustCp. ;It takes pca in si, doc in cx, cpFirstDel in di.cpFirstCa, ;cpLimDel in di.cpLimCa, dcp in AdjustCp's dcpAdj. ;ax, bx and dx are altered. push si push di mov cx,di mov di,bx add si,(caSel) call LN_AdjustCa mov bx,di pop di pop si pop [OFF_dcpAdj] ;restore dcpAdj pop [SEG_dcpAdj] ;Assembler note: We are really checking "> cpFirst" here. ; if (psels->cpAnchor >= cpFirst + 1) ; psels->cpAnchor += dcpAdj; mov ax,[OFF_dcpAdj] mov dx,[SEG_dcpAdj] mov cx,[bx.HI_cpFirstCa] mov bx,[bx.LO_cpFirstCa] cmp bx,[si.LO_cpAnchorSel] push cx sbb cx,[si.HI_cpAnchorSel] pop cx jge AS05 add [si.LO_cpAnchorSel],ax adc [si.HI_cpAnchorSel],dx AS05: ; if (psels->cpAnchorShrink >= cpFirst + 1) ; psels->cpAnchorShrink += dcpAdj; sub bx,[si.LO_cpAnchorShrinkSel] sbb cx,[si.HI_cpAnchorShrinkSel] jge AS06 add [si.LO_cpAnchorShrinkSel],ax adc [si.HI_cpAnchorShrinkSel],dx AS06: ; } AS07: ; /* "Correct" behavior is not well-defined here. We have edited ; /* characters within the selection. To be safe, we turn the ; /* selection into and insertion point so as to not cause problems ; /* elsewhere (particulary with table and block selections). ; /**/ ; if (psels->sk != skIns && psels->cpFirst == psels->cpLim) ; { mov al,[si.skSel] and al,maskSkSel cmp al,skIns SHL ibitSkSel je AS10 mov ax,[si.LO_cpFirstSel] mov dx,[si.HI_cpFirstSel] sub ax,[si.LO_cpLimSel] sbb dx,[si.HI_cpLimSel] or ax,dx jne AS10 ; psels->sk = skIns; and [si.skSel],NOT maskSkSel or [si.skSel],skIns SHL ibitSkSel ;/* selCur at Mac can happen temporarily because of deletions at the end ;of the doc */ ; if (psels->cpFirst < CpMacDoc(psels->doc)) ; SetSelCellBits(psels); mov bx,[si.docSel] ;***Begin in line CpMacDoc ;return ((*mpdochdod[doc]->cpMac - 2*ccpEop); ;LN_PdodDocEdit assumes doc passed in bx and performs ;PdodDoc(doc). Only bx is altered. call LN_PdodDocEdit mov ax,2*ccpEop cwd sub ax,[bx.LO_cpMacDod] sbb dx,[bx.HI_cpMacDod] ;***End in line CpMacDoc add ax,[si.LO_cpFirstSel] adc dx,[si.HI_cpFirstSel] jge AS09 cCall SetSelCellBits,<si> AS09: ; if (psels == &selCur) ; GetSelCurChp(fTrue); cmp si,dataoffset [selCur] jne AS10 mov ax,fTrue cCall GetSelCurChp,<ax> ; } AS10: ;} ret ;------------------------------------------------------------------------- ; AdjustCa(pca, doc, cpFirst, dcp) ;------------------------------------------------------------------------- ;/* A D J U S T C A */ ;/* adjust all cp's >= cpFirst by dcp ;*/ ;/* %%Function:AdjustCa %%Owner:peterj %%reviewed: 6/28/89 */ ;/* We have just replaced [cpFirstDel,cpLimDel) with new text ;/* which has "dcp" more characters than the original. (dcp will ;/* be negative if the replacement was shorter.) We now have some ;/* CA which may have to be adjusted. If the deleted range and the ;/* CA range overlap, then we must leave CA pointing to "safe" CPs. ;/* There are six ways in which the deleted and CA ranges may ;/* intersect. ;/* ;/* cp0 [ inserted ) . -> cpMac ;/* . | <- dcp -> | ;/* [ deleted ) ;/* Case: . . Action: ;/* 1 [) . . Do nothing ;/* 2 [ .) . cpLim = cpFirstDel ;/* 3 [ . ) cpLim += dcp ;/* 4 [) . set both CPs to cpFirstDel ;/* 5 [ ) cpFirst = cpFirstDel ;/* 6 . [ ) adjust both CPs by dcp ;/* ;/* Each "case" is represented by the left-most element of the class. ;/* That is, each '[' can be moved to the right until it hits the ')'. ;/* If the '[' in the next case begins in the same position, then the ')' ;/* in the current case can advance to just in front of the ')' in the ;/* next case; otherwise it can advance arbitrarily. ;/* ;/**/ ;AdjustCa(pca, doc, cpFirstDel, cpLimDel, dcp) ;struct CA *pca; ;int doc; ;CP cpFirstDel, cpLimDel, dcp; ;{ ;LN_AdjustCa can only be used as a near call from AdjustCp ;or near subroutines of AdjustCp. ;It takes pca in si, doc in cx, cpFirstDel in di.cpFirstCa, ;cpLimDel in di.cpLimCa, dcp in AdjustCp's dcpAdj. ;ax, bx and dx are altered. LN_AdjustCa: ; Assert (pca->cpFirst <= pca->cpLim); ; Assert((cpLimDel - cpFirstDel) + dcp >= cp0); ;Do these asserts with a call so as not to mess up short jumps. ifdef DEBUG call ACa06 endif ;DEBUG ; if (pca->doc == doc) ; { cmp [si.docCa],cx jne ACa05 push cx ;save doc mov bx,(cpLimCa) - (cpFirstCa) ACa01: ; if (pca->cpFirst > cpFirstDel) ; { ; if (pca->cpFirst < cpLimDel) ; pca->cpFirst = cpFirstDel; ; else ; pca->cpFirst += dcp; ; } ; if (pca->cpLim > cpFirstDel) ; { ; if (pca->cpLim < cpLimDel) ; pca->cpLim = cpFirstDel; ; else ; pca->cpLim += dcp; ; } ;Assembler note: use AdjustCp's pca->cpFirst for cpFirstDel, ;AdjustCp's pca->cpLim for cpLimDel, and AdjustCp's ;dcpAdjust for dcpAdjust. mov ax,[bx+si.LO_cpFirstCa] mov dx,[bx+si.HI_cpFirstCa] cmp [di.LO_cpFirstCa],ax mov cx,[di.HI_cpFirstCa] sbb cx,dx jge ACa04 cmp ax,[di.LO_cpLimCa] mov cx,dx sbb cx,[di.HI_cpLimCa] jl ACa02 add ax,[OFF_dcpAdj] adc dx,[SEG_dcpAdj] jmp short ACa03 ACa02: mov ax,[di.LO_cpFirstCa] mov dx,[di.HI_cpFirstCa] ACa03: mov [bx+si.LO_cpFirstCa],ax mov [bx+si.HI_cpFirstCa],dx ACa04: errnz <(cpFirstCa) - 0> errnz <(cpLimCa) - 4> sub bx,(cpLimCa)-(cpFirstCa) jge ACa01 pop cx ;restore doc ACa05: ret ; Assert (pca->cpFirst <= pca->cpLim); ; Assert((cpLimDel - cpFirstDel) + dcp >= cp0); ;Assembler note: use AdjustCp's pca->cpFirst for cpFirstDel, ;AdjustCp's pca->cpLim for cpLimDel, and AdjustCp's ;dcpAdjust for dcpAdjust. ifdef DEBUG ACa06: push ax push bx push cx push dx mov ax,[si.LO_cpLimCa] mov dx,[si.HI_cpLimCa] sub ax,[si.LO_cpFirstCa] sbb dx,[si.HI_cpFirstCa] jge ACa07 mov ax,midEditn mov bx,1051 cCall AssertProcForNative,<ax,bx> ACa07: mov ax,[di.LO_cpLimCa] mov dx,[di.HI_cpLimCa] sub ax,[di.LO_cpFirstCa] sbb dx,[di.HI_cpFirstCa] add ax,[OFF_dcpAdj] adc dx,[SEG_dcpAdj] jge ACa08 mov ax,midEditn mov bx,1052 cCall AssertProcForNative,<ax,bx> ACa08: pop dx pop cx pop bx pop ax ret endif ;DEBUG ;------------------------------------------------------------------------- ; LprgcpForPlc( pplc ) ;------------------------------------------------------------------------- ;/* L P R G C P F O R P L C */ ;native CP far *LprgcpForPlc(pplc) ;struct PLC *pplc; ;{ ;#ifdef ENABLE ; if (pplc->fExternal) ; return ((CP far *)LpFromHp(HpOfHq(pplc->hqplce))); ; else ;#endif ; return ((CP far *)pplc->rgcp); cProc LN_LprgcpForPlc,<NEAR,ATOMIC>,<> ; LN_LprgcpForPlc takes pplc in register bx, ; and returns the result in registers es:di. ; bx is not altered, ax, cx, dx are trashed. cBegin nogen ; expect pplc in bx, return HpOfHq(hqplce) in es:di, bx is not altered. include qplc.asm ;} cEnd nogen ret ; End of LN_LprgcpForPlc ;------------------------------------------------------------------------- ; AdjustHplc(hplc, cp, dcpNew, ipcdMin) ;------------------------------------------------------------------------- ;/* A D J U S T H P L C */ ;/* does lazy adjustment of hplc by maintaining an adjustment interval in PLC. ; the adjustment interval is [pplc->icpAdjust, pplc->iMac]. The amount to ; bias the rgcp entries in this interval is pplc->dcpAdjust. */ ;native AdjustHplc(hplc, cp, dcpNew, icpCertain) ;struct PLC **hplc; CP cp, dcpNew; ;int icpCertain; /* when not = -1, new adjustment index is known. */ ;{ ; struct PLC *pplc; ; int icpFenceOld, icpAdjustNew, icpFenceAfter; ; CP dcpOld, dcpAdjustAfter; ; int icpAdjustFirst, icpAdjustLim; ; CP dcpAdjust; ; int iMac; ; CP far *lprgcp; cProc AdjustHplc,<PUBLIC,FAR>,<si,di> ParmW hplc ParmD cp ParmD dcpNew ParmW icpCertain ifdef DEBUG LocalW bxSave endif ;DEBUG cBegin ; if ((int)hplc == 0 || dcpNew == 0) return; mov bx,[hplc] or bx,bx je Ltemp004 mov ax,[OFF_dcpNew] or ax,[SEG_dcpNew] je Ltemp004 ; pplc = *hplc; mov bx,[bx] ; iMac = pplc->iMac; ;/* REVIEW before shipment icpLinSrchThreshold should be set equal to the ; icpLim below which IInPlc performs linear searches and the following ; commented clause activated. When IInPlc does linear searches it's just as ; expensive as AdjustHplcCps() so lazy adjustment doesn't pay.*/ ;/* if (iMac < icpLinSrchThreshold && icpCertain == -1) ; { ; if (pplc->icpAdjust <= iMac) ; CompletelyAdjustHplcCps(hplc); ; AdjustHplcCps(hplc, cp, dcp, (icpCertain != 0) ? icpCertain : 0); ; return; ; } ;*/ ; icpFenceOld = pplc->icpAdjust; ; dcpOld = pplc->dcpAdjust; ; /* this is verbose because of native compiler bug */ ; if (icpCertain != -1) ; icpAdjustNew = icpCertain; mov ax,[icpCertain] cmp ax,-1 jne AH01 ; else if ((icpAdjustNew = IInPlcRef(hplc, cp)) == -1) ; return; /* nothing needs to be done */ cCall IInPlcRef,<[hplc],[SEG_cp],[OFF_cp]> cmp ax,-1 jne AH01 Ltemp004: jmp AH09 AH01: ; the following line is done below in the assembler version ; lprgcp = LprgcpForPlc(pplc); ; dcpAdjustAfter = dcpOld; ; icpFenceAfter = icpFenceOld; xor cx,cx ;clears fUseDcpNew, fUseIcpAdjustNew ; dcpAdjust = dcpNew; mov si,[OFF_dcpNew] mov di,[SEG_dcpNew] ;/* REVIEW this is the heuristic which decides whether the rgcp range in the ; middle of the plc or the rgcp range at the tail of the plc is incremented ; by cpAdjust. Executing either branch will produce correct results. We may ; try to develop heuristic which accounts for change of locality of new ; adjustments. */ ; if (iMac < 2 * max(icpFenceOld, icpAdjustNew) - ; min(icpFenceOld, icpAdjustNew)) ; { mov dx,[bx.icpAdjustPlc] push ax cmp dx,ax jge AH02 xchg ax,dx AH02: shl dx,1 sub dx,ax pop ax cmp [bx.iMacPlcSTR],dx jge AH03 ;/* this branch executed when we are going to execute AddDcpToCps for the ; tail of the plc. */ ; icpAdjustLim = iMac + 1; mov dx,[bx.iMacPlcSTR] inc dx ; if (icpAdjustNew <= icpFenceOld) ; { cmp ax,[bx.icpAdjustPlc] jg AH05 ; dcpAdjustAfter = dcpNew; ; icpFenceAfter = icpAdjustNew; dec cx ;sets fUseDcpNew, fUseIcpAdjustNew ; dcpAdjust = dcpOld; mov si,[bx.LO_dcpAdjustPlc] mov di,[bx.HI_dcpAdjustPlc] ; } ; } jmp short AH05 AH03: ; else ; { ;/* this branch executed when we are going to execute AddDcpToCps for the ; middle part of the plc. The tail will be the new adjustment interval. ; It's dcp will be the sum of the new and old dcp. */ ; dcpAdjustAfter = dcpOld + dcpNew; mov dx,[bx.LO_dcpAdjustPlc] add [OFF_dcpNew],dx mov dx,[bx.HI_dcpAdjustPlc] adc [SEG_dcpNew],dx inc ch ;sets fUseDcpNew ; if (icpAdjustNew <= icpFenceOld) cmp ax,[bx.icpAdjustPlc] jg AH04 ; icpAdjustLim = icpFenceOld; mov dx,[bx.icpAdjustPlc] jmp short AH05 AH04: ; else ; { ; icpAdjustLim = icpAdjustNew; mov dx,ax ; dcpAdjust = dcpOld; mov si,[bx.LO_dcpAdjustPlc] mov di,[bx.HI_dcpAdjustPlc] ; icpFenceAfter = icpAdjustNew; inc cx ;sets fUseIcpAdjustNew ; } ; } AH05: push dx ;save icpAdjustLim ; icpAdjustFirst = icpAdjustNew + icpFenceOld - ; (pplc->icpAdjust = icpFenceAfter); ; NOTE: we have ; icpAdjustNew in ax ; icpFenceOld in pplc->icpAdjust ; icpFenceAfter in cl ? ax : pplc->icpAdjust ; ==> icpAdjustFirst = cl ? pplc->icpAdjust : ax or cl,cl ;test fUseIcpAdjustNew je AH06 xchg ax,[bx.icpAdjustPlc] AH06: ; pplc->dcpAdjust = dcpAdjustAfter; or ch,ch ;test fUseDcpNew je AH07 mov dx,[OFF_dcpNew] mov [bx.LO_dcpAdjustPlc],dx mov dx,[SEG_dcpNew] mov [bx.HI_dcpAdjustPlc],dx AH07: push ax ;save icpAdjustFirst push di push si ;save dcpAdjust ; lprgcp = LprgcpForPlc(pplc); ifdef DEBUG mov [bxSave],bx endif ;DEBUG ; LN_LprgcpForPlc takes pplc in register bx, ; and returns the result in registers es:di. ; bx is not altered, ax, cx, dx are trashed. cCall LN_LprgcpForPlc,<> ifdef DEBUG ; Assert (bx == bxSave); cmp bx,[bxSave] je AH08 push ax push bx push cx push dx push es mov ax,midEditn mov bx,1007 cCall AssertProcForNative,<ax,bx> pop es pop dx pop cx pop bx pop ax AH08: endif ;DEBUG pop ax pop dx ;restore dcpAdjust pop bx ;restore icpAdjustFirst pop cx ;restore icpAdjustLim ; AddDcpToCps(lprgcp, icpAdjustFirst, icpAdjustLim, dcpAdjust); ; LN_AddDcpToCps takes lprgcp in es:di, icpFirst in bx, ; icpLim in cx, and dcp in dx:ax cCall LN_AddDcpToCps,<> AH09: ;} cEnd ; End of AdjustHplc ;------------------------------------------------------------------------- ; CompletelyAdjustHplcCps(hplc) ;------------------------------------------------------------------------- ;/* C O M P L E T E L Y A D J U S T H P L C C P S */ ;/* adds pplc->dcpAdjust to rgcp entries in interval ; [pplc->icpAdjust, pplc->iMac] and invalidates the adjustment interval ; recorded in plc. Should be called for each document's plcs when we ; return to the Idle loop. */ ;CompletelyAdjustHplcCps(hplc) ;struct PLC **hplc; ;{ ; %%Function:CompletelyAdjustHplcCps %%Owner:BRADV cProc CompletelyAdjustHplcCps,<PUBLIC,FAR>,<> ParmW hplc cBegin ; AdjustHplcCpsToLim(hplc, (*hplc)->iMac + 1); mov bx,[hplc] push bx mov bx,[bx] mov ax,[bx.iMacPlcSTR] inc ax push ax push cs call near ptr AdjustHplcCpsToLim cEnd ;} ; End of CompletelyAdjustHplcCps ;------------------------------------------------------------------------- ; AdjustHplcCpsToLim(hplc, icpLim) ;------------------------------------------------------------------------- ;/* A D J U S T H P L C C P S T O L I M */ ;/* adds pplc->dcpAdjust to rgcp entries in the interval ; [pplc->icpAdjust, icpLim). if rgcp[iMac] was adjusted we invalidate the ; plc's adjustment interval. */ ;AdjustHplcCpsToLim(hplc, icpLim) ;struct PLC **hplc; ;int icpLim; ;{ ; struct PLC *pplc; ; %%Function:AdjustHplcCpsToLim %%Owner:BRADV cProc AdjustHplcCpsToLim,<PUBLIC,FAR>,<si,di> ParmW hplc ParmW icpLim ifdef DEBUG LocalW bxSave endif ;DEBUG cBegin ; if (hplc == 0 || (*hplc)->dcpAdjust == cp0) ; return; mov bx,[hplc] or bx,bx je AHCTL02 mov bx,[bx] mov ax,[bx.LO_dcpAdjustPlc] or ax,[bx.HI_dcpAdjustPlc] je AHCTL02 ; pplc = *hplc; ; AddDcpToCps(LprgcpForPlc(pplc), pplc->icpAdjust, icpLim, pplc->dcpAdjust); ifdef DEBUG mov [bxSave],bx endif ;DEBUG ; LN_LprgcpForPlc takes pplc in register bx, ; and returns the result in registers es:di. ; bx is not altered, ax, cx, dx are trashed. cCall LN_LprgcpForPlc,<> ifdef DEBUG ; Assert (bx == bxSave); cmp bx,[bxSave] je AHCTL01 push ax push bx push cx push dx push es mov ax,midEditn mov bx,1008 cCall AssertProcForNative,<ax,bx> pop es pop dx pop cx pop bx pop ax AHCTL01: endif ;DEBUG ; LN_AddDcpToCps takes lprgcp in es:di, icpFirst in bx, ; icpLim in cx, and dcp in dx:ax push bx ;save pplc mov ax,[bx.LO_dcpAdjustPlc] mov dx,[bx.HI_dcpAdjustPlc] mov bx,[bx.icpAdjustPlc] mov cx,[icpLim] cCall LN_AddDcpToCps,<> pop bx ;restore pplc ; if ((pplc->icpAdjust = icpLim) == pplc->iMac + 1) ; pplc->dcpAdjust = cp0; mov ax,[icpLim] mov [bx.icpAdjustPlc],ax sub ax,[bx.iMacPlcSTR] dec ax jne AHCTL02 ;Assembler note: We know ax is zero at this point. mov [bx.LO_dcpAdjustPlc],ax mov [bx.HI_dcpAdjustPlc],ax AHCTL02: ;} cEnd ; End of AdjustHplcCpsToLim ifdef NOTUSED ;------------------------------------------------------------------------- ; AdjustHplcCps(hplc, cp, dcp, ipcdMin) ;------------------------------------------------------------------------- ;/* A D J U S T H P L C C P S */ ;/* hand native */ ;/* adjusts all cp's with i >= ipcdMin from (>=) cp by dcp. Backward scan ;is for efficiency */ ;AdjustHplcCps(hplc, cp, dcp, ipcdMin) ;struct PLC **hplc; ;CP cp; ;CP dcp; ;int ipcdMin; ;{ ; CP far *lprgcp; ; CP far *lpcp, far *lpcpMin; ; struct PLC *pplc; ; %%Function:AdjustHplcCps %%Owner:BRADV cProc AdjustHplcCps,<PUBLIC,FAR>,<si,di> ParmW hplc ParmD cp ParmD dcp ParmW ipcdMin ifdef DEBUG LocalW bxSave endif ;DEBUG cBegin ; if ((int)hplc == 0 || dcp == 0) return; mov bx,[hplc] or bx,bx je AHC04 mov bx,[bx] mov ax,[OFF_dcp] or ax,[SEG_dcp] je AHC04 ; pplc = *hplc; ; lprgcp = LprgcpForPlc(pplc); ifdef DEBUG mov bxSave,bx endif ;DEBUG ; LN_LprgcpForPlc takes pplc in register bx, ; and returns the result in registers es:di. ; bx is not altered, ax, cx, dx are trashed. cCall LN_LprgcpForPlc,<> ifdef DEBUG ; Assert (bx == bxSave); cmp bx,[bxSave] je AHC01 push ax push bx push cx push dx push es mov ax,midEditn mov bx,1009 cCall AssertProcForNative,<ax,bx> pop es pop dx pop cx pop bx pop ax AHC01: endif ;DEBUG ; lpcpMin = &lprgcp[ipcdMin]; mov si,[ipcdMin] shl si,1 shl si,1 add si,di ; lpcp = &lprgcp[pplc->iMac]; mov ax,[bx.iMacPlcSTR] shl ax,1 shl ax,1 add di,ax ; while (lpcp >= lpcpMin && *lpcp >= cp) ; *(lpcp--) += dcp; mov ax,[OFF_cp] mov dx,[SEG_cp] mov bx,[OFF_dcp] mov cx,[SEG_dcp] jmp short AHC03 AHC02: add es:[di],bx adc es:[di+2],cx sub di,4 AHC03: cmp di,si jb AHC04 cmp es:[di+2],dx jg AHC02 jl AHC04 cmp es:[di],ax jae AHC02 AHC04: ;} cEnd ; End of AdjustHplcCps endif ;NOTUSED ;------------------------------------------------------------------------- ; AddDcpToCps(lprgcp, icpFirst, icpLim, dcp) ;------------------------------------------------------------------------- ;/* A D D D C P T O C P S */ ;/* add dcp to all entries of lprgcp within the interval [icpFirst, icpLim). */ ;AddDcpToCps(lprgcp, icpFirst, icpLim, dcp) ;CP far *lprgcp; ;int icpFirst; ;int icpLim; ;CP dcp; ;{ ; CP far *lpcp, lpcpLim; ; %% Function:LN_AddDcpToCps %%Owner:BRADV PUBLIC LN_AddDcpToCps LN_AddDcpToCps: ; LN_AddDcpToCps takes lprgcp in es:di, icpFirst in bx, ; icpLim in cx, and dcp in dx:ax ; for (lpcp = &lprgcp[icpFirst], lpcpLim = &lprgcp[icpLim]; mov si,bx shl si,1 shl si,1 add di,si sub cx,bx jle ADTC03 ADTC02: ; lpcp < lpcpLim; lpcp++) ; *lpcp += dcp; add es:[di],ax adc es:[di+2],dx add di,4 loop ADTC02 ADTC03: ;} ret ; End of LN_AddDcpToCps ;------------------------------------------------------------------------- ; AdjustHplcedlCps(hplcedl, cp, dcp) ;------------------------------------------------------------------------- ;/* A D J U S T H P L C E D L C P S */ ;/* hand native */ ;/* adjusts all cp's with i >= 0 from (>=) cp by dcp. Backward scan ;is for efficiency. */ ;HANDNATIVE AdjustHplcedlCps(hplcedl, cp, dcp) ;struct PLCEDL **hplcedl; ;CP cp; ;CP dcp; ;{ ; CP cpAdjust; ; int dl; ; struct EDL edl; ; struct DR *pdr; ; struct DRF drfFetch; ifdef DEBUG ; %%Function:N_AdjustHplcedlCps %%Owner:BRADV cProc N_AdjustHplcedlCps,<PUBLIC,FAR>,<si,di> else ;!DEBUG ; %%Function:LN_AdjustHplcedlCps %%Owner:BRADV cProc LN_AdjustHplcedlCps,<PUBLIC,NEAR>,<si,di> endif ;!DEBUG ParmW hplcedl ParmD cp ParmD dcp LocalV edl,cbEdlMin LocalV drfFetch,cbDrfMin cBegin ; if ((int)hplcedl == 0 || dcp == 0) ; return; mov si,[OFF_dcp] or si,[SEG_dcp] je AHedlC06 mov si,[hplcedl] or si,si je AHedlC06 ; cpAdjust = CpMacPlc(hplcedl); ; dl = IMacPlc(hplcedl); ; goto LTest; mov di,[si] mov di,[di.iMacPlcStr] jmp short AHedlC04 ; while (dl >= 0) ; { AHedlC01: ;/* note: the first entry which is not adjusted may be still adjusted in its ;interior. Eg. entry is from [2, 4), adjust >= 3, still has to adjust what is ;in the inside. */ ; GetPlc(hplcedl, dl, &edl); lea ax,[edl] cCall GetPlc,<si, di, ax> ; if (edl.hpldr != hNil) ; { push si ;save hplcedl push di ;save dl ; int idr; ; int idrMac = (*((struct PLDR **)edl.hpldr))->idrMac; ; struct DR HUGE *hpdr = HpInPl(edl.hpldr, 0); mov si,[edl.hpldrEdl] or si,si je AHedlC03 mov di,[si] mov di,[di.iMacPl] ; Assert((*((struct PLDR **)edl.hpldr))->fExternal); ; for (idr = 0; idr < idrMac; hpdr++, idr++) ; { AHedlC02: dec di jns AHedlC07 ;Assembler note: I don't think this recoding of PdrFetch and ;AdjustHplc buys us much. ;Assembler note: Jump to AHedlC07 here to avoid messing up short ;jumps. ; CP HUGE *hpcp, HUGE *hpcpMin; ; Assert(hpdr->hplcedl != hNil); ; if (hpdr->cpFirst >= cp) ; { ; if (vpdrfHead == NULL) ; hpdr->cpFirst += dcp; ; else ; { ; pdr = PdrFetch(edl.hpldr, idr, &drfFetch); ; pdr->cpFirst += dcp; ; FreePdrf(&drfFetch); ; } ; } ; Assert(hpdr->plcedl.fExternal); ; hpcpMin = HpOfHq(((struct PLC HUGE *)&hpdr->plcedl)->hqplce); ; hpcp = &hpcpMin[hpdr->plcedl.dlMac]; ;/* copied from AdjustHplcCps */ ; while (hpcp >= hpcpMin && *hpcp >= cp) ; *(hpcp--) += dcp; ; } ; } AHedlC03: pop di ;restore dl pop si ;restore hplcedl ; cpAdjust = CpPlc(hplcedl, dl); ;LTest: AHedlC04: cCall CpPlc,<si, di> ; if (cpAdjust < cp) ; break; mov bx,[OFF_cp] mov cx,[SEG_cp] cmp ax,bx push dx sbb dx,cx pop dx jl AHedlC06 ; cpAdjust = CpPlc(hplcedl, dl) + dcp; add ax,[OFF_dcp] adc dx,[SEG_dcp] ; if (cpAdjust < cp - 1) ; cpAdjust = cp - 1; sub bx,1 sbb cx,0 cmp ax,bx push dx sbb dx,cx pop dx jge AHedlC05 xchg ax,bx mov dx,cx AHedlC05: ; PutCpPlc(hplcedl, dl--, cpAdjust); cCall PutCpPlc,<si, di, dx, ax> ; } dec di jns AHedlC01 AHedlC06: ;} cEnd AHedlC07: lea ax,[drfFetch] push ax ;argument for FreePdrf ifdef DEBUG cCall S_PdrFetch,<si,di,ax> else ;!DEBUG cCall N_PdrFetch,<si,di,ax> endif ;!DEBUG xchg ax,bx push [bx.hplcedlDr] ;argument for CompletelyAdjustHplcCps push [bx.hplcedlDr] mov ax,[OFF_cp] mov dx,[SEG_cp] push dx push ax cmp [bx.LO_cpFirstDr],ax mov cx,[bx.HI_cpFirstDr] sbb cx,dx mov ax,[OFF_dcp] mov dx,[SEG_dcp] push dx push ax jl AHedlC08 add [bx.LO_cpFirstDr],ax adc [bx.HI_cpFirstDr],dx AHedlC08: mov ax,-1 push ax push cs call near ptr AdjustHplc ;REVIEW - This call should be unnecessary, in that dcpAdjust != 0 ;should be allowed. But I fail an assert that cp == caTap.cpLim in ;FUpdateTable if I don't call CompletelyAdjustHplcCps. push cs call near ptr CompletelyAdjustHplcCps ifdef DEBUG cCall S_FreePdrf,<> else ;!DEBUG cCall N_FreePdrf,<> endif ;!DEBUG jmp AHedlC02 ; End of N_AdjustHplcedlCps ;/* P X S I N I T */ ;/* initialize xbc for an Xaction and return the first pxs */ ;char *PxsInit(pxs, ixsMax, pxbc) ;char *pxs; ;int ixsMax; ;struct XBC *pxbc; ;{ ; pxbc->ixsMax = ixsMax; ; pxbc->ixsMac = 1; ; pxbc->itnMac = 0; ; pxbc->rgxs = pxs; ; SetBytes(pxs, 0, ixsMax*cbXSR); ; return pxs; ;} ifdef DEBUG ; %%Function:N_PxsInit %%Owner:BRADV cProc N_PxsInit,<PUBLIC,FAR>,<si,di> ParmW pxs ParmW ixsMax ParmW pxbc cBegin mov si,[pxs] mov cx,[ixsMax] mov bx,[pxbc] call LN_PxsInit xchg ax,si cEnd endif ;DEBUG ;LN_PxsInit takes pxs in si, ixsMax in cx, pxbc in bx ;and performs PxsInit(pxs, ixsMax, pxbc). ;ax, bx, cx, dx, di are altered. The result is returned in si. ; %%Function: LN_PxsInit %%Owner:BRADV PUBLIC LN_PxsInit LN_PxsInit: mov [bx.ixsMaxXbc],cx mov [bx.rgxsXbc],si push ds pop es mov di,si errnz <cbXsrMin AND 1> mov ax,cbXsrMin SHR 1 mul cx xchg ax,cx xor ax,ax rep stosw mov [bx.itnMacXbc],ax inc ax mov [bx.ixsMacXbc],ax ret ;/* P O S T T N */ ;/* add an intention to the intentions list in xbc */ ;PostTn(pxbc, tnt, h, c) ;struct XBC *pxbc; ;int tnt; ;void **h; /* meaning of h and c depend on tnt */ ;int c; ;{ ; %%Function:N_PostTn %%Owner:BRADV cProc N_PostTn,<PUBLIC,FAR>,<> ParmW pxbc ParmW tnt ParmW hArg ParmW cArg cBegin mov bx,[pxbc] mov ax,[tnt] mov cx,[cArg] mov dx,[hArg] call LN_PostTn cEnd ;LN_PostTn takes pxbc in bx, tnt in ax, c in cx, h in dx and ;performs PostTn(pxbc, tnt, h, c). ;ax, bx, cx, dx are altered. ; %%Function:LN_PostTn %%Owner:BRADV PUBLIC LN_PostTn LN_PostTn: ; struct TN *ptn = &pxbc->rgtn[pxbc->itnMac++]; ; Assert(pxbc->itnMac <= itnMax); ifdef DEBUG cmp [bx.itnMacXbc],itnMax jl PT01 ;not jle because itnMac has not been incremented. push ax push bx push cx push dx mov ax,midEditn mov bx,1010 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax PT01: endif ;/* DEBUG */ push si ;save caller's si errnz <cbTnMin - 6> mov si,[bx.itnMacXbc] shl si,1 add si,[bx.itnMacXbc] shl si,1 inc [bx.itnMacXbc] lea bx,[bx+si.rgtnXbc] pop si ;restore caller's si ;#ifdef DEBUG ; switch(tnt) ; { ; case tntAbort: ; case tntNil: ; break; ; case tntHplc: ; case tntHsttb: ; AssertH(h); ; break; ; case tntCloseHdrWw: ; Assert((int)h >= wwDocMin && (int)h < wwMac); ; Assert(PwwdWw((int)h)->wk == wkHdr); ; break; ; case tntDelBkmk: ; Assert(!PdodDoc((int)h/*doc*/)->fShort); ; Assert(c == 0); ; break; ; default: ; Assert(fFalse); ; } ;#endif /* DEBUG */ ifdef DEBUG push ax push bx push cx push dx cmp ax,tntAbort je Ltemp005 cmp ax,tntNil je Ltemp005 cmp ax,tntHplc je PT02 cmp ax,tntHsttb jne PT03 PT02: mov ax,midEditn mov bx,1011 cCall AssertHForNative,<dx, ax, bx> jmp short PT09 PT03: cmp ax,tntCloseHdrWw jne PT06 cmp dx,wwDocMin jl PT04 cmp dx,[wwMac] jl PT05 PT04: mov ax,midEditn mov bx,1012 cCall AssertProcForNative,<ax,bx> Ltemp005: jmp short PT09 PT05: cCall N_PwwdWw,<dx> xchg ax,bx cmp [bx.wkWwd],wkHdr je PT09 mov ax,midEditn mov bx,1013 cCall AssertProcForNative,<ax,bx> jmp short PT09 PT06: cmp ax,tntDelBkmk jne PT08 mov bx,dx ;LN_PdodDocEdit assumes doc passed in bx and performs ;PdodDoc(doc). Only bx is altered. call LN_PdodDocEdit cmp [bx.fShortDod],fFalse jne PT07 jcxz PT09 PT07: mov ax,midEditn mov bx,1030 cCall AssertProcForNative,<ax,bx> jmp short PT09 PT08: mov ax,midEditn mov bx,1031 cCall AssertProcForNative,<ax,bx> PT09: pop dx pop cx pop bx pop ax endif ;/* DEBUG */ ; ptn->tnt = tnt; ; ptn->h = h; ; ptn->c = c; ;} mov [bx.tntTn],ax mov [bx.hTn],dx mov [bx.cTn],cx ret ;/* F D O T N S */ ;/* "execute" the intentions stored in rgtn */ ;FDoTns(pxbc) ;struct XBC *pxbc; ;{ ; int c, cMax; ; struct TN *ptn, *ptnT, *ptnMac; ; void **h; ; int tnt; ; BOOL fReturn = fFalse; ifdef DEBUG ; %%Function:N_FDoTns %%Owner:BRADV cProc N_FDoTns,<PUBLIC,FAR>,<di> ParmW pxbc cBegin mov di,[pxbc] call LN_FDoTns sbb ax,ax cEnd endif ;DEBUG ;LN_FDoTns takes pxbc in di and performs FDoTns(pxbc). ;fTrue is returned iff carry is true upon return. ;ax, bx, cx, dx are altered. ; %%Function:LN_FDoTns %%Owner:BRADV PUBLIC LN_FDoTns LN_FDoTns: push si ;save caller's si ; for (ptn = pxbc->rgtn, ptnMac = ptn + pxbc->itnMac; ptn < ptnMac; ptn++) lea si,[di.rgtnXbc - cbTnMin] mov ax,cbTnMin mul [di.itnMacXbc] xchg ax,bx lea dx,[bx+di.rgtnXbc] FDT01: add si,cbTnMin cmp si,dx jae FDT07 ; switch (tnt = ptn->tnt) ; { ; default: ; Assert(fFalse); ; /* fall through */ ; case tntNil: ; case tntCloseHdrWw: ; case tntDelBkmk: ; continue; ; case tntAbort: ; goto LReturn; ; case tntHplc: ; case tntHsttb: mov ax,[si.tntTn] cmp al,tntNil je FDT01 cmp al,tntCloseHdrWw je FDT01 cmp al,tntDelBkmk je FDT01 cmp al,tntAbort je FDT08 ifdef DEBUG cmp al,tntHplc je FDT02 cmp al,tntHsttb je FDT02 push ax push bx push cx push dx mov ax,midEditn mov bx,1015 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax jmp short FDT01 FDT02: endif ;/* DEBUG */ ;/* coalesce the several intentions to allocate into a single ;maximal intention. (i.e., determine the largest that this heap ;block will get during the course of the operation by accumlating ;all of the intentions that relate to this heap block and taking ;the max that that value obtains). */ ;ax = tnt, dx = ptnMac, si = ptn ; c = cMax = ptn->c; ; h = ptn->h; push di ;save pxbc push si ;save ptn mov cx,[si.cTn] mov di,cx mov bx,[si.hTn] ; for (ptnT = ptn + 1; ptnT < ptnMac; ptnT++) FDT03: add si,cbTnMin cmp si,dx jae FDT04 ; if (ptnT->tnt == tnt && ptnT->h == h) ; { cmp [si.tntTn],ax jne FDT03 cmp [si.hTn],bx jne FDT03 ; if ((c += ptnT->c) > cMax) ; cMax = c; ; /* to avoid double counting */ ; ptnT->tnt = tntNil; mov [si.tntTn],tntNil add di,[si.cTn] cmp di,cx jle FDT03 mov cx,di jmp short FDT03 ; } FDT04: pop si ;restore ptn pop di ;restore pxbc ;/* do allocation, if necessary. fail process if allocation cannot be made */ ; if (cMax > 0) or cx,cx jle FDT01 ; if (tnt == tntHplc && !FStretchPlc(h, cMax)) ; goto LReturn; ; else if (tnt == tntHsttb && !FStretchSttbCb(h, cMax)) ; goto LReturn; ; break; ; } push dx ;save ptnMac push bx push cx cmp al,tntHplc jne FDT05 ifdef DEBUG cCall S_FStretchPlc,<> else ;not DEBUG cCall N_FStretchPlc,<> endif ;DEBUG jmp short FDT06 FDT05: cCall FStretchSttbCb,<> FDT06: pop dx ;restore ptnMac or ax,ax jne FDT01 db 0A8h ;turns next "stc" into "test al,immediate" ;also clears the carry flag FDT07: ; fReturn = fTrue; ; ;/* reset state in preperation for !fPlan phase */ ; pxbc->ixsMac = 1; /* reset to first xs */ stc mov [di.ixsMacXbc],1 ;LReturn: ;/* failure or success - don't need to handle this prm special anymore */ ; vmerr.prmDontReclaim = prmNil; ; ; return fReturn; FDT08: mov [vmerr.prmDontReclaimMerr],prmNil ;} pop si ;restore caller's si ret ;/* C L O S E T N S */ ;/* Close up unneeded space in each hplc or hsttb used by pxbc. ;*/ ;CloseTns(pxbc) ;struct XBC *pxbc; ;{ ; struct TN *ptn, *ptnMac; ifdef DEBUG ; %%Function:N_CloseTns %%Owner:BRADV cProc N_CloseTns,<PUBLIC,FAR>,<di> ParmW pxbc cBegin mov di,[pxbc] call LN_CloseTns cEnd endif ;DEBUG ;LN_CloseTns takes pxbc in di and performs CloseTns(pxbc) ;ax, bx, cx, dx are altered. ; %%Function:LN_CloseTns Owner:BRADV PUBLIC LN_CloseTns LN_CloseTns: ; Assert(!vfInCommit); ifdef DEBUG cmp [vfInCommit],0 je CT01 push ax push bx push cx push dx mov ax,midEditn mov bx,1016 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax CT01: endif ;DEBUG push si ;save caller's si ; for (ptn = pxbc->rgtn, ptnMac = ptn + pxbc->itnMac; ptn < ptnMac; ptn++) lea si,[di.rgtnXbc - cbTnMin] mov ax,cbTnMin mul [di.itnMacXbc] xchg ax,bx lea dx,[bx+di.rgtnXbc] CT02: add si,cbTnMin cmp si,dx jae CT10 ; switch (ptn->tnt) ; { ;#ifdef DEBUG ; case tntAbort: ; default: ; Assert(fFalse); ; case tntNil: ; break; ;#endif /* DEBUG */ mov ax,[si.tntTn] cmp al,tntNil je CT02 ifdef DEBUG jmp short CT11 CT03: endif ;/* DEBUG */ ; case tntHplc: ; CloseUpPlc(ptn->h); ; break; ; case tntHsttb: ; CloseUpSttb(ptn->h); ; break; ; case tntCloseHdrWw: ; DisposeWwHdr(ptn->h); ; break; ; case tntDelBkmk: ; /* if all bookmarks were deleted, nuke structs */ ; { ; struct DOD *pdod = PdodDoc((int)ptn->h/*doc*/); ; FreezeHp(); ; Assert(!pdod->fShort); ; if (pdod->hplcbkf != hNil && IMacPlc(pdod->hplcbkf) == 0) ; { ; FreePhsttb(&pdod->hsttbBkmk); ; FreePhplc(&pdod->hplcbkf); ; FreePhplc(&pdod->hplcbkl); ; } ; MeltHp(); ; break; ; } push dx ;save ptnMac mov bx,[si.hTn] cmp al,tntHplc jne CT04 call LN_CloseUpPlc jmp short CT09 CT04: cmp al,tntDelBkmk jne CT07 ;LN_PdodDocEdit assumes doc passed in bx and performs ;PdodDoc(doc). Only bx is altered. call LN_PdodDocEdit ifdef DEBUG call LN_FreezeHpEdit endif ;DEBUG ifdef DEBUG cmp [bx.fShortDod],fFalse je CT05 push ax push bx push cx push dx mov ax,midEditn mov cx,1037 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax CT05: endif ;/* DEBUG */ mov cx,[bx.hplcbkfDod] jcxz CT06 xchg bx,cx mov bx,[bx] cmp [bx.iMacPlcStr],0 jne CT06 cCall CloseBkmkStructs,<cx> CT06: ifdef DEBUG call LN_MeltHpEdit endif ;DEBUG jmp short CT09 CT07: push bx cmp al,tntHsttb jne CT08 cCall CloseUpSttb,<> jmp short CT09 CT08: cCall DisposeWwHdr,<> CT09: pop dx ;restore ptnMac ; } jmp short CT02 ;} CT10: pop si ;restore caller's si ret ;#ifdef DEBUG ; case tntAbort: ; default: ; Assert(fFalse); ; case tntNil: ; break; ;#endif /* DEBUG */ ifdef DEBUG CT11: cmp al,tntHplc je CT12 cmp al,tntHsttb je CT12 cmp al,tntCloseHdrWw je CT12 cmp al,tntDelBkmk je CT12 push ax push bx push cx push dx mov ax,midEditn mov bx,1017 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax jmp CT02 CT12: jmp CT03 endif ;/* DEBUG */ ;/* C L O S E U P P L C */ ;/* Remove unneeded space from hplc. ;*/ ;CloseUpPlc(hplc) ;struct PLC **hplc; ;{ ; struct PLC *pplc = *hplc; ; long lcb = (long)(pplc->iMax-1)*(pplc->cb+sizeof(CP)) + sizeof(CP); ; ; AssertH(hplc); ; Assert(!vfInCommit); ; %%Function:LN_CloseUpPlc %%Owner:BRADV PUBLIC LN_CloseUpPlc LN_CloseUpPlc: ifdef DEBUG push ax push bx push cx push dx mov ax,midEditn mov cx,1018 cCall AssertHForNative,<bx, ax, cx> cmp [vfInCommit],0 je CUP01 mov ax,midEditn mov bx,1019 cCall AssertProcForNative,<ax,bx> CUP01: pop dx pop cx pop bx pop ax endif ;/* DEBUG */ mov cx,bx ; long lcb = (long)(pplc->iMax-1)*(pplc->cb+sizeof(CP)) + sizeof(CP); mov bx,[bx] ;compute pplc mov ax,[bx.iMaxPlc] dec ax mov dx,[bx.cbPlc] add dx,4 mul dx add ax,4 ; if (pplc->fExternal) ; { ;Assembler note: assert we have an external plc here because no ;one creates internal PLC's anymore. ifdef DEBUG test [bx.fExternalPlc],maskfExternalPlc jne CUP015 push ax push bx push cx push dx mov ax,midEditn mov cx,1037 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax CUP015: endif ;/* DEBUG */ ; HQ hq = pplc->hqplce; mov dx,[bx.LO_hqplcePlc] mov bx,[bx.HI_hqplcePlc] push bx push dx ;save hq in memory push cx ;save hplc ; if (CbOfHq(hq) > lcb+20) ;#define CbOfHq(hq) (*((uns HUGE *)HpOfHq(hq)-1)) push dx ;save low hq push ax ;save lcb shl bx,1 mov ax,mpsbps[bx] mov es,ax shr ax,1 jc CUP02 ; reload sb trashes ax, cx, and dx cCall ReloadSb,<> CUP02: pop ax ;restore lcb pop bx ;restore low hq mov bx,es:[bx] mov cx,es:[bx-2] sub cx,20 jb CUP04 cmp cx,ax jb CUP04 ; /* don't bother if it is close */ ; { ; AssertDo(FChngSizePhqLcb(&hq, lcb)); /* HM */ ; (*hplc)->hqplce = hq; ; } ; } mov bx,sp inc bx inc bx xor cx,cx cCall FChngSizePhqLcb,<bx, cx, ax> ifdef DEBUG or ax,ax jne CUP03 push ax push bx push cx push dx mov ax,midEditn mov bx,1020 cCall AssertProcForNative,<ax,bx> pop dx pop cx pop bx pop ax CUP03: endif ;DEBUG CUP04: pop bx ;restore hplc mov bx,[bx] pop [bx.LO_hqplcePlc] pop [bx.HI_hqplcePlc] ret sEnd edit end
Rings/Homomorphisms/Kernel.agda
Smaug123/agdaproofs
4
5144
{-# OPTIONS --safe --warning=error --without-K #-} open import Setoids.Setoids open import Sets.EquivalenceRelations open import Rings.Definition open import Rings.Homomorphisms.Definition open import Rings.Ideals.Definition module Rings.Homomorphisms.Kernel {a b c d : _} {A : Set a} {B : Set c} {S : Setoid {a} {b} A} {T : Setoid {c} {d} B} {_+1_ _*1_ : A → A → A} {_+2_ _*2_ : B → B → B} {R1 : Ring S _+1_ _*1_} {R2 : Ring T _+2_ _*2_} {f : A → B} (fHom : RingHom R1 R2 f) where open import Groups.Homomorphisms.Kernel (RingHom.groupHom fHom) ringKernelIsIdeal : Ideal R1 groupKernelPred Ideal.isSubgroup ringKernelIsIdeal = groupKernelIsSubgroup Ideal.accumulatesTimes ringKernelIsIdeal {x} {y} fx=0 = transitive (RingHom.ringHom fHom) (transitive (Ring.*WellDefined R2 fx=0 reflexive) (transitive (Ring.*Commutative R2) (Ring.timesZero R2))) where open Setoid T open Equivalence eq