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
HiScore.asm
RichardTND/ShockRaid
0
99694
<reponame>RichardTND/ShockRaid ;############################# ;# Shock Raid # ;# # ;# by <NAME> # ;# # ;# (C)2021 The New Dimension # ;# For Reset Magazine # ;############################# !align $100,0 Name !text " " NameEnd HiScoreRoutine ;The game is over. Now clear all IRQs and check for ;a new hi score. lda #$35 sta $01 ldx #$48 ldy #$ff stx $fffe sty $ffff lda #$00 sta $d01a sta $d019 sta $d020 sta $d021 sta $d017 sta $d01d sta $d01b cli lda #0 sta FireButton ;Copy player score to final score, before clearing the ;screen. ldx #$00 .copyfin lda Score,x sta FinalScore,x inx cpx #5 bne .copyfin ;Restore back to VIC Bank #$03 and init name pointers lda #$12 sta $d018 ldx #$00 .silence lda #$00 sta $d400,x inx cpx #$18 bne .silence lda #0 sta $d020 lda #$08 sta $d016 lda #0 sta NameFinished sta JoyDelay ;Check if the player has cheated. If so, the hi score ;is not allowed to be recorded. Even if the game has been ;completed. lda cheatlives+1 cmp #$2c beq nohiscoreallowed jmp hiscoreallowed nohiscoreallowed jmp nohiscor hiscoreallowed ;Check if the player's score has reached ;a position in the high score table ldx #$00 nextone lda hslo,x sta $c1 lda hshi,x sta $c2 ;The hi score table position read is grabbed so check if ;the player's score is higher rank or equal rank compared ;to the hi scores ldy #$00 scoreget lda FinalScore,y scorecmp cmp ($c1),y bcc posdown beq nextdigit bcs posfound nextdigit iny cpy #scorelen bne scoreget beq posfound posdown inx cpx #listlen bne nextone beq nohiscor posfound stx storbyt cpx #listlen-1 beq lastscor ;Move all hi scores and name ranks down ldx #listlen-1 copynext lda hslo,x sta $c1 lda hshi,x sta $c2 lda nmlo,x sta $d1 lda nmhi,x sta $d2 dex lda hslo,x sta $c3 lda hshi,x sta $c4 lda nmlo,x sta $d3 lda nmhi,x sta $d4 ldy #scorelen-1 copyscor lda ($c3),y sta ($c1),y dey bpl copyscor ldy #namelen+1 copyname lda ($d3),y sta ($d1),y dey bpl copyname cpx storbyt bne copynext lastscor ldx storbyt lda hslo,x sta $c1 lda hshi,x sta $c2 lda nmlo,x sta $d1 lda nmhi,x sta $d2 ;Call routine to allow player to sign name jmp NameEntry ;Then place the name to the new hi score PlaceNewScore ldy #scorelen-1 putscore lda FinalScore,y sta ($c1),y dey bpl putscore ldy #namelen-1 putname lda Name,y sta ($d1),y dey bpl putname lda cheatlives ;Cheat mode: If LASERBEAM is added as name skip saving cmp #$2c ;the new hi score beq nohiscor ;Save / Update hi score file (if running from disk) jmp SaveHiScore nohiscor jmp Title ;====================================================== ;The player has achieved a position in the high ;score table. So now it is time to do joy control ;name entry. NameEntry ldx #$00 ;Clear the screen .hiclr lda #$20 sta screen,x sta screen+$100,x sta screen+$200,x sta screen+$2e8,x inx bne .hiclr ldx #$00 .putwelldonemessage lda pulserow2,x sta screen+(7*40),x lda pulserow1,x sta screen+(19*40),x lda HiScoreMessage,x sta screen+(8*40),x lda HiScoreMessage+(1*40),x sta screen+(11*40),x lda HiScoreMessage+(2*40),x sta screen+(13*40),x lda HiScoreMessage+(3*40),x sta screen+(16*40),x lda #$05 sta colour+(8*40),x lda #$03 sta colour+(11*40),x sta colour+(13*40),x lda #$0d sta colour+(16*40),x lda #1 sta colour+(7*40),x sta colour+(19*40),x inx cpx #40 bne .putwelldonemessage ;Clear name ldx #$00 .clearname lda #$20 sta Name,x inx cpx #9 bne .clearname ;Set Character A as default character lda #1 sta $04 lda $04 sta Hi_Char ;Reset joystick delay lda #0 sta JoyDelay ;Initialise character position lda #<Name sta sm+1 lda #>Name sta sm+2 lda #$1b sta $d011 lda #0 jsr MusicInit2 NameEntryLoop lda #$f9 cmp $d012 bne *-3 jsr SlowAnimPulse jsr HiScorePlayer ;Show name on screen ldx #$00 showname lda Name,x sta $06e0,x lda #1 sta $dae0,x inx cpx #9 bne showname ;Check that the name entry routine is finished lda NameFinished bne stopnameentry jsr joycheck jmp NameEntryLoop ;Name entry has finished, store to the hi score ;rank stopnameentry jmp PlaceNewScore ;Joystick check routine joycheck lda Hi_Char sm sta Name lda JoyDelay cmp #4 beq joyhiok inc JoyDelay rts joyhiok lda #0 sta JoyDelay ;Check joystick up hi_up lda #1 bit $dc00 bne hi_down inc Hi_Char lda Hi_Char cmp #27 beq delete_char cmp #$21 beq a_char rts ;Check joystick down hi_down lda #2 bit $dc00 bne hi_fire ;Move character down one dec Hi_Char ;Check for special character lda Hi_Char cmp #$00 beq space_char cmp #29 beq z_char rts ;Make char delete delete_char lda #30 sta Hi_Char rts ;Make char spacebar space_char lda #$20 sta Hi_Char rts ;Make char letter A a_char lda #1 sta Hi_Char rts ;Make char letter Z z_char lda #26 sta Hi_Char rts ;Check fire button on joystick hi_fire lda $dc00 lsr lsr lsr lsr lsr bit FireButton ror FireButton bmi hi_nofire bvc hi_nofire lda #0 sta FireButton ;Fire pressed ;Check for DELETE char lda Hi_Char cmp #30 bne checkendchar ;Delete detected lda sm+1 cmp #<Name beq donotgoback dec sm+1 jsr CleanUpName donotgoback rts ;Check for END char checkendchar: cmp #31 bne charisok ;Make space lda #$20 sta Hi_Char jmp FinishedNow ;Move to next character charisok inc sm+1 ;Check length expired lda sm+1 cmp #<Name+9 beq FinishedNow ;Name checked hi_nofire rts ;Trigger name entry finished FinishedNow jsr CleanUpName lda #1 sta NameFinished ;Check for cheat code ldx #0 cheatcheck lda Name,x cmp CheatName,x bne skipcheat inx cpx #$09 bne cheatcheck .activatecheat lda #$2c sta cheatlives skipcheat rts ;Clear name from illegal characters to ;prevent messy names CleanUpName ldx #$00 clearchars lda Name,x cmp #30 beq cleanup cmp #31 beq cleanup jmp skipcleanup cleanup lda #$20 sta Name,x skipcleanup inx cpx #namelen bne clearchars rts HiScorePlayer lda system cmp #1 beq .pal2 inc NTSCTimer lda NTSCTimer cmp #$06 beq .loopNTSC .pal2 jsr MusicPlay2 rts .loopNTSC lda #0 sta NTSCTimer rts FinalScore !byte $30,$30,$30,$30,$30 JoyDelay !byte 0 NameFinished !byte 0 Hi_Char !byte 0 CheatName !text "laserbeam" hslo !byte <HiScore1,<HiScore2,<HiScore3,<HiScore4,<HiScore5 hshi !byte >HiScore1,>HiScore2,>HiScore3,>HiScore4,>HiScore5 nmlo !byte <Name1,<Name2,<Name3,<Name4,<Name5 nmhi !byte >Name1,>Name2,>Name3,>Name4,>Name5 HiScoreMessage !text " congratulations pilot " !text "your score has awarded a position in the" !text " hall of fame. " !text " please enter your name "
Assembly/keyboard/keys.asm
WildGenie/Ninokuni
14
167027
;;----------------------------------------------------------------------------;; ;; Keyboard keys ;; Copyright 2015 <NAME> (aka pleonex) ;; ;; 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. ;;----------------------------------------------------------------------------;; ; * Notes: ; '·' represents the null char 8140h (sjis space) that means "no char". ; '¬' represents a space that will be overwrite with ASM code. .org 020CBD90h ; 4 chars in the last column .area 10h dcw 0x00A1, 0x003F, 0x00A2, 0x0021 ; ¿ ? ¡ ! .endarea .org 020CBD9Ah ; Numbers .area 14h dcw 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037 ; 0 1 2 3 4 5 6 7 dcw 0x0038, 0x0039 ; 8 9 .endarea .org 020CBDB0h ; Alphabet 1 (hiragana) .area 64h dcw 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048 ; A B C D E F G H dcw 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x00AE, 0x004F ; I J K L M N Ñ O dcw 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057 ; P Q R S T U V W dcw 0x0058, 0x0059, 0x005A, 0x0020, 0x00A3, 0x00A4, 0x00A5, 0x00A6 ; X Y Z Á É Í Ó dcw 0x00A7, 0x00B0, 0x002C, 0x002E, 0x00B3, 0x00B4, 0x003C, 0x003E ; Ú Ü , . " " < > dcw 0x0023, 0x0024, 0x0025, 0x0026, 0x002B, 0x002D, 0x002A, 0x002F ; # $ % & + - * / dcw 0x0028, 0x0029 ; ( ) .endarea .org 020CBE14h ; Alphabet 1 (hiragana) with nigori 1 .area 64h dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081 ; ¬ ¬ .endarea .org 020CBE78h ; Alphabet 1 (hiragana) with nigori 2 .area 64h dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; ¬ ¬ ¬ ¬ ¬ ¬ ¬ ¬ dcw 0x4081, 0x4081 ; ¬ ¬ .endarea .org 020CBEDCh ; Alphabet 1 (hiragana) capital .area 64h dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081 ; . . .endarea .org 020CBF42h ; Alphabet 2 (katakana) .area 64h dcw 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068 ; a b c d e f g h dcw 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x00AD, 0x006F ; i j k l m n ñ o dcw 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077 ; p q r s t u v w dcw 0x0078, 0x0079, 0x007A, 0x0020, 0x00A8, 0x00A9, 0x00AA, 0x00AB ; x y z á é í ó dcw 0x00AC, 0x00AF, 0x002C, 0x002E, 0x00B3, 0x00B4, 0x003C, 0x003E ; ú ü , . " " < > dcw 0x0023, 0x0024, 0x0025, 0x0026, 0x002B, 0x002D, 0x002A, 0x002F ; # $ % & + - * / dcw 0x0028, 0x0029 ; ( ) .endarea .org 020CBFA6h ; Alphabet 2 (katakana) with nigori 1 .area 64h dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · . . . dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081 ; . . .endarea .org 020CC00Ah ; Alphabet 2 (katakana) with nigori 2 .area 64h dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · . . . dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; . · · · · · · · dcw 0x4081, 0x4081 ; . . .endarea .org 020CC06Eh ; Alphabet 2 (katakana) capital .area 64h dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · . . . dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081, 0x4081 ; · · · · · · · · dcw 0x4081, 0x4081 ; . . .endarea
agda-stdlib/src/Data/Table/Base.agda
DreamLinuxer/popl21-artifact
5
9028
------------------------------------------------------------------------ -- The Agda standard library -- -- This module is DEPRECATED. Please use `Data.Vec.Functional` instead. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Table.Base where {-# WARNING_ON_IMPORT "Data.Table.Base was deprecated in v1.2. Use Data.Vec.Functional instead." #-} open import Data.Nat.Base open import Data.Fin.Base open import Data.Product using (_×_ ; _,_) open import Data.List.Base as List using (List) open import Data.Vec.Base as Vec using (Vec) open import Function using (_∘_; flip) open import Level using (Level) private variable a b : Level A : Set a B : Set b ------------------------------------------------------------------------ -- Definition record Table (A : Set a) n : Set a where constructor tabulate field lookup : Fin n → A open Table public ------------------------------------------------------------------------ -- Basic operations head : ∀ {n} → Table A (suc n) → A head t = lookup t zero tail : ∀ {n} → Table A (suc n) → Table A n tail t = tabulate (lookup t ∘ suc) uncons : ∀ {n} → Table A (suc n) → A × Table A n uncons t = head t , tail t remove : ∀ {n} → Fin (suc n) → Table A (suc n) → Table A n remove i t = tabulate (lookup t ∘ punchIn i) ------------------------------------------------------------------------ -- Operations for transforming tables rearrange : ∀ {m n} → (Fin m → Fin n) → Table A n → Table A m rearrange f t = tabulate (lookup t ∘ f) map : ∀ {n} → (A → B) → Table A n → Table B n map f t = tabulate (f ∘ lookup t) _⊛_ : ∀ {n} → Table (A → B) n → Table A n → Table B n fs ⊛ xs = tabulate λ i → lookup fs i (lookup xs i) ------------------------------------------------------------------------ -- Operations for reducing tables foldr : ∀ {n} → (A → B → B) → B → Table A n → B foldr {n = zero} f z t = z foldr {n = suc n} f z t = f (head t) (foldr f z (tail t)) foldl : ∀ {n} → (B → A → B) → B → Table A n → B foldl {n = zero} f z t = z foldl {n = suc n} f z t = foldl f (f z (head t)) (tail t) ------------------------------------------------------------------------ -- Operations for building tables replicate : ∀ {n} → A → Table A n replicate x = tabulate (λ _ → x) ------------------------------------------------------------------------ -- Operations for converting tables toList : ∀ {n} → Table A n → List A toList = List.tabulate ∘ lookup fromList : ∀ (xs : List A) → Table A (List.length xs) fromList = tabulate ∘ List.lookup fromVec : ∀ {n} → Vec A n → Table A n fromVec = tabulate ∘ Vec.lookup toVec : ∀ {n} → Table A n → Vec A n toVec = Vec.tabulate ∘ lookup
libsrc/zx81/mirrortxt.asm
dex4er/deb-z88dk
1
16614
; ; ZX81 libraries ; ;-------------------------------------------------------------- ; This code comes from the FidoNET Sinclair newsgroup ;-------------------------------------------------------------- ; ; $Id: mirrortxt.asm,v 1.1 2007/10/12 14:49:16 stefano Exp $ ; ;---------------------------------------------------------------- ; ; mirrortxt() - mirror text display ; ;---------------------------------------------------------------- XLIB mirrortxt mirrortxt: LD HL,(400CH) ; Puts the adress of the displayfile in HL LD DE,0010H ; This is the middle of the screen ADD HL,DE ; Add to displayfile LD D,H ; leave result in DE LD E,L ; INC DE ; counting up LD B,16H ; B as counter 22 lines .MIR1 LD A,(HL) ; Character in accumulator CP 76H ; look for end line JR Z,MIR2 ; If b not 0 goto 409E EX DE,HL ; temporary storage LD C,(HL) ; LD (HL),A ; Print to Dfile EX DE,HL ; get value back again LD (HL),C ; print to Dfile DEC HL ; counting down INC DE ; JR MIR1 ; Get next character .MIR2 LD DE,0031H ; Go to middle of next line ADD HL,DE ; LD D,H ; LD E,L ; INC DE ; DJNZ MIR1 ; until screen full repeat routine RET
programs/oeis/029/A029098.asm
neoneye/loda
22
96909
<gh_stars>10-100 ; A029098: Expansion of 1/((1-x)(1-x^5)(1-x^8)(1-x^11)). ; 1,1,1,1,1,2,2,2,3,3,4,5,5,6,6,7,9,9,10,11,12,14,15,16,18,19,21,23,24,26,28,30,33,35,37,40,42,45,48,50,54,57,60,64,67,71,75,78,83,87,91,96,100,105,110,115,121,126 lpb $0 mov $2,$0 sub $0,5 seq $2,25790 ; Expansion of 1/((1-x)(1-x^8)(1-x^11)). add $1,$2 add $1,$2 lpe div $1,2 add $1,1 mov $0,$1
source/amf/uml/amf-internals-modules-uml_module.adb
svn2github/matreshka
24
20782
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Internals.Factories.Primitive_Types_Factories; with AMF.Internals.Factories.Standard_Profile_L2_Factories; with AMF.Internals.Factories.Standard_Profile_L3_Factories; with AMF.Internals.Factories.UML_Factories; with AMF.Internals.Factories.UMLDI_Factories; with AMF.Internals.Factories.UML_Module_Factory; with AMF.Internals.Tables.Primitive_Types_Metamodel.Links; with AMF.Internals.Tables.Primitive_Types_Metamodel.Objects; with AMF.Internals.Tables.Primitive_Types_Metamodel.Properties; with AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Links; with AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Objects; with AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Properties; with AMF.Internals.Tables.Standard_Profile_L3_Metamodel.Links; with AMF.Internals.Tables.Standard_Profile_L3_Metamodel.Objects; with AMF.Internals.Tables.Standard_Profile_L3_Metamodel.Properties; with AMF.Internals.Tables.UML_Element_Table; with AMF.Internals.Tables.UML_Metamodel.Links; with AMF.Internals.Tables.UML_Metamodel.Objects; with AMF.Internals.Tables.UML_Metamodel.Properties; with AMF.Internals.Tables.UMLDI_Metamodel.Links; with AMF.Internals.Tables.UMLDI_Metamodel.Objects; with AMF.Internals.Tables.UMLDI_Metamodel.Properties; with AMF.Internals.Modules.CMOF_Module; pragma Unreferenced (AMF.Internals.Modules.CMOF_Module); pragma Elaborate_All (AMF.Internals.Modules.CMOF_Module); -- CMOF module package and all its dependencies must be elaborated before -- elaboration of this package. with AMF.Internals.Modules.DD_Module; pragma Unreferenced (AMF.Internals.Modules.DD_Module); pragma Elaborate_All (AMF.Internals.Modules.DD_Module); -- CMOF module package and all its dependencies must be elaborated before -- elaboration of this package. package body AMF.Internals.Modules.UML_Module is -- Global objects of factories for supported metamodels. UML_Module_Factory : aliased AMF.Internals.Factories.UML_Module_Factory.UML_Module_Factory; Module : AMF_Metamodel; begin -- Register module's factory. AMF.Internals.Factories.Register (UML_Module_Factory'Access, Module); -- Initialize metamodels. AMF.Internals.Tables.Primitive_Types_Metamodel.Objects.Initialize; AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Objects.Initialize; AMF.Internals.Tables.Standard_Profile_L3_Metamodel.Objects.Initialize; AMF.Internals.Tables.UML_Metamodel.Objects.Initialize; AMF.Internals.Tables.UMLDI_Metamodel.Objects.Initialize; AMF.Internals.Tables.Primitive_Types_Metamodel.Properties.Initialize; AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Properties.Initialize; AMF.Internals.Tables.Standard_Profile_L3_Metamodel.Properties.Initialize; AMF.Internals.Tables.UML_Metamodel.Properties.Initialize; AMF.Internals.Tables.UMLDI_Metamodel.Properties.Initialize; AMF.Internals.Tables.Primitive_Types_Metamodel.Links.Initialize; AMF.Internals.Tables.Standard_Profile_L2_Metamodel.Links.Initialize; AMF.Internals.Tables.Standard_Profile_L3_Metamodel.Links.Initialize; AMF.Internals.Tables.UML_Metamodel.Links.Initialize; AMF.Internals.Tables.UMLDI_Metamodel.Links.Initialize; -- Initialize element table of UML module. AMF.Internals.Tables.UML_Element_Table.Initialize (Module); -- Register factories. AMF.Internals.Factories.Register (AMF.Internals.Factories.Primitive_Types_Factories.Get_Package, AMF.Internals.Factories.Primitive_Types_Factories.Constructor'Access); AMF.Internals.Factories.Register (AMF.Internals.Factories.UML_Factories.Get_Package, AMF.Internals.Factories.UML_Factories.Constructor'Access); AMF.Internals.Factories.Register (AMF.Internals.Factories.Standard_Profile_L2_Factories.Get_Package, AMF.Internals.Factories.Standard_Profile_L2_Factories.Constructor'Access); AMF.Internals.Factories.Register (AMF.Internals.Factories.Standard_Profile_L3_Factories.Get_Package, AMF.Internals.Factories.Standard_Profile_L3_Factories.Constructor'Access); AMF.Internals.Factories.Register (AMF.Internals.Factories.UMLDI_Factories.Get_Package, AMF.Internals.Factories.UMLDI_Factories.Constructor'Access); end AMF.Internals.Modules.UML_Module;
programs/oeis/014/A014480.asm
karttu/loda
1
171479
; A014480: Expansion of (1+2*x)/(1-2*x)^2. ; 1,6,20,56,144,352,832,1920,4352,9728,21504,47104,102400,221184,475136,1015808,2162688,4587520,9699328,20447232,42991616,90177536,188743680,394264576,822083584,1711276032,3556769792,7381975040,15300820992,31675383808,65498251264,135291469824,279172874240,575525617664,1185410973696,2439541424128,5016521801728,10307921510400,21165598834688,43430709297152,89060441849856,182518930210816,373833953443840,765260092932096,1565704557953024,3201777860083712,6544293208522752 mov $1,$0 mul $1,2 add $1,1 mov $2,2 pow $2,$0 mul $1,$2
sylph-parser/src/main/antlr/ideal/sylph/parser/antlr4/SqlBase.g4
wcf1/sylph
1
7478
/* * Copyright (C) 2018 The Sylph Authors * * 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. */ /* * * Template source: https://github.com/prestodb/presto/tree/master/presto-parser/src/main/antlr4/com/facebook/presto/sql/parser * */ grammar SqlBase; @header { package ideal.sylph.parser.antlr4; } tokens { DELIMITER } singleStatement : statement EOF ; singleExpression : expression EOF ; statement : queryStream #selectQuery | CREATE FUNCTION identifier AS (string)? #createFunction | CREATE ((SOURCE | INPUT) | (SINK | OUTPUT) | BATCH) TABLE (IF NOT EXISTS)? qualifiedName '(' tableElement (',' tableElement)* ')' (COMMENT string)? (WITH properties)? (WATERMARK watermark)? #createTable | CREATE VIEW TABLE (IF NOT EXISTS)? qualifiedName (WATERMARK watermark)? AS queryStream #createStreamAsSelect | INSERT INTO qualifiedName columnAliases? queryStream #insertInto ; watermark : identifier FOR identifier BY ( SYSTEM_OFFSET '('offset=INTEGER_VALUE')' | ROWMAX_OFFSET '('offset=INTEGER_VALUE')' ) ; queryStream : (WITH | SELECT) (.*?) EOF | '('(WITH | SELECT) (.*?)')' ; tableElement : columnDefinition | proctime ; proctime : identifier AS 'PROCTIME()' ; columnDefinition : identifier type (COMMENT string)? ; properties : '(' property (',' property)* ')' ; property : identifier EQ expression ; sampleType : BERNOULLI | SYSTEM ; columnAliases : '(' identifier (',' identifier)* ')' ; expression : booleanExpression ; booleanExpression : valueExpression predicate[$valueExpression.ctx]? #predicated | NOT booleanExpression #logicalNot | left=booleanExpression operator=AND right=booleanExpression #logicalBinary | left=booleanExpression operator=OR right=booleanExpression #logicalBinary ; // workaround for https://github.com/antlr/antlr4/issues/780 predicate[ParserRuleContext value] : comparisonOperator right=valueExpression #comparison ; valueExpression : primaryExpression #valueExpressionDefault ; primaryExpression : NULL #nullLiteral | identifier string #typeConstructor | DOUBLE_PRECISION string #typeConstructor | number #numericLiteral | booleanValue #booleanLiteral | string #stringLiteral | BINARY_LITERAL #binaryLiteral | '?' #parameter | POSITION '(' valueExpression IN valueExpression ')' #position | ARRAY '[' (expression (',' expression)*)? ']' #arrayConstructor | value=primaryExpression '[' index=valueExpression ']' #subscript | identifier #columnReference | base=primaryExpression '.' fieldName=identifier #dereference | name=CURRENT_DATE #specialDateTimeFunction | name=CURRENT_TIME ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=CURRENT_TIMESTAMP ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=LOCALTIME ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=LOCALTIMESTAMP ('(' precision=INTEGER_VALUE ')')? #specialDateTimeFunction | name=CURRENT_USER #currentUser | name=CURRENT_PATH #currentPath | SUBSTRING '(' valueExpression FROM valueExpression (FOR valueExpression)? ')' #substring | NORMALIZE '(' valueExpression (',' normalForm)? ')' #normalize | EXTRACT '(' identifier FROM valueExpression ')' #extract ; string : STRING #basicStringLiteral | UNICODE_STRING (UESCAPE STRING)? #unicodeStringLiteral ; comparisonOperator : EQ | NEQ | LT | LTE | GT | GTE ; comparisonQuantifier : ALL | SOME | ANY ; booleanValue : TRUE | FALSE ; normalForm : NFD | NFC | NFKD | NFKC ; type : type ARRAY | ARRAY '<' type '>' | MAP '<' type ',' type '>' | ROW '(' identifier type (',' identifier type)* ')' | baseType ('(' typeParameter (',' typeParameter)* ')')? ; typeParameter : INTEGER_VALUE | type ; baseType : TIME_WITH_TIME_ZONE | TIMESTAMP_WITH_TIME_ZONE | DOUBLE_PRECISION | identifier ; pathElement : identifier '.' identifier #qualifiedArgument | identifier #unqualifiedArgument ; pathSpecification : pathElement (',' pathElement)* ; privilege : SELECT | DELETE | INSERT | identifier ; qualifiedName : identifier ('.' identifier)* ; identifier : IDENTIFIER #unquotedIdentifier | QUOTED_IDENTIFIER #quotedIdentifier | nonReserved #unquotedIdentifier | BACKQUOTED_IDENTIFIER #backQuotedIdentifier | DIGIT_IDENTIFIER #digitIdentifier ; number : DECIMAL_VALUE #decimalLiteral | DOUBLE_VALUE #doubleLiteral | INTEGER_VALUE #integerLiteral ; nonReserved // IMPORTANT: this rule must only contain tokens. Nested rules are not supported. See SqlParser.exitNonReserved : ADD | ALL | ANALYZE | ANY | ARRAY | ASC | AT | BERNOULLI | CALL | CASCADE | CATALOGS | COLUMN | COLUMNS | COMMENT | COMMIT | COMMITTED | CURRENT | DATA | DATE | DAY | DESC | DISTRIBUTED | EXCLUDING | EXPLAIN | FILTER | FIRST | FOLLOWING | FORMAT | FUNCTIONS | GRANT | GRANTS | GRAPHVIZ | HOUR | IF | INCLUDING | INPUT | INTERVAL | ISOLATION | LAST | LATERAL | LEVEL | LIMIT | LOGICAL | MAP | MINUTE | MONTH | NFC | NFD | NFKC | NFKD | NO | NULLIF | NULLS | ONLY | OPTION | ORDINALITY | OUTPUT | OVER | PARTITION | PARTITIONS | PATH | POSITION | PRECEDING | PRIVILEGES | PROPERTIES | PUBLIC | RANGE | READ | RENAME | REPEATABLE | REPLACE | RESET | RESTRICT | REVOKE | ROLLBACK | ROW | ROWS | SCHEMA | SCHEMAS | SECOND | SERIALIZABLE | SESSION | SET | SETS | SHOW | SOME | START | STATS | SUBSTRING | SYSTEM | TABLES | TABLESAMPLE | TEXT | TIME | TIMESTAMP | TO | TRANSACTION | TRY_CAST | TYPE | UNBOUNDED | UNCOMMITTED | USE | VALIDATE | VERBOSE | VIEW | WORK | WRITE | YEAR | ZONE ; ADD: 'ADD'; ALL: 'ALL'; ALTER: 'ALTER'; ANALYZE: 'ANALYZE'; AND: 'AND'; ANY: 'ANY'; ARRAY: 'ARRAY'; AS: 'AS'; ASC: 'ASC'; AT: 'AT'; BERNOULLI: 'BERNOULLI'; BETWEEN: 'BETWEEN'; BY: 'BY'; CALL: 'CALL'; CASCADE: 'CASCADE'; CASE: 'CASE'; CAST: 'CAST'; CATALOGS: 'CATALOGS'; COLUMN: 'COLUMN'; COLUMNS: 'COLUMNS'; COMMENT: 'COMMENT'; COMMIT: 'COMMIT'; COMMITTED: 'COMMITTED'; CONSTRAINT: 'CONSTRAINT'; CREATE: 'CREATE'; CROSS: 'CROSS'; CUBE: 'CUBE'; CURRENT: 'CURRENT'; CURRENT_DATE: 'CURRENT_DATE'; CURRENT_PATH: 'CURRENT_PATH'; CURRENT_TIME: 'CURRENT_TIME'; CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'; CURRENT_USER: 'CURRENT_USER'; DATA: 'DATA'; DATE: 'DATE'; DAY: 'DAY'; DEALLOCATE: 'DEALLOCATE'; DELETE: 'DELETE'; DESC: 'DESC'; DESCRIBE: 'DESCRIBE'; DISTINCT: 'DISTINCT'; DISTRIBUTED: 'DISTRIBUTED'; DROP: 'DROP'; ELSE: 'ELSE'; END: 'END'; ESCAPE: 'ESCAPE'; EXCEPT: 'EXCEPT'; EXCLUDING: 'EXCLUDING'; EXECUTE: 'EXECUTE'; EXISTS: 'EXISTS'; EXPLAIN: 'EXPLAIN'; EXTRACT: 'EXTRACT'; FALSE: 'FALSE'; FILTER: 'FILTER'; FIRST: 'FIRST'; FOLLOWING: 'FOLLOWING'; FOR: 'FOR'; FORMAT: 'FORMAT'; FROM: 'FROM'; SOURCE: 'SOURCE'; SINK: 'SINK'; BATCH: 'BATCH'; FUNCTION: 'FUNCTION'; SYSTEM_OFFSET: 'SYSTEM_OFFSET'; ROWMAX_OFFSET: 'ROWMAX_OFFSET'; WATERMARK: 'WATERMARK'; FULL: 'FULL'; FUNCTIONS: 'FUNCTIONS'; GRANT: 'GRANT'; GRANTS: 'GRANTS'; GRAPHVIZ: 'GRAPHVIZ'; GROUP: 'GROUP'; GROUPING: 'GROUPING'; HAVING: 'HAVING'; HOUR: 'HOUR'; IF: 'IF'; IN: 'IN'; INCLUDING: 'INCLUDING'; INNER: 'INNER'; INPUT: 'INPUT'; INSERT: 'INSERT'; INTERSECT: 'INTERSECT'; INTERVAL: 'INTERVAL'; INTO: 'INTO'; IS: 'IS'; ISOLATION: 'ISOLATION'; JOIN: 'JOIN'; LAST: 'LAST'; LATERAL: 'LATERAL'; LEFT: 'LEFT'; LEVEL: 'LEVEL'; LIKE: 'LIKE'; LIMIT: 'LIMIT'; LOCALTIME: 'LOCALTIME'; LOCALTIMESTAMP: 'LOCALTIMESTAMP'; LOGICAL: 'LOGICAL'; MAP: 'MAP'; MINUTE: 'MINUTE'; MONTH: 'MONTH'; NATURAL: 'NATURAL'; NFC : 'NFC'; NFD : 'NFD'; NFKC : 'NFKC'; NFKD : 'NFKD'; NO: 'NO'; NORMALIZE: 'NORMALIZE'; NOT: 'NOT'; NULL: 'NULL'; NULLIF: 'NULLIF'; NULLS: 'NULLS'; ON: 'ON'; ONLY: 'ONLY'; OPTION: 'OPTION'; OR: 'OR'; ORDER: 'ORDER'; ORDINALITY: 'ORDINALITY'; OUTER: 'OUTER'; OUTPUT: 'OUTPUT'; OVER: 'OVER'; PARTITION: 'PARTITION'; PARTITIONS: 'PARTITIONS'; PATH: 'PATH'; POSITION: 'POSITION'; PRECEDING: 'PRECEDING'; PREPARE: 'PREPARE'; PRIVILEGES: 'PRIVILEGES'; PROPERTIES: 'PROPERTIES'; PUBLIC: 'PUBLIC'; RANGE: 'RANGE'; READ: 'READ'; RECURSIVE: 'RECURSIVE'; RENAME: 'RENAME'; REPEATABLE: 'REPEATABLE'; REPLACE: 'REPLACE'; RESET: 'RESET'; RESTRICT: 'RESTRICT'; REVOKE: 'REVOKE'; RIGHT: 'RIGHT'; ROLLBACK: 'ROLLBACK'; ROLLUP: 'ROLLUP'; ROW: 'ROW'; ROWS: 'ROWS'; SCHEMA: 'SCHEMA'; SCHEMAS: 'SCHEMAS'; SECOND: 'SECOND'; SELECT: 'SELECT'; SERIALIZABLE: 'SERIALIZABLE'; SESSION: 'SESSION'; SET: 'SET'; SETS: 'SETS'; SHOW: 'SHOW'; SOME: 'SOME'; START: 'START'; STATS: 'STATS'; SUBSTRING: 'SUBSTRING'; SYSTEM: 'SYSTEM'; TABLE: 'TABLE'; TABLES: 'TABLES'; TABLESAMPLE: 'TABLESAMPLE'; TEXT: 'TEXT'; THEN: 'THEN'; TIME: 'TIME'; TIMESTAMP: 'TIMESTAMP'; TO: 'TO'; TRANSACTION: 'TRANSACTION'; TRUE: 'TRUE'; TRY_CAST: 'TRY_CAST'; TYPE: 'TYPE'; UESCAPE: 'UESCAPE'; UNBOUNDED: 'UNBOUNDED'; UNCOMMITTED: 'UNCOMMITTED'; UNION: 'UNION'; UNNEST: 'UNNEST'; USE: 'USE'; USING: 'USING'; VALIDATE: 'VALIDATE'; VALUES: 'VALUES'; VERBOSE: 'VERBOSE'; VIEW: 'VIEW'; WHEN: 'WHEN'; WHERE: 'WHERE'; WITH: 'WITH'; WORK: 'WORK'; WRITE: 'WRITE'; YEAR: 'YEAR'; ZONE: 'ZONE'; EQ : '='; NEQ : '<>' | '!='; LT : '<'; LTE : '<='; GT : '>'; GTE : '>='; PLUS: '+'; MINUS: '-'; ASTERISK: '*'; SLASH: '/'; PERCENT: '%'; CONCAT: '||'; STRING : '\'' ( ~'\'' | '\'\'' )* '\'' ; UNICODE_STRING : 'U&\'' ( ~'\'' | '\'\'' )* '\'' ; // Note: we allow any character inside the binary literal and validate // its a correct literal when the AST is being constructed. This // allows us to provide more meaningful error messages to the user BINARY_LITERAL : 'X\'' (~'\'')* '\'' ; INTEGER_VALUE : DIGIT+ ; DECIMAL_VALUE : DIGIT+ '.' DIGIT* | '.' DIGIT+ ; DOUBLE_VALUE : DIGIT+ ('.' DIGIT*)? EXPONENT | '.' DIGIT+ EXPONENT ; IDENTIFIER : (LETTER | '_') (LETTER | DIGIT | '_' | '@' | ':')* ; DIGIT_IDENTIFIER : DIGIT (LETTER | DIGIT | '_' | '@' | ':')+ ; QUOTED_IDENTIFIER : '"' ( ~'"' | '""' )* '"' ; BACKQUOTED_IDENTIFIER : '`' ( ~'`' | '``' )* '`' ; TIME_WITH_TIME_ZONE : 'TIME' WS 'WITH' WS 'TIME' WS 'ZONE' ; TIMESTAMP_WITH_TIME_ZONE : 'TIMESTAMP' WS 'WITH' WS 'TIME' WS 'ZONE' ; DOUBLE_PRECISION : 'DOUBLE' WS 'PRECISION' ; fragment EXPONENT : 'E' [+-]? DIGIT+ ; fragment DIGIT : [0-9] ; fragment LETTER : [A-Z] ; SIMPLE_COMMENT : '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN) ; BRACKETED_COMMENT : '/*' .*? '*/' -> channel(HIDDEN) ; WS : [ \r\n\t]+ -> channel(HIDDEN) ; // Catch-all for anything we can't recognize. // We use this to be able to ignore and recover all the text // when splitting statements with DelimiterLexer UNRECOGNIZED : . ;
ada-interrupts.ads
mgrojo/adalib
15
21207
<filename>ada-interrupts.ads -- Standard Ada library specification -- Copyright (c) 2003-2018 <NAME> <<EMAIL>> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with System; package Ada.Interrupts is type Interrupt_ID is (Implementation_Defined); type Parameterless_Handler is access protected procedure; function Is_Reserved (Interrupt : in Interrupt_ID) return Boolean; function Is_Attached (Interrupt : in Interrupt_ID) return Boolean; function Current_Handler (Interrupt : in Interrupt_ID) return Parameterless_Handler; procedure Attach_Handler (New_Handler : in Parameterless_Handler; Interrupt : in Interrupt_ID); procedure Exchange_Handler (Old_Handler : out Parameterless_Handler; New_Handler : in Parameterless_Handler; Interrupt : in Interrupt_ID); procedure Detach_Handler (Interrupt : in Interrupt_ID); function Reference (Interrupt : in Interrupt_ID) return System.Address; private end Ada.Interrupts;
programs/oeis/271/A271939.asm
neoneye/loda
22
101729
; A271939: Number of edges in the n-th order Sierpinski carpet graph. ; 8,88,776,6424,52040,418264,3351944,26833048,214716872,1717892440,13743611912,109950312472,879606751304,7036866765016,56294972383880,450359893862296,3602879495272136,28823036995298392,230584299061751048,1844674401792100120 add $0,1 mov $1,3 pow $1,$0 mov $2,8 pow $2,$0 sub $2,$1 mov $0,$2 mul $0,4 div $0,20 mul $0,8
oeis/137/A137530.asm
neoneye/loda-programs
11
240423
<filename>oeis/137/A137530.asm ; A137530: Primes of the form 5k^2 + 1. ; Submitted by <NAME>(w3) ; 181,1621,6481,8821,35281,52021,58321,87121,103681,112501,131221,141121,151381,172981,184321,302581,380881,414721,450001,486721,544501,626581,691921,737281,784081,808021,1039681,1067221,1240021,1300501,1362421 mov $2,332202 lpb $2 mov $3,$6 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $5,$1 add $1,20 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,18 add $5,$1 mov $6,$5 lpe mov $0,$5 add $0,1
data/main.asm
MasterQ32/SLF
3
240327
symtable_start exports defsymbol str_reset, reset_def symtable_end exports symtable_start imports defsymbol str_strcpy, patch_location symtable_end imports stringtable_start strings str_reset: string 'reset' str_strcpy: string 'strcpy' stringtable_end strings relocs_start relocs DD reloc_loc - data relocs_end relocs ALIGN 16 data: reset_def: DB "This is the reset symbol", 0 DW 0x1111 patch_location: DW 0 DW 0x2222 ALIGN 2 DB "XXXX" reloc_loc: DW 0x8788 DB "XXXX" data_end:
test_2.asm
shavtvalishvili/Assembly-Emulator
0
171458
<gh_stars>0 R1 = 10 R1 = NEG R1 + NEG2 R2 = 5 R1 = R1 + 1 BLE R1, R2, PC-4 RV = R1 RET
SDG/Extra/OrderedAlgebra/Structures.agda
wrrnhttn/agda-sdg
1
12667
{-# OPTIONS --without-K --safe #-} open import Level hiding (zero) open import Relation.Binary module SDG.Extra.OrderedAlgebra.Structures {a ℓ} {A : Set a} (_≈_ : Rel A ℓ) where open import Algebra.Structures open import Algebra.FunctionProperties record IsOrderedCommutativeRing (_<_ : Rel A ℓ) (_+_ _*_ : Op₂ A) (-_ : Op₁ A) (0# 1# : A) : Set (a ⊔ ℓ) where field isCommutativeRing : IsCommutativeRing _≈_ _+_ _*_ -_ 0# 1# <-isStrictTotalOrder : IsStrictTotalOrder _≈_ _<_ <-+ : ∀ (a b c) → a < b → (a + c) < (b + c) <-* : ∀ (a b) → 0# < a → 0# < b → 0# < (a * b) open IsCommutativeRing isCommutativeRing public --using (zero) open IsStrictTotalOrder <-isStrictTotalOrder public
libsrc/_DEVELOPMENT/alloc/malloc/c/sccz80/heap_alloc_fixed_unlocked_callee.asm
jpoikela/z88dk
640
13808
<reponame>jpoikela/z88dk<gh_stars>100-1000 ; void *heap_alloc_fixed_unlocked(void *heap, void *p, size_t size) SECTION code_clib SECTION code_alloc_malloc PUBLIC heap_alloc_fixed_unlocked_callee EXTERN asm_heap_alloc_fixed_unlocked heap_alloc_fixed_unlocked_callee: pop af pop hl pop bc pop de push af jp asm_heap_alloc_fixed_unlocked
test/interaction/Issue945.agda
cruhland/agda
1,989
15788
<gh_stars>1000+ -- Display whether or not the timeout was hit when using auto -l. module Issue945 where data ⊥ : Set where ¬_ : Set → Set ¬ A = A → ⊥ record ∃ {A : Set} (P : A → Set) : Set where constructor _,_ field witness : A proof : P witness -- Exhaustive lem₁ : ∀ {A : Set} (P : A → Set) (x : A) → (∀ x → ¬ P x) → (∀ x → P x) → ⊥ lem₁ A = {!-l -t 1!} -- Timeout lem₂ : ∀ {A} (P : A → Set) (x : A) → (∀ x → ¬ P x) → (∀ x → P x) → ∃ P → ⊥ lem₂ P a e = {!-l -t 1!}
alloy4fun_models/trashltl/models/11/e5Q3nxGTbgJK5vw4u.als
Kaixi26/org.alloytools.alloy
0
1305
<reponame>Kaixi26/org.alloytools.alloy open main pred ide5Q3nxGTbgJK5vw4u_prop12 { always all f:File | eventually f in Trash implies f in Trash } pred __repair { ide5Q3nxGTbgJK5vw4u_prop12 } check __repair { ide5Q3nxGTbgJK5vw4u_prop12 <=> prop12o }
cmd/edlin/edlin.asm
minblock/msdos
0
241608
<filename>cmd/edlin/edlin.asm<gh_stars>0 PAGE 60,132; TITLE EDLIN ;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ ;======================= START OF SPECIFICATIONS ========================= ; ; MODULE NAME: EDLIN.SAL ; ; DESCRIPTIVE NAME: LINE TEXT EDITOR ; ; FUNCTION: EDLIN IS A SIMPLE, LINE ORIENTED TEXT EDITOR. IT PROVIDES ; USERS OF DOS THE ABILITY TO CREATE AND EDIT TEXT FILES. ; ; ENTRY POINT: EDLIN ; ; INPUT: DOS COMMAND LINE ; EDLIN COMMANDS ; TEXT ; ; EXIT NORMAL: NA ; ; EXIT ERROR: NA ; ; INTERNAL REFERENCES: ; ; EXTERNAL REFERENCES: ; ; ROUTINE: EDLCMD1 - CONTAINS ROUTINES CALLED BY EDLIN ; EDLCMD1 - CONTAINS ROUTINES CALLED BY EDLIN ; EDLMES - CONTAINS ROUTINES CALLED BY EDLIN ; ; LINK EDLIN+EDLCMD1+EDLCMD2+EDLMES+EDLPARSE ; ; REVISION HISTORY: ; ; AN000 VERSION 4.00 - REVISIONS MADE RELATE TO THE FOLLOWING: ; ; - IMPLEMENT SYSPARSE ; - IMPLEMENT MESSAGE RETRIEVER ; - IMPLEMENT DBCS ENABLING ; - ENHANCED VIDEO SUPPORT ; - EXTENDED OPENS ; - SCROLLING ERROR ; ; COPYRIGHT: "MS DOS EDLIN UTILITY" ; "VERSION 4.00 (C) COPYRIGHT 1988 Microsoft" ; "LICENSED MATERIAL - PROPERTY OF Microsoft" ; ; ; MICROSOFT REVISION HISTORY: ; ; ; V1.02 ; ; ; ; V2.00 9/13/82 M.A.U ; ; ; ; 2/23/82 Rev. 13 <NAME> ; ; Changed to 2.0 system calls. ; ; Added an error message for READ-ONLY files ; ; ; ; 11/7/83 Rev. 14 <NAME> ; ; Changed to .EXE format and added Printf ; ; ; ; V2.50 11/15/83 Rev. 1 M.A. U ; ; Official dos 2.50 version. Some random bug ; ; fixes and message changes. ; ; ; ; 11/30/83 Rev. 2 MZ ; ; Close input file before rename. ; ; Jmp to replace after line edit ; ; ; ; 02/01/84 Rev. 3 <NAME> ; ; Now it is called 3.00 dos. Repaired problem ; ; with using printf and having %'s as data. ; ; ; ; 02/15/84 MZ make out of space a fatal error with output; ; ; ; 03/28/84 MZ fixes bogus (totally) code in MOVE/COPY ; ; ; ; 04/02/84 MZ fixes DELETE and changes MOVE/COPY/EDIT ; ; ; ; V3.20 08/29/86 Rev. 1 <NAME> ; ; ; ; 08/29/86 M001 MSKK TAR 593, TAB MOVEMENT ; ; ; ; 08/29/86 M002 MSKK TAR 157, BLKMOVE 1,1,1m, 1,3,1m ; ; ; ; 08/29/86 M003 MSKK TAR 476, EDLCMD2,MAKECAPS,kana char ; ; ; ; 08/29/86 M004 MSKK TAR 191, Append load size ; ; ; ; 08/29/86 M005 IBMJ TAR Transfer Load command ; ; ; ; 04/17/90 c-PaulB ; ; Added /? switch to display options ; ; Files changed: edlin.asm, edlparse.asm, edlmes.asm, ; ; edlin.skl. ; ; ; ;======================= END OF SPECIFICATIONS =========================== ; include version.inc include intnat.inc include syscall.inc include edlequ.asm SUBTTL Contants and Data areas PAGE extrn parser_command:near ;an000;SYSPARSE CODE SEGMENT PUBLIC CODE ENDS CONST SEGMENT PUBLIC WORD CONST ENDS cstack segment stack cstack ends DATA SEGMENT PUBLIC WORD DATA ENDS DG GROUP CODE,CONST,cstack,DATA CONST SEGMENT PUBLIC WORD public bak,$$$file,delflg,loadmod,txt1,txt2 EXTRN BADDRV:abs,NDNAME:abs EXTRN opt_err_ptr:word,NOBAK:abs,BADCOM:abs EXTRN NEWFIL:abs,DEST:abs,MRGERR:abs EXTRN NODIR:abs,FILENM_ptr:word,ro_err:abs EXTRN bcreat:abs,msg_too_many:abs,msg_lf:abs EXTRN prompt:abs,MemFul_Ptr:word,simple_msg:word extrn dsp_options:abs extrn dsp_help:abs,num_help_msgs:abs BAK DB ".BAK",0 $$$FILE DB ".$$$",0 fourth db 0 ;fourth parameter flag loadmod db 0 ;Load mode flag, 0 = ^Z marks the ; end of a file, 1 = viceversa. optchar db "-" TXT1 DB 0,80H DUP (?) TXT2 DB 0,80H DUP (?) DELFLG DB 0 fNew DB 0 ; old file HAVEOF DB 0 CONST ENDS cstack segment stack db stksiz dup (?) cstack ends DATA SEGMENT PUBLIC WORD extrn arg_buf_ptr:word ;an000; extrn line_num_buf_ptr:word ;an000; public path_name,ext_ptr,start,line_num,line_flag public arg_buf,wrt_handle,temp_path public current,pointer,qflg,editbuf,amnt_req,fname_len,delflg,lastlin public olddat,oldlen,newlen,srchflg,srchmod public comline,lstfnd,numpos,lstnum,last_mem,srchcnt public rd_handle,haveof,ending,three4th,one4th public lc_adj ;an000;page length adj. factor public lc_flag ;an000;display cont. flag public pg_count ;an000;lines left on screen public Disp_Len ;an000;display length public Disp_Width ;an000;display width public continue ;an000;boolean T/F public temp_path ;an000;pointer to filespec buf Video_Buffer label word ;an000;buffer for video attr db 0 ;an000;dms; db 0 ;an000;dms; dw 14 ;an000;dms; dw 0 ;an000;dms; db ? ;an000;dms; db 0 ;an000;dms; dw ? ;an000;dms;# of colors dw ? ;an000;dms;# of pixels in width dw ? ;an000;dms;# of pixels in len. dw ? ;an000;dms;# of chars in width dw ? ;an000;dms;# of chars in length video_org db ? ;an000;original video mode on ; entry to EDLIN. lc_adj db ? ;an000;page length adj. factor lc_flag db ? ;an000;display cont. flag pg_count db ? ;an000;lines left on screen Disp_Len db ? ;an000;display length Disp_Width db ? ;an000;display width continue db ? ;an000;boolean T/F ;-----------------------------------------------------------------------; ; This is a table that is sequentially filled via GetNum. Any additions to it ; must be placed in the correct position. Currently Param4 is known to be a ; count and thus is treated specially. public param1,param2,Param3,param4,ParamCt PARAM1 DW ? PARAM2 DW ? PARAM3 DW ? PARAM4 DW ? ParamCt DW ? ; count of passed parameters ifdef DBCS ; Used in TESTKANJ: LBTbl dd ? ; long pointer to lead byte table endif ; in the dos (from syscall 63H) ;-----------------------------------------------------------------------; PUBLIC PTR_1, PTR_2, PTR_3, OLDLEN, NEWLEN, LSTFND, LSTNUM, NUMPOS, SRCHCNT PUBLIC CURRENT, POINTER, ONE4TH, THREE4TH, LAST_MEM, ENDTXT, COPYSIZ PUBLIC COMLINE, LASTLIN, COMBUF, EDITBUF, EOL, QFLG, ENDING, SRCHFLG PUBLIC PATH_NAME, FNAME_LEN, RD_HANDLE, TEMP_PATH, WRT_HANDLE, EXT_PTR PUBLIC MRG_PATH_NAME, MRG_HANDLE, amnt_req, olddat, srchmod, MOVFLG, org_ds ifdef DBCS public lbtbl endif ; ; These comprise the known state of the internal buffer. All editing ; functions must preserve these values. ; CURRENT DW ? ; the 1-based index of the current line POINTER DW ? ; pointer to the current line ENDTXT DW ? ; pointer to end of buffer. (at ^Z) LAST_MEM DW ? ; offset of last byte of memory ; ; The label Start is the beginning of the in-core buffer. ; ; ; Internal temporary pointers ; PTR_1 DW ? PTR_2 DW ? PTR_3 DW ? QFLG DB ? ; TRUE => query for replacement OLDLEN DW ? NEWLEN DW ? LSTFND DW ? LSTNUM DW ? NUMPOS DW ? SRCHCNT DW ? ONE4TH DW ? THREE4TH DW ? COPYSIZ DW ? ; total length to copy COPYLEN DW ? ; single copy length COMLINE DW ? LASTLIN DW ? COMBUF DB 82H DUP (?) EDITBUF DB 258 DUP (?) EOL DB ? ENDING DB ? SRCHFLG DB ? PATH_NAME DB 128 DUP(0) FNAME_LEN DW ? RD_HANDLE DW ? TEMP_PATH DB 128 DUP(?) WRT_HANDLE DW ? EXT_PTR DW ? MRG_PATH_NAME DB 128 DUP(?) MRG_HANDLE DW ? amnt_req dw ? ; amount of bytes requested to read olddat db ? ; Used in replace and search, replace ; by old data flag (1=yes) srchmod db ? ; Search mode: 1=from current+1 to ; end of buffer, 0=from beg. of ; buffer to the end (old way). MOVFLG DB ? org_ds dw ? ;Orginal ds points to header block arg_buf db 258 dup (?) EA_Flag db False ;an000; dms;set to false EA_Buffer_Size dw ? ;an000; dms;EA buffer's size EA_Parm_List label word ;an000; dms;EA parms dd dg:Start ;an000; dms;ptr to EA's dw 0001h ;an000; dms;additional parms db 06h ;an000; dms; dw 0002h ;an000; dms;iomode line_num dw ? line_flag db ?,0 EVEN ;align on word boundaries ; ; Byte before start of data buffer must be < 40H !!!!!! ; dw 0 ;we scan backwards looking for ;a character which can't be part ;of a two-byte seqence. This ;double byte sequence will cause the back ;scan to stop here. START LABEL WORD DATA ENDS CODE SEGMENT PUBLIC ASSUME CS:DG,DS:NOTHING,ES:NOTHING,SS:CStack extrn pre_load_message:near ;an000;message loader extrn disp_fatal:near ;an000;fatal message extrn printf:near ;an000;new PRINTF routine extrn findlin:near,shownum:near,loadbuf:near,crlf:near,lf:near extrn abortcom:near,delbak:near,unquote:near,kill_bl:near extrn make_caps:near,dispone:near,display:near,query:near extrn quit:near,make_cntrl:near,scanln:near,scaneof:near extrn fndfirst:near,fndnext:near,replace:near,memerr:near extrn xerror:near extrn zerror:near extrn bad_read:near,append:near extrn nocom:near,pager:near,list:near,search_from_curr:near extrn replac_from_curr:near,ewrite:near,wrt:near,delete:near extrn filespec:byte ;an000;parser's filespec extrn parse_switch_b:byte ;an000;result of switch scan extrn parse_switch_?:byte ; result of switch scan public std_printf,command,chkrange,comerr public display_message ; exit from EDLIN IFDEF DBCS extrn testkanj:near ENDIF EDLIN: JMP SHORT SIMPED std_printf proc near ;ac000;convert to proc push dx call printf pop dx ;an000;balance the push ret std_printf endp ;ac000;end proc Break <Dispatch Table> ;-----------------------------------------------------------------------; ; Careful changing the order of the next two tables. They are linked and ; changes should be be to both. COMTAB DB 13,";ACDEILMPQRSTW" NUMCOM EQU $-COMTAB TABLE DW BLANKLINE ; Blank line DW NOCOM ; ; DW APPEND ; A(ppend) DW COPY ; C(opy) DW DELETE ; D(elete) DW ENDED ; E(xit) DW INSERT ; I(nsert) DW LIST ; L(ist) DW MOVE ; M(ove) DW PAGER ; P(age) DW QUIT ; Q(uit) dw replac_from_curr ; R(eplace) dw search_from_curr ; S(earch) DW MERGE ; T(merge) DW EWRITE ; W(rite) Break <Initialization Code> NONAME: mov ax,NDNAME jmp zerror SIMPED: mov org_ds,DS push ax ;ac000;save for drive compare push cs ;an000;exchange cs/es pop es ;an000; push cs ;an000;exchange cs/ds pop ds ;an000; assume ds:dg,es:dg ;an000;establish addressibility MOV dg:ENDING,0 mov sp,stack call EDLIN_DISP_GET ;an000;get current video ; mode & set it to ; text ;========================================================================= ; invoke PRE_LOAD_MESSAGE here. If the messages were not loaded we will ; exit with an appropriate error message. ; ; Date : 6/14/87 ;========================================================================= call PRE_LOAD_MESSAGE ;an000;invoke SYSLOADMSG ; $if c ;an000;if the load was unsuccessful JNC $$IF1 mov ah,exit ;an000;exit EDLIN. PRE_LOAD_MESSAGE ; has said why we are exiting mov al,00h ;an000 int 21h ;an000;exit ; $endif ;an000; $$IF1: VERS_OK: ;----- Check for valid drive specifier --------------------------------; pop ax OR AL,AL JZ get_switch_char mov ax,BADDRV jmp zerror get_switch_char: MOV AX,(CHAR_OPER SHL 8) ;GET SWITCH CHARACTER INT 21H CMP DL,"/" JNZ CMD_LINE ;IF NOT / , THEN NOT PC MOV OPTCHAR,"/" ;IN PC, OPTION CHAR = / IFDEF DBCS push ds ; SAVE! all regs destroyed on this push es push si ; call !! mov ax,(ECS_call shl 8) or 00h ; get kanji lead tbl int 21h assume ds:nothing assume es:nothing mov word ptr [LBTbl],si mov word ptr [LBTbl+2],ds pop si pop es pop ds assume ds:dg assume es:dg ENDIF CMD_LINE: push cs pop es ASSUME ES:DG ;----- Process any options ------------------------------------------; ;========================================================================= ; The system parser, called through PARSER_COMMAND, parses external ; command lines. In the case of EDLIN we are looking for two parameters ; on the command line. ; ; Parameter 1 - Filespec (REQUIRED) ; Parameter 2 - \B switch (OPTIONAL) ; ; PARSER_COMMAND - exit_normal : ffffh ; exit_error : not = ffffh ;========================================================================= call PARSER_COMMAND ;an000;invoke sysparse ; DMS:6/11/87 ; Check for /? switch. ; If so, display the options ; and exit. ; ; This is done first so that if the user typed ; /? along with unknown commands, they can get ; a coherent message without being over-errored. ; ; 4/17/90 c-PaulB cmp [parse_switch_?], true ; is the /? switch on? jne CheckOptionsDone ; skip the rest of this if not mov ax,dsp_options call display_message mov al, 0 ; get an okay exit code mov ah, exit ; and int 21h ; bail out. CheckOptionsDone: cmp ax,nrm_parse_exit ;an000;was it a good parse ; $if z ;an000;it was a good parse JNZ $$IF3 call EDLIN_COMMAND ;an000;interface results ; into EDLIN ; $else ;an000; JMP SHORT $$EN3 $$IF3: cmp ax,too_many ;an000;too many operands ; $if z ;an000;we have too many JNZ $$IF5 jmp short badopt ;an000;say why and exit ; $endif $$IF5: cmp ax,op_missing ;an000;required parm missing ; $if z ;an000;missing parm JNZ $$IF7 ifdef DBCS jmp noname ;an000;say why and exit else jmp short noname ;an000;say why and exit endif ; $endif ;an000; $$IF7: cmp ax,sw_missing ;an000;is it an invalid switch ; $if z ;an000;invalid switch JNZ $$IF9 jmp short badopt ;an000;say why and exit ; $endif ;an000; $$IF9: ; $endif ;an000; $$EN3: ;========================================================================= ;======================= begin .BAK check ================================ ; Check for .BAK extension on the filename push ds ;an000;save reg. push cs ;an000;set up addressibility pop ds ;an000; assume ds:dg ;an000; push ax ;an000;save reg. mov ax,offset dg:path_name ;an000;point to path_name add ax,[fname_len] ;an000;calculate end of path_name mov si,ax ;an000;point to end of path_name pop ax ;an000;restore reg. MOV CX,4 ;compare 4 bytes SUB SI,4 ;Point 4th to last char MOV DI,OFFSET DG:BAK ;Point to string ".BAK" REPE CMPSB ;Compare the two strings pop ds ASSUME DS:NOTHING JNZ NOTBAK JMP HAVBAK ;======================= end .BAK check ================================== ;======================= begin NOTBAK ==================================== ; we have a file without a .BAK extension, try to open it NOTBAK: push ds push cs pop ds ASSUME DS:DG ;========================================================================= ; implement EXTENDED OPEN ;========================================================================= push es ;an000;save reg. mov bx,RW ;an000;open for read/write mov cx,ATTR ;an000;file attributes mov dx,RW_FLAG ;an000;action to take on open mov di,0ffffh ;an000;nul parm list call EXT_OPEN1 ;an000;open for R/W;DMS:6/10/87 pop es ;an000;restore reg. ;========================================================================= pop ds ASSUME DS:NOTHING JC CHK_OPEN_ERR ;an open error occurred MOV RD_HANDLE,AX ;Save the handle Jmp HavFil ;work with the opened file ;======================= end NOTBAK ====================================== Badopt: MOV DX,OFFSET DG:OPT_ERR_ptr;Bad option specified JMP XERROR ;========================================================================= ; ; The open of the file failed. We need to figure out why and report the ; correct message. The circumstances we can handle are: ; ; open returns pathnotfound => bad drive or file name ; open returns toomanyopenfiles => too many open files ; open returns access denied => ; chmod indicates read-only => cannot edit read only file ; else => file creation error ; open returns filenotfound => ; creat ok => close, delete, new file ; creat fails => file creation error ; else => file cre ; CHK_OPEN_ERR: cmp ax,error_path_not_found jz BadDriveError cmp ax,error_too_many_open_files jz TooManyError cmp ax,error_access_denied jnz CheckFNF push ds push cs pop ds assume ds:dg mov ax,(chmod shl 8) MOV DX,OFFSET DG:PATH_NAME int 21h jc FileCreationError test cx,attr_read_only jz FileCreationError jmp short ReadOnlyError CheckFNF: cmp ax,error_file_not_found jnz FileCreationError ; ; Try to create the file to see if it is OK. ; push ds push cs pop ds assume ds:dg ;========================================================================= ; implement EXTENDED OPEN ;========================================================================= mov bx,RW ;an000;open for read/write mov cx,ATTR ;an000;file attributes mov dx,CREAT_FLAG ;an000;action to take on open mov di,0ffffh ;an000;null parm list call EXT_OPEN1 ;an000;create file;DMS:6/10/87 ;========================================================================= pop ds assume ds:nothing jc CreateCheck mov bx,ax mov ah,close int 21h push ds push cs pop ds assume ds:dg mov ah,unlink MOV DX,OFFSET DG:PATH_NAME int 21h pop ds assume ds:nothing jc FileCreationError ; This should NEVER be taken!!! MOV HAVEOF,0FFH ; Flag from a system 1.xx call MOV fNew,-1 JMP short HAVFIL CreateCheck: cmp ax,error_access_denied jnz BadDriveError DiskFull: mov ax,NODIR jmp zerror FileCreationError: mov ax,bcreat jmp zerror ReadOnlyError: mov ax,RO_ERR jmp zerror BadDriveError: mov ax,BADDRV jmp zerror TooManyError: mov ax,msg_too_many jmp zerror CREAT_ERR: CMP DELFLG,0 JNZ DiskFull push cs pop ds CALL DELBAK JMP short MAKFIL HAVBAK: mov ax,NOBAK jmp zerror HAVFIL: push cs pop ds ASSUME DS:DG CMP fNew,0 JZ MakeBak mov ax,newfil call display_message MakeBak: MOV SI,OFFSET DG:PATH_NAME MOV CX,[FNAME_LEN] PUSH CX MOV DI,OFFSET DG:TEMP_PATH REP MOVSB DEC DI MOV DX,DI POP CX MOV AL,"." STD REPNE SCASB JZ FOUND_EXT MOV DI,DX ;Point to last char in filename FOUND_EXT: CLD INC DI MOV [EXT_PTR],DI MOV SI,OFFSET DG:$$$FILE MOV CX,5 REP MOVSB ;Create .$$$ file to make sure directory has room MAKFIL: ;========================================================================= ; implement EXTENDED OPEN ;========================================================================= mov bx,RW ;an000;open for read/write mov cx,ATTR ;an000;file attributes mov dx,Creat_Open_Flag ;an000;action to take on open cmp EA_Flag,True ;an000;EA_Buffer used? ; $if e ;an000;yes JNE $$IF12 mov di,offset dg:EA_Parm_List ;an000; point to buffer ; $else ;an000; JMP SHORT $$EN12 $$IF12: mov di,0ffffh ;an000;nul parm list ; $endif ;an000; $$EN12: call EXT_OPEN2 ;an000;create file;DMS:6/10/87 ;========================================================================= JC CREAT_ERR MOV [WRT_HANDLE],AX ; ; We determine the size of the available memory. Use the word in the PDB at ; [2] to determine the number of paragraphs. Then truncate this to 64K at ; most. ; push ds ;save ds for size calc mov ds,[org_ds] MOV CX,DS:[2] MOV DI,CS SUB CX,DI CMP CX,1000h JBE GotSize MOV CX,0FFFh GotSize: SHL CX,1 SHL CX,1 SHL CX,1 SHL CX,1 pop ds ;restore ds after size calc DEC CX MOV [LAST_MEM],CX MOV DI,OFFSET DG:START TEST fNew,-1 JNZ SAVEND SUB CX,OFFSET DG:START ;Available memory SHR CX,1 ;1/2 of available memory MOV AX,CX SHR CX,1 ;1/4 of available memory MOV [ONE4TH],CX ;Save amount of 1/4 full ADD CX,AX ;3/4 of available memory MOV DX,CX ADD DX,OFFSET DG:START MOV [THREE4TH],DX ;Save pointer to 3/4 full MOV DX,OFFSET DG:START SAVEND: CLD MOV BYTE PTR [DI],1AH MOV [ENDTXT],DI MOV BYTE PTR [COMBUF],128 MOV BYTE PTR [EDITBUF],255 MOV BYTE PTR [EOL],10 MOV [POINTER],OFFSET DG:START MOV [CURRENT],1 MOV ParamCt,1 MOV [PARAM1],0 ;M004 Leave room in memory, was -1 TEST fNew,-1 JNZ COMMAND ; ; The above setting of PARAM1 to -1 causes this call to APPEND to try to read ; in as many lines that will fit, BUT.... What we are doing is simulating ; the user issuing an APPEND command, and if the user asks for more lines ; than we get then an "Insufficient memory" error occurs. In this case we ; DO NOT want this error, we just want as many lines as possible read in. ; The twiddle of ENDING suppresses the memory error ; MOV BYTE PTR [ENDING],1 ;Suppress memory errors CALL APPEND MOV ENDING,0 ; restore correct initial value Break <Main command loop> ; ; Main read/parse/execute loop. We reset the stack all the time as there ; are routines that JMP back here. Don't blame me; <NAME> write this. ; COMMAND: push cs ;an000;set up addressibility pop ds ;an000; push cs ;an000; pop es ;an000; assume ds:dg,es:dg ;an000; MOV SP, STACK MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR 23H MOV DX,OFFSET DG:ABORTCOM INT 21H mov ax,prompt call display_message MOV DX,OFFSET DG:COMBUF MOV AH,STD_CON_STRING_INPUT INT 21H MOV [COMLINE],OFFSET DG:COMBUF + 2 mov ax,msg_lf call display_message PARSE: MOV [PARAM2],0 MOV [PARAM3],0 MOV [PARAM4],0 mov [fourth],0 ;reset the fourth parameter flag MOV QFLG,0 MOV SI,[COMLINE] MOV BP,OFFSET DG:PARAM1 XOR DI,DI CHKLP: CALL GETNUM ; ; AL has first char after arg ; MOV ds:[BP+DI],DX ADD DI,2 MOV ParamCt,DI ; set up count of parameters SHR ParamCt,1 ; convert to index (1-based) CALL SKIP1 ; skip to next parameter CMP AL,"," ; is there a comma? jnz NOT_COMMA ; if not, then done with arguments cmp di,8 ; **** maximum size of PARAM array! jb CHKLP ; continue scanning if <4 PARAMS jmp short COMERR NOT_COMMA: DEC SI ; point at char next CALL Kill_BL ; skip all blanks CMP AL,"?" ; is there a ? JNZ DISPATCH ; no, got command letter MOV QFLG,-1 ; signal query CALL Kill_BL DISPATCH: CMP AL,5FH JBE UPCASE cmp al,"z" ja upcase AND AL,5FH UPCASE: MOV DI,OFFSET DG:COMTAB mov cx,NUMCOM REPNE SCASB JNZ COMERR SUB DI,1+OFFSET DG:COMTAB ; convert to index MOV BX,DI MOV AX,[PARAM2] OR AX,AX JZ PARMOK CMP AX,[PARAM1] JB COMERR ; Param. 2 must be >= param 1 PARMOK: MOV [COMLINE],SI SHL BX,1 CALL [BX+TABLE] COMOVER: MOV SI,[COMLINE] CALL Kill_BL CMP AL,0DH JZ COMMANDJ CMP AL,1AH JZ DELIM CMP AL,";" JNZ NODELIM DELIM: INC SI NODELIM: DEC SI MOV [COMLINE],SI JMP PARSE COMMANDJ: JMP COMMAND SKIP1: DEC SI CALL Kill_BL ret1: return Break <Range Checking and argument parsing> ; ; People call here. we need to reset the stack. ; Inputs: BX has param1 ; Outputs: Returns if BX <= Param2 ; CHKRANGE: CMP [PARAM2],0 retz CMP BX,[PARAM2] JBE RET1 POP DX ; clean up return address COMERR: mov ax,BADCOM zcomerr1: call display_message jmp command COMERR1: call std_printf JMP COMMAND ; ; GetNum parses off 1 argument from the command line. Argument forms are: ; nnn a number < 65536 ; +nnn current line + number ; -nnn current line - number ; . current line ; # lastline + 1 ; ; GETNUM: CALL Kill_BL cmp di,6 ;Is this the fourth parameter? jne sk1 mov [fourth],1 ;yes, set the flag sk1: CMP AL,"." JZ CURLIN CMP AL,"#" JZ MAXLIN CMP AL,"+" JZ FORLIN CMP AL,"-" JZ BACKLIN MOV DX,0 MOV CL,0 ;Flag no parameter seen yet NUMLP: CMP AL,"0" JB NUMCHK CMP AL,"9" JA NUMCHK CMP DX,6553 ;Max line/10 JAE COMERR ;Ten times this is too big MOV CL,1 ;Parameter digit has been found SUB AL,"0" MOV BX,DX SHL DX,1 SHL DX,1 ADD DX,BX SHL DX,1 CBW ADD DX,AX LODSB JMP SHORT NUMLP NUMCHK: CMP CL,0 retz OR DX,DX JZ COMERR ;Don't allow zero as a parameter return CURLIN: cmp [fourth],1 ;the fourth parameter? je comerra ;yes, an error MOV DX,[CURRENT] LODSB return MAXLIN: cmp [fourth],1 ;the fourth parameter? je comerra ;yes, an error MOV DX,1 MOV AL,0Ah PUSH DI MOV DI,OFFSET DG:START MOV CX,EndTxt SUB CX,DI MLoop: JCXZ MDone REPNZ SCASB JNZ MDone INC DX JMP MLoop MDone: POP DI LODSB return FORLIN: cmp [fourth],1 ;the fourth parameter? je comerra ;yes, an error CALL GETNUM ADD DX,[CURRENT] return BACKLIN: cmp [fourth],1 ;the fourth parameter? je comerra ;yes, an error CALL GETNUM MOV BX,[CURRENT] SUB BX,DX JA OkLin ; if negative or zero MOV BX,1 ; use first line OkLin: MOV DX,BX return comerra: jmp comerr ERRORJ: JMP COMERR ERROR1J: JMP zcomerr1 BLANKLINE: cmp QFLG,0 jnz SHOWHELP ; if ? at front of blank line, do HELP jmp NOCOM ; ignore blank line otherwise SHOWHELP: dec [COMLINE] ; point back to <cr> mov cx,num_help_msgs-1 mov ax,dsp_help SHOWHELP1: call display_message inc ax loop SHOWHELP1 ; fall into display_message for last message and return ;========================================================================= ; display_message : Displays a simple common message through the ; ; message retriever, using a common parameter ; ; block. ; Inputs : ax = message number to display ; ;========================================================================= display_message proc near mov dg:[simple_msg],ax mov dx,offset dg:simple_msg jmp printf ; display it display_message endp Break <Move and Copy commands> PUBLIC MOVE MOVE: CMP ParamCt,3 JNZ ERRORJ MOV BYTE PTR [MOVFLG],1 JMP SHORT BLKMOVE PUBLIC COPY COPY: CMP ParamCt,3 JB ERRORJ MOV BYTE PTR [MOVFLG],0 ; ; We are to move/copy a number of lines from one range to another. ; ; Memory looks like this: ; ; START: line 1 ; ... ; pointer-> line n Current has n in it ; ... ; line m ; endtxt-> ^Z ; ; The algoritm is: ; ; Bounds check on args. ; set ptr1 and ptr2 to range before move ; set copysiz to number to move ; open up copysize * count for destination ; if destination is before ptr1 then ; add copysize * count to both ptrs ; while count > 0 do ; move from ptr1 to destination for copysize bytes ; count -- ; if moving then ; move from ptr2 through end to ptr1 ; set endtxt to last byte moved. ; set current, pointer to original destination ; BLKMOVE: ; ; Make sure that all correct arguments are specified. ; MOV BX,[PARAM3] ; get destination of move/copy OR BX,BX ; must be specified (non-0) mov ax,DEST JZ ERROR1J ; is 0 => error ; ; get arg 1 (defaulting if necessary) and range check it. ; MOV BX,[PARAM1] ; get first argument OR BX,BX ; do we default it? JNZ NXTARG ; no, assume it is OK. MOV BX,[CURRENT] ; Defaults to the current line CALL CHKRANGE ; Make sure it is good. MOV [PARAM1],BX ; set it NXTARG: CALL FINDLIN ; find first argument line JNZ ErrorJ ; line not found MOV [PTR_1],DI ; ; get arg 2 (defaulting if necessary) and range check it. ; MOV BX,[PARAM2] ; Get the second parameter OR BX,BX ; do we default it too? JNZ HAVARGS ; Nope. MOV BX,[CURRENT] ; Defaults to the current line MOV [PARAM2],BX ; Stash it away HAVARGS: CALL FindLin JNZ ErrorJ ; line not found MOV BX,Param2 INC BX ;Get pointer to line Param2+1 CALL FINDLIN MOV [PTR_2],DI ;Save it ; ; We now have true line number arguments and pointers to the relevant places. ; ptr_1 points to beginning of region and ptr_2 points to first byte beyond ; that region. ; ; Check args for correct ordering of first two arguments ; mov dx,[param1] cmp dx,[param2] jbe havargs1 ; first must be <= second jmp comerr havargs1: ; ; make sure that the third argument is not contained in the first range ; MOV DX,[PARAM3] CMP DX,[PARAM1] ; third must be <= first or JBE NOERROR CMP DX,[PARAM2] JA NoError ; third must be > last JMP ComErr NOERROR: ; ; Determine number to move ; MOV CX,Ptr_2 SUB CX,Ptr_1 ; Calculate number of bytes to copy MOV CopySiz,CX MOV CopyLen,CX ; Save for individual move. MOV AX,[PARAM4] ; Was count defaulted? OR AX,AX JZ SizeOk ; yes, CX has correct value MUL [COPYSIZ] ; convert to true size MOV CX,AX ; move to count register OR DX,DX ; overflow? JZ SizeOK ; no JMP MEMERR ; yes, bomb. SizeOK: MOV [COPYSIZ],CX ; ; Check to see that we have room to grow by copysiz ; MOV AX,[ENDTXT] ; get pointer to last byte MOV DI,[LAST_MEM] ; get offset of last location in memory SUB DI,AX ; remainder of space CMP DI,CX ; is there at least copysiz room? JAE HAV_ROOM ; yes JMP MEMERR HAV_ROOM: ; ; Find destination of move/copy ; MOV BX,[PARAM3] CALL FINDLIN MOV [PTR_3],DI ; ; open up copysiz bytes of space at destination ; ; move (p3, p3+copysiz, endtxt-p3); ; MOV SI,EndTxt ; get source pointer to end MOV CX,SI SUB CX,DI ; number of bytes from here to end INC CX ; remember ^Z at end MOV DI,SI ; destination starts at end ADD DI,[COPYSIZ] ; plus size we are opening MOV [ENDTXT],DI ; new end point STD ; go backwards REP MOVSB ; and store everything CLD ; go forward ; ; relocate ptr_1 and ptr_2 if we moved them ; MOV BX,Ptr_3 CMP BX,Ptr_1 ; was dest before source? JA NoReloc ; no, above. no relocation MOV BX,CopySiz ADD Ptr_1,BX ADD Ptr_2,BX ; relocate pointers NoReloc: ; ; Now we copy for count times copylen bytes from ptr_1 to ptr_3 ; ; move (ptr_1, ptr_3, copylen); ; MOV BX,Param4 ; count (0 and 1 are both 1) MOV DI,Ptr_3 ; destination CopyText: MOV CX,CopyLen ; number to move MOV SI,Ptr_1 ; start point REP MOVSB ; move the bytes SUB BX,1 ; exhaust count? JG CopyText ; no, go for more ; ; If we are moving ; CMP BYTE PTR MovFlg,0 JZ CopyDone ; ; Delete the source text between ptr_1 and ptr_2 ; ; move (ptr_2, ptr_1, endtxt-ptr_2); ; MOV DI,Ptr_1 ; destination MOV SI,Ptr_2 ; source MOV CX,EndTxt ; pointer to end SUB CX,SI ; number of bytes to move CLD ; forwards REP MOVSB MOV BYTE PTR ES:[DI],1Ah ; remember ^Z terminate MOV EndTxt,DI ; new end of file ; ; May need to relocate current line (parameter 3). ; MOV BX,Param3 ; get new current line CMP BX,Param1 ; do we need to relocate JBE CopyDone ; no, current line is before removed M002 ADD BX,Param1 ; add in first SUB BX,Param2 ; current += first-last - 1; DEC BX MOV Param3,BX CopyDone: ; ; we are done. Make current line the destination ; MOV BX,Param3 ; set parameter 3 to be current CALL FINDLIN MOV [POINTER],DI MOV [CURRENT],BX return Break <MoveFile - open up a hole in the internal file> ; ; MoveFile moves the text in the buffer to create a hole ; ; Inputs: DX is spot in buffer for destination ; DI is spot in buffer for source MOVEFILE: MOV CX,[ENDTXT] ;Get End-of-text marker MOV SI,CX SUB CX,DI ;Calculate number of bytes to copy INC CX ; remember ^Z MOV DI,DX STD REP MOVSB ;Copy CX bytes XCHG SI,DI CLD INC DI MOV BP,SI SETPTS: MOV [POINTER],DI ;Current line is first free loc MOV [CURRENT],BX ; in the file MOV [ENDTXT],BP ;End-of-text is last free loc before return NAMERR: cmp ax,error_file_not_found jne otherMergeErr MOV DX,OFFSET DG:FILENM_ptr JMP COMERR1 otherMergeErr: mov ax,BADDRV jmp zcomerr1 PUBLIC MERGE MERGE: CMP ParamCt,1 JZ MergeOK JMP Comerr MergeOK: CALL KILL_BL DEC SI MOV DI,OFFSET DG:MRG_PATH_NAME XOR CX,CX CLD MRG1: LODSB CMP AL," " JE MRG2 CMP AL,9 JE MRG2 CMP AL,CR JE MRG2 CMP AL,";" JE MRG2 STOSB JMP SHORT MRG1 MRG2: MOV BYTE PTR[DI],0 DEC SI MOV [COMLINE],SI ;========================================================================= ; implement EXTENDED OPEN ;========================================================================= push es ;an000;save reg. mov bx,ext_read ;an000;open for read mov cx,ATTR ;an000;file attributes mov dx,OPEN_FLAG ;an000;action to take on open mov di,0ffffh ;an000;null parm list call EXT_OPEN3 ;an000;create file;DMS:6/10/87 pop es ;an000;restore reg. ;========================================================================= JC NAMERR MOV [MRG_HANDLE],AX MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR 23H MOV DX,OFFSET DG:ABORTMERGE INT 21H MOV BX,[PARAM1] OR BX,BX JNZ MRG MOV BX,[CURRENT] CALL CHKRANGE MRG: CALL FINDLIN MOV BX,DX MOV DX,[LAST_MEM] CALL MOVEFILE MOV DX,[POINTER] MOV CX,[ENDTXT] SUB CX,[POINTER] PUSH CX MOV BX,[MRG_HANDLE] MOV AH,READ INT 21H POP DX MOV CX,AX CMP DX,CX JA FILEMRG ; M005 mov ax,mrgerr call display_message MOV CX,[POINTER] JMP SHORT RESTORE_Z FILEMRG: ADD CX,[POINTER] MOV SI,CX dec si LODSB CMP AL,1AH JNZ RESTORE_Z dec cx RESTORE_Z: MOV DI,CX MOV SI,[ENDTXT] INC SI MOV CX,[LAST_MEM] SUB CX,SI inc cx ; remember ^Z REP MOVSB dec di ; unremember ^Z MOV [ENDTXT],DI MOV BX,[MRG_HANDLE] MOV AH,CLOSE INT 21H return PUBLIC INSERT INSERT: CMP ParamCt,1 JBE OKIns JMP ComErr OKIns: MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR 23H ;Set vector 23H MOV DX,OFFSET DG:ABORTINS INT 21H MOV BX,[PARAM1] OR BX,BX JNZ INS MOV BX,[CURRENT] CALL CHKRANGE INS: CALL FINDLIN MOV BX,DX MOV DX,[LAST_MEM] CALL MOVEFILE INLP: CALL SETPTS ;Update the pointers into file CALL SHOWNUM MOV DX,OFFSET DG:EDITBUF MOV AH,STD_CON_STRING_INPUT INT 21H CALL LF MOV SI,2 + OFFSET DG:EDITBUF CMP BYTE PTR [SI],1AH JZ ENDINS ;----------------------------------------------------------------------- call unquote ;scan for quote chars if any ;----------------------------------------------------------------------- MOV CL,[SI-1] MOV CH,0 MOV DX,DI INC CX ADD DX,CX JC MEMERRJ1 JZ MEMERRJ1 CMP DX,BP JB MEMOK MEMERRJ1: CALL END_INS JMP MEMERR MEMOK: REP MOVSB MOV AL,10 STOSB INC BX JMP SHORT INLP ABORTMERGE: MOV DX,OFFSET DG:START MOV AH,SET_DMA INT 21H ABORTINS: MOV AX,CS ;Restore segment registers MOV DS,AX MOV ES,AX MOV AX,CSTACK MOV SS,AX MOV SP,STACK STI CALL CRLF CALL ENDINS JMP COMOVER ENDINS: CALL END_INS return END_INS: MOV BP,[ENDTXT] MOV DI,[POINTER] MOV SI,BP INC SI MOV CX,[LAST_MEM] SUB CX,BP REP MOVSB DEC DI MOV [ENDTXT],DI MOV AX,(SET_INTERRUPT_VECTOR SHL 8) OR 23H MOV DX,OFFSET DG:ABORTCOM INT 21H return FILLBUF: MOV [PARAM1],-1 ;Read in max. no of lines MOV ParamCt,1 CALL APPEND MOV Param1,0 PUBLIC ENDED ENDED: ;Write text out to .$$$ file CMP ParamCt,1 JZ ENDED1 CERR: JMP ComErr Ended1: CMP Param1,0 JNZ Cerr MOV BYTE PTR [ENDING],1 ;Suppress memory errors MOV BX,-1 ;Write max. no of lines CALL WRT TEST BYTE PTR [HAVEOF],-1 JZ FILLBUF MOV DX,[ENDTXT] MOV CX,1 MOV BX,[WRT_HANDLE] MOV AH,WRITE INT 21H ;Write end-of-file byte ;Close input file ; MZ 11/30 ; MZ 11/30 MOV BX,[RD_HANDLE] ; MZ 11/30 MOV AH,CLOSE ; MZ 11/30 INT 21H ; MZ 11/30 ;Close .$$$ file MOV BX,[WRT_HANDLE] MOV AH,CLOSE INT 21H ;Rename original file .BAK MOV DI,[EXT_PTR] MOV SI,OFFSET DG:BAK MOVSW MOVSW MOVSB MOV DX,OFFSET DG:PATH_NAME MOV DI,OFFSET DG:TEMP_PATH MOV AH,RENAME INT 21H MOV DI,[EXT_PTR] MOV SI,OFFSET DG:$$$FILE MOVSW MOVSW MOVSB ;Rename .$$$ file to original name MOV DX,OFFSET DG:TEMP_PATH MOV DI,OFFSET DG:PATH_NAME MOV AH,RENAME INT 21H ; mode mov ah,exit xor al,al int 21h ;========================================================================= ; EDLIN_DISP_GET: This routine will give us the attributes of the ; current display, which are to be used to restore the screen ; back to its original state on exit from EDLIN. We also ; set the screen to a text mode here with an 80 X 25 color ; format. ; ; Inputs : VIDEO_GET - 0fH (get current video mode) ; VIDEO_SET - 00h (set video mode) ; VIDEO_TEXT- 03h (80 X 25 color mode) ; ; Outputs : VIDEO_ORG - Original video attributes on entry to EDLIN ; ;========================================================================= EDLIN_DISP_GET proc near ;an000;video attributes push ax ;an000;save affected regs. push bx ;an000; push cx ;an000; push dx ;an000; push si ;an000; push ds ;an000; push cs ;an000;exchange cs/ds pop ds ;an000; mov ax,440Ch ;an000;generic ioctl mov bx,Std_Out ;an000;Console mov cx,(Display_Attr shl 8) or Get_Display ;an000;get display mov dx,offset dg:Video_Buffer ;an000;buffer for video attr. int 21h ;an000; ; $if nc ;an000;function returned a JC $$IF15 ; buffer mov si,dx ;an000;get pointer mov ax,word ptr dg:[si].Display_Length_Char ;an000;get video len. dec ax ;an000;allow room for message mov dg:Disp_Len,al ;an000;put it into var. mov ax,word ptr dg:[si].Display_Width_Char ;an000;get video width mov dg:Disp_Width,al ;an000;put it into var. ; $else ;an000;function failed use JMP SHORT $$EN15 $$IF15: ; default values mov al,Def_Disp_Len ;an000;get default length dec al ;an000;leave room for messages mov dg:Disp_Len,al ;an000;use default length mov dg:Disp_Width,Def_Disp_Width;an000;use default width ; $endif ;an000; $$EN15: pop ds ;an000;restore affected regs. pop si ;an000; pop dx ;an000; pop cx ;an000; pop bx ;an000; pop ax ;an000; ret ;an000;return to caller EDLIN_DISP_GET endp ;an000;end proc. ;========================================================================= ; EXT_OPEN1 : This routine opens a file for read/write access. If the file ; if not present for opening the open will fail and return with a ; carry set. ; ; Inputs : BX - Open mode ; CX - File attributes ; DX - Open action ; ; Outputs: CY - If error ; ; Date : 6/10/87 ;========================================================================= EXT_OPEN1 proc near ;an000;open for R/W assume ds:dg push ds ;an000;save regs push si ;an000; mov ah,ExtOpen ;an000;extended open mov al,0 ;an000;reserved by system mov si,offset dg:path_name ;an000;point to PATH_NAME int 21h ;an000;invoke function pop si ;an000;restore regs pop ds ;an000; ret ;an000;return to caller EXT_OPEN1 endp ;an000;end proc. ;========================================================================= ; EXT_OPEN2 : This routine will attempt to create a file for read/write ; access. If the files exists the create will fail and return ; with the carry set. ; ; Inputs : BX - Open mode ; CX - File attributes ; DX - Open action ; ; Outputs: CY - If error ; ; Date : 6/10/87 ;========================================================================= EXT_OPEN2 proc near ;an000;create a file assume ds:dg push ds ;an000;save regs push si ;an000; mov ah,ExtOpen ;an000;extended open mov al,0 ;an000;reserved by system mov si,offset dg:temp_path ;an000;point to TEMP_PATH int 21h ;an000;invoke function pop si ;an000;restore regs pop ds ;an000; ret ;an000;return to caller EXT_OPEN2 endp ;an000;end proc. ;========================================================================= ; EXT_OPEN3 : This routine will attempt to create a file for read ; access. If the files exists the create will fail and return ; with the carry set. ; ; Inputs : BX - Open mode ; CX - File attributes ; DX - Open action ; ; Outputs: CY - If error ; ; Date : 6/10/87 ;========================================================================= EXT_OPEN3 proc near ;an000;create a file assume ds:dg push ds ;an000;save regs push si ;an000; mov ah,ExtOpen ;an000;extended open mov al,0 ;an000;reserved by system mov si,offset dg:mrg_path_name ;an000;point to mrg_path_name int 21h ;an000;invoke function pop si ;an000;restore regs pop ds ;an000; ret ;an000;return to caller EXT_OPEN3 endp ;an000;end proc. ;========================================================================= ; EDLIN_COMMAND : This routine provides an interface between the new ; parser and the existing logic of EDLIN. We will be ; interfacing the parser with three existing variables. ; ; Inputs : FILESPEC - Filespec entered by the user and passed by ; the parser. ; ; PARSE_SWITCH_B - Contains the result of the parse for the ; /B switch. This is passed by the parser. ; ; Outputs: PATH_NAME - Filespec ; LOADMOD - Flag for /B switch ; FNAME_LEN - Length of filespec ; ; Date : 6/11/87 ;========================================================================= EDLIN_COMMAND proc near ;an000;interface parser push ax ;an000;save regs. push cx ;an000; push di ;an000 push si ;an000; mov si,offset dg:filespec ;an000;get its offset mov di,offset dg:path_name ;an000;get its offset mov cx,00h ;an000;cx will count filespec ; length cmp parse_switch_b,true ;an000;do we have /B switch ; $if z ;an000;we have the switch JNZ $$IF18 mov [LOADMOD],01h ;an000;signal switch found ; $endif ;an000 $$IF18: ; $do ;an000;while we have filespec $$DO20: lodsb ;an000;move byte to al cmp al,nul ;an000;see if we are at ; the end of the ; filespec ; $leave e ;an000;exit while loop JE $$EN20 stosb ;an000;move byte to path_name inc cx ;an000;increment the length ; of the filespec ; $enddo ;an000;end do while JMP SHORT $$DO20 $$EN20: mov [FNAME_LEN],cx ;an000;save filespec's length pop si ;an000; restore regs pop di ;an000; pop cx ;an000; pop ax ;an000; ret ;an000;return to caller EDLIN_COMMAND endp ;an000;end proc ;========================================================================= ; Calc_Memory_Avail : This routine will calculate the memory ; available for use by EDLIN. ; ; Inputs : ORG_DS - DS of PSP ; ; Outputs : DX - paras available ;========================================================================= Calc_Memory_Avail proc near ;an000; dms; push ds ;save ds for size calc push cx ;an000; dms; push di ;an000; dms; mov ds,cs:[org_ds] MOV CX,DS:[2] MOV DI,CS SUB CX,DI mov dx,cx ;an000; dms;put paras in DX pop di ;an000; dms; pop cx ;an000; dms; pop ds ;an000; dms; ret ;an000; dms; Calc_Memory_Avail endp ;an000; dms; ;========================================================================= ; EA_Fail_Exit : This routine tells the user that there was ; Insufficient memory and exits EDLIN. ; ; Inputs : MemFul_Ptr - "Insufficient memory" ; ; Outputs : message ;========================================================================= EA_Fail_Exit proc near ;an000; dms; mov dx,offset dg:MemFul_Ptr ;an000; dms;"Insufficient push cs ;an000; dms;xchange ds/cs pop ds ;an000; dms; ; memory" call Std_Printf ;an000; dms;print message mov ah,exit ;an000; dms;exit xor al,al ;an000; dms;clear al int 21h ;an000; dms; ret ;an000; dms; EA_Fail_Exit endp ;an000; dms; CODE ENDS END EDLIN 
libsrc/zx81/basic/zx_locatenum.asm
andydansby/z88dk-mk2
1
16207
<filename>libsrc/zx81/basic/zx_locatenum.asm ; ; ZX 81 specific routines ; by <NAME>, 28/07/2008 ; ; Locate the numeric variable having name pointed by HL ; Internal routine used by zx_getint and zx_setint ; ; Carry flag is set on error ; ; ; $Id: zx_locatenum.asm,v 1.3 2009/08/05 07:14:47 stefano Exp $ ; XLIB zx_locatenum zx_locatenum: ld a,(hl) and a jr nz,notempty scf ret notempty: and 31 add 101 ld c,a ; keep the first letter push hl inc hl ld a,(hl) and a ; only 1 char for var name ? ld hl,($4010) ; VARS jr z,onechar ld a,@00011111 ; first letter of a long numeric variable name and c ; has those odd bits added or @10100000 ld c,a onechar: vp: ld a,(hl) cp 128 jr z,notfound cp c jr z,v2 xor 128 ; modify the var name format cp c ; to see if it is a FOR-NEXT type var jr z,v2 ;xor 128 ; restore the original value ld a,(hl) v1: push bc call $09f2 ; find next variable pop bc ex de,hl jr vp v2: and @11100000 cp @10100000 jr nz,result pop de push de push hl v3: inc hl inc de ld a,(de) cp 97 ; ASCII Between a and z ? jr c,isntlower sub 32 ; Then transform in UPPER ASCII .isntlower sub 27 ; re-code to the ZX81 charset ld b,a inc de ; if this is the last character in the ld a,(de) ; variable name, then... dec de and a ld a,b jr nz,noterminate add 128 ; ...add the ZX style string terminator noterminate: cp (hl) jr nz,v4 rla jr nc,v3 inc de ld a,(de) dec de and a jr nz,v3 pop de jr result v4: pop hl jr v1 result: inc hl pop de and a ret notfound: pop de scf ret
oeis/133/A133673.asm
neoneye/loda-programs
11
240727
; A133673: a(n) = n*L(n) + (n-1)*L(n-1) where L(n) is the Lucas number. ; 7,18,40,83,163,311,579,1060,1914,3419,6053,10637,18575,32262,55772,96019,164711,281635,480171,816536,1385262,2345083,3962185,6682393,11251543,18916026,31756624,53243795,89160619,149135759,249187923,415946572,693648930,1155732827,1924033517,3200555429,5320029791,8836815150,14668515716,24333231571,40341318767,66842022523,110690384955,183206923328,303078867798,501141866491,828258369169,1368293945905,2259483660199,3729602661474,6153842722168,10150026839507,16735207418035,27583153569767 add $0,2 mov $3,$0 lpb $0 sub $0,1 add $1,1 mov $2,$1 sub $3,2 add $3,$0 add $1,$3 mov $3,$2 add $3,4 lpe add $1,1 mov $0,$1
scripts/macos/remove-from-login-items.applescript
briangonzalez/awesome-applescripts
39
4001
<reponame>briangonzalez/awesome-applescripts<filename>scripts/macos/remove-from-login-items.applescript set item_name to "[ NAME OF LOGIN ITEM ]" tell application "System Events" to delete login item item_name
asm_jmp/jmp.asm
nitrojacob/8051
0
90104
mov A, #0xA loop: dec A jnz loop end: jmp end
src/buffer.adb
STR-UPM/ToyOBDH
1
1424
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, Universidad Politécnica de Madrid -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Measurements; use Measurements; package body Buffer is ------------------------------------ -- Protected object specification -- ------------------------------------ type Index is mod Capacity; type Store is array (Index) of Measurement; protected Buffer is procedure Put (M: in Measurement); procedure Get (M: out Measurement); function Last return Measurement; function Empty return Boolean; function Full return Boolean; private Data : Store; Next_In : Index := 0; -- next new item Last_In : Index := 0; -- newest item in buffer Next_Out : Index := 0; -- oldest item in buffer Count : Natural := 0; end Buffer; --------- -- Put -- --------- procedure Put (M: in Measurement) is begin Buffer.Put(M); end Put; --------- -- Get -- --------- procedure Get (M: out Measurement) is begin Buffer.Get(M); end Get; ---------- -- Last -- ---------- function Last return Measurement is begin return Buffer.Last; end Last; ----------- -- Empty -- ----------- function Empty return Boolean is begin return Buffer.Empty; end Empty; function Full return Boolean is begin return Buffer.Full; end Full; --------------------------- -- Protected object body -- --------------------------- protected body Buffer is procedure Put (M: in Measurement) is begin Data(Next_In) := M; Last_In := Next_In; Next_In := Next_In + 1; if Count < Capacity then Count := Count + 1; else -- buffer full, overwrite oldest measurement Next_Out := Next_Out + 1; end if; end Put; procedure Get (M: out Measurement) is begin if Empty then raise Constraint_Error; end if; M := Data(Next_Out); Next_Out := Next_Out + 1; Count := Count - 1; end Get; function Last return Measurement is begin return data(Last_In); end Last; function Empty return Boolean is begin return Count = 0; end Empty; function Full return Boolean is begin return Count = Capacity; end Full; end Buffer; end Buffer;
alloy4fun_models/trashltl/models/5/tPgHFAzPMzZGpz7uc.als
Kaixi26/org.alloytools.alloy
0
5060
<gh_stars>0 open main pred idtPgHFAzPMzZGpz7uc_prop6 { always File in Trash since File in Trash } pred __repair { idtPgHFAzPMzZGpz7uc_prop6 } check __repair { idtPgHFAzPMzZGpz7uc_prop6 <=> prop6o }
vendor/tinyvm/programs/asm/euler1_nodiv.asm
erik-kallen/riir
2,334
28167
extern printf SECTION .data str: db "%i", 10, 0 SECTION .text global main main: ; Push the base pointer onto the stack, and move the stack's address to EBP push ebp mov ebp, esp mov ebx, 1000000000 xor edx, edx mov eax, 3 loop0: add edx, eax add eax, 3 cmp eax, ebx jl loop0 mov eax, 5 loop1: add edx, eax add eax, 15 cmp eax, ebx jl loop1 mov eax, 10 loop2: add edx, eax add eax, 15 cmp eax, ebx jl loop2 ; Push our arguments onto the stack push edx push dword str call printf ; Remove that shit from the stack add esp, byte 8 ; Pop the caller's base pointer back to EBP pop ebp mov eax, 0 ret
src/Categories/Category/Unbundled.agda
Trebor-Huang/agda-categories
279
16554
<reponame>Trebor-Huang/agda-categories {-# OPTIONS --without-K --safe #-} module Categories.Category.Unbundled where -- This is basically identical to Category, except that the -- Obj type is a parameter rather than a field. open import Level open import Function.Base using (flip) open import Relation.Binary using (Rel; IsEquivalence) record Category {o : Level} (Obj : Set o) (ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where eta-equality infix 4 _≈_ _⇒_ infixr 9 _∘_ field _⇒_ : Rel Obj ℓ _≈_ : ∀ {A B} → Rel (A ⇒ B) e id : ∀ {A} → (A ⇒ A) _∘_ : ∀ {A B C} → (B ⇒ C) → (A ⇒ B) → (A ⇒ C) field assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → (h ∘ g) ∘ f ≈ h ∘ (g ∘ f) -- We add a symmetric proof of associativity so that the opposite category of the -- opposite category is definitionally equal to the original category. See how -- `op` is implemented. sym-assoc : ∀ {A B C D} {f : A ⇒ B} {g : B ⇒ C} {h : C ⇒ D} → h ∘ (g ∘ f) ≈ (h ∘ g) ∘ f identityˡ : ∀ {A B} {f : A ⇒ B} → id ∘ f ≈ f identityʳ : ∀ {A B} {f : A ⇒ B} → f ∘ id ≈ f -- We add a proof of "neutral" identity proof, in order to ensure the opposite of -- constant functor is definitionally equal to itself. identity² : ∀ {A} → id ∘ id {A} ≈ id {A} equiv : ∀ {A B} → IsEquivalence (_≈_ {A} {B}) ∘-resp-≈ : ∀ {A B C} {f h : B ⇒ C} {g i : A ⇒ B} → f ≈ h → g ≈ i → f ∘ g ≈ h ∘ i
2.36/CRK2TXT.asm
alexanderbazhenoff/brainwave-cracktro-v2
0
102455
<gh_stars>0 ; This Source Code Form is subject to the terms of the MIT ; hLicense. If a copy of the MPL was not distributed with ; this file, You can obtain one at ttps://github.com/aws/mit-0 MAIN "KRACKTR2" MACRO FROM DB 12,20,K2,38,2,4,"FROM" ENDM WGC EQU 15 MACRO GC DB 3,13,K4,T03,1,7,"CRACKED" DB 3,13,K1,T04,2,1,"+" DB 3,23,K2,T05,1,6,"DISKED" DB 3,22,K1,T06,1,1,"+" DB 3,32,K3,T07,1,7,"TRA",#80,"INED" DB 5,4,K1,T08,1,1,"+" DB 5,14,K3,T09,1,6,"PACKED" DB 5,13,K1,T10,1,1,"." DB 5,15,K1,T11,1,1,"." DB 5,17,K1,T12,1,1,"." DB 5,19,K1,T13,1,1,"." DB 5,21,K1,T14,1,1,"." DB 5,27,K4,T15,1,3,"ALX" DB 5,27,K1,T16,1,1,"/" DB 5,33,K3,T17,2,2,"BW" ENDM WGDR EQU 15 MACRO GDR DB 3,13,K4,T03,1,6,"DISKED" DB 3,12,K1,T04,2,1,"+" DB 3,23,K2,T05,1,6,"PACKED" DB 3,22,K1,T06,1,1,"+" DB 3,32,K3,T07,1,7,"TRA",#80,"INED" DB 5,1,K1,T08,1,1,"+" IF0 OPT DB 5,13,K3,T09,1,9,"OPTIM",#80,"IZED" ELSE DB 5,13,K3,T09,1,9,"CORRECTED" ENDIF DB 5,13,K1,T10,1,1,"." DB 5,15,K1,T11,1,1,"." DB 5,17,K1,T12,1,1,"." DB 5,19,K1,T13,1,1,"." DB 5,21,K1,T14,1,1,"." DB 5,27,K4,T15,1,3,"ALX" DB 5,27,K1,T16,1,1,"/" DB 5,33,K3,T17,2,2,"BW" ENDM CLIF EQU 16 MACRO N_CLIF DB 10,2,K1,25,1,1,"*" DB 10,4,K4,26,2,1,"C" DB 10,6,K4,27,1,1,"L" DB 10,8,K4,28,0,1,"I" DB 10,10,K4,29,1,1,"F" DB 10,12,K4,30,2,1,"F" DB 10,16,K4,31,1,1,"H" DB 10,18,K4,32,2,1,"A" DB 10,20,K4,33,1,1,"N" DB 10,22,K4,34,2,1,"G" DB 10,24,K4,35,1,1,"E" DB 10,26,K4,36,2,1,"R" DB 10,28,K1,37,1,1,"*" FROM DB 14,7,K2,40,1,3,"N",#83,"EW" DB 14,20,K4,42,1,10,"GENERAT",#80,"ION" DB 14,30,K3,46,1,8,"S",1,#82,"OF",0,#83,"TWARE" ENDM MACRO C_CLI1 DB 10,8,K4,0,1,7,"%ENTER$" DB 10,8,K1,1,1,1,"-" DB 10,18,K2,2,1,6,"TOGGLE" DB 11,23,K4,3,1,5,"%SPC",#81,"$" DB 11,30,K3,4,2,5," LOAD" DB 11,23,K1,5,1,1,"-" DB 6,0,K1,6,1,1,"1" DB 6,11,K3,7,1,7,"UNL",#80,1,"IMI",#81,"T" ENDM MACRO C_CLIF DB 13 C_CLI1 DB 6,17,K4,8,1,5,"LIVES" DB 6,24,K1,9,2,1,"]" DB 6,18,K1,10,2,1,"[" DB 6,24,K4,11,2,3,"YEP" DB 6,24,K4,12,1,3,"NOP" ENDM HERT EQU 15 MACRO N_HERT DB 10,5,K4,25,1,1,"H" DB 10,7,K4,26,1,1,"E" DB 10,9,K4,27,1,1,"A" DB 10,11,K4,28,1,1,"R" DB 10,13,K4,29,1,1,"T" DB 10,15,K4,30,1,1,"B" DB 10,17,K4,31,1,1,"R" DB 10,19,K1,32,1,1,"\" DB 10,21,K4,33,1,1,"K" DB 10,23,K4,34,1,1,"E" DB 10,25,K4,35,1,1,"N" FROM DB 14,11,K4,40,3,8,"ATLANT",#80,"IS" DB 14,21,K3,42,1,8,"S",1,#82,"OF",0,#82,"TWARE" DB 14,27,K4,44,2,4,"L",1,"TD." DB 14,30,K2,46,1,3,"'89" ENDM MACRO C_HERT DB 12 DB 10,8,K4,0,1,7,"%ENTER$" DB 10,8,K1,1,1,1,"-" DB 10,18,K2,2,1,6,"TOGGLE" DB 11,23,K4,3,1,5,"%SPC",#81,"$" DB 11,30,K3,4,2,5," LOAD" DB 11,23,K1,5,1,1,"-" DB 6,0,K1,6,1,1,"1" DB 6,15,K3,7,0,10,"INVENC",#80,"IB",#82,"LE" DB 6,21,K1,8,2,1,"]" DB 6,15,K1,9,2,1,"[" DB 6,21,K4,10,2,3,"YEP" DB 6,21,K4,11,1,3,"NOP" ENDM BUBLER EQU 11 MACRO N_BUBLER DB 10,0,K1,33,1,1,"@" DB 10,6,K4,25,0,2,"I," DB 10,6,K4,26,1,1,"B" DB 10,8,K4,27,1,1,"A" DB 10,10,K4,28,1,1,"L" DB 10,12,K4,29,1,1,"L" DB 10,28,K4,30,1,10,"COLLECT",#80,"ION" DB 10,27,K1,35,1,1,"@" FROM DB 14,15,K4,40,2,8,"F",#80,"IREB",#80,"IR",#81,"D" DB 14,24,K3,42,1,8,"SOFTWARE" DB 14,27,K4,44,1,3,"'87" ENDM MACRO C_BUBL DB 41 DB 14,8,K4,0,1,7,"%ENTER$" DB 14,8,K2,1,1,1,"-" DB 14,18,K1,2,1,6,"TOGGLE" DB 14,23,K4,3,1,5,"%SPC",#81,"$" DB 14,30,K3,4,2,5," LOAD" DB 14,23,K2,5,1,1,"-" DB 8,0,K1,6,2,1,"5" DB 8,11,K2,7,1,7,"UNL",#80,1,"IMI",#82,"T" DB 8,17,K4,8,1,4,"AMMO" DB 10,0,K1,9,3,1,"6" DB 10,11,K4,10,1,7,"UNL",#80,1,"IMI",#82,"T" DB 10,17,K3,11,1,4,"KEYS" DB 10,26,K1,12,1,8,"(PAR",#82,"T ",#82,"2)" DB 0,0,K1,13,1,1,"1" DB 0,11,K2,14,1,7,"LOAD",#80,"ING" DB 0,17,K4,15,1,4,"PAR",#81,"T" DB 2,0,K1,16,2,1,"2" DB 2,11,K4,17,1,7,"UNL",#80,1,"IMI",#82,"T" DB 2,17,K1,18,1,5,"LIVES" DB 4,0,K1,19,1,1,"3" DB 4,11,K3,20,1,7,"UNL",#80,1,"IMI",#82,"T" DB 4,17,K2,21,1,4,"TIME" DB 6,0,K1,22,2,1,"4" DB 6,15,K3,23,0,10,"INVENC",#80,"IB",#82,"LE" DB 12,4,K3,24,1,3,"ARE" DB 12,8,K2,25,1,3,"YOU" DB 12,14,K4,26,1,5,"HAPPY" DB 12,14,K2,27,2,1,"?" DB 12,20,K1,28,2,2,":)" DB 0,30,K4,29,2,3,"ONE" DB 2,30,K4,30,2,3,"YEP" DB 4,30,K4,31,2,3,"YEP" DB 6,30,K4,32,2,3,"YEP" DB 8,30,K4,33,2,3,"YEP" DB 10,30,K4,34,2,3,"YEP" DB 0,30,K4,35,2,3,"TWO" DB 2,30,K4,36,2,3,"NOP" DB 4,30,K4,37,2,3,"NOP" DB 6,30,K4,38,2,3,"NOP" DB 8,30,K4,39,2,3,"NOP" DB 10,30,K4,40,2,3,"NOP" ENDM XENO EQU 15 MACRO N_XENO DB 10,9,K4,26,3,3,"$",#82,"X",#81,"%" DB 10,15,K4,28,1,3,"$",#82,"E",#83,"%" DB 10,21,K4,30,3,3,"$",#82,"N",#81,"%" DB 10,27,K4,32,1,3,"$",#82,"@",#83,"%" FROM DB 14,1,K4,39,1,1,"A" DB 14,3,K1,40,1,1,"'" DB 14,5,K4,41,1,1,"N" DB 14,7,K1,42,1,1,"'" DB 14,9,K4,43,1,1,"F" DB 14,14,K2,44,1,1,"L" DB 14,17,K2,45,1,1,"T" DB 14,20,K2,46,1,1,"D" DB 14,24,K1,47,1,1,"'" DB 14,26,K3,48,1,1,"8" DB 14,29,K3,49,1,1,"6" ENDM MACRO C_XENO DB 22 DB 0,6,K2,0,1,5,"SORRY" DB 1,12,K4,1,1,4,"GUYS" DB 1,11,K2,2,1,1,"!" DB 2,19,K1,3,2,5,"THERE" DB 3,23,K2,4,1,3,"ARE" DB 4,27,K3,5,1,2,"NO" DB 6,12,K1,6,1,1,"*" DB 6,28,K4,7,1,13,"TRA",#80,"INER MENUE" DB 6,28,K1,8,1,1,"*" DB 6,30,K2,9,1,1,"!" DB 8,12,K1,10,1,1,"(" DB 8,24,K2,11,3,8,"KHE-",#83,"KHE!" DB 8,23,K1,12,1,1,")" DB 10,6,K3,13,1,4,"K",#80,"ICK" DB 11,5,K1,14,1,1,"%" DB 11,13,K4,15,1,5,"SPACE" DB 11,13,K1,16,1,1,"$" DB 12,19,K2,17,1,3,"and" DB 12,25,K1,18,1,5,"EN",#81,"JOY" DB 14,22,K3,19,2,3,"THE" DB 14,30,K4,20,1,6,"ACT",#80,"ION" DB 14,30,K2,21,1,1,"!" ENDM MACRO TOPO DB 14,0,K4,39,1,1,"T" DB 14,3,K3,40,1,1,"@" DB 14,6,K4,41,1,1,"P" DB 14,9,K3,42,1,1,"@" DB 14,13,K4,43,1,1,"S" DB 14,16,K3,44,1,1,"@" DB 14,19,K4,45,1,1,"F" DB 14,22,K4,46,1,1,"T" DB 14,25,K1,47,1,1,"'" DB 14,27,K2,48,1,1,"8" ENDM WELLS EQU 24 MACRO N_WELLS DB 10,2,K1,25,1,1,"+" DB 10,4,K4,26,1,1,"W" DB 10,6,K4,27,1,1,"E" DB 10,8,K4,28,1,1,"L" DB 10,10,K4,29,1,1,"L" DB 10,12,K4,30,1,1,"'" DB 10,14,K4,31,1,1,"S" DB 10,18,K4,32,1,1,"F" DB 10,20,K3,33,1,1,#7B DB 10,22,K4,34,1,1,"R" DB 10,24,K4,35,1,1,"G" DB 10,26,K3,36,1,1,#7D DB 10,28,K1,37,1,1,"+" FROM TOPO DB 14,30,K2,49,1,1,"7" ENDM MACRO C_WELLS DB 22 DB 7,6,K2,0,1,5,"WANNA" DB 7,12,K3,1,1,4,"HAVE" DB 7,15,K4,2,1,3,"FUN" DB 7,15,K1,3,1,1,"?" DB 9,6,K1,4,1,5,"PRESS" DB 9,12,K4,5,1,5,"%B+W$" DB 9,18,K2,6,1,5,"WH",#80,"ILE" DB 9,30,K3,7,1,11,"DECRUNCH",#80,"ING" DB 9,30,K1,8,1,1,"!" DB 13,8,K4,9,1,7,"%ENTER$" DB 13,8,K1,10,1,1,"-" DB 13,18,K2,11,1,6,"TOGGLE" DB 14,23,K4,12,1,5,"%SPC",#81,"$" DB 14,30,K3,13,2,5," LOAD" DB 14,23,K1,14,1,1,"-" DB 2,0,K1,15,1,1,"1" DB 2,11,K3,16,1,7,"UNL",#80,1,"IMI",#81,"T" DB 2,17,K4,17,1,5,"LIVES" DB 2,24,K1,18,2,1,"]" DB 2,18,K1,19,2,1,"[" DB 2,24,K4,20,2,3,"YEP" DB 2,24,K4,21,1,3,"NOP" ENDM TENS EQU 7 MACRO N_TENS DB 10,17,K3,31,2,3," 3D" DB 10,14,K4,29,0,13,"IN",#81,"TERNAT",#80,"IONAL" DB 10,25,K4,33,1,6,"TENNIS" DB 10,32,K1,35,1,6,"128",#83,"/4",#81,"8" DB 12,20,K2,40,2,4,"FROM" DB 14,13,K4,42,2,6,"PALACE" DB 14,23,K3,44,1,8,"SOFTWARE" DB 14,27,K2,46,2,3,"'9O" ENDM ITAL EQU 11 MACRO N_ITAL DB 10,6,K4,29,0,5,"ITALY" DB 10,12,K4,31,2,5,"'199O" DB 10,12,K1,38,1,1,"(" DB 10,20,K3,33,1,5,"OR",#80,"IG." DB 10,20,K1,35,1,1,"/" DB 10,30,K4,37,1,7,"W",#80,"INNER",#82,"S" DB 10,30,K1,39,1,1,")" DB 12,20,K2,40,2,4,"FROM" DB 14,11,K4,42,2,2,"U." DB 14,15,K4,44,2,2,"S." DB 14,21,K4,46,1,4,"GOLD" DB 14,25,K2,47,2,3,"'9O" ENDM CYBER EQU 8 MACRO N_CYBER DB 10,10,K4,25,1,9,"CYBERNO",#80,"ID" DB 10,22,K4,27,1,10,"COLLECT",#80,"ION" DB 10,25,K3,29,1,3,"128" DB 10,25,K1,31,1,1,"/" DB 10,31,K3,33,2,2,"48" ;37 FROM DB 14,11,K4,40,2,6,"HEWSON" DB 14,21,K3,41,1,8,"SOFTWARE" DB 14,29,K2,42,2,6,"'87-88" ;48 ENDM MACRO C_CYBER DB 41 DB 14,8,K4,0,1,7,"%ENTER$" DB 14,8,K2,1,1,1,"-" DB 14,18,K1,2,1,6,"TOGGLE" DB 14,23,K4,3,1,5,"%SPC",#81,"$" DB 14,30,K3,4,2,5," LOAD" DB 14,23,K2,5,1,1,"-" DB 8,0,K1,6,2,1,"5" DB 8,11,K2,7,1,7,"UNL",#80,1,"IMI",#82,"T" DB 8,17,K4,8,1,4,"AMMO" DB 10,0,K1,9,3,1,"6" DB 10,15,K3,12,0,10,"INVENC",#80,"IB",#82,"LE" DB 0,0,K1,13,1,1,"1" DB 0,11,K2,14,1,7,"LOAD",#80,"ING" DB 0,17,K4,15,1,4,"PAR",#81,"T" DB 2,0,K1,16,2,1,"2" DB 2,11,K3,17,1,6,"OUTPUT" DB 2,18,K4,18,1,6,"SOUNDS" DB 4,0,K1,19,1,1,"3" DB 4,11,K2,20,1,7,"UNL",#80,1,"IMI",#82,"T" DB 4,17,K3,21,1,5,"L",#80,"IVES" DB 6,0,K1,22,2,1,"4" DB 6,11,K3,23,1,7,"UNL",#80,1,"IMI",#82,"T" DB 6,17,K3,24,1,4,"T",#80,"IME" DB 12,4,K2,25,1,3,"TRY" DB 12,8,K1,26,1,2,"TO" DB 12,13,K3,27,1,4,"F",#80,"IN",#81,"D" DB 12,19,K4,28,2,4,"F",#80,"IRM" DB 12,24,K4,29,2,5,"CHEAT" DB 12,24,K1,30,1,1,"!" DB 0,30,K4,31,2,3,"ONE" DB 2,30,K4,32,2,7,"AY-CH",#80,"IP" DB 4,30,K4,33,2,3,"YEP" DB 6,30,K4,34,2,3,"YEP" DB 8,30,K4,35,2,3,"YEP" DB 10,30,K4,36,2,3,"YEP" DB 0,30,K4,37,2,3,"TWO" DB 2,30,K4,38,2,7,"BEEPER " DB 4,30,K4,39,2,3,"NOP" DB 6,30,K4,40,2,3,"NOP" DB 8,30,K4,41,2,3,"NOP" DB 10,30,K4,42,2,3,"NOP" ENDM YOGI EQU 9 MACRO N_YOGI DB 10,10,K4,28,1,4,"YO",#81,"G",#80,"I" DB 10,16,K4,30,2,4,"BEAR" DB 10,28,K4,32,1,10,"COLLECT",#80,"ION" FROM DB 14,11,K4,40,1,9,"MAC",#81,"M",#80,"I",#81 DB "L",#81,"L",#82,"AN" DB 14,12,K1,42,1,1,"/" DB 14,22,K4,44,1,6,"HI-TEC" DB 14,25,K3,46,2,3,"'8T" DB 14,25,K1,48,2,1,"/" DB 14,31,K3,50,2,2,"90" ENDM MACRO P_YOGI DB 27 DB 3,8,K4,0,1,6,"SELECT" DB 3,13,K2,1,1,4,"GAME" DB 3,19,K3,2,2,4,"PART" DB 3,18,K1,3,2,1,":" DB 6,8,K3,4,1,7,"LOAD",#80,"ING" DB 6,14,K4,5,2,4,"PART" DB 6,14,K1,6,1,1,"[" DB 6,18,K1,7,1,1,"]" DB 10,4,K2,8,1,3,"USE" DB 10,4,K1,9,1,1,"%" DB 10,6,K4,10,1,1,"1" DB 10,8,K1,11,1,1,"/" DB 10,10,K4,12,1,1,"2" DB 10,12,K1,13,1,1,"/" DB 10,14,K4,14,1,1,"3" DB 10,16,K1,15,1,1,"/" DB 10,24,K4,16,1,5,"ENTER" DB 10,24,K1,17,1,1,"$" DB 10,30,K2,18,1,2,"TO" DB 12,31,K3,19,1,6,"CHOOSE" DB 14,8,K4,20,1,7,"%SPACE$" DB 14,8,K1,21,1,1,"-" DB 14,14,K3,22,1,3,"END" DB 14,24,K2,23,1,9,"SELECT",#80,"ION" DB 6,16,K4,24,2,1,"1" DB 6,16,K4,25,2,1,"2" DB 6,16,K4,26,2,1,"3" ENDM MACRO YK DB 13,8,K4,0,1,7,"%ENTER$" DB 13,8,K1,1,1,1,"-" DB 13,18,K2,2,1,6,"TOGGLE" DB 14,23,K4,3,1,5,"%SPC",#81,"$" DB 14,30,K3,4,2,5," LOAD" DB 14,23,K1,5,1,1,"-" ENDM MACRO YP1 DB 2,0,K1,6,1,1,"1" DB 2,11,K2,7,1,7,"UNLIM",#80,"IT" ENDM MACRO YP11 YP1 DB 2,17,K4,8,1,5,"LIVES" ENDM MACRO YP2 DB 6,0,K1,9,2,1,"2" ENDM MACRO YP22 YP2 DB 6,11,K4,10,1,7,"UNLIM",#80,"IT" ENDM MACRO C_YOG3 YK YP11 YP22 DB 6,17,K3,11,1,4,"TIME" ENDM MACRO C_CYCL DB 27 C_YOG3 DB 10,0,K1,12,1,1,"3" DB 10,11,K3,13,1,7,"UNL",#80,1,"IMI",#81,"T" DB 10,17,K2,14,1,4,"FUEL" DB 2,18,K1,15,2,1,"[" DB 10,18,K1,16,2,1,"[" DB 10,24,K1,17,2,1,"]" DB 6,18,K1,18,2,1,"[" DB 2,24,K1,19,2,1,"]" DB 6,24,K1,20,2,1,"]" DB 2,24,K4,21,2,3,"YEP" DB 6,24,K4,22,2,3,"YEP" DB 10,24,K4,23,2,3,"YEP" DB 2,24,K4,24,1,3,"NOP" DB 6,24,K4,25,1,3,"NOP" DB 10,24,K4,26,1,3,"NOP" ENDM MACRO C_PUZN DB 27 YK DB 2,0,K1,6,1,1,"1" DB 2,11,K2,7,1,7,"UNLIM",#80,"IT" DB 2,17,K4,8,1,4,"TIME" DB 6,0,K1,9,2,1,"2" DB 6,11,K4,10,1,7,"UNLIM",#80,"IT" DB 6,19,K3,11,1,6,"RETRYS" DB 10,0,K1,12,1,1,"3" DB 10,13,K3,13,1,8,"PEN",#81,"TAGON" DB 10,17,K2,14,1,3,"FIX" DB 2,19,K1,15,2,1,"[" DB 10,19,K1,16,2,1,"[" DB 10,25,K1,17,2,1,"]" DB 6,19,K1,18,2,1,"[" DB 2,25,K1,19,2,1,"]" DB 6,25,K1,20,2,1,"]" DB 2,25,K4,21,2,3,"YEP" DB 6,25,K4,22,2,3,"YEP" DB 10,25,K4,23,2,3,"YEP" DB 2,25,K4,24,1,3,"NOP" DB 6,25,K4,25,1,3,"NOP" DB 10,25,K4,26,1,3,"NOP" ENDM MACRO C_VIAJ DB 28 YK YP1 DB 2,19,K4,8,1,6,"HEALT",#81,"H" YP2 DB 6,11,K4,10,1,7,"UNLIM",#80,"IT" DB 6,17,K3,11,1,4,"TIME" DB 10,0,K1,12,1,1,"3" DB 10,9,K3,13,1,4,"OPEN" DB 10,12,K2,14,2,3,"THE" DB 10,16,K4,15,1,3,"MAP" DB 2,19,K1,16,2,1,"[" DB 10,19,K1,17,2,1,"[" DB 10,25,K1,18,2,1,"]" DB 6,19,K1,19,2,1,"[" DB 2,25,K1,20,2,1,"]" DB 6,25,K1,21,2,1,"]" DB 2,25,K4,22,2,3,"YEP" DB 6,25,K4,23,2,3,"YEP" DB 10,25,K4,24,2,3,"YEP" DB 2,25,K4,25,1,3,"NOP" DB 6,25,K4,26,1,3,"NOP" DB 10,25,K4,27,1,3,"NOP" ENDM NWRL EQU 8 MACRO N_NWRL DB 10,12,K4,25,3,6,"NETHER" DB 10,18,K4,27,1,5,"WORLD" DB 10,23,K3,29,1,3,"128" DB 10,23,K1,31,1,1,"/" DB 10,29,K3,33,2,2,"48" FROM DB 14,12,K4,40,2,6,"HEWSON" DB 14,24,K3,41,1,11,"CONSULTANT",#81,"S" DB 14,28,K2,42,2,3,"'88" ENDM MACRO C_NWRL DB 43 DB 14,8,K4,0,1,7,"%ENTER$" DB 14,8,K2,1,1,1,"-" DB 14,18,K1,2,1,6,"TOGGLE" DB 14,23,K4,3,1,5,"%SPC",#81,"$" DB 14,30,K3,4,2,5," LOAD" DB 14,23,K2,5,1,1,"-" DB 8,0,K1,6,1,1,"5" DB 8,8,K4,7,1,5,"GHOST" DB 8,14,K2,8,1,4,"MODE" DB 10,0,K1,9,1,1,"6" DB 10,8,K4,10,1,4,"SK",#80,"IP" DB 10,13,K3,11,1,5,"LEVEL" DB 10,19,K2,12,1,4,"KEYS" DB 10,26,K1,13,1,7,"(R+E+T)" DB 0,0,K1,14,1,1,"1" DB 0,10,K2,15,1,7,"UNL",#80,1,"IMI",#82,"T" DB 0,16,K3,16,1,5,"L",#80,"IVES" DB 2,0,K1,17,2,1,"2" DB 2,10,K3,18,1,7,"UNL",#80,1,"IMI",#82,"T" DB 2,16,K3,19,1,4,"T",#80,"IME" DB 4,0,K1,20,1,1,"3" DB 4,10,K2,21,1,7,"UNL",#80,1,"IMI",#82,"T" DB 4,20,K4,22,1,8,"ADD-AMMO" DB 6,0,K1,23,1,1,"4" DB 6,14,K3,24,0,10,"INVENC",#80,"IB",#82,"LE" DB 12,4,K2,25,1,3,"TRY" DB 12,8,K1,26,1,2,"TO" DB 12,13,K3,27,1,4,"F",#80,"IN",#81,"D" DB 12,19,K4,28,2,4,"F",#80,"IRM" DB 12,24,K3,29,2,5,"CHEAT" DB 12,24,K1,30,1,1,"!" DB 0,30,K4,31,2,3,"YEP" DB 2,30,K4,32,2,3,"YEP" DB 4,30,K4,33,2,3,"YEP" DB 6,30,K4,34,2,3,"YEP" DB 8,30,K4,35,2,3,"YEP" DB 10,30,K4,36,2,3,"YEP" DB 0,30,K4,37,2,3,"NOP" DB 2,30,K4,38,2,3,"NOP" DB 4,30,K4,39,2,3,"NOP" DB 6,30,K4,40,2,3,"NOP" DB 8,30,K4,41,2,3,"NOP" DB 10,30,K4,42,2,3,"NOP" ENDM MACRO C_ITAL DB 21 DB 13,8,K4,0,1,7,"%ENTER$" DB 13,8,K1,1,1,1,"-" DB 13,18,K2,2,1,6,"TOGGLE" DB 14,23,K4,3,1,5,"%SPC",#81,"$" DB 14,30,K3,4,2,5," LOAD" DB 14,23,K1,5,1,1,"-" DB 1,0,K1,6,1,1,"1" DB 1,11,K4,7,3,7,"VERS",#80,"ION" DB 1,15,K2,8,1,2,"OF" DB 1,20,K3,9,1,4,"GAME" DB 7,0,K1,10,2,1,"2" DB 7,13,K2,11,3,8,"PENTAGON" DB 7,16,K4,12,1,3,"FIX" DB 3,30,K1,13,2,1,"]" DB 3,17,K1,14,2,1,"[" DB 9,22,K1,15,2,1,"]" DB 9,14,K1,16,2,1,"[" DB 3,30,K4,17,2,8,"OR",#80,"IG",#80,"INAL" DB 9,21,K4,18,2,3,"YEP" DB 3,30,K4,19,1,8,"W",#80,"INNER",#81,"S " DB 9,21,K4,20,1,3,"NOP" ENDM WO EQU BUBLER TEXT IF0 GA-2 WO=ITAL ENDIF IF0 GA-1 WO=CYBER ENDIF IF0 GA-4 WO=NWRL ENDIF IF0 GA-3 WO=TENS ENDIF IF0 GA-5 WO=YOGI ENDIF IF0 GA-6 WO=CLIF ENDIF IF0 GA-7 WO=HERT ENDIF IF0 GA-8 WO=WELLS ENDIF IF0 GA-9 WO=PUZN ENDIF IF0 GA-10 WO=XENO ENDIF DB 19+WO DB 7,8,K3,19,2,4,"NEXT" DB 7,11,K2,20,2,3,"OUR" DB 7,17,K4,21,1,5,"CRACK" DB 7,17,K3,22,2,1,"-" DB 7,27,K1,23,2,7,"RELEASE" DB 7,31,K4,24,1,2,"OF" IF0 GA N_BUBLER ENDIF IF0 GA-1 N_CYBER ENDIF IF0 GA-2 N_ITAL ENDIF IF0 GA-3 N_TENS ENDIF IF0 GA-4 N_NWRL ENDIF IF0 GA-5 N_YOGI ENDIF IF0 GA-6 N_CLIF ENDIF IF0 GA-7 N_HERT ENDIF IF0 GA-8 N_WELLS ENDIF IF0 GA-9 N_PUZN ENDIF IF0 GA-10 N_XENO ENDIF DB 1,8,K4,0,2,6,"BEWARE" DB 1,11,K1,2,1,3,"!!",#81,"!" DB 1,24,K4,9,1,11,"$",#81,"BRA",#80,"INWAVE%" DB 1,30,K2,10,2,5,"BACKS" DB 1,30,K1,11,2,1,"!" DB 4,6,K2,12,1,3,"NOW" DB 4,10,K4,13,0,2,"WE" DB 4,13,K1,14,0,3,"ARE" DB 4,19,K2,15,0,5,"PROUD" DB 4,23,K1,16,1,2,"TO" DB 4,28,K3,17,3,5,"BR",#80,"ING" DB 4,28,K2,18,3,1,"U" TEXT2 DB 22 DB 5,4,K3,0,1,3,"AND" DB 5,8,K1,1,1,3,"NOW" DB 5,8,K2,2,1,1,"U" DB 5,14,K4,3,1,3,"MAY" DB 7,10,K4,4,1,6,"ESCAPE" DB 7,13,K3,5,1,2,"TO" DB 7,20,K2,6,1,7,"TRA",#80,"INER" DB 9,11,K2,7,1,5,"MENUE" DB 9,16,K1,8,2,2,"BY" DB 9,25,K3,9,1,8,"PRESS",#80,"ING" DB 11,8,K1,10,2,1,"%" DB 11,16,K4,11,1,5,"SPACE" DB 11,16,K1,12,1,1,"$" DB 11,22,K2,13,1,3,"KEY" DB 11,26,K1,14,1,2,"OR" DB 11,31,K3,15,1,4,"READ" DB 13,16,K1,16,1,3,"ALL" DB 13,22,K2,17,2,4,"THIS" DB 13,27,K4,18,0,4,"IN",#81,"FO" DB 13,26,K1,19,0,1,"." DB 13,28,K3,20,0,1,"." DB 13,30,K2,21,0,1,"." IF0 CCR WTC=WGC ELSE WTC=WGDR ENDIF TEXT3 DB 26+WTC DB 8,15,K1,T20,1,1,"+" DB 8,21,K2,T21,1,3,"FN",#81,"T" DB 8,21,K1,T22,1,1,"." DB 8,27,K4,T23,1,3,"ALX" DB 8,27,K1,T24,1,1,"/" DB 8,33,K3,T25,2,2,"BW" DB 8,10,K2,T18,1,8,"CRACKTRO" DB 8,15,K4,T19,1,5,"CODED" DB 10,15,K1,T27,1,1,"." DB 10,17,K1,T28,1,1,"." DB 10,19,K1,T29,1,1,"." DB 10,27,K4,T30,1,5,"MEGUS" DB 10,27,K1,T31,1,1,"/" DB 10,33,K3,T32,2,2,"BW" DB 10,15,K3,T26,1,5,"MUS",#80,"IC" DB 12,28,K4,T37,1,6,"EXOCET" DB 12,28,K1,T38,1,1,"/" DB 14,31,K3,T39,2,9,"J",#83,"FF<",#81,"SB<",#80,"I3" DB 12,15,K2,T33,1,4,"LOGO" DB 14,19,K1,T38+2,1,1,"/" DB 12,14,K1,T34,2,1,"." DB 12,16,K1,T35,1,1,"." DB 12,18,K1,T36,1,1,"." DB 0,8,K4,T00,1,7,"CRED",#80,"IT",#81,"S" DB 0,8,K1,T01,1,1,":" DB 3,6,K2,T02,1,4,"GAME" IF0 CCR GC ELSE GDR ENDIF TEXT4 DB 35 DB 8,10,K1,0,1,1,"@" DB 8,20,K4,4,1,6,"GREETZ" DB 8,19,K1,2,1,1,"@" DB 9,5,K1,24,0,2,"I8" DB 9,9,K4,44,1,3,"R",#82,"ZL" DB 9,31,K2,50,1,7,"TR",#80,"IUM",#82,"PH" DB 11,8,K2,14,1,6,"MAYHEM" DB 11,11,K1,64,1,2,1,"RS" DB 11,25,K3,26,1,12,"STUD",#80,"IO " DB "STALL" DB 11,28,K1,20,2,3,"HWC" DB 11,32,K4,42,2,2,"TL" DB 13,6,K4,58,1,4,"R",#82,"USH" DB 13,10,K2,8,1,3,"GBG" DB 13,19,K1,40,1,6,"P",#81,"SYCHO" DB 13,32,K3,52,0,7,"M",#80,"ILYTIA" DB 13,24,K4,34,1,2,1,"DT" DB 1,4,K4,66,1,3,"PCB" DB 1,10,K3,28,1,5,"EY",#81,1,"E-Q" DB 1,14,K1,16,1,2,"AF" DB 1,24,K4,68,1,9,"RAWW ARSE" DB 1,28,K1,60,1,3,"B",#82,"RC" DB 1,32,K2,36,1,2,1,"DR" DB 3,6,K3,12,1,5,"SKR",#81,"JU" DB 3,10,K4,54,1,2,"4",#82,"D" DB 3,18,K2,10,1,6,1,"H-PRO",#80,"G" DB 3,26,K1,22,1,6,"NEWART" DB 3,31,K4,62,1,3,"P",#82,"HT" DB 5,4,K4,18,1,3,"CPU" DB 5,14,K1,30,1,9,"SERZH",#81,"SOFT" DB 5,22,K3,48,1,6,"P",#83,"O",#81,"S-",1,"WT" DB 5,27,K4,56,2,3,"XTM" DB 5,32,K2,38,1,3,"OCA" DB 7,10,K2,46,1,6,"GAS 13" DB 7,27,K3,32,1,3,"CTL" DB 7,31,K1,6,1,3,"P",#82,"HF" TEXT5 DB 25 DB 7,3,K2,20,1,1,"$" DB 7,5,K4,0,1,1,"C" DB 7,7,K1,2,1,1,"@" DB 7,9,K4,4,1,1,"M" DB 7,11,K4,6,0,1,"I" DB 7,13,K4,8,1,1,"N" DB 7,15,K4,10,1,1,"G" DB 7,19,K4,12,1,1,"S" DB 7,21,K1,14,1,1,"@" DB 7,23,K1,16,1,1,"@" DB 7,25,K4,18,1,1,"N" DB 7,27,K2,22,1,1,"%" DB 10,11,K3,26,1,7,"H",#80,"IGHWAY" DB 10,21,K3,28,1,9,"ENCOUNTER" DB 10,33,K3,30,1,10,"COLLEC",#81,"T",#80,"ION" DB 12,8,K1,24,1,7,"CYCLONE" DB 14,13,K4,36,1,4,"YOG",#80,"I" DB 14,19,K4,38,1,4,"BEAR" DB 14,31,K4,40,1,10,"COLLEC",#81,"T",#80,"ION" DB 0,8,K4,32,1,6,"GALAXY" DB 0,14,K4,34,1,5,"FORCE" DB 2,24,K1,46,1,6,"S",#80,"ILEN",#81,"T" DB 2,32,K1,48,1,6,"SHADOW" DB 4,8,K2,42,1,6,"SAVAGE" DB 4,20,K2,44,2,10,"COLLEC",#81,"T",#80,"ION" TEXT6 DB 9 DB 5,4,K3,1,1,3,"OUR" DB 5,10,K2,2,1,5,"STUFF" DB 5,10,K1,3,1,1,":" DB 9,8,K2,4,2,7,"H",#81,1,"TT",#82,"P:",#83,"//" DB 9,18,K4,5,1,9,"BRA",#80,"INWAVE" DB 9,18,K1,6,1,1,"." DB 9,26,K4,7,1,5,"FATAL" DB 9,26,K1,8,1,1,"." DB 9,32,K4,9,1,2,"RU" MACRO TP DB 2,19,K1,12,2,1,"[" DB 6,19,K1,13,2,1,"[" DB 2,25,K1,14,2,1,"]" DB 6,25,K1,15,2,1,"]" DB 0,10,K0,16,1,9 DS 9,32 DB 2,25,K4,17,2,3,"YEP" DB 6,25,K4,18,2,3,"YEP" DB 2,25,K4,19,1,3,"NOP" DB 6,25,K4,20,1,3,"NOP" ENDM MACRO YB2 DB 21 YK YP1 DB 2,17,K4,8,1,4,"FOOD" YP22 DB 6,19,K3,11,1,6,"SWEETS" TP ENDM MACRO YB1 DB 21 YK YP11 YP2 DB 6,9,K4,10,3,4,"SK",#80,"IP" DB 6,20,K3,11,1,10,"PREC",#80,"IP",#80,"ICES" TP ENDM
awa/src/awa-events-dispatchers-actions.adb
Letractively/ada-awa
0
24026
<reponame>Letractively/ada-awa ----------------------------------------------------------------------- -- awa-events-dispatchers-actions -- Event dispatcher to Ada bean actions -- Copyright (C) 2012 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Exceptions; with Util.Beans.Objects; with Util.Beans.Basic; with Util.Log.Loggers; with EL.Contexts; with EL.Contexts.Default; with EL.Variables; with EL.Variables.Default; with ASF.Beans; with ASF.Requests; with ASF.Sessions; with AWA.Events.Action_Method; package body AWA.Events.Dispatchers.Actions is use Ada.Strings.Unbounded; use Util.Log; Log : constant Loggers.Logger := Loggers.Create ("AWA.Events.Dispatchers.Actions"); -- ------------------------------ -- Dispatch the event identified by <b>Event</b>. -- The event actions which are associated with the event are executed synchronously. -- ------------------------------ procedure Dispatch (Manager : in Action_Dispatcher; Event : in Module_Event'Class) is use Util.Beans.Objects; -- Dispatch the event to the event action identified by <b>Action</b>. procedure Dispatch_One (Action : in Event_Action); type Event_Bean is new Util.Beans.Basic.Readonly_Bean with null record; overriding function Get_Value (From : in Event_Bean; Name : in String) return Util.Beans.Objects.Object; -- ------------------------------ -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. -- ------------------------------ overriding function Get_Value (From : in Event_Bean; Name : in String) return Util.Beans.Objects.Object is pragma Unreferenced (From); begin return Event.Get_Value (Name); end Get_Value; Variables : aliased EL.Variables.Default.Default_Variable_Mapper; -- ------------------------------ -- Default Resolver -- ------------------------------ type Event_ELResolver is limited new EL.Contexts.ELResolver with record Request : ASF.Requests.Request_Access; Application : AWA.Applications.Application_Access; end record; overriding function Get_Value (Resolver : Event_ELResolver; Context : EL.Contexts.ELContext'Class; Base : access Util.Beans.Basic.Readonly_Bean'Class; Name : Unbounded_String) return Util.Beans.Objects.Object; overriding procedure Set_Value (Resolver : in out Event_ELResolver; Context : in EL.Contexts.ELContext'Class; Base : access Util.Beans.Basic.Bean'Class; Name : in Unbounded_String; Value : in Util.Beans.Objects.Object); -- ------------------------------ -- Get the value associated with a base object and a given property. -- ------------------------------ overriding function Get_Value (Resolver : Event_ELResolver; Context : EL.Contexts.ELContext'Class; Base : access Util.Beans.Basic.Readonly_Bean'Class; Name : Unbounded_String) return Util.Beans.Objects.Object is use Util.Beans.Basic; use EL.Variables; use type ASF.Requests.Request_Access; Result : Object; Bean : Util.Beans.Basic.Readonly_Bean_Access; Scope : ASF.Beans.Scope_Type; Key : constant String := To_String (Name); begin if Base /= null then return Base.Get_Value (Key); end if; if Resolver.Request /= null then Result := Resolver.Request.Get_Attribute (Key); if not Util.Beans.Objects.Is_Null (Result) then return Result; end if; -- If there is a session, look if the attribute is defined there. declare Session : constant ASF.Sessions.Session := Resolver.Request.Get_Session; begin if Session.Is_Valid then Result := Session.Get_Attribute (Key); if not Util.Beans.Objects.Is_Null (Result) then return Result; end if; end if; end; end if; Resolver.Application.Create (Name, Context, Bean, Scope); if Bean = null then return Resolver.Application.Get_Global (Name, Context); end if; Result := To_Object (Bean); if Resolver.Request /= null then Resolver.Request.Set_Attribute (Key, Result); else Variables.Bind (Key, Result); end if; return Result; end Get_Value; -- ------------------------------ -- Set the value associated with a base object and a given property. -- ------------------------------ overriding procedure Set_Value (Resolver : in out Event_ELResolver; Context : in EL.Contexts.ELContext'Class; Base : access Util.Beans.Basic.Bean'Class; Name : in Unbounded_String; Value : in Util.Beans.Objects.Object) is pragma Unreferenced (Context); use type ASF.Requests.Request_Access; Key : constant String := To_String (Name); begin if Base /= null then Base.Set_Value (Name => Key, Value => Value); elsif Resolver.Request /= null then Resolver.Request.Set_Attribute (Name => Key, Value => Value); else Variables.Bind (To_String (Name), Value); end if; end Set_Value; Local_Event : aliased Event_Bean; Resolver : aliased Event_ELResolver; ELContext : aliased EL.Contexts.Default.Default_Context; -- ------------------------------ -- Dispatch the event to the event action identified by <b>Action</b>. -- ------------------------------ procedure Dispatch_One (Action : in Event_Action) is use Ada.Exceptions; Method : EL.Expressions.Method_Info; begin Method := Action.Action.Get_Method_Info (Context => ELContext); if Method.Object.all in Util.Beans.Basic.Bean'Class then -- If we have a prepare method and the bean provides a Set_Value method, -- call the preparation method to fill the bean with some values. EL.Beans.Initialize (Util.Beans.Basic.Bean'Class (Method.Object.all), Action.Properties, ELContext); end if; -- Execute the specified method on the bean and give it the event object. AWA.Events.Action_Method.Execute (Method => Method, Param => Event); -- If an exception is raised by the action, do not propagate it: -- o We have to dispatch the event to other actions. -- o The event may be dispatched asynchronously and there is no handler -- that could handle such exception exception when E : others => Log.Error ("Error when executing event action {0}: {1}: {2}", Action.Action.Get_Expression, Exception_Name (E), Exception_Message (E)); end Dispatch_One; Pos : Event_Action_Lists.Cursor := Manager.Actions.First; begin Resolver.Application := Manager.Application; ELContext.Set_Resolver (Resolver'Unchecked_Access); ELContext.Set_Variable_Mapper (Variables'Unchecked_Access); Variables.Bind (Name => "event", Value => To_Object (Local_Event'Unchecked_Access, STATIC)); while Event_Action_Lists.Has_Element (Pos) loop Event_Action_Lists.Query_Element (Pos, Dispatch_One'Access); Event_Action_Lists.Next (Pos); end loop; end Dispatch; -- ------------------------------ -- Add an action invoked when an event is dispatched through this dispatcher. -- When the event queue dispatches the event, the Ada bean identified by the method action -- represented by <b>Action</b> is created and initialized by evaluating and setting the -- parameters defined in <b>Params</b>. The action method is then invoked. -- ------------------------------ procedure Add_Action (Manager : in out Action_Dispatcher; Action : in EL.Expressions.Method_Expression; Params : in EL.Beans.Param_Vectors.Vector) is Item : Event_Action; begin Item.Action := Action; Item.Properties := Params; Manager.Actions.Append (Item); end Add_Action; -- ------------------------------ -- Create a new dispatcher associated with the application. -- ------------------------------ function Create_Dispatcher (Application : in AWA.Applications.Application_Access) return Dispatcher_Access is Result : constant Dispatcher_Access := new Action_Dispatcher '(Dispatcher with Application => Application, others => <>); begin return Result.all'Access; end Create_Dispatcher; end AWA.Events.Dispatchers.Actions;
oeis/006/A006588.asm
neoneye/loda-programs
11
9245
; A006588: a(n) = 4^n*(3*n)!/((2*n)!*n!). ; 1,12,240,5376,126720,3075072,76038144,1905131520,48199827456,1228623052800,31504481648640,811751838842880,20999667135283200,545086744471535616,14189559697354260480,370298578584748425216,9684502341534993088512,253765034617761850982400,6660727956252872964833280,175092820244030003399884800,4608981775962082089495429120,121471561510025048518966640640,3205000185296221153312269926400,84649164314258455504293923389440,2237799716180130446044365953433600,59209440327208480014032644312399872 mov $2,$0 mul $2,2 add $0,$2 bin $0,$2 mov $1,2 pow $1,$2 mul $0,$1
Src/Ant32/div0.asm
geoffthorpe/ant-architecture
0
5420
ste lc g0, 0 div g0, g0, g0 halt
libsrc/adt/linkedlist/ADTListSearch.asm
meesokim/z88dk
0
27809
<reponame>meesokim/z88dk<filename>libsrc/adt/linkedlist/ADTListSearch.asm ; void *adt_ListSearch(struct adt_List *list, void *match, void *item1) ; 02.2003, 08.2005 aralbrec PUBLIC ADTListSearch EXTERN l_jpix ; enter: HL = struct adt_List * ; DE = item1 * ; IX = void (*match)(DE = void *item1, BC = void *item2) -- MUST PRESERVE BC,DE,IX,HL ; sets carry if equal ; exit : no carry = item not found, current points past end of list ; else BC = item found, current points at found item ; uses : AF,BC,DE,HL .ADTListSearch inc hl inc hl ld a,(hl) ; a = list state inc hl or a jp nz, notbefore inc hl push hl ; stack = list.current + 1 inc hl ld a,(hl) inc hl jp rejoin .notbefore ld a,(hl) inc hl push hl ; stack = list.current + 1 .rejoin ld l,(hl) ld h,a ; hl = current NODE .while ld a,h or l jr z, fail ; if hl = NULL, failure ld c,(hl) inc hl ld b,(hl) ; bc = item2 * inc hl ; hl = NODE.next call l_jpix ; compare two items, set carry if = jr c, found ld a,(hl) inc hl ld l,(hl) ld h,a jp while .found dec hl dec hl ; hl = NODE pop de ex de,hl ; de = NODE, hl = list.current + 1 ld (hl),e dec hl ld (hl),d ; list.current = NODE dec hl ld (hl),1 ; current ptr is INLIST scf ret .fail pop hl ; hl = list.current + 1 xor a ld (hl),a dec hl ld (hl),a ; list.current = NULL dec hl ld (hl),2 ; current ptr past end of list ret
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_860.asm
ljhsiun2/medusa
9
246503
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0xdc9c, %rsi lea addresses_A_ht+0xcf9c, %rdi nop nop nop nop nop dec %r15 mov $104, %rcx rep movsb and $54326, %rbp lea addresses_WC_ht+0xfbc8, %r12 nop sub %r14, %r14 mov $0x6162636465666768, %rsi movq %rsi, (%r12) nop nop nop add $49960, %rdi lea addresses_normal_ht+0x1b89c, %r15 clflush (%r15) nop nop nop nop nop add $11994, %r12 vmovups (%r15), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %rbp nop nop xor %rbp, %rbp lea addresses_WT_ht+0x1665d, %rbp nop nop nop xor %rcx, %rcx movw $0x6162, (%rbp) nop sub $65513, %r14 lea addresses_A_ht+0x1a31c, %r15 cmp $13565, %rcx mov (%r15), %bp nop nop nop nop nop sub %r15, %r15 pop %rsi pop %rdi pop %rcx pop %rbp pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %r15 push %rbx push %rcx push %rdi // Store lea addresses_WT+0x9264, %rbx nop nop sub %r12, %r12 movw $0x5152, (%rbx) nop nop nop nop add %r12, %r12 // Faulty Load lea addresses_WT+0x1189c, %r12 nop nop nop cmp $65323, %r14 movb (%r12), %cl lea oracles, %rbx and $0xff, %rcx shlq $12, %rcx mov (%rbx,%rcx,1), %rcx pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'39': 21829} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
library/fmGUI_Database/databaseNameOfFrontWindow.applescript
NYHTC/applescript-fm-helper
1
384
<filename>library/fmGUI_Database/databaseNameOfFrontWindow.applescript -- databaseNameOfFrontWindow({fmAppType:""}) -- <NAME>, NYHTC -- Return the database name of window 1. (* HISTORY: 1.4 - 2018-10-16 ( eshagdar ): FM17 has only FMP ( no more FMA) 1.3 - 1.2 - 1.1 - 1.0 - created REQUIRES: dbNameOfWindowName *) on run databaseNameOfFrontWindow({}) end run -------------------- -- START OF CODE -------------------- on databaseNameOfFrontWindow(prefs) -- version 1.4 set defaultPrefs to {} set prefs to prefs & defaultPrefs using terms from application "FileMaker Pro Advanced" tell application ID "com.filemaker.client.pro12" set frontWindowName to name of window 1 end tell end using terms from dbNameOfWindowName(frontWindowName) end databaseNameOfFrontWindow -------------------- -- END OF CODE -------------------- on dbNameOfWindowName(frontWindowName) tell application "htcLib" to dbNameOfWindowName(frontWindowName) end dbNameOfWindowName
src/Adjoint.agda
myuon/agda-cate
2
5955
module Adjoint where open import Level open import Data.Product open import Basic open import Category import Functor import Nat open Category.Category open Functor.Functor open Nat.Nat open Nat.Export record Adjoint {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} (F : Functor.Functor C D) (G : Functor.Functor D C) : Set (suc ℓ ⊔ suc C₁ ⊔ C₀ ⊔ suc ℓ′ ⊔ suc D₁ ⊔ D₀) where field adjunction : {x : Obj C} {a : Obj D} → Setoids [ LiftSetoid {b = C₁ ⊔ D₁} {ℓ′ = ℓ ⊔ ℓ′} (Homsetoid D (fobj F x) a) ≅ LiftSetoid {b = C₁ ⊔ D₁} {ℓ′ = ℓ ⊔ ℓ′} (Homsetoid C x (fobj G a)) ] adjunct-→-Map : {x : Obj C} {a : Obj D} → Map.Map (Homsetoid D (fobj F x) a) (Homsetoid C x (fobj G a)) adjunct-→-Map {x} {a} = lowerMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (_[_≅_].map-→ (adjunction {x} {a})) adjunct-←-Map : {x : Obj C} {a : Obj D} → Map.Map (Homsetoid C x (fobj G a)) (Homsetoid D (fobj F x) a) adjunct-←-Map {x} {a} = lowerMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (_[_≅_].map-← (adjunction {x} {a})) adjunct-→ : {x : Obj C} {a : Obj D} → Hom D (fobj F x) a → Hom C x (fobj G a) adjunct-→ f = Map.mapping (lowerMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (_[_≅_].map-→ adjunction)) f adjunct-← : {x : Obj C} {a : Obj D} → Hom C x (fobj G a) → Hom D (fobj F x) a adjunct-← f = Map.mapping (lowerMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (_[_≅_].map-← adjunction)) f adjunct-→←≈id : {x : Obj C} {a : Obj D} {f : Hom C x (fobj G a)} → C [ adjunct-→ (adjunct-← f) ≈ f ] adjunct-→←≈id {x} {a} {f} = lower (proj₁ (_[_≅_].proof adjunction) (lift f)) adjunct-←→≈id : {x : Obj C} {a : Obj D} {f : Hom D (fobj F x) a} → D [ adjunct-← (adjunct-→ f) ≈ f ] adjunct-←→≈id {x} {a} {f} = lower (proj₂ (_[_≅_].proof adjunction) (lift f)) field natural-in-→-C : {x y : Obj C} {a : Obj D} {f : Hom C y x} → Setoids [ Setoids [ liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ C ][ f ,-] (fobj G a)) ∘ _[_≅_].map-→ adjunction ] ≈ Setoids [ _[_≅_].map-→ adjunction ∘ liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ D ][ fmap F f ,-] a) ] ] natural-in-→-D : {x : Obj C} {a b : Obj D} {f : Hom D a b} → Setoids [ Setoids [ liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ C ][-, fmap G f ] x) ∘ _[_≅_].map-→ adjunction ] ≈ Setoids [ _[_≅_].map-→ adjunction ∘ liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ D ][-, f ] (fobj F x)) ] ] natural-in-←-C : {x y : Obj C} {a : Obj D} {f : Hom C y x} → Setoids [ Setoids [ liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ D ][ fmap F f ,-] a) ∘ _[_≅_].map-← adjunction ] ≈ Setoids [ _[_≅_].map-← adjunction ∘ liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ C ][ f ,-] (fobj G a)) ] ] natural-in-←-C {x} {y} {a} {f} = begin⟨ Setoids ⟩ Setoids [ Ffa ∘ _[_≅_].map-← adjunction ] ≈⟨ ≈-composite Setoids {f = Ffa} {g = Setoids [ Setoids [ adj← ∘ fGa ] ∘ _[_≅_].map-→ adjunction ]} {h = adj→₂} {i = adj→₂} lem-1 (refl-hom Setoids {f = _[_≅_].map-← adjunction}) ⟩ Setoids [ Setoids [ adj← ∘ fGa ] ∘ Setoids [ _[_≅_].map-→ adjunction ∘ _[_≅_].map-← adjunction ] ] ≈⟨ ≈-composite Setoids {f = Setoids [ adj← ∘ fGa ]} {g = Setoids [ adj← ∘ fGa ]} {h = Setoids [ _[_≅_].map-→ adjunction ∘ _[_≅_].map-← adjunction ]} {i = id Setoids} (refl-hom Setoids {f = Setoids [ adj← ∘ fGa ]}) (proj₁ (_[_≅_].proof adjunction)) ⟩ Setoids [ adj← ∘ fGa ] ∎ where Ffa = liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ D ][ fmap F f ,-] a) fGa = liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ C ][ f ,-] (fobj G a)) adj← = _[_≅_].map-← adjunction adj→₂ = _[_≅_].map-← adjunction adj→ = _[_≅_].map-→ adjunction lem-1 : Setoids [ Ffa ≈ Setoids [ Setoids [ adj← ∘ fGa ] ∘ _[_≅_].map-→ adjunction ] ] lem-1 = begin⟨ Setoids ⟩ Ffa ≈⟨ leftId Setoids {f = Ffa} ⟩ Setoids [ id Setoids ∘ Ffa ] ≈⟨ ≈-composite Setoids {f = id Setoids} {g = Setoids [ adj← ∘ adj→ ]} {h = Ffa} {i = Ffa} (sym-hom Setoids {f = Setoids [ adj← ∘ adj→ ]} {g = id Setoids} (proj₂ (_[_≅_].proof adjunction))) (refl-hom Setoids {f = Ffa}) ⟩ Setoids [ adj← ∘ Setoids [ adj→ ∘ Ffa ] ] ≈⟨ ≈-composite Setoids {f = adj←} {g = adj←} {h = Setoids [ adj→ ∘ Ffa ]} {i = Setoids [ fGa ∘ _[_≅_].map-→ adjunction ]} (refl-hom Setoids {f = adj←}) (sym-hom Setoids {f = Setoids [ fGa ∘ _[_≅_].map-→ adjunction ]} {g = Setoids [ adj→ ∘ Ffa ]} natural-in-→-C) ⟩ Setoids [ Setoids [ _[_≅_].map-← adjunction ∘ liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ C ][ f ,-] (fobj G a)) ] ∘ _[_≅_].map-→ adjunction ] ∎ natural-in-←-D : {x : Obj C} {a b : Obj D} {f : Hom D a b} → Setoids [ Setoids [ liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ D ][-, f ] (fobj F x)) ∘ _[_≅_].map-← adjunction ] ≈ Setoids [ _[_≅_].map-← adjunction ∘ liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ C ][-, fmap G f ] x) ] ] natural-in-←-D {x} {a} {b} {f} = begin⟨ Setoids ⟩ Setoids [ fFx ∘ adj←a ] ≈⟨ ≈-composite Setoids {f = fFx} {g = Setoids [ Setoids [ adj←b ∘ Gfx ] ∘ adj→a ]} {h = adj←a} {i = adj←a} lem-1 (refl-hom Setoids {f = adj←a}) ⟩ Setoids [ Setoids [ adj←b ∘ Gfx ] ∘ Setoids [ adj→a ∘ adj←a ] ] ≈⟨ ≈-composite Setoids {f = Setoids [ adj←b ∘ Gfx ]} {g = Setoids [ adj←b ∘ Gfx ]} {h = Setoids [ adj→a ∘ adj←a ]} {i = id Setoids} (refl-hom Setoids {f = Setoids [ adj←b ∘ Gfx ]}) (proj₁ (_[_≅_].proof adjunction)) ⟩ Setoids [ adj←b ∘ Gfx ] ∎ where fFx = liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ D ][-, f ] (fobj F x)) Gfx = liftMap {d = C₁ ⊔ D₁} {ℓ″ = ℓ ⊔ ℓ′} (component HomNat[ C ][-, fmap G f ] x) adj←a = _[_≅_].map-← adjunction adj←b = _[_≅_].map-← adjunction adj→a = _[_≅_].map-→ adjunction adj→b = _[_≅_].map-→ adjunction lem-1 : Setoids [ fFx ≈ Setoids [ Setoids [ adj←b ∘ Gfx ] ∘ adj→a ] ] lem-1 = begin⟨ Setoids ⟩ fFx ≈⟨ ≈-composite Setoids {f = id Setoids} {g = Setoids [ adj←b ∘ adj→b ]} {h = fFx} {i = fFx} (sym-hom Setoids {f = Setoids [ adj←b ∘ adj→b ]} {g = id Setoids} (proj₂ (_[_≅_].proof adjunction))) (refl-hom Setoids {f = fFx}) ⟩ Setoids [ adj←b ∘ Setoids [ adj→b ∘ fFx ] ] ≈⟨ ≈-composite Setoids {f = adj←b} {g = adj←b} {h = Setoids [ adj→b ∘ fFx ]} {i = Setoids [ Gfx ∘ adj→a ]} (refl-hom Setoids {f = adj←b}) (sym-hom Setoids {f = Setoids [ Gfx ∘ adj→a ]} {g = Setoids [ adj→b ∘ fFx ]} natural-in-→-D) ⟩ Setoids [ Setoids [ adj←b ∘ Gfx ] ∘ adj→a ] ∎ naturality-point-←-C : {x y : Obj C} {a : Obj D} {f : Hom C y x} {k : Hom C x (fobj G a)} → D [ D [ adjunct-← k ∘ fmap F f ] ≈ adjunct-← (C [ k ∘ f ]) ] naturality-point-←-C = λ {x} {y} {a} {f} {k} → lower (natural-in-←-C (lift k)) naturality-point-→-C : {x y : Obj C} {a : Obj D} {f : Hom C y x} {k : Hom D (fobj F x) a} → C [ C [ adjunct-→ k ∘ f ] ≈ adjunct-→ (D [ k ∘ fmap F f ]) ] naturality-point-→-C = λ {x} {y} {a} {f} {k} → lower (natural-in-→-C (lift k)) naturality-point-←-D : {x : Obj C} {a b : Obj D} {f : Hom D a b} {k : Hom C x (fobj G a)} → D [ D [ f ∘ adjunct-← k ] ≈ adjunct-← (C [ fmap G f ∘ k ]) ] naturality-point-←-D = λ {x} {y} {a} {f} {k} → lower (natural-in-←-D (lift k)) naturality-point-→-D : {x : Obj C} {a b : Obj D} {f : Hom D a b} {k : Hom D (fobj F x) a} → C [ C [ fmap G f ∘ adjunct-→ k ] ≈ adjunct-→ (D [ f ∘ k ]) ] naturality-point-→-D = λ {x} {y} {a} {f} {k} → lower (natural-in-→-D (lift k)) open Adjoint unit : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → Adjoint F G → Nat.Nat (Functor.identity C) (Functor.compose G F) unit {C₀} {C₁} {ℓ} {D₀} {D₁} {ℓ′} {C} {D} {F} {G} F⊣G = record { component = λ X → adjunct-→ F⊣G (id D) ; naturality = λ {a} {b} {f} → begin⟨ C ⟩ C [ adjunct-→ F⊣G (id D) ∘ fmap (Functor.identity C) f ] ≈⟨ naturality-point-→-C F⊣G ⟩ adjunct-→ F⊣G (D [ id D ∘ fmap F (fmap (Functor.identity C) f) ]) ≈⟨ Map.preserveEq (adjunct-→-Map F⊣G) (leftId D) ⟩ adjunct-→ F⊣G (fmap F f) ≈⟨ Map.preserveEq (adjunct-→-Map F⊣G) (sym-hom D (rightId D)) ⟩ adjunct-→ F⊣G (D [ fmap F f ∘ id D ]) ≈⟨ sym-hom C (naturality-point-→-D F⊣G) ⟩ C [ fmap (Functor.compose G F) f ∘ adjunct-→ F⊣G (id D) ] ∎ } counit : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → Adjoint F G → Nat.Nat (Functor.compose F G) (Functor.identity D) counit {C₀} {C₁} {ℓ} {D₀} {D₁} {ℓ′} {C} {D} {F} {G} F⊣G = record { component = λ X → adjunct-← F⊣G (id C) ; naturality = λ {a} {b} {f} → begin⟨ D ⟩ D [ adjunct-← F⊣G (id C) ∘ fmap (Functor.compose F G) f ] ≈⟨ naturality-point-←-C F⊣G ⟩ adjunct-← F⊣G (C [ id C ∘ fmap G f ]) ≈⟨ Map.preserveEq (adjunct-←-Map F⊣G) (leftId C) ⟩ adjunct-← F⊣G (fmap G f) ≈⟨ Map.preserveEq (adjunct-←-Map F⊣G) (sym-hom C (rightId C)) ⟩ adjunct-← F⊣G (C [ fmap G f ∘ id C ]) ≈⟨ sym-hom D (naturality-point-←-D F⊣G) ⟩ D [ fmap (Functor.identity D) f ∘ adjunct-← F⊣G (id C) ] ∎} Unit-universal : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → Adjoint F G → Set _ Unit-universal {C = C} {D} {F} {G} adj = ∀ {X : Obj C} {A : Obj D} (f : Hom C X (fobj G A)) → ∃! (λ x y → D [ x ≈ y ]) (λ (h : Hom D (fobj F X) A) → C [ C [ fmap G h ∘ component (unit adj) X ] ≈ f ]) unit-universality : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → (adj : Adjoint F G) → Unit-universal adj unit-universality {C = C} {D} {F} {G} F⊣G {X} {A} f = adjunct-← F⊣G f , lem-1 , lem-2 where lem-1 = begin⟨ C ⟩ C [ fmap G (adjunct-← F⊣G f) ∘ component (unit F⊣G) X ] ≈⟨ naturality-point-→-D F⊣G ⟩ adjunct-→ F⊣G (D [ adjunct-← F⊣G f ∘ id D ]) ≈⟨ Map.preserveEq (adjunct-→-Map F⊣G) (≈-composite D (refl-hom D) (sym-hom D (preserveId F))) ⟩ adjunct-→ F⊣G (D [ adjunct-← F⊣G f ∘ fmap F (id C) ]) ≈⟨ sym-hom C (naturality-point-→-C F⊣G) ⟩ C [ adjunct-→ F⊣G (adjunct-← F⊣G f) ∘ id C ] ≈⟨ rightId C ⟩ adjunct-→ F⊣G (adjunct-← F⊣G f) ≈⟨ adjunct-→←≈id F⊣G ⟩ f ∎ lem-2 = λ {y} eq → begin⟨ D ⟩ adjunct-← F⊣G f ≈⟨ Map.preserveEq (adjunct-←-Map F⊣G) (sym-hom C eq) ⟩ adjunct-← F⊣G (C [ fmap G y ∘ component (unit F⊣G) X ]) ≈⟨ sym-hom D (naturality-point-←-D (F⊣G)) ⟩ D [ y ∘ adjunct-← F⊣G (adjunct-→ F⊣G (id D)) ] ≈⟨ ≈-composite D (refl-hom D) (adjunct-←→≈id F⊣G) ⟩ D [ y ∘ id D ] ≈⟨ rightId D ⟩ y ∎ Counit-universal : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → Adjoint F G → Set _ Counit-universal {C = C} {D} {F} {G} adj = ∀ {X : Obj C} {A : Obj D} (h : Hom D (fobj F X) A) → ∃! (λ x y → C [ x ≈ y ]) (λ (f : Hom C X (fobj G A)) → D [ D [ component (counit adj) A ∘ fmap F f ] ≈ h ]) counit-universality : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → (adj : Adjoint F G) → Counit-universal adj counit-universality {C = C} {D} {F} {G} F⊣G = λ {X} {A} h → adjunct-→ F⊣G h , lem-1 , lem-2 where lem-1 = λ {A} {h} → begin⟨ D ⟩ D [ component (counit F⊣G) A ∘ fmap F (adjunct-→ F⊣G h) ] ≈⟨ naturality-point-←-C F⊣G ⟩ adjunct-← F⊣G (C [ id C ∘ adjunct-→ F⊣G h ]) ≈⟨ Map.preserveEq (adjunct-←-Map F⊣G) (leftId C) ⟩ adjunct-← F⊣G (adjunct-→ F⊣G h) ≈⟨ adjunct-←→≈id F⊣G ⟩ h ∎ lem-2 = λ {A} {h} {y} eq → begin⟨ C ⟩ adjunct-→ F⊣G h ≈⟨ Map.preserveEq (adjunct-→-Map F⊣G) (sym-hom D eq) ⟩ adjunct-→ F⊣G (D [ component (counit F⊣G) A ∘ fmap F y ]) ≈⟨ sym-hom C (naturality-point-→-C F⊣G) ⟩ C [ adjunct-→ F⊣G (component (counit F⊣G) A) ∘ y ] ≈⟨ ≈-composite C (adjunct-→←≈id F⊣G) (refl-hom C) ⟩ C [ id C ∘ y ] ≈⟨ leftId C ⟩ y ∎ TriangularL : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → Nat.Nat (Functor.identity C) (Functor.compose G F) → Nat.Nat (Functor.compose F G) (Functor.identity D) → Set _ TriangularL {C = C} {D} {F} {G} η ε = [ C , D ] [ Nat.compose (Nat.compose Nat.leftIdNat→ (ε N∘F F)) (Nat.compose (Nat.assocNat← {F = F} {G} {F}) (Nat.compose (F F∘N η) Nat.rightIdNat←)) ≈ id [ C , D ] ] triangularL-point : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → (η : Nat.Nat (Functor.identity C) (Functor.compose G F)) → (ε : Nat.Nat (Functor.compose F G) (Functor.identity D)) → {a : Obj C} → (triL : TriangularL {F = F} {G} η ε) → D [ D [ component (ε N∘F F) a ∘ component (F F∘N η) a ] ≈ id D {fobj F a} ] triangularL-point {C = C} {D} {F} {G} η ε {a} triL = begin⟨ D ⟩ D [ component (ε N∘F F) a ∘ component (F F∘N η) a ] ≈⟨ sym-hom D (≈-composite D (leftId D) (trans-hom D (leftId D) (rightId D))) ⟩ D [ D [ id D ∘ component (ε N∘F F) a ] ∘ D [ id D ∘ D [ component (F F∘N η) a ∘ id D ] ] ] ≈⟨ triL {a} ⟩ id D ∎ triangularL : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → (adj : Adjoint F G) → TriangularL {F = F} {G} (unit adj) (counit adj) triangularL {C = C} {D} {F} {G} adj = λ {a} → begin⟨ D ⟩ component (Nat.compose εF (Nat.compose (Nat.assocNat← {F = F} {G} {F}) Fη)) a ≈⟨ ≈-composite D (leftId D) (trans-hom D (leftId D) (rightId D)) ⟩ D [ component ε (fobj F a) ∘ fmap F (component η a) ] ≈⟨ proj₁ (proj₂ (counit-universality adj (id D))) ⟩ id D ≈⟨ refl-hom D ⟩ component (id [ C , D ] {F}) a ∎ where ε = counit adj η = unit adj εF = Nat.compose Nat.leftIdNat→ (counit adj N∘F F) Fη = Nat.compose {F = F} (F F∘N unit adj) Nat.rightIdNat← TriangularR : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → Nat.Nat (Functor.identity C) (Functor.compose G F) → Nat.Nat (Functor.compose F G) (Functor.identity D) → Set _ TriangularR {C = C} {D} {F} {G} η ε = [ D , C ] [ Nat.compose (Nat.compose Nat.rightIdNat→ (G F∘N ε)) (Nat.compose (Nat.assocNat→ {F = G} {F} {G}) (Nat.compose (η N∘F G) Nat.leftIdNat←)) ≈ id [ D , C ] ] triangularR : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → (adj : Adjoint F G) → TriangularR {F = F} (unit adj) (counit adj) triangularR {C = C} {D} {F} {G} adj = λ {a} → begin⟨ C ⟩ component (Nat.compose Gε (Nat.compose (Nat.assocNat→ {F = G} {F} {G}) ηG)) a ≈⟨ ≈-composite C (leftId C) (trans-hom C (leftId C) (rightId C)) ⟩ C [ fmap G (component ε a) ∘ component η (fobj G a) ] ≈⟨ proj₁ (proj₂ (unit-universality adj (id C))) ⟩ id C ≈⟨ refl-hom C ⟩ component (id [ D , C ] {G}) a ∎ where ε = counit adj η = unit adj Gε = Nat.compose {H = G} Nat.rightIdNat→ (G F∘N counit adj) ηG = Nat.compose (unit adj N∘F G) Nat.leftIdNat← triangularR-point : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → (η : Nat.Nat (Functor.identity C) (Functor.compose G F)) → (ε : Nat.Nat (Functor.compose F G) (Functor.identity D)) → {a : Obj D} → (triR : TriangularR {F = F} {G} η ε) → C [ C [ component (G F∘N ε) a ∘ component (η N∘F G) a ] ≈ id C {fobj G a} ] triangularR-point {C = C} {D} {F} {G} η ε {a} triR = begin⟨ C ⟩ C [ component (G F∘N ε) a ∘ component (η N∘F G) a ] ≈⟨ sym-hom C (≈-composite C (leftId C) (trans-hom C (leftId C) (rightId C))) ⟩ C [ C [ id C ∘ component (G F∘N ε) a ] ∘ C [ id C ∘ C [ component (η N∘F G) a ∘ id C ] ] ] ≈⟨ triR {a = a} ⟩ id C ∎ unit-triangular-holds-adjoint : ∀ {C₀ C₁ ℓ D₀ D₁ ℓ′} {C : Category C₀ C₁ ℓ} {D : Category D₀ D₁ ℓ′} {F : Functor.Functor C D} {G : Functor.Functor D C} → (η : Nat.Nat (Functor.identity C) (Functor.compose G F)) → (ε : Nat.Nat (Functor.compose F G) (Functor.identity D)) → TriangularL {F = F} η ε → TriangularR {F = F} η ε → Adjoint F G unit-triangular-holds-adjoint {C = C} {D} {F} {G} η ε triL triR = record { adjunction = λ {x} {a} → record { map-→ = record { mapping = λ Fx→a → lift (C [ fmap G (lower Fx→a) ∘ component η x ]) ; preserveEq = λ {x′} {y} x₂ → lift (≈-composite C (Functor.preserveEq G (lower x₂)) (refl-hom C)) } ; map-← = record { mapping = λ x→Ga → lift (D [ component ε a ∘ fmap F (lower x→Ga) ]) ; preserveEq = λ {x′} {y} x₂ → lift (≈-composite D (refl-hom D) (Functor.preserveEq F (lower x₂))) } ; proof = p1 , p2 } ; natural-in-→-C = λ {x} {y} {a} {f} Fx→a → lift (begin⟨ C ⟩ C [ C [ fmap G (lower Fx→a) ∘ component η x ] ∘ f ] ≈⟨ assoc C ⟩ C [ fmap G (lower Fx→a) ∘ C [ component η x ∘ f ] ] ≈⟨ ≈-composite C (refl-hom C) (naturality η) ⟩ C [ fmap G (lower Fx→a) ∘ C [ fmap G (fmap F f) ∘ component η y ] ] ≈⟨ sym-hom C (assoc C) ⟩ C [ C [ fmap G (lower Fx→a) ∘ fmap G (fmap F f) ] ∘ component η y ] ≈⟨ ≈-composite C (sym-hom C (preserveComp G)) (refl-hom C) ⟩ C [ fmap G (D [ lower Fx→a ∘ fmap F f ]) ∘ component η y ] ∎) ; natural-in-→-D = λ {x} {a} {b} {f} Fx→a → lift (begin⟨ C ⟩ C [ fmap G f ∘ C [ fmap G (lower Fx→a) ∘ component η x ] ] ≈⟨ sym-hom C (assoc C) ⟩ C [ C [ fmap G f ∘ fmap G (lower Fx→a) ] ∘ component η x ] ≈⟨ ≈-composite C (sym-hom C (preserveComp G)) (refl-hom C) ⟩ C [ fmap G (D [ f ∘ lower Fx→a ]) ∘ component η x ] ∎) } where p1 = λ {x} {a} x→Ga → lift (begin⟨ C ⟩ C [ fmap G (D [ component ε a ∘ fmap F (lower x→Ga) ]) ∘ component η x ] ≈⟨ ≈-composite C (preserveComp G) (refl-hom C) ⟩ C [ C [ fmap G (component ε a) ∘ fmap G (fmap F (lower x→Ga)) ] ∘ component η x ] ≈⟨ assoc C ⟩ C [ fmap G (component ε a) ∘ C [ fmap G (fmap F (lower x→Ga)) ∘ component η x ] ] ≈⟨ ≈-composite C (refl-hom C) (sym-hom C (naturality η)) ⟩ C [ fmap G (component ε a) ∘ C [ component η (fobj G a) ∘ (lower x→Ga) ] ] ≈⟨ sym-hom C (assoc C) ⟩ C [ C [ fmap G (component ε a) ∘ component η (fobj G a) ] ∘ (lower x→Ga) ] ≈⟨ ≈-composite C (triangularR-point {F = F} η ε {a = a} triR) (refl-hom C) ⟩ C [ id C ∘ (lower x→Ga) ] ≈⟨ leftId C ⟩ lower x→Ga ∎) p2 = λ {x} {a} Fx→a → lift (begin⟨ D ⟩ D [ component ε a ∘ fmap F (C [ fmap G (lower Fx→a) ∘ component η x ]) ] ≈⟨ ≈-composite D (refl-hom D) (preserveComp F) ⟩ D [ component ε a ∘ D [ fmap F (fmap G (lower Fx→a)) ∘ fmap F (component η x) ] ] ≈⟨ sym-hom D (assoc D) ⟩ D [ D [ component ε a ∘ fmap F (fmap G (lower Fx→a)) ] ∘ fmap F (component η x) ] ≈⟨ ≈-composite D (naturality ε) (refl-hom D) ⟩ D [ D [ lower Fx→a ∘ component ε (fobj F x) ] ∘ fmap F (component η x) ] ≈⟨ assoc D ⟩ D [ lower Fx→a ∘ D [ component ε (fobj F x) ∘ fmap F (component η x) ] ] ≈⟨ ≈-composite D (refl-hom D) (triangularL-point {F = F} η ε {a = x} triL) ⟩ D [ lower Fx→a ∘ id D ] ≈⟨ rightId D ⟩ lower Fx→a ∎) module Export where _⊣_ = Adjoint
examples/ada-lines/src/show_script.adb
stcarrez/resource-embedder
7
20264
with Ada.Text_IO; with Scripts; procedure Show_Script is begin Ada.Text_IO.Put ("Create SQLite"); Ada.Text_IO.Put (Natural'Image (Scripts.create_database'Length)); Ada.Text_IO.Put_Line (" lines"); for Line of Scripts.create_database loop Ada.Text_IO.Put_Line (Line.all); end loop; Ada.Text_IO.Put ("Drop SQLite"); Ada.Text_IO.Put (Natural'Image (Scripts.drop_database'Length)); Ada.Text_IO.Put_Line (" lines"); for Line of Scripts.drop_database loop Ada.Text_IO.Put_Line (Line.all); end loop; end Show_Script;
common/stm32gd.ads
ekoeppen/STM32_Generic_Ada_Drivers
1
9535
pragma Warnings (Off); with Interfaces; use Interfaces; pragma Warnings (On); package STM32GD is pragma Preelaborate; type UID_Type is array (1 .. 3) of Unsigned_32; procedure Wait_For_Interrupt with Inline_Always; procedure Clear_Event with Inline_Always; procedure Wait_For_Event with Inline_Always; procedure Reset; function UID return UID_Type; end STM32GD;
libsrc/math/mbf32/z80/dzerr.asm
jpoikela/z88dk
38
7281
PUBLIC DZERR DZERR: ret
source/amf/dd/amf-internals-tables-dc_metamodel-objects.adb
svn2github/matreshka
24
16607
<reponame>svn2github/matreshka ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Internals.Extents; with AMF.Internals.Tables.CMOF_Constructors; with AMF.Internals.Tables.CMOF_Element_Table; with AMF.Internals.Tables.DC_String_Data_00; package body AMF.Internals.Tables.DC_Metamodel.Objects is ---------------- -- Initialize -- ---------------- procedure Initialize is Extent : constant AMF.Internals.AMF_Extent := AMF.Internals.Extents.Allocate_Extent (AMF.Internals.Tables.DC_String_Data_00.MS_0040'Access); begin Base := AMF.Internals.Tables.CMOF_Element_Table.Last; Initialize_1 (Extent); Initialize_2 (Extent); Initialize_3 (Extent); Initialize_4 (Extent); Initialize_5 (Extent); Initialize_6 (Extent); Initialize_7 (Extent); Initialize_8 (Extent); Initialize_9 (Extent); Initialize_10 (Extent); Initialize_11 (Extent); Initialize_12 (Extent); Initialize_13 (Extent); Initialize_14 (Extent); Initialize_15 (Extent); Initialize_16 (Extent); Initialize_17 (Extent); Initialize_18 (Extent); Initialize_19 (Extent); Initialize_20 (Extent); Initialize_21 (Extent); Initialize_22 (Extent); Initialize_23 (Extent); Initialize_24 (Extent); Initialize_25 (Extent); Initialize_26 (Extent); Initialize_27 (Extent); Initialize_28 (Extent); Initialize_29 (Extent); Initialize_30 (Extent); Initialize_31 (Extent); Initialize_32 (Extent); Initialize_33 (Extent); Initialize_34 (Extent); Initialize_35 (Extent); Initialize_36 (Extent); Initialize_37 (Extent); Initialize_38 (Extent); Initialize_39 (Extent); Initialize_40 (Extent); Initialize_41 (Extent); Initialize_42 (Extent); Initialize_43 (Extent); Initialize_44 (Extent); Initialize_45 (Extent); Initialize_46 (Extent); Initialize_47 (Extent); Initialize_48 (Extent); Initialize_49 (Extent); Initialize_50 (Extent); Initialize_51 (Extent); Initialize_52 (Extent); Initialize_53 (Extent); Initialize_54 (Extent); Initialize_55 (Extent); Initialize_56 (Extent); Initialize_57 (Extent); Initialize_58 (Extent); Initialize_59 (Extent); Initialize_60 (Extent); Initialize_61 (Extent); Initialize_62 (Extent); Initialize_63 (Extent); Initialize_64 (Extent); Initialize_65 (Extent); Initialize_66 (Extent); Initialize_67 (Extent); Initialize_68 (Extent); Initialize_69 (Extent); Initialize_70 (Extent); Initialize_71 (Extent); Initialize_72 (Extent); Initialize_73 (Extent); Initialize_74 (Extent); Initialize_75 (Extent); Initialize_76 (Extent); Initialize_77 (Extent); Initialize_78 (Extent); Initialize_79 (Extent); Initialize_80 (Extent); Initialize_81 (Extent); Initialize_82 (Extent); Initialize_83 (Extent); Initialize_84 (Extent); Initialize_85 (Extent); Initialize_86 (Extent); Initialize_87 (Extent); Initialize_88 (Extent); Initialize_89 (Extent); Initialize_90 (Extent); Initialize_91 (Extent); Initialize_92 (Extent); Initialize_93 (Extent); Initialize_94 (Extent); Initialize_95 (Extent); Initialize_96 (Extent); Initialize_97 (Extent); Initialize_98 (Extent); end Initialize; ------------------ -- Initialize_1 -- ------------------ procedure Initialize_1 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Package; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_1; ------------------ -- Initialize_2 -- ------------------ procedure Initialize_2 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_2; ------------------ -- Initialize_3 -- ------------------ procedure Initialize_3 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Primitive_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_3; ------------------ -- Initialize_4 -- ------------------ procedure Initialize_4 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_4; ------------------ -- Initialize_5 -- ------------------ procedure Initialize_5 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Primitive_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_5; ------------------ -- Initialize_6 -- ------------------ procedure Initialize_6 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_6; ------------------ -- Initialize_7 -- ------------------ procedure Initialize_7 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Primitive_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_7; ------------------ -- Initialize_8 -- ------------------ procedure Initialize_8 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_8; ------------------ -- Initialize_9 -- ------------------ procedure Initialize_9 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Primitive_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_9; ------------------- -- Initialize_10 -- ------------------- procedure Initialize_10 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_10; ------------------- -- Initialize_11 -- ------------------- procedure Initialize_11 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_11; ------------------- -- Initialize_12 -- ------------------- procedure Initialize_12 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_12; ------------------- -- Initialize_13 -- ------------------- procedure Initialize_13 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_13; ------------------- -- Initialize_14 -- ------------------- procedure Initialize_14 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_14; ------------------- -- Initialize_15 -- ------------------- procedure Initialize_15 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_15; ------------------- -- Initialize_16 -- ------------------- procedure Initialize_16 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_16; ------------------- -- Initialize_17 -- ------------------- procedure Initialize_17 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_17; ------------------- -- Initialize_18 -- ------------------- procedure Initialize_18 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_18; ------------------- -- Initialize_19 -- ------------------- procedure Initialize_19 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_19; ------------------- -- Initialize_20 -- ------------------- procedure Initialize_20 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_20; ------------------- -- Initialize_21 -- ------------------- procedure Initialize_21 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_21; ------------------- -- Initialize_22 -- ------------------- procedure Initialize_22 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_22; ------------------- -- Initialize_23 -- ------------------- procedure Initialize_23 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_23; ------------------- -- Initialize_24 -- ------------------- procedure Initialize_24 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_24; ------------------- -- Initialize_25 -- ------------------- procedure Initialize_25 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_25; ------------------- -- Initialize_26 -- ------------------- procedure Initialize_26 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_26; ------------------- -- Initialize_27 -- ------------------- procedure Initialize_27 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_27; ------------------- -- Initialize_28 -- ------------------- procedure Initialize_28 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_28; ------------------- -- Initialize_29 -- ------------------- procedure Initialize_29 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_29; ------------------- -- Initialize_30 -- ------------------- procedure Initialize_30 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_30; ------------------- -- Initialize_31 -- ------------------- procedure Initialize_31 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_31; ------------------- -- Initialize_32 -- ------------------- procedure Initialize_32 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_32; ------------------- -- Initialize_33 -- ------------------- procedure Initialize_33 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_33; ------------------- -- Initialize_34 -- ------------------- procedure Initialize_34 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_34; ------------------- -- Initialize_35 -- ------------------- procedure Initialize_35 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_35; ------------------- -- Initialize_36 -- ------------------- procedure Initialize_36 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_36; ------------------- -- Initialize_37 -- ------------------- procedure Initialize_37 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Data_Type; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_37; ------------------- -- Initialize_38 -- ------------------- procedure Initialize_38 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_38; ------------------- -- Initialize_39 -- ------------------- procedure Initialize_39 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Constraint; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_39; ------------------- -- Initialize_40 -- ------------------- procedure Initialize_40 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_40; ------------------- -- Initialize_41 -- ------------------- procedure Initialize_41 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Opaque_Expression; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_41; ------------------- -- Initialize_42 -- ------------------- procedure Initialize_42 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_42; ------------------- -- Initialize_43 -- ------------------- procedure Initialize_43 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_43; ------------------- -- Initialize_44 -- ------------------- procedure Initialize_44 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_44; ------------------- -- Initialize_45 -- ------------------- procedure Initialize_45 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_45; ------------------- -- Initialize_46 -- ------------------- procedure Initialize_46 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_46; ------------------- -- Initialize_47 -- ------------------- procedure Initialize_47 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_47; ------------------- -- Initialize_48 -- ------------------- procedure Initialize_48 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_48; ------------------- -- Initialize_49 -- ------------------- procedure Initialize_49 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_49; ------------------- -- Initialize_50 -- ------------------- procedure Initialize_50 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_50; ------------------- -- Initialize_51 -- ------------------- procedure Initialize_51 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_51; ------------------- -- Initialize_52 -- ------------------- procedure Initialize_52 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_52; ------------------- -- Initialize_53 -- ------------------- procedure Initialize_53 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_53; ------------------- -- Initialize_54 -- ------------------- procedure Initialize_54 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_54; ------------------- -- Initialize_55 -- ------------------- procedure Initialize_55 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_55; ------------------- -- Initialize_56 -- ------------------- procedure Initialize_56 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_56; ------------------- -- Initialize_57 -- ------------------- procedure Initialize_57 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_57; ------------------- -- Initialize_58 -- ------------------- procedure Initialize_58 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_58; ------------------- -- Initialize_59 -- ------------------- procedure Initialize_59 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_59; ------------------- -- Initialize_60 -- ------------------- procedure Initialize_60 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_60; ------------------- -- Initialize_61 -- ------------------- procedure Initialize_61 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_61; ------------------- -- Initialize_62 -- ------------------- procedure Initialize_62 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_62; ------------------- -- Initialize_63 -- ------------------- procedure Initialize_63 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_63; ------------------- -- Initialize_64 -- ------------------- procedure Initialize_64 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_64; ------------------- -- Initialize_65 -- ------------------- procedure Initialize_65 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_65; ------------------- -- Initialize_66 -- ------------------- procedure Initialize_66 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_66; ------------------- -- Initialize_67 -- ------------------- procedure Initialize_67 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_67; ------------------- -- Initialize_68 -- ------------------- procedure Initialize_68 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_68; ------------------- -- Initialize_69 -- ------------------- procedure Initialize_69 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_69; ------------------- -- Initialize_70 -- ------------------- procedure Initialize_70 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_70; ------------------- -- Initialize_71 -- ------------------- procedure Initialize_71 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_71; ------------------- -- Initialize_72 -- ------------------- procedure Initialize_72 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_72; ------------------- -- Initialize_73 -- ------------------- procedure Initialize_73 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_73; ------------------- -- Initialize_74 -- ------------------- procedure Initialize_74 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_74; ------------------- -- Initialize_75 -- ------------------- procedure Initialize_75 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_75; ------------------- -- Initialize_76 -- ------------------- procedure Initialize_76 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_76; ------------------- -- Initialize_77 -- ------------------- procedure Initialize_77 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_77; ------------------- -- Initialize_78 -- ------------------- procedure Initialize_78 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_78; ------------------- -- Initialize_79 -- ------------------- procedure Initialize_79 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_79; ------------------- -- Initialize_80 -- ------------------- procedure Initialize_80 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_80; ------------------- -- Initialize_81 -- ------------------- procedure Initialize_81 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_81; ------------------- -- Initialize_82 -- ------------------- procedure Initialize_82 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_82; ------------------- -- Initialize_83 -- ------------------- procedure Initialize_83 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_83; ------------------- -- Initialize_84 -- ------------------- procedure Initialize_84 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_84; ------------------- -- Initialize_85 -- ------------------- procedure Initialize_85 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_85; ------------------- -- Initialize_86 -- ------------------- procedure Initialize_86 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_86; ------------------- -- Initialize_87 -- ------------------- procedure Initialize_87 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_87; ------------------- -- Initialize_88 -- ------------------- procedure Initialize_88 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_88; ------------------- -- Initialize_89 -- ------------------- procedure Initialize_89 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_89; ------------------- -- Initialize_90 -- ------------------- procedure Initialize_90 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_90; ------------------- -- Initialize_91 -- ------------------- procedure Initialize_91 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_91; ------------------- -- Initialize_92 -- ------------------- procedure Initialize_92 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_92; ------------------- -- Initialize_93 -- ------------------- procedure Initialize_93 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Comment; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_93; ------------------- -- Initialize_94 -- ------------------- procedure Initialize_94 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_94; ------------------- -- Initialize_95 -- ------------------- procedure Initialize_95 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_95; ------------------- -- Initialize_96 -- ------------------- procedure Initialize_96 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_96; ------------------- -- Initialize_97 -- ------------------- procedure Initialize_97 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_97; ------------------- -- Initialize_98 -- ------------------- procedure Initialize_98 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Tag; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_98; end AMF.Internals.Tables.DC_Metamodel.Objects;
dev/emm386/i286.asm
minblock/msdos
0
164850
<reponame>minblock/msdos .386p page 58,132 ;****************************************************************************** TITLE i286.asm - Support Routines for protected mode system ;****************************************************************************** ; ; (C) Copyright MICROSOFT Corp. 1986-1991 ; (C) Copyright COMPAQ Computer Corp. 1986-1991 ; ; Title: EMM386.EXE - MICROSOFT Expanded Memory Manager 386 Driver ; ; Module: i286.asm - Support Routines for protected mode system ; ; Version: 0.02 ; ; Date: January 31, 1986 ; ; Author: ; ;****************************************************************************** ; ; Change log: ; ; DATE REVISION DESCRIPTION ; -------- -------- ------------------------------------------------------- ; 01/31/86 Original ; 02/05/86 A added is286, is386 ; 05/12/86 B-RRH Cleanup and segment reorganization ; 06/03/86 C-SBP added push/pop es to Init_GDT and changed Ring 0 ; stack to STACK0 and STACK0_SIZE. ; 06/28/86 0.02 Name changed from CEMM386 to CEMM (SBP). ; 02/22/88 3.30 (*B) Added IsP9 routine to check for 80P9 processor (RDV). ; 07/13/88 3.31 (*C) Change IsP9 routine to Is386s and add Is386c (RDV). ; 08/19/88 3.31 (*C) Fix Is386s & Is386c to only set carry for non-386 (RDV). ; 01/15/89 4.00 (*D) Add generic password 8042 detect (RDV) ; ;****************************************************************************** ; ; Functional Description: ; ; <NAME> ; 26th Dec 1985 ; ; DESCRIPTION ; ; These routines manage the various 286 memory management ; tables and manipulate descriptors and selectors. ; ; The routines which deal with descriptors use the following ; register usage conventions: ; ; BX - selector of required descriptor. The selector may ; have RPL bits present, the routines ignore them. ; ; CX - SIZE IN BYTES of segment. NOTE: descriptors contain ; limits, not sizes (limit = size - 1). Since everyone ; else talks sizes, these routines do too, and do their ; own conversion. ; ; DX - second selector when needed ; ; AH - access rights byte ; ; AL, DX - 24 bit physical address ; ; ES:0 - pointer to the desired descriptor table. ; ; All the routines which manipulate descriptors are callable ; in both real and protected mode. ; ; In general all registers are preserved. ; ; The following routines are provided: ; ; SetDescInfo - set descriptor information ; SetSegDesc - set segment descriptor information ; ; SegTo24 - convert segment number to 24 bit addr ; SegOffTo24 - convert seg:offset to 24 bit addr ; ; InitGdt - set up parts of GDT which cannot easily ; be initialised statically. ; ; WARNING This code is 286 specific, it will NOT run on an 8088. ; ;****************************************************************************** .lfcond ; list false conditionals include VDMseg.inc include VDMsel.inc include desc.inc ;****************************************************************************** ; E X T E R N A L R E F E R E N C E S ;****************************************************************************** GDT segment extrn GDTLEN:abs GDT ends IDT segment extrn IDTLEN:abs IDT ends LAST SEGMENT assume cs:LAST ;** SetDescInfo - set descriptor information ; ; The limit field of a specified descriptor is set. ; (limit = size - 1). ; The base address of the specified descriptor is set. ; The access field of the specified descriptor is set. ; ; ENTRY BX = selector ; ES:0 = descriptor table to use ; CX = limit ; AL, DX = 24 bit base address ; AH = access rights byte ; EXIT None ; USES Flags, other regs preserved ; ; WARNING This code only works on a 286. It can be called in ; either mode. public SetDescInfo SetDescInfo proc near push bx ; save selector and bl,SEL_LOW_MASK ; fill in the limit field mov es:[bx],cx ; fill in base address mov es:[bx + 2],dx mov es:[bx + 4],al ; fill in access rights byte mov es:[bx + 5],ah pop bx ret SetDescInfo endp ;** SetSegDesc - set segment descriptor information ; ; The limit field of a specified descriptor is set. ; (limit = size - 1). ; The base address of the specified descriptor is set. ; The access field of the specified descriptor is set. ; ; ENTRY BX = selector ; ES:0 = descriptor table to use ; CX = size ; AL, DX = 24 bit base address ; AH = access rights byte ; EXIT None ; USES Flags, other regs preserved ; ; WARNING This code only works on a 286. It can be called in ; either mode. public SetSegDesc SetSegDesc proc near dec cx ; convert size to limit call SetDescInfo ; set descriptor information inc cx ; restore size ret SetSegDesc endp ;** SegTo24 - convert segment to 24 bit physical address ; ; The real mode segment number is convert to a 24 bit addr ; ; ENTRY AX = segment ; EXIT AL, DX = 24 bit physical address ; USES AH, Flags, other regs preserved ; ; WARNING This code only works on a 286, it can be called in ; either mode. public SegTo24 SegTo24 proc near mov dl,ah shr dl,4 ; DH = high byte of 24 bit addr xchg ax,dx ; AH = high byte, DX = segment shl dx,4 ; DX = low word of 24 bit addr ret SegTo24 endp ;** SegOffTo24 - convert seg:off to 24 bit physical address ; ; The specified real mode segment:offset is converted to ; a 24 bit physical address. ; ; ENTRY AX = segment ; DX = offset ; EXIT AL, DX = 24 bit physical address ; USES AH, Flags, other regs preserved. ; ; WARNING This code only works on a 286. It can be called in ; either mode. public SegOffTo24 SegOffTo24 proc near push cx ; Convert AX:DX into 24 bit addr in AL, DX mov ch,ah shl ax,4 shr ch,4 ; CH = high byte add dx,ax ; DX = low word mov al,ch ; AL = high byte adc al,0 ; propagate cy from low word pop cx ret SegOffTo24 endp ;****************************************************************************** ; Is386 - return type of processor (386 vs. 8088/86/286). ; This routine relies on Intel-approved code that takes advantage ; of the documented behavior of the high nibble of the flag word ; in the REAL MODE of the various processors. The MSB (bit 15) ; is always a one on the 8086 and 8088 and a zero on the 286 and ; 386. Bit 14 (NT flag) and bits 13/12 (IOPL bit field) are ; always zero on the 286, but can be set on the 386. ; ; For future compatibility of this test, it is strongly recommended ; that this specific instruction sequence be used. The exit codes ; can of course be changed to fit a particular need. ; ; CALLABLE FROM REAL MODE ONLY - FAR ROUTINE ; ; ENTRY: (none) ; EXIT: STC if 8088/86/286 ; CLC if 386 ; USED: none ; STACK: 6 bytes ;------------------------------------------------------------------------------ public Is386 Is386 proc FAR push ax pushf ; save entry flags ; xor ax,ax ; 0000 into AX push ax popf ; try to put that in the flags pushf pop ax ; look at what really went into flags test ax,08000h ;Q: was high bit set ? jnz short IsNot386_exit ; Y: 8086/8088 mov ax,07000h ; N: try to set the NT/IOPL bits push ax popf ; ... in the flags pushf pop ax ; look at actual flags test ax,07000h ; Q: any high bits set ? jz short IsNot386_exit ; N: 80286 ; Y: 80386 Is386_exit: popf ; restore flags clc ; 386 jmp short I386_exit ; and leave IsNot386_exit: popf ; restore flags stc ; not a 386 I386_exit: pop ax ret ; *** RETURN *** Is386 endp ;*****************************************************************************C ; Is386s - returns equal if Taurus. (Original code name for 386s) *C ; This routine relies on the "COMPAQ 386" ID in the ROM and then *C ; checks the ROM family code for the Taurus system ('F'). *C ; ENTRY: (none) *C ; EXIT: ZF = 1 if Taurus (equal) *C ; ZF = 0 if not (not equal) *C ; CY set if ROM image not COMPAQ 386 *C ;----------------------------------------------------------------------------*C public Is386s ; *C Is386s proc FAR ; check for Taurus *C push ax push bx ; *C push es ; *C mov bx,0F000h ; ROM segment *C mov es,bx ; *C stc ; set carry *C cmp word ptr es:[0FFE9h],'C3' ; COMPAQ 386 ROM? *C jne short exit386s ; nope *C clc ; clear carry *C cmp byte ptr es:[0FFE4h],'F';Q: is it Taurus ROM? *C je short exit386s cmp byte ptr es:[0FFE4h],'R';Q: is it CARRERA ROM? je short exit386s cmp byte ptr es:[0FFE4h],'D';Q: is it EAGLE ROM? je short exit386s cmp byte ptr es:[0FFE4h],'B';Q: is it a TITAN je short exit386s ; ; For future CPQ machines, checks for a 386s processor via CMOS ; call chk_cmos ; check CMOS cmp ax,0 ;Q: Valid CMOS? jne short exit386s ; N: assume not a 386s mov al,24h call R_CMOS ; read byte 24 of CMOS shr ax,4 ; get CPU type in low 3 bits and ax,0111b ; clear all but low oder 3 bits cmp ax,0101b ;Q: Is this a 386sx processor? ; Y: indicate via ZF ; N: indicate via NZ exit386s:pop es ; *C pop bx pop ax ret ; *** RETURN *** *C Is386s endp ; *C ;*****************************************************************************D ; IsP8042 - returns equal if password 8042. *D ; ENTRY: (none) *D ; EXIT: ZF = 1 if 8042 (equal) *D ; ZF = 0 if not (not equal) *D ;----------------------------------------------------------------------------*D public IsP8042 ; *D IsP8042 proc FAR PUSH AX CLI CALL test_8042_type STI OR AX, AX POP AX RET IsP8042 endp ; *D ;**************************************************************************** ; The following code for detecting password 8042's is from the KP utility ;**************************************************************************** ;*** Begin 8042.EQU and KP.EQU BAD_CHAR equ 042h BIG_WAIT equ 0ffffh COMMAND_REG_8042 equ 064h DATA_REG_8042 equ 060h ; 8042 IBUF & OBUF must be empty*/ GET_D_TO equ -4 ; get data time out IBUF_FULL_8042 equ 002h ; must be 0 before sending data STATUS_REG_8042 equ 064h OBUF_FULL_8042 equ 001h ; must be 0 before sending data WRITE_KBD_OBUF equ 0d2h ;*** End 8042.EQU and KP.EQU ;********************************************************************* ; test_8042_type - Determine the type of 8042 in this machine. ; ; Function Prototype: ; extern int far pascal test_8042_type( void ); ; ; ENTRY: None. ; EXIT: Returns AX=0 (8042 of TEXAS/HORIZON/PS2) ; AX<>0 (see 8042.equ and 8042.h) ; USED: ; STACK: ;--------------------------------------------------------------------- PUBLIC test_8042_type test_8042_type PROC mov al, WRITE_KBD_OBUF ; determine whether this is TEXAS or call send_8042_cmd ; ZEBRA hardware by sending a new ; 8042 command and ax, ax ; Q: send successful JZ SHORT t_8_t_3 mov al, BAD_CHAR ; this character should be echoed call send_8042_data ; when read and ax, ax ; Q: send successful JZ SHORT t_8_t_3 call get_8042_data ; was the bad character echoed cmp ax, BAD_CHAR ; Q: echo je SHORT t_8_t_3 ; Y: continue mov ax, -1 ; return bad h/w error code ret ; *** Return *** t_8_t_3: xor ax, ax ; ZERO -> success ret ; *** Return *** test_8042_type ENDP ;********************************************************************* ; send_8042_cmd - send a command to the 8042. Waits for the ; input & output buffers to be empty. ; ; Not callable by 'C'. Internal function used by IOPL ; subroutines. ; ; ENTRY: AL - contains the command ; EXIT: AX = 0 command unsuccessfully sent ; AX <> 0 command successfully sent ; USED: ; STACK: ;--------------------------------------------------------------------- send_8042_cmd PROC NEAR push bx push ax ; save the command call wait_for_iobuf_empty ; wait for in & out buffers to empty pop bx ; restore the command and ax, ax ; Q: wait fail jz SHORT s_8_c_ret ; Y: don't output xchg ax, bx ; move command into AX out COMMAND_REG_8042, al mov al, 1 ; data sent successfully s_8_c_ret: pop bx ret ; *** Return *** send_8042_cmd ENDP ;********************************************************************* ; send_8042_data - send data to the 8042. Waits for the ; input & output buffers to be empty. ; ; Not callable by 'C'. Internal function used by IOPL ; subroutines. ; ; ENTRY: AL - contains the data ; EXIT: AX = 0 data unsuccessfully sent ; AX <> 0 data successfully sent ; USED: ; STACK: ;--------------------------------------------------------------------- send_8042_data PROC NEAR push bx push ax ; save the data call wait_for_iobuf_empty ; wait for in & out buffers to empty pop bx ; restore the data and ax, ax ; Q: wait fail je SHORT s_8_d_ret ; Y: don't send data xchg ax, bx ; move the data into AX out DATA_REG_8042, al mov al, 1 ; data sent successfully s_8_d_ret: pop bx ret ; *** Return *** send_8042_data ENDP ;********************************************************************* ; get_8042_data - get data from the 8042. Waits for the ; output buffer to be full. ; ; Not callable by 'C'. Internal function used by IOPL ; subroutines. ; ; ENTRY: ; EXIT: AX >= 0 contains the data, AX < 0 failure. ; USED: ; STACK: ;--------------------------------------------------------------------- get_8042_data PROC NEAR call wait_for_obuf_full ; wait for data to read and ax, ax ; did the wait "time out" jz SHORT g_8_d_f ; jump if so in al, DATA_REG_8042 ; get the data xor ah, ah ; remove hi-byte ret ; *** Return *** g_8_d_f: mov ax, GET_D_TO ; error return code ret ; *** Return *** get_8042_data ENDP ;********************************************************************* ; wait_for_obuf_full - Wait for the 8042's output buffer to become ; 'full'. ; ; Not callable by 'C'. Internal function used by IOPL ; subroutines. ; ; ENTRY: ; EXIT: AX = 0 obuf never became full ; AX <> 0 obuf is full ; USED: AX, CX ; STACK: ;--------------------------------------------------------------------- wait_for_obuf_full PROC NEAR push cx mov cx, BIG_WAIT ; store a 'wait' value loop_ofull_01: in al, STATUS_REG_8042 ; get the 8042 status test al, OBUF_FULL_8042 ; Q: Output buffer full loopz loop_ofull_01 ; keep looping until obuf is full xchg ax, cx ; use count as return code pop cx ret ; *** Return *** wait_for_obuf_full ENDP ;********************************************************************* ; wait_for_iobuf_empty - Wait for the 8042's input and output ; buffer to become 'empty'. ; ; Not callable by 'C'. Internal function used by IOPL ; subroutines. ; ; ENTRY: ; EXIT: AX = 0 ibuf & obuf never became empty ; AX <> 0 ibuf & obuf are empty ; USED: AX, CX ; STACK: ;--------------------------------------------------------------------- wait_for_iobuf_empty PROC NEAR push cx mov cx, BIG_WAIT ; store a 'wait' value loop_iompte_01: in al, STATUS_REG_8042 ; get the 8042 status ; Q: Input & Output buffer full test al, (IBUF_FULL_8042 OR OBUF_FULL_8042) loopnz loop_iompte_01 ; Y: keep looping until ibuf&obuf empty xchg ax, cx ; use count as return code pop cx ret ; *** Return *** wait_for_iobuf_empty ENDP ;/***************************************************************************** ; ; Synopsis : state = chk_cmos() ; int state; CMOS invalid configuration bit ; ; Description : Check CMOS invalid configuration bit. ; ; Returns : CMOS invalid configuration bit. ; 0 - CMOS configuration OK. ; !0 - CMOS configuration invalid. ; or CMOS checksum bad ; Alters : AX ; ; History : <NAME> 04/01/1988 ; ;*****************************************************************************/ public chk_cmos chk_cmos proc near mov al,0EH ; read CMOS diagnostics port call r_cmos ; get CMOS byte 0EH and ax,0000000001010000B ; Is CMOS good ? ret chk_cmos endp page ;****************************************************************************** ; ; R_CMOS - Read a byte from cmos RAM ; ; Entry: al = cmos byte to read ; ; Exit: al = value of cmos byte read ; ; Regs: None ; ;****************************************************************************** public r_cmos r_cmos proc near out 70h, al jmp $+2 jmp $+2 in al, 71h ret ; *** Return *** r_cmos endp page ;****************************************************************************** ; ; W_CMOS - Write a byte to cmos RAM ; ; Entry: al = cmos byte to write ; ah = value to write ; ; Exit: None ; ; Regs: ax ; ;****************************************************************************** public w_cmos w_cmos proc near out 70h, al jmp $+2 jmp $+2 mov al, ah out 71h, al ret ; *** Return *** w_cmos endp CMOS_CHK_HIGH equ 2Eh CMOS_CHK_LOW equ 2Fh page ;****************************************************************************** ; W_CMOS_CHECKSUM -- update the CMOS Checksum ; ; Read system configuration from CMOS (if CMOS valid) ; This logic reads system configuration values from CMOS ; and verifies that the corresponding checksum is correct. ; ; Entry: none ; Exit: none ; Registers changed: none ;****************************************************************************** public w_cmos_checksum w_cmos_checksum proc near push ax ; save registers push bx ; ... push cx ; ... push dx ; ... mov ah, 10h ; Start with byte 10H. mov cx, 1Eh ; Reads this many bytes. xor bx, bx ; Init checksum value. xor dx, dx ; chk_1: mov al, ah ; Which byte to read. call r_cmos ; Read cmos byte mov dl, al ; add bx, dx ; Add value to checksum inc ah ; Point to next byte in CMOS. loop chk_1 ; Loop until all bytes read. ; Write high byte of checksum. chk_2: mov al, CMOS_CHK_HIGH mov ah, bh ; Checksum (Hi) call w_cmos ; write cmos byte ; Write low byte of checksum. mov al, CMOS_CHK_LOW mov ah, bl ; Checksum (Lo) call w_cmos ; write cmos byte pop dx ; restore registers pop cx ; ... pop bx ; ... pop ax ; ... ret w_cmos_checksum endp LAST ends end 
awa/plugins/awa-mail/src/awa-mail-components-messages.ads
fuzzysloth/ada-awa
0
19695
<reponame>fuzzysloth/ada-awa ----------------------------------------------------------------------- -- awa-mail-components-recipients -- Mail UI Recipients -- Copyright (C) 2012 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Contexts.Faces; -- === Mail Messages === -- The <b>AWA.Mail.Components.Messages</b> package defines the UI components -- to represent the email message with its recipients, subject and body. -- -- The mail message is retrieved by looking at the parent UI component until a -- <tt>UIMailMessage</tt> component is found. The mail message recipients are initialized -- during the render response JSF phase, that is when <tt>Encode_End</tt> are called. package AWA.Mail.Components.Messages is -- ------------------------------ -- The mail recipient -- ------------------------------ type UIMailMessage is new UIMailComponent with private; type UIMailMessage_Access is access all UIMailMessage'Class; -- Set the mail message instance. procedure Set_Message (UI : in out UIMailMessage; Message : in AWA.Mail.Clients.Mail_Message_Access); -- Get the mail message instance. overriding function Get_Message (UI : in UIMailMessage) return AWA.Mail.Clients.Mail_Message_Access; -- Send the mail. overriding procedure Encode_End (UI : in UIMailMessage; Context : in out ASF.Contexts.Faces.Faces_Context'Class); -- Finalize and release the mail message. overriding procedure Finalize (UI : in out UIMailMessage); -- ------------------------------ -- The mail subject -- ------------------------------ type UIMailSubject is new UIMailComponent with private; -- Render the mail subject and initializes the message with its content. overriding procedure Encode_Children (UI : in UIMailSubject; Context : in out ASF.Contexts.Faces.Faces_Context'Class); -- ------------------------------ -- The mail body -- ------------------------------ type UIMailBody is new UIMailComponent with private; -- Render the mail body and initializes the message with its content. overriding procedure Encode_Children (UI : in UIMailBody; Context : in out ASF.Contexts.Faces.Faces_Context'Class); private type UIMailMessage is new UIMailComponent with record Message : AWA.Mail.Clients.Mail_Message_Access; end record; type UIMailBody is new UIMailComponent with null record; type UIMailSubject is new UIMailComponent with null record; end AWA.Mail.Components.Messages;
boot/bootloader.asm
MahmoudYounes/BeOS
0
7627
;=================================================================== ; BeOS BootLoader Code ; ==================== ; ; boot code to boot the kernel from iso 9660 compliant CD ; works on 8086 architecture, 32 bits, single CPU ; boot sector size is 2kb ~ 2048 bytes ;=================================================================== ; TODO: make more explicit error messages ; TODO: discover memory layout [BITS 16] [ORG 0x7C00] jmp _start global _start _start: ; setting up segments and offsets cli xor ax, ax mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax mov sp, 0xffff sti ; far jmp to make sure that cs and ip are the correct values ; 5 = 1 opcode + 2 segment + 2 offset jmp 0h:$ + 5 ; preserving boot drive number mov BYTE[BootDrive], dl ; print loading msg mov si, BootLoadingMsg call func_biosPrintf ; resetting boot drive mov dl, [BootDrive] call func_ResetDisk ; TODO: Check if int 13h extension methods 40h-48h exist and supported by BIOS. if not bootFailure ; ; reading primary volume descriptor to locate the kernel files ; first 32kb (16 sectors) are empty start at sector 16 mov eax, 100h mov es, eax xor edi, edi call func_ReadPrimaryVolumeDescriptor ; search for kernel file mov eax, 100h mov es, eax xor edi, edi call func_LocateKernelImage call func_LoadKernel call func_EnableA20 call func_PrepareGDT call func_EnableProtectedModeAndJmpKernel cli hlt bootFailure: mov si, BootFailureMsg call func_biosPrintf bootloaderEnd: cli hlt %include "./screen.asm" %include "./isoUtilities.asm" %include "./kernelLoad.asm" %include "./enableA20.asm" %include "./gdt.asm" %include "./protectedMode.asm" ; boot loader data BootDrive: db 0 BootFailureMsg: db "Booting sequence failed", 0 BootLoadingMsg: db "loading BeOS...", 0 BytesPerSector: dw 0 ; kernel info KernelName: db "KERNEL.IMG", 0x3b, 0x31 KernelLBA: dd 0 KernelLength: dd 0 ; gdtr gdtData: dd 0x0000 dd 0x0000 ; ;Code Descriptor dw 0xFFFF ;Limit (Low) dw 0x0000 ;Base (Low) DB 0x00 ;Base (Middle) DB 10011010b ;Access DB 11001111b ;Granularity DB 0x00 ;Base (High) ; ;Data Descriptor dw 0xFFFF ;Limit (Low) dw 0x0000 ;Base (Low) DB 0x00 ;Base (Middle) DB 10010010b ;Access DB 11001111b ;Granularity DB 0x00 ;Base (High) gdtEnd: GDT: dw gdtEnd - gdtData - 1 ;GDT Size - 1 dd gdtData ;Base Of GDT ; DAP buffer DAP: db 10h ; DAP size (disk address packet) db 0 ; unused dapNumSectors: dw 0 ; num sectors dapBufferOffset: dw 0 ; offset for buffer dapBufferSegment: dw 0 ; segment for buffer dapSectorNumL: dd 0 ; absolute sector number low dapSectorNumH: dd 0 ; absolute sector number high ; screen state currentCursorPosition: db 0 ; the current position of the cursor state whiteOnBlackConst: equ 0x0f ; const added to video memory rowsLimit: equ 80 colsLimit: equ 25 TIMES 2046-($-$$) db 0 dw 0xaa55
specs/ada/common/tkmrpc-results.ads
DrenfongWong/tkm-rpc
0
16420
<reponame>DrenfongWong/tkm-rpc<filename>specs/ada/common/tkmrpc-results.ads with Interfaces; package Tkmrpc.Results is type Result_Type is new Interfaces.Unsigned_64; Ok : constant Result_Type := 16#0000000000000000#; Invalid_Operation : constant Result_Type := 16#0000000000000101#; Invalid_Id : constant Result_Type := 16#0000000000000102#; Invalid_State : constant Result_Type := 16#0000000000000103#; Invalid_Parameter : constant Result_Type := 16#0000000000000104#; Random_Failure : constant Result_Type := 16#0000000000000201#; Sign_Failure : constant Result_Type := 16#0000000000000202#; Aborted : constant Result_Type := 16#0000000000000301#; Math_Error : constant Result_Type := 16#0000000000000401#; end Tkmrpc.Results;
libsrc/_DEVELOPMENT/arch/cpm/c/sdcc_iy/cpm_get_offset.asm
jpoikela/z88dk
640
93099
; unsigned long cpm_get_offset(void *p) SECTION code_clib SECTION code_arch PUBLIC _cpm_get_offset EXTERN asm_cpm_get_offset _cpm_get_offset: pop af pop hl push hl push af jp asm_cpm_get_offset
alloy4fun_models/trainstlt/models/5/XNGLNgjWPynrGFGEh.als
Kaixi26/org.alloytools.alloy
0
1398
<filename>alloy4fun_models/trainstlt/models/5/XNGLNgjWPynrGFGEh.als open main pred idXNGLNgjWPynrGFGEh_prop6 { always Signal != Signal' } pred __repair { idXNGLNgjWPynrGFGEh_prop6 } check __repair { idXNGLNgjWPynrGFGEh_prop6 <=> prop6o }
1-base/math/applet/demo/geometry/launch_basic_geometry_demo.adb
charlie5/lace
20
20986
with float_Math.Geometry.d3.Modeller.Forge, ada.text_IO; procedure launch_basic_geometry_Demo -- -- A simple demonstration of the geometry packages. -- is package Math renames float_Math; use Math, math.Geometry, math.Geometry.d3.Modeller; procedure log (Message : in String) renames ada.text_IO.put_Line; the_Modeller : d3.Modeller.item; begin declare use float_math.Geometry.d3, float_math.Geometry.d3.Modeller.Forge; the_Model : float_math.Geometry.d3.a_Model := to_box_Model; begin log ("Box Model: " & Image (the_Model)); end; declare use float_math.Geometry.d3, float_math.Geometry.d3.Modeller.Forge; the_Model : float_math.Geometry.d3.a_Model := to_capsule_Model; begin log ("Capsule Model: " & Image (the_Model)); end; end launch_basic_geometry_Demo;
programs/oeis/186/A186444.asm
neoneye/loda
22
1338
; A186444: The count of numbers <= n for which 3 is an infinitary divisor. ; 0,0,1,1,1,2,2,2,2,2,2,3,3,3,4,4,4,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,9,9,9,9,9,9,10,10,10,11,11,11,11,11,11,12,12,12,13,13,13,14,14,14,15,15,15,16,16,16,16,16,16,17,17,17,18,18,18,18,18,18,19,19,19,20,20,20,20,20,20,21,21,21,22,22,22,22,22,22,23,23,23,24,24,24,24,24 add $0,1 mov $2,$0 lpb $0 lpb $2,4 cmp $3,0 mov $6,$0 mov $0,$2 sub $0,$6 div $2,3 lpe lpe
programs/oeis/025/A025528.asm
neoneye/loda
22
241371
<reponame>neoneye/loda ; A025528: Number of prime powers <= n with exponents > 0 (A246655). ; 0,1,2,3,4,4,5,6,7,7,8,8,9,9,9,10,11,11,12,12,12,12,13,13,14,14,15,15,16,16,17,18,18,18,18,18,19,19,19,19,20,20,21,21,21,21,22,22,23,23,23,23,24,24,24,24,24,24,25,25,26,26,26,27,27,27,28,28,28,28,29,29,30,30,30,30,30,30,31,31,32,32,33,33,33,33,33,33,34,34,34,34,34,34,34,34,35,35,35,35 mov $2,$0 mov $3,$0 add $3,1 lpb $3 mov $0,$2 sub $3,1 sub $0,$3 seq $0,10055 ; 1 if n is a prime power p^k (k >= 0), otherwise 0. add $1,$0 lpe sub $1,1 mov $0,$1
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/g-sehamd.adb
orb-zhuchen/Orb
0
21176
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . S E C U R E _ H A S H E S . M D 5 -- -- -- -- B o d y -- -- -- -- Copyright (C) 2002-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with GNAT.Byte_Swapping; use GNAT.Byte_Swapping; package body GNAT.Secure_Hashes.MD5 is use Interfaces; -- The sixteen values used to rotate the context words. Four for each -- rounds. Used in procedure Transform. -- Round 1 S11 : constant := 7; S12 : constant := 12; S13 : constant := 17; S14 : constant := 22; -- Round 2 S21 : constant := 5; S22 : constant := 9; S23 : constant := 14; S24 : constant := 20; -- Round 3 S31 : constant := 4; S32 : constant := 11; S33 : constant := 16; S34 : constant := 23; -- Round 4 S41 : constant := 6; S42 : constant := 10; S43 : constant := 15; S44 : constant := 21; -- The following functions (F, FF, G, GG, H, HH, I and II) are the -- equivalent of the macros of the same name in the example C -- implementation in the annex of RFC 1321. function F (X, Y, Z : Unsigned_32) return Unsigned_32; pragma Inline (F); procedure FF (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive); pragma Inline (FF); function G (X, Y, Z : Unsigned_32) return Unsigned_32; pragma Inline (G); procedure GG (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive); pragma Inline (GG); function H (X, Y, Z : Unsigned_32) return Unsigned_32; pragma Inline (H); procedure HH (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive); pragma Inline (HH); function I (X, Y, Z : Unsigned_32) return Unsigned_32; pragma Inline (I); procedure II (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive); pragma Inline (II); ------- -- F -- ------- function F (X, Y, Z : Unsigned_32) return Unsigned_32 is begin return (X and Y) or ((not X) and Z); end F; -------- -- FF -- -------- procedure FF (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive) is begin A := A + F (B, C, D) + X + AC; A := Rotate_Left (A, S); A := A + B; end FF; ------- -- G -- ------- function G (X, Y, Z : Unsigned_32) return Unsigned_32 is begin return (X and Z) or (Y and (not Z)); end G; -------- -- GG -- -------- procedure GG (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive) is begin A := A + G (B, C, D) + X + AC; A := Rotate_Left (A, S); A := A + B; end GG; ------- -- H -- ------- function H (X, Y, Z : Unsigned_32) return Unsigned_32 is begin return X xor Y xor Z; end H; -------- -- HH -- -------- procedure HH (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive) is begin A := A + H (B, C, D) + X + AC; A := Rotate_Left (A, S); A := A + B; end HH; ------- -- I -- ------- function I (X, Y, Z : Unsigned_32) return Unsigned_32 is begin return Y xor (X or (not Z)); end I; -------- -- II -- -------- procedure II (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive) is begin A := A + I (B, C, D) + X + AC; A := Rotate_Left (A, S); A := A + B; end II; --------------- -- Transform -- --------------- procedure Transform (H : in out Hash_State.State; M : in out Message_State) is use System; X : array (0 .. 15) of Interfaces.Unsigned_32; for X'Address use M.Buffer'Address; pragma Import (Ada, X); AA : Unsigned_32 := H (0); BB : Unsigned_32 := H (1); CC : Unsigned_32 := H (2); DD : Unsigned_32 := H (3); begin if Default_Bit_Order /= Low_Order_First then for J in X'Range loop Swap4 (X (J)'Address); end loop; end if; -- Round 1 FF (AA, BB, CC, DD, X (00), 16#D76aa478#, S11); -- 1 FF (DD, AA, BB, CC, X (01), 16#E8c7b756#, S12); -- 2 FF (CC, DD, AA, BB, X (02), 16#242070db#, S13); -- 3 FF (BB, CC, DD, AA, X (03), 16#C1bdceee#, S14); -- 4 FF (AA, BB, CC, DD, X (04), 16#f57c0faf#, S11); -- 5 FF (DD, AA, BB, CC, X (05), 16#4787c62a#, S12); -- 6 FF (CC, DD, AA, BB, X (06), 16#a8304613#, S13); -- 7 FF (BB, CC, DD, AA, X (07), 16#fd469501#, S14); -- 8 FF (AA, BB, CC, DD, X (08), 16#698098d8#, S11); -- 9 FF (DD, AA, BB, CC, X (09), 16#8b44f7af#, S12); -- 10 FF (CC, DD, AA, BB, X (10), 16#ffff5bb1#, S13); -- 11 FF (BB, CC, DD, AA, X (11), 16#895cd7be#, S14); -- 12 FF (AA, BB, CC, DD, X (12), 16#6b901122#, S11); -- 13 FF (DD, AA, BB, CC, X (13), 16#fd987193#, S12); -- 14 FF (CC, DD, AA, BB, X (14), 16#a679438e#, S13); -- 15 FF (BB, CC, DD, AA, X (15), 16#49b40821#, S14); -- 16 -- Round 2 GG (AA, BB, CC, DD, X (01), 16#f61e2562#, S21); -- 17 GG (DD, AA, BB, CC, X (06), 16#c040b340#, S22); -- 18 GG (CC, DD, AA, BB, X (11), 16#265e5a51#, S23); -- 19 GG (BB, CC, DD, AA, X (00), 16#e9b6c7aa#, S24); -- 20 GG (AA, BB, CC, DD, X (05), 16#d62f105d#, S21); -- 21 GG (DD, AA, BB, CC, X (10), 16#02441453#, S22); -- 22 GG (CC, DD, AA, BB, X (15), 16#d8a1e681#, S23); -- 23 GG (BB, CC, DD, AA, X (04), 16#e7d3fbc8#, S24); -- 24 GG (AA, BB, CC, DD, X (09), 16#21e1cde6#, S21); -- 25 GG (DD, AA, BB, CC, X (14), 16#c33707d6#, S22); -- 26 GG (CC, DD, AA, BB, X (03), 16#f4d50d87#, S23); -- 27 GG (BB, CC, DD, AA, X (08), 16#455a14ed#, S24); -- 28 GG (AA, BB, CC, DD, X (13), 16#a9e3e905#, S21); -- 29 GG (DD, AA, BB, CC, X (02), 16#fcefa3f8#, S22); -- 30 GG (CC, DD, AA, BB, X (07), 16#676f02d9#, S23); -- 31 GG (BB, CC, DD, AA, X (12), 16#8d2a4c8a#, S24); -- 32 -- Round 3 HH (AA, BB, CC, DD, X (05), 16#fffa3942#, S31); -- 33 HH (DD, AA, BB, CC, X (08), 16#8771f681#, S32); -- 34 HH (CC, DD, AA, BB, X (11), 16#6d9d6122#, S33); -- 35 HH (BB, CC, DD, AA, X (14), 16#fde5380c#, S34); -- 36 HH (AA, BB, CC, DD, X (01), 16#a4beea44#, S31); -- 37 HH (DD, AA, BB, CC, X (04), 16#4bdecfa9#, S32); -- 38 HH (CC, DD, AA, BB, X (07), 16#f6bb4b60#, S33); -- 39 HH (BB, CC, DD, AA, X (10), 16#bebfbc70#, S34); -- 40 HH (AA, BB, CC, DD, X (13), 16#289b7ec6#, S31); -- 41 HH (DD, AA, BB, CC, X (00), 16#eaa127fa#, S32); -- 42 HH (CC, DD, AA, BB, X (03), 16#d4ef3085#, S33); -- 43 HH (BB, CC, DD, AA, X (06), 16#04881d05#, S34); -- 44 HH (AA, BB, CC, DD, X (09), 16#d9d4d039#, S31); -- 45 HH (DD, AA, BB, CC, X (12), 16#e6db99e5#, S32); -- 46 HH (CC, DD, AA, BB, X (15), 16#1fa27cf8#, S33); -- 47 HH (BB, CC, DD, AA, X (02), 16#c4ac5665#, S34); -- 48 -- Round 4 II (AA, BB, CC, DD, X (00), 16#f4292244#, S41); -- 49 II (DD, AA, BB, CC, X (07), 16#432aff97#, S42); -- 50 II (CC, DD, AA, BB, X (14), 16#ab9423a7#, S43); -- 51 II (BB, CC, DD, AA, X (05), 16#fc93a039#, S44); -- 52 II (AA, BB, CC, DD, X (12), 16#655b59c3#, S41); -- 53 II (DD, AA, BB, CC, X (03), 16#8f0ccc92#, S42); -- 54 II (CC, DD, AA, BB, X (10), 16#ffeff47d#, S43); -- 55 II (BB, CC, DD, AA, X (01), 16#85845dd1#, S44); -- 56 II (AA, BB, CC, DD, X (08), 16#6fa87e4f#, S41); -- 57 II (DD, AA, BB, CC, X (15), 16#fe2ce6e0#, S42); -- 58 II (CC, DD, AA, BB, X (06), 16#a3014314#, S43); -- 59 II (BB, CC, DD, AA, X (13), 16#4e0811a1#, S44); -- 60 II (AA, BB, CC, DD, X (04), 16#f7537e82#, S41); -- 61 II (DD, AA, BB, CC, X (11), 16#bd3af235#, S42); -- 62 II (CC, DD, AA, BB, X (02), 16#2ad7d2bb#, S43); -- 63 II (BB, CC, DD, AA, X (09), 16#eb86d391#, S44); -- 64 H (0) := H (0) + AA; H (1) := H (1) + BB; H (2) := H (2) + CC; H (3) := H (3) + DD; end Transform; end GNAT.Secure_Hashes.MD5;
libsrc/stdio/spectrum/getk.asm
meesokim/z88dk
0
21984
; ; Devilishly simple Spectrum Routines ; ; getk() Read key status ; ; 17/5/99 djm ; ; ; $Id: getk.asm,v 1.4 2015/01/19 01:33:21 pauloscustodio Exp $ ; PUBLIC getk .getk ld h,0 ld a,(23560) ld l,a and a ret z xor a ld (23560),a ret
query-compiler/src/main/antlr4/io/wizzie/enricher/query/compiler/EnricherQLLexer.g4
jnebrera/enricher
1
6094
lexer grammar EnricherQLLexer; // SKIP WS: [ \r\n\t]+ -> skip; // Keywords BY: 'BY'; ENRICH: 'ENRICH'; FROM: 'FROM'; GLOBAL: 'GLOBAL'; INSERT: 'INSERT'; INTO: 'INTO'; JOIN: 'JOIN'; PARTITION: 'PARTITION'; SELECT: 'SELECT'; STREAM: 'STREAM'; TABLE: 'TABLE'; USING: 'USING'; WITH: 'WITH'; // Identifier ID: ID_LITERAL; STAR: '*'; COMMA: ','; fragment ID_LITERAL : [a-z_A-Z] ([a-zA-Z0-9]|HYPHEN|UNDERSCORE)*; fragment HYPHEN: '-'; fragment UNDERSCORE: '_';
Numeral/Integer/Function.agda
Lolirofle/stuff-in-agda
6
6090
module Numeral.Integer.Function where open import Numeral.Integer open import Numeral.Integer.Oper open import Numeral.Natural as ℕ using (ℕ)
src/fx/starfield.asm
bitshifters/teletextr
8
25092
; quick & dirty starfield ; copied from Kieran's mode7-sprites cracktro wip .start_fx_starfield STARFIELD_shadow_addr = MODE7_VRAM_SHADOW STARFIELD_ERASE_STARS = FALSE ; FALSE if erasing screen anyway STARFIELD_top_row = 1 ; omit Ceefax header STARFIELD_left_column = 1 ; needs to be 4 if req background colour STARFIELD_num_stars = 24 ; also number of rows STARFIELD_right_edge = (MODE7_char_width - STARFIELD_left_column) * 2 STARFIELD_start_addr = STARFIELD_shadow_addr + (STARFIELD_top_row * MODE7_char_width) + STARFIELD_left_column \ ****************************************************************** \ * Starfield FX \ ****************************************************************** .fx_starfield_update { \\ Set graphics white lda #144+7 jsr mode7_set_graphics_shadow_fast \\ Set start address LDA #LO(STARFIELD_start_addr) STA writeptr LDA #HI(STARFIELD_start_addr) STA writeptr+1 LDX #0 .loop \\ Erase old star IF STARFIELD_ERASE_STARS LDA stars_table_byte,X CMP #32 BNE no_erase LDA stars_table_x,X LSR A:LSR A:TAY LDA #32 STA (writeptr),Y ENDIF .no_erase \\ Update star x position based on speed & wrap CLC LDA stars_table_x,X ADC stars_table_speed,X CMP #STARFIELD_right_edge*2 BCC no_wrap SBC #STARFIELD_right_edge*2 .no_wrap STA stars_table_x,X \\ Calculate x char LSR A:LSR A:TAY \\ Is there something there already? LDA (writeptr), Y IF STARFIELD_ERASE_STARS STA stars_table_byte,X ENDIF ; sm: screen is now cleared with zero, not 32 ;CMP #32 BNE skip_write \\ Plot our star LDA stars_table_x,X LSR A AND #&1 ; odd or even CLC ADC #33 ; 1 or 2 OR 32 STA (writeptr), Y ; reuses Y as x char from above .skip_write \\ Next star INX CPX #STARFIELD_num_stars BCS return \\ Next row CLC LDA writeptr ADC #MODE7_char_width STA writeptr BCC no_carry INC writeptr+1 .no_carry JMP loop .return RTS } \ ****************************************************************** \ * Look up tables \ ****************************************************************** .stars_table_x FOR n, 0, STARFIELD_num_stars, 1 EQUB RND(STARFIELD_right_edge * 2) NEXT .stars_table_speed FOR n, 0, STARFIELD_num_stars, 1 EQUB 1+RND(3) ; only 3 speeds NEXT IF STARFIELD_ERASE_STARS .stars_table_byte SKIP STARFIELD_num_stars ENDIF .end_fx_starfield
programs/oeis/157/A157948.asm
neoneye/loda
22
170018
; A157948: a(n) = 64*n^2 - n. ; 63,254,573,1020,1595,2298,3129,4088,5175,6390,7733,9204,10803,12530,14385,16368,18479,20718,23085,25580,28203,30954,33833,36840,39975,43238,46629,50148,53795,57570,61473,65504,69663,73950,78365,82908,87579,92378,97305,102360,107543,112854,118293,123860,129555,135378,141329,147408,153615,159950,166413,173004,179723,186570,193545,200648,207879,215238,222725,230340,238083,245954,253953,262080,270335,278718,287229,295868,304635,313530,322553,331704,340983,350390,359925,369588,379379,389298,399345,409520,419823,430254,440813,451500,462315,473258,484329,495528,506855,518310,529893,541604,553443,565410,577505,589728,602079,614558,627165,639900 add $0,1 mul $0,64 bin $0,2 div $0,32
libsrc/input/sc3000/in_keytranstbl.asm
jpoikela/z88dk
640
22739
<reponame>jpoikela/z88dk<gh_stars>100-1000 ; This table translates key presses into ascii codes. ; Also used by 'GetKey' and 'LookupKey'. An effort has been made for ; this key translation table to emulate a PC keyboard with the 'CTRL' key ; http://www43.tok2.com/home/cmpslv/Sc3000/EnrSC.htm SECTION rodata_clib PUBLIC in_keytranstbl .in_keytranstbl ; First 4 from port 0xdd, then 8 from 0xdc ; 84 bytes per table ;Unshifted defb 255, 255, 255, '8' ; -, -, -, 8 defb 'i', 'k', ',', 255, 'z', 'a', 'q', '1' ; I, K, ., ??, Z, A, Q, 1 defb 255, 255, 255, '9' ; -, -, -, 9 defb 'o', 'l', '.', ' ', 'x', 's', 'w', '2' ; O, L, ., SPACE, X, S, W, 2 defb 255, 255, 255, '0' ; -, -, -, 0 defb 'p', ';', '/', 255, 'c', 'd', 'e', '3' ; p, ;, /, HOME/CLR, C, D, E, 3 defb 255, 255, 255, '-' ; -, -, -, '-' defb '@', ':', 255, 12, 'v', 'f', 'r', '4' ; @, :, ??, INS/DEL, V, F, R, 4 defb 255, 255, 255, '^' ; -, -, -, ^ defb '[', ']', 10, 255, 'b', 'g', 't', '5' ; [, ], CURDOWN, -, b, g, t, 5 defb 255, 255, 255, '|' ; FUNC, -, -, | defb 255, 13, 8, 255, 'n', 'h', 'y', '6' ; -, CR, CURLEFT, -, N, H, Y, 6 defb 255, 255, 255, 255 ; SHIFT, CTRL, GRAPH, BREAK defb 255, 11, 9, 255, 'm', 'j', 'u', '7' ; -, CURUP, CURRIGHT, -, M, J, U, 7 ; J2-2, J2-1, J2-Right, J2-Left ; J2-Down, J2-UP, J1-2, J1-1, J1-Right, J1-Left, J1-Down, J1-Up ; Shifted defb 255, 255, 255, '(' ; -, -, -, 8 defb 'I', 'K', '<', 255, 'Z', 'A', 'Q', '!' ; I, K, ., ??, Z, A, Q, 1 defb 255, 255, 255, ')' ; -, -, -, 9 defb 'O', 'L', '>', ' ', 'X', 'S', 'W', '\"' ; O, L, ., SPACE, X, S, W, 2 defb 255, 255, 255, '0' ; -, -, -, 0 defb 'P', '+', '?', 255, 'C', 'D', 'E', '#' ; p, ;, /, HOME/CLR, C, D, E, 3 defb 255, 255, 255, '=' ; -, -, -, '-' defb '`', '*', 255, 127, 'V', 'F', 'R', '$' ; @, :, ??, INS/DEL, V, F, R, 4 defb 255, 255, 255, '~' ; -, -, -, ^ defb '{', '}', 10, 255, 'B', 'G', 'T', '%' ; [, ], CURDOWN, -, b, g, t, 5 defb 255, 255, 255, '\\' ; FUNC, -, -, | defb 255, 13, 8, 255, 'N', 'H', 'Y', '&' ; -, CR, CURLEFT, -, N, H, Y, 6 defb 255, 255, 255, 255 ; SHIFT, CTRL, GRAPH, BREAK defb 255, 11, 9, 255, 'M', 'J', 'U', '\'' ; -, CURUP, CURRIGHT, -, M, J, U, 7 ; With control defb 255, 255, 255, '(' ; -, -, -, 8 defb 9, 11, '<', 255, 26, 1, 17, 27 ; I, K, ., ??, Z, A, Q, 1 defb 255, 255, 255, ')' ; -, -, -, 9 defb 15, 12, '>', ' ', 24, 19, 23, 28 ; O, L, ., SPACE, X, S, W, 2 defb 255, 255, 255, '0' ; -, -, -, 0 defb 16, '+', '?', 255, 3, 4, 5, 29 ; p, ;, /, HOME/CLR, C, D, E, 3 defb 255, 255, 255, '=' ; -, -, -, '-' defb '`', '*', 255, 127, 22, 6, 18, 30 ; @, :, ??, INS/DEL, V, F, R, 4 defb 255, 255, 255, '~' ; -, -, -, ^ defb '[', ']', 10, 255, 2, 7, 20, 31 ; [, ], CURDOWN, -, b, g, t, 5 defb 255, 255, 255, '|' ; FUNC, -, -, | defb 255, 13, 8, 255, 14, 8, 25, '&' ; -, CR, CURLEFT, -, N, H, Y, 6 defb 255, 255, 255, 255 ; SHIFT, CTRL, GRAPH, BREAK defb 255, 11, 9, 255, 13, 10, 21, '\'' ; -, CURUP, CURRIGHT, -, M, J, U, 7
programs/oeis/165/A165865.asm
neoneye/loda
22
80227
<reponame>neoneye/loda ; A165865: Totally multiplicative sequence with a(p) = 44. ; 1,44,44,1936,44,1936,44,85184,1936,1936,44,85184,44,1936,1936,3748096,44,85184,44,85184,1936,1936,44,3748096,1936,1936,85184,85184,44,85184,44,164916224,1936,1936,1936,3748096,44,1936,1936,3748096,44,85184,44,85184,85184,1936,44,164916224,1936,85184,1936,85184,44,3748096,1936,3748096,1936,1936,44,3748096,44,1936,85184,7256313856,1936,85184,44,85184,1936,85184,44,164916224,44,1936,85184,85184,1936,85184,44,164916224,3748096,1936,44,3748096,1936,1936,1936,3748096,44,3748096,1936,85184,1936,1936,1936,7256313856,44,85184,85184,3748096 seq $0,1222 ; Number of prime divisors of n counted with multiplicity (also called bigomega(n) or Omega(n)). mov $1,44 pow $1,$0 mov $0,$1
Transynther/x86/_processed/NONE/_st_/i3-7100_9_0x84_notsx.log_136_2928.asm
ljhsiun2/medusa
9
165876
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x1135, %rsi lea addresses_normal_ht+0x17c35, %rdi nop nop nop nop nop cmp %rdx, %rdx mov $34, %rcx rep movsq nop nop nop nop sub %r13, %r13 lea addresses_A_ht+0xcbad, %r13 nop nop cmp %rdi, %rdi mov (%r13), %si nop nop nop xor $43460, %rdx lea addresses_WC_ht+0xb36f, %rsi lea addresses_UC_ht+0x4135, %rdi nop nop nop xor $64114, %r14 mov $71, %rcx rep movsq nop add $54056, %rdi lea addresses_normal_ht+0xd935, %r14 nop nop cmp %r11, %r11 mov $0x6162636465666768, %rsi movq %rsi, %xmm3 movups %xmm3, (%r14) nop nop nop nop and $56105, %rdx lea addresses_D_ht+0x17135, %r11 clflush (%r11) cmp $46142, %rcx mov (%r11), %rdx nop add %rdx, %rdx lea addresses_WT_ht+0x4335, %rsi nop nop nop nop xor $24639, %rdi movw $0x6162, (%rsi) nop nop cmp $42644, %rcx lea addresses_D_ht+0x14fb5, %rsi lea addresses_WC_ht+0x1c995, %rdi nop nop nop cmp %r14, %r14 mov $31, %rcx rep movsq nop nop nop nop nop inc %r11 lea addresses_D_ht+0x15535, %rsi nop nop nop sub $13255, %rcx movb (%rsi), %r14b nop nop nop nop nop add %r13, %r13 lea addresses_normal_ht+0x1b335, %rsi lea addresses_A_ht+0x17535, %rdi nop and %r13, %r13 mov $42, %rcx rep movsq nop nop xor %r14, %r14 lea addresses_D_ht+0x11ef, %rsi lea addresses_WC_ht+0x1cc35, %rdi nop nop nop nop xor $56041, %r9 mov $94, %rcx rep movsw nop nop nop xor %rdx, %rdx lea addresses_A_ht+0x7215, %rdx nop add $2168, %r14 vmovups (%rdx), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $1, %xmm4, %r13 nop nop nop add $15102, %rdx lea addresses_UC_ht+0x15935, %rdx and $42254, %rcx mov (%rdx), %r11d add $60637, %r13 lea addresses_normal_ht+0x1e7cd, %rcx nop sub %rsi, %rsi movb $0x61, (%rcx) nop nop nop cmp $10700, %r11 lea addresses_UC_ht+0x15cd5, %r11 and $30751, %r14 mov (%r11), %di nop add %rsi, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r8 push %rbp push %rbx push %rdi // Store lea addresses_A+0xed35, %r12 nop nop nop nop nop and %rbx, %rbx mov $0x5152535455565758, %rdi movq %rdi, %xmm0 vmovaps %ymm0, (%r12) nop nop nop nop xor %rbx, %rbx // Faulty Load lea addresses_A+0x15d35, %rdi nop nop nop nop nop xor %r11, %r11 movb (%rdi), %r12b lea oracles, %rdi and $0xff, %r12 shlq $12, %r12 mov (%rdi,%r12,1), %r12 pop %rdi pop %rbx pop %rbp pop %r8 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_A', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'58': 136} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
org.alloytools.alloy.core/src/main/resources/models/util/boolean.als
Kaixi26/org.alloytools.alloy
527
1504
module util/boolean /* * Creates a Bool type with two singleton subtypes: True * and False. Provides common boolean operations. * * author: <NAME> */ abstract sig Bool {} one sig True, False extends Bool {} pred isTrue[b: Bool] { b in True } pred isFalse[b: Bool] { b in False } fun Not[b: Bool] : Bool { Bool - b } fun And[b1, b2: Bool] : Bool { subset_[b1 + b2, True] } fun Or[b1, b2: Bool] : Bool { subset_[True, b1 + b2] } fun Xor[b1, b2: Bool] : Bool { subset_[Bool, b1 + b2] } fun Nand[b1, b2: Bool] : Bool { subset_[False, b1 + b2] } fun Nor[b1, b2: Bool] : Bool { subset_[b1 + b2, False] } fun subset_[s1, s2: set Bool] : Bool { (s1 in s2) => True else False }
gfx/pokemon/skiploom/anim.asm
Dev727/ancientplatinum
28
176844
frame 0, 04 frame 1, 10 frame 2, 14 frame 3, 14 endanim
samples/addTwoNumbers.asm
sumanthreddy07/uPower_Assembler
0
18786
.data #global data X: .word 5 Y: .word 10 SUM: .word 0 .text #.globl main main: la R1, X la R2, Y lwz R3, 0(R1) lwz R4, 0(R2) add R5, R3, R4 la R6, SUM stw R5, 0(R6) lwz R8, 0(R6) # .end
vendor/stdlib/src/Data/Rational.agda
isabella232/Lemmachine
56
11354
------------------------------------------------------------------------ -- Rational numbers ------------------------------------------------------------------------ module Data.Rational where open import Data.Bool.Properties open import Data.Function open import Data.Integer hiding (suc) renaming (_*_ to _ℤ*_) open import Data.Integer.Divisibility as ℤDiv using (Coprime) import Data.Integer.Properties as ℤ open import Data.Nat.Divisibility as ℕDiv using (_∣_) import Data.Nat.Coprimality as C open import Data.Nat as ℕ renaming (_*_ to _ℕ*_) open import Relation.Nullary.Decidable open import Relation.Binary open import Relation.Binary.PropositionalEquality as PropEq open ≡-Reasoning ------------------------------------------------------------------------ -- The definition -- Rational numbers in reduced form. record ℚ : Set where field numerator : ℤ denominator-1 : ℕ isCoprime : True (C.coprime? ∣ numerator ∣ (suc denominator-1)) denominator : ℤ denominator = + suc denominator-1 coprime : Coprime numerator denominator coprime = witnessToTruth isCoprime -- Constructs rational numbers. The arguments have to be in reduced -- form. infixl 7 _÷_ _÷_ : (numerator : ℤ) (denominator : ℕ) {coprime : True (C.coprime? ∣ numerator ∣ denominator)} {≢0 : False (ℕ._≟_ denominator 0)} → ℚ (n ÷ zero) {≢0 = ()} (n ÷ suc d) {c} = record { numerator = n; denominator-1 = d; isCoprime = c } private -- Note that the implicit arguments do not need to be given for -- concrete inputs: 0/1 : ℚ 0/1 = + 0 ÷ 1 -½ : ℚ -½ = - + 1 ÷ 2 ------------------------------------------------------------------------ -- Equality -- Equality of rational numbers. infix 4 _≃_ _≃_ : Rel ℚ p ≃ q = P.numerator ℤ* Q.denominator ≡ Q.numerator ℤ* P.denominator where module P = ℚ p; module Q = ℚ q -- _≃_ coincides with propositional equality. ≡⇒≃ : _≡_ ⇒ _≃_ ≡⇒≃ refl = refl ≃⇒≡ : _≃_ ⇒ _≡_ ≃⇒≡ {p} {q} = helper P.numerator P.denominator-1 P.isCoprime Q.numerator Q.denominator-1 Q.isCoprime where module P = ℚ p; module Q = ℚ q helper : ∀ n₁ d₁ c₁ n₂ d₂ c₂ → n₁ ℤ* + suc d₂ ≡ n₂ ℤ* + suc d₁ → (n₁ ÷ suc d₁) {c₁} ≡ (n₂ ÷ suc d₂) {c₂} helper n₁ d₁ c₁ n₂ d₂ c₂ eq with Poset.antisym ℕDiv.poset 1+d₁∣1+d₂ 1+d₂∣1+d₁ where 1+d₁∣1+d₂ : suc d₁ ∣ suc d₂ 1+d₁∣1+d₂ = ℤDiv.coprime-divisor (+ suc d₁) n₁ (+ suc d₂) (C.sym $ witnessToTruth c₁) $ ℕDiv.divides ∣ n₂ ∣ (begin ∣ n₁ ℤ* + suc d₂ ∣ ≡⟨ cong ∣_∣ eq ⟩ ∣ n₂ ℤ* + suc d₁ ∣ ≡⟨ ℤ.abs-*-commute n₂ (+ suc d₁) ⟩ ∣ n₂ ∣ ℕ* suc d₁ ∎) 1+d₂∣1+d₁ : suc d₂ ∣ suc d₁ 1+d₂∣1+d₁ = ℤDiv.coprime-divisor (+ suc d₂) n₂ (+ suc d₁) (C.sym $ witnessToTruth c₂) $ ℕDiv.divides ∣ n₁ ∣ (begin ∣ n₂ ℤ* + suc d₁ ∣ ≡⟨ cong ∣_∣ (PropEq.sym eq) ⟩ ∣ n₁ ℤ* + suc d₂ ∣ ≡⟨ ℤ.abs-*-commute n₁ (+ suc d₂) ⟩ ∣ n₁ ∣ ℕ* suc d₂ ∎) helper n₁ d c₁ n₂ .d c₂ eq | refl with ℤ.cancel-*-right n₁ n₂ (+ suc d) (λ ()) eq helper n d c₁ .n .d c₂ eq | refl | refl with proof-irrelevance c₁ c₂ helper n d c .n .d .c eq | refl | refl | refl = refl
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c35508e.ada
best08618/asylo
7
3208
-- C35508E.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT THE ATTRIBUTES 'IMAGE' AND 'VALUE' YIELD THE CORRECT -- RESULTS WHEN THE PREFIX IS A GENERIC FORMAL DISCRETE TYPE WHOSE -- ACTUAL ARGUMENT IS A BOOLEAN TYPE. -- SUBTESTS ARE: -- (A). TESTS FOR IMAGE. -- (B). TESTS FOR VALUE. -- HISTORY: -- RJW 03/19/86 CREATED ORIGINAL TEST. -- DHH 10/19/87 SHORTENED LINES CONTAINING MORE THAN 72 CHARACTERS. WITH REPORT; USE REPORT; PROCEDURE C35508E IS BEGIN TEST( "C35508E" , "CHECK THAT THE ATTRIBUTES 'IMAGE' AND " & "'VALUE' YIELD THE CORRECT RESULTS WHEN THE " & "PREFIX IS A GENERIC FORMAL DISCRETE TYPE " & "WHOSE ACTUAL ARGUMENT IS A BOOLEAN TYPE" ); -- PART (A). DECLARE TYPE NEWBOOL IS NEW BOOLEAN; GENERIC TYPE BOOL IS (<>); PROCEDURE P (B : BOOL; STR : STRING ); PROCEDURE P (B : BOOL; STR : STRING) IS SUBTYPE SUBBOOL IS BOOL RANGE BOOL'VAL (IDENT_INT(0)) .. BOOL'VAL (IDENT_INT(0)); BEGIN IF BOOL'IMAGE (B) /= STR THEN FAILED ( "INCORRECT BOOL'IMAGE OF " & STR ); END IF; IF BOOL'IMAGE (B)'FIRST /= 1 THEN FAILED ( "INCORRECT BOOL'FIRST FOR " & STR ); END IF; IF SUBBOOL'IMAGE (B) /= STR THEN FAILED ( "INCORRECT SUBBOOL'IMAGE OF " & STR ); END IF; IF SUBBOOL'IMAGE (B)'FIRST /= 1 THEN FAILED ( "INCORRECT SUBBOOL'FIRST FOR " & STR ); END IF; END P; PROCEDURE NP1 IS NEW P ( BOOLEAN ); PROCEDURE NP2 IS NEW P ( NEWBOOL ); BEGIN NP1 ( TRUE, "TRUE" ); NP2 ( FALSE, "FALSE" ); END; ----------------------------------------------------------------------- -- PART (B). DECLARE TYPE NEWBOOL IS NEW BOOLEAN; GENERIC TYPE BOOL IS (<>); PROCEDURE P (STR : STRING; B : BOOL ); PROCEDURE P (STR : STRING; B : BOOL) IS SUBTYPE SUBBOOL IS BOOL RANGE BOOL'VAL (IDENT_INT(0)) .. BOOL'VAL (IDENT_INT(0)); BEGIN BEGIN IF BOOL'VALUE (STR) /= B THEN FAILED ( "INCORRECT BOOL'VALUE OF """ & STR & """" ); END IF; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED BOOL'VALUE OF """ & STR & """" ); END; BEGIN IF SUBBOOL'VALUE (STR) /= B THEN FAILED ( "INCORRECT SUBBOOL'VALUE OF """ & STR & """" ); END IF; EXCEPTION WHEN OTHERS => FAILED ( "EXCEPTION RAISED SUBBOOL'VALUE " & "OF """ & STR & """" ); END; END P; PROCEDURE NP1 IS NEW P ( BOOLEAN ); PROCEDURE NP2 IS NEW P ( NEWBOOL ); BEGIN NP1 ( "TRUE", TRUE ); NP2 ( "FALSE", FALSE ); NP2 ( "true", TRUE ); NP1 ( "false", FALSE ); NP1 ( " TRUE", TRUE ); NP2 ( "FALSE ", FALSE ); END; DECLARE GENERIC TYPE BOOL IS (<>); PROCEDURE P (STR1 : STRING; B : BOOL; STR2 : STRING); PROCEDURE P (STR1 : STRING; B : BOOL; STR2 : STRING) IS SUBTYPE SUBBOOL IS BOOL RANGE BOOL'VAL (IDENT_INT(0)) .. BOOL'VAL (IDENT_INT(0)); BEGIN BEGIN IF BOOL'VALUE (STR1) = B THEN FAILED ( "NO EXCEPTION RAISED - " & "BOOL'VALUE WITH " & STR2 & "- EQUAL " ); ELSE FAILED ( "NO EXCEPTION RAISED - " & "BOOL'VALUE WITH " & STR2 & " - NOT EQUAL" ); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED - " & "BOOL'VALUE WITH " & STR2 ); END; BEGIN IF SUBBOOL'VALUE (STR1) /= B THEN FAILED ( "NO EXCEPTION RAISED - " & "SUBBOOL'VALUE WITH " & STR2 & " - EQUAL"); ELSE FAILED ( "NO EXCEPTION RAISED - " & "SUBBOOL'VALUE WITH " & STR2 & " - NOT EQUAL"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => NULL; WHEN OTHERS => FAILED ( "WRONG EXCEPTION RAISED - " & "SUBBOOL'VALUE WITH " & STR2 ); END; END P; PROCEDURE NP IS NEW P ( BOOLEAN ); BEGIN NP ( "MAYBE", TRUE, "NON-BOOLEAN VALUE"); NP ( ASCII.HT & "TRUE", TRUE, "LEADING 'HT'" ); NP ( "FALSE" & ASCII.HT , FALSE, "TRAILING 'HT'" ); END; RESULT; END C35508E;
alloy4fun_models/trashltl/models/0/BHEafam9km9hc3HbM.als
Kaixi26/org.alloytools.alloy
0
1806
open main pred idBHEafam9km9hc3HbM_prop1 { no Trash } pred __repair { idBHEafam9km9hc3HbM_prop1 } check __repair { idBHEafam9km9hc3HbM_prop1 <=> prop1o }
src/asis/a4g-encl_el.adb
My-Colaborations/dynamo
15
4228
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . E N C L _ E L -- -- -- -- B o d y -- -- -- -- Copyright (C) 1995-2012, Free Software Foundation, Inc. -- -- -- -- ASIS-for-GNAT is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 51 Franklin -- -- Street, Fifth Floor, Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by AdaCore -- -- (http://www.ad<EMAIL>). -- -- -- ------------------------------------------------------------------------------ with Asis; use Asis; with Asis.Declarations; use Asis.Declarations; with Asis.Elements; use Asis.Elements; with Asis.Extensions; with Asis.Set_Get; use Asis.Set_Get; with A4G.A_Sem; use A4G.A_Sem; with A4G.A_Types; use A4G.A_Types; with A4G.Int_Knds; use A4G.Int_Knds; with A4G.Mapping; use A4G.Mapping; with A4G.Queries; use A4G.Queries; with A4G.Vcheck; use A4G.Vcheck; with Atree; use Atree; with Einfo; use Einfo; with Namet; use Namet; with Nlists; use Nlists; with Sinfo; use Sinfo; with Sinput; use Sinput; with Snames; with Stand; use Stand; with Types; use Types; package body A4G.Encl_El is ------------------------------------------------ -- The general approach to the implementation -- -- of the Enclosing_Element query -- ------------------------------------------------ -- There are important differences in the ways how an Enclosing_Element -- is retrieved for explicit and implicit Elements, and for the elements -- from expanded generics. For explicit Elements, the general way to get -- the enclosing Element is to do the necessary bottom-up tree traversing, -- for most of the cases all what we need if one step up the front-end -- tree, but sometimes the differences between front-end and ASIS trees -- require some non-trivial traversing. -- -- For implicit Elements, there is a semantic link between a top Element -- of an ASIS implicit sub-hierarchy and some explicit Element that -- "generates" this subhierarchy. For example, an implicit declaration of -- an inherited supprogram is "generated" by some derived type definition, -- so inside the implicit subhierarchy we use the same approach for -- retrieving the enclosing Element as for explicit Elements, but the -- enclosing Element for subhierarchy is the construct that "generates" the -- subhierarchy, and to get to this construct, the link stored as a part -- of implicit elements structure is used. -- -- For Elements from generic instantiations, we do bottom-up traversing of -- the ASIS/front-end tree structure corresponding to the expanded code -- in the same way as for explicit Elements, but when we are at the top of -- an expanded spec or body, the next Enclosing_Element step should go -- to the corresponding instantiation, so here we also do something -- different that bottom-up tree traversing -- -- But for most of the cases the way to get the enclosing Element is to -- map the bottom-up traversing of the compiler tree onto the ASIS Elements -- hierarchy. This is performed by Enclosing_Element_For_Explicit function, -- and all the other routines defined in this package detect and process -- various special cases. For implicit Elements and for Elements that are -- components of expanded generic structure the first thing is to check if -- this Element can be processed as if it is a usual explicit Element, and -- then correct result, if needed. --------------------------------------------------------------------- -- Mapping the bottom-up traversing of the compiler tree onto ASIS -- --------------------------------------------------------------------- -- Each ASIS Element contains the reference to the tree node it has been -- built from. In many cases the enclosing Element should be built on -- the parent node. In some cases the enclosing Element may be built on the -- same node. And there are some cases when we have to do some traversing -- that is specific to this particular Element to get to the compiler tree -- node corresponding to its enclosing Element. -- The way of getting the enclosing Element is implemented on the base of -- two look-up tables (switches). The first table defines if for the given -- element (that is, for the given Element kind, and the internal flat -- Element classification is used here) some regular way of constructing -- enclosing Element should be used, or some non-trivial traversing is -- needed. This non-trivial traversing is specific to the Element kind, and -- the corresponding routine is defined by the second look-up table. ------------------------------------------------- -- The general structure of this package body -- ------------------------------------------------- -- The rest of this package body has the following structure: -- -- Section 1 - definition of the first Enclosing_Element switch (makes -- the difference between trivial and non-trivial cases of -- mapping the bottom up compiler tree traversing onto ASIS -- -- Section 2 - declarations of routines implementing various cases of -- non-trivial bottom up compiler tree traversing -- -- Section 3 - definition of the second Enclosing_Element switch (maps -- Element kind requiring non-trivial actions onto -- corresponding routines -- -- Section 4 - (general-purpose) local subprograms -- -- Section 5 - bodies of the routines declared in Section 2 -- -- Section 6 - bodies of the routines declared in the package spec --------------------------------------------------------------------- -- Section 1 - Enclosing_Element first switch, separating trivial -- -- and non-trivial cases -- --------------------------------------------------------------------- -- This switch maps each value of the Internal_Element_Kinds onto one -- of the following values of the same type, and this mapping has the -- following meaning: -- Not_An_Element => Asis.Nil_Element should be returned as -- Enclosed Element; -- -- Trivial_Mapping => A standard Enclosing_Element constructor should -- be used, it is implemented by General_Encl_Elem -- function -- -- No_Mapping => is set for the special values added to the -- Internal_Element_Kinds literals to organize the -- Node_to_Element and Enclosing Element switches. -- -- Non_Trivial_Mapping => a special function is needed for this Element -- kind to get the Enclosing Element. This function -- is selected by second switch, -- -- Not_Implemented_Mapping => it means what is sounds -- -- any the other value => the Enclosing Element for the Element of the -- corresponding kind is based on the same node, but -- is of the specified kind Enclosing_Element_For_Explicits_First_Switch : constant array (Internal_Element_Kinds) of Internal_Element_Kinds := ( -- type Internal_Element_Kinds is ( -- Not_An_Element => Not_An_Element, -- Asis.Nil_Element should be returned as the -- Enclosing for the Asis.Nil_Element, should not it??? -- ------------------------------------------------------------------------------ -- -- -- A_Pragma, -- Asis.Elements -- ------------------------------------------------------------------------------ -- An_All_Calls_Remote_Pragma .. -- An_Asynchronous_Pragma, -- An_Atomic_Pragma, -- An_Atomic_Components_Pragma, -- An_Attach_Handler_Pragma, -- A_Controlled_Pragma, -- A_Convention_Pragma, -- A_Discard_Names_Pragma, -- An_Elaborate_Pragma, -- An_Elaborate_All_Pragma, -- An_Elaborate_Body_Pragma, -- An_Export_Pragma, -- An_Import_Pragma, -- An_Inline_Pragma, -- An_Inspection_Point_Pragma, -- An_Interrupt_Handler_Pragma, -- An_Interrupt_Priority_Pragma, -- A_Linker_Options_Pragma -- A_List_Pragma, -- A_Locking_Policy_Pragma, -- A_Normalize_Scalars_Pragma, -- An_Optimize_Pragma, -- A_Pack_Pragma, -- A_Page_Pragma, -- A_Preelaborate_Pragma, -- A_Priority_Pragma, -- A_Pure_Pragma, -- A_Queuing_Policy_Pragma, -- A_Remote_Call_Interface_Pragma, -- A_Remote_Types_Pragma, -- A_Restrictions_Pragma, -- A_Reviewable_Pragma, -- A_Shared_Passive_Pragma, -- A_Storage_Size_Pragma, -- A_Suppress_Pragma, -- A_Task_Dispatching_Policy_Pragma, -- A_Volatile_Pragma, -- A_Volatile_Components_Pragma, -- -- An_Implementation_Defined_Pragma, -- An_Unknown_Pragma => Non_Trivial_Mapping, -- ------------------------------------------------------------------------------ -- -- -- A_Defining_Name, -- Asis.Declarations -- ------------------------------------------------------------------------------ -- A_Defining_Identifier => Non_Trivial_Mapping, A_Defining_Character_Literal => An_Enumeration_Literal_Specification, A_Defining_Enumeration_Literal => An_Enumeration_Literal_Specification, -- -- -- A_Defining_Operator_Symbol => Non_Trivial_Mapping -- A_Defining_And_Operator .. -- A_Defining_Or_Operator, -- A_Defining_Xor_Operator, -- A_Defining_Equal_Operator, -- A_Defining_Not_Equal_Operator, -- A_Defining_Less_Than_Operator, -- A_Defining_Less_Than_Or_Equal_Operator, -- A_Defining_Greater_Than_Operator, -- A_Defining_Greater_Than_Or_Equal_Operator, -- A_Defining_Plus_Operator, -- A_Defining_Minus_Operator, -- A_Defining_Concatenate_Operator, -- A_Defining_Unary_Plus_Operator, -- A_Defining_Unary_Minus_Operator, -- A_Defining_Multiply_Operator, -- A_Defining_Divide_Operator, -- A_Defining_Mod_Operator, -- A_Defining_Rem_Operator, -- A_Defining_Exponentiate_Operator, -- A_Defining_Abs_Operator, A_Defining_Not_Operator => Non_Trivial_Mapping, A_Defining_Expanded_Name => Non_Trivial_Mapping, -- ------------------------------------------------------------------------------ -- -- -- A_Declaration, -- Asis.Declarations -- ------------------------------------------------------------------------------ -- An_Ordinary_Type_Declaration .. -- A_Task_Type_Declaration, -- A_Protected_Type_Declaration, -- An_Incomplete_Type_Declaration, -- A_Private_Type_Declaration, -- A_Private_Extension_Declaration, -- A_Subtype_Declaration, A_Variable_Declaration => Trivial_Mapping, A_Constant_Declaration => Trivial_Mapping, A_Deferred_Constant_Declaration .. -- A_Single_Task_Declaration, -- A_Single_Protected_Declaration, -- -- An_Integer_Number_Declaration, A_Real_Number_Declaration => Trivial_Mapping, -- An_Enumeration_Literal_Specification => Non_Trivial_Mapping, -- is it really so? -- A_Discriminant_Specification => Non_Trivial_Mapping, A_Component_Declaration => Non_Trivial_Mapping, A_Loop_Parameter_Specification .. -- A_Generalized_Iterator_Specification, An_Element_Iterator_Specification => Non_Trivial_Mapping, A_Procedure_Declaration => Non_Trivial_Mapping, A_Function_Declaration => Non_Trivial_Mapping, -- A_Parameter_Specification => Non_Trivial_Mapping, -- A_Procedure_Body_Declaration => Non_Trivial_Mapping, A_Function_Body_Declaration => Non_Trivial_Mapping, A_Return_Variable_Specification => Trivial_Mapping, A_Return_Constant_Specification => Trivial_Mapping, A_Null_Procedure_Declaration => Trivial_Mapping, An_Expression_Function_Declaration => Trivial_Mapping, A_Package_Declaration => Non_Trivial_Mapping, A_Package_Body_Declaration => Non_Trivial_Mapping, An_Object_Renaming_Declaration => Trivial_Mapping, An_Exception_Renaming_Declaration => Trivial_Mapping, A_Package_Renaming_Declaration => Non_Trivial_Mapping, A_Procedure_Renaming_Declaration => Non_Trivial_Mapping, A_Function_Renaming_Declaration => Non_Trivial_Mapping, A_Generic_Package_Renaming_Declaration => Non_Trivial_Mapping, A_Generic_Procedure_Renaming_Declaration => Non_Trivial_Mapping, A_Generic_Function_Renaming_Declaration => Non_Trivial_Mapping, A_Task_Body_Declaration => Non_Trivial_Mapping, A_Protected_Body_Declaration => Non_Trivial_Mapping, An_Entry_Declaration => Non_Trivial_Mapping, An_Entry_Body_Declaration => Trivial_Mapping, An_Entry_Index_Specification => Trivial_Mapping, A_Procedure_Body_Stub => Trivial_Mapping, A_Function_Body_Stub => Trivial_Mapping, A_Package_Body_Stub => Trivial_Mapping, A_Task_Body_Stub => Trivial_Mapping, A_Protected_Body_Stub => Trivial_Mapping, An_Exception_Declaration => Trivial_Mapping, A_Choice_Parameter_Specification => Trivial_Mapping, -- A_Generic_Procedure_Declaration => Non_Trivial_Mapping, A_Generic_Function_Declaration => Non_Trivial_Mapping, A_Generic_Package_Declaration => Non_Trivial_Mapping, A_Package_Instantiation => Non_Trivial_Mapping, A_Procedure_Instantiation => Non_Trivial_Mapping, A_Function_Instantiation => Non_Trivial_Mapping, A_Formal_Object_Declaration => Trivial_Mapping, A_Formal_Type_Declaration => Trivial_Mapping, A_Formal_Incomplete_Type_Declaration => Trivial_Mapping, A_Formal_Procedure_Declaration => Trivial_Mapping, A_Formal_Function_Declaration => Trivial_Mapping, A_Formal_Package_Declaration => Trivial_Mapping, A_Formal_Package_Declaration_With_Box => Trivial_Mapping, ------------------------------------------------------------------------------ -- -- -- A_Definition, -- Asis.Definitions -- ------------------------------------------------------------------------------ -- -- -- A_Type_Definition, -- A_Derived_Type_Definition => Trivial_Mapping, A_Derived_Record_Extension_Definition => Trivial_Mapping, -- An_Enumeration_Type_Definition => Non_Trivial_Mapping, -- A_Signed_Integer_Type_Definition => Trivial_Mapping, A_Modular_Type_Definition => Trivial_Mapping, -- -- -- A_Root_Type_Definition, ----- ######### -- -- A_Root_Integer_Definition, ----- ######### -- A_Root_Real_Definition, ----- ######### -- A_Root_Fixed_Definition, ----- ######### -- -- A_Universal_Integer_Definition, ----- ######### -- A_Universal_Real_Definition, ----- ######### -- A_Universal_Fixed_Definition, ----- ######### -- -- A_Floating_Point_Definition => Trivial_Mapping, -- An_Ordinary_Fixed_Point_Definition => Trivial_Mapping, A_Decimal_Fixed_Point_Definition => Trivial_Mapping, -- An_Unconstrained_Array_Definition => Trivial_Mapping, A_Constrained_Array_Definition => Trivial_Mapping, -- A_Record_Type_Definition => Trivial_Mapping, -- ??? A_Tagged_Record_Type_Definition => Trivial_Mapping, -- ??? -- --|A2005 start -- An_Interface_Type_Definition, An_Ordinary_Interface .. -- A_Limited_Interface, -- A_Task_Interface, -- A_Protected_Interface, A_Synchronized_Interface => Trivial_Mapping, -- --|A2005 end -- -- An_Access_Type_Definition, -- A_Pool_Specific_Access_To_Variable => Trivial_Mapping, An_Access_To_Variable => Trivial_Mapping, An_Access_To_Constant => Trivial_Mapping, -- An_Access_To_Procedure => Trivial_Mapping, An_Access_To_Protected_Procedure => Trivial_Mapping, An_Access_To_Function => Trivial_Mapping, An_Access_To_Protected_Function => Trivial_Mapping, -- -- A_Subtype_Indication => Non_Trivial_Mapping, -- -- -- A_Constraint, -- A_Range_Attribute_Reference => Non_Trivial_Mapping, -- ??? A_Simple_Expression_Range => Non_Trivial_Mapping, A_Digits_Constraint => Trivial_Mapping, A_Delta_Constraint => Trivial_Mapping, An_Index_Constraint => Non_Trivial_Mapping, A_Discriminant_Constraint => Non_Trivial_Mapping, -- A_Component_Definition => Trivial_Mapping, -- -- -- A_Discrete_Subtype_Definition, -- A_Discrete_Subtype_Indication_As_Subtype_Definition => Trivial_Mapping, A_Discrete_Range_Attribute_Reference_As_Subtype_Definition => Trivial_Mapping, A_Discrete_Simple_Expression_Range_As_Subtype_Definition => Trivial_Mapping, -- -- -- A_Discrete_Range, -- A_Discrete_Subtype_Indication => Non_Trivial_Mapping, A_Discrete_Range_Attribute_Reference => Non_Trivial_Mapping, A_Discrete_Simple_Expression_Range => Non_Trivial_Mapping, -- -- An_Unknown_Discriminant_Part => Non_Trivial_Mapping, A_Known_Discriminant_Part => Non_Trivial_Mapping, -- A_Record_Definition => Non_Trivial_Mapping, A_Null_Record_Definition => Non_Trivial_Mapping, -- A_Null_Component => Non_Trivial_Mapping, A_Variant_Part => Non_Trivial_Mapping, A_Variant => Trivial_Mapping, An_Others_Choice => Non_Trivial_Mapping, -- --|A2005 start An_Anonymous_Access_To_Variable .. -- An_Anonymous_Access_To_Constant -- An_Anonymous_Access_To_Procedure -- An_Anonymous_Access_To_Protected_Procedure -- An_Anonymous_Access_To_Function An_Anonymous_Access_To_Protected_Function => Trivial_Mapping, -- --|A2005 end A_Private_Type_Definition => A_Private_Type_Declaration, A_Tagged_Private_Type_Definition => A_Private_Type_Declaration, A_Private_Extension_Definition => A_Private_Extension_Declaration, -- A_Task_Definition => Trivial_Mapping, A_Protected_Definition => Non_Trivial_Mapping, -- -- -- A_Formal_Type_Definition, -- A_Formal_Private_Type_Definition .. -- A_Formal_Tagged_Private_Type_Definition, -- -- A_Formal_Derived_Type_Definition, -- -- A_Formal_Discrete_Type_Definition, -- -- A_Formal_Signed_Integer_Type_Definition, -- A_Formal_Modular_Type_Definition, -- -- A_Formal_Floating_Point_Definition, -- -- A_Formal_Ordinary_Fixed_Point_Definition, -- A_Formal_Decimal_Fixed_Point_Definition, -- -- A_Formal_Unconstrained_Array_Definition, -- A_Formal_Constrained_Array_Definition, -- -- -- A_Formal_Access_Type_Definition, -- -- A_Formal_Pool_Specific_Access_To_Variable, -- A_Formal_Access_To_Variable, -- A_Formal_Access_To_Constant, -- -- A_Formal_Access_To_Procedure, -- A_Formal_Access_To_Protected_Procedure, -- A_Formal_Access_To_Function, -- A_Formal_Access_To_Protected_Function An_Aspect_Specification => Trivial_Mapping, -- ------------------------------------------------------------------------------ -- -- -- An_Expression, -- Asis.Expressions --########## -- ------------------------------------------------------------------------------ -- An_Integer_Literal => Non_Trivial_Mapping, A_Real_Literal => Non_Trivial_Mapping, A_String_Literal => Non_Trivial_Mapping, An_Identifier => Non_Trivial_Mapping, -- -- -- An_Operator_Symbol, -- An_And_Operator .. -- An_Or_Operator, -- An_Xor_Operator, -- An_Equal_Operator, -- A_Not_Equal_Operator, -- A_Less_Than_Operator, -- A_Less_Than_Or_Equal_Operator, -- A_Greater_Than_Operator, -- A_Greater_Than_Or_Equal_Operator, -- A_Plus_Operator, -- A_Minus_Operator, -- A_Concatenate_Operator, -- A_Unary_Plus_Operator, -- A_Unary_Minus_Operator, -- A_Multiply_Operator, -- A_Divide_Operator, -- A_Mod_Operator, -- A_Rem_Operator, -- An_Exponentiate_Operator, -- An_Abs_Operator, -- A_Not_Operator => A_Function_Call, A_Not_Operator => Non_Trivial_Mapping, -- -- A_Character_Literal .. -- -- An_Enumeration_Literal, -- An_Explicit_Dereference => Trivial_Mapping, -- -- A_Function_Call => Non_Trivial_Mapping, -- -- -- An_Indexed_Component .. -- A_Slice => Trivial_Mapping, -- A_Selected_Component => Non_Trivial_Mapping, -- -- -- -- -- ??? Not_An_Attribute, -- -- -- An_Attribute_Reference => Non_Trivial_Mapping, -- -- -- An_Access_Attribute .. -- -- An_Address_Attribute, -- -- An_Adjacent_Attribute, -- -- An_Aft_Attribute, -- -- An_Alignment_Attribute, -- -- A_Base_Attribute, -- -- A_Bit_Order_Attribute, -- -- A_Body_Version_Attribute, -- -- A_Callable_Attribute, -- -- A_Caller_Attribute, -- -- A_Ceiling_Attribute, -- -- A_Class_Attribute, -- -- A_Component_Size_Attribute, -- -- A_Compose_Attribute, -- -- A_Constrained_Attribute, -- -- A_Copy_Sign_Attribute, -- -- A_Count_Attribute, -- -- A_Definite_Attribute, -- -- A_Delta_Attribute, -- -- A_Denorm_Attribute, -- -- A_Digits_Attribute, -- -- An_Exponent_Attribute, -- -- An_External_Tag_Attribute, -- -- A_First_Attribute, -- -- A_First_Bit_Attribute, -- -- A_Floor_Attribute, -- -- A_Fore_Attribute, -- -- A_Fraction_Attribute, -- -- An_Identity_Attribute, -- -- An_Image_Attribute, -- -- An_Input_Attribute, -- -- A_Last_Attribute, -- -- A_Last_Bit_Attribute, -- -- A_Leading_Part_Attribute, -- -- A_Length_Attribute, -- -- A_Machine_Attribute, -- -- A_Machine_Emax_Attribute, -- -- A_Machine_Emin_Attribute, -- -- A_Machine_Mantissa_Attribute, -- -- A_Machine_Overflows_Attribute, -- -- A_Machine_Radix_Attribute, -- -- A_Machine_Rounds_Attribute, -- -- A_Max_Attribute, -- -- A_Max_Size_In_Storage_Elements_Attribute, -- -- A_Min_Attribute, -- -- A_Model_Attribute, -- -- A_Model_Emin_Attribute, -- -- A_Model_Epsilon_Attribute, -- -- A_Model_Mantissa_Attribute, -- -- A_Model_Small_Attribute, -- -- A_Modulus_Attribute, -- -- An_Output_Attribute, -- -- A_Partition_ID_Attribute, -- -- A_Pos_Attribute, -- -- A_Position_Attribute, -- -- A_Pred_Attribute, -- -- A_Range_Attribute, -- -- A_Read_Attribute, -- -- A_Remainder_Attribute, -- -- A_Round_Attribute, -- -- A_Rounding_Attribute, -- -- A_Safe_First_Attribute, -- -- A_Safe_Last_Attribute, -- -- A_Scale_Attribute, -- -- A_Scaling_Attribute, -- -- A_Signed_Zeros_Attribute, -- -- A_Size_Attribute, -- -- A_Small_Attribute, -- -- A_Storage_Pool_Attribute, -- -- A_Storage_Size_Attribute, -- -- -- -- A_Succ_Attribute, -- -- A_Tag_Attribute, -- -- A_Terminated_Attribute, -- -- A_Truncation_Attribute, -- -- An_Unbiased_Rounding_Attribute, -- -- An_Unchecked_Access_Attribute, -- -- A_Val_Attribute, -- -- A_Valid_Attribute, -- -- A_Value_Attribute, -- -- A_Version_Attribute, -- -- A_Wide_Image_Attribute, -- -- A_Wide_Value_Attribute, -- -- A_Wide_Width_Attribute, -- -- A_Width_Attribute, -- -- A_Write_Attribute, -- -- -- -- An_Implementation_Defined_Attribute, -- Vendor Annex M -- An_Unknown_Attribute => Non_Trivial_Mapping, -- -- -- A_Record_Aggregate, -- -- An_Extension_Aggregate, -- -- A_Positional_Array_Aggregate, -- -- A_Named_Array_Aggregate, -- -- -- -- An_And_Then_Short_Circuit, -- -- An_Or_Else_Short_Circuit, -- -- -- -- An_In_Range_Membership_Test, -- -- A_Not_In_Range_Membership_Test, -- -- An_In_Type_Membership_Test, -- -- A_Not_In_Type_Membership_Test, -- -- -- -- A_Null_Literal, -- -- A_Parenthesized_Expression, -- -- -- -- A_Type_Conversion, -- -- A_Qualified_Expression, -- -- -- -- An_Allocation_From_Subtype, -- An_Allocation_From_Qualified_Expression, -- A_Case_Expression, -- Ada 2012 -- An_If_Expression, -- Ada 2012 -- A_For_All_Quantified_Expression, -- Ada 2012 -- A_For_Some_Quantified_Expression); -- Ada 2012 A_Character_Literal .. A_For_Some_Quantified_Expression => Non_Trivial_Mapping, -- ------------------------------------------------------------------------------ -- -- -- An_Association, -- Asis.Expressions -- ------------------------------------------------------------------------------ -- A_Pragma_Argument_Association => Trivial_Mapping, A_Discriminant_Association => Non_Trivial_Mapping, A_Record_Component_Association => Trivial_Mapping, An_Array_Component_Association => Non_Trivial_Mapping, A_Parameter_Association => Non_Trivial_Mapping, A_Generic_Association => Non_Trivial_Mapping, -- ------------------------------------------------------------------------------ -- -- -- A_Statement, -- Asis.Statements -- -- All subordinates of A_Statement kind require non trivial processing, -- this processing is the same for all of them except -- A_Terminate_Alternative_Statement ------------------------------------------------------------------------------ -- A_Null_Statement .. -- An_Assignment_Statement, -- An_If_Statement, -- A_Case_Statement, -- -- A_Loop_Statement, -- A_While_Loop_Statement, -- A_For_Loop_Statement, -- -- A_Block_Statement, -- An_Exit_Statement, -- A_Goto_Statement, -- -- A_Procedure_Call_Statement, -- A_Return_Statement, -- -- An_Accept_Statement, -- An_Entry_Call_Statement, -- -- A_Requeue_Statement, -- A_Requeue_Statement_With_Abort, -- -- A_Delay_Until_Statement, -- A_Delay_Relative_Statement, -- -- A_Terminate_Alternative_Statement, -- A_Selective_Accept_Statement, -- A_Timed_Entry_Call_Statement, -- A_Conditional_Entry_Call_Statement, -- An_Asynchronous_Select_Statement, -- -- An_Abort_Statement, -- A_Raise_Statement, A_Code_Statement => Non_Trivial_Mapping, -- ------------------------------------------------------------------------------ -- Path_Kinds -- Literals -- Ada RM 95 -- -- Detailed classification for -- ASIS_Element_Kinds.Element_Kinds(A_Path) literal -- corresponds to subtype Internal_Path_Kinds ------------------------------------------------------------------------------ An_If_Path => An_If_Statement, An_Elsif_Path => Trivial_Mapping, An_Else_Path => Non_Trivial_Mapping, A_Case_Path => Trivial_Mapping, A_Select_Path => Trivial_Mapping, An_Or_Path => Trivial_Mapping, A_Then_Abort_Path => Trivial_Mapping, -- ------------------------------------------------------------ -- An_Expression_Path, -- Asis.Expressions Ada 2015 -- Detailed classification for Asis.Element_Kinds (An_Expression_Path) -- literal corresponds to subtype Internal_Expression_Path_Kinds ------------------------------------------------------------ An_If_Expression_Path .. -- An_Elsif_Expression_Path, An_Else_Expression_Path => Non_Trivial_Mapping, ------------------------------------------------------------------------ -- -- -- A_Clause, -- Asis.Clauses -- ------------------------------------------------------------------------------ -- A_Use_Package_Clause => Non_Trivial_Mapping, A_Use_Type_Clause => Non_Trivial_Mapping, A_Use_All_Type_Clause => Non_Trivial_Mapping, A_With_Clause => Not_An_Element, -- -- -- A_Representation_Clause, -- An_Attribute_Definition_Clause => Non_Trivial_Mapping, An_Enumeration_Representation_Clause => Trivial_Mapping, A_Record_Representation_Clause => Trivial_Mapping, An_At_Clause => Trivial_Mapping, -- -- A_Component_Clause => Trivial_Mapping, -- ------------------------------------------------------------------------------ -- An_Exception_Handler => Non_Trivial_Mapping, -- ------------------------------------------------------------------------------ -- Special values added for Node -> Element and -- Element -> Enclosing Element switching, ------------------------------------------------------------------------------ Non_Trivial_Mapping => No_Mapping, Not_Implemented_Mapping => No_Mapping, Trivial_Mapping => No_Mapping, No_Mapping => No_Mapping, others => Not_Implemented_Mapping ); ------------------------------------------------------------------------- -- Section 2 - declarations of routines implementing various cases of -- -- non-trivial bottom up compiler tree traversing and -- -- accessed though the second switch -- ------------------------------------------------------------------------- function Not_Implemented_Enclosing_Element_Construction (Element : Asis.Element) return Asis.Element; -- Placeholders for "others" choice -- The functions below computes Enclosing_Elememnt for specific Element -- kinds; the corresponding situations cannot be covered by -- General_Encl_Elem function A_Pragma_Enclosing (Element : Asis.Element) return Asis.Element; function A_Defining_Expanded_Name_Enclosing (Element : Asis.Element) return Asis.Element; function A_Defining_Identifier_Enclosing (Element : Asis.Element) return Asis.Element; function A_Defining_Operator_Symbol_Enclosing (Element : Asis.Element) return Asis.Element; function A_Constant_Declaration_Enclosing (Element : Asis.Element) return Asis.Element; function An_Enumeration_Literal_Specification_Enclosing (Element : Asis.Element) return Asis.Element; function A_Discriminant_Specification_Enclosing (Element : Asis.Element) return Asis.Element; function A_Loop_Parameter_Specification_Enclosing (Element : Asis.Element) return Asis.Element; function A_Parameter_Specification_Enclosing (Element : Asis.Element) return Asis.Element; function An_Enumeration_Type_Definition_Enclosing (Element : Asis.Element) return Asis.Element; function A_Subtype_Indication_Enclosing (Element : Asis.Element) return Asis.Element; function A_Range_Attribute_Reference_Enclosing (Element : Asis.Element) return Asis.Element; function A_Simple_Expression_Range_Enclosing (Element : Asis.Element) return Asis.Element; function A_Discrete_Range_Enclosing (Element : Asis.Element) return Asis.Element; function A_Discriminant_Part_Enclosing (Element : Asis.Element) return Asis.Element; function A_Record_Definition_Enclosing (Element : Asis.Element) return Asis.Element; function A_Null_Component_Enclosing (Element : Asis.Element) return Asis.Element; function A_Variant_Part_Enclosing (Element : Asis.Element) return Asis.Element; function An_Others_Choice_Enclosing (Element : Asis.Element) return Asis.Element; function A_Statement_Enclosing (Element : Asis.Element) return Asis.Element; function A_Terminate_Alternative_Statement_Enclosing (Element : Asis.Element) return Asis.Element; function An_Else_Path_Enclosing (Element : Asis.Element) return Asis.Element; function An_Attribute_Definition_Clause_Enclosing (Element : Asis.Element) return Asis.Element; function An_Exception_Handler_Enclosing (Element : Asis.Element) return Asis.Element; function Possible_C_U_Enclosing (Element : Asis.Element) return Asis.Element; -- Called in a situation when Enclosing_Element may have to be Nil_Element, -- because we may reach the very top of the Element hierarchy of an ASIS -- Compilation_Unit, so logically the next step up should be from Elements -- into enclosing unit. function An_Association_Enclosing (Element : Asis.Element) return Asis.Element; -- Computes the Enclosing Element for parameter associations. The main -- difference with An_Expression_Enclosing is that here we may have to deal -- with normalized associations function An_Expression_Enclosing (Element : Asis.Element) return Asis.Element; -- This function implements the part of the semantic of the -- Asis.Elements.Enclosing_Element function corresponding to the -- enclosing element retrieving for elements representing Ada explicit -- constructs. It deals only with expressions - the hardest part -- for Enclosing_Element. -------------------------------------------------------------------- -- Section 3 - definition of the second Enclosing_Element switch -- -- (maps Element kind requiring non-trivial actions -- -- onto corresponding routines -- -------------------------------------------------------------------- type Enclosing_Element_Construction_For_Explicits_Items is access function (Element : Asis.Element) return Asis.Element; -- access to the local items of the constructing the Enclosing Elements -- for Explicit constructs Enclosing_Element_For_Explicits_Second_Switch : constant array (Internal_Element_Kinds) of Enclosing_Element_Construction_For_Explicits_Items := ( -- type Internal_Element_Kinds is ( -- -- Not_An_Element, -- Asis.Nil_Element -- ------------------------------------------------------------------------------ -- A_Pragma, -- Asis.Elements ------------------------------------------------------------------------------ An_All_Calls_Remote_Pragma .. -- An_Asynchronous_Pragma, -- An_Atomic_Pragma, -- An_Atomic_Components_Pragma, -- An_Attach_Handler_Pragma, -- A_Controlled_Pragma, -- A_Convention_Pragma, -- A_Discard_Names_Pragma, -- An_Elaborate_Pragma, -- An_Elaborate_All_Pragma, -- An_Elaborate_Body_Pragma, -- An_Export_Pragma, -- An_Import_Pragma, -- An_Inline_Pragma, -- An_Inspection_Point_Pragma, -- An_Interrupt_Handler_Pragma, -- An_Interrupt_Priority_Pragma, -- A_Linker_Options_Pragma -- A_List_Pragma, -- A_Locking_Policy_Pragma, -- A_Normalize_Scalars_Pragma, -- An_Optimize_Pragma, -- A_Pack_Pragma, -- A_Page_Pragma, -- A_Preelaborate_Pragma, -- A_Priority_Pragma, -- A_Pure_Pragma, -- A_Queuing_Policy_Pragma, -- A_Remote_Call_Interface_Pragma, -- A_Remote_Types_Pragma, -- A_Restrictions_Pragma, -- A_Reviewable_Pragma, -- A_Shared_Passive_Pragma, -- A_Storage_Size_Pragma, -- A_Suppress_Pragma, -- A_Task_Dispatching_Policy_Pragma, -- A_Volatile_Pragma, -- A_Volatile_Components_Pragma, -- -- An_Implementation_Defined_Pragma, -- An_Unknown_Pragma => A_Pragma_Enclosing'Access, ------------------------------------------------------------------------------ -- A_Defining_Name, -- Asis.Declarations ------------------------------------------------------------------------------ A_Defining_Identifier => A_Defining_Identifier_Enclosing'Access, -- A_Defining_Character_Literal, -- an Enclosing Element is based -- A_Defining_Enumeration_Literal, -- on the same Node -- -- -- A_Defining_Operator_Symbol -- A_Defining_And_Operator .. -- A_Defining_Or_Operator, -- A_Defining_Xor_Operator, -- A_Defining_Equal_Operator, -- A_Defining_Not_Equal_Operator, -- A_Defining_Less_Than_Operator, -- A_Defining_Less_Than_Or_Equal_Operator, -- A_Defining_Greater_Than_Operator, -- A_Defining_Greater_Than_Or_Equal_Operator, -- A_Defining_Plus_Operator, -- A_Defining_Minus_Operator, -- A_Defining_Concatenate_Operator, -- A_Defining_Unary_Plus_Operator, -- A_Defining_Unary_Minus_Operator, -- A_Defining_Multiply_Operator, -- A_Defining_Divide_Operator, -- A_Defining_Mod_Operator, -- A_Defining_Rem_Operator, -- A_Defining_Exponentiate_Operator, -- A_Defining_Abs_Operator, A_Defining_Not_Operator => A_Defining_Operator_Symbol_Enclosing'Access, A_Defining_Expanded_Name => A_Defining_Expanded_Name_Enclosing'Access, -- ------------------------------------------------------------------------------- -- -- -- A_Declaration, -- Asis.Declarations -- ------------------------------------------------------------------------------- -- -- An_Ordinary_Type_Declaration, -- 3.2.1 -- A_Task_Type_Declaration, -- 3.2.1 -- A_Protected_Type_Declaration, -- 3.2.1 -- An_Incomplete_Type_Declaration, -- 3.2.1 -- A_Private_Type_Declaration, -- 3.2.1 -- A_Private_Extension_Declaration, -- 3.2.1 -- -- A_Subtype_Declaration, -- 3.2.2 -- -- A_Variable_Declaration, -- 3.3.1 -> Trait_Kinds A_Constant_Declaration => A_Constant_Declaration_Enclosing'Access, -- This is turned off, see G416-009 -- A_Deferred_Constant_Declaration, -- 3.3.1 -> Trait_Kinds -- A_Single_Task_Declaration, -- 3.3.1 -- A_Single_Protected_Declaration, -- 3.3.1 -- -- An_Integer_Number_Declaration, -- 3.3.2 -- A_Real_Number_Declaration, -- 3.3.2 -- An_Enumeration_Literal_Specification => An_Enumeration_Literal_Specification_Enclosing'Access, -- A_Discriminant_Specification => A_Discriminant_Specification_Enclosing'Access, -- -- A_Component_Declaration => A_Component_Declaration_Enclosing'Access, A_Component_Declaration => An_Expression_Enclosing'Access, -- A_Loop_Parameter_Specification => A_Loop_Parameter_Specification_Enclosing'Access, A_Generalized_Iterator_Specification .. An_Element_Iterator_Specification => A_Loop_Parameter_Specification_Enclosing'Access, -- A_Procedure_Declaration => Possible_C_U_Enclosing'Access, A_Function_Declaration => Possible_C_U_Enclosing'Access, -- A_Parameter_Specification => A_Parameter_Specification_Enclosing'Access, A_Procedure_Body_Declaration => Possible_C_U_Enclosing'Access, A_Function_Body_Declaration => Possible_C_U_Enclosing'Access, -- A_Package_Declaration => Possible_C_U_Enclosing'Access, A_Package_Body_Declaration => Possible_C_U_Enclosing'Access, -- -- An_Object_Renaming_Declaration, -- 8.5.1 -- An_Exception_Renaming_Declaration, -- 8.5.2 A_Package_Renaming_Declaration => Possible_C_U_Enclosing'Access, A_Procedure_Renaming_Declaration => Possible_C_U_Enclosing'Access, A_Function_Renaming_Declaration => Possible_C_U_Enclosing'Access, A_Generic_Package_Renaming_Declaration => Possible_C_U_Enclosing'Access, A_Generic_Procedure_Renaming_Declaration => Possible_C_U_Enclosing'Access, A_Generic_Function_Renaming_Declaration => Possible_C_U_Enclosing'Access, A_Task_Body_Declaration => Possible_C_U_Enclosing'Access, A_Protected_Body_Declaration => Possible_C_U_Enclosing'Access, -- An_Entry_Declaration => An_Expression_Enclosing'Access, -- for entry declarations, the problem is for single task declarations -- rewritten as anonymous task type declaration and task object declaration, -- that's why we have to use An_Expression_Enclosing -- An_Entry_Body_Declaration, -- 9.5.2 -- An_Entry_Index_Specification, -- 9.5.2 -- -- A_Procedure_Body_Stub, -- 10.1.3 -- A_Function_Body_Stub, -- 10.1.3 -- A_Package_Body_Stub, -- 10.1.3 -- A_Task_Body_Stub, -- 10.1.3 -- A_Protected_Body_Stub, -- 10.1.3 -- -- An_Exception_Declaration, -- 11.1 -- A_Choice_Parameter_Specification, -- 11.2 -- A_Generic_Procedure_Declaration => Possible_C_U_Enclosing'Access, A_Generic_Function_Declaration => Possible_C_U_Enclosing'Access, A_Generic_Package_Declaration => Possible_C_U_Enclosing'Access, A_Package_Instantiation => Possible_C_U_Enclosing'Access, A_Procedure_Instantiation => Possible_C_U_Enclosing'Access, A_Function_Instantiation => Possible_C_U_Enclosing'Access, -- -- A_Formal_Object_Declaration, -- 12.4 -> Mode_Kinds -- -- A_Formal_Type_Declaration, -- 12.5 -- A_Formal_Procedure_Declaration, -- 12.6 -> Default_Kinds -- -- A_Formal_Function_Declaration, -- 12.6 -> Default_Kinds -- -- A_Formal_Package_Declaration, -- 12.7 -- A_Formal_Package_Declaration_With_Box, -- 12.7 -- ------------------------------------------------------------------------------- -- -- -- A_Definition, -- Asis.Definitions -- ------------------------------------------------------------------------------- -- -- -- A_Type_Definition, -- 3.2.1 -> Type_Kinds -- -- A_Derived_Type_Definition, -- 3.4 -> Trait_Kinds -- A_Derived_Record_Extension_Definition, -- 3.4 -> Trait_Kinds -- An_Enumeration_Type_Definition => An_Enumeration_Type_Definition_Enclosing'Access, -- -- A_Signed_Integer_Type_Definition, -- 3.5.4 -- A_Modular_Type_Definition, -- 3.5.4 -- -- -- A_Root_Type_Definition, -- 3.5.4(10), 3.5.6(4) -- -- -> Root_Type_Kinds -- A_Root_Integer_Definition, -- 3.5.4(9) -- A_Root_Real_Definition, -- 3.5.6(2) -- A_Root_Fixed_Definition, -- 3.5.6(2) -- -- A_Universal_Integer_Definition, -- 3.5.4(10) -- A_Universal_Real_Definition, -- 3.5.6(4) -- A_Universal_Fixed_Definition, -- 3.5.6(4) -- -- -- A_Floating_Point_Definition, -- 3.5.7 -- -- An_Ordinary_Fixed_Point_Definition, -- 3.5.9 -- A_Decimal_Fixed_Point_Definition, -- 3.5.9 -- -- An_Unconstrained_Array_Definition, -- 3.6 -- A_Constrained_Array_Definition, -- 3.6 -- -- A_Record_Type_Definition, -- 3.8 -> Trait_Kinds -- A_Tagged_Record_Type_Definition, -- 3.8 -> Trait_Kinds -- -- -- An_Access_Type_Definition, -- 3.10 -> Access_Type_Kinds -- -- A_Pool_Specific_Access_To_Variable, -- An_Access_To_Variable, -- An_Access_To_Constant, -- -- An_Access_To_Procedure, -- An_Access_To_Protected_Procedure, -- An_Access_To_Function, -- An_Access_To_Protected_Function, -- -- A_Subtype_Indication => A_Subtype_Indication_Enclosing'Access, -- -- -- A_Constraint, -- 3.2.2 -> Constraint_Kinds -- A_Range_Attribute_Reference => A_Range_Attribute_Reference_Enclosing'Access, A_Simple_Expression_Range => A_Simple_Expression_Range_Enclosing'Access, -- A_Digits_Constraint, -- 3.2.2, 3.5.9 -- A_Delta_Constraint, -- 3.2.2, N.3 -- An_Index_Constraint => An_Index_Constraint_Enclosing'Access, An_Index_Constraint => An_Expression_Enclosing'Access, A_Discriminant_Constraint => An_Expression_Enclosing'Access, -- -- A_Component_Definition, -- 3.6 -- -- -- A_Discrete_Subtype_Definition, -- 3.6 -> Discrete_Range_Kinds -- -- A_Discrete_Subtype_Indication_As_Subtype_Definition, -- A_Discrete_Range_Attribute_Reference_As_Subtype_Definition, -- A_Discrete_Simple_Expression_Range_As_Subtype_Definition, -- -- -- A_Discrete_Range, -- 3.6.1 -> Discrete_Range_Kinds -- A_Discrete_Subtype_Indication => A_Discrete_Range_Enclosing'Access, A_Discrete_Range_Attribute_Reference => A_Discrete_Range_Enclosing'Access, A_Discrete_Simple_Expression_Range => A_Discrete_Range_Enclosing'Access, -- -- An_Unknown_Discriminant_Part => A_Discriminant_Part_Enclosing'Access, A_Known_Discriminant_Part => A_Discriminant_Part_Enclosing'Access, -- A_Record_Definition => A_Record_Definition_Enclosing'Access, A_Null_Record_Definition => A_Record_Definition_Enclosing'Access, -- A_Null_Component => A_Null_Component_Enclosing'Access, A_Variant_Part => A_Variant_Part_Enclosing'Access, -- A_Variant, -- 3.8 -- An_Others_Choice => An_Others_Choice_Enclosing'Access, -- A_Private_Type_Definition, -- 7.3 -> Trait_Kinds -- A_Tagged_Private_Type_Definition, -- 7.3 -> Trait_Kinds -- A_Private_Extension_Definition, -- 7.3 -> Trait_Kinds -- -- A_Task_Definition, -- 9.1 A_Protected_Definition => An_Expression_Enclosing'Access, -- -- -- A_Formal_Type_Definition, -- 12.5 -> Formal_Type_Kinds -- -- A_Formal_Private_Type_Definition, -- 12.5.1 -> Trait_Kinds -- A_Formal_Tagged_Private_Type_Definition, -- 12.5.1 -> Trait_Kinds -- -- A_Formal_Derived_Type_Definition, -- 12.5.1 -> Trait_Kinds -- -- A_Formal_Discrete_Type_Definition, -- 12.5.2 -- -- A_Formal_Signed_Integer_Type_Definition, -- 12.5.2 -- A_Formal_Modular_Type_Definition, -- 12.5.2 -- -- A_Formal_Floating_Point_Definition, -- 12.5.2 -- -- A_Formal_Ordinary_Fixed_Point_Definition, -- 12.5.2 -- A_Formal_Decimal_Fixed_Point_Definition, -- 12.5.2 -- -- A_Formal_Unconstrained_Array_Definition, -- 12.5.3 -- A_Formal_Constrained_Array_Definition, -- 12.5.3 -- -- -- A_Formal_Access_Type_Definition, -- -- A_Formal_Pool_Specific_Access_To_Variable, -- A_Formal_Access_To_Variable, -- A_Formal_Access_To_Constant, -- -- A_Formal_Access_To_Procedure, -- A_Formal_Access_To_Protected_Procedure, -- A_Formal_Access_To_Function, -- A_Formal_Access_To_Protected_Function, -- ------------------------------------------------------------------------------- -- -- -- An_Expression, -- Asis.Expressions -- ------------------------------------------------------------------------------- -- -- An_Integer_Literal .. -- -- A_Real_Literal, -- 2.4.1 -- A_String_Literal => A_Literal_Enclosing'Access, -- -- An_Identifier => An_Expression_Enclosing'Access, -- An_Identifier => An_Identifier_Enclosing'Access, -- -- -- ---- An_Operator_Symbol, -- 4.1 -- -- An_And_Operator .. -- -- An_Or_Operator, -- or -- -- An_Xor_Operator, -- xor -- -- An_Equal_Operator, -- = -- -- A_Not_Equal_Operator, -- /= -- -- A_Less_Than_Operator, -- < -- -- A_Less_Than_Or_Equal_Operator, -- <= -- -- A_Greater_Than_Operator, -- > -- -- A_Greater_Than_Or_Equal_Operator, -- >= -- -- A_Plus_Operator, -- + -- -- A_Minus_Operator, -- - -- -- A_Concatenate_Operator, -- & -- -- A_Unary_Plus_Operator, -- + -- -- A_Unary_Minus_Operator, -- - -- -- A_Multiply_Operator, -- * -- -- A_Divide_Operator, -- / -- -- A_Mod_Operator, -- mod -- -- A_Rem_Operator, -- rem -- -- An_Exponentiate_Operator, -- ** -- -- An_Abs_Operator, -- abs -- A_Not_Operator => An_Operator_Symbol_Enclosing'Access, -- ??? Do we need An_Operator_Symbol_Enclosing??? A_Not_Operator => An_Expression_Enclosing'Access, -- -- A_Character_Literal .. -- -- An_Enumeration_Literal, -- 4.1 -- -- An_Explicit_Dereference, -- 4.1 -- -- A_Function_Call => A_Function_Call_Enclosing'Access, -- -- -- -- An_Indexed_Component, -- 4.1.1 -- -- A_Slice, -- 4.1.2 -- A_Selected_Component => An_Identifier_Enclosing'Access, -- -- -- -- An_Attribute_Reference, -- 4.1.4 -> Attribute_Kinds -- -- -- An_Access_Attribute .. -- -- An_Address_Attribute, -- -- An_Adjacent_Attribute, -- -- An_Aft_Attribute, -- -- An_Alignment_Attribute, -- -- A_Base_Attribute, -- -- A_Bit_Order_Attribute, -- -- A_Body_Version_Attribute, -- -- A_Callable_Attribute, -- -- A_Caller_Attribute, -- -- A_Ceiling_Attribute, -- -- A_Class_Attribute, -- -- A_Component_Size_Attribute, -- -- A_Compose_Attribute, -- -- A_Constrained_Attribute, -- -- A_Copy_Sign_Attribute, -- -- A_Count_Attribute, -- -- A_Definite_Attribute, -- -- A_Delta_Attribute, -- -- A_Denorm_Attribute, -- -- A_Digits_Attribute, -- -- An_Exponent_Attribute, -- -- An_External_Tag_Attribute, -- -- A_First_Attribute, -- -- A_First_Bit_Attribute, -- -- A_Floor_Attribute, -- -- A_Fore_Attribute, -- -- A_Fraction_Attribute, -- -- An_Identity_Attribute, -- -- An_Image_Attribute, -- -- An_Input_Attribute, -- -- A_Last_Attribute, -- -- A_Last_Bit_Attribute, -- -- A_Leading_Part_Attribute, -- -- A_Length_Attribute, -- -- A_Machine_Attribute, -- -- A_Machine_Emax_Attribute, -- -- A_Machine_Emin_Attribute, -- -- A_Machine_Mantissa_Attribute, -- -- A_Machine_Overflows_Attribute, -- -- A_Machine_Radix_Attribute, -- -- A_Machine_Rounds_Attribute, -- -- A_Max_Attribute, -- -- A_Max_Size_In_Storage_Elements_Attribute, -- -- A_Min_Attribute, -- -- A_Model_Attribute, -- -- A_Model_Emin_Attribute, -- -- A_Model_Epsilon_Attribute, -- -- A_Model_Mantissa_Attribute, -- -- A_Model_Small_Attribute, -- -- A_Modulus_Attribute, -- -- An_Output_Attribute, -- -- A_Partition_ID_Attribute, -- -- A_Pos_Attribute, -- -- A_Position_Attribute, -- A_Pred_Attribute => An_Attribute_Reference_Enclosing'Access, -- -- A_Range_Attribute => A_Range_Attribute_Enclosing'Access, -- -- A_Read_Attribute .. -- -- A_Remainder_Attribute, -- -- A_Round_Attribute, -- -- A_Rounding_Attribute, -- -- A_Safe_First_Attribute, -- -- A_Safe_Last_Attribute, -- -- A_Scale_Attribute, -- -- A_Scaling_Attribute, -- -- A_Signed_Zeros_Attribute, -- -- A_Size_Attribute, -- -- A_Small_Attribute, -- -- A_Storage_Pool_Attribute, -- -- A_Storage_Size_Attribute, -- -- -- -- A_Succ_Attribute, -- -- A_Tag_Attribute, -- -- A_Terminated_Attribute, -- -- A_Truncation_Attribute, -- -- An_Unbiased_Rounding_Attribute, -- -- An_Unchecked_Access_Attribute, -- -- A_Val_Attribute, -- -- A_Valid_Attribute, -- -- A_Value_Attribute, -- -- A_Version_Attribute, -- -- A_Wide_Image_Attribute, -- -- A_Wide_Value_Attribute, -- -- A_Wide_Width_Attribute, -- -- A_Width_Attribute, -- -- A_Write_Attribute, -- -- -- -- An_Implementation_Defined_Attribute, -- Vendor Annex M -- An_Unknown_Attribute => An_Attribute_Reference_Enclosing'Access, -- -- -- -- A_Record_Aggregate, -- 4.3 -- -- An_Extension_Aggregate, -- 4.3 -- -- A_Positional_Array_Aggregate, -- 4.3 -- -- A_Named_Array_Aggregate, -- 4.3 -- -- -- -- An_And_Then_Short_Circuit, -- 4.4 -- -- An_Or_Else_Short_Circuit, -- 4.4 -- -- -- -- An_In_Range_Membership_Test, -- 4.4 -- -- A_Not_In_Range_Membership_Test, -- 4.4 -- -- An_In_Type_Membership_Test, -- 4.4 -- -- A_Not_In_Type_Membership_Test, -- 4.4 -- -- -- -- A_Null_Literal, -- 4.4 -- -- A_Parenthesized_Expression, -- 4.4 -- -- -- -- A_Type_Conversion, -- 4.6 -- -- A_Qualified_Expression, -- 4.7 -- -- -- -- An_Allocation_From_Subtype, -- 4.8 -- -- An_Allocation_From_Qualified_Expression, -- 4.8 -- A_Case_Expression, -- Ada 2012 -- An_If_Expression, -- Ada 2012 -- A_For_All_Quantified_Expression, -- Ada 2012 -- A_For_Some_Quantified_Expression); -- Ada 2012 A_For_Some_Quantified_Expression => An_Expression_Enclosing'Access, ------------------------------------------------------------------------------- -- -- -- An_Association, -- Asis.Expressions -- ------------------------------------------------------------------------------- -- -- A_Pragma_Argument_Association, -- 2.8 A_Discriminant_Association => An_Expression_Enclosing'Access, -- A_Record_Component_Association, -- 4.3.1 An_Array_Component_Association => An_Expression_Enclosing'Access, A_Parameter_Association .. A_Generic_Association => An_Association_Enclosing'Access, -- ------------------------------------------------------------------------------- -- -- -- A_Statement, -- Asis.Statements -- ------------------------------------------------------------------------------- -- A_Null_Statement .. -- An_Assignment_Statement, -- 5.2 -- An_If_Statement, -- 5.3 -- A_Case_Statement, -- 5.4 -- -- A_Loop_Statement, -- 5.5 -- A_While_Loop_Statement, -- 5.5 -- A_For_Loop_Statement, -- 5.5 -- -- A_Block_Statement, -- 5.6 -- An_Exit_Statement, -- 5.7 -- A_Goto_Statement, -- 5.8 -- -- A_Procedure_Call_Statement, -- 6.4 -- A_Return_Statement, -- 6.5 -- -- An_Accept_Statement, -- 9.5.2 -- An_Entry_Call_Statement, -- 9.5.3 -- -- A_Requeue_Statement, -- 9.5.4 -- A_Requeue_Statement_With_Abort, -- 9.5.4 -- -- A_Delay_Until_Statement, -- 9.6 A_Delay_Relative_Statement => A_Statement_Enclosing'Access, -- A_Terminate_Alternative_Statement => A_Terminate_Alternative_Statement_Enclosing'Access, -- A_Selective_Accept_Statement .. -- A_Timed_Entry_Call_Statement, -- 9.7.3 -- A_Conditional_Entry_Call_Statement, -- 9.7.3 -- An_Asynchronous_Select_Statement, -- 9.7.4 -- -- An_Abort_Statement, -- 9.8 -- A_Raise_Statement, -- 11.3 A_Code_Statement => A_Statement_Enclosing'Access, -- ------------------------------------------------------------------------------- -- Path_Kinds -- Literals -- RM 95 ------------------------------------------------------------------------------ -- -- An_If_Path, -- An_Elsif_Path, -- An_Else_Path => An_Else_Path_Enclosing'Access, -- -- A_Case_Path, -- -- when discrete_choice_list => -- -- sequence_of_statements -- -- A_Select_Path, -- -- select [guard] select_alternative -- -- 9.7.2, 9.7.3: -- -- select entry_call_alternative -- -- 9.7.4: -- -- select triggering_alternative -- -- An_Or_Path, -- -- or [guard] select_alternative 9.7.2: -- -- or delay_alternative -- -- A_Then_Abort_Path, -- 9.7.4 -- -- then abort sequence_of_statements -- -- ------------------------------------------------------------ -- An_Expression_Path, -- Asis.Expressions Ada 2015 ------------------------------------------------------------ An_If_Expression_Path .. -- An_Elsif_Expression_Path, An_Else_Expression_Path => An_Expression_Enclosing'Access, ------------------------------------------------------------------------------- -- -- -- A_Clause, -- Asis.Clauses -- ------------------------------------------------------------------------------- -- A_Use_Package_Clause => Possible_C_U_Enclosing'Access, -- 8.4 A_Use_Type_Clause => Possible_C_U_Enclosing'Access, -- 8.4 A_Use_All_Type_Clause => Possible_C_U_Enclosing'Access, -- 8.4 Ada 2012 -- -- A_With_Clause, -- 10.1.2 -- -- -- A_Representation_Clause, -- 13.1 -> Representation_Clause_Kinds -- An_Attribute_Definition_Clause => An_Attribute_Definition_Clause_Enclosing'Access, -- An_Enumeration_Representation_Clause, -- 13.4 -- A_Record_Representation_Clause, -- 13.5.3 -- An_At_Clause, -- N.7 -- -- -- A_Component_Clause, -- 13.5.3 -- ------------------------------------------------------------------------------- -- An_Exception_Handler => An_Exception_Handler_Enclosing'Access, -- ------------------------------------------------------------------------------- -- -- Special values added for Node -> Element switching, -- -- see Asis_Vendor_Primitives.GNAT_to_Asis_Mapping body for -- -- more details ------------------------------------------------------------------------------- -- -- Non_Trivial_Mapping, -- Not_Implemented_Mapping, -- No_Mapping -- others => Not_Implemented_Enclosing_Element_Construction'Access); ------------------------------------------------------ -- Section 4 - (general-purpose) local subprograms -- ------------------------------------------------------ procedure Skip_Implicit_Subtype (Constr : in out Node_Id); -- Supposing that Constr is a constraint, this procedure checks if the -- parent node for it points to implicit subtype created in case if -- this constraint is used directly in object declaration, and if -- so, resets Constr to point to the constraint from the object -- declaration function Parent (Node : Node_Id) return Node_Id; -- this function is the modification of Atree.Parent. It is able -- to deal in the "ASIS mode" with the sequences of one-identifier -- declarations/with clauses resulting from the normalization of -- multi-name declarations/with clauses which is done by the -- compiler function General_Encl_Elem (Element : Asis.Element) return Asis.Element; -- Computes Enclosing_Element for most common cases procedure No_Enclosing_Element (Element_Kind : Internal_Element_Kinds); -- Should be called only in erroneous situations, when no Enclosing_Element -- can correspond to a given Element. Raises ASIS_Failed with the -- corresponding Diagnosis procedure Not_Implemented_Enclosing_Element_Construction (Element : Asis.Element); -- Generates Element-specific diagnosis about non-implemented case function Is_Top_Of_Expanded_Generic (N : Node_Id) return Boolean; -- Checks if N is the top node of the tree structure corresponding to -- expanded generic spec or body function Get_Rough_Enclosing_Node (Element : Asis.Element) return Node_Id; -- This function finds the node, which is the base for a "rough" -- enclosing element for the argument Element. Starting from the -- argument R_Node, we go up through the chain of Parent nodes -- till the first node, which is a member of some Node_List or to the node -- representing the unit declaration in a compilation unit function Get_Enclosing (Approximation : Asis.Element; Element : Asis.Element) return Asis.Element; -- This function finds the Enclosing Element for Element by traversing -- Approximation which is considered as a rough estimation for -- enclosing element. procedure Skip_Normalized_Declarations_Back (Node : in out Node_Id); -- this procedure is applied in case when the compiler may normalize a -- multi-identifier declaration (or multi-name with clause) in a set of -- equivalent one-identifier (one-name) declarations (clauses). It is -- intended to be called for Node representing any declaration -- (clause) in this normalized sequence, and it resets its parameter -- to point to the first declaration (clause) in this sequence -- -- There is no harm to call this procedure for Node which does not -- represent a normalized declaration (or even which does not represent -- any declaration at all), or for Node which represents the first -- declaration in a normalized chain - the procedure simply leaves -- its parameter intact. -- -- (In some sense this procedure may be considered as an "inversion -- of the local procedure Skip_Normalized_Declarations defined in -- the body of the A4G.Mapping package) --------------------------------------------------------------- -- Section 5 - bodies of the routines declared in Section 2 -- --------------------------------------------------------------- -------------------------------------- -- A_Constant_Declaration_Enclosing -- -------------------------------------- function A_Constant_Declaration_Enclosing (Element : Asis.Element) return Asis.Element is Result : Asis.Element := General_Encl_Elem (Element); Res_Node : Node_Id; begin -- The problem with constant declarations exists for a declarations -- created by the front-end to pass the actual expressions for generic -- IN parameters, see EC16-004 and EC22-007 Res_Node := Node (Element); if Present (Corresponding_Generic_Association (Res_Node)) then Res_Node := Parent (Res_Node); if No (Generic_Parent (Res_Node)) then -- This IF statement prevents us from doing this special -- processing for expanded package declarations, we have to do it -- only for wrapper packages created for subprogram instantiation Res_Node := Parent (Res_Node); Res_Node := Corresponding_Body (Res_Node); Res_Node := Parent (Res_Node); Res_Node := First (Sinfo.Declarations (Res_Node)); while Nkind (Res_Node) /= N_Subprogram_Body loop Res_Node := Next (Res_Node); end loop; Result := Node_To_Element_New (Node => Res_Node, Starting_Element => Element); end if; end if; return Result; end A_Constant_Declaration_Enclosing; ---------------------------------------- -- A_Defining_Expanded_Name_Enclosing -- --------------------------------------- function A_Defining_Expanded_Name_Enclosing (Element : Asis.Element) return Asis.Element is Parent_Node : Node_Id := Parent (R_Node (Element)); Parent_Node_Kind : constant Node_Kind := Nkind (Parent_Node); begin if Parent_Node_Kind = N_Function_Specification or else Parent_Node_Kind = N_Procedure_Specification or else Parent_Node_Kind = N_Package_Specification then -- one more step up required Parent_Node := Parent (Parent_Node); end if; return Node_To_Element_New (Node => Parent_Node, Starting_Element => Element); end A_Defining_Expanded_Name_Enclosing; ------------------------------------- -- A_Defining_Identifier_Enclosing -- ------------------------------------- function A_Defining_Identifier_Enclosing (Element : Asis.Element) return Asis.Element is -- A_Defining_Identifier may be processed just in the same way as -- A_Defining_Expanded_Name, except the following cases: -- - A_Defining_Identifier obtained as the child of -- A_Choice_Parameter_Specification element (by means of Names -- query) - both these elements are based on the same -- N_Defining_Identifier node -- -- - A_Defining_Identifier representing a statement label, it is -- obtained by means of Label_Names query, and it is based on -- N_Label node which is the member of the node list representing -- the corresponding statement sequence (or it can be based on -- N_Identifier node in case if the front-end rewrites a sequence of -- statement implementing the infinite loop by goto into -- N_Loop_Statement node. The Enclosing_Element of such -- A_Defining_Name element will be the statement labeled by it, see -- Asis_Statements.Label_Names. -- -- - A_Defining_Identifier representing a statement identifier, it is -- obtained by means of Statement_Identifier query, and it is based -- on N_Identifier node. The Enclosing_Element of the name is the -- named statement, see Asis_Statements.Statement_Identifier. But -- there is no difference in computing the Enclosing Element -- (compared to A_Defining_Expanded_Name) in this case. -- -- - A special processing is needed for a formal package defining name -- -- - A_Defining_Identifier is from a single task/protected declaration Parent_Node : Node_Id := Parent (R_Node (Element)); Parent_Node_Kind : constant Node_Kind := Nkind (Parent_Node); Result_Kind : Internal_Element_Kinds := Not_An_Element; begin if Nkind (Node (Element)) = N_Label then Parent_Node := Next (R_Node (Element)); -- R_Node (Element) definitely is a list member while not Is_Statement (Parent_Node) loop Parent_Node := Next (Parent_Node); end loop; elsif Nkind (Node (Element)) = N_Identifier and then Parent_Node_Kind = N_Loop_Statement and then Is_Rewrite_Substitution (Parent_Node) and then Nkind (Original_Node (Parent_Node)) = N_Goto_Statement then if Is_Empty_List (Sinfo.Statements (Parent_Node)) then -- Pathological case of -- -- <<Target>> goto target; Result_Kind := A_Goto_Statement; else Parent_Node := First (Sinfo.Statements (Parent_Node)); end if; elsif Parent_Node_Kind = N_Exception_Handler then Parent_Node := R_Node (Element); Result_Kind := A_Choice_Parameter_Specification; elsif Nkind (Parent_Node) = N_Generic_Package_Declaration and then Nkind (Original_Node (Parent_Node)) = N_Formal_Package_Declaration and then R_Node (Element) = Defining_Identifier (Original_Node (Parent_Node)) then -- A formal package with a box (but not its expanded spec!) Result_Kind := A_Formal_Package_Declaration_With_Box; elsif not Comes_From_Source (Parent_Node) and then Nkind (Parent_Node) = N_Object_Declaration and then Present (Etype (R_Node (Element))) and then Ekind (Etype (R_Node (Element))) in E_Task_Type .. E_Protected_Type then -- The case of a single task/protected definition - the problem here -- is that Parent field of the argument node points into artificial -- object declaration, see G214-005 Parent_Node := Etype (R_Node (Element)); if Ekind (Parent_Node) = E_Protected_Type then Result_Kind := A_Single_Protected_Declaration; else Result_Kind := A_Single_Task_Declaration; end if; Parent_Node := Parent (Parent_Node); else return A_Defining_Expanded_Name_Enclosing (Element); end if; return Node_To_Element_New (Node => Parent_Node, Internal_Kind => Result_Kind, Starting_Element => Element); end A_Defining_Identifier_Enclosing; ------------------------------------------ -- A_Defining_Operator_Symbol_Enclosing -- ------------------------------------------ function A_Defining_Operator_Symbol_Enclosing (Element : Asis.Element) return Asis.Element is Parent_Node : Node_Id := Parent (R_Node (Element)); Parent_Node_Kind : constant Node_Kind := Nkind (Parent_Node); begin if Parent_Node_Kind = N_Function_Specification then -- one more step up required Parent_Node := Parent (Parent_Node); end if; return Node_To_Element_New (Node => Parent_Node, Starting_Element => Element); end A_Defining_Operator_Symbol_Enclosing; -------------------------------- -- A_Discrete_Range_Enclosing -- -------------------------------- function A_Discrete_Range_Enclosing (Element : Asis.Element) return Asis.Element is Result_Node : Node_Id := Parent (R_Node (Element)); Result_Node_Kind : constant Node_Kind := Nkind (Result_Node); Result_Elem_Kind : Internal_Element_Kinds := Not_An_Element; begin if not Comes_From_Source (Result_Node) or else not Comes_From_Source (Parent (Result_Node)) then return An_Expression_Enclosing (Element); end if; if Nkind (Node (Element)) = N_Component_Clause then Result_Node := R_Node (Element); Result_Elem_Kind := A_Component_Clause; elsif Result_Node_Kind = N_Component_Association then Result_Elem_Kind := An_Array_Component_Association; end if; return Node_To_Element_New (Starting_Element => Element, Node => Result_Node, Internal_Kind => Result_Elem_Kind, Considering_Parent_Count => False); end A_Discrete_Range_Enclosing; ----------------------------------- -- A_Discriminant_Part_Enclosing -- ----------------------------------- function A_Discriminant_Part_Enclosing (Element : Asis.Element) return Asis.Element is begin return Node_To_Element_New (Node => R_Node (Element), Starting_Element => Element); end A_Discriminant_Part_Enclosing; -------------------------------------------- -- A_Discriminant_Specification_Enclosing -- -------------------------------------------- function A_Discriminant_Specification_Enclosing (Element : Asis.Element) return Asis.Element is begin return Node_To_Element_New ( Node => Parent (R_Node (Element)), Internal_Kind => A_Known_Discriminant_Part, Starting_Element => Element); end A_Discriminant_Specification_Enclosing; ---------------------------------------------- -- A_Loop_Parameter_Specification_Enclosing -- ---------------------------------------------- function A_Loop_Parameter_Specification_Enclosing (Element : Asis.Element) return Asis.Element is Result_Node : Node_Id; Tmp : Node_Id; Result : Asis.Element; begin Result_Node := Parent (R_Node (Element)); if Nkind (Result_Node) /= N_Quantified_Expression then -- We have got to N_Ineration_Sceme node only Result_Node := Parent (Result_Node); end if; if Declaration_Kind (Element) in A_Generalized_Iterator_Specification .. An_Element_Iterator_Specification then -- Here we may have to get to an artificial block statement the -- needed loop node is rewritten into Tmp := Parent (Parent (Result_Node)); if Nkind (Tmp) = N_Block_Statement and then Is_Rewrite_Substitution (Tmp) and then Nkind (Original_Node (Tmp)) = N_Loop_Statement then Result_Node := Tmp; end if; end if; Result := Node_To_Element_New (Node => Result_Node, Starting_Element => Element); if Int_Kind (Result) = A_Parenthesized_Expression then -- This is the case when an iteration scheme is used in a -- conditional or quantified expression. We go in bottom-up -- direction, so we can have A_Parenthesized_Expression only as the -- next enclosing Element Result := An_Expression_Enclosing (Element); end if; return Result; end A_Loop_Parameter_Specification_Enclosing; -------------------------------- -- A_Null_Component_Enclosing -- -------------------------------- function A_Null_Component_Enclosing (Element : Asis.Element) return Asis.Element is Parent_Node : constant Node_Id := Node (Element); Parent_Internal_Kind : Internal_Element_Kinds; begin if Nkind (Parent_Node) = N_Record_Definition then Parent_Internal_Kind := A_Record_Definition; else Parent_Internal_Kind := A_Variant; end if; return Node_To_Element_New (Node => Parent_Node, Internal_Kind => Parent_Internal_Kind, Starting_Element => Element); end A_Null_Component_Enclosing; ----------------------------------------- -- A_Parameter_Specification_Enclosing -- ----------------------------------------- function A_Parameter_Specification_Enclosing (Element : Asis.Element) return Asis.Element is Result_Node : Node_Id := Parent (R_Node (Element)); Result_Node_Kind : constant Node_Kind := Nkind (Result_Node); begin if not (Result_Node_Kind = N_Entry_Declaration or else Result_Node_Kind = N_Access_Function_Definition or else Result_Node_Kind = N_Access_Procedure_Definition or else Result_Node_Kind = N_Accept_Statement) -- --|A2005 start or else (Nkind (Parent (Result_Node)) = N_Identifier and then Is_Rewrite_Substitution (Parent (Result_Node)) and then Nkind (Original_Node (Parent (Result_Node))) = N_Access_Definition) or else Nkind (Parent (Result_Node)) = N_Access_Definition -- --|A2005 end then Result_Node := Parent (Result_Node); -- the first Parent gives N_Function/Procedure_Specification only end if; return Node_To_Element_New (Starting_Element => Element, Node => Result_Node, Considering_Parent_Count => False); end A_Parameter_Specification_Enclosing; ------------------------ -- A_Pragma_Enclosing -- ------------------------ function A_Pragma_Enclosing (Element : Asis.Element) return Asis.Element is Parent_Node : Node_Id := Atree.Parent (R_Node (Element)); Parent_Node_Kind : Node_Kind := Nkind (Parent_Node); Parent_Internal_Kind : Internal_Element_Kinds; begin if Parent_Node_Kind = N_Loop_Statement and then Is_Rewrite_Substitution (Parent_Node) and then Nkind (Original_Node (Parent_Node)) = N_Goto_Statement then -- This is the case when infinite loop implemented as -- -- <<Target>> ... -- ... -- goto Target; -- -- is rewritten into N_Loop_Statement Parent_Node := Parent (Parent_Node); Parent_Node_Kind := Nkind (Parent_Node); end if; -- filtering out compilation pragmas and correcting Parent_Node, -- if necessary case Parent_Node_Kind is when N_Handled_Sequence_Of_Statements | N_Package_Specification | N_Component_List => Parent_Node := Atree.Parent (Parent_Node); Parent_Node_Kind := Nkind (Parent_Node); when N_Compilation_Unit => return Asis.Nil_Element; when others => null; end case; -- special processing for Nodes requiring by-hand Enclosing Element -- kind determination and returning the result for all other Nodes case Parent_Node_Kind is when N_If_Statement => if List_Containing (R_Node (Element)) = Then_Statements (Parent_Node) then Parent_Internal_Kind := An_If_Path; else Parent_Internal_Kind := An_Else_Path; end if; -- ??? List_Containing (Node (Element)) ?? -- ??? or List_Containing (R_Node (Element)) ?? when N_Conditional_Entry_Call | N_Selective_Accept => Parent_Internal_Kind := An_Else_Path; when N_Record_Definition => Parent_Internal_Kind := An_Else_Path; when others => -- auto determination of the Enclosing Element kind: return Node_To_Element_New (Node => Parent_Node, Starting_Element => Element); end case; -- returning the Enclosing Element with the by-hand-defined kind: return Node_To_Element_New (Node => Parent_Node, Internal_Kind => Parent_Internal_Kind, Starting_Element => Element); end A_Pragma_Enclosing; ------------------------------------------- -- A_Range_Attribute_Reference_Enclosing -- ------------------------------------------- function A_Range_Attribute_Reference_Enclosing (Element : Asis.Element) return Asis.Element is Result_Node : Node_Id := Parent (R_Node (Element)); Tmp : Node_Id := Parent (Result_Node); begin if Nkind (Result_Node) = N_Subtype_Indication and then Nkind (Tmp) = N_Subtype_Declaration and then not Comes_From_Source (Tmp) then -- This N_Subtype_Declaration is from the tree structure created -- for an artificial subtype declaration, see C208-003 Tmp := Next (Tmp); Result_Node := Object_Definition (Tmp); end if; return Node_To_Element_New (Starting_Element => Element, Node => Result_Node, Considering_Parent_Count => False); end A_Range_Attribute_Reference_Enclosing; ----------------------------------- -- A_Record_Definition_Enclosing -- ----------------------------------- function A_Record_Definition_Enclosing (Element : Asis.Element) return Asis.Element is Parent_Node : Node_Id; Parent_Internal_Kind : Internal_Element_Kinds; begin if Nkind (Parent (R_Node (Element))) = N_Derived_Type_Definition then Parent_Node := Parent (R_Node (Element)); Parent_Internal_Kind := A_Derived_Record_Extension_Definition; else Parent_Node := Node (Element); if Tagged_Present (Parent_Node) then Parent_Internal_Kind := A_Tagged_Record_Type_Definition; else Parent_Internal_Kind := A_Record_Type_Definition; end if; end if; return Node_To_Element_New (Node => Parent_Node, Internal_Kind => Parent_Internal_Kind, Starting_Element => Element); end A_Record_Definition_Enclosing; ----------------------------------------- -- A_Simple_Expression_Range_Enclosing -- ---------------------------------------- function A_Simple_Expression_Range_Enclosing (Element : Asis.Element) return Asis.Element is Enclosing_Node : Node_Id := Node (Element); Enclosing_Node_Kind : Node_Kind := Nkind (Enclosing_Node); Context : Node_Id; Context_Kind : Node_Kind; Enclosing_Element_Kind : Internal_Element_Kinds; begin if Enclosing_Node_Kind = N_Signed_Integer_Type_Definition then -- back from Integer_Constraint return Node_To_Element_New (Starting_Element => Element, Node => R_Node (Element), Internal_Kind => A_Signed_Integer_Type_Definition, Considering_Parent_Count => False); else -- one step up Enclosing_Node := Parent (R_Node (Element)); Enclosing_Node_Kind := Nkind (Enclosing_Node); -- possible values of corresponding kinds of -- Enclosing_Node_Kind: Enclosing Element: -- -- N_Floating_Point_Definition A_Floating_Point_Definition (*) -- N_Ordinary_Fixed_Point_Definition An_Ordinary_Fixed_Point_Definition (*) -- N_Decimal_Fixed_Point_Definition A_Decimal_Fixed_Point_Definition (*) -- -- A_Constraint -- N_Digits_Constraint A_Digits_Constraint (*) -- N_Delta_Constraint A_Delta_Constraint (*) -- -- -- A_Subtype_Indication -- N_Subtype_Indication A_Discrete_Subtype_Indication -- (_As_Subtype_Definition) -- A_Subtype_Indication -- -- A_Discrete_Range -- N_Subtype_Indication A_Discrete_Subtype_Indication -- -- -- -- N_In An_In_Range_Membership_Test (*) -- N_Not_In A_Not_In_Range_Membership_Test (*) -- -- (*) means that the Enclosing Element can be obtained by Node_To_Elemen -- constructor with auto determination of the Element kind if Enclosing_Node_Kind /= N_Subtype_Indication then return Node_To_Element_New (Starting_Element => Element, Node => Enclosing_Node, Considering_Parent_Count => False); else -- A_Discrete_Subtype_Indication or -- A_Discrete_Subtype_Indication_As_Subtype_Definition -- or A_Subtype_Indication? -- First, we have to skip implicit subtype created for -- constraint directly included in object declaration, -- if any Skip_Implicit_Subtype (Enclosing_Node); Context := Parent (Enclosing_Node); Context_Kind := Nkind (Context); if Context_Kind = N_Subtype_Indication then -- it's impossible to make a decision on the base -- of this node, we shall go one more step up Context := Parent (Context); Context_Kind := Nkind (Context); end if; if Context_Kind = N_Subtype_Declaration or else ((Context_Kind = N_Constrained_Array_Definition or else Context_Kind = N_Unconstrained_Array_Definition) and then Enclosing_Node = Sinfo.Component_Definition (Context)) or else -- is it enough or should we add: -- and then Enclosing_Node = Subtype_Indication (Context)? Context_Kind = N_Derived_Type_Definition or else Context_Kind = N_Access_To_Object_Definition then Enclosing_Element_Kind := A_Subtype_Indication; elsif Context_Kind = N_Constrained_Array_Definition or else Context_Kind = N_Entry_Declaration or else Context_Kind = N_Entry_Index_Specification or else Context_Kind = N_Loop_Parameter_Specification then Enclosing_Element_Kind := A_Discrete_Subtype_Indication_As_Subtype_Definition; elsif Context_Kind = N_Component_Declaration or else Context_Kind = N_Object_Declaration or else Context_Kind = N_Component_Definition then Enclosing_Element_Kind := A_Subtype_Indication; else Enclosing_Element_Kind := A_Discrete_Subtype_Indication; end if; return Node_To_Element_New (Starting_Element => Element, Node => Enclosing_Node, Internal_Kind => Enclosing_Element_Kind, Considering_Parent_Count => False); end if; end if; end A_Simple_Expression_Range_Enclosing; --------------------------- -- A_Statement_Enclosing -- --------------------------- function A_Statement_Enclosing (Element : Asis.Element) return Asis.Element is Parent_Node : Node_Id := Parent (R_Node (Element)); Parent_Node_Kind : Node_Kind := Nkind (Parent_Node); Parent_Internal_Kind : Internal_Element_Kinds; begin if Parent_Node_Kind = N_Loop_Statement and then Is_Rewrite_Substitution (Parent_Node) and then Nkind (Original_Node (Parent_Node)) = N_Goto_Statement then -- This is the case when infinite loop implemented as -- -- <<Target>> ... -- ... -- goto Target; -- -- is rewritten into N_Loop_Statement Parent_Node := Parent (Parent_Node); Parent_Node_Kind := Nkind (Parent_Node); end if; if Parent_Node_Kind = N_If_Statement then if List_Containing (R_Node (Element)) = Then_Statements (Parent_Node) then Parent_Internal_Kind := An_If_Path; else Parent_Internal_Kind := An_Else_Path; end if; -- ??? List_Containing (Node (Element)) ?? -- ?? or List_Containing (R_Node (Element)) ?? elsif Parent_Node_Kind = N_Conditional_Entry_Call or else Parent_Node_Kind = N_Selective_Accept then Parent_Internal_Kind := An_Else_Path; else if Parent_Node_Kind = N_Handled_Sequence_Of_Statements then -- to go to N_Block_Statement, N_Accept_Statement, -- N_Subprogram_Body, N_Package_Body, N_Task_Body or -- N_Entry_Body node Parent_Node := Parent (Parent_Node); end if; return Node_To_Element_New (Node => Parent_Node, Starting_Element => Element); end if; return Node_To_Element_New (Node => Parent_Node, Internal_Kind => Parent_Internal_Kind, Starting_Element => Element); end A_Statement_Enclosing; ------------------------------------ -- A_Subtype_Indication_Enclosing -- ------------------------------------ function A_Subtype_Indication_Enclosing (Element : Asis.Element) return Asis.Element is Parent_Node : Node_Id := Parent (R_Node (Element)); Result_Node : Node_Id := R_Node (Element); Parent_Node_Kind : constant Node_Kind := Nkind (Parent_Node); Result_Kind : Internal_Element_Kinds; begin if Parent_Node_Kind = N_Component_Definition then Parent_Node := Parent (Parent_Node); -- This skips the normalized component declarations back! Parent_Node := Sinfo.Component_Definition (Parent_Node); end if; if Parent_Node_Kind = N_Allocator and then Nkind (Parent (Parent_Node)) = N_Component_Association and then not Comes_From_Source (Parent (Parent_Node)) then return An_Expression_Enclosing (Element); end if; if Parent_Node_Kind = N_Unconstrained_Array_Definition or else Parent_Node_Kind = N_Constrained_Array_Definition or else Parent_Node_Kind = N_Component_Declaration then Result_Kind := A_Component_Definition; elsif Parent_Node_Kind = N_Private_Extension_Declaration then Result_Kind := A_Private_Extension_Definition; Result_Node := Parent_Node; else return Node_To_Element_New (Starting_Element => Element, Node => Parent_Node, Considering_Parent_Count => False); end if; return Node_To_Element_New (Starting_Element => Element, Node => Result_Node, Internal_Kind => Result_Kind, Considering_Parent_Count => False); end A_Subtype_Indication_Enclosing; ------------------------------------------------- -- A_Terminate_Alternative_Statement_Enclosing -- ------------------------------------------------- function A_Terminate_Alternative_Statement_Enclosing (Element : Asis.Element) return Asis.Element is begin return Node_To_Element_New (Node => R_Node (Element), Starting_Element => Element); end A_Terminate_Alternative_Statement_Enclosing; ------------------------------ -- A_Variant_Part_Enclosing -- ------------------------------ function A_Variant_Part_Enclosing (Element : Asis.Element) return Asis.Element is Result_Node : constant Node_Id := Parent (Parent (R_Node (Element))); Result_Kind : Internal_Element_Kinds; begin if Nkind (Result_Node) = N_Record_Definition then Result_Kind := A_Record_Definition; else Result_Kind := A_Variant; end if; return Node_To_Element_New (Starting_Element => Element, Node => Result_Node, Internal_Kind => Result_Kind, Considering_Parent_Count => False); end A_Variant_Part_Enclosing; ------------------------------ -- An_Association_Enclosing -- ------------------------------ function An_Association_Enclosing (Element : Asis.Element) return Asis.Element is Result : Asis.Element; begin if Normalization_Case (Element) = Is_Not_Normalized then Result := An_Expression_Enclosing (Element); else Result := Node_To_Element_New (Node => R_Node (Element), Starting_Element => Element); Set_From_Implicit (Result, False); end if; return Result; end An_Association_Enclosing; ---------------------------------------------- -- An_Attribute_Definition_Clause_Enclosing -- ---------------------------------------------- function An_Attribute_Definition_Clause_Enclosing (Element : Asis.Element) return Asis.Element is Result_Node : Node_Id := Parent (R_Node (Element)); Result_Node_Kind : Node_Kind := Nkind (Result_Node); Result_Kind : Internal_Element_Kinds := Not_An_Element; begin if Result_Node_Kind = N_Component_List or else Result_Node_Kind = N_Package_Specification then Result_Node := Parent (Result_Node); Result_Node_Kind := Nkind (Result_Node); end if; if Result_Node_Kind = N_Record_Definition then Result_Kind := A_Record_Definition; elsif Result_Node_Kind = N_Variant then Result_Kind := A_Variant; end if; return Node_To_Element_New (Starting_Element => Element, Node => Result_Node, Internal_Kind => Result_Kind, Considering_Parent_Count => False); end An_Attribute_Definition_Clause_Enclosing; ---------------------------- -- An_Else_Path_Enclosing -- ---------------------------- function An_Else_Path_Enclosing (Element : Asis.Element) return Asis.Element is begin return Node_To_Element_New (Node => R_Node (Element), Starting_Element => Element); end An_Else_Path_Enclosing; ---------------------------------------------------- -- An_Enumeration_Literal_Specification_Enclosing -- ---------------------------------------------------- function An_Enumeration_Literal_Specification_Enclosing (Element : Asis.Element) return Asis.Element is Result_Node : Node_Id; Start_Elem : Asis.Element := Element; begin if Special_Case (Element) = Stand_Char_Literal then Result_Node := R_Node (Element); Set_Character_Code (Start_Elem, 0); Set_Special_Case (Start_Elem, Explicit_From_Standard); else Result_Node := Parent (R_Node (Element)); end if; return Node_To_Element_New (Starting_Element => Start_Elem, Node => Result_Node, Internal_Kind => An_Enumeration_Type_Definition); end An_Enumeration_Literal_Specification_Enclosing; ---------------------------------------------- -- An_Enumeration_Type_Definition_Enclosing -- ---------------------------------------------- function An_Enumeration_Type_Definition_Enclosing (Element : Asis.Element) return Asis.Element is Result_Node : Node_Id; begin if Special_Case (Element) = Stand_Char_Literal then Result_Node := R_Node (Element); if Nkind (Result_Node) = N_Defining_Identifier then -- we are in the definition of Standard.Boolean: Result_Node := Parent (Etype (Result_Node)); end if; else Result_Node := Parent (R_Node (Element)); end if; return Node_To_Element_New (Starting_Element => Element, Node => Result_Node, Internal_Kind => An_Ordinary_Type_Declaration); end An_Enumeration_Type_Definition_Enclosing; ------------------------------------ -- An_Exception_Handler_Enclosing -- ------------------------------------ function An_Exception_Handler_Enclosing (Element : Asis.Element) return Asis.Element is begin return Node_To_Element_New (Node => Parent (Parent (R_Node (Element))), Starting_Element => Element); end An_Exception_Handler_Enclosing; ----------------------------- -- An_Expression_Enclosing -- ----------------------------- function An_Expression_Enclosing (Element : Asis.Element) return Asis.Element is Start_Elem : Asis.Element := Element; Rough_Result_Node : Node_Id; Res_Entity : Entity_Id; Rough_Result_Element : Asis.Element; Rough_Res_Spec_Case : Special_Cases; Result_Element : Asis.Element; begin Rough_Result_Node := Get_Rough_Enclosing_Node (Element); if not (Sloc (Node (Start_Elem)) <= Standard_Location or else Special_Case (Start_Elem) = Configuration_File_Pragma) then Set_Special_Case (Start_Elem, Not_A_Special_Case); end if; Rough_Result_Element := Node_To_Element_New (Node => Rough_Result_Node, Starting_Element => Start_Elem); if Is_Top_Of_Expanded_Generic (Rough_Result_Node) and then Is_From_Instance (Element) and then (Nkind (Original_Node (Rough_Result_Node)) /= N_Formal_Package_Declaration or else Instantiation_Depth (Sloc (R_Node (Element))) > Instantiation_Depth (Sloc (Rough_Result_Node))) then -- ??? The content of this if statement is just a slightly edited -- ??? fragment of Enclosing_For_Explicit_Instance_Component if Nkind (Rough_Result_Node) = N_Package_Declaration or else Nkind (Rough_Result_Node) = N_Package_Body then Rough_Res_Spec_Case := Expanded_Package_Instantiation; -- and here we have to correct the result: Set_Node (Rough_Result_Element, R_Node (Rough_Result_Element)); if Nkind (Rough_Result_Node) = N_Package_Declaration then Set_Int_Kind (Rough_Result_Element, A_Package_Declaration); else Set_Int_Kind (Rough_Result_Element, A_Package_Body_Declaration); end if; else Rough_Res_Spec_Case := Expanded_Subprogram_Instantiation; end if; Set_Special_Case (Rough_Result_Element, Rough_Res_Spec_Case); end if; if Special_Case (Element) = Is_From_Gen_Association and then Is_Top_Of_Expanded_Generic (Node (Rough_Result_Element)) and then Instantiation_Depth (Sloc (Node (Rough_Result_Element))) = Instantiation_Depth (Sloc (Node (Element))) then Rough_Result_Element := Enclosing_Element (Rough_Result_Element); end if; if Nkind (Rough_Result_Node) = N_Subprogram_Declaration and then not Comes_From_Source (Rough_Result_Node) then Res_Entity := Defining_Unit_Name (Specification (Rough_Result_Node)); if (Ekind (Res_Entity) = E_Function and then not Comes_From_Source (Res_Entity) and then Chars (Res_Entity) = Snames.Name_Op_Ne) and then Present (Corresponding_Equality (Res_Entity)) then Set_Special_Case (Rough_Result_Element, Is_From_Imp_Neq_Declaration); end if; end if; Result_Element := Get_Enclosing (Approximation => Rough_Result_Element, Element => Element); return Result_Element; end An_Expression_Enclosing; -------------------------------- -- An_Others_Choice_Enclosing -- -------------------------------- function An_Others_Choice_Enclosing (Element : Asis.Element) return Asis.Element is Parent_Node : constant Node_Id := Parent (Parent (R_Node (Element))); Result_Node : Node_Id := Parent (R_Node (Element)); Result_Kind : Internal_Element_Kinds := Not_An_Element; begin if Nkind (Result_Node) = N_Component_Association then -- we have to find out, is it record or array component -- association. Parent_Node points to the enclosing aggregate if No (Etype (Parent_Node)) or else Is_Array_Type (Etype (Parent_Node)) then -- the first condition in 'or else' is true for multi-dimensional -- array aggregates Result_Kind := An_Array_Component_Association; else Result_Kind := A_Record_Component_Association; end if; elsif Nkind (Result_Node) = N_Package_Declaration and then Nkind (Original_Node (Result_Node)) = N_Formal_Package_Declaration then Result_Node := Last_Non_Pragma (Generic_Associations (Original_Node (Result_Node))); Result_Kind := A_Generic_Association; end if; return Node_To_Element_New (Starting_Element => Element, Node => Result_Node, Internal_Kind => Result_Kind, Considering_Parent_Count => False); end An_Others_Choice_Enclosing; ---------------------------------------------------- -- Not_Implemented_Enclosing_Element_Construction -- ---------------------------------------------------- function Not_Implemented_Enclosing_Element_Construction (Element : Asis.Element) return Asis.Element is begin Not_Implemented_Yet (Diagnosis => "Enclosing Element retrieval for the explicit Element " & "of the " & Internal_Element_Kinds'Image (Int_Kind (Element)) & " kind " & "has not been implemented yet"); return Asis.Nil_Element; -- to make the code syntactically correct; end Not_Implemented_Enclosing_Element_Construction; ---------------------------- -- Possible_C_U_Enclosing -- ---------------------------- function Possible_C_U_Enclosing (Element : Asis.Element) return Asis.Element is Parent_Node : Node_Id := Parent (R_Node (Element)); Parent_Node_Kind : constant Node_Kind := Nkind (Parent_Node); begin if Parent_Node_Kind = N_Compilation_Unit or else Parent_Node_Kind = N_Subunit then return Asis.Nil_Element; elsif Parent_Node_Kind = N_Package_Specification then Parent_Node := Parent (Parent_Node); elsif Parent_Node_Kind = N_Protected_Definition then Parent_Node := Parent (Parent_Node); Parent_Node := Protected_Definition (Original_Node (Parent_Node)); end if; return Node_To_Element_New (Starting_Element => Element, Node => Parent_Node); end Possible_C_U_Enclosing; ----------------------------------------------------------------- -- Section 6 - bodies for the routines defined in the package -- -- spec and local subprograms -- ----------------------------------------------------------------- --------------------------------- -- Corresponding_Instantiation -- --------------------------------- function Corresponding_Instantiation (Element : Asis.Element) return Asis.Element is Argument_Node : Node_Id := R_Node (Element); Argument_Kind : constant Internal_Element_Kinds := Int_Kind (Element); Result_Node : Node_Id := Argument_Node; Result_Kind : Internal_Element_Kinds; Result_Unit : constant Asis.Compilation_Unit := Encl_Unit (Element); begin if Argument_Kind = A_Package_Declaration or else Argument_Kind = A_Package_Body_Declaration then -- A formal package with box needs a special processing - it is -- based on the same node as the argument if Nkind (Original_Node (Argument_Node)) = N_Formal_Package_Declaration and then Box_Present (Original_Node (Argument_Node)) then Result_Kind := A_Formal_Package_Declaration_With_Box; else Argument_Node := Parent (Argument_Node); if Nkind (Argument_Node) in N_Generic_Declaration and then Is_List_Member (Result_Node) and then List_Containing (Result_Node) = Generic_Formal_Declarations (Argument_Node) then Result_Kind := A_Formal_Package_Declaration; else Result_Kind := A_Package_Instantiation; end if; end if; else if Argument_Kind = A_Procedure_Declaration or else Argument_Kind = A_Procedure_Body_Declaration then Result_Kind := A_Procedure_Instantiation; else Result_Kind := A_Function_Instantiation; end if; -- we have to go the N_Package_Decalaration node of an -- artificial package created by the compiler for a subprogram -- instantiation - two steps up the tree are needed: Result_Node := Parent (Result_Node); if Argument_Kind = A_Procedure_Declaration or else Argument_Kind = A_Function_Declaration then Result_Node := Parent (Result_Node); end if; end if; if Nkind (Parent (Result_Node)) = N_Compilation_Unit then -- For library-level subprogram instantiations we may have a -- problem in the tree created for the instantiation itself. if Nkind (Result_Node) = N_Package_Declaration and then not Is_Rewrite_Substitution (Result_Node) then Result_Node := Parent (Corresponding_Body (Result_Node)); if Nkind (Result_Node) = N_Defining_Program_Unit_Name then Result_Node := Parent (Result_Node); end if; end if; elsif Nkind (Original_Node (Result_Node)) /= N_Formal_Package_Declaration then -- "local" instantiation, therefore - one or two steps down the -- declaration list to get in the instantiation node, a formal -- package with a box is an exception: Result_Node := Next_Non_Pragma (Result_Node); if Nkind (Result_Node) = N_Package_Body then -- This is an expanded generic body Result_Node := Next_Non_Pragma (Result_Node); end if; end if; if Is_Rewrite_Substitution (Result_Node) and then Is_Rewrite_Substitution (Original_Node (Result_Node)) then Result_Node := Original_Node (Result_Node); end if; return Node_To_Element_New (Node => Result_Node, Internal_Kind => Result_Kind, In_Unit => Result_Unit); end Corresponding_Instantiation; ------------------------------------ -- Enclosing_Element_For_Explicit -- ------------------------------------ function Enclosing_Element_For_Explicit (Element : Asis.Element) return Asis.Element is Enclosing_Construction_Case : Internal_Element_Kinds; Element_Internal_Kind : Internal_Element_Kinds; Result_Element : Asis.Element; Res_Node : constant Node_Id := Standard_Package_Node; Res_Kind : Internal_Element_Kinds := Not_An_Element; Res_Spec_Case : Special_Cases; begin Element_Internal_Kind := Int_Kind (Element); -- A special case of fake Numeric_Error renaming is handled -- separately (see B712-0050) if Special_Case (Element) = Numeric_Error_Renaming then case Element_Internal_Kind is when An_Exception_Renaming_Declaration => Res_Kind := A_Package_Declaration; Res_Spec_Case := Explicit_From_Standard; when A_Defining_Identifier | An_Identifier => Res_Kind := An_Exception_Renaming_Declaration; Res_Spec_Case := Numeric_Error_Renaming; when others => null; end case; Result_Element := Node_To_Element_New (Starting_Element => Element, Node => Res_Node, Internal_Kind => Res_Kind, Spec_Case => Res_Spec_Case); return Result_Element; end if; -- A special case of a configuration pragma is handled separately -- (BA07-013) if Element_Internal_Kind in Internal_Pragma_Kinds and then Special_Case (Element) = Configuration_File_Pragma then return Asis.Nil_Element; end if; Enclosing_Construction_Case := Enclosing_Element_For_Explicits_First_Switch (Element_Internal_Kind); case Enclosing_Construction_Case is when Not_An_Element => return Asis.Nil_Element; when Trivial_Mapping => Result_Element := General_Encl_Elem (Element); when Non_Trivial_Mapping => Result_Element := Enclosing_Element_For_Explicits_Second_Switch (Element_Internal_Kind) (Element); when No_Mapping => No_Enclosing_Element (Element_Kind => Element_Internal_Kind); return Asis.Nil_Element; -- to avoid GNAT warning when Not_Implemented_Mapping => Not_Implemented_Enclosing_Element_Construction (Element => Element); when others => -- others means here that the Enclosing Element should -- based on the same node. Result_Element := Node_To_Element_New (Starting_Element => Element, Node => R_Node (Element), Internal_Kind => Enclosing_Construction_Case, Considering_Parent_Count => False); if Element_Internal_Kind = A_Defining_Character_Literal then Set_Character_Code (Result_Element, Character_Code (Element)); end if; end case; if Is_From_Implicit (Element) and then Statement_Kind (Element) = A_Null_Statement then -- Case of an implicit NULL statement needed for 'floating' labels, -- Ada 2012 Set_From_Implicit (Result_Element, False); end if; return Result_Element; end Enclosing_Element_For_Explicit; ----------------------------------------------- -- Enclosing_For_Explicit_Instance_Component -- ----------------------------------------------- function Enclosing_For_Explicit_Instance_Component (Element : Asis.Element) return Asis.Element is Result_Element : Asis.Element; Result_Node : Node_Id; Tmp_Node : Node_Id; Res_Spec_Case : Special_Cases; function Is_Top_Exp_Form_Pack_With_Box (Potential_Enclosing_Element : Asis.Element; Arg_Element : Asis.Element) return Boolean; -- Checks if Potential_Enclosing_Element is the top expanded spec -- (??? what about body???) for a formal package declaration with box. -- The problem here is that when going up the tree, we can get into this -- argument both from components of the formal package declaration with -- box and from the corresponding expanded spec. So we have to check -- if Potential_Enclosing_Element and Arg_Element are the same level -- of instantiating (nested instances may be a pain! The function needs -- more testing ???) -- See the discussion in E425-007 function Is_Top_Exp_Form_Pack_With_Box (Potential_Enclosing_Element : Asis.Element; Arg_Element : Asis.Element) return Boolean is EE_Inst_Level : Natural := 0; Arg_Inst_Level : Natural := 0; Src : Source_Ptr := Instantiation (Get_Source_File_Index (Sloc (R_Node (Potential_Enclosing_Element)))); function May_Be_Exp_Pack_Def_Name (N_Pack : Node_Id; N_Name : Node_Id) return Boolean; -- In case of the defining name of an expanded package created for a -- formal package with the box, we have the instantiation chain one -- link shorter then the rest of the expanded package, so we have -- to detect this situation. function May_Be_Nested_FP_Instantiation (N_Pack : Node_Id; N_Name : Node_Id) return Boolean; -- See E430-A01. We try to detect the situation when we go out of -- a chain of nested instantiations created by formal packages with -- the box function May_Be_Exp_Pack_Def_Name (N_Pack : Node_Id; N_Name : Node_Id) return Boolean is Result : Boolean := False; begin if Nkind (N_Name) = N_Defining_Identifier and then Nkind (Original_Node (N_Pack)) = N_Formal_Package_Declaration and then Box_Present (Original_Node (N_Pack)) then Result := N_Name = Defining_Unit_Name (Specification (N_Pack)); end if; return Result; end May_Be_Exp_Pack_Def_Name; function May_Be_Nested_FP_Instantiation (N_Pack : Node_Id; N_Name : Node_Id) return Boolean is Result : Boolean := False; begin if Nkind (N_Pack) = N_Generic_Package_Declaration and then Nkind (Original_Node (N_Pack)) = N_Formal_Package_Declaration and then Box_Present (Original_Node (N_Pack)) and then Nkind (N_Name) = N_Generic_Package_Declaration and then Nkind (Original_Node (N_Name)) = N_Formal_Package_Declaration and then Box_Present (Original_Node (N_Name)) then Result := True; end if; return Result; end May_Be_Nested_FP_Instantiation; begin if not (Nkind (Node (Potential_Enclosing_Element)) = N_Formal_Package_Declaration and then Nkind (R_Node (Potential_Enclosing_Element)) = N_Generic_Package_Declaration) or else (Int_Kind (Potential_Enclosing_Element) = A_Formal_Package_Declaration_With_Box and then Node (Arg_Element) = Defining_Identifier (Node (Potential_Enclosing_Element))) then return False; end if; while Src /= No_Location loop EE_Inst_Level := EE_Inst_Level + 1; Src := Instantiation (Get_Source_File_Index (Src)); end loop; Src := Instantiation (Get_Source_File_Index (Sloc (R_Node (Arg_Element)))); while Src /= No_Location loop Arg_Inst_Level := Arg_Inst_Level + 1; Src := Instantiation (Get_Source_File_Index (Src)); end loop; return (May_Be_Exp_Pack_Def_Name (R_Node (Potential_Enclosing_Element), R_Node (Arg_Element)) and then EE_Inst_Level = Arg_Inst_Level + 1) or else (May_Be_Nested_FP_Instantiation (R_Node (Potential_Enclosing_Element), R_Node (Arg_Element)) and then EE_Inst_Level + 1 = Arg_Inst_Level) or else EE_Inst_Level = Arg_Inst_Level; end Is_Top_Exp_Form_Pack_With_Box; begin Result_Element := Enclosing_Element_For_Explicit (Element); if Is_Nil (Result_Element) then -- There is a special case corresponding to the defining name in an -- artificial subtype declaration that is a means to pass an actual -- type in the expanded instantiation (see K811-006). Under some -- conditions the corresponding node in the tree is an Itype node, -- and it does not have a Parent reference set. Tmp_Node := Node (Element); if Nkind (Tmp_Node) = N_Defining_Identifier and then Is_Itype (Tmp_Node) then Tmp_Node := Associated_Node_For_Itype (Tmp_Node); Result_Element := Node_To_Element_New (Node => Tmp_Node, Starting_Element => Element, Internal_Kind => A_Subtype_Declaration); end if; end if; -- In case if the result argument is an artificial declaration -- used to pass an actual into expanded subprogram, we are -- in the spec of the artificial wrapper package. So we have to get -- to the expanded subprogram declaration (see G416-009) if Is_Top_Of_Expanded_Generic (R_Node (Result_Element)) then Tmp_Node := (R_Node (Result_Element)); if Nkind (Tmp_Node) = N_Package_Declaration and then No (Generic_Parent (Specification (Tmp_Node))) then -- This IF statement prevents us from doing this special -- processing for expanded package declarations, we have to do -- it only for wrapper packages created for subprogram -- instantiation Tmp_Node := Last (Visible_Declarations (Specification (Tmp_Node))); Result_Element := Node_To_Element_New (Node => Tmp_Node, Spec_Case => Expanded_Subprogram_Instantiation, Starting_Element => Element); end if; end if; -- and now we have to check if we are in the whole expanded -- declaration Result_Node := R_Node (Result_Element); if not (Is_Rewrite_Substitution (Result_Node) and then Nkind (Original_Node (Result_Node)) = N_Formal_Package_Declaration and then (Node (Element) = Defining_Identifier (Original_Node (Result_Node)) or else (Node (Element) /= Defining_Unit_Name (Specification (Result_Node)) and then Instantiation_Depth (Sloc (R_Node (Element))) = Instantiation_Depth (Sloc (Result_Node))))) and then Is_Top_Of_Expanded_Generic (Result_Node) then -- this is an artificial package or subprogram declaration -- created by the compiler as an expanded generic declaration if Nkind (Result_Node) = N_Package_Declaration or else Nkind (Result_Node) = N_Package_Body then Res_Spec_Case := Expanded_Package_Instantiation; -- and here we have to correct the result: Set_Node (Result_Element, R_Node (Result_Element)); if Nkind (Result_Node) = N_Package_Declaration then Set_Int_Kind (Result_Element, A_Package_Declaration); else Set_Int_Kind (Result_Element, A_Package_Body_Declaration); end if; else Res_Spec_Case := Expanded_Subprogram_Instantiation; end if; Set_Special_Case (Result_Element, Res_Spec_Case); elsif Is_Top_Exp_Form_Pack_With_Box (Result_Element, Element) then -- This case is somewhat special - we have not a package, but a -- generic package declaration as expanded code here Set_Int_Kind (Result_Element, A_Package_Declaration); Set_Special_Case (Result_Element, Expanded_Package_Instantiation); -- ??? What about expanded bodies for formal packages with a box? end if; -- and we have to correct Is_Part_Of_Instance field of the result - -- just in case. May be, it will not be necessary, if (and when) -- Enclosing_Element_For_Explicit takes the corresponding fields -- from its argument if not Is_Nil (Result_Element) then Set_From_Instance (Result_Element, True); end if; return Result_Element; end Enclosing_For_Explicit_Instance_Component; ------------------------------------ -- Enclosing_Element_For_Implicit -- ------------------------------------ function Enclosing_Element_For_Implicit (Element : Asis.Element) return Asis.Element is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Element); Result_Node : Node_Id := Empty; Result_Element : Asis.Element; Result_Kind : Internal_Element_Kinds := Not_An_Element; Res_Spec_Case : Special_Cases := Not_A_Special_Case; begin -- Special treatment for the declaration of implicit "/=", see F903-002: if Asis.Extensions.Is_Implicit_Neq_Declaration (Element) then Result_Element := Enclosing_Element (Asis.Declarations.Corresponding_Equality_Operator (Element)); else case Arg_Kind is when A_Procedure_Declaration | A_Function_Declaration | A_Procedure_Body_Declaration | A_Function_Body_Declaration | A_Procedure_Renaming_Declaration | A_Function_Renaming_Declaration | A_Discriminant_Specification | A_Component_Declaration => Result_Node := Original_Node (Node_Field_1 (Element)); if Nkind (Result_Node) in N_Entity and then (Arg_Kind in A_Procedure_Declaration .. A_Function_Declaration or else Arg_Kind in A_Procedure_Body_Declaration .. A_Function_Body_Declaration or else Arg_Kind in A_Procedure_Renaming_Declaration .. A_Function_Renaming_Declaration) then Result_Node := Original_Node (Parent (Node_Field_1 (Element))); end if; case Nkind (Result_Node) is when N_Private_Extension_Declaration => Result_Kind := A_Private_Extension_Definition; when N_Formal_Type_Declaration => Result_Node := Sinfo.Formal_Type_Definition (Result_Node); when others => Result_Node := Sinfo.Type_Definition (Result_Node); end case; Result_Element := Node_To_Element_New ( Node => Result_Node, Starting_Element => Element, Internal_Kind => Result_Kind); Set_From_Implicit (Result_Element, False); Set_From_Inherited (Result_Element, False); Set_Node_Field_1 (Result_Element, Empty); when Internal_Root_Type_Kinds => Result_Element := Element; Set_Int_Kind (Result_Element, An_Ordinary_Type_Declaration); when An_Ordinary_Type_Declaration => -- The only possible case is the declaration of a root or -- universal numeric type Result_Node := Standard_Package_Node; Res_Spec_Case := Explicit_From_Standard; Result_Kind := A_Package_Declaration; Result_Element := Node_To_Element_New (Node => Result_Node, Spec_Case => Res_Spec_Case, In_Unit => Encl_Unit (Element)); when An_Enumeration_Literal_Specification | An_Entry_Declaration => Result_Node := Sinfo.Type_Definition (Original_Node (Node_Field_1 (Element))); Result_Kind := A_Derived_Type_Definition; Result_Element := Node_To_Element_New ( Node => Result_Node, Starting_Element => Element, Internal_Kind => Result_Kind); Set_From_Implicit (Result_Element, False); Set_From_Inherited (Result_Element, False); Set_Node_Field_1 (Result_Element, Empty); when A_Generic_Association => Result_Element := Node_To_Element_New (Node => R_Node (Element), In_Unit => Encl_Unit (Element)); when others => if Normalization_Case (Element) = Is_Normalized_Defaulted_For_Box then Result_Node := Parent (Parent (Parent (Node (Element)))); while not (Nkind (Result_Node) in N_Generic_Instantiation or else Nkind (Original_Node (Result_Node)) = N_Formal_Package_Declaration) loop if Nkind (Parent (Result_Node)) = N_Compilation_Unit then -- Library level instantiation if Is_Rewrite_Substitution (Result_Node) then -- Package instantiation, the package does not have -- a body exit; else Result_Node := Corresponding_Body (Result_Node); while Nkind (Result_Node) /= N_Package_Body loop Result_Node := Parent (Result_Node); end loop; end if; exit; else Result_Node := Next (Result_Node); end if; end loop; Result_Element := Node_To_Element_New (Node => Result_Node, In_Unit => Encl_Unit (Element)); else Result_Element := Enclosing_Element_For_Explicit (Element); end if; end case; end if; if Int_Kind (Result_Element) = A_Function_Renaming_Declaration then -- See C125-002 Set_Int_Kind (Result_Element, A_Function_Declaration); elsif Int_Kind (Result_Element) = A_Procedure_Renaming_Declaration then Set_Int_Kind (Result_Element, A_Procedure_Declaration); end if; return Result_Element; end Enclosing_Element_For_Implicit; ---------------------------------------- -- Enclosing_Element_For_Limited_View -- ---------------------------------------- function Enclosing_Element_For_Limited_View (Element : Asis.Element) return Asis.Element is Result : Asis.Element := Enclosing_Element_For_Explicit (Element); begin if not Is_Nil (Result) then Set_Special_Case (Result, From_Limited_View); Set_From_Implicit (Result, True); Set_Int_Kind (Result, Limited_View_Kind (Result)); end if; return Result; end Enclosing_Element_For_Limited_View; ----------------------- -- General_Encl_Elem -- ----------------------- function General_Encl_Elem (Element : Asis.Element) return Asis.Element is Result_Node : Node_Id; Result_Nkind : Node_Kind; begin Result_Node := Parent (R_Node (Element)); Result_Nkind := Nkind (Result_Node); -- and now - special processing for some node kinds to skip nodes which -- are of no use in ASIS if Result_Nkind = N_Package_Specification or else Result_Nkind = N_Function_Specification or else Result_Nkind = N_Procedure_Specification or else Result_Nkind = N_Entry_Body_Formal_Part then Result_Node := Parent (Result_Node); end if; return Node_To_Element_New (Starting_Element => Element, Node => Result_Node, Considering_Parent_Count => False); end General_Encl_Elem; ------------------- -- Get_Enclosing -- ------------------- function Get_Enclosing (Approximation : Asis.Element; Element : Asis.Element) return Asis.Element is -- we need two-level traversing for searching for Enclosing Element: -- first, we go through the direct children of an approximate -- result, and none of them Is_Identical to Element, we repeat -- the search process for each direct child. We may implement -- this on top of Traverse_Element, but we prefer to code -- it manually on top of A4G.Queries Result_Element : Asis.Element; Result_Found : Boolean := False; -- needed to simulate the effect of Terminate_Immediatelly procedure Check_Possible_Enclosing (Appr_Enclosing : Asis.Element); -- implements the first level of the search. Appr_Enclosing is -- the "approximate" Enclosing Element, and this procedure -- checks if some of its components Is_Identical to Element -- (Element here is the parameter of Get_Enclosing function, -- as a global constant value inside Get_Enclosing, it is the -- same for all the (recursive) calls of Check_Possible_Enclosing ------------------------------ -- Check_Possible_Enclosing -- ------------------------------- procedure Check_Possible_Enclosing (Appr_Enclosing : Asis.Element) is Child_Access : constant Query_Array := Appropriate_Queries (Appr_Enclosing); -- this is the way to traverse the direct children Next_Child : Asis.Element; procedure Check_List (L : Asis.Element_List); -- checks if L contains a component which Is_Identical -- to (global) Element. Sets Result_Found ON if such a -- component is found procedure Check_List_Down (L : Asis.Element_List); -- calls Get_Enclosing for every component of L, by -- this the recursion and the second level of the search -- is implemented procedure Check_List (L : Asis.Element_List) is begin for L_El_Index in L'Range loop if Is_Identical (Element, L (L_El_Index)) then Result_Found := True; return; end if; end loop; end Check_List; procedure Check_List_Down (L : Asis.Element_List) is begin if Result_Found then return; -- it seems that we do not need this if... ??? end if; for L_El_Index in L'Range loop Check_Possible_Enclosing (L (L_El_Index)); if Result_Found then return; end if; end loop; end Check_List_Down; begin -- Check_Possible_Enclosing if Result_Found then return; -- now the only goal is to not disturb the setting of the -- global variable Result_Element to be returned as a result end if; -- first, setting the (global for this procedure) Result_Element: Result_Element := Appr_Enclosing; -- the first level of the search - checking all the direct -- children: for Each_Query in Child_Access'Range loop case Child_Access (Each_Query).Query_Kind is when Bug => null; when Single_Element_Query => Next_Child := Child_Access (Each_Query).Func_Simple (Appr_Enclosing); if Is_Identical (Element, Next_Child) then Result_Found := True; return; end if; when Element_List_Query => declare Child_List : constant Asis.Element_List := Child_Access (Each_Query).Func_List (Appr_Enclosing); begin Check_List (Child_List); if Result_Found then return; end if; end; when Element_List_Query_With_Boolean => declare Child_List : constant Asis.Element_List := Child_Access (Each_Query).Func_List_Boolean (Appr_Enclosing, Child_Access (Each_Query).Bool); begin Check_List (Child_List); if Result_Found then return; end if; end; end case; end loop; -- if we are here, we have hot found Element among the direct -- children of Appr_Enclosing. So we have to traverse the direct -- children again, but this time we have to go one step down, -- so here we have the second level of the search: for Each_Query in Child_Access'Range loop case Child_Access (Each_Query).Query_Kind is when Bug => null; when Single_Element_Query => Next_Child := Child_Access (Each_Query).Func_Simple (Appr_Enclosing); -- and here - recursively one step down if not Is_Nil (Next_Child) then Check_Possible_Enclosing (Next_Child); if Result_Found then return; end if; end if; when Element_List_Query => declare Child_List : constant Asis.Element_List := Child_Access (Each_Query).Func_List (Appr_Enclosing); begin -- and here - recursively one step down Check_List_Down (Child_List); if Result_Found then return; end if; end; when Element_List_Query_With_Boolean => declare Child_List : constant Asis.Element_List := Child_Access (Each_Query).Func_List_Boolean (Appr_Enclosing, Child_Access (Each_Query).Bool); begin -- and here - recursively one step down Check_List_Down (Child_List); if Result_Found then return; end if; end; end case; end loop; end Check_Possible_Enclosing; begin -- Get_Enclosing Check_Possible_Enclosing (Approximation); pragma Assert (Result_Found); return Result_Element; end Get_Enclosing; ------------------------------ -- Get_Rough_Enclosing_Node -- ------------------------------ function Get_Rough_Enclosing_Node (Element : Asis.Element) return Node_Id is Arg_Node : constant Node_Id := R_Node (Element); Result_Node : Node_Id; Res_Nkind : Node_Kind; function Is_Acceptable_As_Rough_Enclosing_Node (N : Node_Id) return Boolean; -- this function encapsulates the condition for choosing -- the rough enclosing node function Is_Acceptable_Impl_Neq_Decl (N : Node_Id) return Boolean; -- Implements a special check for Is_Acceptable_As_Rough_Enclosing_Node: -- in case if Element is a subcomponenet of an implicit declaration of -- "/=", checks that N represents the whole declaration of this "/=" ------------------------------------------- -- Is_Acceptable_As_Rough_Enclosing_Node -- ------------------------------------------- function Is_Acceptable_As_Rough_Enclosing_Node (N : Node_Id) return Boolean is N_K : constant Node_Kind := Nkind (N); Result : Boolean := True; begin if not (Is_Acceptable_Impl_Neq_Decl (N) or else Is_List_Member (N) or else (Nkind (Parent (N)) = N_Compilation_Unit or else Nkind (Parent (N)) = N_Subunit)) or else (Nkind (N) in N_Subexpr and then Nkind (N) /= N_Procedure_Call_Statement) or else Nkind (N) = N_Parameter_Association then Result := False; elsif N_K = N_Range or else -- N_K = N_Component_Association or else N_K = N_Subtype_Indication then Result := False; elsif N_K = N_Component_Association then if Special_Case (Element) = Is_From_Gen_Association or else Is_From_Rewritten_Aggregate (N) then Result := False; end if; elsif N_K = N_Procedure_Call_Statement and then Nkind (Parent (N)) = N_Pragma then Result := False; elsif not Comes_From_Source (N) and then Sloc (N) > Standard_Location and then not Is_Acceptable_Impl_Neq_Decl (N) then if not (Is_From_Instance (Element) and then Is_Top_Of_Expanded_Generic (N)) then Result := False; end if; end if; return Result; end Is_Acceptable_As_Rough_Enclosing_Node; --------------------------------- -- Is_Acceptable_Impl_Neq_Decl -- --------------------------------- function Is_Acceptable_Impl_Neq_Decl (N : Node_Id) return Boolean is Result : Boolean := False; begin if Special_Case (Element) = Is_From_Imp_Neq_Declaration and then Nkind (N) = N_Subprogram_Declaration and then not Comes_From_Source (N) and then Present (Corresponding_Equality (Defining_Unit_Name (Specification (N)))) then Result := True; end if; return Result; end Is_Acceptable_Impl_Neq_Decl; begin -- Get_Rough_Enclosing_Node Result_Node := Parent (Arg_Node); if Nkind (Result_Node) = N_Object_Renaming_Declaration and then Special_Case (Element) = Is_From_Gen_Association and then Present (Corresponding_Generic_Association (Result_Node)) then Result_Node := Corresponding_Generic_Association (Result_Node); elsif (Nkind (Result_Node) = N_Attribute_Definition_Clause or else Nkind (Result_Node) = N_Pragma) and then From_Aspect_Specification (Result_Node) then -- Result_Node := Corresponding_Aspect (Result_Node); null; -- SCz end if; while Present (Result_Node) and then not Is_Acceptable_As_Rough_Enclosing_Node (Result_Node) loop Result_Node := Parent (Result_Node); if Nkind (Result_Node) = N_Object_Renaming_Declaration and then Special_Case (Element) = Is_From_Gen_Association and then Present (Corresponding_Generic_Association (Result_Node)) then Result_Node := Corresponding_Generic_Association (Result_Node); elsif (Nkind (Result_Node) = N_Attribute_Definition_Clause or else Nkind (Result_Node) = N_Pragma) and then From_Aspect_Specification (Result_Node) then -- Result_Node := Corresponding_Aspect (Result_Node); null; -- SCz end if; if Nkind (Result_Node) = N_Compilation_Unit then -- this means that there is no node list on the way up -- the tree, and we have to go back to the node -- for the unit declaration: if Is_Standard (Encl_Unit (Element)) then Result_Node := Standard_Package_Node; else Result_Node := Unit (Result_Node); end if; if Nkind (Result_Node) = N_Subunit then Result_Node := Proper_Body (Result_Node); end if; exit; end if; end loop; -- and here we have to take into account possible normalization -- of multi-identifier declarations: Res_Nkind := Nkind (Result_Node); if Res_Nkind = N_Object_Declaration or else Res_Nkind = N_Number_Declaration or else Res_Nkind = N_Discriminant_Specification or else Res_Nkind = N_Component_Declaration or else Res_Nkind = N_Parameter_Specification or else Res_Nkind = N_Exception_Declaration or else Res_Nkind = N_Formal_Object_Declaration or else Res_Nkind = N_With_Clause then Skip_Normalized_Declarations_Back (Result_Node); end if; -- If we've got Result_Node pointing to the artificial package -- declaration created for library-level generic instantiation, -- we have to the body for which we have this instantiation as -- the original node if Nkind (Result_Node) = N_Package_Declaration and then not Comes_From_Source (Result_Node) and then Nkind (Parent (Result_Node)) = N_Compilation_Unit and then not Is_From_Instance (Element) and then not Is_Rewrite_Substitution (Result_Node) then Result_Node := Corresponding_Body (Result_Node); while Nkind (Result_Node) /= N_Package_Body loop Result_Node := Parent (Result_Node); end loop; end if; -- Below is the patch for 8706-003. It is needed when we are looking -- for the enclosing element for actual parameter in subprogram -- instantiation. In this case Result_Node points to the spec of a -- wrapper package, so we have to go to the instantiation. if Special_Case (Element) = Is_From_Gen_Association and then Nkind (Result_Node) = N_Package_Declaration and then not (Nkind (Original_Node (Result_Node)) = N_Package_Instantiation or else Nkind (Original_Node (Result_Node)) = N_Package_Body or else (Present (Generic_Parent (Specification (Result_Node))) and then Ekind (Generic_Parent (Specification (Result_Node))) = E_Generic_Package)) and then not Comes_From_Source (Result_Node) and then (Nkind (Parent (Arg_Node)) = N_Subprogram_Renaming_Declaration and then not Comes_From_Source (Parent (Arg_Node))) and then Instantiation_Depth (Sloc (Result_Node)) = Instantiation_Depth (Sloc (Arg_Node)) then if Is_Rewrite_Substitution (Result_Node) and then Nkind (Original_Node (Result_Node)) in N_Generic_Instantiation then Result_Node := Original_Node (Result_Node); else while not Comes_From_Source (Result_Node) loop Result_Node := Next_Non_Pragma (Result_Node); end loop; end if; end if; return Result_Node; end Get_Rough_Enclosing_Node; -------------------------------- -- Is_Top_Of_Expanded_Generic -- -------------------------------- function Is_Top_Of_Expanded_Generic (N : Node_Id) return Boolean is N_Kind : constant Node_Kind := Nkind (N); Result : Boolean := False; begin Result := ((not Comes_From_Source (N) or else Is_Rewrite_Insertion (N)) and then (N_Kind = N_Package_Declaration or else N_Kind = N_Package_Body or else N_Kind = N_Subprogram_Declaration or else N_Kind = N_Subprogram_Body) and then Nkind (Original_Node (N)) not in N_Renaming_Declaration) or else (Nkind (Parent (N)) = N_Package_Body and then not Comes_From_Source (Parent (N))) or else (Is_Rewrite_Substitution (N) and then Nkind (Original_Node (N)) = N_Package_Instantiation); -- Library-level package instantiation return Result; end Is_Top_Of_Expanded_Generic; -------------------------- -- No_Enclosing_Element -- -------------------------- procedure No_Enclosing_Element (Element_Kind : Internal_Element_Kinds) is begin Raise_ASIS_Failed ("No Enclosing Element can correspond " & "to the Element with Internal_Element_Kinds value of " & Internal_Element_Kinds'Image (Element_Kind)); end No_Enclosing_Element; ---------------------------------------------------- -- Not_Implemented_Enclosing_Element_Construction -- ---------------------------------------------------- procedure Not_Implemented_Enclosing_Element_Construction (Element : Asis.Element) is begin Not_Implemented_Yet (Diagnosis => "Enclosing Element retrieval for the explicit Element " & "of the " & Internal_Element_Kinds'Image (Int_Kind (Element)) & " kind " & "has not been implemented yet"); end Not_Implemented_Enclosing_Element_Construction; ------------ -- Parent -- ------------ function Parent (Node : Node_Id) return Node_Id is Result_Node : Node_Id; begin Result_Node := Atree.Parent (Node); Skip_Normalized_Declarations_Back (Result_Node); return Result_Node; end Parent; --------------------------- -- Skip_Implicit_Subtype -- --------------------------- procedure Skip_Implicit_Subtype (Constr : in out Node_Id) is begin if not Comes_From_Source (Parent (Constr)) then Constr := Parent (Constr); while Nkind (Constr) /= N_Object_Declaration loop Constr := Next_Non_Pragma (Constr); end loop; Constr := Object_Definition (Constr); end if; end Skip_Implicit_Subtype; --------------------------------------- -- Skip_Normalized_Declarations_Back -- --------------------------------------- procedure Skip_Normalized_Declarations_Back (Node : in out Node_Id) is Arg_Kind : constant Node_Kind := Nkind (Node); begin loop if Arg_Kind = N_Object_Declaration or else Arg_Kind = N_Number_Declaration or else Arg_Kind = N_Discriminant_Specification or else Arg_Kind = N_Component_Declaration or else Arg_Kind = N_Parameter_Specification or else Arg_Kind = N_Exception_Declaration or else Arg_Kind = N_Formal_Object_Declaration then if Prev_Ids (Node) then Node := Prev (Node); while Nkind (Node) /= Arg_Kind loop -- some implicit subtype declarations may be inserted by -- the compiler in between the normalized declarations, so: Node := Prev (Node); end loop; else return; end if; elsif Arg_Kind = N_With_Clause then if First_Name (Node) then return; else Node := Prev (Node); end if; else return; -- nothing to do! end if; end loop; end Skip_Normalized_Declarations_Back; end A4G.Encl_El;
src/input.asm
geniiii/genesis-pong
0
5648
<gh_stars>0 io_ctrl1: equ $A10009 ; 1P control port io_ctrl2: equ $A1000B ; 2P control port io_data1: equ $A10003 ; 1P data port io_data2: equ $A10005 ; 2P data port Input_Init: ; Z80_FastPause move.b #$40, io_ctrl1 move.b #$40, io_data1 move.b #$40, io_ctrl2 move.b #$40, io_data2 ; Z80_Resume Input_UpdateControllerPart: macro write, register move.b #write, (a0) nop nop move.b (a0), register endm Input_Rearrange: macro reg1, reg2 and.b #$3F, reg1 and.b #$30, reg2 add.b reg2, reg2 add.b reg2, reg2 or.b reg2, reg1 not.b reg1 endm Input_UpdatePressed: macro reg, p move.b input_p_held, d5 move.b reg, input_p_held not.b d5 and.b d5, reg move.b reg, input_p_press endm ; Trashes: a0, d4-d7 Input_Update: ; Z80_FastPause lea io_data1, a0 Input_UpdateControllerPart $40, d4 Input_UpdateControllerPart $00, d5 lea io_data2, a0 Input_UpdateControllerPart $40, d6 Input_UpdateControllerPart $00, d7 ; Z80_Resume ; Rearrange bits into SACBRLDU Input_Rearrange d4, d5 ; Controller 1 Input_Rearrange d6, d7 ; Controller 2 Input_UpdatePressed d4, p1 Input_UpdatePressed d6, p2 rts
libs/CPC_V1_SimpleScreenSetup.asm
CurlyPaul/cpc-z80-poc
0
18928
<filename>libs/CPC_V1_SimpleScreenSetup.asm Screen_Init: ; Sets the screen to 16 colour/160 wide mode ld a,0 call &BC0E ; scr_set_mode 0 - 16 colors ret ; This is the screen address table for a standard screen ; Each word in the table is the memory address offest for the start of each screen line ; eg line 1 is at 0000 (scr_start_adr +C000 normally) ; line 2 is at 0800 ; line 3 is at 1000 ; line 4 is at 1800 ; line 5 is at 2000 etc align2 scr_addr_table: defb &00,&00, &00,&08, &00,&10, &00,&18, &00,&20, &00,&28, &00,&30, &00,&38;1 defb &50,&00, &50,&08, &50,&10, &50,&18, &50,&20, &50,&28, &50,&30, &50,&38;2 defb &A0,&00, &A0,&08, &A0,&10, &A0,&18, &A0,&20, &A0,&28, &A0,&30, &A0,&38;3 defb &F0,&00, &F0,&08, &F0,&10, &F0,&18, &F0,&20, &F0,&28, &F0,&30, &F0,&38;4 defb &40,&01, &40,&09, &40,&11, &40,&19, &40,&21, &40,&29, &40,&31, &40,&39;5 defb &90,&01, &90,&09, &90,&11, &90,&19, &90,&21, &90,&29, &90,&31, &90,&39;6 defb &E0,&01, &E0,&09, &E0,&11, &E0,&19, &E0,&21, &E0,&29, &E0,&31, &E0,&39;7 defb &30,&02, &30,&0A, &30,&12, &30,&1A, &30,&22, &30,&2A, &30,&32, &30,&3A;8 defb &80,&02, &80,&0A, &80,&12, &80,&1A, &80,&22, &80,&2A, &80,&32, &80,&3A;9 defb &D0,&02, &D0,&0A, &D0,&12, &D0,&1A, &D0,&22, &D0,&2A, &D0,&32, &D0,&3A;10 defb &20,&03, &20,&0B, &20,&13, &20,&1B, &20,&23, &20,&2B, &20,&33, &20,&3B;11 defb &70,&03, &70,&0B, &70,&13, &70,&1B, &70,&23, &70,&2B, &70,&33, &70,&3B;12 defb &C0,&03, &C0,&0B, &C0,&13, &C0,&1B, &C0,&23, &C0,&2B, &C0,&33, &C0,&3B;13 defb &10,&04, &10,&0C, &10,&14, &10,&1C, &10,&24, &10,&2C, &10,&34, &10,&3C;14 defb &60,&04, &60,&0C, &60,&14, &60,&1C, &60,&24, &60,&2C, &60,&34, &60,&3C;15 defb &B0,&04, &B0,&0C, &B0,&14, &B0,&1C, &B0,&24, &B0,&2C, &B0,&34, &B0,&3C;16 defb &00,&05, &00,&0D, &00,&15, &00,&1D, &00,&25, &00,&2D, &00,&35, &00,&3D;17 defb &50,&05, &50,&0D, &50,&15, &50,&1D, &50,&25, &50,&2D, &50,&35, &50,&3D;18 defb &A0,&05, &A0,&0D, &A0,&15, &A0,&1D, &A0,&25, &A0,&2D, &A0,&35, &A0,&3D;19 defb &F0,&05, &F0,&0D, &F0,&15, &F0,&1D, &F0,&25, &F0,&2D, &F0,&35, &F0,&3D;20 defb &40,&06, &40,&0E, &40,&16, &40,&1E, &40,&26, &40,&2E, &40,&36, &40,&3E;21 defb &90,&06, &90,&0E, &90,&16, &90,&1E, &90,&26, &90,&2E, &90,&36, &90,&3E;22 defb &E0,&06, &E0,&0E, &E0,&16, &E0,&1E, &E0,&26, &E0,&2E, &E0,&36, &E0,&3E;23 defb &30,&07, &30,&0F, &30,&17, &30,&1F, &30,&27, &30,&2F, &30,&37, &30,&3F;24 defb &80,&07, &80,&0F, &80,&17, &80,&1F, &80,&27, &80,&2F, &80,&37, &80,&3F;25
source/regions/regions-contexts-environments-package_nodes.adb
reznikmm/declarative-regions
0
21387
-- SPDX-FileCopyrightText: 2022 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Regions.Contexts.Environments.Package_Nodes is type Entity_Cursor is new Regions.Entity_Cursor with record List_Cursor : Selected_Entity_Name_Lists.Cursor; end record; type Entity_Iterator (Env : not null Regions.Contexts.Environments.Environment_Node_Access) is new Regions.Entity_Iterator_Interfaces.Forward_Iterator with record List : Selected_Entity_Name_Lists.List; end record; overriding function First (Self : Entity_Iterator) return Regions.Entity_Cursor_Class; overriding function Next (Self : Entity_Iterator; Cursor : Regions.Entity_Cursor_Class) return Regions.Entity_Cursor_Class; --------------- -- Empty_Map -- --------------- function Empty_Map (Self : access Package_Node) return Name_List_Maps.Map is begin return Name_List_Maps.Empty_Map (Self.Version'Access); end Empty_Map; ----------- -- First -- ----------- overriding function First (Self : Entity_Iterator) return Regions.Entity_Cursor_Class is First : constant Selected_Entity_Name_Lists.Cursor := Self.List.Iterate.First; begin if Selected_Entity_Name_Lists.Has_Element (First) then return Entity_Cursor' (Entity => Self.Env.Get_Entity (Self.List (First)), List_Cursor => First, Left => Self.List.Length - 1); else return Entity_Cursor'(null, 0, Selected_Entity_Name_Lists.No_Element); end if; end First; ----------------------- -- Immediate_Visible -- ----------------------- overriding function Immediate_Visible (Self : Package_Entity; Symbol : Symbols.Symbol) return Regions.Entity_Iterator_Interfaces.Forward_Iterator'Class is (raise Program_Error); -------------------------------- -- Immediate_Visible_Backward -- -------------------------------- overriding function Immediate_Visible_Backward (Self : Package_Entity; Symbol : Symbols.Symbol) return Regions.Entity_Iterator_Interfaces.Forward_Iterator'Class is Node : Package_Node renames Package_Node (Self.Env.Nodes.Element (Self.Name).all); begin if Node.Names.Contains (Symbol) then declare List : constant Selected_Entity_Name_Lists.List := Node.Names.Element (Symbol); begin return Entity_Iterator'(Self.Env, List); end; else return Entity_Iterator' (Self.Env, Selected_Entity_Name_Lists.Empty_List); end if; end Immediate_Visible_Backward; ---------- -- Next -- ---------- overriding function Next (Self : Entity_Iterator; Cursor : Regions.Entity_Cursor_Class) return Regions.Entity_Cursor_Class is begin if Cursor.Left = 0 then return Entity_Cursor'(null, 0, Selected_Entity_Name_Lists.No_Element); else declare Value : Entity_Cursor renames Entity_Cursor (Cursor); Next : constant Selected_Entity_Name_Lists.Cursor := Self.List.Iterate.Next (Value.List_Cursor); begin return Entity_Cursor' (Entity => Self.Env.Get_Entity (Self.List (Next)), List_Cursor => Next, Left => Cursor.Left - 1); end; end if; end Next; end Regions.Contexts.Environments.Package_Nodes;
test/Succeed/Issue2168.agda
shlevy/agda
1,989
15927
-- Andreas, 2016-09-09 issue #2168 reported by Nisse -- {-# OPTIONS -v tc.cover.splittree:30 -v tc.cc:40 #-} open import Common.Equality data Unit : Set where unit : Unit data Bool : Set where true false : Bool f : Unit → Bool → Bool f unit true = false f = λ _ _ → true -- Testing definitional equality: f-1 : f unit true ≡ false f-1 = refl f-2 : f unit false ≡ true f-2 = refl
programs/oeis/014/A014495.asm
neoneye/loda
22
178768
<reponame>neoneye/loda<filename>programs/oeis/014/A014495.asm ; A014495: Central binomial coefficient - 1. ; 0,0,1,2,5,9,19,34,69,125,251,461,923,1715,3431,6434,12869,24309,48619,92377,184755,352715,705431,1352077,2704155,5200299,10400599,20058299,40116599,77558759,155117519,300540194,601080389,1166803109,2333606219,4537567649,9075135299,17672631899,35345263799,68923264409,137846528819,269128937219,538257874439,1052049481859,2104098963719,4116715363799,8233430727599,16123801841549,32247603683099,63205303218875,126410606437751,247959266474051,495918532948103,973469712824055,1946939425648111,3824345300380219,7648690600760439,15033633249770519,30067266499541039,59132290782430711,118264581564861423,232714176627630543,465428353255261087,916312070471295266,1832624140942590533,3609714217008132869,7219428434016265739,14226520737620288369,28453041475240576739,56093138908331422715,112186277816662845431,221256270138418389601,442512540276836779203,873065282167813104915,1746130564335626209831,3446310324346630677299,6892620648693261354599,13608507434599516007799,27217014869199032015599,53753604366668088230809,107507208733336176461619,212392290424395860814419,424784580848791721628839,839455243105945545123659,1678910486211891090247319,3318776542511877736535399,6637553085023755473070799,13124252690842425594480899,26248505381684851188961799,51913710643776705684835559,103827421287553411369671119,205397724721029574666088519,410795449442059149332177039,812850570172585125274307759,1625701140345170250548615519,3217533506933149454210801549,6435067013866298908421603099,12738806129490428451365214299,25477612258980856902730428599,50445672272782096667406248627 mov $1,$0 div $1,2 bin $0,$1 sub $0,1
techniques/specs/dynamics/light.als
awwx/alloydocs
58
819
<reponame>awwx/alloydocs open util/ordering[Light] as ord abstract sig Color {} one sig Red, Yellow, Green extends Color {} sig Light { color: Color } pred change_light[l: Light] { let l" = l.(ord/next) { l.color = Red => l".color = Green l.color = Green => l".color = Yellow l.color = Yellow => l".color = Red } } fact Trace { ord/first.color = Red all l: Light - ord/last | change_light[l] }
programs/oeis/292/A292286.asm
jmorken/loda
1
163106
<gh_stars>1-10 ; A292286: a(n) = k if the product of the divisors of n is n^k for some integer k, or -1 if no such k exists. For the ambiguous case, define a(1) = 0. ; 0,1,1,-1,1,2,1,2,-1,2,1,3,1,2,2,-1,1,3,1,3,2,2,1,4,-1,2,2,3,1,4,1,3,2,2,2,-1,1,2,2,4,1,4,1,3,3,2,1,5,-1,3,2,3,1,4,2,4,2,2,1,6,1,2,3,-1,2,4,1,3,2,4,1,6,1,2,3,3,2,4,1,5,-1,2,1,6,2,2,2,4,1,6,2,3,2,2,2,6,1,3,3,-1,1,4,1,4,4,2,1,6,1,4,2,5,1,4,2,3,3,2,2,8,-1,2,2,3,2,6,1,4,2,4,1,6,2,2,4,4,1,4,1,6,2,2,2,-1,2,2,3,3,1,6,1,4,3,4,2,6,1,2,2,6,2,5,1,3,4,2,1,8,-1,4,3,3,1,4,3,5,2,2,1,9,1,4,2,4,2,4,2,3,4,4,1,7,1,2,4,-1,1,6,1,6,2,2,2,6,2,2,3,5,2,8,1,3,2,2,2,8,2,2,2,6,2,4,1,6,-1,2,1,6,1,4,4,4,1,6,2,3,2,4,1,10,1,3,3,3,3,4,2,4,2,4 cal $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. cal $0,296065 ; Partial sums of A296064. sub $0,5 mov $1,$0 add $1,6 div $1,2 sub $1,1
_maps/SBZ Stomper and Door.asm
kodishmediacenter/msu-md-sonic
9
16509
; --------------------------------------------------------------------------- ; Sprite mappings - stomper and platforms (SBZ) ; --------------------------------------------------------------------------- Map_Stomp_internal: dc.w @door-Map_Stomp_internal dc.w @stomper-Map_Stomp_internal dc.w @stomper-Map_Stomp_internal dc.w @stomper-Map_Stomp_internal dc.w @bigdoor-Map_Stomp_internal @door: dc.b 4 dc.b $F4, $E, $21, $AF, $C0 ; horizontal sliding door dc.b $F4, $E, $21, $B2, $E0 dc.b $F4, $E, $21, $B2, 0 dc.b $F4, $E, $29, $AF, $20 @stomper: dc.b 8 dc.b $E0, $C, 0, $C, $E4 ; stomper block with yellow/black stripes dc.b $E0, 8, 0, $10, 4 dc.b $E8, $E, $20, $13, $E4 dc.b $E8, $A, $20, $1F, 4 dc.b 0, $E, $20, $13, $E4 dc.b 0, $A, $20, $1F, 4 dc.b $18, $C, 0, $C, $E4 dc.b $18, 8, 0, $10, 4 @bigdoor: dc.b $E dc.b $C0, $F, 0, 0, $80 ; huge diagonal sliding door from SBZ3 dc.b $C0, $F, 0, $10, $A0 dc.b $C0, $F, 0, $20, $C0 dc.b $C0, $F, 0, $10, $E0 dc.b $C0, $F, 0, $20, 0 dc.b $C0, $F, 0, $10, $20 dc.b $C0, $F, 0, $30, $40 dc.b $C0, $D, 0, $40, $60 dc.b $E0, $F, 0, $48, $80 dc.b $E0, $F, 0, $48, $C0 dc.b $E0, $F, 0, $58, 0 dc.b 0, $F, 0, $48, $80 dc.b 0, $F, 0, $58, $C0 dc.b $20, $F, 0, $58, $80 even
test/Fail/Issue280.agda
cruhland/agda
1,989
9154
module Issue280 where data PreModel (C : Set) (M : C → Set) : Set → Set where model : (c : C) → PreModel C M (M c) reflect : (C : Set)(M : C → Set) → PreModel C M C → C reflect .(M c) M (model c) = c
data/wild/maps/VictoryRoad3F.asm
opiter09/ASM-Machina
1
8902
<filename>data/wild/maps/VictoryRoad3F.asm VictoryRoad3FWildMons: def_grass_wildmons 0 ;15 ; encounter rate ;db 24, MACHOP ;db 26, GEODUDE ;db 22, ZUBAT ;db 42, ONIX ;db 40, VENOMOTH ;db 45, ONIX ;db 43, GRAVELER ;db 41, GOLBAT ;db 42, MACHOKE ;db 45, MACHOKE end_grass_wildmons def_water_wildmons 0 ; encounter rate end_water_wildmons
Transynther/x86/_processed/AVXALIGN/_st_zr_/i3-7100_9_0x84_notsx.log_21829_2334.asm
ljhsiun2/medusa
9
21108
<filename>Transynther/x86/_processed/AVXALIGN/_st_zr_/i3-7100_9_0x84_notsx.log_21829_2334.asm .global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r9 push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1c4a5, %rsi lea addresses_normal_ht+0x9111, %rdi cmp $57972, %r11 mov $113, %rcx rep movsl nop nop nop nop xor $8391, %r9 lea addresses_normal_ht+0xcea5, %r15 nop nop dec %r11 movl $0x61626364, (%r15) nop nop nop cmp %rdi, %rdi lea addresses_WC_ht+0x130a5, %rsi lea addresses_WT_ht+0x17aa5, %rdi nop nop nop nop nop cmp %rbx, %rbx mov $9, %rcx rep movsq nop nop nop xor %rcx, %rcx lea addresses_WT_ht+0x16b25, %r9 nop and $15810, %rcx and $0xffffffffffffffc0, %r9 movaps (%r9), %xmm6 vpextrq $0, %xmm6, %rsi nop nop and %rsi, %rsi lea addresses_A_ht+0xcca5, %rbx nop nop nop nop nop cmp $31305, %r15 mov $0x6162636465666768, %rcx movq %rcx, %xmm2 movups %xmm2, (%rbx) nop nop nop cmp $17428, %r11 lea addresses_normal_ht+0x1b955, %rcx nop nop nop cmp $49009, %rbx mov (%rcx), %r9d nop cmp %rdi, %rdi lea addresses_WT_ht+0x5add, %rbx clflush (%rbx) nop nop nop nop nop dec %r15 movb (%rbx), %r9b nop nop nop cmp %r11, %r11 lea addresses_WT_ht+0x1ca05, %r9 nop nop nop nop nop xor $31363, %r15 mov (%r9), %esi nop nop and %rcx, %rcx lea addresses_WT_ht+0x1a515, %rsi lea addresses_WT_ht+0x1c881, %rdi clflush (%rsi) nop inc %rbx mov $86, %rcx rep movsb nop add $7201, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r15 push %rax push %rbx push %rcx push %rsi // Load lea addresses_A+0x1b25, %r15 nop nop cmp %r13, %r13 vmovups (%r15), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %rbx nop nop nop nop add %r15, %r15 // Faulty Load lea addresses_A+0xb0a5, %r15 nop nop nop sub %rcx, %rcx mov (%r15), %ebx lea oracles, %rax and $0xff, %rbx shlq $12, %rbx mov (%rax,%rbx,1), %rbx pop %rsi pop %rcx pop %rbx pop %rax pop %r15 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_A', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_A', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_A', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': True, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'} {'00': 1, '35': 21828} 00 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
experiments/sigma-unification/Demo.agda
AndrasKovacs/elaboration-zoo
242
2094
<filename>experiments/sigma-unification/Demo.agda {-# OPTIONS --type-in-type #-} open import Data.Product renaming (proj₁ to ₁; proj₂ to ₂) open import Relation.Binary.PropositionalEquality open import Function test : Set test = Set where -- (Agda 2.6.1.3) -- works -------------------------------------------------------------------------------- -- eliminating projections -- m : Set × Set -- m = _ -- p₁ = (m .₁ ≡ Set) ∋ refl -- p₂ = (m .₂ ≡ Set) ∋ refl -- currying -- m : Set × Set → Set -- m = _ -- p = λ (A : Set)(B : Set) → m (A , B) ≡ A ∋ refl -- nested currying -- m : Set × (Set × Set) → Set -- m = _ -- p = λ (A : Set)(B : Set)(C : Set) → m (A , (B , C)) ≡ A ∋ refl -- projected variable under pairing -- m : Set × Set → Set -- m = _ -- p = λ (A : Set)(B : Set × Set) → m (A , B .₁) ≡ B .₁ ∋ refl -- non-linearity -- m : Set → Set → Set → Set -- m = _ -- p = λ (A : Set)(B : Set) → m A B B ≡ A ∋ refl -- m A B B =? A -- m = λ A _ _. A -- m : (a : A)(a' : A) → B a → B a' → C -- m a a (b : B a)(b' : B a) -- eta-reduction -- m : (Set → Set × Set) → Set -- m = _ -- p = λ (f : Set → Set × Set) → m (λ x → f x .₁ , f x .₂) ≡ f Set .₁ ∋ refl -- = p = λ (f : Set → Set × Set) → m f ≡ f Set .₁ ∋ refl -- doesn't work ------------------------------------------------------------ -- non-linearity under pairing -- m : Set × Set × Set → Set -- m = _ -- p = λ (A : Set)(B : Set) → m (A , B , B) ≡ A ∋ refl -- flipping -- m : (Set → Set → Set) → Set -- m = _ -- p = λ (f : Set → Set → Set) → m (λ A B → f B A) ≡ f Set (Set → Set) ∋ refl -- projection under λ (no full Skolemization) -- m : (Set → Set) → Set -- m = _ -- p = λ (f : Set → Set × Set) → m (λ A → f A .₁) ≡ f Set .₁ ∋ refl -- flipping + projection -- m : (Set → Set × Set) → Set -- m = _ -- p = λ (f : Set → Set × Set) → m (λ x → f x .₂ , f x .₁) ≡ f Set .₁ ∋ refl
1A/S5/PIM/td/td1/first_negative_or_null.adb
MOUDDENEHamza/ENSEEIHT
4
22933
-------------------------------------------------------------------------------- -- File : first_negative_or_null.adb -- Author : <NAME> -- Target : Réviser les tables de multiplications -- Created : Saturday Nov 30 2019 -------------------------------------------------------------------------------- -- Create a simple program that calculate the first null or negatif term of a -- sequence defined like this : -- Un+1 = (1/2) * Un - 3 *n -- U0 = a -- a is a real number entred by the user with Ada.Text_IO; use Ada.Text_IO; with Ada.Float_Text_IO; use Ada.Float_Text_IO; procedure First_Negative_Or_Null is U0, Un : Float; Rank : Integer; begin Rank := 0; Put ("Please enter the initial term : "); Get (U0); Un := U0; while (Un > 0.0) loop Un := 0.5 * Un - 3.0 * Float (Rank); Rank := Rank + 1; end loop; Put_Line ("This sequence becomes null or negative from the" & Integer'Image (Rank) & " term."); end First_Negative_Or_Null;
Task/Handle-a-signal/Ada/handle-a-signal-2.ada
mullikine/RosettaCodeData
1
17006
package body Sigint_Handler is ------------- -- Handler -- ------------- protected body Handler is ---------- -- Wait -- ---------- entry Wait when Call_Count > 0 is begin Call_Count := Call_Count - 1; end Wait; ------------ -- Handle -- ------------ procedure Handle is begin Call_Count := Call_Count + 1; end Handle; end Handler; end Sigint_Handler;
oeis/060/A060645.asm
neoneye/loda-programs
11
98109
; A060645: a(0) = 0, a(1) = 4, then a(n) = 18*a(n-1) - a(n-2). ; 0,4,72,1292,23184,416020,7465176,133957148,2403763488,43133785636,774004377960,13888945017644,249227005939632,4472197161895732,80250321908183544,1440033597185408060,25840354427429161536,463686346096539499588,8320513875310281831048,149305563409488533459276,2679179627495483320435920,48075927731509211234387284,862687519539670318898535192,15480299423982556528939246172,277782702112146347202007895904,4984608338594651693107202880100,89445167392591584128727643945896,1605028404728053862623990388146028 mul $0,6 mov $2,1 lpb $0 sub $0,2 add $1,$2 add $2,$1 lpe div $1,2 mov $0,$1
Validation/pyFrame3DD-master/gcc-master/gcc/ada/gnatfind.adb
djamal2727/Main-Bearing-Analytical-Model
0
30576
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T F I N D -- -- -- -- B o d y -- -- -- -- Copyright (C) 1998-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 Opt; with Osint; use Osint; with Switch; use Switch; with Types; use Types; with Xr_Tabls; with Xref_Lib; use Xref_Lib; with Ada.Command_Line; use Ada.Command_Line; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Text_IO; use Ada.Text_IO; with GNAT.Command_Line; use GNAT.Command_Line; with System.Strings; use System.Strings; -------------- -- Gnatfind -- -------------- procedure Gnatfind is Output_Ref : Boolean := False; Pattern : Xref_Lib.Search_Pattern; Local_Symbols : Boolean := True; Prj_File : File_Name_String; Prj_File_Length : Natural := 0; Nb_File : Natural := 0; Usage_Error : exception; Full_Path_Name : Boolean := False; Have_Entity : Boolean := False; Wide_Search : Boolean := True; Glob_Mode : Boolean := True; Der_Info : Boolean := False; Type_Tree : Boolean := False; Read_Only : Boolean := False; Source_Lines : Boolean := False; Has_File_In_Entity : Boolean := False; -- Will be true if a file name was specified in the entity RTS_Specified : String_Access := null; -- Used to detect multiple use of --RTS= switch EXT_Specified : String_Access := null; -- Used to detect multiple use of --ext= switch procedure Parse_Cmd_Line; -- Parse every switch on the command line procedure Usage; -- Display the usage procedure Write_Usage; pragma No_Return (Write_Usage); -- Print a small help page for program usage and exit program -------------------- -- Parse_Cmd_Line -- -------------------- procedure Parse_Cmd_Line is procedure Check_Version_And_Help is new Check_Version_And_Help_G (Usage); -- Start of processing for Parse_Cmd_Line begin -- First check for --version or --help Check_Version_And_Help ("GNATFIND", "1998"); -- Now scan the other switches GNAT.Command_Line.Initialize_Option_Scan; loop case GNAT.Command_Line.Getopt ("a aI: aO: d e f g h I: nostdinc nostdlib p: r s t -RTS= -ext=") is when ASCII.NUL => exit; when 'a' => if GNAT.Command_Line.Full_Switch = "a" then Read_Only := True; elsif GNAT.Command_Line.Full_Switch = "aI" then Osint.Add_Src_Search_Dir (GNAT.Command_Line.Parameter); else Osint.Add_Lib_Search_Dir (GNAT.Command_Line.Parameter); end if; when 'd' => Der_Info := True; when 'e' => Glob_Mode := False; when 'f' => Full_Path_Name := True; when 'g' => Local_Symbols := False; when 'h' => Write_Usage; when 'I' => Osint.Add_Src_Search_Dir (GNAT.Command_Line.Parameter); Osint.Add_Lib_Search_Dir (GNAT.Command_Line.Parameter); when 'n' => if GNAT.Command_Line.Full_Switch = "nostdinc" then Opt.No_Stdinc := True; elsif GNAT.Command_Line.Full_Switch = "nostdlib" then Opt.No_Stdlib := True; end if; when 'p' => declare S : constant String := GNAT.Command_Line.Parameter; begin Prj_File_Length := S'Length; Prj_File (1 .. Prj_File_Length) := S; end; when 'r' => Output_Ref := True; when 's' => Source_Lines := True; when 't' => Type_Tree := True; -- Only switch starting with -- recognized is --RTS when '-' => if GNAT.Command_Line.Full_Switch = "-RTS" then -- Check that it is the first time we see this switch if RTS_Specified = null then RTS_Specified := new String'(GNAT.Command_Line.Parameter); elsif RTS_Specified.all /= GNAT.Command_Line.Parameter then Osint.Fail ("--RTS cannot be specified multiple times"); end if; Opt.No_Stdinc := True; Opt.RTS_Switch := True; declare Src_Path_Name : constant String_Ptr := Get_RTS_Search_Dir (GNAT.Command_Line.Parameter, Include); Lib_Path_Name : constant String_Ptr := Get_RTS_Search_Dir (GNAT.Command_Line.Parameter, Objects); begin if Src_Path_Name /= null and then Lib_Path_Name /= null then Add_Search_Dirs (Src_Path_Name, Include); Add_Search_Dirs (Lib_Path_Name, Objects); elsif Src_Path_Name = null and then Lib_Path_Name = null then Osint.Fail ("RTS path not valid: missing " & "adainclude and adalib directories"); elsif Src_Path_Name = null then Osint.Fail ("RTS path not valid: missing " & "adainclude directory"); elsif Lib_Path_Name = null then Osint.Fail ("RTS path not valid: missing " & "adalib directory"); end if; end; -- Process -ext switch elsif GNAT.Command_Line.Full_Switch = "-ext" then -- Check that it is the first time we see this switch if EXT_Specified = null then EXT_Specified := new String'(GNAT.Command_Line.Parameter); elsif EXT_Specified.all /= GNAT.Command_Line.Parameter then Osint.Fail ("--ext cannot be specified multiple times"); end if; if EXT_Specified'Length = Osint.ALI_Default_Suffix'Length then Osint.ALI_Suffix := EXT_Specified.all'Access; else Osint.Fail ("--ext argument must have 3 characters"); end if; end if; when others => Try_Help; raise Usage_Error; end case; end loop; -- Get the other arguments loop declare S : constant String := GNAT.Command_Line.Get_Argument; begin exit when S'Length = 0; -- First argument is the pattern if not Have_Entity then Add_Entity (Pattern, S, Glob_Mode); Have_Entity := True; if not Has_File_In_Entity and then Index (S, ":") /= 0 then Has_File_In_Entity := True; end if; -- Next arguments are the files to search else Add_Xref_File (S); Wide_Search := False; Nb_File := Nb_File + 1; end if; end; end loop; exception when GNAT.Command_Line.Invalid_Switch => Ada.Text_IO.Put_Line ("Invalid switch : " & GNAT.Command_Line.Full_Switch); Try_Help; raise Usage_Error; when GNAT.Command_Line.Invalid_Parameter => Ada.Text_IO.Put_Line ("Parameter missing for : " & GNAT.Command_Line.Full_Switch); Try_Help; raise Usage_Error; when Xref_Lib.Invalid_Argument => Ada.Text_IO.Put_Line ("Invalid line or column in the pattern"); Try_Help; raise Usage_Error; end Parse_Cmd_Line; ----------- -- Usage -- ----------- procedure Usage is begin Put_Line ("Usage: gnatfind pattern[:sourcefile[:line[:column]]] " & "[file1 file2 ...]"); New_Line; Put_Line (" pattern Name of the entity to look for (can have " & "wildcards)"); Put_Line (" sourcefile Only find entities referenced from this " & "file"); Put_Line (" line Only find entities referenced from this line " & "of file"); Put_Line (" column Only find entities referenced from this columns" & " of file"); Put_Line (" file ... Set of Ada source files to search for " & "references. This parameters are optional"); New_Line; Put_Line ("gnatfind switches:"); Display_Usage_Version_And_Help; Put_Line (" -a Consider all files, even when the ali file is " & "readonly"); Put_Line (" -aIdir Specify source files search path"); Put_Line (" -aOdir Specify library/object files search path"); Put_Line (" -d Output derived type information"); Put_Line (" -e Use the full regular expression set for " & "pattern"); Put_Line (" -f Output full path name"); Put_Line (" -g Output information only for global symbols"); Put_Line (" -Idir Like -aIdir -aOdir"); Put_Line (" -nostdinc Don't look for sources in the system default" & " directory"); Put_Line (" -nostdlib Don't look for library files in the system" & " default directory"); Put_Line (" --ext=xxx Specify alternate ali file extension"); Put_Line (" --RTS=dir specify the default source and object search" & " path"); Put_Line (" -p file Use file as the configuration file"); Put_Line (" -r Find all references (default to find declaration" & " only)"); Put_Line (" -s Print source line"); Put_Line (" -t Print type hierarchy"); end Usage; ----------------- -- Write_Usage -- ----------------- procedure Write_Usage is begin Display_Version ("GNATFIND", "1998"); New_Line; Usage; raise Usage_Error; end Write_Usage; -- Start of processing for Gnatfind begin Parse_Cmd_Line; if not Have_Entity then if Argument_Count = 0 then Write_Usage; else Try_Help; raise Usage_Error; end if; end if; -- Special case to speed things up: if the user has a command line of the -- form 'gnatfind entity:file', i.e. has specified a file and only wants -- the bodies and specs, then we can restrict the search to the .ali file -- associated with 'file'. if Has_File_In_Entity and then not Output_Ref then Wide_Search := False; end if; -- Find the project file if Prj_File_Length = 0 then Xr_Tabls.Create_Project_File (Default_Project_File (".")); else Xr_Tabls.Create_Project_File (Prj_File (1 .. Prj_File_Length)); end if; -- Fill up the table if Type_Tree and then Nb_File > 1 then Ada.Text_IO.Put_Line ("Error: for type hierarchy output you must " & "specify only one file."); Ada.Text_IO.New_Line; Try_Help; raise Usage_Error; end if; Search (Pattern, Local_Symbols, Wide_Search, Read_Only, Der_Info, Type_Tree); if Source_Lines then Xr_Tabls.Grep_Source_Files; end if; Print_Gnatfind (Output_Ref, Full_Path_Name); exception when Usage_Error => null; end Gnatfind;
src/generator-rssfeed.adb
bracke/websitegenerator
1
11205
<reponame>bracke/websitegenerator with Xmlhelpers; with Ada.Containers; package body Generator.Rssfeed is use Ada.Containers; use Ada.Characters.Conversions; package DIR renames Ada.Directories; function Create ( Posts : Document_Container.List; Targetpath : String; Site_Set : Translate_Set) return String is Main_Node, Entry_Node : DOM.Core.Element; DOMi : DOM_Implementation; Feed : Node; Entries_Amount : Natural := 0; Filepath : constant String := DIR.Compose (Targetpath, Globals.Feed_filename); File_Handle : Ada.Streams.Stream_IO.File_Type; site_feed_max_items : constant String := Generator.Read_From_Set (Site_Set, "site_feed_max_items"); Max_Items : Natural := 0; begin if site_feed_max_items /= "" then begin Max_Items := Natural'Value (site_feed_max_items); exception when Constraint_Error => Max_Items := 0; end; end if; Feed := Create_Document (Implementation => DOMi); Main_Node := Create_Element (Doc => Feed, Tag_Name => "feed"); DOM.Core.Elements.Set_Attribute (Main_Node, "xmlns", "http://www.w3.org/2005/Atom"); Main_Node := Append_Child (N => Feed, New_Child => Main_Node); Xmlhelpers.Add_Link (Main_Node, Generator.Read_From_Set (Site_Set, "site_base") & "/" & Globals.Feed_filename, "self", Feed); Xmlhelpers.Add_Node ("id", Generator.Read_From_Set (Site_Set, "site_base") & "/", Main_Node, Feed); Xmlhelpers.Add_Node ("title", Generator.Read_From_Set (Site_Set, "site_name"), Main_Node, Feed); Xmlhelpers.Add_Node ("subtitle", Generator.Read_From_Set (Site_Set, "site_description"), Main_Node, Feed); Xmlhelpers.Add_Generator (Main_Node, Feed); Xmlhelpers.Add_Node ("rights", Generator.Read_From_Set (Site_Set, "site_license"), Main_Node, Feed); if Length (Posts) /= 0 then Xmlhelpers.Add_Node ("updated", Read_From_Set (First_Element (Posts).T, "updated"), Main_Node, Feed); end if; Xmlhelpers.Add_Author (Main_Node, Generator.Read_From_Set (Site_Set, "site_author"), Generator.Read_From_Set (Site_Set, "site_base"), Feed); for aPost of Posts loop Entry_Node := Append_Child (Main_Node, Create_Element (Feed, "entry")); Xmlhelpers.Add_Node ("id", Generator.Read_From_Set (Site_Set, "site_base") & "/" & To_String (To_String (aPost.Linkpath)), Entry_Node, Feed); Xmlhelpers.Add_Node ("title", Generator.Read_From_Set (aPost.T, "title"), Entry_Node, Feed); Xmlhelpers.Add_Node ("updated", Generator.Read_From_Set (aPost.T, "updated"), Entry_Node, Feed); Xmlhelpers.Add_Node ("content", Generator.Read_From_Set (aPost.T, "content"), Entry_Node, Feed); Xmlhelpers.Add_Link (Entry_Node, Generator.Read_From_Set (Site_Set, "site_base") & "/" & To_String (To_String (aPost.Linkpath)), "alternate", Feed); if Generator.Read_From_Set (aPost.T, "author") /= "" then Xmlhelpers.Add_Author ( Entry_Node, Generator.Read_From_Set (aPost.T, "author"), Generator.Read_From_Set (aPost.T, "email"), Feed); else Xmlhelpers.Add_Author ( Entry_Node, Generator.Read_From_Set (aPost.T, "site_author"), Generator.Read_From_Set (aPost.T, "site_email"), Feed); end if; if Generator.Read_From_Set (aPost.T, "excerpt") /= "" then Xmlhelpers.Add_Node ("summary", Generator.Read_From_Set (aPost.T, "summary"), Entry_Node, Feed); end if; Entries_Amount := Entries_Amount + 1; exit when Max_Items /= 0 and then Entries_Amount = Max_Items; end loop; Ada.Streams.Stream_IO.Create (File_Handle, Out_File, Filepath); Write (Stream (File => File_Handle), Feed, True); Close (File_Handle); return Filepath; end Create; end Generator.Rssfeed;
unittests/ASM/Primary/Primary_50.asm
cobalt2727/FEX
628
88529
%ifdef CONFIG { "RegData": { "RAX": "0x1", "RBX": "0x2", "RCX": "0x3", "RDX": "0x4", "RBP": "0x5", "RSI": "0x6", "RDI": "0x7", "R15": "0x8" }, "MemoryRegions": { "0x100000000": "4096" } } %endif mov r15, 0xe0000080 mov rax, 1 mov rbx, 2 mov rcx, 3 mov rdx, 4 mov rbp, 5 mov rsi, 6 mov rdi, 7 mov r15, 8 push r15 ; Sub for rsp push rdi push rsi push rbp push rdx push rcx push rbx push rax mov rax, 0 mov rbx, 0 mov rcx, 0 mov rdx, 0 mov rbp, 0 mov rsi, 0 mov rdi, 0 mov r15, 0 pop rax pop rbx pop rcx pop rdx pop rbp pop rsi pop rdi pop r15 hlt
alloy4fun_models/trashltl/models/6/yEi8aXCKoq96R6cbp.als
Kaixi26/org.alloytools.alloy
0
595
<reponame>Kaixi26/org.alloytools.alloy open main pred idyEi8aXCKoq96R6cbp_prop7 { eventually File in Protected } pred __repair { idyEi8aXCKoq96R6cbp_prop7 } check __repair { idyEi8aXCKoq96R6cbp_prop7 <=> prop7o }
dcf/src/dcf-zip-create.ads
onox/dcf-ada
5
7188
-- SPDX-License-Identifier: MIT -- -- Contributed by ITEC - NXP Semiconductors -- June 2008 -- -- Copyright (c) 2008 - 2018 <NAME> (maintainer) -- SWITZERLAND -- -- 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. private with Ada.Containers.Hashed_Maps; private with Ada.Strings.Unbounded.Hash; with DCF.Streams; with DCF.Zip.Compress; with DCF.Zip.Headers; use DCF.Streams; use DCF.Zip.Headers; package DCF.Zip.Create is pragma Preelaborate; type Zip_Create_Info is private; procedure Create (Info : in out Zip_Create_Info; Stream : not null Zipstream_Class_Access; Compress : Zip.Compress.Compression_Method := Zip.Compress.Deflate_1) with Pre => Stream.Get_Name /= "", Post => Is_Created (Info); function Is_Created (Info : Zip_Create_Info) return Boolean; -- Set a new compression format for the next data to be added to the archive. -- Can be useful if data are known to be already compressed - or not. procedure Set (Info : in out Zip_Create_Info; New_Method : Zip.Compress.Compression_Method); procedure Set_Comment (Info : in out Zip_Create_Info; Comment : String); function Name (Info : Zip_Create_Info) return String; procedure Add_Stream (Info : in out Zip_Create_Info; Stream : in out Root_Zipstream_Type'Class; Feedback : in Feedback_Proc; Compressed_Size : out Zip.File_Size_Type; Final_Method : out Natural); -- Add a new entry to a Zip archive, from a general input Zipstream procedure Add_Stream (Info : in out Zip_Create_Info; Stream : in out Root_Zipstream_Type'Class); procedure Add_Compressed_Stream (Info : in out Zip_Create_Info; -- Destination Stream : in out Root_Zipstream_Type'Class; -- Source Feedback : in Feedback_Proc); -- Add a new entry to a Zip archive, copied from another Zip archive. -- This is useful for duplicating archives with some differences, like -- adding, replacing, removing or recompressing entries. See the AZip -- file manager for an application example. -- The streams' indices are set at the beginning of local headers in -- both archives. procedure Finish (Info : in out Zip_Create_Info); -- Complete the Zip archive; close the file if the stream is a file Zip_Capacity_Exceeded : exception; -- The following is raised on cases when the Zip archive creation exceeds -- the Zip_32 format's capacity: 4GB total size, 65535 entries. private type P_String is access String; type Dir_Entry is record Head : Zip.Headers.Central_File_Header; Name : P_String; end record; type Dir_Entries is array (Positive range <>) of Dir_Entry; type Pdir_Entries is access Dir_Entries; -- The use of Hashed_Maps makes Test_Zip_Create_Info_Timing run ~10x faster than -- with the unbalanced binary tree of previous versions. package SU renames Ada.Strings.Unbounded; package Name_Mapping is new Ada.Containers.Hashed_Maps (SU.Unbounded_String, Positive, SU.Hash, SU."="); type Zip_Create_Info is record Stream : Zipstream_Class_Access; Compress : Zip.Compress.Compression_Method; Contains : Pdir_Entries := null; -- 'Contains' has unused room, to avoid reallocating each time: Last_Entry : Natural := 0; -- We set up a name dictionary just for avoiding duplicate entries Dir : Name_Mapping.Map; Zip_Archive_Format : Zip_Archive_Format_Type := Zip_32; Comment : SU.Unbounded_String; end record; end DCF.Zip.Create;
astro_turret_armer_data.asm
nealvis/astroblast
0
91431
////////////////////////////////////////////////////////////////////////////// // astro_turret_armer_data.asm // Copyright(c) 2021 <NAME>. // License: MIT. See LICENSE file in root directory. ////////////////////////////////////////////////////////////////////////////// // file contains the data for turret armer #importonce #import "../nv_c64_util/nv_color_macs.asm" #import "../nv_c64_util/nv_screen_macs.asm" #import "astro_vars_data.asm" ///////////////// // starfield consts and variables // number of steps which in this case won't be the same as number of frames // frames for turret effect. Each step is a different color level for the turret. // the turret will stay at each level for some number of frames defined by // turret_frames_between_steps .const TURRET_ARM_FRAMES=5 // The three modes for the turret. pass into TurretArm .const TURRET_ARM_EASY = 1 .const TURRET_ARM_MED = 2 .const TURRET_ARM_HARD = 3 // number of seconds it should take to arm the turret completely. three // different possibilities for easy, medium, and hard difficulty .const TURRET_SECONDS_TO_ARM_EASY = 4 .const TURRET_SECONDS_TO_ARM_MED = 2 .const TURRET_SECONDS_TO_ARM_HARD = 1.5 // number of frames it takes before a step should be made .const TURRET_FRAMES_BETWEEN_STEPS_EASY = ((TURRET_SECONDS_TO_ARM_EASY * ASTRO_FPS) / TURRET_ARM_FRAMES) .const TURRET_FRAMES_BETWEEN_STEPS_MED = ((TURRET_SECONDS_TO_ARM_MED * ASTRO_FPS) / TURRET_ARM_FRAMES) .const TURRET_FRAMES_BETWEEN_STEPS_HARD = ((TURRET_SECONDS_TO_ARM_HARD * ASTRO_FPS) / TURRET_ARM_FRAMES) // when turret arming starts this will be non zero and count down each frame turret_arm_count: .byte $00 turret_currently_armed: .byte $00 turret_second_counter: .byte $00 turret_second_saved_value: .byte $00 turret_frames_between_steps: .word TURRET_FRAMES_BETWEEN_STEPS_EASY // count down some number of frames between steps. This is the counter. turret_arm_frame_counter: .byte $00 // table of the addresses of all the streams for each frame for turret 2 TurretArmStreamAddrTable: .word turret_arm_stream_frame_1 .word turret_arm_stream_frame_2 .word turret_arm_stream_frame_3 .word turret_arm_stream_frame_4 .word turret_arm_stream_frame_5 turret_arm_stream_empty_frame: .word $FFFF .word $FF .const TURRET_ARM_ROW = 10 .const TURRET_ARM_COL = 38 .const TURRET_ARM_CHAR_TOP = $53 .const TURRET_ARM_CHAR_BOTTOM = $4A turret_arm_stream_frame_1: .word $FFFF .byte $01, NV_COLOR_RED .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+1, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+3, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+4, TURRET_ARM_COL) .word $FFFF .word $FF turret_arm_stream_frame_2: .word $FFFF .byte $01, NV_COLOR_LITE_RED .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+1, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+3, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+4, TURRET_ARM_COL) .word $FFFF .word $FF turret_arm_stream_frame_3: .word $FFFF .byte $01, NV_COLOR_LITE_GREY .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+1, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+3, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+4, TURRET_ARM_COL) .word $FFFF .word $FF turret_arm_stream_frame_4: .word $FFFF .byte $01, NV_COLOR_LITE_GREY .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+1, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+3, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+4, TURRET_ARM_COL) .word $FFFF .word $FF turret_arm_stream_frame_5: .word $FFFF .byte $01, NV_COLOR_YELLOW .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+1, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+3, TURRET_ARM_COL) .word nv_screen_color_addr_from_yx(TURRET_ARM_ROW+4, TURRET_ARM_COL) .word $FFFF .word $FF
antlr4-interpreter/LoxParser.g4
Twinklebear/crafting-interpreters
2
7249
parser grammar LoxParser; options { tokenVocab = LoxLexer; } file: declaration* ; declaration: functionDecl | classDecl | varDeclStmt | statement ; functionDecl: FUN function ; classDecl: CLASS IDENTIFIER LEFT_BRACE function* RIGHT_BRACE ; varDeclStmt: varDecl SEMICOLON ; varDecl: VAR IDENTIFIER (EQUAL expr)? ; function: IDENTIFIER LEFT_PAREN parameters? RIGHT_PAREN block ; parameters: IDENTIFIER (COMMA IDENTIFIER)? ; block: LEFT_BRACE declaration* RIGHT_BRACE ; statement: ifStmt | whileStmt | forStmt | printStmt | returnStmt | block | exprStmt ; ifStmt: IF LEFT_PAREN expr RIGHT_PAREN statement (ELSE statement)? ; whileStmt: WHILE LEFT_PAREN expr RIGHT_PAREN statement ; // Separate names for the possible expressions in the for loop so it's easier to distinguish them // Note: statement can also be optional in most languages (C/C++/etc) forStmt: FOR LEFT_PAREN (varDecl | forInit)? SEMICOLON forCond? SEMICOLON forAdvance? RIGHT_PAREN statement ; forInit: expr ; forCond: expr ; forAdvance: expr ; printStmt: PRINT expr SEMICOLON ; returnStmt: RETURN expr SEMICOLON ; exprStmt: expr SEMICOLON ; /* // Grammar from the book, more nested expr: assignment ; assignment: ( call '.' )? IDENTIFIER '=' assignment | logicOr ; logicOr: logicAnd ( 'or' logicAnd )* ; logicAnd: equality ( 'and' equality )* ; equality: comparison ( ('!=' | '==') comparison )* ; comparison: term ( ('<' | '<=' | '>' | '>=') term )* ; term: factor ( ('-' | '+') factor )* ; factor: unary ( ('/' | '*') unary )* ; unary: ('!' | '-') unary | call ; call: primary ( '(' arguments? ')' | '.' IDENTIFIER )* ; primary: 'true' | 'false' | 'nil' | 'this' | NUMBER | STRING | IDENTIFIER | '(' expr ')' ; */ expr: (MINUS | BANG) expr # Unary | callExpr # Call | expr STAR expr # Mult | expr SLASH expr # Div | expr (PLUS | MINUS) expr # AddSub | expr (LESS | LESS_EQUAL | GREATER | GREATER_EQUAL) expr # Comparison | expr (NOT_EQUAL | EQUAL_EQUAL) expr # Equality | expr AND expr # LogicAnd | expr OR expr # LogicOr | ( callExpr PERIOD )? IDENTIFIER EQUAL expr # Assign | LEFT_PAREN expr RIGHT_PAREN # Parens | (IDENTIFIER | NUMBER | STRING | TRUE | FALSE | NIL) # Primary ; callExpr: IDENTIFIER ( arguments | PERIOD memberIdentifier )* ; arguments: LEFT_PAREN expr? (COMMA expr)* RIGHT_PAREN ; memberIdentifier: IDENTIFIER ;
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c38104a.ada
best08618/asylo
7
5014
<gh_stars>1-10 -- C38104A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT AN INCOMPLETE TYPE WITH DISCRIMINANTS CAN BE -- USED IN AN ACCESS TYPE DEFINITION WITH A COMPATIBLE DISCRIMINANT -- CONSTRAINT. -- HISTORY: -- PMW 09/01/88 CREATED ORIGINAL TEST BY RENAMING E38104A.ADA. WITH REPORT; USE REPORT; PROCEDURE C38104A IS BEGIN TEST ("C38104A","INCOMPLETELY DECLARED TYPE CAN BE USED AS TYPE " & "MARK IN ACCESS TYPE DEFINITION, AND CAN BE CONSTRAINED " & "THERE OR LATER IF INCOMPLETE TYPE HAD DISCRIMINANT(S)"); DECLARE TYPE T1; TYPE T1_NAME IS ACCESS T1; TYPE T1 IS RECORD COMP : INTEGER; END RECORD; TYPE T2(DISC : INTEGER := 5); TYPE T2_NAME1 IS ACCESS T2(5); TYPE T2_NAME2 IS ACCESS T2; SUBTYPE SUB_T2_NAME2 IS T2_NAME2(5); TYPE T2_NAME2_NAME IS ACCESS T2_NAME2(5); X : T2_NAME2(5); TYPE T2(DISC : INTEGER := 5) IS RECORD COMP : T2_NAME2(DISC); END RECORD; X1N : T1_NAME; X2A,X2B : T2; X2N2 : T2_NAME2; BEGIN IF EQUAL(3,3) THEN X1N := NEW T1 '(COMP => 5); END IF; IF X1N.COMP /= 5 THEN FAILED ("ASSIGNMENT FAILED - 1"); END IF; X2A := (DISC => IDENT_INT(7), COMP => NULL); X2N2 := NEW T2(IDENT_INT(7)); X2N2.ALL := X2A; IF EQUAL(3,3) THEN X2B := (DISC => IDENT_INT(7), COMP => X2N2); END IF; IF X2B.COMP.COMP /= NULL OR X2B.COMP.DISC /= 7 THEN FAILED ("ASSIGNMENT FAILED - 2"); END IF; EXCEPTION WHEN OTHERS => FAILED ("EXCEPTION RAISED"); END; RESULT; END C38104A;
scripts/Batch Cue Edits/Clear Gangs.applescript
samschloegel/qlab-scripts
8
4138
<filename>scripts/Batch Cue Edits/Clear Gangs.applescript -- For help, bug reports, or feature suggestions, please visit https://github.com/samschloegel/qlab-scripts -- Built for QLab 4. v211121-01 set outputCount to 16 tell application id "com.figure53.QLab.4" to tell front workspace set theSelection to (selected as list) repeat with eachCue in theSelection repeat with i from 0 to outputCount setGang eachCue row 0 column i gang "" end repeat end repeat end tell
test/Fail/Issue59.agda
alhassy/agda
3
10962
module Issue59 where data Nat : Set where zero : Nat suc : Nat → Nat -- This no longer termination checks with the -- new rules for with. bad : Nat → Nat bad n with n ... | zero = zero ... | suc m = bad m -- This shouldn't termination check. bad₂ : Nat → Nat bad₂ n with bad₂ n ... | m = m
lab2/Lab2_test_case/5.asm
may811204/EE460NCompArchi
0
26183
;5.asm .orig x3000 ADD R0, R0, #0; NOT R0, R0; ADD R0, R0,#-2; RSHFL R1, R0, #1; halt .END
Laburi/Lab11/6-optimize-assembly/optimize.asm
DanBrezeanu/IOCLA
2
9114
<reponame>DanBrezeanu/IOCLA global runAssemblyCode section .text runAssemblyCode: xor eax, eax mov ecx, [esp + 8] mov edx, [esp + 4] L: mov edi, [edx + (ecx - 1) * 4] lea eax, [eax + edi] dec ecx jnz L ret
3-mid/impact/source/3d/collision/narrowphase/impact-d3-collision-convex_raycast-subsimplex.adb
charlie5/lace
20
18136
with impact.d3.Transform; with impact.d3.Vector; with impact.d3.Scalar; -- #include "btSubSimplexConvexCast.h" -- #include "BulletCollision/CollisionShapes/impact.d3.Shape.convex.h" -- -- #include "BulletCollision/CollisionShapes/btMinkowskiSumShape.h" -- #include "BulletCollision/NarrowPhaseCollision/impact.d3.collision.simplex_Solver.h" -- #include "impact.d3.collision.point_Collector.h" -- #include "LinearMath/impact.d3.TransformUtil.h" package body impact.d3.collision.convex_Raycast.subsimplex is function to_convex_Raycast (shapeA, shapeB : in impact.d3.Shape.convex.view; simplexSolver : access impact.d3.collision.simplex_Solver.Item'Class) return Item is Self : Item; begin Self.m_simplexSolver := simplexSolver; Self.m_convexA := shapeA; Self.m_convexB := shapeB; return Self; end to_convex_Raycast; -- Typically the conservative advancement reaches solution in a few iterations, clip it to 32 for degenerate cases. -- See discussion about this here http://continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=565 -- MAX_ITERATIONS : constant := 64; overriding function calcTimeOfImpact (Self : access Item; fromA, toA : in Transform_3d; fromB, toB : in Transform_3d; result : access impact.d3.collision.convex_Raycast.CastResult'Class) return Boolean is use linear_Algebra_3d, impact.d3.Scalar, impact.d3.Vector, impact.d3.Transform, math.Vectors; linVelA : constant math.Vector_3 := getOrigin (toA) - getOrigin (fromA); linVelB : constant math.Vector_3 := getOrigin (toB) - getOrigin (fromB); lambda : math.Real := 0.0; interpolatedTransA : aliased Transform_3d := fromA; interpolatedTransB : aliased Transform_3d := fromB; r : constant math.Vector_3 := linVelA - linVelB; -- take relative motion supVertexA : math.Vector_3 := fromA * Self.m_convexA.localGetSupportingVertex (-r * getBasis (fromA)); supVertexB : math.Vector_3 := fromB * Self.m_convexB.localGetSupportingVertex (r * getBasis (fromB)); v : aliased math.Vector_3 := supVertexA - supVertexB; maxIter : Integer := MAX_ITERATIONS; n : math.Vector_3 := (0.0, 0.0, 0.0); hasResult : Boolean := False; pragma Unreferenced (hasResult); -- c : math.Vector_3; lastLambda : math.Real := lambda; pragma Unreferenced (lastLambda); dist2 : math.Real := length2 (v); epsilon : math.Real := 0.0001; w : math.Vector_3; -- p : math.Vector_3; VdotR, VdotW : math.Real; begin Self.m_simplexSolver.reset; while dist2 > epsilon and then maxIter /= 0 loop maxIter := maxIter - 1; supVertexA := interpolatedTransA * Self.m_convexA.localGetSupportingVertex (-v * getBasis (interpolatedTransA)); supVertexB := interpolatedTransB * Self.m_convexB.localGetSupportingVertex (v * getBasis (interpolatedTransB)); w := supVertexA - supVertexB; VdotW := dot (v, w); if lambda > 1.0 then return False; end if; if VdotW > 0.0 then VdotR := dot (v, r); if VdotR >= -(SIMD_EPSILON * SIMD_EPSILON) then return False; else lambda := lambda - VdotW / VdotR; -- interpolate to next lambda -- x = s + lambda * r; setInterpolate3 (getOrigin (interpolatedTransA'Access).all, getOrigin (fromA), getOrigin (toA), lambda); setInterpolate3 (getOrigin (interpolatedTransB'Access).all, getOrigin (fromB), getOrigin (toB), lambda); -- m_simplexSolver->reset(); -- check next line w := supVertexA - supVertexB; lastLambda := lambda; n := v; hasResult := True; end if; end if; -- Just like regular GJK only add the vertex if it isn't already (close) to current vertex, it would lead to divisions by zero and NaN etc. -- if not Self.m_simplexSolver.inSimplex (w) then Self.m_simplexSolver.addVertex (w, supVertexA, supVertexB); end if; if Self.m_simplexSolver.closest (v'Access) then dist2 := length2 (v); hasResult := True; -- todo: check this normal for validity -- n=v; else dist2 := 0.0; end if; end loop; -- int numiter = MAX_ITERATIONS - maxIter; -- don't report a time of impact when moving 'away' from the hitnormal -- result.m_fraction := lambda; if length2 (n) >= SIMD_EPSILON * SIMD_EPSILON then result.m_normal := normalized (n); else result.m_normal := (0.0, 0.0, 0.0); end if; -- don't report time of impact for motion away from the contact normal (or causes minor penetration) -- if dot (result.m_normal, r) >= -result.m_allowedPenetration then return False; end if; declare hitA, hitB : math.Vector_3; begin Self.m_simplexSolver.compute_points (hitA, hitB); result.m_hitPoint := hitB; end; return True; end calcTimeOfImpact; end impact.d3.collision.convex_Raycast.subsimplex; -- bool impact.d3.collision.convex_Raycast.subsimplex::calcTimeOfImpact( -- const impact.d3.Transform& fromA, -- const impact.d3.Transform& toA, -- const impact.d3.Transform& fromB, -- const impact.d3.Transform& toB, -- CastResult& result) -- { -- -- m_simplexSolver->reset(); -- -- impact.d3.Vector linVelA,linVelB; -- linVelA = toA.getOrigin()-fromA.getOrigin(); -- linVelB = toB.getOrigin()-fromB.getOrigin(); -- -- impact.d3.Scalar lambda = impact.d3.Scalar(0.); -- -- impact.d3.Transform interpolatedTransA = fromA; -- impact.d3.Transform interpolatedTransB = fromB; -- -- ///take relative motion -- impact.d3.Vector r = (linVelA-linVelB); -- impact.d3.Vector v; -- -- impact.d3.Vector supVertexA = fromA(m_convexA->localGetSupportingVertex(-r*fromA.getBasis())); -- impact.d3.Vector supVertexB = fromB(m_convexB->localGetSupportingVertex(r*fromB.getBasis())); -- v = supVertexA-supVertexB; -- int maxIter = MAX_ITERATIONS; -- -- impact.d3.Vector n; -- n.setValue(impact.d3.Scalar(0.),impact.d3.Scalar(0.),impact.d3.Scalar(0.)); -- bool hasResult = false; -- impact.d3.Vector c; -- -- impact.d3.Scalar lastLambda = lambda; -- -- -- impact.d3.Scalar dist2 = v.length2(); -- #ifdef BT_USE_DOUBLE_PRECISION -- impact.d3.Scalar epsilon = impact.d3.Scalar(0.0001); -- #else -- impact.d3.Scalar epsilon = impact.d3.Scalar(0.0001); -- #endif //BT_USE_DOUBLE_PRECISION -- impact.d3.Vector w,p; -- impact.d3.Scalar VdotR; -- -- while ( (dist2 > epsilon) && maxIter--) -- { -- supVertexA = interpolatedTransA(m_convexA->localGetSupportingVertex(-v*interpolatedTransA.getBasis())); -- supVertexB = interpolatedTransB(m_convexB->localGetSupportingVertex(v*interpolatedTransB.getBasis())); -- w = supVertexA-supVertexB; -- -- impact.d3.Scalar VdotW = v.dot(w); -- -- if (lambda > impact.d3.Scalar(1.0)) -- { -- return false; -- } -- -- if ( VdotW > impact.d3.Scalar(0.)) -- { -- VdotR = v.dot(r); -- -- if (VdotR >= -(SIMD_EPSILON*SIMD_EPSILON)) -- return false; -- else -- { -- lambda = lambda - VdotW / VdotR; -- //interpolate to next lambda -- // x = s + lambda * r; -- interpolatedTransA.getOrigin().setInterpolate3(fromA.getOrigin(),toA.getOrigin(),lambda); -- interpolatedTransB.getOrigin().setInterpolate3(fromB.getOrigin(),toB.getOrigin(),lambda); -- //m_simplexSolver->reset(); -- //check next line -- w = supVertexA-supVertexB; -- lastLambda = lambda; -- n = v; -- hasResult = true; -- } -- } -- ///Just like regular GJK only add the vertex if it isn't already (close) to current vertex, it would lead to divisions by zero and NaN etc. -- if (!m_simplexSolver->inSimplex(w)) -- m_simplexSolver->addVertex( w, supVertexA , supVertexB); -- -- if (m_simplexSolver->closest(v)) -- { -- dist2 = v.length2(); -- hasResult = true; -- //todo: check this normal for validity -- //n=v; -- //printf("V=%f , %f, %f\n",v[0],v[1],v[2]); -- //printf("DIST2=%f\n",dist2); -- //printf("numverts = %i\n",m_simplexSolver->numVertices()); -- } else -- { -- dist2 = impact.d3.Scalar(0.); -- } -- } -- -- //int numiter = MAX_ITERATIONS - maxIter; -- // printf("number of iterations: %d", numiter); -- -- //don't report a time of impact when moving 'away' from the hitnormal -- -- -- result.m_fraction = lambda; -- if (n.length2() >= (SIMD_EPSILON*SIMD_EPSILON)) -- result.m_normal = n.normalized(); -- else -- result.m_normal = impact.d3.Vector(impact.d3.Scalar(0.0), impact.d3.Scalar(0.0), impact.d3.Scalar(0.0)); -- -- //don't report time of impact for motion away from the contact normal (or causes minor penetration) -- if (result.m_normal.dot(r)>=-result.m_allowedPenetration) -- return false; -- -- impact.d3.Vector hitA,hitB; -- m_simplexSolver->compute_points(hitA,hitB); -- result.m_hitPoint=hitB; -- return true; -- } -- --
tests/resources/mock_grammars/MockGrammar.g4
pmatos/fuzzinator
202
3145
/* * Copyright (c) 2018 <NAME>, <NAME>. * * Licensed under the BSD 3-Clause License * <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. * This file may not be copied, modified, or distributed except * according to those terms. */ grammar MockGrammar; text: line*; line: CHAR* EOL; CHAR: ~[\n]; EOL: [\n];
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/self_aggregate_with_array.adb
best08618/asylo
7
27671
<gh_stars>1-10 -- { dg-do run } procedure self_aggregate_with_array is type Value_Bounds is array (1 .. 2) of Natural; type Sensor is record Value : Natural; Bounds : Value_Bounds; end record; Pressure : Sensor; begin Pressure.Value := 256; Pressure := (Value => Pressure.Value, Bounds => (1, 2)); if Pressure.Value /= 256 then raise Program_Error; end if; end;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/warn12_pkg.ads
best08618/asylo
7
23965
with Interfaces.C; use Interfaces.C; with System; package Warn12_Pkg is Anysize_Array: constant := 0; type Sid_And_Attributes is record Sid : System.Address; Attributes : Interfaces.C.Unsigned_Long; end record; type Sid_And_Attributes_Array is array (Integer range 0..Anysize_Array) of aliased Sid_And_Attributes; type Token_Groups is record GroupCount : Interfaces.C.Unsigned_Long; Groups : Sid_And_Attributes_Array; end record; end Warn12_Pkg;
alloy4fun_models/trashltl/models/18/mn7f2W74aqtiwqzsw.als
Kaixi26/org.alloytools.alloy
0
3897
<reponame>Kaixi26/org.alloytools.alloy open main pred idmn7f2W74aqtiwqzsw_prop19 { (all f:File | eventually (f in Protected until f in Trash)) } pred __repair { idmn7f2W74aqtiwqzsw_prop19 } check __repair { idmn7f2W74aqtiwqzsw_prop19 <=> prop19o }
STM32F4/ToyOBDH/src/housekeeping.adb
AntonioRamosNieto/TFG-STM32F429
0
293
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2018, Universidad Politécnica de Madrid -- -- -- -- This 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. This software is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY 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 this software; see file -- -- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy -- -- of the license. -- -- -- ------------------------------------------------------------------------------ with HK_Data; use HK_Data; with Sensor; with Storage; with Ada.Real_Time; use Ada.Real_Time; package body Housekeeping is ------------------------- -- Internal operations -- ------------------------- procedure Read_Data; -- Read a value from a temperature sensor ---------------------------- -- Housekeeping task body -- ---------------------------- task body Housekeeping_Task is -- cyclic Next_Time : Time := Clock + Milliseconds (Start_Delay); begin loop delay until Next_Time; Read_Data; Next_Time := Next_Time + Milliseconds (Period); end loop; end Housekeeping_Task; ---------- -- Read -- ---------- procedure Read_Data is Reading : Sensor_Reading; Data : Sensor_Data; SC : Seconds_Count; TS : Time_Span; begin Sensor.Get (Reading); Split (Clock, SC, TS); Data := (Value => Reading, Timestamp => Mission_Time (SC)); Storage.Put (Data); end Read_Data; end Housekeeping;
src/fot/FOTC/Program/SortList/Properties/Totality/BoolI.agda
asr/fotc
11
16333
------------------------------------------------------------------------------ -- Totality properties respect to Bool ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Program.SortList.Properties.Totality.BoolI where open import FOTC.Base open import FOTC.Data.Bool.Type open import FOTC.Data.Bool.PropertiesI open import FOTC.Data.Nat.List.Type open import FOTC.Data.Nat.Type open import FOTC.Program.SortList.SortList ------------------------------------------------------------------------------ le-ItemList-Bool : ∀ {item is} → N item → ListN is → Bool (le-ItemList item is) le-ItemList-Bool {item} Nitem lnnil = subst Bool (sym (le-ItemList-[] item)) btrue le-ItemList-Bool {item} Nitem (lncons {i} {is} Ni Lis) = subst Bool (sym (le-ItemList-∷ item i is)) (&&-Bool (le-Bool Nitem Ni) (le-ItemList-Bool Nitem Lis)) -- See the ATP version. postulate le-Lists-Bool : ∀ {is js} → ListN is → ListN js → Bool (le-Lists is js) -- See the ATP version. postulate ordList-Bool : ∀ {is} → ListN is → Bool (ordList is) le-ItemTree-Bool : ∀ {item t} → N item → Tree t → Bool (le-ItemTree item t) le-ItemTree-Bool {item} _ tnil = subst Bool (sym (le-ItemTree-nil item)) btrue le-ItemTree-Bool {item} Nitem (ttip {i} Ni) = subst Bool (sym (le-ItemTree-tip item i)) (le-Bool Nitem Ni) le-ItemTree-Bool {item} Nitem (tnode {t₁} {i} {t₂} Tt₁ Ni Tt₂) = subst Bool (sym (le-ItemTree-node item t₁ i t₂)) (&&-Bool (le-ItemTree-Bool Nitem Tt₁) (le-ItemTree-Bool Nitem Tt₂)) le-TreeItem-Bool : ∀ {t item} → Tree t → N item → Bool (le-TreeItem t item) le-TreeItem-Bool {item = item} tnil _ = subst Bool (sym (le-TreeItem-nil item)) btrue le-TreeItem-Bool {item = item} (ttip {i} Ni) Nitem = subst Bool (sym (le-TreeItem-tip i item)) (le-Bool Ni Nitem) le-TreeItem-Bool {item = item} (tnode {t₁} {i} {t₂} Tt₁ Ni Tt₂) Nitem = subst Bool (sym (le-TreeItem-node t₁ i t₂ item)) (&&-Bool (le-TreeItem-Bool Tt₁ Nitem) (le-TreeItem-Bool Tt₂ Nitem)) ordTree-Bool : ∀ {t} → Tree t → Bool (ordTree t) ordTree-Bool tnil = subst Bool (sym ordTree-nil) btrue ordTree-Bool (ttip {i} Ni) = subst Bool (sym (ordTree-tip i)) btrue ordTree-Bool (tnode {t₁} {i} {t₂} Tt₁ Ni Tt₂) = subst Bool (sym (ordTree-node t₁ i t₂)) (&&-Bool (ordTree-Bool Tt₁) (&&-Bool (ordTree-Bool Tt₂) (&&-Bool (le-TreeItem-Bool Tt₁ Ni) (le-ItemTree-Bool Ni Tt₂))))
base/remoteboot/bootfloppy/src/bootware/common/common.asm
npocmaka/Windows-Server-2003
17
87620
;==================================================================== ; COMMON.ASM ; ; "Common" routines for Goliath ; ; $History: COMMON.ASM $ ; ; ***************** Version 7 ***************** ; User: <NAME> Date: 11/08/98 Time: 11:31a ; Updated in $/Client Boot/Goliath/BootWare/Common ; Changed banner string. ; ; ***************** Version 6 ***************** ; User: <NAME> Date: 10/08/98 Time: 4:46p ; Updated in $/Client Boot/Goliath/BootWare/Common ; Changed copyright to include 3Com. ; ; ***************** Version 5 ***************** ; User: <NAME> Date: 27/07/98 Time: 4:27p ; Updated in $/Client Boot/Goliath/BootWare/Common ; Company name change. ; ; ***************** Version 4 ***************** ; User: <NAME> Date: 27/07/98 Time: 10:47a ; Updated in $/Client Boot/Goliath/BootWare/Common ; Added include for config.inc. ; ;==================================================================== IDEAL _IDEAL_ = 1 include "..\include\drvseg.inc" include "..\include\bwstruct.inc" include "..\include\config.inc" public ClearScreen public Print public PrintChar public PrintTitle public PrintDecimal public PrintCRLF public PrintSettings public StoDec public Reboot public ErrorMsg extrn LanOption:byte ; NAD extrn BWTable:BWT extrn NIC_RAM:word extrn RomBase:word extrn NIC_IRQ:byte extrn NIC_IO:word extrn NetAddress:word START_CODE P386 BootWareString db "Windows NT Remote Installation Boot Floppy", 13, 10 db "(C) Copyright 1998 Lanworks Technologies Co. a subsidiary of 3Com Corporation", 13, 10 db 'All rights reserved.' CRLF db 13, 10, 0 _NodeString db 'Node: ', 0 _NodeID db 'XXXXXXXXXXXX', 0 ErrorMsg db 'Error: ', 0 include "print.asm" ;-------------------------------------------------------------------- ; PrintTitle ; ; Prints "BootWare Centralized Boot ROM for ..." and copyright ; message at the top of the screen. ; ; Parameters: ; bl - text attribute ; ; Returns: ; dx - next screen location for printing ;-------------------------------------------------------------------- Proc PrintTitle pusha mov bh, bl ; attribute xor cx, cx ; start row/column mov dx, 194Fh ; end row/column mov ax, 0600h ; scroll up 21 lines int 10h ; clear the screen with attribute xor dx, dx xor bh, bh mov ah, 2 int 10h ; set cursor to top left mov al, bl mov bx, offset BootWareString call Print ; print "Copyright...." mov bx, offset LanOption call Print call PrintCRLF call PrintCRLF inc dh ; next row inc dh ; next row xor dl, dl popa ret endp ;-------------------------------------------------------------------- ; PrintSettings ; ; Prints the current ROM configuration settings, RAM base, ROM base, ; I/O, IRQ and ethernet standard, if NetWare, using values in the ; NID/NAD table. ; ; Parameters: ; ax - NAD config text ; ; Returns: ; nothing ;-------------------------------------------------------------------- Proc PrintSettings pusha ; save everything ; Convert the node address from binary to ascii and print it mov di, offset _NodeID mov ax, [NetAddress] call StoHex xchg al, ah call StoHex mov ax, [NetAddress+2] call StoHex xchg al, ah call StoHex mov ax, [NetAddress+4] call StoHex xchg al, ah call StoHex mov bx, offset _NodeString call Print mov bx, offset _NodeID call Print mov bx, offset CRLF call Print popa ; restore everything ret endp ;---------------------------------------------------------------------- ; ClearScreen ; ; Clears the screen. ; ; Parameters: ; none ; ; Returns: ; nothng ;---------------------------------------------------------------------- Proc ClearScreen mov ax, 3 int 010h ; set 80x25 text mode mov ax, 0500h int 010h ; page 0 xor dx, dx xor bh, bh mov ah, 2 int 10h ; set cursor to top left ret endp ClearScreen ;---------------------------------------------------------------------- ; PrintChar ; ; Prints a single character on the screen. ; ; Parameters: ; AL - character ; ; Returns: ; nothing ;---------------------------------------------------------------------- Proc PrintChar push bx ; save bx mov ah, 0Eh mov bx, 0007h ; page 0, normal int 10h ; Write TTY pop bx ; restore bx ret endp ;---------------------------------------------------------------------- ; PrintDecimal ; ; Prints a decimal value. ; ; Parameters: ; AX - value to print ; ; Returns: ; nothing ;---------------------------------------------------------------------- Proc PrintDecimal push bx push cx ; save cx push dx ; save dx xor cx, cx ; clear counter mov bx, 10 __loop1: xor dx, dx div bx ; divide by 10 add dl, 30h ; convert to ASCII character push dx ; save on stack inc cx ; increase counter or ax, ax ; still value remaining? jnz __loop1 ; do more __loop2: pop ax mov ah, 0Eh mov bx, 7 int 10h loop __loop2 pop dx ; restore dx pop cx ; restore cx pop bx ret endp ;---------------------------------------------------------------------- ; PrintCRLF ; ;---------------------------------------------------------------------- Proc PrintCRLF mov bx, offset CRLF jmp Print endp ;---------------------------------------------------------------------- ; StoHex - stuff binary AL as 2 hex digits at ES:DI ; ; Parameters: ; AX - binary digit to print as hex ; ES:DI ptr to string buffer, CLD flag set ; ; Returns: ; nothing (ax, di modified) ; ;---------------------------------------------------------------------- Proc StoHex push ax ; save for lower nibble shr al, 4 call h_digit pop ax ; now do lower nibble h_digit: and al, 0Fh add al, 90h daa adc al, 40h daa stosb ; stuff hex digit in buffer ret endp ;---------------------------------------------------------------------- ; StoDec - stuff AX as CL decimal digits at ES:DI ; ; Parameters: ; AX = number to print as decimal ; ES:DI ptr to leftmost position of field ; CL has width of field, will zero-fill ; ; Returns: ; nothing (ax, di modified) ;---------------------------------------------------------------------- Proc StoDec push cx ; save cx push dx ; save dx push ax ; save ax mov al, '0' mov ch, 0 rep stosb ; fill with zeroes mov cl, 0Ah ; divide by 10 pop ax ; restore value push di ; save ending DI value stoDecNext: xor dx, dx div cx ; ax, dx rem=dx:ax/reg add dl, 30h ; '0' dec di mov [es:di], dl or ax, ax jnz stoDecNext pop di ; restore di pop dx ; restore dx pop cx ; restore cx ret endp ;-------------------------------------------------------------------- ; Reboot ; ; Delays 5 seconds then reboots the PC. ; ;-------------------------------------------------------------------- Proc Reboot test [BWTable.Settings], CFG_WAITKEY ; should we wait for a key? jz noKey ; no key wait mov bx, offset CRLF call Print mov bx, offset KeyWait call Print ; print "Press a key..." getKeyLoop: mov ax, 0100h ; check status int 16h jb getKeyLoop ; keep checking keyboard xor ax, ax int 16h ; read key jmp doReboot noKey: xor ah, ah ; get system tick count int 1Ah ; timer services mov bx, dx ; save starting time add bx, 18*5 ; wait 5 seconds rebootLoop: xor ah, ah ; get system tick count int 1Ah ; timer services cmp bx, dx ; is time up? jnc rebootLoop ; loop until times up doReboot: cli ; disable interrupts db 0EAh, 0, 0, -1, -1 ; reboot system endp Reboot KeyWait db "Press a key to reboot system.", 0 END_CODE end
oeis/026/A026911.asm
neoneye/loda-programs
11
102861
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A026911: T(2n,n-2), T given by A026907. ; Submitted by <NAME> ; 67,348,1495,6108,24501,97456,385900,1524066,6009720,23675882,93226503,367005692,1444728537,5687662392,22395051912,88199397642,347448657492,1369107075762,5396498311992,21277355051610,83918011194996 mov $3,$0 mov $5,4 lpb $5 mov $0,$3 sub $5,1 add $0,$5 add $0,1 mov $2,$0 mul $0,2 sub $2,2 bin $0,$2 mul $0,2 sub $0,$6 mov $6,$5 mul $6,$0 add $4,$6 lpe mov $0,$4 div $0,2 sub $0,18
programs/oeis/036/A036837.asm
karttu/loda
0
95281
<reponame>karttu/loda ; A036837: Schoenheim bound L_1(n,n-5,n-6). ; 4,11,25,50,92,158,257,400,600,873,1237,1713,2325,3100,4069,5266,6729,8500,10625,13155,16145,19655,23750,28500,33981,40274,47466,55650,64925,75397,87178,100387,115150,131600,149878,170132,192518 mov $4,$0 add $4,1 mov $6,$0 lpb $4,1 mov $0,$6 sub $4,1 sub $0,$4 mov $3,$0 trn $0,1 add $0,3 mov $5,$3 add $5,6 bin $5,$0 mov $2,$5 div $2,5 add $1,$2 lpe