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
lab4/somma_selettiva/sommaSelettiva_best.asm
samdsk/lab_arch2
0
168270
<reponame>samdsk/lab_arch2 .data A: .space 200 msginsert_N: .asciiz "Quanti numeri nell'array? (N): " msginsert_INT: .asciiz "Inserire intero: " msginsert_K: .asciiz "Inserire k: " msg_RESULT: .asciiz "Somma: " .text .globl main main: # leggo N ($t0) li $v0, 4 # print_string la $a0, msginsert_N syscall li $v0, 5 # read_int syscall add $t0, $v0, $zero # Se N==0 ho finito (Exit) beq $t0, $zero, Exit # altrimenti N è il secondo parametro per la funzione P add $a1, $t0, $zero # Inserisco gli N interi nell'array ($t1) la $t1, A main_read_A_loop: # leggo prossimo int li $v0, 4 # print_string la $a0, msginsert_INT syscall li $v0, 5 # read_int syscall # memorizzo int nell'array sw $v0, 0($t1) addi $t1, $t1, 4 # controllo se ho finito addi $t0, $t0, -1 bgt $t0, $zero, main_read_A_loop # leggo k li $v0, 4 # print_string la $a0, msginsert_K syscall li $v0, 5 # read_int syscall # $v0 (k) è il primo parametro add $a2, $v0, $zero # array A è il terzo parametro la $a0, A jal P # stampo il risultato add $t0, $v0, $zero li $v0, 4 # print_string la $a0, msg_RESULT syscall li $v0, 1 # print_int add $a0,$zero,$t0 syscall Exit: li $v0, 10 # exit syscall # ------------------------------------------- # Procedura P # $a0 base address dell'array # $a1 numero di elementi nell'array # $a2 è k P: # calcolo offset su indici ($t0 = 1-k) mul $a2, $a2, -1 addi $t0, $a2, 1 add $t1, $t0, $zero # $t1 = i = (1-k) mul $t0, $t0, 4 # $t0 = $t0*4 add $a0, $a0, $t0 # $a0 = $a0 + (1-k)*4 è lo shift iniziale sugli indici li $t0, 0 # inizializzo la somma a 0 ($t0) P_loop: bgt $t1, $a1, P_end # se i > N ho finito (P_end) lw $t2, 0($a0) # altrimenti carico il prossimo elemento da sommare add $t0, $t0, $t2 # aggiorno la somma addi $a0, $a0, 8 # indirizzo del prossimo elemento addi $t1, $t1, 2 # indice del prossimo elemento j P_loop P_end: add $v0, $t0, $zero # carico risultato in $v0 jr $ra # -------------------------------------------
_inc/Debug list - SYZ.asm
NatsumiFox/AMPS-Sonic-1-2005
2
241305
<filename>_inc/Debug list - SYZ.asm<gh_stars>1-10 ; --------------------------------------------------------------------------- ; Debug list - <NAME> ; --------------------------------------------------------------------------- dc.w $F dc.l Map_obj25+$25000000 dc.b 0, 0, $27, $B2 dc.l Map_obj26+$26000000 dc.b 0, 0, 6, $80 dc.l Map_obj36+$36000000 dc.b 0, 0, 5, $1B dc.l Map_obj41+$41000000 dc.b 0, 0, 5, $23 dc.l Map_obj43+$43000000 dc.b 0, 0, 4, $B8 dc.l Map_obj12+$12000000 dc.b 0, 0, 0, 0 dc.l Map_obj47+$47000000 dc.b 0, 0, 3, $80 dc.l Map_obj1F+$1F000000 dc.b 0, 0, 4, 0 dc.l Map_obj22+$22000000 dc.b 0, 0, 4, $44 dc.l Map_obj50+$50000000 dc.b 0, 0, $24, $7B dc.l Map_obj18a+$18000000 dc.b 0, 0, $40, 0 dc.l Map_obj56+$56000000 dc.b 0, 0, $40, 0 dc.l Map_obj32+$32000000 dc.b 0, 0, 5, $13 dc.l Map_obj78+$78000000 dc.b 0, 0, $24, $FF dc.l Map_obj79+$79000000 dc.b 1, 0, 7, $A0 even
programs/oeis/332/A332410.asm
karttu/loda
1
99308
; A332410: a(n) = 2*a(n-1) - a(n-2) + a(n-5) - 2*a(n-6) + a(n-7) with a(0)=0, a(1)=1, a(2)=3, a(3)=6, a(4)=11, a(5)=17, a(6)=24. ; 0,1,3,6,11,17,24,32,41,52,64,77,91,106,123,141,160,180,201,224,248,273,299,326,355,385,416,448,481,516,552,589,627,666,707,749,792,836,881,928,976,1025,1075,1126,1179,1233,1288,1344,1401,1460,1520,1581,1643,1706,1771,1837,1904,1972,2041,2112,2184,2257,2331,2406,2483,2561,2640,2720,2801,2884,2968,3053,3139,3226,3315,3405,3496,3588,3681,3776,3872,3969,4067,4166,4267,4369,4472,4576,4681,4788,4896,5005,5115,5226,5339,5453,5568,5684,5801,5920,6040,6161,6283,6406,6531,6657,6784,6912,7041,7172,7304,7437,7571,7706,7843,7981,8120,8260,8401,8544,8688,8833,8979,9126,9275,9425,9576,9728,9881,10036,10192,10349,10507,10666,10827,10989,11152,11316,11481,11648,11816,11985,12155,12326,12499,12673,12848,13024,13201,13380,13560,13741,13923,14106,14291,14477,14664,14852,15041,15232,15424,15617,15811,16006,16203,16401,16600,16800,17001,17204,17408,17613,17819,18026,18235,18445,18656,18868,19081,19296,19512,19729,19947,20166,20387,20609,20832,21056,21281,21508,21736,21965,22195,22426,22659,22893,23128,23364,23601,23840,24080,24321,24563,24806,25051,25297,25544,25792,26041,26292,26544,26797,27051,27306,27563,27821,28080,28340,28601,28864,29128,29393,29659,29926,30195,30465,30736,31008,31281,31556,31832,32109,32387,32666,32947,33229,33512,33796,34081,34368,34656,34945,35235,35526,35819,36113,36408,36704,37001,37300 mov $2,$0 mul $2,9 add $2,6 mul $0,$2 mov $1,$0 div $1,15
demo0.asm
6502/js6502
18
92081
; ; Special locations ; (they work with LDA/STA abs only!) ; set_palette = $FF00 ; W: sets current index write_color = $FF01 ; W++: R, G or B set_row = $FF02 ; W: pixel row set_col = $FF03 ; W: pixel col write_pixel = $FF04 ; W++: writes a pixel random = $FF80 ; R: a random byte clock0 = $FF81 ; R: updates clock and returns low byte clock1 = $FF82 ; R: returns second byte of clock clock2 = $FF83 ; R: returns third byte of clock clock3 = $FF84 ; R: returns fourth byte of clock ; ; Execution begins at "start" and stops when ; program counter becomes $0000 ; .org $0200 ... put your code here ...
base/crts/crtw32/string/i386/strlen.asm
npocmaka/Windows-Server-2003
17
168245
page ,132 title strlen - return the length of a null-terminated string ;*** ;strlen.asm - contains strlen() routine ; ; Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved. ; ;Purpose: ; strlen returns the length of a null-terminated string, ; not including the null byte itself. ; ;Revision History: ; 04-21-87 SKS Rewritten to be fast and small, added file header ; 05-18-88 SJM Add model-independent (large model) ifdef ; 08-02-88 SJM Add 32 bit code, use cruntime vs cmacros ; 08-23-88 JCR 386 cleanup ; 10-05-88 GJF Fixed off-by-2 error. ; 10-10-88 JCR Minor improvement ; 10-25-88 JCR General cleanup for 386-only code ; 10-26-88 JCR Re-arrange regs to avoid push/pop ebx ; 03-23-90 GJF Changed to _stdcall. Also, fixed the copyright. ; 05-10-91 GJF Back to _cdecl, sigh... ; 04-23-93 GJF Tuned for the 486. ; 06-16-93 GJF Added .FPO directive. ; 11-28-94 GJF New, faster version from Intel. ; 11-28-95 GJF Align main_loop on para boundary for 486 and P6 ; 06-12-01 PML inc->add 1, dec->sub 1 for Pentium 4 perf (vs7#267015) ; ;******************************************************************************* .xlist include cruntime.inc .list page ;*** ;strlen - return the length of a null-terminated string ; ;Purpose: ; Finds the length in bytes of the given string, not including ; the final null character. ; ; Algorithm: ; int strlen (const char * str) ; { ; int length = 0; ; ; while( *str++ ) ; ++length; ; ; return( length ); ; } ; ;Entry: ; const char * str - string whose length is to be computed ; ;Exit: ; EAX = length of the string "str", exclusive of the final null byte ; ;Uses: ; EAX, ECX, EDX ; ;Exceptions: ; ;******************************************************************************* CODESEG public strlen strlen proc .FPO ( 0, 1, 0, 0, 0, 0 ) string equ [esp + 4] mov ecx,string ; ecx -> string test ecx,3 ; test if string is aligned on 32 bits je short main_loop str_misaligned: ; simple byte loop until string is aligned mov al,byte ptr [ecx] add ecx,1 test al,al je short byte_3 test ecx,3 jne short str_misaligned add eax,dword ptr 0 ; 5 byte nop to align label below align 16 ; should be redundant main_loop: mov eax,dword ptr [ecx] ; read 4 bytes mov edx,7efefeffh add edx,eax xor eax,-1 xor eax,edx add ecx,4 test eax,81010100h je short main_loop ; found zero byte in the loop mov eax,[ecx - 4] test al,al ; is it byte 0 je short byte_0 test ah,ah ; is it byte 1 je short byte_1 test eax,00ff0000h ; is it byte 2 je short byte_2 test eax,0ff000000h ; is it byte 3 je short byte_3 jmp short main_loop ; taken if bits 24-30 are clear and bit ; 31 is set byte_3: lea eax,[ecx - 1] mov ecx,string sub eax,ecx ret byte_2: lea eax,[ecx - 2] mov ecx,string sub eax,ecx ret byte_1: lea eax,[ecx - 3] mov ecx,string sub eax,ecx ret byte_0: lea eax,[ecx - 4] mov ecx,string sub eax,ecx ret strlen endp end
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/array_no_def_init.ads
best08618/asylo
7
7498
<reponame>best08618/asylo<gh_stars>1-10 -- { dg-do compile } pragma Restrictions (No_Default_Initialization); package Array_No_Def_Init is type Int_Array is array (Natural range <>) of Integer; IA : Int_Array (1 .. 10); end Array_No_Def_Init;
software/hal/boards/pixracer_v1/media_reader-sdcard-config.ads
TUM-EI-RCS/StratoX
12
11501
<reponame>TUM-EI-RCS/StratoX<filename>software/hal/boards/pixracer_v1/media_reader-sdcard-config.ads<gh_stars>10-100 -- Based on AdaCore's Ada Drivers Library, -- see https://github.com/AdaCore/Ada_Drivers_Library, -- checkout 93b5f269341f970698af18f9182fac82a0be66c3. -- Copyright (C) Adacore -- -- Institution: Technische Universität München -- Department: Real-Time Computer Systems (RCS) -- Project: StratoX -- Authors: <NAME> (<EMAIL>) with Ada.Interrupts.Names; with STM32.GPIO; with STM32.DMA; use STM32.DMA; with STM32.Device; use STM32.Device; with STM32_SVD.SDIO; -- @summary -- Mapping of system resources for Pixracer V1 -- -- based on https://raw.githubusercontent.com/AdaCore/Ada_Drivers_Library/ -- master/examples/sdcard/src/stm32f7/device_sd_configuration.ads. package Media_Reader.SDCard.Config is SD_Pins : constant STM32.GPIO.GPIO_Points := (PC8, PC9, PC10, PC11, PC12, PD2); -- manual: 8x data, 1xCK, 1x CMD -- PC8=D0, PC9=D1, PC10=D2, PC11=D3, PC12=CK, PD2=CMD --SD_Detect_Pin : constant STM32.GPIO.GPIO_Point := PC11; -- no card detect pin on pixracer -- DMA: DMA2 (Stream 3 or Stream 6) with Channel4 SD_DMA : DMA_Controller renames DMA_2; SD_DMA_Rx_Channel : constant DMA_Channel_Selector := Channel_4; SD_DMA_Rx_Stream : constant DMA_Stream_Selector := Stream_3; Rx_IRQ : Ada.Interrupts.Interrupt_ID renames Ada.Interrupts.Names.DMA2_Stream3_Interrupt; SD_DMA_Tx_Channel : constant DMA_Channel_Selector := Channel_4; SD_DMA_Tx_Stream : constant DMA_Stream_Selector := Stream_6; Tx_IRQ : Ada.Interrupts.Interrupt_ID renames Ada.Interrupts.Names.DMA2_Stream6_Interrupt; SD_Interrupt : Ada.Interrupts.Interrupt_ID renames Ada.Interrupts.Names.SDIO_Interrupt; SD_Device : STM32_SVD.SDIO.SDIO_Peripheral renames STM32_SVD.SDIO.SDIO_Periph; procedure Enable_Clock_Device; procedure Reset_Device; end Media_Reader.SDCard.Config;
table.asm
kenyapcomau/8042-metronome
0
161631
tbot: ; count ; tempo .db 250 ; 60 .db 245 ; 61 .db 241 ; 62 .db 238 ; 63 .db 234 ; 64 .db 230 ; 65 .db 227 ; 66 .db 223 ; 67 .db 220 ; 68 .db 217 ; 69 .db 214 ; 70 .db 211 ; 71 .db 208 ; 72 .db 205 ; 73 .db 202 ; 74 .db 200 ; 75 .db 197 ; 76 .db 194 ; 77 .db 192 ; 78 .db 189 ; 79 .db 187 ; 80 .db 182 ; 82 .db 178 ; 84 .db 174 ; 86 .db 170 ; 88 .db 166 ; 90 .db 163 ; 92 .db 159 ; 94 .db 156 ; 96 .db 153 ; 98 .db 150 ; 100 .db 147 ; 102 .db 144 ; 104 .db 141 ; 106 .db 138 ; 108 .db 136 ; 110 defbpm: .db 133 ; 112 .db 131 ; 114 .db 129 ; 116 .db 127 ; 118 .db 125 ; 120 .db 121 ; 123 .db 119 ; 126 .db 116 ; 129 .db 113 ; 132 .db 111 ; 135 .db 108 ; 138 .db 106 ; 141 .db 104 ; 144 .db 102 ; 147 .db 100 ; 150 .db 98 ; 153 .db 96 ; 156 .db 93 ; 160 .db 91 ; 164 .db 89 ; 168 .db 87 ; 172 .db 85 ; 176 .db 83 ; 180 .db 81 ; 184 .db 79 ; 188 .db 78 ; 192 .db 76 ; 196 .db 75 ; 200 .db 73 ; 204 .db 72 ; 208 .db 70 ; 212 .db 69 ; 216 .db 68 ; 220 .db 66 ; 224 .db 65 ; 228 .db 64 ; 232 .db 63 ; 236 ttop: bcdtempi: ; table of bcdtempi in BCD for a display .db 0x60,0x0 .db 0x61,0x0 .db 0x62,0x0 .db 0x63,0x0 .db 0x64,0x0 .db 0x65,0x0 .db 0x66,0x0 .db 0x67,0x0 .db 0x68,0x0 .db 0x69,0x0 .db 0x70,0x0 .db 0x71,0x0 .db 0x72,0x0 .db 0x73,0x0 .db 0x74,0x0 .db 0x75,0x0 .db 0x76,0x0 .db 0x77,0x0 .db 0x78,0x0 .db 0x79,0x0 .db 0x80,0x0 .db 0x82,0x0 .db 0x84,0x0 .db 0x86,0x0 .db 0x88,0x0 .db 0x90,0x0 .db 0x92,0x0 .db 0x94,0x0 .db 0x96,0x0 .db 0x98,0x0 .db 0x00,0x1 .db 0x02,0x1 .db 0x04,0x1 .db 0x06,0x1 .db 0x08,0x1 .db 0x10,0x1 .db 0x12,0x1 .db 0x14,0x1 .db 0x16,0x1 .db 0x18,0x1 .db 0x20,0x1 .db 0x23,0x1 .db 0x26,0x1 .db 0x29,0x1 .db 0x32,0x1 .db 0x35,0x1 .db 0x38,0x1 .db 0x41,0x1 .db 0x44,0x1 .db 0x47,0x1 .db 0x50,0x1 .db 0x53,0x1 .db 0x56,0x1 .db 0x60,0x1 .db 0x64,0x1 .db 0x68,0x1 .db 0x72,0x1 .db 0x76,0x1 .db 0x80,0x1 .db 0x84,0x1 .db 0x88,0x1 .db 0x92,0x1 .db 0x96,0x1 .db 0x00,0x2 .db 0x04,0x2 .db 0x08,0x2 .db 0x12,0x2 .db 0x16,0x2 .db 0x20,0x2 .db 0x24,0x2 .db 0x28,0x2 .db 0x32,0x2 .db 0x36,0x2
gcc-gcc-7_3_0-release/gcc/ada/a-strunb-shared.adb
best08618/asylo
7
167
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S T R I N G S . U N B O U N D E D -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2016, 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 Ada.Strings.Search; with Ada.Unchecked_Deallocation; package body Ada.Strings.Unbounded is use Ada.Strings.Maps; Growth_Factor : constant := 32; -- The growth factor controls how much extra space is allocated when -- we have to increase the size of an allocated unbounded string. By -- allocating extra space, we avoid the need to reallocate on every -- append, particularly important when a string is built up by repeated -- append operations of small pieces. This is expressed as a factor so -- 32 means add 1/32 of the length of the string as growth space. Min_Mul_Alloc : constant := Standard'Maximum_Alignment; -- Allocation will be done by a multiple of Min_Mul_Alloc. This causes -- no memory loss as most (all?) malloc implementations are obliged to -- align the returned memory on the maximum alignment as malloc does not -- know the target alignment. function Aligned_Max_Length (Max_Length : Natural) return Natural; -- Returns recommended length of the shared string which is greater or -- equal to specified length. Calculation take in sense alignment of the -- allocated memory segments to use memory effectively by Append/Insert/etc -- operations. --------- -- "&" -- --------- function "&" (Left : Unbounded_String; Right : Unbounded_String) return Unbounded_String is LR : constant Shared_String_Access := Left.Reference; RR : constant Shared_String_Access := Right.Reference; DL : constant Natural := LR.Last + RR.Last; DR : Shared_String_Access; begin -- Result is an empty string, reuse shared empty string if DL = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Left string is empty, return Right string elsif LR.Last = 0 then Reference (RR); DR := RR; -- Right string is empty, return Left string elsif RR.Last = 0 then Reference (LR); DR := LR; -- Otherwise, allocate new shared string and fill data else DR := Allocate (DL); DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); DR.Data (LR.Last + 1 .. DL) := RR.Data (1 .. RR.Last); DR.Last := DL; end if; return (AF.Controlled with Reference => DR); end "&"; function "&" (Left : Unbounded_String; Right : String) return Unbounded_String is LR : constant Shared_String_Access := Left.Reference; DL : constant Natural := LR.Last + Right'Length; DR : Shared_String_Access; begin -- Result is an empty string, reuse shared empty string if DL = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Right is an empty string, return Left string elsif Right'Length = 0 then Reference (LR); DR := LR; -- Otherwise, allocate new shared string and fill it else DR := Allocate (DL); DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); DR.Data (LR.Last + 1 .. DL) := Right; DR.Last := DL; end if; return (AF.Controlled with Reference => DR); end "&"; function "&" (Left : String; Right : Unbounded_String) return Unbounded_String is RR : constant Shared_String_Access := Right.Reference; DL : constant Natural := Left'Length + RR.Last; DR : Shared_String_Access; begin -- Result is an empty string, reuse shared one if DL = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Left is empty string, return Right string elsif Left'Length = 0 then Reference (RR); DR := RR; -- Otherwise, allocate new shared string and fill it else DR := Allocate (DL); DR.Data (1 .. Left'Length) := Left; DR.Data (Left'Length + 1 .. DL) := RR.Data (1 .. RR.Last); DR.Last := DL; end if; return (AF.Controlled with Reference => DR); end "&"; function "&" (Left : Unbounded_String; Right : Character) return Unbounded_String is LR : constant Shared_String_Access := Left.Reference; DL : constant Natural := LR.Last + 1; DR : Shared_String_Access; begin DR := Allocate (DL); DR.Data (1 .. LR.Last) := LR.Data (1 .. LR.Last); DR.Data (DL) := Right; DR.Last := DL; return (AF.Controlled with Reference => DR); end "&"; function "&" (Left : Character; Right : Unbounded_String) return Unbounded_String is RR : constant Shared_String_Access := Right.Reference; DL : constant Natural := 1 + RR.Last; DR : Shared_String_Access; begin DR := Allocate (DL); DR.Data (1) := Left; DR.Data (2 .. DL) := RR.Data (1 .. RR.Last); DR.Last := DL; return (AF.Controlled with Reference => DR); end "&"; --------- -- "*" -- --------- function "*" (Left : Natural; Right : Character) return Unbounded_String is DR : Shared_String_Access; begin -- Result is an empty string, reuse shared empty string if Left = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Otherwise, allocate new shared string and fill it else DR := Allocate (Left); for J in 1 .. Left loop DR.Data (J) := Right; end loop; DR.Last := Left; end if; return (AF.Controlled with Reference => DR); end "*"; function "*" (Left : Natural; Right : String) return Unbounded_String is DL : constant Natural := Left * Right'Length; DR : Shared_String_Access; K : Positive; begin -- Result is an empty string, reuse shared empty string if DL = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Otherwise, allocate new shared string and fill it else DR := Allocate (DL); K := 1; for J in 1 .. Left loop DR.Data (K .. K + Right'Length - 1) := Right; K := K + Right'Length; end loop; DR.Last := DL; end if; return (AF.Controlled with Reference => DR); end "*"; function "*" (Left : Natural; Right : Unbounded_String) return Unbounded_String is RR : constant Shared_String_Access := Right.Reference; DL : constant Natural := Left * RR.Last; DR : Shared_String_Access; K : Positive; begin -- Result is an empty string, reuse shared empty string if DL = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Coefficient is one, just return string itself elsif Left = 1 then Reference (RR); DR := RR; -- Otherwise, allocate new shared string and fill it else DR := Allocate (DL); K := 1; for J in 1 .. Left loop DR.Data (K .. K + RR.Last - 1) := RR.Data (1 .. RR.Last); K := K + RR.Last; end loop; DR.Last := DL; end if; return (AF.Controlled with Reference => DR); end "*"; --------- -- "<" -- --------- function "<" (Left : Unbounded_String; Right : Unbounded_String) return Boolean is LR : constant Shared_String_Access := Left.Reference; RR : constant Shared_String_Access := Right.Reference; begin return LR.Data (1 .. LR.Last) < RR.Data (1 .. RR.Last); end "<"; function "<" (Left : Unbounded_String; Right : String) return Boolean is LR : constant Shared_String_Access := Left.Reference; begin return LR.Data (1 .. LR.Last) < Right; end "<"; function "<" (Left : String; Right : Unbounded_String) return Boolean is RR : constant Shared_String_Access := Right.Reference; begin return Left < RR.Data (1 .. RR.Last); end "<"; ---------- -- "<=" -- ---------- function "<=" (Left : Unbounded_String; Right : Unbounded_String) return Boolean is LR : constant Shared_String_Access := Left.Reference; RR : constant Shared_String_Access := Right.Reference; begin -- LR = RR means two strings shares shared string, thus they are equal return LR = RR or else LR.Data (1 .. LR.Last) <= RR.Data (1 .. RR.Last); end "<="; function "<=" (Left : Unbounded_String; Right : String) return Boolean is LR : constant Shared_String_Access := Left.Reference; begin return LR.Data (1 .. LR.Last) <= Right; end "<="; function "<=" (Left : String; Right : Unbounded_String) return Boolean is RR : constant Shared_String_Access := Right.Reference; begin return Left <= RR.Data (1 .. RR.Last); end "<="; --------- -- "=" -- --------- function "=" (Left : Unbounded_String; Right : Unbounded_String) return Boolean is LR : constant Shared_String_Access := Left.Reference; RR : constant Shared_String_Access := Right.Reference; begin return LR = RR or else LR.Data (1 .. LR.Last) = RR.Data (1 .. RR.Last); -- LR = RR means two strings shares shared string, thus they are equal end "="; function "=" (Left : Unbounded_String; Right : String) return Boolean is LR : constant Shared_String_Access := Left.Reference; begin return LR.Data (1 .. LR.Last) = Right; end "="; function "=" (Left : String; Right : Unbounded_String) return Boolean is RR : constant Shared_String_Access := Right.Reference; begin return Left = RR.Data (1 .. RR.Last); end "="; --------- -- ">" -- --------- function ">" (Left : Unbounded_String; Right : Unbounded_String) return Boolean is LR : constant Shared_String_Access := Left.Reference; RR : constant Shared_String_Access := Right.Reference; begin return LR.Data (1 .. LR.Last) > RR.Data (1 .. RR.Last); end ">"; function ">" (Left : Unbounded_String; Right : String) return Boolean is LR : constant Shared_String_Access := Left.Reference; begin return LR.Data (1 .. LR.Last) > Right; end ">"; function ">" (Left : String; Right : Unbounded_String) return Boolean is RR : constant Shared_String_Access := Right.Reference; begin return Left > RR.Data (1 .. RR.Last); end ">"; ---------- -- ">=" -- ---------- function ">=" (Left : Unbounded_String; Right : Unbounded_String) return Boolean is LR : constant Shared_String_Access := Left.Reference; RR : constant Shared_String_Access := Right.Reference; begin -- LR = RR means two strings shares shared string, thus they are equal return LR = RR or else LR.Data (1 .. LR.Last) >= RR.Data (1 .. RR.Last); end ">="; function ">=" (Left : Unbounded_String; Right : String) return Boolean is LR : constant Shared_String_Access := Left.Reference; begin return LR.Data (1 .. LR.Last) >= Right; end ">="; function ">=" (Left : String; Right : Unbounded_String) return Boolean is RR : constant Shared_String_Access := Right.Reference; begin return Left >= RR.Data (1 .. RR.Last); end ">="; ------------ -- Adjust -- ------------ procedure Adjust (Object : in out Unbounded_String) is begin Reference (Object.Reference); end Adjust; ------------------------ -- Aligned_Max_Length -- ------------------------ function Aligned_Max_Length (Max_Length : Natural) return Natural is Static_Size : constant Natural := Empty_Shared_String'Size / Standard'Storage_Unit; -- Total size of all static components begin return ((Static_Size + Max_Length - 1) / Min_Mul_Alloc + 2) * Min_Mul_Alloc - Static_Size; end Aligned_Max_Length; -------------- -- Allocate -- -------------- function Allocate (Max_Length : Natural) return not null Shared_String_Access is begin -- Empty string requested, return shared empty string if Max_Length = 0 then Reference (Empty_Shared_String'Access); return Empty_Shared_String'Access; -- Otherwise, allocate requested space (and probably some more room) else return new Shared_String (Aligned_Max_Length (Max_Length)); end if; end Allocate; ------------ -- Append -- ------------ procedure Append (Source : in out Unbounded_String; New_Item : Unbounded_String) is SR : constant Shared_String_Access := Source.Reference; NR : constant Shared_String_Access := New_Item.Reference; DL : constant Natural := SR.Last + NR.Last; DR : Shared_String_Access; begin -- Source is an empty string, reuse New_Item data if SR.Last = 0 then Reference (NR); Source.Reference := NR; Unreference (SR); -- New_Item is empty string, nothing to do elsif NR.Last = 0 then null; -- Try to reuse existing shared string elsif Can_Be_Reused (SR, DL) then SR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last); SR.Last := DL; -- Otherwise, allocate new one and fill it else DR := Allocate (DL + DL / Growth_Factor); DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); DR.Data (SR.Last + 1 .. DL) := NR.Data (1 .. NR.Last); DR.Last := DL; Source.Reference := DR; Unreference (SR); end if; end Append; procedure Append (Source : in out Unbounded_String; New_Item : String) is SR : constant Shared_String_Access := Source.Reference; DL : constant Natural := SR.Last + New_Item'Length; DR : Shared_String_Access; begin -- New_Item is an empty string, nothing to do if New_Item'Length = 0 then null; -- Try to reuse existing shared string elsif Can_Be_Reused (SR, DL) then SR.Data (SR.Last + 1 .. DL) := New_Item; SR.Last := DL; -- Otherwise, allocate new one and fill it else DR := Allocate (DL + DL / Growth_Factor); DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); DR.Data (SR.Last + 1 .. DL) := New_Item; DR.Last := DL; Source.Reference := DR; Unreference (SR); end if; end Append; procedure Append (Source : in out Unbounded_String; New_Item : Character) is SR : constant Shared_String_Access := Source.Reference; DL : constant Natural := SR.Last + 1; DR : Shared_String_Access; begin -- Try to reuse existing shared string if Can_Be_Reused (SR, SR.Last + 1) then SR.Data (SR.Last + 1) := New_Item; SR.Last := SR.Last + 1; -- Otherwise, allocate new one and fill it else DR := Allocate (DL + DL / Growth_Factor); DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); DR.Data (DL) := New_Item; DR.Last := DL; Source.Reference := DR; Unreference (SR); end if; end Append; ------------------- -- Can_Be_Reused -- ------------------- function Can_Be_Reused (Item : not null Shared_String_Access; Length : Natural) return Boolean is begin return System.Atomic_Counters.Is_One (Item.Counter) and then Item.Max_Length >= Length and then Item.Max_Length <= Aligned_Max_Length (Length + Length / Growth_Factor); end Can_Be_Reused; ----------- -- Count -- ----------- function Count (Source : Unbounded_String; Pattern : String; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural is SR : constant Shared_String_Access := Source.Reference; begin return Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping); end Count; function Count (Source : Unbounded_String; Pattern : String; Mapping : Maps.Character_Mapping_Function) return Natural is SR : constant Shared_String_Access := Source.Reference; begin return Search.Count (SR.Data (1 .. SR.Last), Pattern, Mapping); end Count; function Count (Source : Unbounded_String; Set : Maps.Character_Set) return Natural is SR : constant Shared_String_Access := Source.Reference; begin return Search.Count (SR.Data (1 .. SR.Last), Set); end Count; ------------ -- Delete -- ------------ function Delete (Source : Unbounded_String; From : Positive; Through : Natural) return Unbounded_String is SR : constant Shared_String_Access := Source.Reference; DL : Natural; DR : Shared_String_Access; begin -- Empty slice is deleted, use the same shared string if From > Through then Reference (SR); DR := SR; -- Index is out of range elsif Through > SR.Last then raise Index_Error; -- Compute size of the result else DL := SR.Last - (Through - From + 1); -- Result is an empty string, reuse shared empty string if DL = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Otherwise, allocate new shared string and fill it else DR := Allocate (DL); DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1); DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); DR.Last := DL; end if; end if; return (AF.Controlled with Reference => DR); end Delete; procedure Delete (Source : in out Unbounded_String; From : Positive; Through : Natural) is SR : constant Shared_String_Access := Source.Reference; DL : Natural; DR : Shared_String_Access; begin -- Nothing changed, return if From > Through then null; -- Through is outside of the range elsif Through > SR.Last then raise Index_Error; else DL := SR.Last - (Through - From + 1); -- Result is empty, reuse shared empty string if DL = 0 then Reference (Empty_Shared_String'Access); Source.Reference := Empty_Shared_String'Access; Unreference (SR); -- Try to reuse existing shared string elsif Can_Be_Reused (SR, DL) then SR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); SR.Last := DL; -- Otherwise, allocate new shared string else DR := Allocate (DL); DR.Data (1 .. From - 1) := SR.Data (1 .. From - 1); DR.Data (From .. DL) := SR.Data (Through + 1 .. SR.Last); DR.Last := DL; Source.Reference := DR; Unreference (SR); end if; end if; end Delete; ------------- -- Element -- ------------- function Element (Source : Unbounded_String; Index : Positive) return Character is SR : constant Shared_String_Access := Source.Reference; begin if Index <= SR.Last then return SR.Data (Index); else raise Index_Error; end if; end Element; -------------- -- Finalize -- -------------- procedure Finalize (Object : in out Unbounded_String) is SR : constant not null Shared_String_Access := Object.Reference; begin if SR /= Null_Unbounded_String.Reference then -- The same controlled object can be finalized several times for -- some reason. As per 7.6.1(24) this should have no ill effect, -- so we need to add a guard for the case of finalizing the same -- object twice. -- We set the Object to the empty string so there will be no ill -- effects if a program references an already-finalized object. Object.Reference := Null_Unbounded_String.Reference; Reference (Object.Reference); Unreference (SR); end if; end Finalize; ---------------- -- Find_Token -- ---------------- procedure Find_Token (Source : Unbounded_String; Set : Maps.Character_Set; From : Positive; Test : Strings.Membership; First : out Positive; Last : out Natural) is SR : constant Shared_String_Access := Source.Reference; begin Search.Find_Token (SR.Data (From .. SR.Last), Set, Test, First, Last); end Find_Token; procedure Find_Token (Source : Unbounded_String; Set : Maps.Character_Set; Test : Strings.Membership; First : out Positive; Last : out Natural) is SR : constant Shared_String_Access := Source.Reference; begin Search.Find_Token (SR.Data (1 .. SR.Last), Set, Test, First, Last); end Find_Token; ---------- -- Free -- ---------- procedure Free (X : in out String_Access) is procedure Deallocate is new Ada.Unchecked_Deallocation (String, String_Access); begin Deallocate (X); end Free; ---------- -- Head -- ---------- function Head (Source : Unbounded_String; Count : Natural; Pad : Character := Space) return Unbounded_String is SR : constant Shared_String_Access := Source.Reference; DR : Shared_String_Access; begin -- Result is empty, reuse shared empty string if Count = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Length of the string is the same as requested, reuse source shared -- string. elsif Count = SR.Last then Reference (SR); DR := SR; -- Otherwise, allocate new shared string and fill it else DR := Allocate (Count); -- Length of the source string is more than requested, copy -- corresponding slice. if Count < SR.Last then DR.Data (1 .. Count) := SR.Data (1 .. Count); -- Length of the source string is less than requested, copy all -- contents and fill others by Pad character. else DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); for J in SR.Last + 1 .. Count loop DR.Data (J) := Pad; end loop; end if; DR.Last := Count; end if; return (AF.Controlled with Reference => DR); end Head; procedure Head (Source : in out Unbounded_String; Count : Natural; Pad : Character := Space) is SR : constant Shared_String_Access := Source.Reference; DR : Shared_String_Access; begin -- Result is empty, reuse empty shared string if Count = 0 then Reference (Empty_Shared_String'Access); Source.Reference := Empty_Shared_String'Access; Unreference (SR); -- Result is same as source string, reuse source shared string elsif Count = SR.Last then null; -- Try to reuse existing shared string elsif Can_Be_Reused (SR, Count) then if Count > SR.Last then for J in SR.Last + 1 .. Count loop SR.Data (J) := Pad; end loop; end if; SR.Last := Count; -- Otherwise, allocate new shared string and fill it else DR := Allocate (Count); -- Length of the source string is greater than requested, copy -- corresponding slice. if Count < SR.Last then DR.Data (1 .. Count) := SR.Data (1 .. Count); -- Length of the source string is less than requested, copy all -- existing data and fill remaining positions with Pad characters. else DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); for J in SR.Last + 1 .. Count loop DR.Data (J) := Pad; end loop; end if; DR.Last := Count; Source.Reference := DR; Unreference (SR); end if; end Head; ----------- -- Index -- ----------- function Index (Source : Unbounded_String; Pattern : String; Going : Strings.Direction := Strings.Forward; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural is SR : constant Shared_String_Access := Source.Reference; begin return Search.Index (SR.Data (1 .. SR.Last), Pattern, Going, Mapping); end Index; function Index (Source : Unbounded_String; Pattern : String; Going : Direction := Forward; Mapping : Maps.Character_Mapping_Function) return Natural is SR : constant Shared_String_Access := Source.Reference; begin return Search.Index (SR.Data (1 .. SR.Last), Pattern, Going, Mapping); end Index; function Index (Source : Unbounded_String; Set : Maps.Character_Set; Test : Strings.Membership := Strings.Inside; Going : Strings.Direction := Strings.Forward) return Natural is SR : constant Shared_String_Access := Source.Reference; begin return Search.Index (SR.Data (1 .. SR.Last), Set, Test, Going); end Index; function Index (Source : Unbounded_String; Pattern : String; From : Positive; Going : Direction := Forward; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural is SR : constant Shared_String_Access := Source.Reference; begin return Search.Index (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping); end Index; function Index (Source : Unbounded_String; Pattern : String; From : Positive; Going : Direction := Forward; Mapping : Maps.Character_Mapping_Function) return Natural is SR : constant Shared_String_Access := Source.Reference; begin return Search.Index (SR.Data (1 .. SR.Last), Pattern, From, Going, Mapping); end Index; function Index (Source : Unbounded_String; Set : Maps.Character_Set; From : Positive; Test : Membership := Inside; Going : Direction := Forward) return Natural is SR : constant Shared_String_Access := Source.Reference; begin return Search.Index (SR.Data (1 .. SR.Last), Set, From, Test, Going); end Index; --------------------- -- Index_Non_Blank -- --------------------- function Index_Non_Blank (Source : Unbounded_String; Going : Strings.Direction := Strings.Forward) return Natural is SR : constant Shared_String_Access := Source.Reference; begin return Search.Index_Non_Blank (SR.Data (1 .. SR.Last), Going); end Index_Non_Blank; function Index_Non_Blank (Source : Unbounded_String; From : Positive; Going : Direction := Forward) return Natural is SR : constant Shared_String_Access := Source.Reference; begin return Search.Index_Non_Blank (SR.Data (1 .. SR.Last), From, Going); end Index_Non_Blank; ---------------- -- Initialize -- ---------------- procedure Initialize (Object : in out Unbounded_String) is begin Reference (Object.Reference); end Initialize; ------------ -- Insert -- ------------ function Insert (Source : Unbounded_String; Before : Positive; New_Item : String) return Unbounded_String is SR : constant Shared_String_Access := Source.Reference; DL : constant Natural := SR.Last + New_Item'Length; DR : Shared_String_Access; begin -- Check index first if Before > SR.Last + 1 then raise Index_Error; end if; -- Result is empty, reuse empty shared string if DL = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Inserted string is empty, reuse source shared string elsif New_Item'Length = 0 then Reference (SR); DR := SR; -- Otherwise, allocate new shared string and fill it else DR := Allocate (DL + DL / Growth_Factor); DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1); DR.Data (Before .. Before + New_Item'Length - 1) := New_Item; DR.Data (Before + New_Item'Length .. DL) := SR.Data (Before .. SR.Last); DR.Last := DL; end if; return (AF.Controlled with Reference => DR); end Insert; procedure Insert (Source : in out Unbounded_String; Before : Positive; New_Item : String) is SR : constant Shared_String_Access := Source.Reference; DL : constant Natural := SR.Last + New_Item'Length; DR : Shared_String_Access; begin -- Check bounds if Before > SR.Last + 1 then raise Index_Error; end if; -- Result is empty string, reuse empty shared string if DL = 0 then Reference (Empty_Shared_String'Access); Source.Reference := Empty_Shared_String'Access; Unreference (SR); -- Inserted string is empty, nothing to do elsif New_Item'Length = 0 then null; -- Try to reuse existing shared string first elsif Can_Be_Reused (SR, DL) then SR.Data (Before + New_Item'Length .. DL) := SR.Data (Before .. SR.Last); SR.Data (Before .. Before + New_Item'Length - 1) := New_Item; SR.Last := DL; -- Otherwise, allocate new shared string and fill it else DR := Allocate (DL + DL / Growth_Factor); DR.Data (1 .. Before - 1) := SR.Data (1 .. Before - 1); DR.Data (Before .. Before + New_Item'Length - 1) := New_Item; DR.Data (Before + New_Item'Length .. DL) := SR.Data (Before .. SR.Last); DR.Last := DL; Source.Reference := DR; Unreference (SR); end if; end Insert; ------------ -- Length -- ------------ function Length (Source : Unbounded_String) return Natural is begin return Source.Reference.Last; end Length; --------------- -- Overwrite -- --------------- function Overwrite (Source : Unbounded_String; Position : Positive; New_Item : String) return Unbounded_String is SR : constant Shared_String_Access := Source.Reference; DL : Natural; DR : Shared_String_Access; begin -- Check bounds if Position > SR.Last + 1 then raise Index_Error; end if; DL := Integer'Max (SR.Last, Position + New_Item'Length - 1); -- Result is empty string, reuse empty shared string if DL = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Result is same as source string, reuse source shared string elsif New_Item'Length = 0 then Reference (SR); DR := SR; -- Otherwise, allocate new shared string and fill it else DR := Allocate (DL); DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1); DR.Data (Position .. Position + New_Item'Length - 1) := New_Item; DR.Data (Position + New_Item'Length .. DL) := SR.Data (Position + New_Item'Length .. SR.Last); DR.Last := DL; end if; return (AF.Controlled with Reference => DR); end Overwrite; procedure Overwrite (Source : in out Unbounded_String; Position : Positive; New_Item : String) is SR : constant Shared_String_Access := Source.Reference; DL : Natural; DR : Shared_String_Access; begin -- Bounds check if Position > SR.Last + 1 then raise Index_Error; end if; DL := Integer'Max (SR.Last, Position + New_Item'Length - 1); -- Result is empty string, reuse empty shared string if DL = 0 then Reference (Empty_Shared_String'Access); Source.Reference := Empty_Shared_String'Access; Unreference (SR); -- String unchanged, nothing to do elsif New_Item'Length = 0 then null; -- Try to reuse existing shared string elsif Can_Be_Reused (SR, DL) then SR.Data (Position .. Position + New_Item'Length - 1) := New_Item; SR.Last := DL; -- Otherwise allocate new shared string and fill it else DR := Allocate (DL); DR.Data (1 .. Position - 1) := SR.Data (1 .. Position - 1); DR.Data (Position .. Position + New_Item'Length - 1) := New_Item; DR.Data (Position + New_Item'Length .. DL) := SR.Data (Position + New_Item'Length .. SR.Last); DR.Last := DL; Source.Reference := DR; Unreference (SR); end if; end Overwrite; --------------- -- Reference -- --------------- procedure Reference (Item : not null Shared_String_Access) is begin System.Atomic_Counters.Increment (Item.Counter); end Reference; --------------------- -- Replace_Element -- --------------------- procedure Replace_Element (Source : in out Unbounded_String; Index : Positive; By : Character) is SR : constant Shared_String_Access := Source.Reference; DR : Shared_String_Access; begin -- Bounds check if Index <= SR.Last then -- Try to reuse existing shared string if Can_Be_Reused (SR, SR.Last) then SR.Data (Index) := By; -- Otherwise allocate new shared string and fill it else DR := Allocate (SR.Last); DR.Data (1 .. SR.Last) := SR.Data (1 .. SR.Last); DR.Data (Index) := By; DR.Last := SR.Last; Source.Reference := DR; Unreference (SR); end if; else raise Index_Error; end if; end Replace_Element; ------------------- -- Replace_Slice -- ------------------- function Replace_Slice (Source : Unbounded_String; Low : Positive; High : Natural; By : String) return Unbounded_String is SR : constant Shared_String_Access := Source.Reference; DL : Natural; DR : Shared_String_Access; begin -- Check bounds if Low > SR.Last + 1 then raise Index_Error; end if; -- Do replace operation when removed slice is not empty if High >= Low then DL := By'Length + SR.Last + Low - Integer'Min (High, SR.Last) - 1; -- This is the number of characters remaining in the string after -- replacing the slice. -- Result is empty string, reuse empty shared string if DL = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Otherwise allocate new shared string and fill it else DR := Allocate (DL); DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1); DR.Data (Low .. Low + By'Length - 1) := By; DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); DR.Last := DL; end if; return (AF.Controlled with Reference => DR); -- Otherwise just insert string else return Insert (Source, Low, By); end if; end Replace_Slice; procedure Replace_Slice (Source : in out Unbounded_String; Low : Positive; High : Natural; By : String) is SR : constant Shared_String_Access := Source.Reference; DL : Natural; DR : Shared_String_Access; begin -- Bounds check if Low > SR.Last + 1 then raise Index_Error; end if; -- Do replace operation only when replaced slice is not empty if High >= Low then DL := By'Length + SR.Last + Low - Integer'Min (High, SR.Last) - 1; -- This is the number of characters remaining in the string after -- replacing the slice. -- Result is empty string, reuse empty shared string if DL = 0 then Reference (Empty_Shared_String'Access); Source.Reference := Empty_Shared_String'Access; Unreference (SR); -- Try to reuse existing shared string elsif Can_Be_Reused (SR, DL) then SR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); SR.Data (Low .. Low + By'Length - 1) := By; SR.Last := DL; -- Otherwise allocate new shared string and fill it else DR := Allocate (DL); DR.Data (1 .. Low - 1) := SR.Data (1 .. Low - 1); DR.Data (Low .. Low + By'Length - 1) := By; DR.Data (Low + By'Length .. DL) := SR.Data (High + 1 .. SR.Last); DR.Last := DL; Source.Reference := DR; Unreference (SR); end if; -- Otherwise just insert item else Insert (Source, Low, By); end if; end Replace_Slice; -------------------------- -- Set_Unbounded_String -- -------------------------- procedure Set_Unbounded_String (Target : out Unbounded_String; Source : String) is TR : constant Shared_String_Access := Target.Reference; DR : Shared_String_Access; begin -- In case of empty string, reuse empty shared string if Source'Length = 0 then Reference (Empty_Shared_String'Access); Target.Reference := Empty_Shared_String'Access; else -- Try to reuse existing shared string if Can_Be_Reused (TR, Source'Length) then Reference (TR); DR := TR; -- Otherwise allocate new shared string else DR := Allocate (Source'Length); Target.Reference := DR; end if; DR.Data (1 .. Source'Length) := Source; DR.Last := Source'Length; end if; Unreference (TR); end Set_Unbounded_String; ----------- -- Slice -- ----------- function Slice (Source : Unbounded_String; Low : Positive; High : Natural) return String is SR : constant Shared_String_Access := Source.Reference; begin -- Note: test of High > Length is in accordance with AI95-00128 if Low > SR.Last + 1 or else High > SR.Last then raise Index_Error; else return SR.Data (Low .. High); end if; end Slice; ---------- -- Tail -- ---------- function Tail (Source : Unbounded_String; Count : Natural; Pad : Character := Space) return Unbounded_String is SR : constant Shared_String_Access := Source.Reference; DR : Shared_String_Access; begin -- For empty result reuse empty shared string if Count = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Result is whole source string, reuse source shared string elsif Count = SR.Last then Reference (SR); DR := SR; -- Otherwise allocate new shared string and fill it else DR := Allocate (Count); if Count < SR.Last then DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last); else for J in 1 .. Count - SR.Last loop DR.Data (J) := Pad; end loop; DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last); end if; DR.Last := Count; end if; return (AF.Controlled with Reference => DR); end Tail; procedure Tail (Source : in out Unbounded_String; Count : Natural; Pad : Character := Space) is SR : constant Shared_String_Access := Source.Reference; DR : Shared_String_Access; procedure Common (SR : Shared_String_Access; DR : Shared_String_Access; Count : Natural); -- Common code of tail computation. SR/DR can point to the same object ------------ -- Common -- ------------ procedure Common (SR : Shared_String_Access; DR : Shared_String_Access; Count : Natural) is begin if Count < SR.Last then DR.Data (1 .. Count) := SR.Data (SR.Last - Count + 1 .. SR.Last); else DR.Data (Count - SR.Last + 1 .. Count) := SR.Data (1 .. SR.Last); for J in 1 .. Count - SR.Last loop DR.Data (J) := Pad; end loop; end if; DR.Last := Count; end Common; begin -- Result is empty string, reuse empty shared string if Count = 0 then Reference (Empty_Shared_String'Access); Source.Reference := Empty_Shared_String'Access; Unreference (SR); -- Length of the result is the same as length of the source string, -- reuse source shared string. elsif Count = SR.Last then null; -- Try to reuse existing shared string elsif Can_Be_Reused (SR, Count) then Common (SR, SR, Count); -- Otherwise allocate new shared string and fill it else DR := Allocate (Count); Common (SR, DR, Count); Source.Reference := DR; Unreference (SR); end if; end Tail; --------------- -- To_String -- --------------- function To_String (Source : Unbounded_String) return String is begin return Source.Reference.Data (1 .. Source.Reference.Last); end To_String; ------------------------- -- To_Unbounded_String -- ------------------------- function To_Unbounded_String (Source : String) return Unbounded_String is DR : Shared_String_Access; begin if Source'Length = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; else DR := Allocate (Source'Length); DR.Data (1 .. Source'Length) := Source; DR.Last := Source'Length; end if; return (AF.Controlled with Reference => DR); end To_Unbounded_String; function To_Unbounded_String (Length : Natural) return Unbounded_String is DR : Shared_String_Access; begin if Length = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; else DR := Allocate (Length); DR.Last := Length; end if; return (AF.Controlled with Reference => DR); end To_Unbounded_String; --------------- -- Translate -- --------------- function Translate (Source : Unbounded_String; Mapping : Maps.Character_Mapping) return Unbounded_String is SR : constant Shared_String_Access := Source.Reference; DR : Shared_String_Access; begin -- Nothing to translate, reuse empty shared string if SR.Last = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Otherwise, allocate new shared string and fill it else DR := Allocate (SR.Last); for J in 1 .. SR.Last loop DR.Data (J) := Value (Mapping, SR.Data (J)); end loop; DR.Last := SR.Last; end if; return (AF.Controlled with Reference => DR); end Translate; procedure Translate (Source : in out Unbounded_String; Mapping : Maps.Character_Mapping) is SR : constant Shared_String_Access := Source.Reference; DR : Shared_String_Access; begin -- Nothing to translate if SR.Last = 0 then null; -- Try to reuse shared string elsif Can_Be_Reused (SR, SR.Last) then for J in 1 .. SR.Last loop SR.Data (J) := Value (Mapping, SR.Data (J)); end loop; -- Otherwise, allocate new shared string else DR := Allocate (SR.Last); for J in 1 .. SR.Last loop DR.Data (J) := Value (Mapping, SR.Data (J)); end loop; DR.Last := SR.Last; Source.Reference := DR; Unreference (SR); end if; end Translate; function Translate (Source : Unbounded_String; Mapping : Maps.Character_Mapping_Function) return Unbounded_String is SR : constant Shared_String_Access := Source.Reference; DR : Shared_String_Access; begin -- Nothing to translate, reuse empty shared string if SR.Last = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Otherwise, allocate new shared string and fill it else DR := Allocate (SR.Last); for J in 1 .. SR.Last loop DR.Data (J) := Mapping.all (SR.Data (J)); end loop; DR.Last := SR.Last; end if; return (AF.Controlled with Reference => DR); exception when others => Unreference (DR); raise; end Translate; procedure Translate (Source : in out Unbounded_String; Mapping : Maps.Character_Mapping_Function) is SR : constant Shared_String_Access := Source.Reference; DR : Shared_String_Access; begin -- Nothing to translate if SR.Last = 0 then null; -- Try to reuse shared string elsif Can_Be_Reused (SR, SR.Last) then for J in 1 .. SR.Last loop SR.Data (J) := Mapping.all (SR.Data (J)); end loop; -- Otherwise allocate new shared string and fill it else DR := Allocate (SR.Last); for J in 1 .. SR.Last loop DR.Data (J) := Mapping.all (SR.Data (J)); end loop; DR.Last := SR.Last; Source.Reference := DR; Unreference (SR); end if; exception when others => if DR /= null then Unreference (DR); end if; raise; end Translate; ---------- -- Trim -- ---------- function Trim (Source : Unbounded_String; Side : Trim_End) return Unbounded_String is SR : constant Shared_String_Access := Source.Reference; DL : Natural; DR : Shared_String_Access; Low : Natural; High : Natural; begin Low := Index_Non_Blank (Source, Forward); -- All blanks, reuse empty shared string if Low = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; else case Side is when Left => High := SR.Last; DL := SR.Last - Low + 1; when Right => Low := 1; High := Index_Non_Blank (Source, Backward); DL := High; when Both => High := Index_Non_Blank (Source, Backward); DL := High - Low + 1; end case; -- Length of the result is the same as length of the source string, -- reuse source shared string. if DL = SR.Last then Reference (SR); DR := SR; -- Otherwise, allocate new shared string else DR := Allocate (DL); DR.Data (1 .. DL) := SR.Data (Low .. High); DR.Last := DL; end if; end if; return (AF.Controlled with Reference => DR); end Trim; procedure Trim (Source : in out Unbounded_String; Side : Trim_End) is SR : constant Shared_String_Access := Source.Reference; DL : Natural; DR : Shared_String_Access; Low : Natural; High : Natural; begin Low := Index_Non_Blank (Source, Forward); -- All blanks, reuse empty shared string if Low = 0 then Reference (Empty_Shared_String'Access); Source.Reference := Empty_Shared_String'Access; Unreference (SR); else case Side is when Left => High := SR.Last; DL := SR.Last - Low + 1; when Right => Low := 1; High := Index_Non_Blank (Source, Backward); DL := High; when Both => High := Index_Non_Blank (Source, Backward); DL := High - Low + 1; end case; -- Length of the result is the same as length of the source string, -- nothing to do. if DL = SR.Last then null; -- Try to reuse existing shared string elsif Can_Be_Reused (SR, DL) then SR.Data (1 .. DL) := SR.Data (Low .. High); SR.Last := DL; -- Otherwise, allocate new shared string else DR := Allocate (DL); DR.Data (1 .. DL) := SR.Data (Low .. High); DR.Last := DL; Source.Reference := DR; Unreference (SR); end if; end if; end Trim; function Trim (Source : Unbounded_String; Left : Maps.Character_Set; Right : Maps.Character_Set) return Unbounded_String is SR : constant Shared_String_Access := Source.Reference; DL : Natural; DR : Shared_String_Access; Low : Natural; High : Natural; begin Low := Index (Source, Left, Outside, Forward); -- Source includes only characters from Left set, reuse empty shared -- string. if Low = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; else High := Index (Source, Right, Outside, Backward); DL := Integer'Max (0, High - Low + 1); -- Source includes only characters from Right set or result string -- is empty, reuse empty shared string. if High = 0 or else DL = 0 then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Otherwise, allocate new shared string and fill it else DR := Allocate (DL); DR.Data (1 .. DL) := SR.Data (Low .. High); DR.Last := DL; end if; end if; return (AF.Controlled with Reference => DR); end Trim; procedure Trim (Source : in out Unbounded_String; Left : Maps.Character_Set; Right : Maps.Character_Set) is SR : constant Shared_String_Access := Source.Reference; DL : Natural; DR : Shared_String_Access; Low : Natural; High : Natural; begin Low := Index (Source, Left, Outside, Forward); -- Source includes only characters from Left set, reuse empty shared -- string. if Low = 0 then Reference (Empty_Shared_String'Access); Source.Reference := Empty_Shared_String'Access; Unreference (SR); else High := Index (Source, Right, Outside, Backward); DL := Integer'Max (0, High - Low + 1); -- Source includes only characters from Right set or result string -- is empty, reuse empty shared string. if High = 0 or else DL = 0 then Reference (Empty_Shared_String'Access); Source.Reference := Empty_Shared_String'Access; Unreference (SR); -- Try to reuse existing shared string elsif Can_Be_Reused (SR, DL) then SR.Data (1 .. DL) := SR.Data (Low .. High); SR.Last := DL; -- Otherwise, allocate new shared string and fill it else DR := Allocate (DL); DR.Data (1 .. DL) := SR.Data (Low .. High); DR.Last := DL; Source.Reference := DR; Unreference (SR); end if; end if; end Trim; --------------------- -- Unbounded_Slice -- --------------------- function Unbounded_Slice (Source : Unbounded_String; Low : Positive; High : Natural) return Unbounded_String is SR : constant Shared_String_Access := Source.Reference; DL : Natural; DR : Shared_String_Access; begin -- Check bounds if Low > SR.Last + 1 or else High > SR.Last then raise Index_Error; -- Result is empty slice, reuse empty shared string elsif Low > High then Reference (Empty_Shared_String'Access); DR := Empty_Shared_String'Access; -- Otherwise, allocate new shared string and fill it else DL := High - Low + 1; DR := Allocate (DL); DR.Data (1 .. DL) := SR.Data (Low .. High); DR.Last := DL; end if; return (AF.Controlled with Reference => DR); end Unbounded_Slice; procedure Unbounded_Slice (Source : Unbounded_String; Target : out Unbounded_String; Low : Positive; High : Natural) is SR : constant Shared_String_Access := Source.Reference; TR : constant Shared_String_Access := Target.Reference; DL : Natural; DR : Shared_String_Access; begin -- Check bounds if Low > SR.Last + 1 or else High > SR.Last then raise Index_Error; -- Result is empty slice, reuse empty shared string elsif Low > High then Reference (Empty_Shared_String'Access); Target.Reference := Empty_Shared_String'Access; Unreference (TR); else DL := High - Low + 1; -- Try to reuse existing shared string if Can_Be_Reused (TR, DL) then TR.Data (1 .. DL) := SR.Data (Low .. High); TR.Last := DL; -- Otherwise, allocate new shared string and fill it else DR := Allocate (DL); DR.Data (1 .. DL) := SR.Data (Low .. High); DR.Last := DL; Target.Reference := DR; Unreference (TR); end if; end if; end Unbounded_Slice; ----------------- -- Unreference -- ----------------- procedure Unreference (Item : not null Shared_String_Access) is procedure Free is new Ada.Unchecked_Deallocation (Shared_String, Shared_String_Access); Aux : Shared_String_Access := Item; begin if System.Atomic_Counters.Decrement (Aux.Counter) then -- Reference counter of Empty_Shared_String should never reach -- zero. We check here in case it wraps around. if Aux /= Empty_Shared_String'Access then Free (Aux); end if; end if; end Unreference; end Ada.Strings.Unbounded;
.emacs.d/elpa/wisi-3.0.1/wisitoken-syntax_trees-lr_utils.ads
caqg/linux-home
0
9274
-- Abstract : -- -- Utilities for navigating syntax trees produced by an LR parser. -- -- Copyright (C) 2019 <NAME> All Rights Reserved. -- -- This library 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 3, or (at your option) any later -- version. This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- TABILITY 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. pragma License (Modified_GPL); with Ada.Iterator_Interfaces; package WisiToken.Syntax_Trees.LR_Utils is procedure Raise_Programmer_Error (Label : in String; Descriptor : in WisiToken.Descriptor; Lexer : in WisiToken.Lexer.Handle; Tree : in WisiToken.Syntax_Trees.Tree; Terminals : in WisiToken.Base_Token_Arrays.Vector; Node : in WisiToken.Syntax_Trees.Node_Index); pragma No_Return (Raise_Programmer_Error); ---------- -- List functions -- -- A list has one of the following grammar forms: -- -- list : list element | element ; -- list : element | list element ; -- -- list : list separator element | element ; -- list : element | list separator element ; type Cursor is private; function Has_Element (Cursor : in LR_Utils.Cursor) return Boolean; function Node (Cursor : in LR_Utils.Cursor) return Node_Index; package Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor, Has_Element); type Iterator is new Iterator_Interfaces.Reversible_Iterator with private; overriding function First (Iter : Iterator) return Cursor; overriding function Last (Iter : Iterator) return Cursor; overriding function Next (Iter : Iterator; Position : Cursor) return Cursor; overriding function Previous (Iter : Iterator; Position : Cursor) return Cursor; function Iterate (Tree : in WisiToken.Syntax_Trees.Tree; Terminals : in WisiToken.Base_Token_Array_Access; Lexer : in WisiToken.Lexer.Handle; Descriptor : in WisiToken.Descriptor_Access_Constant; Root : in Valid_Node_Index; Element_ID : in WisiToken.Token_ID; Separator_ID : in WisiToken.Token_ID := WisiToken.Invalid_Token_ID) return Iterator_Interfaces.Reversible_Iterator'Class; function Count (Iter : Iterator) return Ada.Containers.Count_Type; private type Cursor is record Node : Node_Index; end record; type Iterator is new Iterator_Interfaces.Reversible_Iterator with record Tree : WisiToken.Syntax_Trees.Tree; Terminals : WisiToken.Base_Token_Array_Access; Lexer : WisiToken.Lexer.Handle; Descriptor : WisiToken.Descriptor_Access_Constant; Root : Valid_Node_Index; List_ID : WisiToken.Token_ID; Element_ID : WisiToken.Token_ID; Separator_ID : WisiToken.Token_ID; end record; end WisiToken.Syntax_Trees.LR_Utils;
src/Lambda/Compiler-correctness/Sizes-match.agda
nad/definitional-interpreters
0
6410
<gh_stars>0 ------------------------------------------------------------------------ -- The actual maximum stack size of the compiled program matches the -- maximum stack size of the instrumented source-level semantics ------------------------------------------------------------------------ open import Prelude import Lambda.Syntax module Lambda.Compiler-correctness.Sizes-match {Name : Type} (open Lambda.Syntax Name) (def : Name → Tm 1) where open import Equality.Propositional as E using (refl) open import Logical-equivalence using (_⇔_) open import Tactic.By.Propositional using (by) open import Prelude.Size open import Colist E.equality-with-J hiding (_++_; length) import Conat E.equality-with-J as Conat open import Function-universe E.equality-with-J hiding (id; _∘_) open import List E.equality-with-J using (_++_; length) open import Monad E.equality-with-J open import Nat E.equality-with-J open import Vec.Data E.equality-with-J open import Upper-bounds open import Lambda.Compiler def open import Lambda.Interpreter.Stack-sizes def as I open import Lambda.Delay-crash-trace as DCT using (Delay-crash-trace) open import Lambda.Virtual-machine.Instructions Name open import Lambda.Virtual-machine comp-name as VM private module C = Closure Code module T = Closure Tm open Delay-crash-trace using (tell) ------------------------------------------------------------------------ -- A lemma -- A rearrangement lemma for ⟦_⟧⁺. ⟦⟧-· : ∀ {A n} (t₁ t₂ : Tm n) {ρ} tc {k : T.Value → Delay-crash-trace (ℕ → ℕ) A ∞} → DCT.[ ∞ ] ⟦ t₁ · t₂ ⟧ ρ tc >>= k ∼ do v₁ ← ⟦ t₁ ⟧ ρ false v₂ ← ⟦ t₂ ⟧ ρ false [ pred , pred ] v₁ ∙ v₂ >>= k ⟦⟧-· t₁ t₂ {ρ} tc {k} = ⟦ t₁ · t₂ ⟧ ρ tc >>= k DCT.∼⟨⟩ (do v₁ ← ⟦ t₁ ⟧ ρ false v₂ ← ⟦ t₂ ⟧ ρ false [ pred , pred ] v₁ ∙ v₂) >>= k DCT.∼⟨ DCT.symmetric (DCT.associativity (⟦ t₁ ⟧ _ _) _ _) ⟩ (do v₁ ← ⟦ t₁ ⟧ ρ false (do v₂ ← ⟦ t₂ ⟧ ρ false [ pred , pred ] v₁ ∙ v₂) >>= k) DCT.∼⟨ ((⟦ t₁ ⟧ _ _ DCT.∎) DCT.>>=-cong λ _ → DCT.symmetric (DCT.associativity (⟦ t₂ ⟧ _ _) _ _)) ⟩ (do v₁ ← ⟦ t₁ ⟧ ρ false v₂ ← ⟦ t₂ ⟧ ρ false [ pred , pred ] v₁ ∙ v₂ >>= k) DCT.∎ ------------------------------------------------------------------------ -- Well-formed continuations and stacks -- A continuation is OK with respect to a certain state if the -- following property is satisfied. Cont-OK : Size → State → (T.Value → Delay-crash-trace (ℕ → ℕ) C.Value ∞) → Type Cont-OK i ⟨ c , s , ρ ⟩ k = ∀ v → [ i ] VM.stack-sizes ⟨ c , val (comp-val v) ∷ s , ρ ⟩ ≂ numbers (k v) (1 + length s) -- A workaround for what might be an Agda bug. castC : ∀ {i} {j : Size< i} {s k} → Cont-OK i s k → Cont-OK j s k castC {s = ⟨ _ , _ , _ ⟩} c-ok = cast-≂ ∘ c-ok -- If the In-tail-context parameter indicates that we are in a tail -- context, then the stack must have a certain shape, and it must be -- related to the continuation in a certain way. data Stack-OK (i : Size) (k : T.Value → Delay-crash-trace (ℕ → ℕ) C.Value ∞) : In-tail-context → Stack → Type where unrestricted : ∀ {s} → Stack-OK i k false s restricted : ∀ {s n} {c : Code n} {ρ : C.Env n} → (∀ v → [ i ] 2 + length s ∷′ VM.stack-sizes ⟨ c , val (comp-val v) ∷ s , ρ ⟩ ≂ numbers (k v) (2 + length s)) → Stack-OK i k true (ret c ρ ∷ s) -- Stacks that are OK in a tail context are OK in any context. any-OK : ∀ {tc i k s} → Stack-OK i k true s → Stack-OK i k tc s any-OK {false} = const unrestricted any-OK {true} = id ------------------------------------------------------------------------ -- The stack sizes match mutual -- Some lemmas making up the main part of the correctness result. ⟦⟧-correct : ∀ {i n} (t : Tm n) (ρ : T.Env n) {tc c s} {k : T.Value → Delay-crash-trace (ℕ → ℕ) C.Value ∞} → Stack-OK i k tc s → Cont-OK i ⟨ c , s , comp-env ρ ⟩ k → [ i ] VM.stack-sizes ⟨ comp tc t c , s , comp-env ρ ⟩ ≂ numbers (⟦ t ⟧ ρ tc >>= k) (length s) ⟦⟧-correct (var x) ρ {tc} {c} {s} {k} _ c-ok = VM.stack-sizes ⟨ var x ∷ c , s , comp-env ρ ⟩ ∼⟨ ∷∼∷′ ⟩≂ (length s ∷′ VM.stack-sizes ⟨ c , val (index (comp-env ρ) x) ∷ s , comp-env ρ ⟩) ≡⟨ by (comp-index ρ x) ⟩≂ (length s ∷′ VM.stack-sizes ⟨ c , val (comp-val (index ρ x)) ∷ s , comp-env ρ ⟩) ≂⟨ cons″-≂ (c-ok (index ρ x)) ⟩∼ (length s ∷′ numbers (k (index ρ x)) (1 + length s)) ∼⟨ symmetric-∼ ∷∼∷′ ⟩ numbers (⟦ var x ⟧ ρ tc >>= k) (length s) ∎ ⟦⟧-correct (lam t) ρ {tc} {c} {s} {k} _ c-ok = VM.stack-sizes ⟨ clo (comp-body t) ∷ c , s , comp-env ρ ⟩ ∼⟨ ∷∼∷′ ⟩≂ (length s ∷′ VM.stack-sizes ⟨ c , val (comp-val (T.lam t ρ)) ∷ s , comp-env ρ ⟩) ≂⟨ cons″-≂ (c-ok (T.lam t ρ)) ⟩∼ (length s ∷′ numbers (k (T.lam t ρ)) (1 + length s)) ∼⟨ symmetric-∼ ∷∼∷′ ⟩ numbers (⟦ lam t ⟧ ρ tc >>= k) (length s) ∎ ⟦⟧-correct (t₁ · t₂) ρ {tc} {c} {s} {k} _ c-ok = VM.stack-sizes ⟨ comp false t₁ (comp false t₂ (app ∷ c)) , s , comp-env ρ ⟩ ≂⟨ (⟦⟧-correct t₁ _ unrestricted λ v₁ → VM.stack-sizes ⟨ comp false t₂ (app ∷ c) , val (comp-val v₁) ∷ s , comp-env ρ ⟩ ≂⟨ (⟦⟧-correct t₂ _ unrestricted λ v₂ → VM.stack-sizes ⟨ app ∷ c , val (comp-val v₂) ∷ val (comp-val v₁) ∷ s , comp-env ρ ⟩ ≂⟨ ∙-correct v₁ v₂ c-ok ⟩∼ numbers ([ pred , pred ] v₁ ∙ v₂ >>= k) (2 + length s) ∎) ⟩∼ numbers (do v₂ ← ⟦ t₂ ⟧ ρ false [ pred , pred ] v₁ ∙ v₂ >>= k) (1 + length s) ∎) ⟩∼ numbers (do v₁ ← ⟦ t₁ ⟧ ρ false v₂ ← ⟦ t₂ ⟧ ρ false [ pred , pred ] v₁ ∙ v₂ >>= k) (length s) ∼⟨ symmetric-∼ (numbers-cong (⟦⟧-· t₁ t₂ tc)) ⟩ numbers (⟦ t₁ · t₂ ⟧ ρ tc >>= k) (length s) ∎ ⟦⟧-correct (call f t) ρ {false} {c} {s} {k} unrestricted c-ok = VM.stack-sizes ⟨ comp false t (cal f ∷ c) , s , comp-env ρ ⟩ ≂⟨ (⟦⟧-correct t _ unrestricted λ v → VM.stack-sizes ⟨ cal f ∷ c , val (comp-val v) ∷ s , comp-env ρ ⟩ ∼⟨ ∷∼∷′ ⟩≂ 1 + length s ∷′ VM.stack-sizes ⟨ comp-name f , ret c (comp-env ρ) ∷ s , comp-val v ∷ [] ⟩ ≂⟨ cons′-≂ (_⇔_.from ≂′⇔≂″ λ { .force → body-lemma (def f) [] (castC c-ok) }) ⟩∼ 1 + length s ∷′ numbers (⟦ def f ⟧ (v ∷ []) true >>= tell pred ∘ return >>= k) (1 + length s) ∼⟨ symmetric-∼ ∷∼∷′ ⟩ numbers ([ id , pred ] T.lam (def f) [] ∙ v >>= k) (1 + length s) ∎) ⟩∼ numbers (⟦ t ⟧ ρ false >>= λ v → [ id , pred ] T.lam (def f) [] ∙ v >>= k) (length s) ∼⟨ numbers-cong (DCT.associativity (⟦ t ⟧ _ _) _ _) ⟩ numbers ((⟦ t ⟧ ρ false >>= [ id , pred ] T.lam (def f) [] ∙_) >>= k) (length s) ∼⟨⟩ numbers (⟦ call f t ⟧ ρ false >>= k) (length s) ∎ ⟦⟧-correct {i} (call f t) ρ {true} {c} {ret c′ ρ′ ∷ s} {k} s-ok@(restricted c-ok) _ = VM.stack-sizes ⟨ comp false t (tcl f ∷ c) , ret c′ ρ′ ∷ s , comp-env ρ ⟩ ≂⟨ (⟦⟧-correct t _ unrestricted λ v → VM.stack-sizes ⟨ tcl f ∷ c , val (comp-val v) ∷ ret c′ ρ′ ∷ s , comp-env ρ ⟩ ∼⟨ ∷∼∷′ ⟩≂ 2 + length s ∷′ VM.stack-sizes ⟨ comp-name f , ret c′ ρ′ ∷ s , comp-val v ∷ [] ⟩ ≡⟨⟩≂ 2 + length s ∷′ VM.stack-sizes ⟨ comp-name f , ret c′ ρ′ ∷ s , comp-env (v ∷ []) ⟩ ≂⟨ cons′-≂ (_⇔_.from ≂′⇔≂″ λ { .force → ⟦⟧-correct (def f) (_ ∷ []) (restricted lemma) (λ v′ → VM.stack-sizes ⟨ ret ∷ [] , val (comp-val v′) ∷ ret c′ ρ′ ∷ s , comp-env (v ∷ []) ⟩ ∼⟨ ∷∼∷′ ⟩≂ 2 + length s ∷′ VM.stack-sizes ⟨ c′ , val (comp-val v′) ∷ s , ρ′ ⟩ ≂⟨ lemma v′ ⟩∼ numbers (tell id (k v′)) (2 + length s) ∎) }) ⟩∼ 2 + length s ∷′ numbers (⟦ def f ⟧ (v ∷ []) true >>= tell id ∘ k) (1 + length s) ∼⟨ (refl ∷ λ { .force → numbers-cong (DCT.associativity (⟦ def f ⟧ _ _) _ _) }) ⟩ 2 + length s ∷′ numbers (⟦ def f ⟧ (v ∷ []) true >>= tell id ∘ return >>= k) (1 + length s) ∼⟨ symmetric-∼ ∷∼∷′ ⟩ numbers ([ pred , id ] T.lam (def f) [] ∙ v >>= k) (2 + length s) ∎) ⟩∼ numbers (⟦ t ⟧ ρ false >>= λ v → [ pred , id ] T.lam (def f) [] ∙ v >>= k) (1 + length s) ∼⟨ numbers-cong (DCT.associativity (⟦ t ⟧ _ _) _ _) ⟩ numbers ((⟦ t ⟧ ρ false >>= [ pred , id ] T.lam (def f) [] ∙_) >>= k) (1 + length s) ∼⟨⟩ numbers (⟦ call f t ⟧ ρ true >>= k) (1 + length s) ∎ where lemma : {j : Size< i} → _ lemma = λ v′ → 2 + length s ∷′ VM.stack-sizes ⟨ c′ , val (comp-val v′) ∷ s , ρ′ ⟩ ≂⟨ consʳ-≂ (inj₁ (here ≤-refl)) (cast-≂ (c-ok v′)) ⟩∼ 2 + length s ∷′ numbers (k v′) (2 + length s) ∼⟨ symmetric-∼ ∷∼∷′ ⟩ numbers (tell id (k v′)) (2 + length s) ∎ ⟦⟧-correct (con b) ρ {tc} {c} {s} {k} _ c-ok = VM.stack-sizes ⟨ con b ∷ c , s , comp-env ρ ⟩ ∼⟨ ∷∼∷′ ⟩≂ (length s ∷′ VM.stack-sizes ⟨ c , val (comp-val (T.con b)) ∷ s , comp-env ρ ⟩) ≂⟨ cons″-≂ (c-ok (T.con b)) ⟩∼ (length s ∷′ numbers (k (T.con b)) (1 + length s)) ∼⟨ symmetric-∼ ∷∼∷′ ⟩ numbers (⟦ con b ⟧ ρ tc >>= k) (length s) ∎ ⟦⟧-correct (if t₁ t₂ t₃) ρ {tc} {c} {s} {k} s-ok c-ok = VM.stack-sizes ⟨ comp false t₁ (bra (comp tc t₂ []) (comp tc t₃ []) ∷ c) , s , comp-env ρ ⟩ ≂⟨ (⟦⟧-correct t₁ _ unrestricted λ v₁ → ⟦if⟧-correct v₁ t₂ t₃ s-ok c-ok) ⟩∼ numbers (⟦ t₁ ⟧ ρ false >>= λ v₁ → ⟦if⟧ v₁ t₂ t₃ ρ tc >>= k) (length s) ∼⟨ numbers-cong (DCT.associativity (⟦ t₁ ⟧ _ _) _ _) ⟩ numbers ((⟦ t₁ ⟧ ρ false >>= λ v₁ → ⟦if⟧ v₁ t₂ t₃ ρ tc) >>= k) (length s) ∎ body-lemma : ∀ {i n n′} (t : Tm (1 + n)) ρ {ρ′ : C.Env n′} {c s v} {k : T.Value → Delay-crash-trace (ℕ → ℕ) C.Value ∞} → Cont-OK i ⟨ c , s , ρ′ ⟩ k → [ i ] VM.stack-sizes ⟨ comp-body t , ret c ρ′ ∷ s , comp-val v ∷ comp-env ρ ⟩ ≂ numbers (⟦ t ⟧ (v ∷ ρ) true >>= tell pred ∘ return >>= k) (1 + length s) body-lemma t ρ {ρ′} {c} {s} {v} {k} c-ok = VM.stack-sizes ⟨ comp-body t , ret c ρ′ ∷ s , comp-val v ∷ comp-env ρ ⟩ ≡⟨⟩≂ VM.stack-sizes ⟨ comp-body t , ret c ρ′ ∷ s , comp-env (v ∷ ρ) ⟩ ≂⟨ (⟦⟧-correct t (_ ∷ _) (any-OK (restricted lemma)) λ v′ → VM.stack-sizes ⟨ ret ∷ [] , val (comp-val v′) ∷ ret c ρ′ ∷ s , comp-env (v ∷ ρ) ⟩ ∼⟨ ∷∼∷′ ⟩≂ 2 + length s ∷′ VM.stack-sizes ⟨ c , val (comp-val v′) ∷ s , ρ′ ⟩ ≂⟨ lemma v′ ⟩∼ numbers (tell pred (k v′)) (2 + length s) ∎) ⟩∼ numbers (⟦ t ⟧ (v ∷ ρ) true >>= tell pred ∘ k) (1 + length s) ∼⟨ numbers-cong (DCT.associativity (⟦ t ⟧ _ _) _ _) ⟩ numbers (⟦ t ⟧ (v ∷ ρ) true >>= tell pred ∘ return >>= k) (1 + length s) ∎ where lemma = λ v′ → 2 + length s ∷′ VM.stack-sizes ⟨ c , val (comp-val v′) ∷ s , ρ′ ⟩ ≂⟨ cons″-≂ (c-ok v′) ⟩∼ 2 + length s ∷′ numbers (k v′) (1 + length s) ∼⟨ symmetric-∼ ∷∼∷′ ⟩ numbers (tell pred (k v′)) (2 + length s) ∎ ∙-correct : ∀ {i n} v₁ v₂ {ρ : C.Env n} {c s} {k : T.Value → Delay-crash-trace (ℕ → ℕ) C.Value ∞} → Cont-OK i ⟨ c , s , ρ ⟩ k → [ i ] VM.stack-sizes ⟨ app ∷ c , val (comp-val v₂) ∷ val (comp-val v₁) ∷ s , ρ ⟩ ≂ numbers ([ pred , pred ] v₁ ∙ v₂ >>= k) (2 + length s) ∙-correct (T.lam t₁ ρ₁) v₂ {ρ} {c} {s} {k} c-ok = VM.stack-sizes ⟨ app ∷ c , val (comp-val v₂) ∷ val (comp-val (T.lam t₁ ρ₁)) ∷ s , ρ ⟩ ∼⟨ ∷∼∷′ ⟩≂ 2 + length s ∷′ VM.stack-sizes ⟨ comp-body t₁ , ret c ρ ∷ s , comp-val v₂ ∷ comp-env ρ₁ ⟩ ≂⟨ cons′-≂ (_⇔_.from ≂′⇔≂″ λ { .force → body-lemma t₁ _ (castC c-ok) }) ⟩∼ 2 + length s ∷′ numbers (⟦ t₁ ⟧ (v₂ ∷ ρ₁) true >>= tell pred ∘ return >>= k) (1 + length s) ∼⟨ symmetric-∼ ∷∼∷′ ⟩ numbers ([ pred , pred ] T.lam t₁ ρ₁ ∙ v₂ >>= k) (2 + length s) ∎ ∙-correct (T.con b) v₂ {ρ} {c} {s} {k} _ = VM.stack-sizes ⟨ app ∷ c , val (comp-val v₂) ∷ val (C.con b) ∷ s , ρ ⟩ ∼⟨ ∷∼∷′ ⟩≂ 2 + length s ∷′ [] ∼⟨ symmetric-∼ ∷∼∷′ ⟩≂ numbers ([ pred , pred ] T.con b ∙ v₂ >>= k) (2 + length s) □≂ ⟦if⟧-correct : ∀ {i n} v₁ t₂ t₃ {ρ : T.Env n} {tc c s} {k : T.Value → Delay-crash-trace (ℕ → ℕ) C.Value ∞} → Stack-OK i k tc s → Cont-OK i ⟨ c , s , comp-env ρ ⟩ k → [ i ] VM.stack-sizes ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c , val (comp-val v₁) ∷ s , comp-env ρ ⟩ ≂ numbers (⟦if⟧ v₁ t₂ t₃ ρ tc >>= k) (1 + length s) ⟦if⟧-correct (T.lam t₁ ρ₁) t₂ t₃ {ρ} {tc} {c} {s} {k} _ _ = VM.stack-sizes ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c , val (comp-val (T.lam t₁ ρ₁)) ∷ s , comp-env ρ ⟩ ∼⟨ ∷∼∷′ ⟩≂ 1 + length s ∷′ [] ∼⟨ symmetric-∼ ∷∼∷′ ⟩≂ numbers (⟦if⟧ (T.lam t₁ ρ₁) t₂ t₃ ρ tc >>= k) (1 + length s) □≂ ⟦if⟧-correct (T.con true) t₂ t₃ {ρ} {tc} {c} {s} {k} s-ok c-ok = VM.stack-sizes ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c , val (comp-val (T.con true)) ∷ s , comp-env ρ ⟩ ∼⟨ ∷∼∷′ ⟩≂ 1 + length s ∷′ VM.stack-sizes ⟨ comp tc t₂ [] ++ c , s , comp-env ρ ⟩ ≡⟨ by (comp-++ _ t₂) ⟩≂ 1 + length s ∷′ VM.stack-sizes ⟨ comp tc t₂ c , s , comp-env ρ ⟩ ≂⟨ cons″-≂ (⟦⟧-correct t₂ _ s-ok c-ok) ⟩∼ 1 + length s ∷′ numbers (⟦ t₂ ⟧ ρ tc >>= k) (length s) ∼⟨ symmetric-∼ ∷∼∷′ ⟩ numbers (⟦if⟧ (T.con true) t₂ t₃ ρ tc >>= k) (1 + length s) ∎ ⟦if⟧-correct (T.con false) t₂ t₃ {ρ} {tc} {c} {s} {k} s-ok c-ok = VM.stack-sizes ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c , val (comp-val (T.con false)) ∷ s , comp-env ρ ⟩ ∼⟨ ∷∼∷′ ⟩≂ 1 + length s ∷′ VM.stack-sizes ⟨ comp tc t₃ [] ++ c , s , comp-env ρ ⟩ ≡⟨ by (comp-++ _ t₃) ⟩≂ 1 + length s ∷′ VM.stack-sizes ⟨ comp tc t₃ c , s , comp-env ρ ⟩ ≂⟨ cons″-≂ (⟦⟧-correct t₃ _ s-ok c-ok) ⟩∼ 1 + length s ∷′ numbers (⟦ t₃ ⟧ ρ tc >>= k) (length s) ∼⟨ symmetric-∼ ∷∼∷′ ⟩ numbers (⟦if⟧ (T.con false) t₂ t₃ ρ tc >>= k) (1 + length s) ∎ -- The virtual machine and the interpreter produce related lists of -- stack sizes. -- -- (However, the traces are not necessarily bisimilar, see -- Lambda.Interpreter.Stack-sizes.Counterexample.stack-sizes-not-bisimilar.) stack-sizes-related : (t : Tm 0) → [ ∞ ] VM.stack-sizes ⟨ comp₀ t , [] , [] ⟩ ≂ I.stack-sizes t stack-sizes-related t = VM.stack-sizes ⟨ comp false t [] , [] , [] ⟩ ≂⟨ ⟦⟧-correct t [] unrestricted (λ _ → cons″-≂ (_ □≂)) ⟩∼ numbers (comp-val ⟨$⟩ ⟦ t ⟧ [] false) 0 ∼⟨ scanl-cong (DCT.trace-⟨$⟩ _) ⟩ numbers (⟦ t ⟧ [] false) 0 ∼⟨⟩ I.stack-sizes t ∎ -- The maximum stack sizes match. maximum-stack-sizes-match : ∀ (t : Tm 0) {i v} → LUB (I.stack-sizes t) i → LUB (VM.stack-sizes ⟨ comp₀ t , [] , [] ⟩) v → Conat.[ ∞ ] i ∼ v maximum-stack-sizes-match t {i} {v} i-lub = LUB (VM.stack-sizes ⟨ comp₀ t , [] , [] ⟩) v ↝⟨ LUB-≂ (stack-sizes-related t) ⟩ LUB (I.stack-sizes t) v ↝⟨ lub-unique i-lub ⟩□ Conat.[ ∞ ] i ∼ v □
libsrc/math/cpcmath/floor.asm
andydansby/z88dk-mk2
1
4360
; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** <kbaccam /at/ free.fr> ; ; $Id: floor.asm,v 1.2 2009/06/22 21:44:17 dom Exp $ ; INCLUDE "cpcfirm.def" INCLUDE "cpcfp.def" XLIB floor XDEF floorc XDEF floorc2 LIB get_para .floor call get_para call firmware .floorc defw CPCFP_FLO_BINFIX ld a,b call firmware .floorc2 defw CPCFP_BIN_2_FLO ret
runtime/ravenscar-sfp-stm32f427/gnarl-common/a-taster.adb
TUM-EI-RCS/StratoX
12
275
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . T A S K _ T E R M I N A T I O N -- -- -- -- B o d y -- -- -- -- Copyright (C) 2005-2014, 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. -- -- -- -- -- -- -- -- -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- This is a simplified version of this package body to be used in when the -- Ravenscar profile and there are no exception handlers present (either of -- the restrictions No_Exception_Handlers or No_Exception_Propagation are in -- effect). This means that the only task termination cause that need to be -- taken into account is normal task termination (abort is not allowed by -- the Ravenscar profile and the restricted exception support does not -- include Exception_Occurrence). with System.Tasking; -- used for Task_Id -- Self -- Fall_Back_Handler with System.Task_Primitives.Operations; -- Used for Self -- Set_Priority -- Get_Priority with Unchecked_Conversion; package body Ada.Task_Termination is use System.Task_Primitives.Operations; use type Ada.Task_Identification.Task_Id; function To_TT is new Unchecked_Conversion (System.Tasking.Termination_Handler, Termination_Handler); function To_ST is new Unchecked_Conversion (Termination_Handler, System.Tasking.Termination_Handler); ----------------------------------- -- Current_Task_Fallback_Handler -- ----------------------------------- function Current_Task_Fallback_Handler return Termination_Handler is Self_Id : constant System.Tasking.Task_Id := Self; Caller_Priority : constant System.Any_Priority := Get_Priority (Self_Id); Result : Termination_Handler; begin -- Raise the priority to prevent race conditions when modifying -- System.Tasking.Fall_Back_Handler. Set_Priority (Self_Id, System.Any_Priority'Last); Result := To_TT (System.Tasking.Fall_Back_Handler); -- Restore the original priority Set_Priority (Self_Id, Caller_Priority); return Result; end Current_Task_Fallback_Handler; ------------------------------------- -- Set_Dependents_Fallback_Handler -- ------------------------------------- procedure Set_Dependents_Fallback_Handler (Handler : Termination_Handler) is Self_Id : constant System.Tasking.Task_Id := Self; Caller_Priority : constant System.Any_Priority := Get_Priority (Self_Id); begin -- Raise the priority to prevent race conditions when modifying -- System.Tasking.Fall_Back_Handler. Set_Priority (Self_Id, System.Any_Priority'Last); System.Tasking.Fall_Back_Handler := To_ST (Handler); -- Restore the original priority Set_Priority (Self_Id, Caller_Priority); end Set_Dependents_Fallback_Handler; end Ada.Task_Termination;
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xa0.log_21829_982.asm
ljhsiun2/medusa
9
28276
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r8 push %r9 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x1b59a, %rdi nop nop nop nop xor $23924, %r9 mov $0x6162636465666768, %r12 movq %r12, (%rdi) nop nop nop nop nop inc %rbx lea addresses_A_ht+0xfc1e, %rdx nop nop nop sub $11072, %r8 movups (%rdx), %xmm4 vpextrq $1, %xmm4, %rax nop nop nop add $31410, %rdi lea addresses_WC_ht+0x73e, %rsi lea addresses_A_ht+0x587e, %rdi clflush (%rsi) nop nop nop cmp %rdx, %rdx mov $77, %rcx rep movsw nop nop nop nop nop dec %r12 lea addresses_normal_ht+0xa0be, %r9 clflush (%r9) nop nop nop nop nop add %rcx, %rcx mov $0x6162636465666768, %rax movq %rax, %xmm4 movups %xmm4, (%r9) sub $2658, %rdx lea addresses_WT_ht+0x95a0, %r12 nop nop nop nop nop sub %rdi, %rdi mov (%r12), %rsi nop nop nop nop xor %rax, %rax lea addresses_D_ht+0x2bbe, %rsi nop nop nop nop add %rdi, %rdi movb (%rsi), %r12b nop nop nop nop nop add %rcx, %rcx lea addresses_D_ht+0x7cbe, %rcx clflush (%rcx) nop nop add $50297, %rbx mov $0x6162636465666768, %rsi movq %rsi, (%rcx) and $24493, %rax lea addresses_UC_ht+0x12cbe, %rdx nop nop nop nop cmp %r12, %r12 movups (%rdx), %xmm1 vpextrq $1, %xmm1, %rbx nop nop nop nop add %rcx, %rcx lea addresses_UC_ht+0x1cbe, %rbx nop nop xor $1973, %rcx movw $0x6162, (%rbx) xor %rsi, %rsi lea addresses_WT_ht+0x44be, %rax nop nop nop inc %r9 mov (%rax), %r8d nop nop nop nop nop and $44243, %rsi lea addresses_A_ht+0x116be, %rbx nop nop nop sub $13985, %r9 mov $0x6162636465666768, %r8 movq %r8, %xmm4 vmovups %ymm4, (%rbx) nop nop nop nop nop sub %rsi, %rsi lea addresses_normal_ht+0xa8be, %r8 nop nop add $9871, %rsi movw $0x6162, (%r8) nop nop nop and %r12, %r12 lea addresses_WC_ht+0x1a11a, %r12 nop nop nop nop nop and %rsi, %rsi mov (%r12), %r8w nop nop nop nop and %r12, %r12 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r9 pop %r8 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r8 push %rcx push %rdi push %rdx // Store mov $0x92, %r10 nop nop cmp %rdi, %rdi mov $0x5152535455565758, %rcx movq %rcx, (%r10) nop nop nop nop nop and $34672, %r12 // Store lea addresses_WC+0x1eebe, %r10 nop nop nop nop cmp $36677, %rdx mov $0x5152535455565758, %rcx movq %rcx, %xmm2 vmovups %ymm2, (%r10) nop nop nop sub %r10, %r10 // Store lea addresses_D+0xd3e, %r10 nop nop inc %r12 movw $0x5152, (%r10) nop sub %r11, %r11 // Load mov $0x29931800000002be, %rdi nop cmp $64748, %r12 movups (%rdi), %xmm4 vpextrq $0, %xmm4, %r8 nop nop nop nop nop xor $52712, %rcx // Store lea addresses_WT+0x16cbe, %r11 nop add %rdi, %rdi movw $0x5152, (%r11) nop and %rdi, %rdi // Store lea addresses_WT+0x138ce, %rcx sub $9602, %r12 mov $0x5152535455565758, %rdx movq %rdx, %xmm6 vmovups %ymm6, (%rcx) nop nop nop add %r12, %r12 // Store lea addresses_normal+0xc08c, %r12 nop xor $64661, %r11 movl $0x51525354, (%r12) nop nop nop nop nop inc %r11 // Store lea addresses_A+0x1944e, %r8 nop nop nop nop xor $11333, %r12 mov $0x5152535455565758, %r10 movq %r10, %xmm6 vmovups %ymm6, (%r8) // Exception!!! mov (0), %rcx nop add %r11, %r11 // Store lea addresses_US+0x24be, %r10 nop nop cmp %rcx, %rcx mov $0x5152535455565758, %rdx movq %rdx, (%r10) nop dec %r8 // Store lea addresses_WC+0x1673e, %r10 nop nop nop nop and %rdi, %rdi mov $0x5152535455565758, %rdx movq %rdx, (%r10) inc %r12 // Faulty Load lea addresses_WT+0x16cbe, %rdx nop nop nop nop cmp $11154, %r8 mov (%rdx), %rcx lea oracles, %r11 and $0xff, %rcx shlq $12, %rcx mov (%r11,%rcx,1), %rcx pop %rdx pop %rdi pop %rcx pop %r8 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_P', 'AVXalign': True, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WC', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_D', 'AVXalign': False, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_NC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_WT', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_A', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_US', 'AVXalign': False, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WC', 'AVXalign': False, 'size': 8}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8}} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16}} {'src': {'NT': False, 'same': True, 'congruent': 1, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}} {'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'52': 21829} 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 */
oldstuff/tigcc/PolySnd/sources/statique/PortStatus.asm
bcherry/bcherry
3
90993
section ".data" xdef pSnd_PortStatus pSnd_PortStatus: move.b ($60000E),d0 rts
keywords from EXIF.applescript
danielpietzsch/Applescripts-for-Aperture
3
3947
on ImportActionForVersions(imageSel) tell application "Aperture" repeat with i from 1 to count of imageSel tell library 1 tell item i of imageSel set cameraModel to value of EXIF tag "Model" -- mobile phones might not have a LensModel EXIF tag try set lensModel to value of EXIF tag "LensModel" on error set lensModel to "" end try make new keyword with properties {name:cameraModel} make new keyword with properties {name:lensModel, parents:{cameraModel}} end tell end tell end repeat end tell end ImportActionForVersions
src/main/fragment/mos6502-common/isr_hardware_all_exit.asm
jbrandwood/kickc
2
100096
pla @clob_y tay @clob_y pla @clob_x tax @clob_x pla @clob_none rti
test/parse.asm
dpr0/z80_disassembler
0
80757
device zxspectrum48 org #8000 ; адрес на который компилировать begin_file: LD IXL, 4 LD HL,(IX) LD A,#04 LD HL,#5800 LD DE,#5801 LD BC,#02FF LD (HL),A LDIR RET end_file: display "code size: ", /d, end_file - begin_file savebin "parse.C", begin_file, end_file - begin_file
agda-aplas14/SN/AntiRename.agda
ryanakca/strong-normalization
32
10701
module SN.AntiRename where open import Relation.Unary using (_∈_; _⊆_) open import Library open import Terms open import Substitution open import SN mutual -- To formulate this, we need heterogeneous SNholes, going from Γ to Δ -- unRenameSNh : ∀{a b Γ Δ} (ρ : Δ ≤ Γ) {t : Tm Γ b} {E : ECxt Γ a b} {t' : Tm Γ a} → -- SNhole (subst ρ t) (λ t' → subst ρ (E t')) t' → SNhole t E t' -- unRenameSNh = TODO unRenameSNe : ∀{a Γ Δ} {ρ : Δ ≤ Γ} {t : Tm Γ a}{t'} → IndRen ρ t t' → SNe t' → SNe t unRenameSNe (var x x₁) (var y) = var x unRenameSNe (app is is₁) (elim 𝒏 (appl 𝒖)) = elim (unRenameSNe is 𝒏) (appl (unRenameSN is₁ 𝒖)) unRenameSN : ∀{a Γ Δ} {ρ : Δ ≤ Γ} {t : Tm Γ a} {t'} → IndRen ρ t t' → SN t' → SN t -- neutral cases: unRenameSN n (ne 𝒏) = ne (unRenameSNe n 𝒏) -- redex cases: unRenameSN is (exp t⇒ 𝒕) = exp (unRename⇒1 is t⇒) (unRenameSN (proj₂ (unRename⇒0 is t⇒)) 𝒕) -- constructor cases: unRenameSN (abs t) (abs 𝒕) = abs (unRenameSN t 𝒕) unRename⇒0 : ∀{a Γ Δ} {ρ : Δ ≤ Γ} {t : Tm Γ a} {t' : Tm Δ a}{tρ} → IndRen ρ t tρ → tρ ⟨ _ ⟩⇒ t' → Σ _ \ s → IndRen ρ s t' unRename⇒0 {ρ = ρ} (app {u = u} (abs {t = t} is) is₁) (β 𝒖) = _ , prop→Ind ρ (≡.trans (≡.sym (sgs-lifts-term {σ = ρ} {u = u} {t = t})) (≡.cong₂ (λ t₁ u₁ → subst (sgs u₁) t₁) (Ind→prop _ is) (Ind→prop _ is₁))) unRename⇒0 (app is is₁) (cong (appl u) (appl .u) tρ→t') = let s , iss = unRename⇒0 is tρ→t' in app s _ , app iss is₁ unRename⇒1 : ∀{a Γ Δ} {ρ : Δ ≤ Γ} {t : Tm Γ a} {t' : Tm Δ a}{tρ} → (is : IndRen ρ t tρ) → (t⇒ : tρ ⟨ _ ⟩⇒ t') → t ⟨ _ ⟩⇒ proj₁ (unRename⇒0 is t⇒) unRename⇒1 (app (abs is) is₁) (β 𝒖) = β (unRenameSN is₁ 𝒖) unRename⇒1 (app is is₁) (cong (appl u) (appl .u) tρ→t') = cong (appl _) (appl _) (unRename⇒1 is tρ→t') -- Extensionality of SN for function types: -- If t x ∈ SN then t ∈ SN. absVarSNe : ∀{Γ a b}{t : Tm (a ∷ Γ) (a →̂ b)} → app t (var (zero)) ∈ SNe → t ∈ SNe absVarSNe (elim 𝒏 (appl 𝒖)) = 𝒏 absVarSN : ∀{Γ a b}{t : Tm (a ∷ Γ) (a →̂ b)} → app t (var (zero)) ∈ SN → t ∈ SN absVarSN (ne 𝒖) = ne (absVarSNe 𝒖) absVarSN (exp (β {t = t} 𝒖) 𝒕′) = abs (unRenameSN (prop→Ind contract (subst-ext contract-sgs t)) 𝒕′) absVarSN (exp (cong (appl ._) (appl ._) t⇒) 𝒕′) = exp t⇒ (absVarSN 𝒕′)
asm/Z80/unaplib_fast.asm
uniabis/apultra
79
161543
; ; Speed-optimized ApLib decompressor by spke & uniabis (ver.06 01-05/06/2020, 235 bytes) ; ; The original Z80 decompressors for ApLib were written by <NAME> (Dwedit), ; then tweaked by <NAME> (utopian), ; and optimized by <NAME> (Metalbrain) and <NAME>. ; ; This is a new "implicit state" decompressor heavily optimized for speed by spke. ; (It is 12 bytes shorter and 18% faster than the previously fastest ; 247b decompressor by Metalbrain and <NAME>.) ; ; ver.00 by spke (21/08/2018-01/09/2018, 244 bytes, an edit of the existing 247b decompressor); ; ver.01 by spke (12-13/11/2018, 234(-10) bytes, +3% speed using the state machine for LWM); ; ver.02 by spke (06/08/2019, +1% speed); ; ver.03 by spke (27/08/2019, 236(+2) bytes, +1% speed using partly expanded LDIR); ; ver.04 by spke (spring 2020, added full revision history and support for long offsets) ; ver.05 by spke (17-31/05/2020, 230(-6) bytes, +3% speed, added support for backward compression) <- BROKEN, DO NOT USE ; ver.06 by uniabis & spke (01-07/06/2020, 235(+5) bytes, +1% speed, added support for HD64180) ; ; The data must be compressed using any compressor for ApLib capable of generating raw data. ; At present, two best available compressors are: ; ; "APC" by <NAME>: https://github.com/svendahl/cap or ; "apultra" by <NAME>: https://github.com/emmanuel-marty/apultra ; ; The compression can done as follows: ; ; apc.exe e <sourcefile> <outfile> ; or ; apultra.exe <sourcefile> <outfile> ; ; A decent compressor was written by r57shell (although it is worse than compressors above): ; http://gendev.spritesmind.net/forum/viewtopic.php?p=32548#p32548 ; The use of the official ApLib compressor by <NAME> is not recommended. ; ; The decompression is done in the standard way: ; ; ld hl,FirstByteOfCompressedData ; ld de,FirstByteOfMemoryForDecompressedData ; call DecompressApLib ; ; Backward decompression is also supported; you can compress files backward using: ; ; apultra.exe -b <sourcefile> <outfile> ; ; uncomment option "DEFINE BackwardDecompression" and decompress the resulting files using: ; ; ld hl,LastByteOfCompressedData ; ld de,LastByteOfMemoryForDecompressedData ; call DecompressApLib ; ; The decompressor modifies AF, AF', BC, DE, HL, IX. ; ; Of course, ApLib compression algorithms are (c) 1998-2014 <NAME>, ; see http://www.ibsensoftware.com/ for more information ; ; Drop me an email if you have any comments/ideas/suggestions: <EMAIL> ; ; This software is provided 'as-is', without any express or implied ; warranty. In no event will the authors be held liable for any damages ; arising from the use of this software. ; ; Permission is granted to anyone to use this software for any purpose, ; including commercial applications, and to alter it and redistribute it ; freely, subject to the following restrictions: ; ; 1. The origin of this software must not be misrepresented; you must not ; claim that you wrote the original software. If you use this software ; in a product, an acknowledgment in the product documentation would be ; appreciated but is not required. ; 2. Altered source versions must be plainly marked as such, and must not be ; misrepresented as being the original software. ; 3. This notice may not be removed or altered from any source distribution. ; DEFINE SupportLongOffsets ; +4 bytes for long offset support. slows decompression down by 1%, but may be needed to decompress files >=32K ; DEFINE BackwardDecompression ; decompress data compressed backwards, -10 bytes, speeds decompression up by 3% ; DEFINE HD64180 ; -2 bytes for HD64180/Z180 support, slows decompression down by 1% IFNDEF BackwardDecompression MACRO NEXT_HL inc hl ENDM MACRO COPY_1 ldi ENDM MACRO COPY_BC ldir ENDM ELSE MACRO NEXT_HL dec hl ENDM MACRO COPY_1 ldd ENDM MACRO COPY_BC lddr ENDM ENDIF MACRO RELOAD_A ld a,(hl) : NEXT_HL : rla ENDM @Decompress: COPY_1 : scf ;================================================================================================================== ;================================================================================================================== ;================================================================================================================== LWM0: ;LWM = 0 (LWM stands for "Last Was Match"; a flag that we did not have a match) .ReloadByteC0 RELOAD_A : jr c,.Check2ndBit ; ; case "0"+BYTE: copy a single literal .CASE0: COPY_1 ; first byte is always copied as literal ; ; main decompressor loop .MainLoop: add a : jr nc,.CASE0 : jr z,.ReloadByteC0 ; "0"+BYTE = copy literal .Check2ndBit add a : jr nc,.CASE10 : jr z,.ReloadByteC1 ; "10"+gamma(offset/256)+BYTE+gamma(length) = the main matching mechanism .Check3rdBit add a : call z,ReloadByte : jp c,LWM1.CASE111 ; "110"+[oooooool] = matched 2-3 bytes with a small offset ; ; branch "110"+[oooooool]: copy two or three bytes (bit "l") with the offset -1..-127 (bits "ooooooo"), or stop .CASE110: ; "use 7 bit offset, length = 2 or 3" ; "if a zero is found here, it's EOF" ld c,(hl) : rr c : ret z ; process EOF NEXT_HL ld b,0 IFNDEF HD64180 ld ixl,c : ld ixh,b ; save offset for future LWMs ELSE push bc : pop ix ENDIF push hl ; save src ld h,d : ld l,e ; HL = dest jr c,.LengthIs3 .LengthIs2 IFNDEF BackwardDecompression sbc hl,bc ELSE add hl,bc ENDIF COPY_1 : COPY_1 jr .PreMainLoop .LengthIs3 IFNDEF BackwardDecompression or a : sbc hl,bc ELSE add hl,bc ENDIF COPY_1 : COPY_1 : COPY_1 jr .PreMainLoop .ReloadByteC1 RELOAD_A : jr c,.Check3rdBit ; ; branch "10"+gamma(offset/256)+BYTE+gamma(length): the main matching mechanism .CASE10: ; "use a gamma code * 256 for offset, another gamma code for length" call GetGammaCoded ; the original decompressor contains ; ; if ((LWM == 0) && (offs == 2)) { ... } ; else { ; if (LWM == 0) { offs -= 3; } ; else { offs -= 2; } ; } ; ; so, the idea here is to use the fact that GetGammaCoded returns (offset/256)+2, ; and to split the first condition by noticing that C-1 can never be zero dec c : dec c : jr z,LWM1.KickInLWM .AfterLWM dec c : ld b,c : ld c,(hl) : NEXT_HL ; BC = offset IFNDEF HD64180 ld ixl,c : ld ixh,b : push bc ELSE push bc : push bc : pop ix ENDIF call GetGammaCoded ; BC = len* ex (sp),hl ; interpretation of length value is offset-dependent: ; if (offs >= 32000) len++; if (offs >= 1280) len++; if (offs < 128) len+=2; ; in other words, ; (1 <= offs < 128) +=2 ; (128 <= offs < 1280) +=0 ; (1280 <= offs < 31999) +=1 ; NB offsets over 32000 need one more check, but other Z80 decompressors seem to ignore it. is it not needed? ; interpretation of length value is offset-dependent exa : ld a,h IFDEF SupportLongOffsets ; NB offsets over 32000 require an additional check, which is skipped in most ; Z80 decompressors (seemingly as a performance optimization) cp 32000/256 : jr nc,.Add2 ENDIF cp 5 : jr nc,.Add1 or a : jr nz,.Add0 bit 7,l : jr nz,.Add0 .Add2 inc bc .Add1 inc bc .Add0 ; for offs<128 : 4+4+7+7 + 4+7 + 8+7 + 6+6 = 60t ; for offs>=1280 : 4+4+7+12 + 6 = 33t ; for 128<=offs<1280 : 4+4+7+7 + 4+12 = 38t OR 4+4+7+7 + 4+7+8+12 = 53t .CopyMatch: ; this assumes that BC = len, DE = dest, HL = offset ; and also that (SP) = src, while having NC IFNDEF BackwardDecompression ld a,e : sub l : ld l,a ld a,d : sbc h ld h,a : exa ELSE exa .CopyMatchLDH add hl,de ENDIF COPY_1 : COPY_BC .PreMainLoop pop hl ; recover src ;================================================================================================================== ;================================================================================================================== ;================================================================================================================== LWM1: ; LWM = 1 ; ; main decompressor loop .MainLoop: add a : jr nc,LWM0.CASE0 : jr z,.ReloadByteC0 ; "0"+BYTE = copy literal .Check2ndBit add a : jr nc,.CASE10 : jr z,.ReloadByteC1 ; "10"+gamma(offset/256)+BYTE+gamma(length) = the main matching mechanism .Check3rdBit add a : call z,ReloadByte : jr nc,LWM0.CASE110 ; "110"+[oooooool] = matched 2-3 bytes with a small offset ; ; case "111"+"oooo": copy a byte with offset -1..-15, or write zero to dest .CASE111: ld bc,%11100000 DUP 4 add a : call z,ReloadByte : rl c ; read short offset (4 bits) EDUP ex de,hl : jr z,.WriteZero ; zero offset means "write zero" (NB: B is zero here) ; "write a previous byte (1-15 away from dest)" push hl ; BC = offset, DE = src, HL = dest IFNDEF BackwardDecompression sbc hl,bc ; HL = dest-offset (SBC works because branching above ensured NC) ELSE add hl,bc ENDIF ld c,(hl) pop hl .WriteZero ld (hl),c : NEXT_HL ex de,hl : jp LWM0.MainLoop ; 10+4*(4+10+8)+4+7 + 11+15+7+10 + 7+4+6+10 = 179t .ReloadByteC0 RELOAD_A : jp nc,LWM0.CASE0 jr .Check2ndBit .ReloadByteC1 RELOAD_A : jr c,.Check3rdBit ; ; branch "10"+gamma(offset/256)+BYTE+gamma(length): the main matching mechanism .CASE10: ; "use a gamma code * 256 for offset, another gamma code for length" call GetGammaCoded ; the original decompressor contains ; ; if ((LWM == 0) && (offs == 2)) { ... } ; else { ; if (LWM == 0) { offs -= 3; } ; else { offs -= 2; } ; } ; ; so, the idea here is to use the fact that GetGammaCoded returns (offset/256)+2, ; and to split the first condition by noticing that C-1 can never be zero dec c : jr LWM0.AfterLWM ; ; the re-use of the previous offset (LWM magic) .KickInLWM: ; "and a new gamma code for length" inc c : call GetGammaCoded.ReadGamma ; BC = len IFNDEF BackwardDecompression push ix : ex (sp),hl : exa jr LWM0.CopyMatch ELSE push ix : ex (sp),hl jr LWM0.CopyMatchLDH ENDIF ;================================================================================================================== ;================================================================================================================== ;================================================================================================================== ; ; interlaced gamma code reader ; x0 -> 1x ; x1y0 -> 1xy ; x1y1z0 -> 1xyz etc ; (technically, this is a 2-based variation of Exp-Golomb-1) GetGammaCoded: ld bc,1 .ReadGamma add a : jr z,.ReloadByteRG1 rl c : rl b add a : ret nc ; NB: flag NC immediately says we do not need to reload our byte... jr nz,.ReadGamma ; ...even better, flag NZ then automatically means flag C :) .ReloadByteRG2 RELOAD_A : ret nc : jr .ReadGamma .ReloadByteRG1 RELOAD_A : rl c : rl b add a : ret nc : jr .ReadGamma ; ; pretty usual getbit for mixed datastreams ReloadByte: RELOAD_A : ret
boot/ssl.asm
MJCS96/miniOS
0
163373
%define break xchg bx, bx KERNEL_SECTORS equ 50 [org 0x7E00] [bits 16] SSL: mov ah, 02h ; parameters for calling int13 (ReadSectors) - read the Kernel mov al, KERNEL_SECTORS ; read KERNEL_SECTORS sectors (hardcoded space for Kernel) mov ch, 00h mov cl, 0Bh ; starting from sector 11 - skip first 10 sectors (the MBR + SSL) mov dh, 00h mov bx, 0x9200 ; memory from 0x7E00 - 0x9200 used by SLL; 0x9200 - 0x9FFFF is unused int 13h jnc .success cli ; we should reset drive and retry, but we hlt hlt .success: cli ; starting RM to PM32 transition lgdt [GDT] mov eax, cr0 or al, 1 mov cr0, eax ; we are in protected mode but we need to set the CS register jmp 8:.bits32 ; we change the CS to 8 (index of FLAT_DESCRIPTOR_CODE32 entry) .bits32: [bits 32] mov ax, 16 ; index of FLAT_DESCRIPTOR_DATA32 entry mov ds, ax mov es, ax mov gs, ax mov ss, ax mov fs, ax cld mov ecx, KERNEL_SECTORS*512 ; KERNEL_SECTORS * sector_size mov esi, 0x9200 ; source mov edi, 0x200000 ; destination rep movsb ; copy the kernel from 0x9200 to 0x200000 mov [ds:0xb8000], BYTE 'O' mov [ds:0xb8002], BYTE 'K' ;break is_A20_on?: pushad mov edi,0x112345 ;odd megabyte address. mov esi,0x012345 ;even megabyte address. mov [esi],esi ;making sure that both addresses contain diffrent values. mov [edi],edi ;(if A20 line is cleared the two pointers would point to the address 0x012345 that would contain 0x112345 (edi)) cmpsd ;compare addresses to see if the're equivalent. popad jne A20_on ;if not equivalent , A20 line is set. cli ;if equivalent , the A20 line is cleared. hlt A20_on: ;break mov eax, 0x201000 ; the hardcoded ASMEntryPoint of the Kernel call eax cli ; this should not be reached hlt ; ; Data ; GDT: .limit dw GDTTable.end - GDTTable - 1 .base dd GDTTable FLAT_DESCRIPTOR_CODE32 equ 0x00CF9A000000FFFF ; Code: Execute/Read FLAT_DESCRIPTOR_DATA32 equ 0x00CF92000000FFFF ; Data: Read/Write FLAT_DESCRIPTOR_CODE16 equ 0x00009B000000FFFF ; Code: Execute/Read, accessed FLAT_DESCRIPTOR_DATA16 equ 0x000093000000FFFF ; Data: Read/Write, accessed FLAT_DESCRIPTOR_CODE64 equ 0x00AF9A000000FFFF FLAT_DESCRIPTOR_DATA64 equ 0x00AF92000000FFFF GDTTable: .null dq 0 ; 0 .code32 dq FLAT_DESCRIPTOR_CODE32 ; 8 .data32 dq FLAT_DESCRIPTOR_DATA32 ; 16 .code16 dq FLAT_DESCRIPTOR_CODE16 ; 24 .data16 dq FLAT_DESCRIPTOR_DATA16 ; 32 ;TODO!!! add 64-bits descriptors .code64 dq FLAT_DESCRIPTOR_CODE64 ; 40 .data64 dq FLAT_DESCRIPTOR_DATA64 ; 48 .end:
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c45252b.ada
best08618/asylo
7
29036
-- C45252B.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 NO EXCEPTION IS RAISED WHEN A FIXED POINT LITERAL -- OPERAND IN A COMPARISON OR A FIXED POINT LITERAL LEFT OPERAND -- IN A MEMBERSHIP TEST BELONGS TO THE BASE TYPE BUT IS OUTSIDE -- THE RANGE OF THE SUBTYPE. -- *** NOTE: This test has been modified since ACVC version 1.11 to -- 9X -- *** remove incompatibilities associated with the transition -- 9X -- *** to Ada 9X. -- 9X -- HISTORY: -- PWB 09/04/86 CREATED ORIGINAL TEST. -- DHH 10/19/87 SHORTENED LINES CONTAINING MORE THAN 72 CHARACTERS. -- JRL 03/30/93 REMOVED NUMERIC_ERROR FROM TEST. WITH REPORT, SYSTEM; USE REPORT; PROCEDURE C45252B IS BEGIN TEST ("C45252B", "NO EXCEPTION IS RAISED WHEN A FIXED " & "LITERAL USED IN A COMPARISON OR AS THE " & "LEFT OPERAND IN A MEMBERSHIP TEST " & "BELONGS TO THE BASE TYPE BUT IS OUTSIDE " & "THE RANGE OF THE SUBTYPE"); DECLARE TYPE FIXED IS DELTA 0.25 RANGE -10.0 .. 10.0; SUBTYPE FIXED_1 IS FIXED RANGE -1.0 .. 1.0; NUM : FIXED_1 := 0.0; BEGIN -- FIXED COMPARISON IF EQUAL(3,3) THEN NUM := FIXED_1'(0.5); END IF; IF 2.0 > NUM THEN COMMENT ("NO EXCEPTION RAISED FOR FIXED " & "COMPARISON"); ELSE FAILED ("WRONG RESULT FROM FIXED " & "COMPARISON"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => FAILED ("CONSTRAINT_ERROR RAISED FOR " & "FIXED COMPARISON"); WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED FOR " & "FIXED COMPARISON"); END; -- FIXED COMPARISON DECLARE TYPE FIXED IS DELTA 0.25 RANGE -10.0 .. 10.0; SUBTYPE FIXED_1 IS FIXED RANGE -1.0 .. 1.0; BEGIN -- FIXED MEMBERSHIP IF 2.0 IN FIXED_1 THEN FAILED ("WRONG RESULT FROM FIXED " & "MEMBERSHIP"); ELSE COMMENT ("NO EXCEPTION RAISED FOR FIXED " & "MEMBERSHIP"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => FAILED ("CONSTRAINT_ERROR RAISED FOR " & "FIXED MEMBERSHIP"); WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED FOR " & "FIXED MEMBERSHIP"); END; -- FIXED MEMBERSHIP DECLARE -- PRECISE FIXED COMPARISON TYPE FINE_FIXED IS DELTA SYSTEM.FINE_DELTA RANGE -1.0 .. 1.0; SUBTYPE SUB_FINE IS FINE_FIXED RANGE -0.5 .. 0.5; NUM : SUB_FINE := 0.0; BEGIN IF EQUAL(3,3) THEN NUM := 0.25; END IF; IF 0.75 > NUM THEN COMMENT ("NO EXCEPTION RAISED FOR FINE_FIXED " & "COMPARISON"); ELSE FAILED ("WRONG RESULT FROM FINE_FIXED COMPARISON"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => FAILED ("CONSTRAINT_ERROR RAISED FOR " & "FINE_FIXED COMPARISON"); WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED FOR " & "FINE_FIXED COMPARISON"); END; -- FINE_FIXED COMPARISON DECLARE -- PRECISE FIXED MEMBERSHIP TYPE FINE_FIXED IS DIGITS SYSTEM.MAX_DIGITS; SUBTYPE SUB_FINE IS FINE_FIXED RANGE -0.5 .. 0.5; BEGIN IF 0.75 IN SUB_FINE THEN FAILED ("WRONG RESULT FROM FINE_FIXED MEMBERSHIP"); ELSE COMMENT ("NO EXCEPTION RAISED FOR FINE_FIXED " & "MEMBERSHIP"); END IF; EXCEPTION WHEN CONSTRAINT_ERROR => FAILED ("CONSTRAINT_ERROR RAISED FOR " & "FINE_FIXED MEMBERSHIP"); WHEN OTHERS => FAILED ("OTHER EXCEPTION RAISED FOR " & "FINE_FIXED MEMBERSHIP"); END; -- FINE_FIXED MEMBERSHIP RESULT; END C45252B;
kernel/arch/amd64.asm
NineSilver/Oxyb
2
171420
<reponame>NineSilver/Oxyb bits 64 section .text global gdt_reload gdt_reload: lgdt [rdi] mov ax, 0x10 mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax pop rdi mov rax, 0x08 push rax push rdi retfq global idt_reload idt_reload: lidt [rdi] ret global read_cr2 read_cr2: mov rax, cr2 ret global write_cr3 write_cr3: mov cr3, rdi ret global read_msr read_msr: mov rcx, rdi rdmsr shl rdx, 32 or rax, rdx ret global outb outb: mov rax, rsi mov rdx, rdi out dx, al ret global outw outw: mov rax, rsi mov rdx, rdi out dx, ax ret global outd outl: mov rax, rsi mov rdx, rdi out dx, eax ret global inb inb: mov rdx, rdi in al, dx ret global inw inw: mov rdx, rdi in ax, dx ret global ind inl: mov rdx, rdi in eax, dx ret global __hlt __hlt: hlt ret global __cli __cli: cli ret global __sti __sti: sti ret
hw5/mult_poly_test.asm
Cyfurion/CSE220
0
175168
.data p_pair: .word 5 2 p_terms: .word 7 1 0 -1 q_pair: .word 3 2 q_terms: .word 1 1 0 -1 p: .word 0 q: .word 0 r: .word 0 N: .word 1 .text: main: la $a0, p la $a1, p_pair jal init_polynomial la $a0, p la $a1, p_terms lw $a2, N jal add_N_terms_to_polynomial la $a0, q la $a1, q_pair jal init_polynomial la $a0, q la $a1, q_terms lw $a2, N jal add_N_terms_to_polynomial la $a0, p la $a1, q la $a2, r jal mult_poly #write test code li $v0, 10 syscall .include "hw5.asm"
Cubical/HITs/Ints/DeltaInt/Base.agda
Edlyr/cubical
0
5672
{-# OPTIONS --cubical --no-import-sorts --safe #-} {- This file defines integers as equivalence classes of pairs of natural numbers using a direct & untruncated HIT definition (cf. HITs.Ints.DiffInt) and some basic operations, and the zero value: succ : DeltaInt → DeltaInt pred : DeltaInt → DeltaInt zero : {a : ℕ} → DeltaInt and conversion function for ℕ and Int: fromℕ : ℕ → DeltaInt fromInt : Int → DeltaInt toInt : DeltaInt → Int and a generalized version of cancel: cancelN : ∀ a b n → a ⊖ b ≡ (n + a) ⊖ n + b -} module Cubical.HITs.Ints.DeltaInt.Base where open import Cubical.Foundations.Prelude open import Cubical.Data.Nat hiding (zero) open import Cubical.Data.Int hiding (abs; sgn; _+_) infixl 5 _⊖_ data DeltaInt : Type₀ where _⊖_ : ℕ → ℕ → DeltaInt cancel : ∀ a b → a ⊖ b ≡ suc a ⊖ suc b succ : DeltaInt → DeltaInt succ (x ⊖ y) = suc x ⊖ y succ (cancel a b i) = cancel (suc a) b i pred : DeltaInt → DeltaInt pred (x ⊖ y) = x ⊖ suc y pred (cancel a b i) = cancel a (suc b) i zero : {a : ℕ} → DeltaInt zero {a} = a ⊖ a fromℕ : ℕ → DeltaInt fromℕ n = n ⊖ 0 fromInt : Int → DeltaInt fromInt (pos n) = fromℕ n fromInt (negsuc n) = 0 ⊖ suc n toInt : DeltaInt → Int toInt (x ⊖ y) = x ℕ- y toInt (cancel a b i) = a ℕ- b cancelN : ∀ a b n → a ⊖ b ≡ (n + a) ⊖ n + b cancelN a b 0 = refl cancelN a b (suc n) = cancelN a b n ∙ cancel (n + a) (n + b)
source/numerics/a-nlrear.ads
ytomino/drake
33
30820
pragma License (Unrestricted); with Ada.Numerics.Generic_Real_Arrays; package Ada.Numerics.Long_Real_Arrays is new Generic_Real_Arrays (Long_Float); pragma Pure (Ada.Numerics.Long_Real_Arrays);
programs/oeis/259/A259369.asm
neoneye/loda
22
84386
<filename>programs/oeis/259/A259369.asm ; A259369: a(n) = 1 + sigma(n)^3 + sigma(n)^6. ; 3,757,4161,117993,46873,2987713,262657,11394001,4829007,34018057,2987713,481912257,7532281,191116801,191116801,887533473,34018057,3518803081,64008001,5489105833,1073774593,2176828993,191116801,46656216001,887533473,5489105833,4096064001,30841155073,729027001,139314442753,1073774593,62523752257,12230701057,24795068761,12230701057,567870005613,3010991257,46656216001,30841155073,531441729001,5489105833,782758674433,7256399041,351298624321,225200075257,139314442753,12230701057,3635216984001,34296632443,646990987807,139314442753,885843322057,24795068761,2985985728001,139314442753,2985985728001,262144512001,531441729001,46656216001,22483078765057,56800473913,782758674433,1265320143361,4195874963073,351298624321,8916103434241,98867797057,4001506141753,782758674433,8916103434241,139314442753,54980378680501,164206895401,2194974105481,3635216984001,7529538744001,782758674433,22483078765057,262144512001,41407378175593,3138430148283,4001506141753,351298624321,126324663091201,1586875582657,5289855100993,2985985728001,34012229832001,531441729001,164170521726121,1973824090113,22483078765057,4398048608257,8916103434241,2985985728001,256096281051073,885843322057,25002115044733,14412778241473,104413930784283 seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n). seq $0,60883 ; a(n) = n^6 + n^3 + 1.
test/Succeed/NonTerminatingClauseInDefByCopatterns.agda
cruhland/agda
1,989
5920
<filename>test/Succeed/NonTerminatingClauseInDefByCopatterns.agda {-# OPTIONS --copatterns #-} open import Common.Prelude open import Common.Product postulate A : Set B : A → Set f : ∀ a → B a bla : ∃ B {-# NON_TERMINATING #-} proj₁ bla = proj₁ bla proj₂ bla = f (proj₁ bla) T : Bool → Set T true = Bool T false = Bool test : (∀ b → T b) → ∃ T {-# NON_TERMINATING #-} proj₁ (test f) = proj₁ (test f) proj₂ (test f) = f (proj₁ (test f))
oeis/200/A200674.asm
neoneye/loda-programs
11
82205
<gh_stars>10-100 ; A200674: Eccentricity of Tower of Hanoi graph H_n^{3} (divided by 3). ; Submitted by <NAME> ; 0,1,9,61,385,2365,14353,86605,521089,3130909,18798577,112830829,677103073,4062972733,24378899281,146276584333,877669071937,5266043129437,31596344870065,189578327500717,1137470739845281,6824826763594621,40948967555136529 mov $1,1 mov $3,1 lpb $0 sub $0,1 mul $1,2 add $3,$1 mov $2,$3 mul $2,2 add $3,$1 mul $1,3 add $3,$2 lpe mov $0,$2 div $0,5
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_436.asm
ljhsiun2/medusa
9
4690
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %r8 push %rax push %rcx push %rdi push %rsi lea addresses_WT_ht+0xc956, %r8 nop nop inc %r11 movb (%r8), %r13b nop nop nop sub $14244, %rsi lea addresses_normal_ht+0x7716, %r11 nop nop nop nop nop mfence mov $0x6162636465666768, %r13 movq %r13, %xmm1 vmovups %ymm1, (%r11) nop nop nop nop xor %r11, %r11 lea addresses_WT_ht+0x17ed6, %r13 nop nop xor $34800, %rax mov $0x6162636465666768, %r11 movq %r11, (%r13) nop nop nop nop and %r14, %r14 lea addresses_A_ht+0xc016, %rax nop nop add $12293, %r8 and $0xffffffffffffffc0, %rax movaps (%rax), %xmm4 vpextrq $1, %xmm4, %r14 nop nop nop nop sub %rdi, %rdi lea addresses_UC_ht+0x17416, %rsi lea addresses_WC_ht+0x15416, %rdi nop nop xor $65151, %r8 mov $12, %rcx rep movsw nop nop nop nop xor $34883, %rcx lea addresses_UC_ht+0x12c16, %r14 inc %r13 movb $0x61, (%r14) nop nop nop nop nop and $2466, %r14 lea addresses_WT_ht+0x1ca6e, %r14 clflush (%r14) and %r11, %r11 vmovups (%r14), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %rcx nop nop nop nop cmp $39138, %r11 lea addresses_normal_ht+0x10dba, %rsi nop nop nop dec %r13 vmovups (%rsi), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $1, %xmm6, %r11 nop nop dec %r11 lea addresses_A_ht+0x17c16, %rsi lea addresses_UC_ht+0x1e116, %rdi and %r11, %r11 mov $119, %rcx rep movsb nop nop nop nop add $52027, %r13 lea addresses_A_ht+0x12066, %rsi clflush (%rsi) nop nop nop nop mfence movb (%rsi), %al xor $15931, %rax lea addresses_WC_ht+0x7e5e, %rax nop nop nop xor $44517, %rcx mov $0x6162636465666768, %rsi movq %rsi, (%rax) nop sub $23025, %r11 lea addresses_normal_ht+0x2416, %r8 nop nop add $12649, %rsi vmovups (%r8), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $1, %xmm3, %rdi nop xor %r13, %r13 lea addresses_UC_ht+0x10816, %r11 nop nop nop nop cmp $62046, %r13 mov $0x6162636465666768, %rcx movq %rcx, %xmm4 movups %xmm4, (%r11) and $15123, %rcx lea addresses_WT_ht+0x38f6, %r14 nop nop nop sub %r13, %r13 vmovups (%r14), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $1, %xmm6, %rsi nop nop nop nop nop lfence pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r8 push %rbx push %rcx // Faulty Load lea addresses_normal+0x10416, %rbx nop add $56518, %rcx mov (%rbx), %r14 lea oracles, %r8 and $0xff, %r14 shlq $12, %r14 mov (%r8,%r14,1), %r14 pop %rcx pop %rbx pop %r8 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 9, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
test/Fail/DuplicateBuiltinBinding.agda
alhassy/agda
1
740
module DuplicateBuiltinBinding where {-# BUILTIN STRING String #-} {-# BUILTIN STRING String #-}
example_1.1/src/points.ads
rogermc2/GA_Ada
3
3495
<filename>example_1.1/src/points.ads with GL.Types; use GL.Types; with C3GA; with E3GA; with Multivectors; package Points is use Multivectors; use C3GA; type Normalized_Points_Array is array (int range <>) of Normalized_Point; Num_Points : constant Int := 6; Point_Data : constant Vector_E3_Array (1 .. Num_Points) := -- E1 E2 E3 ((-0.356756, -0.881980, 0.0), -- L1 (-0.725786, 0.934177, -0.366154), -- L2 (2.612482, 1.495455, -2.704073), -- C1 (2.218644, 0.425753, -1.780935), -- C2 (0.865897, 0.629159, -1.438985), -- C3 (2.846445, -1.112365, -0.366769)); -- P1 L0_Points : constant Vector_E3_Array (1 .. 2) := -- E1 E2 E3 ((0.0, -0.9, 0.0), -- L0L (0.0, 0.9, 0.0)); -- L0R type Colour_Data is new Singles.Vector4_Array (1 .. Num_Points); Line_Point_Index : Int := 1; Circle_Point_Index : Int := 3; Plane_Point_Index : Int := 6; -- A Normalized_Point consists of five blades representing the vectors: -- no = 1.0, E1, E2, E3, ni = Inf n : constant M_Vector := E3GA.e2; -- n is a direction vector L1 : constant Normalized_Point := Set_Normalized_Point (Point_Data (1)); L2 : constant Normalized_Point := Set_Normalized_Point (Point_Data (2)); C1 : constant Normalized_Point := Set_Normalized_Point (Point_Data (3)); C2 : constant Normalized_Point := Set_Normalized_Point (Point_Data (4)); C3 : constant Normalized_Point := Set_Normalized_Point (Point_Data (5)); P1 : constant Normalized_Point := Set_Normalized_Point (Point_Data (6)); L0L : constant Normalized_Point := Set_Normalized_Point (L0_Points (1)); L0R : constant Normalized_Point := Set_Normalized_Point (L0_Points (2)); Normalized_Points : constant Normalized_Points_Array (1 .. Num_Points) := (L1, L2, C1, C2, C3, P1); L0_Normalized_Points : constant Normalized_Points_Array (1 .. 2) := (L0L, L0R); function Set_Draw_Colour (Colour : Singles.Vector4) return Colour_Data; end Points;
MmParser.g4
anterokangas/MM
0
4484
parser grammar MmParser ; options {tokenVocab=MmLexer;} /************************ * Manuscript Manager * version 2.0 * Parser of *.mm files ************************/ mm : ( Comment # ohitetaan | String # kertoja | command # määrittelykomento vaiko definition? | call # kutsu )* ; command : roleCommand | waitCommand | soundCommand | groupCommand | playCommand | settingsCommand ; roleCommand : LParen RoleCommand RoleName roleParameters RoleRParen ; roleParameters : roleParameter* ; roleParameter : RoleLParen ( PitchRoleParam NumberValue NumberRParen | RateRoleParam NumberValue NumberRParen | GainRoleParam NumberValue NumberRParen | LangRoleParam LanguageValue NumberRParen | AliasRoleParam FullNameValue FullNameRParen ) ; waitCommand : LParen WaitCommand WaitName waitParameters WaitRParen ; waitParameters : waitParameter ; waitParameter : WaitLParen LengthWaitParam NumberValue NumberRParen ; soundCommand : LParen SoundCommand SoundName soundParameters SoundRParen ; soundParameters : soundParameter* ; soundParameter : SoundLParen ( BlockSoundParam BooleanValue BooleanRParen | FromSoundParam SoundName SoundNameRParen | GainSoundParam NumberValue NumberRParen ) ; groupCommand : LParen GroupCommand GroupName groupParameters GroupRParen ; groupParameters : groupParameter* ; groupParameter : GroupLParen ( MembersGroupParam SoundNameValue* SoundNameRParen | GainSoundParam NumberValue NumberRParen ) ; playCommand : LParen PlayCommand PlayName playParameters PlayRParen ; playParameters : playParameter* ; playParameter : PlayLParen ( SoundPlayParam SoundNameValue SoundNameRParen | GainSoundParam NumberValue NumberRParen ) ; settingsCommand : LParen SettingsCommand settingsParameters SettingsRParen ; settingsParameters : settingsParameter* ; settingsParameter : SettingsLParen ( DefaultLanguageSettingsParam LanguageValue LanguageRParen | OutputSettingsParam SoundNameValue SoundNameRParen ) ; call : LParen Call CallString? callParameters CallRParen ; callParameters: callParameter* ; callParameter : CallLParen StringValue StringRParen ;
Driver/Printer/PrintCom/printcomToshibaGraphics.asm
steakknife/pcgeos
504
7960
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1990 -- All Rights Reserved PROJECT: PC GEOS MODULE: early Epson 24-pin print drivers FILE: printcomToshibaGraphics.asm AUTHOR: <NAME> 1 March 1990 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 3/1/90 Initial revision DESCRIPTION: This file contains most of the code to implement the Toshiba 24-pin print driver graphics mode support $Id: printcomToshibaGraphics.asm,v 1.1 97/04/18 11:50:55 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ include Graphics/graphicsCommon.asm ;common graphic print routines include Graphics/graphics2ResHigh.asm ;PrPrintABand routine. include Graphics/graphicsCitohCommon.asm ;common Citoh graphic rout. include Graphics/graphicsPrintSwath48.asm ;PrintSwath routine. include Graphics/graphicsHi24IntX.asm ;Hi res routine, include Graphics/Rotate/rotate2pass24Into4.asm ;and rotate routine include Graphics/graphicsMed24.asm ;Medium res. routine, include Graphics/Rotate/rotate24Into4.asm ;and rotate routine.
src/main/antlr4/org/optionmetrics/ztext/antlr4/ZMarkupParser.g4
dhait/ztext
0
6227
/* * [The "BSD licence"] * Copyright (c) 2017 <NAME> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ parser grammar ZMarkupParser; options { tokenVocab=ZMarkupLexer; } specification : paragraph* EOF ; paragraph : DEFINE DEFSYM zexpr* END #Define | ZED zexpr* END #ZedParagraph | AXIOM gen? zexpr* (WHERE zexpr*)? END #AxiomParagraph | SCHEMA sname gen? zexpr* (WHERE zexpr*)? END #SchemaParagraph | SECTION sname (PARENTS sparents)? END #SectionHeader | TAG NUMBER END #Tag | IGNORE+ #Informal ; zexpr : (TEXT | NAME | NUMBER | DEFSYM | COMMA | UNICODE | LBRACKET | RBRACKET ) ; sname : NAME; gen: (LBRACKET NAME (COMMA NAME)* RBRACKET) ; sparents : sname (COMMA sname)* ;
examples/shared/hello_world_blinky/src/control.adb
webgeeks/Ada_Drivers_Library
0
13835
<reponame>webgeeks/Ada_Drivers_Library package body control is procedure Intialize_Controls is begin Configure_PWM_Timer (Selected_Timer'Access, Requested_Frequency); Servo_Control.Attach_PWM_Channel (Selected_Timer'Access, Servo_Channel, LED_For (Servo_Channel), Timer_AF); Servo_Control.Enable_Output; Motor_Control.Attach_PWM_Channel (Selected_Timer'Access, Motor_Channel, LED_For (Motor_Channel), Timer_AF); Motor_Control.Enable_Output; Seed_Control.Attach_PWM_Channel (Selected_Timer'Access, Seed_Channel, LED_For (Seed_Channel), Timer_AF); Seed_Control.Enable_Output; Soil_Control.Attach_PWM_Channel (Selected_Timer'Access, Soil_Channel, LED_For (Soil_Channel), Timer_AF); Soil_Control.Enable_Output; Motor_Control.Set_Duty_Cycle (8); Servo_Control.Set_Duty_Cycle (7); end Intialize_Controls; procedure forward is begin Motor_Control.Set_Duty_Cycle (11); end forward; procedure backward is begin Motor_Control.Set_Duty_Cycle (5); end backward; procedure left is begin Servo_Control.Set_Duty_Cycle (5); end left; procedure right is begin Servo_Control.Set_Duty_Cycle (9); end right; procedure stop is begin Motor_Control.Set_Duty_Cycle (8); end stop; procedure front is begin Servo_Control.Set_Duty_Cycle (7); end front; procedure Drop_Seed is begin Servo_Control.Set_Duty_Cycle (5); delay until Clock + Milliseconds (1000); Servo_Control.Set_Duty_Cycle (8); end Drop_Seed; procedure Measure is begin Servo_Control.Set_Duty_Cycle (3); delay until Clock + Milliseconds (1000); Servo_Control.Set_Duty_Cycle (8); end Measure; end control;
Task/Box-the-compass/Ada/box-the-compass.ada
LaudateCorpus1/RosettaCodeData
1
6039
with Ada.Text_IO; procedure Box_The_Compass is type Degrees is digits 5 range 0.00 .. 359.99; type Index_Type is mod 32; function Long_Name(Short: String) return String is function Char_To_Name(Char: Character) return String is begin case Char is when 'N' | 'n' => return Char & "orth"; when 'S' | 's' => return Char & "outh"; when 'E' | 'e' => return Char & "ast"; when 'W' | 'w' => return Char & "est"; when 'b' => return " by "; when '-' => return "-"; when others => raise Constraint_Error; end case; end Char_To_Name; begin if Short'Length = 0 or else Short(Short'First)=' ' then return ""; else return Char_To_Name(Short(Short'First)) & Long_Name(Short(Short'First+1 .. Short'Last)); end if; end Long_Name; procedure Put_Line(Angle: Degrees) is function Index(D: Degrees) return Index_Type is begin return Index_Type(Integer(Degrees'Rounding(D/11.25)) mod 32); end Index; I: Integer := Integer(Index(Angle))+1; package DIO is new Ada.Text_IO.Float_IO(Degrees); Abbr: constant array(Index_Type) of String(1 .. 4) := ("N ", "Nbe ", "N-ne", "Nebn", "Ne ", "Nebe", "E-ne", "Ebn ", "E ", "Ebs ", "E-se", "Sebe", "Se ", "Sebs", "S-se", "Sbe ", "S ", "Sbw ", "S-sw", "Swbs", "Sw ", "Swbw", "W-sw", "Wbs ", "W ", "Wbn ", "W-nw", "Nwbw", "Nw ", "Nwbn", "N-nw", "Nbw "); begin DIO.Put(Angle, Fore => 3, Aft => 2, Exp => 0); -- format "zzx.xx" Ada.Text_IO.Put(" |"); if I <= 9 then Ada.Text_IO.Put(" "); end if; Ada.Text_IO.Put_Line(" " & Integer'Image(I) & " | " & Long_Name(Abbr(Index(Angle)))); end Put_Line; Difference: constant array(0..2) of Degrees'Base := (0=> 0.0, 1=> +5.62, 2=> - 5.62); begin Ada.Text_IO.Put_Line(" angle | box | compass point"); Ada.Text_IO.Put_Line(" ---------------------------------"); for I in 0 .. 32 loop Put_Line(Degrees(Degrees'Base(I) * 11.25 + Difference(I mod 3))); end loop; end Box_The_Compass;
src/Compilers/VisualBasic/Portable/Generated/VisualBasic.Grammar.g4
ffMathy/roslyn
17,923
2979
// <auto-generated /> grammar vb; compilation_unit : option_statement* imports_statement* attributes_statement* statement* ; option_statement : 'Option' ('Explicit' | 'Strict' | 'Compare' | 'Infer') ('On' | 'Off' | 'Text' | 'Binary')? ; imports_statement : 'Imports' imports_clause (',' imports_clause)* ; imports_clause : simple_imports_clause | xml_namespace_imports_clause ; simple_imports_clause : import_alias_clause? name ; import_alias_clause : identifier_token '=' ; xml_namespace_imports_clause : '<' xml_attribute '>' ; xml_attribute : xml_node '=' xml_node ; attributes_statement : attribute_list* ; attribute_list : '<' attribute (',' attribute)* '>' ; attribute : attribute_target? type argument_list? ; attribute_target : 'Assembly' ':' | 'Module' ':' ; argument_list : '(' (argument (',' argument)*)? ')' ; argument : omitted_argument | range_argument | simple_argument ; omitted_argument : empty_token ; range_argument : expression 'To' expression ; simple_argument : name_colon_equals? expression ; name_colon_equals : identifier_name ':=' ; identifier_name : identifier_token ; statement : case_statement | catch_statement | declaration_statement | do_statement | else_if_statement | else_statement | empty_statement | executable_statement | finally_statement | for_or_for_each_statement | if_statement | loop_statement | next_statement | select_statement | sync_lock_statement | try_statement | using_statement | while_statement | with_statement ; case_statement : 'Case' case_clause (',' case_clause)* ; case_clause : else_case_clause | range_case_clause | relational_case_clause | simple_case_clause ; else_case_clause : 'Else' ; range_case_clause : expression 'To' expression ; relational_case_clause : case_equals_clause | case_greater_than_clause | case_greater_than_or_equal_clause | case_less_than_clause | case_less_than_or_equal_clause | case_not_equals_clause ; case_equals_clause : 'Is'? '=' expression ; case_greater_than_clause : 'Is'? '>' expression ; case_greater_than_or_equal_clause : 'Is'? '>=' expression ; case_less_than_clause : 'Is'? '<' expression ; case_less_than_or_equal_clause : 'Is'? '<=' expression ; case_not_equals_clause : 'Is'? '<>' expression ; simple_case_clause : expression ; catch_statement : 'Catch' identifier_name? simple_as_clause? catch_filter_clause? ; simple_as_clause : 'As' attribute_list* type ; catch_filter_clause : 'When' expression ; declaration_statement : attributes_statement | end_block_statement | enum_block | enum_member_declaration | enum_statement | event_block | field_declaration | imports_statement | incomplete_member | inherits_or_implements_statement | method_base | method_block_base | namespace_block | namespace_statement | option_statement | property_block | type_block | type_statement ; end_block_statement : end_add_handler_statement | end_class_statement | end_enum_statement | end_event_statement | end_function_statement | end_get_statement | end_if_statement | end_interface_statement | end_module_statement | end_namespace_statement | end_operator_statement | end_property_statement | end_raise_event_statement | end_remove_handler_statement | end_select_statement | end_set_statement | end_structure_statement | end_sub_statement | end_sync_lock_statement | end_try_statement | end_using_statement | end_while_statement | end_with_statement ; end_add_handler_statement : 'End' 'AddHandler' ; end_class_statement : 'End' 'Class' ; end_enum_statement : 'End' 'Enum' ; end_event_statement : 'End' 'Event' ; end_function_statement : 'End' 'Function' ; end_get_statement : 'End' 'Get' ; end_if_statement : 'End' 'If' ; end_interface_statement : 'End' 'Interface' ; end_module_statement : 'End' 'Module' ; end_namespace_statement : 'End' 'Namespace' ; end_operator_statement : 'End' 'Operator' ; end_property_statement : 'End' 'Property' ; end_raise_event_statement : 'End' 'RaiseEvent' ; end_remove_handler_statement : 'End' 'RemoveHandler' ; end_select_statement : 'End' 'Select' ; end_set_statement : 'End' 'Set' ; end_structure_statement : 'End' 'Structure' ; end_sub_statement : 'End' 'Sub' ; end_sync_lock_statement : 'End' 'SyncLock' ; end_try_statement : 'End' 'Try' ; end_using_statement : 'End' 'Using' ; end_while_statement : 'End' 'While' ; end_with_statement : 'End' 'With' ; enum_block : enum_statement statement* end_enum_statement ; enum_statement : attribute_list* modifier* 'Enum' identifier_token as_clause? ; as_clause : as_new_clause | simple_as_clause ; as_new_clause : 'As' new_expression ; new_expression : anonymous_object_creation_expression | array_creation_expression | object_creation_expression ; anonymous_object_creation_expression : 'New' attribute_list* object_member_initializer ; object_member_initializer : 'With' '{' (field_initializer (',' field_initializer)*)? '}' ; field_initializer : inferred_field_initializer | named_field_initializer ; inferred_field_initializer : 'Key'? expression ; named_field_initializer : 'Key'? '.' identifier_name '=' expression ; array_creation_expression : 'New' attribute_list* type argument_list? array_rank_specifier* collection_initializer ; array_rank_specifier : '(' ','* ')' ; collection_initializer : '{' (expression (',' expression)*)? '}' ; object_creation_expression : 'New' attribute_list* type argument_list? object_creation_initializer? ; object_creation_initializer : object_collection_initializer | object_member_initializer ; object_collection_initializer : 'From' collection_initializer ; enum_member_declaration : attribute_list* identifier_token equals_value? ; equals_value : '=' expression ; event_block : event_statement accessor_block* end_event_statement ; event_statement : attribute_list* modifier* 'Custom'? 'Event' identifier_token parameter_list? simple_as_clause? implements_clause? ; parameter_list : '(' (parameter (',' parameter)*)? ')' ; parameter : attribute_list* modifier* modified_identifier simple_as_clause? equals_value? ; modified_identifier : identifier_token '?'? argument_list? array_rank_specifier* ; implements_clause : 'Implements' (qualified_name (',' qualified_name)*)? ; qualified_name : name '.' simple_name ; simple_name : generic_name | identifier_name ; generic_name : identifier_token type_argument_list ; type_argument_list : '(' 'Of' type (',' type)* ')' ; accessor_block : add_handler_accessor_block | get_accessor_block | raise_event_accessor_block | remove_handler_accessor_block | set_accessor_block ; add_handler_accessor_block : accessor_statement end_add_handler_statement ; accessor_statement : add_handler_accessor_statement | get_accessor_statement | raise_event_accessor_statement | remove_handler_accessor_statement | set_accessor_statement ; add_handler_accessor_statement : 'AddHandler' ; get_accessor_statement : 'Get' ; raise_event_accessor_statement : 'RaiseEvent' ; remove_handler_accessor_statement : 'RemoveHandler' ; set_accessor_statement : 'Set' ; get_accessor_block : accessor_statement end_get_statement ; raise_event_accessor_block : accessor_statement end_raise_event_statement ; remove_handler_accessor_block : accessor_statement end_remove_handler_statement ; set_accessor_block : accessor_statement end_set_statement ; field_declaration : attribute_list* modifier* variable_declarator (',' variable_declarator)* ; variable_declarator : modified_identifier (',' modified_identifier)* as_clause? equals_value? ; incomplete_member : attribute_list* modifier* identifier_token? ; inherits_or_implements_statement : implements_statement | inherits_statement ; implements_statement : 'Implements' type (',' type)* ; inherits_statement : 'Inherits' type (',' type)* ; method_base : accessor_statement | declare_statement | delegate_statement | event_statement | lambda_header | method_statement | operator_statement | property_statement | sub_new_statement ; declare_statement : declare_function_statement | declare_sub_statement ; declare_function_statement : 'Declare' ('Ansi' | 'Unicode' | 'Auto')? 'Function' identifier_token 'Lib' literal_expression 'Alias'? literal_expression? simple_as_clause? ; literal_expression : 'False' | 'Nothing' | 'True' | character_literal_token | date_literal_token | decimal_literal_token | floating_literal_token | integer_literal_token | string_literal_token ; declare_sub_statement : 'Declare' ('Ansi' | 'Unicode' | 'Auto')? 'Sub' identifier_token 'Lib' literal_expression 'Alias'? literal_expression? simple_as_clause? ; delegate_statement : delegate_function_statement | delegate_sub_statement ; delegate_function_statement : 'Delegate' 'Function' identifier_token type_parameter_list? simple_as_clause? ; type_parameter_list : '(' 'Of' type_parameter (',' type_parameter)* ')' ; type_parameter : 'In'? identifier_token type_parameter_constraint_clause? | 'Out'? identifier_token type_parameter_constraint_clause? ; type_parameter_constraint_clause : type_parameter_multiple_constraint_clause | type_parameter_single_constraint_clause ; type_parameter_multiple_constraint_clause : 'As' '{' constraint (',' constraint)* '}' ; constraint : special_constraint | type_constraint ; special_constraint : class_constraint | new_constraint | structure_constraint ; class_constraint : 'Class' ; new_constraint : 'New' ; structure_constraint : 'Structure' ; type_constraint : type ; type_parameter_single_constraint_clause : 'As' constraint ; delegate_sub_statement : 'Delegate' 'Sub' identifier_token type_parameter_list? simple_as_clause? ; lambda_header : function_lambda_header | sub_lambda_header ; function_lambda_header : 'Function' simple_as_clause? ; sub_lambda_header : 'Sub' simple_as_clause? ; method_statement : function_statement | sub_statement ; function_statement : 'Function' identifier_token type_parameter_list? simple_as_clause? handles_clause? implements_clause? ; handles_clause : 'Handles' handles_clause_item (',' handles_clause_item)* ; handles_clause_item : event_container '.' identifier_name ; event_container : keyword_event_container | with_events_event_container | with_events_property_event_container ; keyword_event_container : 'Me' | 'MyBase' | 'MyClass' ; with_events_event_container : identifier_token ; with_events_property_event_container : with_events_event_container '.' identifier_name ; sub_statement : 'Sub' identifier_token type_parameter_list? simple_as_clause? handles_clause? implements_clause? ; operator_statement : attribute_list* modifier* 'Operator' ('CType' | 'IsTrue' | 'IsFalse' | 'Not' | '+' | '-' | '*' | '/' | '^' | '\\' | '&' | '<<' | '>>' | 'Mod' | 'Or' | 'Xor' | 'And' | 'Like' | '=' | '<>' | '<' | '<=' | '>=' | '>') parameter_list? simple_as_clause? ; property_statement : attribute_list* modifier* 'Property' identifier_token parameter_list? as_clause? equals_value? implements_clause? ; sub_new_statement : attribute_list* modifier* 'Sub' 'New' parameter_list? ; method_block_base : accessor_block | constructor_block | method_block | operator_block ; constructor_block : sub_new_statement statement* end_sub_statement ; method_block : function_block | sub_block ; function_block : method_statement end_function_statement ; sub_block : method_statement end_sub_statement ; operator_block : operator_statement statement* end_operator_statement ; namespace_block : namespace_statement statement* end_namespace_statement ; namespace_statement : 'Namespace' name ; property_block : property_statement accessor_block* end_property_statement ; type_block : class_block | interface_block | module_block | structure_block ; class_block : class_statement inherits_statement* implements_statement* statement* end_class_statement ; class_statement : attribute_list* modifier* 'Class' identifier_token type_parameter_list? ; interface_block : interface_statement inherits_statement* implements_statement* statement* end_interface_statement ; interface_statement : attribute_list* modifier* 'Interface' identifier_token type_parameter_list? ; module_block : module_statement inherits_statement* implements_statement* statement* end_module_statement ; module_statement : attribute_list* modifier* 'Module' identifier_token type_parameter_list? ; structure_block : structure_statement inherits_statement* implements_statement* statement* end_structure_statement ; structure_statement : attribute_list* modifier* 'Structure' identifier_token type_parameter_list? ; type_statement : class_statement | interface_statement | module_statement | structure_statement ; do_statement : 'Do' while_or_until_clause? ; while_or_until_clause : until_clause | while_clause ; until_clause : 'Until' expression ; while_clause : 'While' expression ; else_if_statement : 'ElseIf' expression 'Then'? ; else_statement : 'Else' ; empty_statement : empty_token ; executable_statement : add_remove_handler_statement | assignment_statement | call_statement | continue_statement | do_loop_block | erase_statement | error_statement | exit_statement | expression_statement | for_or_for_each_block | go_to_statement | label_statement | local_declaration_statement | multi_line_if_block | on_error_go_to_statement | on_error_resume_next_statement | print_statement | raise_event_statement | re_dim_statement | resume_statement | return_statement | select_block | single_line_if_statement | stop_or_end_statement | sync_lock_block | throw_statement | try_block | using_block | while_block | with_block | yield_statement ; add_remove_handler_statement : add_handler_statement | remove_handler_statement ; add_handler_statement : 'AddHandler' expression ',' expression ; remove_handler_statement : 'RemoveHandler' expression ',' expression ; assignment_statement : expression ('=' | '+=' | '-=' | '*=' | '/=' | '\=' | '^=' | '<<=' | '>>=' | '&=') expression ; call_statement : 'Call' expression ; continue_statement : continue_do_statement | continue_for_statement | continue_while_statement ; continue_do_statement : 'Continue' 'Do' ; continue_for_statement : 'Continue' 'For' ; continue_while_statement : 'Continue' 'While' ; do_loop_block : do_statement statement* loop_statement ; loop_statement : 'Loop' while_or_until_clause? ; erase_statement : 'Erase' expression (',' expression)* ; error_statement : 'Error' expression ; exit_statement : exit_do_statement | exit_for_statement | exit_function_statement | exit_operator_statement | exit_property_statement | exit_select_statement | exit_sub_statement | exit_try_statement | exit_while_statement ; exit_do_statement : 'Exit' 'Do' ; exit_for_statement : 'Exit' 'For' ; exit_function_statement : 'Exit' 'Function' ; exit_operator_statement : 'Exit' 'Operator' ; exit_property_statement : 'Exit' 'Property' ; exit_select_statement : 'Exit' 'Select' ; exit_sub_statement : 'Exit' 'Sub' ; exit_try_statement : 'Exit' 'Try' ; exit_while_statement : 'Exit' 'While' ; expression_statement : expression ; for_or_for_each_block : for_block | for_each_block ; for_block : for_statement statement* next_statement? ; for_statement : 'For' (expression | variable_declarator) '=' expression 'To' expression for_step_clause? ; for_step_clause : 'Step' expression ; next_statement : 'Next' (expression (',' expression)*)? ; for_each_block : for_each_statement statement* next_statement? ; for_each_statement : 'For' 'Each' (expression | variable_declarator) 'In' expression ; go_to_statement : 'GoTo' label ; label : identifier_label | next_label | numeric_label ; identifier_label : identifier_token ; next_label : 'Next' ; numeric_label : integer_literal_token ; label_statement : identifier_token ':' | integer_literal_token ':' ; local_declaration_statement : modifier* variable_declarator (',' variable_declarator)* ; multi_line_if_block : if_statement statement* else_if_block* else_block? end_if_statement ; if_statement : 'If' expression 'Then'? ; else_if_block : else_if_statement statement* ; else_block : else_statement statement* ; on_error_go_to_statement : on_error_go_to_label_statement | on_error_go_to_minus_one_statement | on_error_go_to_zero_statement ; on_error_go_to_label_statement : 'On' 'Error' 'GoTo' '-'? next_label ; on_error_go_to_minus_one_statement : 'On' 'Error' 'GoTo' '-'? numeric_label ; on_error_go_to_zero_statement : 'On' 'Error' 'GoTo' '-'? identifier_label ; on_error_resume_next_statement : 'On' 'Error' 'Resume' 'Next' ; print_statement : '?' expression ; raise_event_statement : 'RaiseEvent' identifier_name argument_list? ; re_dim_statement : 'ReDim' 'Preserve'? (redim_clause (',' redim_clause)*)? ; redim_clause : expression argument_list ; resume_statement : resume_label_statement | resume_next_statement | resume_statement ; resume_label_statement : 'Resume' numeric_label? ; resume_next_statement : 'Resume' next_label? ; resume_statement : 'Resume' identifier_label? ; return_statement : 'Return' expression? ; select_block : select_statement case_block* end_select_statement ; select_statement : 'Select' 'Case'? expression ; case_block : case_block | case_else_block ; case_block : case_statement statement* ; case_else_block : case_statement statement* ; single_line_if_statement : 'If' expression 'Then' statement* single_line_else_clause? ; single_line_else_clause : 'Else' statement* ; stop_or_end_statement : end_statement | stop_statement ; end_statement : 'End' ; stop_statement : 'Stop' ; sync_lock_block : sync_lock_statement statement* end_sync_lock_statement ; sync_lock_statement : 'SyncLock' expression ; throw_statement : 'Throw' expression? ; try_block : try_statement statement* catch_block* finally_block? end_try_statement ; try_statement : 'Try' ; catch_block : catch_statement statement* ; finally_block : finally_statement statement* ; finally_statement : 'Finally' ; using_block : using_statement statement* end_using_statement ; using_statement : 'Using' expression? (variable_declarator (',' variable_declarator)*)? ; while_block : while_statement statement* end_while_statement ; while_statement : 'While' expression ; with_block : with_statement statement* end_with_statement ; with_statement : 'With' expression ; yield_statement : 'Yield' expression ; for_or_for_each_statement : for_each_statement | for_statement ; expression : aggregation | await_expression | binary_conditional_expression | binary_expression | cast_expression | collection_initializer | conditional_access_expression | event_container | get_type_expression | get_xml_namespace_expression | instance_expression | interpolated_string_expression | invocation_expression | label | lambda_expression | literal_expression | member_access_expression | mid_expression | name_of_expression | new_expression | parenthesized_expression | predefined_cast_expression | query_expression | ternary_conditional_expression | tuple_expression | type | type_of_expression | unary_expression | xml_member_access_expression | xml_node ; aggregation : function_aggregation | group_aggregation ; function_aggregation : identifier_token '('? expression? ')'? ; group_aggregation : 'Group' ; await_expression : 'Await' expression ; binary_conditional_expression : 'If' '(' expression ',' expression ')' ; binary_expression : add_expression | and_also_expression | and_expression | concatenate_expression | divide_expression | equals_expression | exclusive_or_expression | exponentiate_expression | greater_than_expression | greater_than_or_equal_expression | integer_divide_expression | is_expression | is_not_expression | left_shift_expression | less_than_expression | less_than_or_equal_expression | like_expression | modulo_expression | multiply_expression | not_equals_expression | or_else_expression | or_expression | right_shift_expression | subtract_expression ; add_expression : expression '+' expression ; and_also_expression : expression 'AndAlso' expression ; and_expression : expression 'And' expression ; concatenate_expression : expression '&' expression ; divide_expression : expression '/' expression ; equals_expression : expression '=' expression ; exclusive_or_expression : expression 'Xor' expression ; exponentiate_expression : expression '^' expression ; greater_than_expression : expression '>' expression ; greater_than_or_equal_expression : expression '>=' expression ; integer_divide_expression : expression '\\' expression ; is_expression : expression 'Is' expression ; is_not_expression : expression 'IsNot' expression ; left_shift_expression : expression '<<' expression ; less_than_expression : expression '<' expression ; less_than_or_equal_expression : expression '<=' expression ; like_expression : expression 'Like' expression ; modulo_expression : expression 'Mod' expression ; multiply_expression : expression '*' expression ; not_equals_expression : expression '<>' expression ; or_else_expression : expression 'OrElse' expression ; or_expression : expression 'Or' expression ; right_shift_expression : expression '>>' expression ; subtract_expression : expression '-' expression ; cast_expression : c_type_expression | direct_cast_expression | try_cast_expression ; c_type_expression : 'CType' '(' expression ',' type ')' ; direct_cast_expression : 'DirectCast' '(' expression ',' type ')' ; try_cast_expression : 'TryCast' '(' expression ',' type ')' ; conditional_access_expression : expression? '?' expression ; get_type_expression : 'GetType' '(' type ')' ; get_xml_namespace_expression : 'GetXmlNamespace' '(' xml_prefix_name? ')' ; xml_prefix_name : xml_name_token ; instance_expression : me_expression | my_base_expression | my_class_expression ; me_expression : 'Me' ; my_base_expression : 'MyBase' ; my_class_expression : 'MyClass' ; interpolated_string_expression : '$"' interpolated_string_content* '"' ; interpolated_string_content : interpolated_string_text | interpolation ; interpolated_string_text : interpolated_string_text_token ; interpolation : '{' expression interpolation_alignment_clause? interpolation_format_clause? '}' ; interpolation_alignment_clause : ',' expression ; interpolation_format_clause : ':' interpolated_string_text_token ; invocation_expression : expression? argument_list? ; lambda_expression : multi_line_lambda_expression | single_line_lambda_expression ; multi_line_lambda_expression : multi_line_function_lambda_expression | multi_line_sub_lambda_expression ; multi_line_function_lambda_expression : statement* end_sub_statement ; multi_line_sub_lambda_expression : statement* end_function_statement ; single_line_lambda_expression : lambda_header (expression | statement) ; member_access_expression : dictionary_access_expression | simple_member_access_expression ; dictionary_access_expression : expression? '!' generic_name ; simple_member_access_expression : expression? '.' identifier_name ; mid_expression : identifier_token argument_list ; name_of_expression : 'NameOf' '(' expression ')' ; parenthesized_expression : '(' expression ')' ; predefined_cast_expression : 'CBool' '(' expression ')' | 'CByte' '(' expression ')' | 'CChar' '(' expression ')' | 'CDate' '(' expression ')' | 'CDbl' '(' expression ')' | 'CDec' '(' expression ')' | 'CInt' '(' expression ')' | 'CLng' '(' expression ')' | 'CObj' '(' expression ')' | 'CSByte' '(' expression ')' | 'CShort' '(' expression ')' | 'CSng' '(' expression ')' | 'CStr' '(' expression ')' | 'CUInt' '(' expression ')' | 'CULng' '(' expression ')' | 'CUShort' '(' expression ')' ; query_expression : query_clause* ; query_clause : aggregate_clause | distinct_clause | from_clause | group_by_clause | join_clause | let_clause | order_by_clause | partition_clause | partition_while_clause | select_clause | where_clause ; aggregate_clause : 'Aggregate' collection_range_variable (',' collection_range_variable)* query_clause* 'Into' aggregation_range_variable (',' aggregation_range_variable)* ; collection_range_variable : modified_identifier simple_as_clause? 'In' expression ; aggregation_range_variable : variable_name_equals? aggregation ; variable_name_equals : modified_identifier simple_as_clause? '=' ; distinct_clause : 'Distinct' ; from_clause : 'From' collection_range_variable (',' collection_range_variable)* ; group_by_clause : 'Group' expression_range_variable (',' expression_range_variable)* 'By' expression_range_variable (',' expression_range_variable)* 'Into' aggregation_range_variable (',' aggregation_range_variable)* ; expression_range_variable : variable_name_equals? expression ; join_clause : group_join_clause | simple_join_clause ; group_join_clause : 'Group' 'Join' collection_range_variable (',' collection_range_variable)* join_clause* 'On' join_condition ('And' join_condition)* 'Into' aggregation_range_variable (',' aggregation_range_variable)* ; join_condition : expression 'Equals' expression ; simple_join_clause : 'Join' collection_range_variable (',' collection_range_variable)* join_clause* 'On' join_condition ('And' join_condition)* ; let_clause : 'Let' expression_range_variable (',' expression_range_variable)* ; order_by_clause : 'Order' 'By' ordering (',' ordering)* ; ordering : ascending_ordering | descending_ordering ; ascending_ordering : expression 'Ascending'? ; descending_ordering : expression 'Descending'? ; partition_clause : skip_clause | take_clause ; skip_clause : 'Skip' expression ; take_clause : 'Take' expression ; partition_while_clause : skip_while_clause | take_while_clause ; skip_while_clause : 'Skip' 'While' expression ; take_while_clause : 'Take' 'While' expression ; select_clause : 'Select' expression_range_variable (',' expression_range_variable)* ; where_clause : 'Where' expression ; ternary_conditional_expression : 'If' '(' expression ',' expression ',' expression ')' ; tuple_expression : '(' simple_argument (',' simple_argument)+ ')' ; type_of_expression : type_of_is_expression | type_of_is_not_expression ; type_of_is_expression : 'TypeOf' expression 'Is' type ; type_of_is_not_expression : 'TypeOf' expression 'IsNot' type ; unary_expression : address_of_expression | not_expression | unary_minus_expression | unary_plus_expression ; address_of_expression : 'AddressOf' expression ; not_expression : 'Not' expression ; unary_minus_expression : '-' expression ; unary_plus_expression : '+' expression ; xml_member_access_expression : expression? '.' ('.' | '@')? '.'? xml_node ; type : array_type | name | nullable_type | predefined_type | tuple_type ; array_type : type array_rank_specifier* ; nullable_type : type '?' ; predefined_type : 'Boolean' | 'Byte' | 'Char' | 'Date' | 'Decimal' | 'Double' | 'Integer' | 'Long' | 'Object' | 'SByte' | 'Short' | 'Single' | 'String' | 'UInteger' | 'ULong' | 'UShort' ; tuple_type : '(' tuple_element (',' tuple_element)+ ')' ; tuple_element : named_tuple_element | typed_tuple_element ; named_tuple_element : identifier_token simple_as_clause? ; typed_tuple_element : type ; name : cref_operator_reference | global_name | qualified_cref_operator_reference | qualified_name | simple_name ; cref_operator_reference : 'Operator' ('CType' | 'IsTrue' | 'IsFalse' | 'Not' | '+' | '-' | '*' | '/' | '^' | '\\' | '&' | '<<' | '>>' | 'Mod' | 'Or' | 'Xor' | 'And' | 'Like' | '=' | '<>' | '<' | '<=' | '>=' | '>') ; global_name : 'Global' ; qualified_cref_operator_reference : name '.' cref_operator_reference ; xml_node : base_xml_attribute | xml_bracketed_name | xml_c_data_section | xml_comment | xml_document | xml_element | xml_element_end_tag | xml_element_start_tag | xml_embedded_expression | xml_empty_element | xml_name | xml_prefix_name | xml_processing_instruction | xml_string | xml_text ; base_xml_attribute : xml_attribute | xml_cref_attribute | xml_name_attribute ; xml_cref_attribute : xml_name '=' ('"' | '\'') cref_reference ('"' | '\'') ; xml_name : xml_prefix? xml_name_token ; xml_prefix : xml_name_token ':' ; cref_reference : type cref_signature? simple_as_clause? ; cref_signature : '(' (cref_signature_part (',' cref_signature_part)*)? ')' ; cref_signature_part : 'ByRef'? type? | 'ByVal'? type? ; xml_name_attribute : xml_name '=' ('"' | '\'') identifier_name ('"' | '\'') ; xml_bracketed_name : '<' xml_name '>' ; xml_c_data_section : '<![CDATA[' xml_text_token* ']]>' ; xml_comment : '<!--' xml_text_token* '-->' ; xml_document : xml_declaration xml_node* xml_node xml_node* ; xml_declaration : '<?' 'xml' xml_declaration_option xml_declaration_option? xml_declaration_option? '?>' ; xml_declaration_option : xml_name_token '=' xml_string ; xml_string : '"' (xml_text_token)* ('"' | '\'') | '\'' (xml_text_token)* ('"' | '\'') ; xml_element : xml_element_start_tag xml_node* xml_element_end_tag ; xml_element_start_tag : '<' xml_node xml_node* '>' ; xml_element_end_tag : '</' xml_name? '>' ; xml_embedded_expression : '<%=' expression '%>' ; xml_empty_element : '<' xml_node xml_node* '/>' ; xml_processing_instruction : '<?' xml_name_token xml_text_token* '?>' ; xml_text : xml_text_token* ; structured_trivia : directive_trivia | documentation_comment_trivia | skipped_tokens_trivia ; directive_trivia : bad_directive_trivia | const_directive_trivia | disable_warning_directive_trivia | else_directive_trivia | enable_warning_directive_trivia | end_external_source_directive_trivia | end_if_directive_trivia | end_region_directive_trivia | external_checksum_directive_trivia | external_source_directive_trivia | if_directive_trivia | reference_directive_trivia | region_directive_trivia ; bad_directive_trivia : '#' ; const_directive_trivia : '#' 'Const' identifier_token '=' expression ; disable_warning_directive_trivia : '#' 'Disable' 'Warning' (identifier_name (',' identifier_name)*)? ; else_directive_trivia : '#' 'Else' ; enable_warning_directive_trivia : '#' 'Enable' 'Warning' (identifier_name (',' identifier_name)*)? ; end_external_source_directive_trivia : '#' 'End' 'ExternalSource' ; end_if_directive_trivia : '#' 'End' 'If' ; end_region_directive_trivia : '#' 'End' 'Region' ; external_checksum_directive_trivia : '#' 'ExternalChecksum' '(' string_literal_token ',' string_literal_token ',' string_literal_token ')' ; external_source_directive_trivia : '#' 'ExternalSource' '(' string_literal_token ',' integer_literal_token ')' ; if_directive_trivia : else_if_directive_trivia | if_directive_trivia ; else_if_directive_trivia : 'Else'? 'ElseIf' expression 'Then'? ; if_directive_trivia : 'Else'? 'If' expression 'Then'? ; reference_directive_trivia : '#' 'R' string_literal_token ; region_directive_trivia : '#' 'Region' string_literal_token ; documentation_comment_trivia : xml_node* ; skipped_tokens_trivia : syntax_token* ; modifier : 'Async' | 'Const' | 'Default' | 'Dim' | 'Friend' | 'Iterator' | 'MustInherit' | 'MustOverride' | 'Narrowing' | 'NotInheritable' | 'NotOverridable' | 'Overloads' | 'Overridable' | 'Overrides' | 'Partial' | 'Private' | 'Protected' | 'Public' | 'ReadOnly' | 'Shadows' | 'Shared' | 'Static' | 'Widening' | 'WithEvents' | 'WriteOnly' ; syntax_token : character_literal_token | date_literal_token | decimal_literal_token | floating_literal_token | identifier_token | integer_literal_token | interpolated_string_text_token | keyword | punctuation | string_literal_token | xml_name_token | xml_text_token ; punctuation : /* see lexical specification */ ; empty_token : /* see lexical specification */ ; character_literal_token : /* see lexical specification */ ; date_literal_token : /* see lexical specification */ ; decimal_literal_token : /* see lexical specification */ ; floating_literal_token : /* see lexical specification */ ; identifier_token : /* see lexical specification */ ; integer_literal_token : /* see lexical specification */ ; interpolated_string_text_token : /* see lexical specification */ ; keyword : /* see lexical specification */ ; string_literal_token : /* see lexical specification */ ; syntax_trivia : /* see lexical specification */ ; xml_name_token : /* see lexical specification */ ; xml_text_token : /* see lexical specification */ ;
src/utils/string.asm
Quatroctus/Startaste
1
102493
<gh_stars>1-10 ; String routines for Protected Mode ; ============================================ ; ; Get Row Routine ; Arguments: bl: Row ; Outputs: si: Pointer to Row String ; ============================================ ; string_get_row: pusha mov si, STRING_ROW_STRING mov eax, COLUMNS mul bl ; row * columns mov bx, 2 ; multiply everything by 2 because every character takes 2 bytes. mul bx add eax, VID_MEM+2 ; add the video memory address and a character (because the command message is 1 character) mov bx, 80 .repeat: mov cl, [eax] mov [si], cl add eax, 2 inc si dec bx cmp bx, 0 je .done jmp .repeat .done: mov [si], byte 0 popa mov si, STRING_ROW_STRING ret ; ============================================ ; ; Get String Length Routine ; Arguments: si: Location of stirng. ; Ouputs: bx: length of string. ; ============================================ ; string_length: push si mov bx, 0 ; set default string length to 0, then count up .find: lodsb inc bx ; increase string length var by 1 or al, al ; check if the end of the string. jnz .find .done: dec bx ; the actual length is one more since we compare the character after we increase bx. pop si ret ; ============================================ ; ; Strip String Routine ; Arguments: si: Location of string, cl: character to be stripped. ; Ouputs: si: Stripped string ; ============================================ ; string_strip: pusha ; get the length of the string, so we can work with the string from back to front, removing trailing characters first. call string_length ; WORKS: the resulting number is 79 for every command line entry. mov dx, si ; put si into cx, this is a number value, so it can be compared (resulting in the beginning of the string). add si, bx ; add bx (the string length, to si) this moves the address to the end of the string. dec si ; subtract one more from the string, as the length is 1 more than the index of the string. .repeat: mov al, [si] ; same as lodsb, moves char at si to al and doesn't increase si, since we will decrease it later. cmp al, cl ; if the character is the same as the character to be stripped, then overwrite it to BYTE 0 jne .done ; if not, then finish mov [si], BYTE 0 dec si ; move si down one, this goes backwards in the string. cmp si, dx ; if si is at the beginning of the string, then finish. je .done jmp .repeat ; otherwise, repeat what just happened. .done: popa ret ; ============================================ ; ; Compare Strings Routine ; Arguments: si: Location of string, di: location of second string. ; Ouputs: ax: true/false, 1/0, of if strings match. ; ============================================ ; string_compare: push si push bx push dx mov ax, 1 .repeat: mov bl, [si] mov dl, [di] cmp bl, dl jne .done_false or bl, dl jz .done inc si inc di jmp .repeat .done_false: mov ax, 0 .done: pop dx pop bx pop si ret ; ============================================ ; ; Strip String Routine ; Arguments: si: Location of String ; Ouputs: si: Location of String ; ============================================ ; string_lowercase: pusha .repeat: lodsb ; load a character into al cmp al, 0 ; if it's a null, it's the end of the string. je .done cmp al, 0x41 ; if the character is less than 'A' then loop again jl .repeat cmp al, 0x5A ; if the character is greater than 'Z' then loop again jg .repeat add al, 0x20 ; otherwise, add 0x20 to lowercase the character mov [si-1], al ; move al back into [si] jmp .repeat ; and repeat .done: popa ret STRING_ROW_STRING times COLUMNS+1 db 0
src/evil-util-files.adb
OneWingedShark/EVIL
2
12822
Pragma Ada_2012; Pragma Assertion_Policy( Check ); Package Body EVIL.Util.Files with SPARK_Mode => On is -------------- -- GENERICS -- -------------- Generic with Procedure Init_File( File : in out File_Type; Mode : File_Mode; Name : String := Empty_String; Form : String := Empty_String ); Function Generic_Make( Name : String; Mode : File_Mode ) return File; Function Generic_Make( Name : String; Mode : File_Mode ) return File is Use Ada.Finalization; Begin Return Result : File := (Limited_Controlled with Others => <>) do Init_File( File => Result.Data, Mode => Mode, Name => Name ); Result.FSA:= Stream(Result.Data); End return; End; Generic Type Return_Type(<>) is private; with Function Op( File : File_Type ) return Return_Type; Function Generic_Function( Object : File ) return Return_Type with Inline; Function Generic_Function( Object : File ) return Return_Type is ( Op(Object.Data) ); Generic with Procedure Op( File : in out File_Type ); Procedure Generic_FileOp( Object : in out File ) with Inline; Procedure Generic_FileOp( Object : in out File ) is Begin Op( Object.Data ); End Generic_FileOp; -------------------- -- INSTANTIATIONS -- -------------------- Function Create_File is new Generic_Make( Init_File => Create ); Function Open_File is new Generic_Make( Init_File => Open ); Function Get_Mode is new Generic_Function( File_Mode, Mode ); Function Get_Name is new Generic_Function( String, Name ); Function Get_Form is new Generic_Function( String, Form ); Function Get_Open is new Generic_Function( Boolean, Is_Open ); Procedure Do_Close is new Generic_FileOp ( Close ); Procedure Do_Delete is new Generic_FileOp ( Delete ); Procedure Do_Reset is new Generic_FileOp ( Reset ); ------------- -- RENAMES -- ------------- Function Create( Name : String; Mode : File_Mode ) return File renames Create_File; Function Open( Name : String; Mode : File_Mode ) return File renames Open_File; Function Mode ( Object : File ) return File_Mode renames Get_Mode; Function Name ( Object : File ) return String renames Get_Name; Function Form ( Object : File ) return String renames Get_Form; Function Open ( Object : File ) return Boolean renames Get_Open; Procedure Close (Object : in out File) renames Do_Close; Procedure Delete (Object : in out File) renames Do_Delete; Procedure Reset (Object : in out File) renames Do_Reset; ------------------ -- FINALIZATION -- ------------------ Procedure Finalize (Object : in out File) is Begin Close( Object.Data ); End Finalize; ----------------- -- non-renames -- ----------------- Procedure Reset (Object : in out File; Mode : File_Mode) is Begin Reset(File => Object.Data, Mode => Mode); End Reset; End EVIL.Util.Files;
src/text_file_scroller.ads
zenharris/ada-bbs
2
15339
procedure Text_File_Scroller (FileName : String);
Safari/Count Windows and Tabs.applescript
larryv/applescripts
7
3269
#!/usr/bin/osascript (* * Count Safari Windows and Tabs * * Counts Safari's visible/minimized windows and tabs and displays the * results. * * Last updated 2021-05-28. * * Copyright 2018, 2021 <NAME> * SPDX-License-Identifier: MIT *) property name : "Count Safari Windows and Tabs" tell application id "com.apple.Safari" set _windows to a reference to ¬ every window where it is visible or it is miniaturized set _windowCount to count _windows set _tabCount to count every tab of _windows end tell set _alertText to (_windowCount as string) & " window" if _windowCount is not 1 then set _alertText to _alertText & "s" set _alertText to _alertText & ", " & (_tabCount as string) & " tab" if _tabCount is not 1 then set _alertText to _alertText & "s" if id of current application is "at.obdev.LaunchBar" then using terms from application id "at.obdev.LaunchBar" display in large type _alertText with title (my name) end using terms from else display alert (my name) message _alertText end if
source/containers/a-cgaaty.ads
ytomino/drake
33
23082
pragma License (Unrestricted); -- extended unit generic type Index_Type is range <>; type Element_Type is private; type Array_Type is array (Index_Type range <>) of Element_Type; type Array_Access is access Array_Type; with procedure Free (X : in out Array_Access) is <>; package Ada.Containers.Generic_Array_Access_Types is -- Ada.Containers.Vectors-like utilities for access-to-array types. pragma Preelaborate; subtype Extended_Index is Index_Type'Base range Index_Type'Base'Pred (Index_Type'First) .. Index_Type'Last; function Length (Container : Array_Access) return Count_Type; procedure Set_Length ( Container : in out Array_Access; Length : Count_Type); procedure Clear (Container : in out Array_Access) renames Free; procedure Assign (Target : in out Array_Access; Source : Array_Access); procedure Move ( Target : in out Array_Access; Source : in out Array_Access); procedure Insert ( Container : in out Array_Access; Before : Extended_Index; New_Item : Array_Type); procedure Insert ( Container : in out Array_Access; Before : Extended_Index; New_Item : Array_Access); procedure Insert ( Container : in out Array_Access; Before : Extended_Index; New_Item : Element_Type; Count : Count_Type := 1); procedure Insert ( Container : in out Array_Access; Before : Extended_Index; Count : Count_Type := 1); procedure Prepend ( Container : in out Array_Access; New_Item : Array_Type); procedure Prepend ( Container : in out Array_Access; New_Item : Array_Access); procedure Prepend ( Container : in out Array_Access; New_Item : Element_Type; Count : Count_Type := 1); procedure Prepend ( Container : in out Array_Access; Count : Count_Type := 1); procedure Append ( Container : in out Array_Access; New_Item : Array_Type); procedure Append ( Container : in out Array_Access; New_Item : Array_Access); procedure Append ( Container : in out Array_Access; New_Item : Element_Type; Count : Count_Type := 1); procedure Append ( Container : in out Array_Access; Count : Count_Type := 1); procedure Delete ( Container : in out Array_Access; Index : Extended_Index; Count : Count_Type := 1); procedure Delete_First ( Container : in out Array_Access; Count : Count_Type := 1); procedure Delete_Last ( Container : in out Array_Access; Count : Count_Type := 1); procedure Swap (Container : in out Array_Access; I, J : Index_Type); function First_Index (Container : Array_Access) return Index_Type; function Last_Index (Container : Array_Access) return Extended_Index; generic with procedure Swap ( Container : in out Array_Access; I, J : Index_Type) is Generic_Array_Access_Types.Swap; package Generic_Reversing is procedure Reverse_Elements (Container : in out Array_Access); procedure Reverse_Rotate_Elements ( Container : in out Array_Access; Before : Extended_Index); procedure Juggling_Rotate_Elements ( Container : in out Array_Access; Before : Extended_Index); procedure Rotate_Elements ( Container : in out Array_Access; Before : Extended_Index) renames Juggling_Rotate_Elements; end Generic_Reversing; generic with function "<" (Left, Right : Element_Type) return Boolean is <>; with procedure Swap ( Container : in out Array_Access; I, J : Index_Type) is Generic_Array_Access_Types.Swap; package Generic_Sorting is function Is_Sorted (Container : Array_Access) return Boolean; procedure Insertion_Sort (Container : in out Array_Access); procedure Merge_Sort (Container : in out Array_Access); procedure Sort (Container : in out Array_Access) renames Merge_Sort; procedure Merge ( Target : in out Array_Access; Source : in out Array_Access); end Generic_Sorting; -- Allocating concatenation operators type New_Array (<>) is limited private; procedure Assign (Target : in out Array_Access; Source : New_Array); generic package Operators is type New_Array_1 (<>) is limited private; type New_Array_2 (<>) is limited private; function "&" (Left : Array_Access; Right : Element_Type) return New_Array; function "&" (Left : New_Array_1; Right : Element_Type) return New_Array; function "&" (Left : Array_Access; Right : Element_Type) return New_Array_1; function "&" (Left : New_Array_2; Right : Element_Type) return New_Array_1; function "&" (Left : Array_Access; Right : Element_Type) return New_Array_2; private type New_Array_1 is record Data : Array_Access; Last : Extended_Index; end record; pragma Suppress_Initialization (New_Array_1); type New_Array_2 is new New_Array_1; end Operators; private type New_Array is new Array_Access; end Ada.Containers.Generic_Array_Access_Types;
tools/ayacc/src/symbol_info.ads
svn2github/matreshka
24
13176
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- The primary authors of ayacc were <NAME> and <NAME>. -- Enhancements were made by <NAME>. -- -- Send requests for ayacc information to <EMAIL> -- Send bug reports for ayacc to <EMAIL> -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- Module : symbol_info.ada -- Component of : ayacc -- Version : 1.2 -- Date : 11/21/86 12:37:08 -- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxsymbol_info.ada -- $Header: symbol_info.a,v 0.1 86/04/01 15:13:15 ada Exp $ -- $Log: symbol_info.a,v $ -- Revision 0.1 86/04/01 15:13:15 ada -- This version fixes some minor bugs with empty grammars -- and $$ expansion. It also uses vads5.1b enhancements -- such as pragma inline. -- -- -- Revision 0.0 86/02/19 18:42:36 ada -- -- These files comprise the initial version of Ayacc -- designed and implemented by <NAME> and <NAME>. -- Ayacc has been compiled and tested under the Verdix Ada compiler -- version 4.06 on a vax 11/750 running Unix 4.2BSD. -- with Symbol_Table, Rule_Table; use Symbol_Table, Rule_Table; package Symbol_Info is -- -- The following array declarations are used to compute the -- the rules that have a particular symbol on the left hand -- side. NONTERMINAL_YIELD contains the rules and -- NONTERMINAL_YIELD_OFFSET contains the offset into the first array -- indexed by a particular nonterminal. The user of this package -- should not attempt to alter the contents of these arrays. They -- are visible in the spec only for efficiency reasons. -- type Yield_Index is new Integer; type Rule_Array is array (Yield_Index range <>) of Rule; type Offset_Array is array (Grammar_Symbol range <>) of Yield_Index; type Rule_Array_Pointer is access Rule_Array; type Offset_Array_Pointer is access Offset_Array; Nonterminal_Yield : Rule_Array_Pointer; Nonterminal_Yield_Index : Offset_Array_Pointer; --- procedure Initialize; function Is_Nullable(Sym: Grammar_Symbol) return Boolean; Undefined_Nonterminal : exception; -- raised if a nonterminal doesn't appear on left hand side of -- any rule. --RJS pragma inline(is_nullable); end Symbol_Info;
src/test/resources/framework_specifications/TestRunResultsParser.g4
google/polymorphicDSL
3
1924
<reponame>google/polymorphicDSL<gh_stars>1-10 parser grammar TestRunResultsParser ; import GherkinCommonParser; options { tokenVocab=TestRunResultsLexer ; } givenAnotherTestResource : GIVEN_ANOTHER_TEST_RESOURCE docstring ; thenTestCaseCollectionHasSpecifiedTestCases : THEN_TEST_TEST_CASE_COLLECTION_HAS_N_TEST_CASES_START integerValue THEN_TEST_TEST_CASE_COLLECTION_HAS_N_TEST_CASES_END ; convertTestResourcesToCollectionWithSingleTestCase : WHEN_THE_TEST_RESOURCE_IS_CONVERTED_TO_A_SINGLE_TEST_CASE_BY_SOME_METHOD ; givenTheSpecifiedGrammarParseTreeListener : GIVEN_THE_GRAMMAR_PARSE_TREE_LISTENER textInDoubleQuotesEnd ; thenSingleTestCaseIsProduced: THEN_A_SINGLE_TEST_CASE_IS_PRODUCED ; thenTheTestRunResultHasSpecifiedFilteredDuplicateTests : THEN_THE_TEST_RUN_RESULT_HAS integerValue FILTERED_DUPLICATE_TESTS_END ; thenTheTestRunResultHasSpecifiedPassingPhrases : THEN_THE_TEST_RUN_RESULT_HAS integerValue PASSING_PHRASES_END ; thenTheTestRunResultHasSpecifiedTotalPhrases : THEN_THE_TEST_RUN_RESULT_HAS integerValue TOTAL_PHRASES_END ; whenTheTestMetadataIsRetrievedFromTheTestRunResult :WHEN_THE_TEST_METADATA_IS_RETRIEVED_FROM_THE_TEST_RUN_RESULT ; whenTheOnlyTestMetadataItemIsExamined : WHEN_THE_ONLY_TEST_METADATA_ITEM_IS_EXAMINED ; thenTheTestMetadataHasAnExceptionExplainingWhyTheTestFailed : THEN_THE_TEST_METADATA_HAS_AN_EXCEPTION_EXPLAINING_WHY_THE_TEST_FAILED ; thenTheTestMetadataHasThePhraseThatFailed : THEN_THE_TEST_METADATA_HAS_THE_PHRASE_THAT_FAILED ; thenTheTestMetadataFailingPhraseIsSpecifiedText : THEN_THE_TEST_METADATA_FAILING_PHRASE_IS textInDoubleQuotesEnd ; thenTheTestMetadataHasOneItemInIt : THEN_THE_TEST_METADATA_HAS_ONE_ITEM_IN_IT ; integerValue : INTEGER_VALUE ;
test/Fail/LetPair.agda
cruhland/agda
1,989
11014
<filename>test/Fail/LetPair.agda -- Andreas, 2012-06-05 let for record patterns -- {-# OPTIONS --show-implicit #-} -- {-# OPTIONS -v tc.term.let.pattern:100 #-} -- {-# OPTIONS -v tc.lhs.top:100 #-} module LetPair where import Common.Level -- open import Common.Equality data _×_ (A B : Set) : Set where _,_ : (fst : A)(snd : B) → A × B swap : {A B : Set} → A × B → B × A swap p = let (a , b) = p -- works only for record patterns in (b , a)
libs/qmlglsink/gst-plugins-good/gst/deinterlace/tvtime/greedyh.asm
ant-nihil/routen-qgroundcontrol
6
176464
<gh_stars>1-10 /* * * GStreamer * Copyright (c) 2001 <NAME>. All rights reserved. * Copyright (C) 2008,2010 <NAME> <<EMAIL>> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License aglong with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ /* * Relicensed for GStreamer from GPL to LGPL with permit from <NAME>. * See: http://bugzilla.gnome.org/show_bug.cgi?id=163578 */ #include "x86-64_macros.inc" static void FUNCT_NAME_YUY2 (GstDeinterlaceMethodGreedyH *self, const guint8 * L1, const guint8 * L2, const guint8 * L3, const guint8 * L2P, guint8 * Dest, gint width) { // in tight loop some vars are accessed faster in local storage gint64 YMask = 0x00ff00ff00ff00ffull; // to keep only luma gint64 UVMask = 0xff00ff00ff00ff00ull; // to keep only chroma gint64 ShiftMask = 0xfefefefefefefefeull; // to avoid shifting chroma to luma gint64 QW256 = 0x0100010001000100ull; // 4 256's gint64 MaxComb; gint64 MotionThreshold; gint64 MotionSense; gint64 i; glong LoopCtr; glong oldbx = 0; gint64 QW256B; gint64 LastAvg = 0; //interp value from left qword // FIXME: Use C implementation if the width is not a multiple of 4 // Do something more optimal later if (width % 4 != 0) C_FUNCT_YUY2 (self, L1, L2, L3, L2P, Dest, width); // Set up our two parms that are actually evaluated for each pixel i = self->max_comb; MaxComb = i << 56 | i << 48 | i << 40 | i << 32 | i << 24 | i << 16 | i << 8 | i; i = self->motion_threshold; // scale to range of 0-257 MotionThreshold = i << 48 | i << 32 | i << 16 | i | UVMask; i = self->motion_sense; // scale to range of 0-257 MotionSense = i << 48 | i << 32 | i << 16 | i; i = 0xffffffff - 256; QW256B = i << 48 | i << 32 | i << 16 | i; // save a couple instr on PMINSW instruct. LoopCtr = width / 8 - 1; // there are LineLength / 4 qwords per line but do 1 less, adj at end of loop // For ease of reading, the comments below assume that we're operating on an odd // field (i.e., that InfoIsOdd is true). Assume the obvious for even lines.. __asm__ __volatile__ ( // save ebx (-fPIC) MOVX " %%" XBX ", %[oldbx]\n\t" MOVX " %[L1], %%" XAX "\n\t" LEAX " 8(%%" XAX "), %%" XBX "\n\t" // next qword needed by DJR MOVX " %[L3], %%" XCX "\n\t" SUBX " %%" XAX ", %%" XCX "\n\t" // carry L3 addr as an offset MOVX " %[L2P], %%" XDX "\n\t" MOVX " %[L2], %%" XSI "\n\t" MOVX " %[Dest], %%" XDI "\n\t" // DL1 if Odd or DL2 if Even ".align 8\n\t" "1:\n\t" "movq (%%" XSI "), %%mm0\n\t" // L2 - the newest weave pixel value "movq (%%" XAX "), %%mm1\n\t" // L1 - the top pixel "movq (%%" XDX "), %%mm2\n\t" // L2P - the prev weave pixel "movq (%%" XAX ", %%" XCX "), %%mm3\n\t" // L3, next odd row "movq %%mm1, %%mm6\n\t" // L1 - get simple single pixel interp // pavgb mm6, mm3 // use macro below V_PAVGB ("%%mm6", "%%mm3", "%%mm4", "%[ShiftMask]") // DJR - Diagonal Jaggie Reduction // In the event that we are going to use an average (Bob) pixel we do not want a jagged // stair step effect. To combat this we avg in the 2 horizontally adjacen pixels into the // interpolated Bob mix. This will do horizontal smoothing for only the Bob'd pixels. "movq %[LastAvg], %%mm4\n\t" // the bob value from prev qword in row "movq %%mm6, %[LastAvg]\n\t" // save for next pass "psrlq $48, %%mm4\n\t" // right justify 1 pixel "movq %%mm6, %%mm7\n\t" // copy of simple bob pixel "psllq $16, %%mm7\n\t" // left justify 3 pixels "por %%mm7, %%mm4\n\t" // and combine "movq (%%" XBX "), %%mm5\n\t" // next horiz qword from L1 // pavgb mm5, qword ptr[ebx+ecx] // next horiz qword from L3, use macro below V_PAVGB ("%%mm5", "(%%" XBX ",%%" XCX ")", "%%mm7", "%[ShiftMask]") "psllq $48, %%mm5\n\t" // left just 1 pixel "movq %%mm6, %%mm7\n\t" // another copy of simple bob pixel "psrlq $16, %%mm7\n\t" // right just 3 pixels "por %%mm7, %%mm5\n\t" // combine // pavgb mm4, mm5 // avg of forward and prev by 1 pixel, use macro V_PAVGB ("%%mm4", "%%mm5", "%%mm5", "%[ShiftMask]") // mm5 gets modified if MMX // pavgb mm6, mm4 // avg of center and surround interp vals, use macro V_PAVGB ("%%mm6", "%%mm4", "%%mm7", "%[ShiftMask]") // Don't do any more averaging than needed for mmx. It hurts performance and causes rounding errors. #ifndef IS_MMX // pavgb mm4, mm6 // 1/4 center, 3/4 adjacent V_PAVGB ("%%mm4", "%%mm6", "%%mm7", "%[ShiftMask]") // pavgb mm6, mm4 // 3/8 center, 5/8 adjacent V_PAVGB ("%%mm6", "%%mm4", "%%mm7", "%[ShiftMask]") #endif // get abs value of possible L2 comb "movq %%mm6, %%mm4\n\t" // work copy of interp val "movq %%mm2, %%mm7\n\t" // L2 "psubusb %%mm4, %%mm7\n\t" // L2 - avg "movq %%mm4, %%mm5\n\t" // avg "psubusb %%mm2, %%mm5\n\t" // avg - L2 "por %%mm7, %%mm5\n\t" // abs(avg-L2) // get abs value of possible L2P comb "movq %%mm0, %%mm7\n\t" // L2P "psubusb %%mm4, %%mm7\n\t" // L2P - avg "psubusb %%mm0, %%mm4\n\t" // avg - L2P "por %%mm7, %%mm4\n\t" // abs(avg-L2P) // use L2 or L2P depending upon which makes smaller comb "psubusb %%mm5, %%mm4\n\t" // see if it goes to zero "psubusb %%mm5, %%mm5\n\t" // 0 "pcmpeqb %%mm5, %%mm4\n\t" // if (mm4=0) then FF else 0 "pcmpeqb %%mm4, %%mm5\n\t" // opposite of mm4 // if Comb(L2P) <= Comb(L2) then mm4=ff, mm5=0 else mm4=0, mm5 = 55 "pand %%mm2, %%mm5\n\t" // use L2 if mm5 == ff, else 0 "pand %%mm0, %%mm4\n\t" // use L2P if mm4 = ff, else 0 "por %%mm5, %%mm4\n\t" // may the best win // Inventory: at this point we have the following values: // mm0 = L2P (or L2) // mm1 = L1 // mm2 = L2 (or L2P) // mm3 = L3 // mm4 = the best of L2,L2P weave pixel, base upon comb // mm6 = the avg interpolated value, if we need to use it // Let's measure movement, as how much the weave pixel has changed "movq %%mm2, %%mm7\n\t" "psubusb %%mm0, %%mm2\n\t" "psubusb %%mm7, %%mm0\n\t" "por %%mm2, %%mm0\n\t" // abs value of change, used later // Now lets clip our chosen value to be not outside of the range // of the high/low range L1-L3 by more than MaxComb. // This allows some comb but limits the damages and also allows more // detail than a boring oversmoothed clip. "movq %%mm1, %%mm2\n\t" // copy L1 // pmaxub mm2, mm3 // use macro V_PMAXUB ("%%mm2", "%%mm3") // now = Max(L1,L3) "movq %%mm1, %%mm5\n\t" // copy L1 // pminub mm5, mm3 // now = Min(L1,L3), use macro V_PMINUB ("%%mm5", "%%mm3", "%%mm7") // allow the value to be above the high or below the low by amt of MaxComb "psubusb %[MaxComb], %%mm5\n\t" // lower min by diff "paddusb %[MaxComb], %%mm2\n\t" // increase max by diff // pmaxub mm4, mm5 // now = Max(best,Min(L1,L3) use macro V_PMAXUB ("%%mm4", "%%mm5") // pminub mm4, mm2 // now = Min( Max(best, Min(L1,L3), L2 )=L2 clipped V_PMINUB ("%%mm4", "%%mm2", "%%mm7") // Blend weave pixel with bob pixel, depending on motion val in mm0 "psubusb %[MotionThreshold], %%mm0\n\t" // test Threshold, clear chroma change "pmullw %[MotionSense], %%mm0\n\t" // mul by user factor, keep low 16 bits "movq %[QW256], %%mm7\n\t" #ifdef IS_MMXEXT "pminsw %%mm7, %%mm0\n\t" // max = 256 #else "paddusw %[QW256B], %%mm0\n\t" // add, may sat at fff.. "psubusw %[QW256B], %%mm0\n\t" // now = Min(L1,256) #endif "psubusw %%mm0, %%mm7\n\t" // so the 2 sum to 256, weighted avg "movq %%mm4, %%mm2\n\t" // save weave chroma info before trashing "pand %[YMask], %%mm4\n\t" // keep only luma from calc'd value "pmullw %%mm7, %%mm4\n\t" // use more weave for less motion "pand %[YMask], %%mm6\n\t" // keep only luma from calc'd value "pmullw %%mm0, %%mm6\n\t" // use more bob for large motion "paddusw %%mm6, %%mm4\n\t" // combine "psrlw $8, %%mm4\n\t" // div by 256 to get weighted avg // chroma comes from weave pixel "pand %[UVMask], %%mm2\n\t" // keep chroma "por %%mm4, %%mm2\n\t" // and combine V_MOVNTQ ("(%%" XDI ")", "%%mm2") // move in our clipped best, use macro // bump ptrs and loop LEAX " 8(%%" XAX "), %%" XAX "\n\t" LEAX " 8(%%" XBX "), %%" XBX "\n\t" LEAX " 8(%%" XDX "), %%" XDX "\n\t" LEAX " 8(%%" XDI "), %%" XDI "\n\t" LEAX " 8(%%" XSI "), %%" XSI "\n\t" DECX " %[LoopCtr]\n\t" "jg 1b\n\t" // loop if not to last line // note P-III default assumes backward branches taken "jl 1f\n\t" // done MOVX " %%" XAX ", %%" XBX "\n\t" // sharpness lookahead 1 byte only, be wrong on 1 "jmp 1b\n\t" "1:\n\t" MOVX " %[oldbx], %%" XBX "\n\t" "emms\n\t": /* no outputs */ :[LastAvg] "m" (LastAvg), [L1] "m" (L1), [L3] "m" (L3), [L2P] "m" (L2P), [L2] "m" (L2), [Dest] "m" (Dest), [ShiftMask] "m" (ShiftMask), [MaxComb] "m" (MaxComb), [MotionThreshold] "m" (MotionThreshold), [MotionSense] "m" (MotionSense), [QW256B] "m" (QW256B), [YMask] "m" (YMask), [UVMask] "m" (UVMask), [LoopCtr] "m" (LoopCtr), [QW256] "m" (QW256), [oldbx] "m" (oldbx) : XAX, XCX, XDX, XSI, XDI, "st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)", #ifdef __MMX__ "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7", #endif "memory", "cc"); } static void FUNCT_NAME_UYVY (GstDeinterlaceMethodGreedyH *self, const guint8 * L1, const guint8 * L2, const guint8 * L3, const guint8 * L2P, guint8 * Dest, gint width) { // in tight loop some vars are accessed faster in local storage gint64 YMask = 0xff00ff00ff00ff00ull; // to keep only luma gint64 UVMask = 0x00ff00ff00ff00ffull; // to keep only chroma gint64 ShiftMask = 0xfefefefefefefefeull; // to avoid shifting chroma to luma gint64 QW256 = 0x0100010001000100ull; // 4 256's gint64 MaxComb; gint64 MotionThreshold; gint64 MotionSense; gint64 i; glong LoopCtr; glong oldbx = 0; gint64 QW256B; gint64 LastAvg = 0; //interp value from left qword // FIXME: Use C implementation if the width is not a multiple of 4 // Do something more optimal later if (width % 4 != 0) C_FUNCT_UYVY (self, L1, L2, L3, L2P, Dest, width); // Set up our two parms that are actually evaluated for each pixel i = self->max_comb; MaxComb = i << 56 | i << 48 | i << 40 | i << 32 | i << 24 | i << 16 | i << 8 | i; i = self->motion_threshold; // scale to range of 0-257 MotionThreshold = i << 48 | i << 32 | i << 16 | i | UVMask; i = self->motion_sense; // scale to range of 0-257 MotionSense = i << 48 | i << 32 | i << 16 | i; i = 0xffffffff - 256; QW256B = i << 48 | i << 32 | i << 16 | i; // save a couple instr on PMINSW instruct. LoopCtr = width / 8 - 1; // there are LineLength / 4 qwords per line but do 1 less, adj at end of loop // For ease of reading, the comments below assume that we're operating on an odd // field (i.e., that InfoIsOdd is true). Assume the obvious for even lines.. __asm__ __volatile__ ( // save ebx (-fPIC) MOVX " %%" XBX ", %[oldbx]\n\t" MOVX " %[L1], %%" XAX "\n\t" LEAX " 8(%%" XAX "), %%" XBX "\n\t" // next qword needed by DJR MOVX " %[L3], %%" XCX "\n\t" SUBX " %%" XAX ", %%" XCX "\n\t" // carry L3 addr as an offset MOVX " %[L2P], %%" XDX "\n\t" MOVX " %[L2], %%" XSI "\n\t" MOVX " %[Dest], %%" XDI "\n\t" // DL1 if Odd or DL2 if Even ".align 8\n\t" "1:\n\t" "movq (%%" XSI "), %%mm0\n\t" // L2 - the newest weave pixel value "movq (%%" XAX "), %%mm1\n\t" // L1 - the top pixel "movq (%%" XDX "), %%mm2\n\t" // L2P - the prev weave pixel "movq (%%" XAX ", %%" XCX "), %%mm3\n\t" // L3, next odd row "movq %%mm1, %%mm6\n\t" // L1 - get simple single pixel interp // pavgb mm6, mm3 // use macro below V_PAVGB ("%%mm6", "%%mm3", "%%mm4", "%[ShiftMask]") // DJR - Diagonal Jaggie Reduction // In the event that we are going to use an average (Bob) pixel we do not want a jagged // stair step effect. To combat this we avg in the 2 horizontally adjacen pixels into the // interpolated Bob mix. This will do horizontal smoothing for only the Bob'd pixels. "movq %[LastAvg], %%mm4\n\t" // the bob value from prev qword in row "movq %%mm6, %[LastAvg]\n\t" // save for next pass "psrlq $48, %%mm4\n\t" // right justify 1 pixel "movq %%mm6, %%mm7\n\t" // copy of simple bob pixel "psllq $16, %%mm7\n\t" // left justify 3 pixels "por %%mm7, %%mm4\n\t" // and combine "movq (%%" XBX "), %%mm5\n\t" // next horiz qword from L1 // pavgb mm5, qword ptr[ebx+ecx] // next horiz qword from L3, use macro below V_PAVGB ("%%mm5", "(%%" XBX ",%%" XCX ")", "%%mm7", "%[ShiftMask]") "psllq $48, %%mm5\n\t" // left just 1 pixel "movq %%mm6, %%mm7\n\t" // another copy of simple bob pixel "psrlq $16, %%mm7\n\t" // right just 3 pixels "por %%mm7, %%mm5\n\t" // combine // pavgb mm4, mm5 // avg of forward and prev by 1 pixel, use macro V_PAVGB ("%%mm4", "%%mm5", "%%mm5", "%[ShiftMask]") // mm5 gets modified if MMX // pavgb mm6, mm4 // avg of center and surround interp vals, use macro V_PAVGB ("%%mm6", "%%mm4", "%%mm7", "%[ShiftMask]") // Don't do any more averaging than needed for mmx. It hurts performance and causes rounding errors. #ifndef IS_MMX // pavgb mm4, mm6 // 1/4 center, 3/4 adjacent V_PAVGB ("%%mm4", "%%mm6", "%%mm7", "%[ShiftMask]") // pavgb mm6, mm4 // 3/8 center, 5/8 adjacent V_PAVGB ("%%mm6", "%%mm4", "%%mm7", "%[ShiftMask]") #endif // get abs value of possible L2 comb "movq %%mm6, %%mm4\n\t" // work copy of interp val "movq %%mm2, %%mm7\n\t" // L2 "psubusb %%mm4, %%mm7\n\t" // L2 - avg "movq %%mm4, %%mm5\n\t" // avg "psubusb %%mm2, %%mm5\n\t" // avg - L2 "por %%mm7, %%mm5\n\t" // abs(avg-L2) // get abs value of possible L2P comb "movq %%mm0, %%mm7\n\t" // L2P "psubusb %%mm4, %%mm7\n\t" // L2P - avg "psubusb %%mm0, %%mm4\n\t" // avg - L2P "por %%mm7, %%mm4\n\t" // abs(avg-L2P) // use L2 or L2P depending upon which makes smaller comb "psubusb %%mm5, %%mm4\n\t" // see if it goes to zero "psubusb %%mm5, %%mm5\n\t" // 0 "pcmpeqb %%mm5, %%mm4\n\t" // if (mm4=0) then FF else 0 "pcmpeqb %%mm4, %%mm5\n\t" // opposite of mm4 // if Comb(L2P) <= Comb(L2) then mm4=ff, mm5=0 else mm4=0, mm5 = 55 "pand %%mm2, %%mm5\n\t" // use L2 if mm5 == ff, else 0 "pand %%mm0, %%mm4\n\t" // use L2P if mm4 = ff, else 0 "por %%mm5, %%mm4\n\t" // may the best win // Inventory: at this point we have the following values: // mm0 = L2P (or L2) // mm1 = L1 // mm2 = L2 (or L2P) // mm3 = L3 // mm4 = the best of L2,L2P weave pixel, base upon comb // mm6 = the avg interpolated value, if we need to use it // Let's measure movement, as how much the weave pixel has changed "movq %%mm2, %%mm7\n\t" "psubusb %%mm0, %%mm2\n\t" "psubusb %%mm7, %%mm0\n\t" "por %%mm2, %%mm0\n\t" // abs value of change, used later // Now lets clip our chosen value to be not outside of the range // of the high/low range L1-L3 by more than MaxComb. // This allows some comb but limits the damages and also allows more // detail than a boring oversmoothed clip. "movq %%mm1, %%mm2\n\t" // copy L1 // pmaxub mm2, mm3 // use macro V_PMAXUB ("%%mm2", "%%mm3") // now = Max(L1,L3) "movq %%mm1, %%mm5\n\t" // copy L1 // pminub mm5, mm3 // now = Min(L1,L3), use macro V_PMINUB ("%%mm5", "%%mm3", "%%mm7") // allow the value to be above the high or below the low by amt of MaxComb "psubusb %[MaxComb], %%mm5\n\t" // lower min by diff "paddusb %[MaxComb], %%mm2\n\t" // increase max by diff // pmaxub mm4, mm5 // now = Max(best,Min(L1,L3) use macro V_PMAXUB ("%%mm4", "%%mm5") // pminub mm4, mm2 // now = Min( Max(best, Min(L1,L3), L2 )=L2 clipped V_PMINUB ("%%mm4", "%%mm2", "%%mm7") // Blend weave pixel with bob pixel, depending on motion val in mm0 "psubusb %[MotionThreshold], %%mm0\n\t" // test Threshold, clear chroma change "psrlw $8, %%mm0\n\t" // div by 256 to get weighted avg "pmullw %[MotionSense], %%mm0\n\t" // mul by user factor, keep low 16 bits "movq %[QW256], %%mm7\n\t" #ifdef IS_MMXEXT "pminsw %%mm7, %%mm0\n\t" // max = 256 #else "paddusw %[QW256B], %%mm0\n\t" // add, may sat at fff.. "psubusw %[QW256B], %%mm0\n\t" // now = Min(L1,256) #endif "psubusw %%mm0, %%mm7\n\t" // so the 2 sum to 256, weighted avg "movq %%mm4, %%mm2\n\t" // save weave chroma info before trashing "pand %[YMask], %%mm4\n\t" // keep only luma from calc'd value "psrlw $8, %%mm4\n\t" // div by 256 to get weighted avg "pmullw %%mm7, %%mm4\n\t" // use more weave for less motion "pand %[YMask], %%mm6\n\t" // keep only luma from calc'd value "psrlw $8, %%mm6\n\t" // div by 256 to get weighted avg "pmullw %%mm0, %%mm6\n\t" // use more bob for large motion "paddusw %%mm6, %%mm4\n\t" // combine "pand %[YMask], %%mm4\n\t" // keep only luma from calc'd value // chroma comes from weave pixel "pand %[UVMask], %%mm2\n\t" // keep chroma "por %%mm4, %%mm2\n\t" // and combine V_MOVNTQ ("(%%" XDI ")", "%%mm2") // move in our clipped best, use macro // bump ptrs and loop LEAX " 8(%%" XAX "), %%" XAX "\n\t" LEAX " 8(%%" XBX "), %%" XBX "\n\t" LEAX " 8(%%" XDX "), %%" XDX "\n\t" LEAX " 8(%%" XDI "), %%" XDI "\n\t" LEAX " 8(%%" XSI "), %%" XSI "\n\t" DECX " %[LoopCtr]\n\t" "jg 1b\n\t" // loop if not to last line // note P-III default assumes backward branches taken "jl 1f\n\t" // done MOVX " %%" XAX ", %%" XBX "\n\t" // sharpness lookahead 1 byte only, be wrong on 1 "jmp 1b\n\t" "1:\n\t" MOVX " %[oldbx], %%" XBX "\n\t" "emms\n\t": /* no outputs */ :[LastAvg] "m" (LastAvg), [L1] "m" (L1), [L3] "m" (L3), [L2P] "m" (L2P), [L2] "m" (L2), [Dest] "m" (Dest), [ShiftMask] "m" (ShiftMask), [MaxComb] "m" (MaxComb), [MotionThreshold] "m" (MotionThreshold), [MotionSense] "m" (MotionSense), [QW256B] "m" (QW256B), [YMask] "m" (YMask), [UVMask] "m" (UVMask), [LoopCtr] "m" (LoopCtr), [QW256] "m" (QW256), [oldbx] "m" (oldbx) : XAX, XCX, XDX, XSI, XDI, "st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)", #ifdef __MMX__ "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7", #endif "memory", "cc"); }
problems/045/a045.adb
melwyncarlo/ProjectEuler
0
16748
with Ada.Long_Integer_Text_IO; -- Copyright 2021 <NAME> procedure A045 is use Ada.Long_Integer_Text_IO; ---------------------------------------------------------------------------- Max_N : constant Integer := 1E5; ---------------------------------------------------------------------------- type Double is digits 10; ---------------------------------------------------------------------------- -- Newton-Raphson's Method for calculating the square root. -- xn = x0 - ( f(x0) / f'(x0) ) -- x(n) = x(n-1) - ( ((x(n-1) * x(n-1)) - x0) / (2 * x(n-1)) ) function Sqrt (x0 : Double) return Double; ---------------------------------------------------------------------------- function Sqrt (x0 : Double) return Double is Max_Iterations : constant Integer := 25; xn : Double := x0; begin for I in 1 .. Max_Iterations loop xn := xn - (((xn * xn) - x0) / (2.0 * xn)); end loop; return xn; end Sqrt; ---------------------------------------------------------------------------- Tn, Sqrt_Term : Double; ---------------------------------------------------------------------------- begin for I in 286 .. Max_N loop Tn := Double (I + 1) / 2.0; Tn := Tn * Double (I); Sqrt_Term := Sqrt (1.0E0 + (24.0E0 * Tn)); if (Sqrt_Term - Double (Long_Integer (Sqrt_Term))) = 0.0 then if ((Long_Integer (Sqrt_Term) + 1) mod 6) = 0 then Sqrt_Term := Sqrt (1.0E0 + (8.0E0 * Tn)); if (Sqrt_Term - Double (Long_Integer (Sqrt_Term))) = 0.0 then if ((Long_Integer (Sqrt_Term) + 1) mod 4) = 0 then exit; end if; end if; end if; end if; end loop; Put (Long_Integer (Tn), Width => 0); end A045;
electronics/proteus/PIC Microcontroller/PIC ADC (mikroC folder)/MyProject.asm
m-ahmadi/exref
9
24594
<reponame>m-ahmadi/exref _main: ;MyProject.c,2 :: void main() { ;MyProject.c,3 :: CMCON = 0x07; // Disable Comparators MOVLW 7 MOVWF CMCON+0 ;MyProject.c,4 :: ADCON1 = 0x80; // ADC module configuration MOVLW 128 MOVWF ADCON1+0 ;MyProject.c,6 :: TRISA = 0xFF; // PORTA as Input MOVLW 255 MOVWF TRISA+0 ;MyProject.c,7 :: TRISB = 0x00; // PORTB as Output CLRF TRISB+0 ;MyProject.c,8 :: TRISC = 0x00; // PORTC as Output CLRF TRISC+0 ;MyProject.c,10 :: do { L_main0: ;MyProject.c,11 :: adc = ADC_Read(1); // Read ADC value from channel 1 MOVLW 1 MOVWF FARG_ADC_Read_channel+0 CALL _ADC_Read+0 MOVF R0+0, 0 MOVWF _adc+0 MOVF R0+1, 0 MOVWF _adc+1 ;MyProject.c,12 :: PORTB = adc; // Send lower 8 bits of ADC value to PORTB MOVF R0+0, 0 MOVWF PORTB+0 ;MyProject.c,13 :: PORTC = adc >> 2; // Send higher 2 bits to PORTC MOVF R0+0, 0 MOVWF R2+0 MOVF R0+1, 0 MOVWF R2+1 RRF R2+1, 1 RRF R2+0, 1 BCF R2+1, 7 RRF R2+1, 1 RRF R2+0, 1 BCF R2+1, 7 MOVF R2+0, 0 MOVWF PORTC+0 ;MyProject.c,14 :: } while(1); GOTO L_main0 ;MyProject.c,15 :: } L_end_main: GOTO $+0 ; end of _main
oeis/157/A157653.asm
neoneye/loda-programs
11
16733
; A157653: a(n) = 80000*n^2 - 39200*n + 4801. ; 45601,246401,607201,1128001,1808801,2649601,3650401,4811201,6132001,7612801,9253601,11054401,13015201,15136001,17416801,19857601,22458401,25219201,28140001,31220801,34461601,37862401,41423201,45144001,49024801,53065601,57266401,61627201,66148001,70828801,75669601,80670401,85831201,91152001,96632801,102273601,108074401,114035201,120156001,126436801,132877601,139478401,146239201,153160001,160240801,167481601,174882401,182443201,190164001,198044801,206085601,214286401,222647201,231168001,239848801 seq $0,157652 ; a(n) = 40*(200*n - 49). pow $0,2 sub $0,36481600 div $0,640000 mul $0,800 add $0,45601
mc-sema/validator/x86/tests/ADDSDrm.asm
randolphwong/mcsema
2
173714
<reponame>randolphwong/mcsema<filename>mc-sema/validator/x86/tests/ADDSDrm.asm BITS 32 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS= ;TEST_FILE_META_END ; convert 1 to a double precision float and store in xmm0 mov ecx, 1 cvtsi2sd xmm0, ecx ;TEST_BEGIN_RECORDING ; load 2.5 (in double precision float form) lea ecx, [esp-8] mov DWORD [ecx], 0 mov DWORD [ecx+4], 0x40040000 addsd xmm0, [ecx] mov ecx, [ecx] ;TEST_END_RECORDING xor ecx, ecx cvtsi2sd xmm0, ecx
MySource/23-print-str-num.asm
mdabdullahibnaharun/Assembly-Language
0
241635
<gh_stars>0 ; You may customize this and other start-up templates; ; The location of this template is c:\emu8086\inc\0_com_template.txt org 100h .model small .data var1 db 7 var2 dw "Hello World$" .code main proc mov ax,@data ;data access notation mov ds,ax ;all data address mov dl,var1 add dl,48 mov ah,2 ;for 1 char int 21h ;---str mov dx, offset var2 lea dx,var1 mov ah,9 ;for str int 21h mov ah,4ch int 21h main endp end main ret
arch/ARM/STM32/driver_demos/demo_gpio_direct_leds/src/demo_gpio.adb
morbos/Ada_Drivers_Library
2
16261
<gh_stars>1-10 ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics 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. -- -- -- ------------------------------------------------------------------------------ -- A simple example that blinks all the LEDs simultaneously, w/o tasking. It -- does not use the "board" packages and so works directly with the platform -- package STM32F40xx and the GPIO driver to control the LEDs. -- Note that this is set up for an STM32F4_Discovery board because it uses -- four LEDs, but it would be trivial to change it to another board. The -- F4_Disco board is based on an STM32F405 MCU so we use the STM32F40xxx -- package to get the GPIO port GPIO_D for the LEDs. -- -- Note that using the STM32.Board package would make this even easier -- but that is not what this program demonstrates. with STM32.User_Button; with STM32.Device; use STM32.Device; with STM32.GPIO; use STM32.GPIO; with Ada.Real_Time; use Ada.Real_Time; procedure Demo_GPIO is Green_LED : GPIO_Point renames PD12; Orange_LED : GPIO_Point renames PD13; Red_LED : GPIO_Point renames PD14; Blue_LED : GPIO_Point renames PD15; Pattern : GPIO_Points := (Orange_LED, Red_LED, Blue_LED, Green_LED); -- The LEDs on the F4 Disco are not physically laid out "consecutively" -- in such a way that we can simply go in enumeral order to get circular -- rotation. Thus we define this mapping, using a consecutive index to get -- the physical LED blinking order desired. Next_LED : Positive range Pattern'Range := Pattern'First; Clockwise : Boolean := True; Period : constant Time_Span := Milliseconds (75); -- arbitrary Next_Release : Time := Clock; procedure Initialize_LEDs; -- Enable the clock for the four LEDs and configure them as outputs. Note -- there is a procedure defined in STM32.Board to do this. We do it here -- to demonstrate the use of the GPIO interface. procedure Initialize_LEDs is Configuration : GPIO_Port_Configuration; begin Enable_Clock (GPIO_D); Configuration.Mode := Mode_Out; Configuration.Output_Type := Push_Pull; Configuration.Speed := Speed_100MHz; Configuration.Resistors := Floating; Configure_IO (Pattern, Config => Configuration); end Initialize_LEDs; begin Initialize_LEDs; STM32.User_Button.Initialize; loop Pattern (Next_LED).Clear; if STM32.User_Button.Has_Been_Pressed then Clockwise := not Clockwise; end if; if Clockwise then Next_LED := (if Next_LED = Pattern'Last then Pattern'First else Next_LED + 1); else Next_LED := (if Next_LED = Pattern'First then Pattern'Last else Next_LED - 1); end if; Pattern (Next_LED).Set; Next_Release := Next_Release + Period; delay until Next_Release; end loop; end Demo_GPIO;
programs/oeis/327/A327329.asm
jmorken/loda
1
1906
; A327329: Twice the sum of all divisors of all positive integers <= n. ; 2,8,16,30,42,66,82,112,138,174,198,254,282,330,378,440,476,554,594,678,742,814,862,982,1044,1128,1208,1320,1380,1524,1588,1714,1810,1918,2014,2196,2272,2392,2504,2684,2768,2960,3048,3216,3372,3516,3612,3860,3974,4160,4304,4500,4608,4848,4992 add $0,1 mul $0,2 cal $0,271342 ; Sum of all even divisors of all positive integers <= n. mov $1,$0
libsrc/graphics/gray/g_drawr.asm
meesokim/z88dk
0
175788
; ; TI Gray Library Functions ; ; Written by <NAME> - Mar 2001 ; ; ; $Id: g_drawr.asm,v 1.6 2015/01/22 17:23:48 stefano Exp $ ; ;Usage: g_drawr(int px, int py, int GrayLevel) PUBLIC g_drawr EXTERN coords EXTERN Line_r EXTERN plotpixel EXTERN respixel EXTERN graypage .g_drawr ld ix,0 add ix,sp ld a,(ix+2) ;GrayLevel ld e,(ix+4) ;py ld d,(ix+5) ld l,(ix+6) ;px ld h,(ix+7) ld bc,(coords) push bc push af xor a call graypage pop af ld ix,plotpixel rra jr nc,set1 ld ix,respixel .set1 push af push hl push de call Line_r pop de pop hl pop af pop bc ld (coords),bc push af ld a,1 call graypage pop af ld ix,plotpixel rra jr nc,set2 ld ix,respixel .set2 jp Line_r
kernel/mm/mm.asm
TheMachine02/Sorcery
14
22388
; memory management routine define KERNEL_MM_PAGE_SIZE 1024 ; mask define KERNEL_MM_PAGE_FREE_MASK 128 ; memory page is free define KERNEL_MM_PAGE_CACHE_MASK 64 ; this is a cache page define KERNEL_MM_PAGE_UNEVICTABLE_MASK 32 ; set page as not moveable define KERNEL_MM_PAGE_DIRTY_MASK 16 ; only used if unevictable is z define KERNEL_MM_PAGE_USER_MASK 15 ; owner mask in first byte of ptlb define KERNEL_MM_PAGE_COUNTER 1 ; the counter is the second byte of ptlb define KERNEL_MM_PAGE_INODE 0 ; the inode number for cache page is stored in 2 bytes overlapping flag byte ; bit define KERNEL_MM_PAGE_FREE 7 define KERNEL_MM_PAGE_CACHE 6 define KERNEL_MM_PAGE_UNEVICTABLE 5 define KERNEL_MM_PAGE_DIRTY 4 define KERNEL_MM_PAGE_COUNTER 0 ; the counter is the second byte of ptlb ; reserved mask : no-free, bound to thread 0 define KERNEL_MM_RESERVED_MASK 0 ; the first 32768 bytes shouldn't be init by mm module define KERNEL_MM_PROTECTED_SIZE 32768 ; null adress reading always zero, but faster define KERNEL_MM_NULL $E40000 ; poison for illegal jp / derefence define KERNEL_HW_POISON $C7 ; physical device define KERNEL_MM_PHY_RAM $D00000 define KERNEL_MM_PHY_RAM_SIZE $040000 define KERNEL_MM_PHY_FLASH $000000 define KERNEL_MM_PHY_FLASH_SIZE $400000 ; the memory device as seen by the kernel define KERNEL_MM_GFP_RAM KERNEL_MM_GFP_KERNEL * KERNEL_MM_PAGE_SIZE + KERNEL_MM_PHY_RAM define KERNEL_MM_GFP_RAM_SIZE KERNEL_MM_PHY_RAM_SIZE - KERNEL_MM_GFP_KERNEL * KERNEL_MM_PAGE_SIZE define KERNEL_MM_GFP_KERNEL 32 ; $D08000 : total kernel size define KERNEL_MM_GFP_USER 64 ; $D10000 : start of user memory define KERNEL_MM_GFP_CRITICAL 28 ; 4K of critical RAM area ? (TODO : to be defined) define KERNEL_MM_PAGE_MAX 256 ; $D0 ... $D1 should be reserved to kernel / cache ; $D1 and after is thread and program memory ; this partition reduce fragmentation in the cache area (always map 1K at the time) and general memory fragmentation macro trap db $FD, $FF end macro kmm: ; memory adress sanitizer in memory allocation ; ; read and write permission : every thread can write to an allocated page ; detect non allocated page write .page_perm_rw: ; b = page ; return nc if permission is okay ; return nz if cache or shared page or anonymous ; return z if thread mapped page ; return c is segfaulted ; return nz ; return de ptlb, destroy a, return hl current_thread ld de, kmm_ptlb_map ld e, b ld a, (de) rla ; KERNEL_MM_FREE jr c, .__segfault_permission ld hl, (kthread_current) and a, KERNEL_MM_PAGE_CACHE_MASK shl 1 ret nz inc d ld a, (de) dec d cp a, (hl) ret z jr .__segfault_permission ; read, write, execute permission ; detect if the page is a user page ; anything else segfault .page_perm_rwox: ; b = page ; return nc if permission is okay ; return z if user mapped page ; return c is segfaulted ; return nz ; return de ptlb, destroy a, return hl current_thread ld de, kmm_ptlb_map ld e, b ld a, (de) and KERNEL_MM_PAGE_FREE_MASK or KERNEL_MM_PAGE_CACHE_MASK jr nz, .__segfault_permission ; are we the owner ? ld hl, (kthread_current) inc d ld a, (de) dec d cp a, (hl) ret z ; segfault cleanup .__segfault_permission: pop bc ; pop the routine adress .__segfault_critical: pop af ; this is interrupt status jp po, .segfault ei .segfault: ld hl, (kthread_current) ld c, (hl) ld a, SIGSEGV call signal.kill ; well, clean up and try for better ? ; interrupts are enabled and wish for the best scf sbc hl, hl ; Say, I WISH YOU THE BEST ret .map_pages: ; register b is page index wanted, return hl = adress or -1 if error ; register c is page count wanted ; destroy bc, destroy a, destroy de ld hl, (kthread_current) or a, a ld a, (hl) .map_user_pages: dec c ld e, c jr z, .page_map_single ; map c page from b page to thread a ld h, a ld a, i ld a, h push af ld a, b add a, c jp c, .__segfault_critical ld hl, kmm_ptlb_map ld l, b ld a, b cpl ld b, 0 ld c, a inc.s bc ld a, KERNEL_MM_PAGE_FREE_MASK di .page_map_parse: ; fast search for free page cpir jp po, .page_map_no_free ; else check we have at least c page free ld d, e .page_map_length: cpi jp po, .page_map_except jr nz, .page_map_parse dec d jr nz, .page_map_length .page_map_found: ; e is lenght, hl is last adress + 1 dec hl ld a, l sub a, e ld l, a ; hl = start of the map, for e+1 inc e ld b, e ld c, l ; save l for latter pop af push af .page_map_owner: ld (hl), 0 inc h ld (hl), a dec h inc hl djnz .page_map_owner pop af jp po, $+5 ei ld hl, KERNEL_MM_PHY_RAM shr 2 ld h, c add hl, hl add hl, hl ret .page_map_except: jp nz, .page_map_no_free dec d jr z, .page_map_found jp .page_map_no_free .page_map_single: ; register b is page index wanted, return hl = adress or -1 if error, e is flag (SHARED or not) ; destroy bc, destroy hl ; get kmm_ptlb_map adress ld a, i push af ld hl, kmm_ptlb_map ld l, b ld a, b cpl ld b, 0 ld c, a inc.s bc ld a, KERNEL_MM_PAGE_FREE_MASK di ; fast search for free page cpir jp po, .page_map_no_free dec hl ld (hl), e inc h pop af ld (hl), a jp po, $+5 ei ld b, l ld hl, KERNEL_MM_PHY_RAM shr 2 ld h, b add hl, hl add hl, hl ret .page_map_no_free: ; will need to reclaim cache memory page scf sbc hl, hl pop af scf ret po ei ret .unmap_user_pages: ; unmap all the pages belonging to an thread ; a = pid ; sanity check guard, call by kernel ; of course, it is easy to bypass, but at least it is here ; mainly, what happen if you unmap yourself ? > CRASH pop hl push hl ld bc, KERNEL_MM_PHY_RAM + KERNEL_MM_PROTECTED_SIZE or a, a sbc hl, bc jp nc, .segfault ld hl, kmm_ptlb_map + KERNEL_MM_PAGE_MAX + KERNEL_MM_GFP_KERNEL ld bc, KERNEL_MM_PAGE_MAX - KERNEL_MM_GFP_KERNEL jr .__unmap_user_pages_parse .__unmap_user_pages_flush: dec hl dec h bit KERNEL_MM_PAGE_CACHE, (hl) call z, .flush_page inc h inc hl .__unmap_user_pages_parse: cpir jp pe, .__unmap_user_pages_flush ret .unmap_pages: ; register b is page index wanted ; register c is page count wanted to clean ; destroy hl, bc, a dec c jr z, .unmap_page ld a, b ; sanity check ; ; b > base kernel memory cp a, KERNEL_MM_GFP_KERNEL jp c, .segfault ld hl, kmm_ptlb_map ld l, b ld a, b add a, c jp c, .segfault ; okay nice. Now, we will unmap page ; hl = first page ; check permission first inc c ld b, c ld de, (kthread_current) ld a, (de) ; thread pid ld e, a .__unmap_pages_loop: ; page_perm_rwox ld a, (hl) and a, KERNEL_MM_PAGE_CACHE_MASK or KERNEL_MM_PAGE_FREE_MASK jp nz, .segfault inc h ld a, e cp a, (hl) jp nz, .segfault dec h call .flush_page djnz .__unmap_pages_loop ret .unmap_page: ; register b is page index wanted ; destroy a, destroy hl, destroy bc, destroy de ; page_perm_rwox ld de, kmm_ptlb_map ld e, b ld a, (de) and a, KERNEL_MM_PAGE_FREE_MASK or KERNEL_MM_PAGE_CACHE_MASK jp nz, .segfault ld a, b ; sanity check ; ; b > base kernel memory cp a, KERNEL_MM_GFP_KERNEL jp c, .segfault ; are we the owner ? ld hl, (kthread_current) inc d ld a, (de) dec d cp a, (hl) jp nz, .segfault ex de, hl ; rst $0 : trap execute, illegal instruction .flush_page: ; hl as the ptlb adress push bc push hl ld c, l ld hl, KERNEL_MM_PHY_RAM shr 2 ld h, c add hl, hl add hl, hl ld bc, KERNEL_MM_PAGE_SIZE - 1 ex de, hl sbc hl, hl adc hl, de ld (hl), KERNEL_HW_POISON inc de ldir pop hl ; write first free_mask, so the page will be considered as free even if hell break loose and the thread is killed between the two following write ld (hl), KERNEL_MM_PAGE_FREE_MASK inc h ld (hl), c dec h pop bc ret .physical_to_ptlb: ; adress divided by page KERNEL_MM_PAGE_SIZE = 1024 assert KERNEL_MM_PAGE_SIZE = 1024 push hl dec sp pop hl inc sp ld a, l srl h rra srl h rra ld hl, kmm_ptlb_map ld l, a ret .map_page: ; register b is page index wanted, return hl = adress and a = page or -1 if error with a=error and c set ; de is full tlb flag ; destroy bc, destroy hl ; get kmm_ptlb_map adress ld a, i push af ld hl, kmm_ptlb_map ld l, b ld a, b ; sanity check ; ; b > base kernel memory cp a, KERNEL_MM_GFP_KERNEL jp c, .__segfault_critical cpl ld b, 0 ld c, a inc.s bc ld a, KERNEL_MM_PAGE_FREE_MASK di ; fast search for free page cpir jp po, .__map_page_full dec hl ld (hl), e inc h ld (hl), d pop af jp po, $+5 ei ld a, l ld hl, KERNEL_MM_PHY_RAM shr 2 ld h, a add hl, hl add hl, hl ret .__map_page_full: ; will need to reclaim memory page here scf sbc hl, hl pop af scf ld a, ENOMEM ret po ei ret
source/league/league-text_codecs-codec_for_application_locale__posix.adb
svn2github/matreshka
24
16026
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2013, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This version of subprogram intended to be used on POSIX systems. ------------------------------------------------------------------------------ with Ada.Characters.Conversions; with Ada.Strings.Fixed; with Interfaces.C.Strings; separate (League.Text_Codecs) function Codec_For_Application_Locale return Text_Codec is function Determine_Encoding return League.Strings.Universal_String; -- Determines application locale encoding and returns its name. function Encoding_Component (Locale : String) return League.Strings.Universal_String; -- Returns encoding/character set component of locale specification, or -- empty string when there are no such component specified. -- -- language[_territory][.codeset][@variant] function Get_Environment_Variable (Name : String) return String; -- Returns value of the specified environment variable, or empty string -- if variable is not defined. ------------------------ -- Determine_Encoding -- ------------------------ function Determine_Encoding return League.Strings.Universal_String is LC_CTYPE_Encoding : constant League.Strings.Universal_String := Encoding_Component (Get_Environment_Variable ("LC_TYPE")); LC_ALL_Encoding : constant League.Strings.Universal_String := Encoding_Component (Get_Environment_Variable ("LC_ALL")); LANG_Encoding : constant League.Strings.Universal_String := Encoding_Component (Get_Environment_Variable ("LANG")); begin -- Analyze LC_CTYPE, LC_ALL, LANG for codeset part, use first found, -- otherwise fallback to ISO-8859-1. if not LC_CTYPE_Encoding.Is_Empty then return LC_CTYPE_Encoding; elsif not LC_ALL_Encoding.Is_Empty then return LC_ALL_Encoding; elsif not LANG_Encoding.Is_Empty then return LANG_Encoding; else return League.Strings.To_Universal_String ("ISO-8859-1"); end if; end Determine_Encoding; ------------------------ -- Encoding_Component -- ------------------------ function Encoding_Component (Locale : String) return League.Strings.Universal_String is Dot_Index : constant Natural := Ada.Strings.Fixed.Index (Locale, "."); At_Index : constant Natural := Ada.Strings.Fixed.Index (Locale, "@"); begin if Dot_Index = 0 then return League.Strings.Empty_Universal_String; else if At_Index = 0 then return League.Strings.To_Universal_String (Ada.Characters.Conversions.To_Wide_Wide_String (Locale (Dot_Index + 1 .. Locale'Last))); else return League.Strings.To_Universal_String (Ada.Characters.Conversions.To_Wide_Wide_String (Locale (Dot_Index + 1 .. At_Index - 1))); end if; end if; end Encoding_Component; ------------------------------ -- Get_Environment_Variable -- ------------------------------ function Get_Environment_Variable (Name : String) return String is use type Interfaces.C.Strings.chars_ptr; function getenv (Name : Interfaces.C.Strings.chars_ptr) return Interfaces.C.Strings.chars_ptr; pragma Import (C, getenv); C_Name : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.New_String (Name); C_Value : constant Interfaces.C.Strings.chars_ptr := getenv (C_Name); begin Interfaces.C.Strings.Free (C_Name); if C_Value = Interfaces.C.Strings.Null_Ptr then return ""; else return Interfaces.C.Strings.Value (C_Value); end if; end Get_Environment_Variable; begin return Codec (Determine_Encoding); end Codec_For_Application_Locale;
tools-src/gnu/gcc/gcc/ada/ali-util.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
8793
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- A L I . U T I L -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2001 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 2, 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 COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Binderr; use Binderr; with Namet; use Namet; with Opt; use Opt; with Osint; use Osint; with System.CRC32; package body ALI.Util is ----------------------- -- Local Subprograms -- ----------------------- procedure Accumulate_Checksum (C : Character; Csum : in out Word); pragma Inline (Accumulate_Checksum); -- This routine accumulates the checksum given character C. During the -- scanning of a source file, this routine is called with every character -- in the source, excluding blanks, and all control characters (except -- that ESC is included in the checksum). Upper case letters not in string -- literals are folded by the caller. See Sinput spec for the documentation -- of the checksum algorithm. Note: checksum values are only used if we -- generate code, so it is not necessary to worry about making the right -- sequence of calls in any error situation. procedure Initialize_Checksum (Csum : out Word); -- Sets initial value of Csum before any calls to Accumulate_Checksum ------------------------- -- Accumulate_Checksum -- ------------------------- procedure Accumulate_Checksum (C : Character; Csum : in out Word) is begin System.CRC32.Update (System.CRC32.CRC32 (Csum), C); end Accumulate_Checksum; --------------------- -- Checksums_Match -- --------------------- function Checksums_Match (Checksum1, Checksum2 : Word) return Boolean is begin return Checksum1 = Checksum2 and then Checksum1 /= Checksum_Error; end Checksums_Match; ----------------------- -- Get_File_Checksum -- ----------------------- function Get_File_Checksum (Fname : Name_Id) return Word is Src : Source_Buffer_Ptr; Hi : Source_Ptr; Csum : Word; Ptr : Source_Ptr; Bad : exception; -- Raised if file not found, or file format error use ASCII; -- Make control characters visible procedure Free_Source; -- Free source file buffer procedure Free_Source is procedure free (Arg : Source_Buffer_Ptr); pragma Import (C, free, "free"); begin free (Src); end Free_Source; -- Start of processing for Get_File_Checksum begin Read_Source_File (Fname, 0, Hi, Src); -- If we cannot find the file, then return an impossible checksum, -- impossible becaues checksums have the high order bit zero, so -- that checksums do not match. if Src = null then raise Bad; end if; Initialize_Checksum (Csum); Ptr := 0; loop case Src (Ptr) is -- Spaces and formatting information are ignored in checksum when ' ' | CR | LF | VT | FF | HT => Ptr := Ptr + 1; -- EOF is ignored unless it is the last character when EOF => if Ptr = Hi then Free_Source; return Csum; else Ptr := Ptr + 1; end if; -- Non-blank characters that are included in the checksum when '#' | '&' | '*' | ':' | '(' | ',' | '.' | '=' | '>' | '<' | ')' | '/' | ';' | '|' | '!' | '+' | '_' | '0' .. '9' | 'a' .. 'z' => Accumulate_Checksum (Src (Ptr), Csum); Ptr := Ptr + 1; -- Upper case letters, fold to lower case when 'A' .. 'Z' => Accumulate_Checksum (Character'Val (Character'Pos (Src (Ptr)) + 32), Csum); Ptr := Ptr + 1; -- Left bracket, really should do wide character thing here, -- but for now, don't bother. when '[' => raise Bad; -- Minus, could be comment when '-' => if Src (Ptr + 1) = '-' then Ptr := Ptr + 2; while Src (Ptr) >= ' ' or else Src (Ptr) = HT loop Ptr := Ptr + 1; end loop; else Accumulate_Checksum ('-', Csum); Ptr := Ptr + 1; end if; -- String delimited by double quote when '"' => Accumulate_Checksum ('"', Csum); loop Ptr := Ptr + 1; exit when Src (Ptr) = '"'; if Src (Ptr) < ' ' then raise Bad; end if; Accumulate_Checksum (Src (Ptr), Csum); end loop; Accumulate_Checksum ('"', Csum); Ptr := Ptr + 1; -- String delimited by percent when '%' => Accumulate_Checksum ('%', Csum); loop Ptr := Ptr + 1; exit when Src (Ptr) = '%'; if Src (Ptr) < ' ' then raise Bad; end if; Accumulate_Checksum (Src (Ptr), Csum); end loop; Accumulate_Checksum ('%', Csum); Ptr := Ptr + 1; -- Quote, could be character constant when ''' => Accumulate_Checksum (''', Csum); if Src (Ptr + 2) = ''' then Accumulate_Checksum (Src (Ptr + 1), Csum); Accumulate_Checksum (''', Csum); Ptr := Ptr + 3; -- Otherwise assume attribute char. We should deal with wide -- character cases here, but that's hard, so forget it. else Ptr := Ptr + 1; end if; -- Upper half character, more to be done here, we should worry -- about folding Latin-1, folding other character sets, and -- dealing with the nasty case of upper half wide encoding. when Upper_Half_Character => Accumulate_Checksum (Src (Ptr), Csum); Ptr := Ptr + 1; -- Escape character, we should do the wide character thing here, -- but for now, do not bother. when ESC => raise Bad; -- Invalid control characters when NUL | SOH | STX | ETX | EOT | ENQ | ACK | BEL | BS | SO | SI | DLE | DC1 | DC2 | DC3 | DC4 | NAK | SYN | ETB | CAN | EM | FS | GS | RS | US | DEL => raise Bad; -- Invalid graphic characters when '$' | '?' | '@' | '`' | '\' | '^' | '~' | ']' | '{' | '}' => raise Bad; end case; end loop; exception when Bad => Free_Source; return Checksum_Error; end Get_File_Checksum; --------------------------- -- Initialize_ALI_Source -- --------------------------- procedure Initialize_ALI_Source is begin -- When (re)initializing ALI data structures the ALI user expects to -- get a fresh set of data structures. Thus we first need to erase the -- marks put in the name table by the previous set of ALI routine calls. -- This loop is empty and harmless the first time in. for J in Source.First .. Source.Last loop Set_Name_Table_Info (Source.Table (J).Sfile, 0); Source.Table (J).Source_Found := False; end loop; Source.Init; end Initialize_ALI_Source; ------------------------- -- Initialize_Checksum -- ------------------------- procedure Initialize_Checksum (Csum : out Word) is begin System.CRC32.Initialize (System.CRC32.CRC32 (Csum)); end Initialize_Checksum; -------------- -- Read_ALI -- -------------- procedure Read_ALI (Id : ALI_Id) is Afile : File_Name_Type; Text : Text_Buffer_Ptr; Idread : ALI_Id; begin for I in ALIs.Table (Id).First_Unit .. ALIs.Table (Id).Last_Unit loop for J in Units.Table (I).First_With .. Units.Table (I).Last_With loop Afile := Withs.Table (J).Afile; -- Only process if not a generic (Afile /= No_File) and if -- file has not been processed already. if Afile /= No_File and then Get_Name_Table_Info (Afile) = 0 then Text := Read_Library_Info (Afile); if Text = null then Error_Msg_Name_1 := Afile; Error_Msg_Name_2 := Withs.Table (J).Sfile; Error_Msg ("% not found, % must be compiled"); Set_Name_Table_Info (Afile, Int (No_Unit_Id)); return; end if; Idread := Scan_ALI (F => Afile, T => Text, Ignore_ED => Force_RM_Elaboration_Order, Err => False); Free (Text); if ALIs.Table (Idread).Compile_Errors then Error_Msg_Name_1 := Withs.Table (J).Sfile; Error_Msg ("% had errors, must be fixed, and recompiled"); Set_Name_Table_Info (Afile, Int (No_Unit_Id)); elsif ALIs.Table (Idread).No_Object then Error_Msg_Name_1 := Withs.Table (J).Sfile; Error_Msg ("% must be recompiled"); Set_Name_Table_Info (Afile, Int (No_Unit_Id)); end if; -- Recurse to get new dependents Read_ALI (Idread); end if; end loop; end loop; end Read_ALI; ---------------------- -- Set_Source_Table -- ---------------------- procedure Set_Source_Table (A : ALI_Id) is F : File_Name_Type; S : Source_Id; Stamp : Time_Stamp_Type; begin Sdep_Loop : for D in ALIs.Table (A).First_Sdep .. ALIs.Table (A).Last_Sdep loop F := Sdep.Table (D).Sfile; -- If this is the first time we are seeing this source file, -- then make a new entry in the source table. if Get_Name_Table_Info (F) = 0 then Source.Increment_Last; S := Source.Last; Set_Name_Table_Info (F, Int (S)); Source.Table (S).Sfile := F; Source.Table (S).All_Timestamps_Match := True; -- Initialize checksum fields Source.Table (S).Checksum := Sdep.Table (D).Checksum; Source.Table (S).All_Checksums_Match := True; -- In check source files mode, try to get time stamp from file if Opt.Check_Source_Files then Stamp := Source_File_Stamp (F); -- If we got the stamp, then set the stamp in the source -- table entry and mark it as set from the source so that -- it does not get subsequently changed. if Stamp (Stamp'First) /= ' ' then Source.Table (S).Stamp := Stamp; Source.Table (S).Source_Found := True; -- If we could not find the file, then the stamp is set -- from the dependency table entry (to be possibly reset -- if we find a later stamp in subsequent processing) else Source.Table (S).Stamp := Sdep.Table (D).Stamp; Source.Table (S).Source_Found := False; -- In All_Sources mode, flag error of file not found if Opt.All_Sources then Error_Msg_Name_1 := F; Error_Msg ("cannot locate %"); end if; end if; -- First time for this source file, but Check_Source_Files -- is off, so simply initialize the stamp from the Sdep entry else Source.Table (S).Source_Found := False; Source.Table (S).Stamp := Sdep.Table (D).Stamp; end if; -- Here if this is not the first time for this source file, -- so that the source table entry is already constructed. else S := Source_Id (Get_Name_Table_Info (F)); -- Update checksum flag if not Checksums_Match (Sdep.Table (D).Checksum, Source.Table (S).Checksum) then Source.Table (S).All_Checksums_Match := False; end if; -- Check for time stamp mismatch if Sdep.Table (D).Stamp /= Source.Table (S).Stamp then Source.Table (S).All_Timestamps_Match := False; -- When we have a time stamp mismatch, we go look for the -- source file even if Check_Source_Files is false, since -- if we find it, then we can use it to resolve which of the -- two timestamps in the ALI files is likely to be correct. if not Check_Source_Files then Stamp := Source_File_Stamp (F); if Stamp (Stamp'First) /= ' ' then Source.Table (S).Stamp := Stamp; Source.Table (S).Source_Found := True; end if; end if; -- If the stamp in the source table entry was set from the -- source file, then we do not change it (the stamp in the -- source file is always taken as the "right" one). if Source.Table (S).Source_Found then null; -- Otherwise, we have no source file available, so we guess -- that the later of the two timestamps is the right one. -- Note that this guess only affects which error messages -- are issued later on, not correct functionality. else if Sdep.Table (D).Stamp > Source.Table (S).Stamp then Source.Table (S).Stamp := Sdep.Table (D).Stamp; end if; end if; end if; end if; -- Set the checksum value in the source table S := Source_Id (Get_Name_Table_Info (F)); Source.Table (S).Checksum := Sdep.Table (D).Checksum; end loop Sdep_Loop; end Set_Source_Table; ---------------------- -- Set_Source_Table -- ---------------------- procedure Set_Source_Table is begin for A in ALIs.First .. ALIs.Last loop Set_Source_Table (A); end loop; end Set_Source_Table; ------------------------- -- Time_Stamp_Mismatch -- ------------------------- function Time_Stamp_Mismatch (A : ALI_Id) return File_Name_Type is Src : Source_Id; -- Source file Id for the current Sdep entry begin for D in ALIs.Table (A).First_Sdep .. ALIs.Table (A).Last_Sdep loop Src := Source_Id (Get_Name_Table_Info (Sdep.Table (D).Sfile)); if Opt.Minimal_Recompilation and then Sdep.Table (D).Stamp /= Source.Table (Src).Stamp then -- If minimal recompilation is in action, replace the stamp -- of the source file in the table if checksums match. -- ??? It is probably worth updating the ALI file with a new -- field to avoid recomputing it each time. if Checksums_Match (Get_File_Checksum (Sdep.Table (D).Sfile), Source.Table (Src).Checksum) then Sdep.Table (D).Stamp := Source.Table (Src).Stamp; end if; end if; if not Source.Table (Src).Source_Found or else Sdep.Table (D).Stamp /= Source.Table (Src).Stamp then return Source.Table (Src).Sfile; end if; end loop; return No_File; end Time_Stamp_Mismatch; end ALI.Util;
Ada/cyclic_scheduler.adb
UdayanSinha/Code_Blocks
3
1436
with Ada.Text_IO; use Ada.Text_IO; with Ada.Real_Time; use Ada.Real_Time; with System_Function_Package; use System_Function_Package; procedure Cyclic_Scheduler is X : Integer := 0; -- Input Y : Integer := 0; -- Input task Source_X; task Source_Y; task Scheduler; task body Source_X is -- Generates Data for Input X Start : Time; Next_Release : Time; Release : Time_Span := Milliseconds(0); Period : Time_Span := Milliseconds(1000); begin Start := Clock; Next_Release := Start + Release; loop delay until Next_Release; Next_Release:= Next_Release + Period; X := X + 1; end loop; end Source_X; task body Source_Y is -- Generated Data for Input Y Start : Time; Next_Release : Time; Release: Time_Span := Milliseconds(500); Period : Time_Span := Milliseconds(1000); begin Start := Clock; Next_Release := Start + Release; loop delay until Next_Release; Next_Release:= Next_Release + Period; Y := Y + 1; end loop; end Source_Y; task body Scheduler is A: Integer; B: Integer; Z : Integer; -- Output begin loop delay To_Duration(Milliseconds(100)); --wait 100ms A := System_A(X); --process X Put_Line("A:"); Put_Line(Integer'Image(A)); delay To_Duration(Milliseconds(400)); --wait 400ms B := System_B(Y); --process Y Put_Line("B:"); Put_Line(Integer'Image(B)); Z:= System_C(A, B); --calc Z Put_Line("Z:"); --display Z Put_Line(Integer'Image(Z)); end loop; end Scheduler; begin null; end Cyclic_Scheduler;
test_applescript.applescript
mattpackwood/TRIGGERcmd-testing
0
1607
<gh_stars>0 on run say "Trigger activated" --Just say a basic phrase end run
common/antlr/grammar/Line.g4
evotodi/cpp-dotenv
55
4606
<filename>common/antlr/grammar/Line.g4 grammar Line; ////////////////// // Parser rules // ////////////////// line : content? EOF ; content : (STRING_CHAR | ESC_SEQ | variable)+ ; variable : BOUNDED_VARIABLE | UNBOUNDED_VARIABLE ; ///////////////// // Lexer rules // ///////////////// ESC_SEQ : '\\' ('\''|'"'|'='|'$'|'#'|'\\'|'a'|'b'|'f'|'n'|'r'|'t'|'v') | UNICODE_ESC | OCTAL_ESC ; BOUNDED_VARIABLE: '$' '{' UNBOUNDED_STRING '}'; UNBOUNDED_VARIABLE: '$' LIMITED_UNBOUNDED_STRING; STRING_CHAR: .; fragment UNICODE_ESC : '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT ; fragment OCTAL_ESC : '\\' ('0'..'3') ('0'..'7') ('0'..'7') | '\\' ('0'..'7') ('0'..'7') | '\\' ('0'..'7') ; fragment UNBOUNDED_STRING: ~[{}]+; fragment LIMITED_UNBOUNDED_STRING: ('_' | LETTER) ('_' | LETTER | DIGIT)*; fragment LETTER: 'a'..'z' | 'A'..'Z'; fragment DIGIT: '0'..'9'; fragment HEX_DIGIT: ('0'..'9'|'a'..'f'|'A'..'F');
data/wildPokemon/route2.asm
adhi-thirumala/EvoYellow
0
14698
Route2Mons: db $19 db 3,RATTATA db 5,TOGEPI db 4,PIDGEY db 4,NIDORAN_M db 4,NIDORAN_F db 5,SANDSHREW db 6,ZUBAT db 6,MANKEY db 7,RATTATA db 7,PIDGEY db $00
programs/oeis/007/A007584.asm
jmorken/loda
1
90047
; A007584: 9-gonal (or enneagonal) pyramidal numbers: a(n) = n*(n+1)*(7*n-4)/6. ; 0,1,10,34,80,155,266,420,624,885,1210,1606,2080,2639,3290,4040,4896,5865,6954,8170,9520,11011,12650,14444,16400,18525,20826,23310,25984,28855,31930,35216,38720,42449,46410,50610,55056,59755,64714,69940,75440,81221,87290,93654,100320,107295,114586,122200,130144,138425,147050,156026,165360,175059,185130,195580,206416,217645,229274,241310,253760,266631,279930,293664,307840,322465,337546,353090,369104,385595,402570,420036,438000,456469,475450,494950,514976,535535,556634,578280,600480,623241,646570,670474,694960,720035,745706,771980,798864,826365,854490,883246,912640,942679,973370,1004720,1036736,1069425,1102794,1136850,1171600,1207051,1243210,1280084,1317680,1356005,1395066,1434870,1475424,1516735,1558810,1601656,1645280,1689689,1734890,1780890,1827696,1875315,1923754,1973020,2023120,2074061,2125850,2178494,2232000,2286375,2341626,2397760,2454784,2512705,2571530,2631266,2691920,2753499,2816010,2879460,2943856,3009205,3075514,3142790,3211040,3280271,3350490,3421704,3493920,3567145,3641386,3716650,3792944,3870275,3948650,4028076,4108560,4190109,4272730,4356430,4441216,4527095,4614074,4702160,4791360,4881681,4973130,5065714,5159440,5254315,5350346,5447540,5545904,5645445,5746170,5848086,5951200,6055519,6161050,6267800,6375776,6484985,6595434,6707130,6820080,6934291,7049770,7166524,7284560,7403885,7524506,7646430,7769664,7894215,8020090,8147296,8275840,8405729,8536970,8669570,8803536,8938875,9075594,9213700,9353200,9494101,9636410,9780134,9925280,10071855,10219866,10369320,10520224,10672585,10826410,10981706,11138480,11296739,11456490,11617740,11780496,11944765,12110554,12277870,12446720,12617111,12789050,12962544,13137600,13314225,13492426,13672210,13853584,14036555,14221130,14407316,14595120,14784549,14975610,15168310,15362656,15558655,15756314,15955640,16156640,16359321,16563690,16769754,16977520,17186995,17398186,17611100,17825744,18042125 mov $3,$0 lpb $0 sub $0,1 add $2,$3 add $1,$2 add $3,4 lpe
src/epl.ads
OneWingedShark/Risi
1
30086
Pragma Ada_2012; Pragma Wide_Character_Encoding( UTF8 ); With Ada.Strings.UTF_Encoding.Wide_Wide_Strings, Ada.Strings.UTF_Encoding.Wide_Strings, Ada.Strings.UTF_Encoding.Strings, Ada.IO_Exceptions; with Ada.Strings.UTF_Encoding; -- Edward Parse Library. -- -- ©2015 <NAME>; All Rights Reserved. Package EPL with Pure is -- Subtype Renaming of string-types. subtype UTF_08 is Ada.Strings.UTF_Encoding.UTF_8_String; subtype UTF_16 is Ada.Strings.UTF_Encoding.UTF_16_Wide_String; subtype UTF_32 is Wide_Wide_String; Format_Error : Exception renames Ada.IO_Exceptions.Data_Error; Parse_Error : Exception; End EPL;
oeis/028/A028201.asm
neoneye/loda-programs
11
1047
; A028201: Expansion of 1/((1-6x)(1-7x)(1-8x)(1-10x)). ; Submitted by <NAME> ; 1,31,605,9515,131901,1684011,20303725,234831355,2632942301,28828462091,309891463245,3283433875995,34394321024701,357022927273771,3679144385477165,37693176577349435,384361331408659101 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,20838 ; Expansion of 1/((1-7x)(1-8x)(1-10x)). sub $0,$1 mul $1,7 add $1,$0 lpe mov $0,$1
oeis/111/A111408.asm
neoneye/loda-programs
11
22336
<reponame>neoneye/loda-programs ; A111408: f(f(n+1))-f(f(n)), where f(0)=0, and for m>0, f(m) = sigma(m) = A000203(m). ; Submitted by <NAME> ; 1,3,3,1,4,16,-13,9,-10,25,-11,28,-32,36,0,-28,7,17,-14,54,-33,28,-31,108,-136,64,-6,30,-48,123,-132,41,20,-4,4,-12,-52,108,-48,114,-138,156,-168,140,-56,27,-71,100,-144,48,67,-24,-51,240,-165,165,-174,48,-66,312,-384,156,-42,-82,96,179,-277,186 mov $4,2 mov $6,$0 lpb $4 sub $4,1 add $0,$4 sub $0,1 mov $2,$0 max $2,0 seq $2,51027 ; a(n) = sigma(sigma(n)) = sum of the divisors of the sum of the divisors of n. mov $3,$4 mul $3,$2 add $1,$3 mov $5,$2 lpe min $6,1 mul $6,$5 sub $1,$6 mov $0,$1
src/linux_joystick.adb
alkhimey/Ada_Joystick
9
30293
<filename>src/linux_joystick.adb -- The MIT License (MIT) -- -- Copyright (c) 2016 <EMAIL> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- -- with Ada.Sequential_IO; with Ada.Directories; package body Linux_Joystick is type Axis_Button_Number_Type is range 0..(2**8)-1; for Axis_Button_Number_Type'Size use 8; type Raw_Js_Event_Type is record Time : Milliseconds_Type; Value : Value_Type; Is_Init_Event : Boolean; Event_Type : Event_Type_Type; Axis_Button_Number : Axis_Button_Number_Type; end record; for Raw_Js_Event_Type use record Time at 0 range 0..31; Value at 4 range 0..15; Is_Init_Event at 6 range 0..0; Event_Type at 6 range 1..7; Axis_Button_Number at 7 range 0..7; end record; for Raw_Js_Event_Type'Bit_Order use System.High_Order_First; -- TODO: veriy that this is enough package SIO is new Ada.Sequential_IO(Raw_Js_Event_Type); Input_File : SIO.File_Type; procedure Open(Name : String) is begin SIO.Open (File => Input_File, Mode => SIO.IN_FILE, Name => Name); end; function Open return String is Search : Ada.Directories.Search_Type; Dir_Ent : Ada.Directories.Directory_Entry_Type; begin Ada.Directories.Start_Search (Search, "/dev/input/", "js*"); if not Ada.Directories.More_Entries (Search) then Ada.Directories.End_Search (Search); raise No_Joystick_Device_Found; end if; Ada.Directories.Get_Next_Entry (Search, Dir_Ent); declare Device_Path : String := Ada.Directories.Full_Name (Dir_Ent); begin Ada.Directories.End_Search (Search); Open(Device_Path); return Device_Path; end; end; function Read return Js_Event_Type is Raw_Js_Event : Raw_Js_Event_Type; begin SIO.Read(File => Input_File, Item => Raw_Js_Event); case Raw_Js_Event.Event_Type is when JS_EVENT_BUTTON => return (Event_Type => JS_EVENT_BUTTON, Time => Raw_Js_Event.Time, Is_Init_Event => Raw_Js_Event.Is_Init_Event, Button => Button_Type'Val(Raw_Js_Event.Axis_Button_Number), Button_Action => Button_Action_Type'Val(Raw_Js_Event.Value) ); when JS_EVENT_AXIS => return (Event_Type => JS_EVENT_AXIS, Time => Raw_Js_Event.Time, Is_Init_Event => Raw_Js_Event.Is_Init_Event, Axis => Axis_Type'Val(Raw_Js_Event.Axis_Button_Number), Value => Raw_Js_Event.Value ); end case; end; procedure Close is begin SIO.Close(Input_File); end; end Linux_Joystick;
oeis/090/A090613.asm
neoneye/loda-programs
11
19168
<filename>oeis/090/A090613.asm ; A090613: Numbers k such that the k-th prime is congruent to 3 mod 7. ; Submitted by <NAME>(s1) ; 2,7,11,17,21,26,37,46,49,53,57,61,64,71,73,80,92,98,103,106,114,118,121,137,138,145,148,160,166,168,175,186,188,190,196,204,206,210,215,218,232,236,243,248,255,258,263,265,273,281,289,292,296,316,321,334 seq $0,45437 ; Primes congruent to 3 mod 7. sub $0,1 seq $0,230980 ; Number of primes <= n, starting at n=0. add $0,1
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca_notsx.log_64_1217.asm
ljhsiun2/medusa
9
23536
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r8 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x1916d, %r12 and %r8, %r8 mov (%r12), %r13 nop nop cmp $44934, %rbp lea addresses_normal_ht+0x13ead, %r10 nop nop nop nop nop sub %r9, %r9 movl $0x61626364, (%r10) nop nop nop nop nop cmp $36233, %r12 lea addresses_UC_ht+0x16ead, %rsi lea addresses_D_ht+0x21dd, %rdi nop add $53680, %rbx mov $32, %rcx rep movsw nop nop nop xor %rcx, %rcx lea addresses_WT_ht+0x10bad, %r12 clflush (%r12) nop nop nop nop nop dec %rcx movw $0x6162, (%r12) xor %r8, %r8 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r8 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r14 push %r8 push %rbp push %rcx // Store lea addresses_D+0x1eaab, %r11 nop nop nop dec %r14 mov $0x5152535455565758, %rbp movq %rbp, (%r11) nop nop nop nop inc %r14 // Store lea addresses_US+0xb4ad, %r10 clflush (%r10) sub %r13, %r13 mov $0x5152535455565758, %r11 movq %r11, %xmm0 vmovups %ymm0, (%r10) nop nop xor $17022, %rbp // Store lea addresses_WC+0xefad, %r14 nop nop nop sub $32185, %r10 movw $0x5152, (%r14) xor %rcx, %rcx // Faulty Load lea addresses_US+0x6bad, %r13 nop xor $11100, %r11 vmovups (%r13), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %rbp lea oracles, %r11 and $0xff, %rbp shlq $12, %rbp mov (%r11,%rbp,1), %rbp pop %rcx pop %rbp pop %r8 pop %r14 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10}} {'00': 64} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
contexts.agda
hazelgrove/hazelnut-agda
0
4831
<filename>contexts.agda open import Prelude open import Nat module contexts where -- variables are named with naturals in ė. therefore we represent -- contexts as functions from names for variables (nats) to possible -- bindings. _ctx : Set → Set A ctx = Nat → Maybe A -- convenient shorthand for the (unique up to fun. ext.) empty context ∅ : {A : Set} → A ctx ∅ _ = None infixr 100 ■_ -- the domain of a context is those naturals which cuase it to emit some τ dom : {A : Set} → A ctx → Nat → Set dom {A} Γ x = Σ[ τ ∈ A ] (Γ x == Some τ) -- membership, or presence, in a context _∈_ : {A : Set} (p : Nat × A) → (Γ : A ctx) → Set (x , y) ∈ Γ = (Γ x) == Some y -- this packages up an appeal to context memebership into a form that -- lets us retain more information ctxindirect : {A : Set} (Γ : A ctx) (n : Nat) → Σ[ a ∈ A ] (Γ n == Some a) + (Γ n == None) ctxindirect Γ n with Γ n ctxindirect Γ n | Some x = Inl (x , refl) ctxindirect Γ n | None = Inr refl -- apartness for contexts _#_ : {A : Set} (n : Nat) → (Γ : A ctx) → Set x # Γ = (Γ x) == None -- disjoint contexts are those which share no mappings _##_ : {A : Set} → A ctx → A ctx → Set _##_ {A} Γ Γ' = ((n : Nat) → dom Γ n → n # Γ') × ((n : Nat) → dom Γ' n → n # Γ) -- contexts give at most one binding for each variable ctxunicity : {A : Set} → {Γ : A ctx} {n : Nat} {t t' : A} → (n , t) ∈ Γ → (n , t') ∈ Γ → t == t' ctxunicity {n = n} p q with natEQ n n ctxunicity p q | Inl refl = someinj (! p · q) ctxunicity _ _ | Inr x≠x = abort (x≠x refl) -- warning: this is union, but it assumes WITHOUT CHECKING that the -- domains are disjoint. this is inherently asymmetric, and that's -- reflected throughout the development that follows _∪_ : {A : Set} → A ctx → A ctx → A ctx (C1 ∪ C2) x with C1 x (C1 ∪ C2) x | Some x₁ = Some x₁ (C1 ∪ C2) x | None = C2 x -- the singleton context ■_ : {A : Set} → (Nat × A) → A ctx (■ (x , a)) y with natEQ x y (■ (x , a)) .x | Inl refl = Some a ... | Inr _ = None -- context extension -- Note that if x is not apart from Γ, this relies on the asymmetry -- of union to set Γ x = t. _,,_ : {A : Set} → A ctx → (Nat × A) → A ctx (Γ ,, (x , t)) = (■ (x , t)) ∪ Γ infixl 10 _,,_ extend-empty : {A : Set} (x : Nat) (t : A) → ∅ ,, (x , t) == ■ (x , t) extend-empty x t = funext eq where eq : (y : Nat) → (∅ ,, (x , t)) y == (■ (x , t)) y eq y with natEQ x y ... | Inl refl = refl ... | Inr x≠y = refl -- used below in proof of ∪ commutativity and associativity lem-dom-union1 : {A : Set} {C1 C2 : A ctx} {x : Nat} → C1 ## C2 → dom C1 x → (C1 ∪ C2) x == C1 x lem-dom-union1 {A} {C1} {C2} {x} (d1 , d2) D with C1 x lem-dom-union1 (d1 , d2) D | Some x₁ = refl lem-dom-union1 (d1 , d2) D | None = abort (somenotnone (! (π2 D))) lem-dom-union2 : {A : Set} {C1 C2 : A ctx} {x : Nat} → C1 ## C2 → dom C1 x → (C2 ∪ C1) x == C1 x lem-dom-union2 {A} {C1} {C2} {x} (d1 , d2) D with ctxindirect C2 x lem-dom-union2 {A} {C1} {C2} {x} (d1 , d2) D | Inl x₁ = abort (somenotnone (! (π2 x₁) · d1 x D )) lem-dom-union2 {A} {C1} {C2} {x} (d1 , d2) D | Inr x₁ with C2 x lem-dom-union2 (d1 , d2) D | Inr x₂ | Some x₁ = abort (somenotnone x₂) lem-dom-union2 (d1 , d2) D | Inr x₁ | None = refl -- if the contexts in question are disjoint, then union is commutative ∪comm : {A : Set} → (C1 C2 : A ctx) → C1 ## C2 → (C1 ∪ C2) == (C2 ∪ C1) ∪comm C1 C2 (d1 , d2)= funext guts where lem-apart-union1 : {A : Set} (C1 C2 : A ctx) (x : Nat) → x # C1 → x # C2 → x # (C1 ∪ C2) lem-apart-union1 C1 C2 x apt1 apt2 with C1 x lem-apart-union1 C1 C2 x apt1 apt2 | Some x₁ = abort (somenotnone apt1) lem-apart-union1 C1 C2 x apt1 apt2 | None = apt2 lem-apart-union2 : {A : Set} (C1 C2 : A ctx) (x : Nat) → x # C1 → x # C2 → x # (C2 ∪ C1) lem-apart-union2 C1 C2 x apt1 apt2 with C2 x lem-apart-union2 C1 C2 x apt1 apt2 | Some x₁ = abort (somenotnone apt2) lem-apart-union2 C1 C2 x apt1 apt2 | None = apt1 guts : (x : Nat) → (C1 ∪ C2) x == (C2 ∪ C1) x guts x with ctxindirect C1 x | ctxindirect C2 x guts x | Inl (π1 , π2) | Inl (π3 , π4) = abort (somenotnone (! π4 · d1 x (π1 , π2))) guts x | Inl x₁ | Inr x₂ = tr (λ qq → qq == (C2 ∪ C1) x) (! (lem-dom-union1 (d1 , d2) x₁)) (tr (λ qq → C1 x == qq) (! (lem-dom-union2 (d1 , d2) x₁)) refl) guts x | Inr x₁ | Inl x₂ = tr (λ qq → (C1 ∪ C2) x == qq) (! (lem-dom-union1 (d2 , d1) x₂)) (tr (λ qq → qq == C2 x) (! (lem-dom-union2 (d2 , d1) x₂)) refl) guts x | Inr x₁ | Inr x₂ = tr (λ qq → qq == (C2 ∪ C1) x) (! (lem-apart-union1 C1 C2 x x₁ x₂)) (tr (λ qq → None == qq) (! (lem-apart-union2 C1 C2 x x₁ x₂)) refl) -- an element in the left of a union is in the union x∈∪l : {A : Set} → (Γ Γ' : A ctx) (n : Nat) (x : A) → (n , x) ∈ Γ → (n , x) ∈ (Γ ∪ Γ') x∈∪l Γ Γ' n x xin with Γ n x∈∪l Γ Γ' n x₁ xin | Some x = xin x∈∪l Γ Γ' n x () | None -- an element in the right of a union is in the union as long as it is not in the left; -- this asymmetry reflects the asymmetry in the definition of union x∈∪r : {A : Set} → (Γ Γ' : A ctx) (n : Nat) (x : A) → (n , x) ∈ Γ' → n # Γ → (n , x) ∈ (Γ ∪ Γ') x∈∪r Γ Γ' n x nx∈ apt with Γ n ... | None = nx∈ -- an element is in the context formed with just itself x∈■ : {A : Set} (n : Nat) (a : A) → (n , a) ∈ (■ (n , a)) x∈■ n a with natEQ n n x∈■ n a | Inl refl = refl x∈■ n a | Inr x = abort (x refl) -- if an index is in the domain of a singleton context, it's the only -- index in the context lem-dom-eq : {A : Set} {y : A} {n m : Nat} → dom (■ (m , y)) n → n == m lem-dom-eq {n = n} {m = m} (π1 , π2) with natEQ m n lem-dom-eq (π1 , π2) | Inl refl = refl lem-dom-eq (π1 , π2) | Inr x = abort (somenotnone (! π2)) -- a singleton context formed with an index apart from a context is -- disjoint from that context lem-apart-sing-disj : {A : Set} {n : Nat} {a : A} {Γ : A ctx} → n # Γ → (■ (n , a)) ## Γ lem-apart-sing-disj {A} {n} {a} {Γ} apt = asd1 , asd2 where asd1 : (n₁ : Nat) → dom (■ (n , a)) n₁ → n₁ # Γ asd1 m d with lem-dom-eq d asd1 .n d | refl = apt asd2 : (n₁ : Nat) → dom Γ n₁ → n₁ # (■ (n , a)) asd2 m (π1 , π2) with natEQ n m asd2 .n (π1 , π2) | Inl refl = abort (somenotnone (! π2 · apt )) asd2 m (π1 , π2) | Inr x = refl -- the only index of a singleton context is in its domain lem-domsingle : {A : Set} (p : Nat) (q : A) → dom (■ (p , q)) p lem-domsingle p q with natEQ p p lem-domsingle p q | Inl refl = q , refl lem-domsingle p q | Inr x₁ = abort (x₁ refl) -- dual of above lem-disj-sing-apart : {A : Set} {n : Nat} {a : A} {Γ : A ctx} → (■ (n , a)) ## Γ → n # Γ lem-disj-sing-apart {A} {n} {a} {Γ} (d1 , d2) = d1 n (lem-domsingle n a) -- the singleton context can only produce one non-none result lem-insingeq : {A : Set} {x x' : Nat} {τ τ' : A} → (■ (x , τ)) x' == Some τ' → τ == τ' lem-insingeq {A} {x} {x'} {τ} {τ'} eq with lem-dom-eq (τ' , eq) lem-insingeq {A} {x} {.x} {τ} {τ'} eq | refl with natEQ x x lem-insingeq refl | refl | Inl refl = refl lem-insingeq eq | refl | Inr x₁ = abort (somenotnone (! eq)) -- if an index doesn't appear in a context, and the union of that context -- with a singleton does produce a result, it must have come from the singleton lem-apart-union-eq : {A : Set} {Γ : A ctx} {x x' : Nat} {τ τ' : A} → x' # Γ → (Γ ∪ ■ (x , τ)) x' == Some τ' → τ == τ' lem-apart-union-eq {A} {Γ} {x} {x'} {τ} {τ'} apart eq with Γ x' lem-apart-union-eq apart eq | Some x = abort (somenotnone apart) lem-apart-union-eq apart eq | None = lem-insingeq eq -- if an index not in a singleton context produces a result from that -- singleton unioned with another context, the result must have come from -- the other context lem-neq-union-eq : {A : Set} {Γ : A ctx} {x x' : Nat} {τ τ' : A} → x' ≠ x → (Γ ∪ ■ (x , τ)) x' == Some τ' → Γ x' == Some τ' lem-neq-union-eq {A} {Γ} {x} {x'} {τ} {τ'} neq eq with Γ x' lem-neq-union-eq neq eq | Some x = eq lem-neq-union-eq {A} {Γ} {x} {x'} {τ} {τ'} neq eq | None with natEQ x x' lem-neq-union-eq neq eq | None | Inl x₁ = abort ((flip neq) x₁) lem-neq-union-eq neq eq | None | Inr x₁ = abort (somenotnone (! eq)) -- extending a context with a new index produces the result paired with -- that index. ctx-top : {A : Set} → (Γ : A ctx) (n : Nat) (a : A) → (n # Γ) → (n , a) ∈ (Γ ,, (n , a)) ctx-top Γ n a apt with natEQ n n ... | Inl refl = refl ... | Inr n≠n = abort (n≠n refl) -- if a union of a singleton and a ctx produces no result, the argument -- index must be apart from the ctx and disequal to the index of the -- singleton lem-union-none : {A : Set} {Γ : A ctx} {a : A} {x x' : Nat} → (Γ ∪ ■ (x , a)) x' == None → (x ≠ x') × (x' # Γ) lem-union-none {A} {Γ} {a} {x} {x'} emp with ctxindirect Γ x' lem-union-none {A} {Γ} {a} {x} {x'} emp | Inl (π1 , π2) with Γ x' lem-union-none emp | Inl (π1 , π2) | Some x = abort (somenotnone emp) lem-union-none {A} {Γ} {a} {x} {x'} emp | Inl (π1 , π2) | None with natEQ x x' lem-union-none emp | Inl (π1 , π2) | None | Inl x₁ = abort (somenotnone (! π2)) lem-union-none emp | Inl (π1 , π2) | None | Inr x₁ = x₁ , refl lem-union-none {A} {Γ} {a} {x} {x'} emp | Inr y with Γ x' lem-union-none emp | Inr y | Some x = abort (somenotnone emp) lem-union-none {A} {Γ} {a} {x} {x'} emp | Inr y | None with natEQ x x' lem-union-none emp | Inr y | None | Inl refl = abort (somenotnone emp) lem-union-none emp | Inr y | None | Inr x₁ = x₁ , refl --- lemmas building up to a proof of associativity of ∪ ctxignore1 : {A : Set} (x : Nat) (C1 C2 : A ctx) → x # C1 → (C1 ∪ C2) x == C2 x ctxignore1 x C1 C2 apt with ctxindirect C1 x ctxignore1 x C1 C2 apt | Inl x₁ = abort (somenotnone (! (π2 x₁) · apt)) ctxignore1 x C1 C2 apt | Inr x₁ with C1 x ctxignore1 x C1 C2 apt | Inr x₂ | Some x₁ = abort (somenotnone (x₂)) ctxignore1 x C1 C2 apt | Inr x₁ | None = refl ctxignore2 : {A : Set} (x : Nat) (C1 C2 : A ctx) → x # C2 → (C1 ∪ C2) x == C1 x ctxignore2 x C1 C2 apt with ctxindirect C2 x ctxignore2 x C1 C2 apt | Inl x₁ = abort (somenotnone (! (π2 x₁) · apt)) ctxignore2 x C1 C2 apt | Inr x₁ with C1 x ctxignore2 x C1 C2 apt | Inr x₂ | Some x₁ = refl ctxignore2 x C1 C2 apt | Inr x₁ | None = x₁ ctxcollapse1 : {A : Set} → (C1 C2 C3 : A ctx) (x : Nat) → (x # C3) → (C2 ∪ C3) x == C2 x → (C1 ∪ (C2 ∪ C3)) x == (C1 ∪ C2) x ctxcollapse1 C1 C2 C3 x apt eq with C2 x ctxcollapse1 C1 C2 C3 x apt eq | Some x₁ with C1 x ctxcollapse1 C1 C2 C3 x apt eq | Some x₂ | Some x₁ = refl ctxcollapse1 C1 C2 C3 x apt eq | Some x₁ | None with C2 x ctxcollapse1 C1 C2 C3 x apt eq | Some x₂ | None | Some x₁ = refl ctxcollapse1 C1 C2 C3 x apt eq | Some x₁ | None | None = apt ctxcollapse1 C1 C2 C3 x apt eq | None with C1 x ctxcollapse1 C1 C2 C3 x apt eq | None | Some x₁ = refl ctxcollapse1 C1 C2 C3 x apt eq | None | None with C2 x ctxcollapse1 C1 C2 C3 x apt eq | None | None | Some x₁ = refl ctxcollapse1 C1 C2 C3 x apt eq | None | None | None = eq ctxcollapse2 : {A : Set} → (C1 C2 C3 : A ctx) (x : Nat) → (x # C2) → (C2 ∪ C3) x == C3 x → (C1 ∪ (C2 ∪ C3)) x == (C1 ∪ C3) x ctxcollapse2 C1 C2 C3 x apt eq with C1 x ctxcollapse2 C1 C2 C3 x apt eq | Some x₁ = refl ctxcollapse2 C1 C2 C3 x apt eq | None with C2 x ctxcollapse2 C1 C2 C3 x apt eq | None | Some x₁ = eq ctxcollapse2 C1 C2 C3 x apt eq | None | None = refl ctxcollapse3 : {A : Set} → (C1 C2 C3 : A ctx) (x : Nat) → (x # C2) → ((C1 ∪ C2) ∪ C3) x == (C1 ∪ C3) x ctxcollapse3 C1 C2 C3 x apt with C1 x ctxcollapse3 C1 C2 C3 x apt | Some x₁ = refl ctxcollapse3 C1 C2 C3 x apt | None with C2 x ctxcollapse3 C1 C2 C3 x apt | None | Some x₁ = abort (somenotnone apt) ctxcollapse3 C1 C2 C3 x apt | None | None = refl ∪assoc : {A : Set} (C1 C2 C3 : A ctx) → (C2 ## C3) → (C1 ∪ C2) ∪ C3 == C1 ∪ (C2 ∪ C3) ∪assoc C1 C2 C3 (d1 , d2) = funext guts where case2 : (x : Nat) → x # C3 → dom C2 x → ((C1 ∪ C2) ∪ C3) x == (C1 ∪ (C2 ∪ C3)) x case2 x apt dom = (ctxignore2 x (C1 ∪ C2) C3 apt) · ! (ctxcollapse1 C1 C2 C3 x apt (lem-dom-union1 (d1 , d2) dom)) case34 : (x : Nat) → x # C2 → ((C1 ∪ C2) ∪ C3) x == (C1 ∪ (C2 ∪ C3)) x case34 x apt = ctxcollapse3 C1 C2 C3 x apt · ! (ctxcollapse2 C1 C2 C3 x apt (ctxignore1 x C2 C3 apt)) guts : (x : Nat) → ((C1 ∪ C2) ∪ C3) x == (C1 ∪ (C2 ∪ C3)) x guts x with ctxindirect C2 x | ctxindirect C3 x guts x | Inl (π1 , π2) | Inl (π3 , π4) = abort (somenotnone (! π4 · d1 x (π1 , π2))) guts x | Inl x₁ | Inr x₂ = case2 x x₂ x₁ guts x | Inr x₁ | Inl x₂ = case34 x x₁ guts x | Inr x₁ | Inr x₂ = case34 x x₁ -- if x is apart from either part of a union, the answer comes from the other one lem-dom-union-apt1 : {A : Set} {Δ1 Δ2 : A ctx} {x : Nat} {y : A} → x # Δ1 → ((Δ1 ∪ Δ2) x == Some y) → (Δ2 x == Some y) lem-dom-union-apt1 {A} {Δ1} {Δ2} {x} {y} apt xin with Δ1 x lem-dom-union-apt1 apt xin | Some x₁ = abort (somenotnone apt) lem-dom-union-apt1 apt xin | None = xin lem-dom-union-apt2 : {A : Set} {Δ1 Δ2 : A ctx} {x : Nat} {y : A} → x # Δ2 → ((Δ1 ∪ Δ2) x == Some y) → (Δ1 x == Some y) lem-dom-union-apt2 {A} {Δ1} {Δ2} {x} {y} apt xin with Δ1 x lem-dom-union-apt2 apt xin | Some x₁ = xin lem-dom-union-apt2 apt xin | None = abort (somenotnone (! xin · apt)) -- if x is in the union , it is in one of the parts lem-dom-union : {A : Set} {Δ1 Δ2 : A ctx} {x : Nat} {y : A} → (x , y) ∈ (Δ1 ∪ Δ2) → ((x , y) ∈ Δ1) + ((x , y) ∈ Δ2) lem-dom-union {Δ1 = Δ1} {Δ2 = Δ2} {x = x} ∈∪ with Δ1 x ... | Some x₁ = Inl ∈∪ ... | None = Inr ∈∪ update : {A : Set} (Γ : A ctx) (x : Nat) (τ1 τ2 : A) → Γ ,, (x , τ1) ,, (x , τ2) == Γ ,, (x , τ2) update Γ x τ1 τ2 = funext eq where eq : (y : Nat) → (Γ ,, (x , τ1) ,, (x , τ2)) y == (Γ ,, (x , τ2)) y eq y with natEQ x y ... | Inl refl = refl ... | Inr x≠y with natEQ x y ... | Inl refl = abort (x≠y refl) ... | Inr x≠y' = refl
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sdcc_iy/esx_ide_get_lfn.asm
jpoikela/z88dk
640
6765
<gh_stars>100-1000 ; unsigned char esx_ide_get_lfn(struct esx_lfn *dir, struct esx_cat_entry *query) SECTION code_esxdos PUBLIC _esx_ide_get_lfn EXTERN l_esx_ide_get_lfn_callee _esx_ide_get_lfn: pop af pop hl pop de push de push hl push af jp l_esx_ide_get_lfn_callee
examples/AIM4/bag/Eq.agda
cruhland/agda
1,989
16453
<reponame>cruhland/agda module Eq where import Prelude open Prelude abstract data _=^=_ {a : Set} (x y : a) : Set1 where leibniz : ((P : a -> Set) -> P x <-> P y) -> x =^= y leibnizSubst : {a : Set} -> {x y : a} -> x =^= y -> (P : a -> Set) -> P x -> P y leibnizSubst (leibniz f) P p = iffLeft (f P) p leibnizRefl : {a : Set} -> {x : a} -> x =^= x leibnizRefl = leibniz (\_ -> iff id id) leibnizSym : {a : Set} -> {x y : a} -> x =^= y -> y =^= x leibnizSym (leibniz f) = leibniz (\P -> iff (iffRight (f P)) (iffLeft (f P)))
3d/interp.asm
arbruijn/d1dos
2
244691
;THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX ;SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO ;END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A ;ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS ;IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS ;SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE ;FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE ;CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS ;AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. ;COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. ; ; $Source: f:/miner/source/3d/rcs/interp.asm $ ; $Revision: 1.21 $ ; $Author: john $ ; $Date: 1994/10/26 23:57:49 $ ; ; Polygon object interpreter ; ; $Log: interp.asm $ ; Revision 1.21 1994/10/26 23:57:49 john ; Took out gr_inverse_table ; ; Revision 1.20 1994/09/26 14:43:31 matt ; Put in checks for faces with fewer than 3 vertices ; ; Revision 1.19 1994/09/09 14:24:14 matt ; Added support for glowing textures, to add engine glow to Descent. ; ; Revision 1.18 1994/08/26 16:42:03 matt ; Added check for how many textures used in an object ; ; Revision 1.17 1994/07/29 18:29:17 matt ; Use instance-by-angles code, instead of building matrix here ; ; Revision 1.16 1994/07/25 10:58:28 matt ; Fixed morph effect for new 3d point handling ; ; Revision 1.15 1994/07/25 00:00:07 matt ; Made 3d no longer deal with point numbers, but only with pointers. ; ; Revision 1.14 1994/07/22 17:57:59 matt ; Changed the name of the rod functions, and took out some debugging code ; ; Revision 1.13 1994/06/07 16:49:36 matt ; Made interpreter take lighting value as parm, rather than in global var ; ; Revision 1.12 1994/05/31 22:11:52 matt ; Fixed morphing object lighting ; ; Revision 1.11 1994/05/31 18:35:52 matt ; Added lighting back to polygon objects ; ; Revision 1.10 1994/05/31 16:03:55 matt ; Made uvls right for triangulated faces in morphing objects ; ; Revision 1.9 1994/05/30 22:48:34 matt ; Added support for morph effect ; ; Revision 1.8 1994/05/19 23:12:04 matt ; Support new uvl value ranges ; ; Revision 1.7 1994/04/29 15:39:46 matt ; Use ebx in one place because the assembler seemed to be using it anyway ; even though I typed just bx. ; ; Revision 1.6 1994/04/19 17:02:32 matt ; Made g3d_interp_outline var accessible by C ; ; Revision 1.5 1994/03/30 10:22:40 matt ; Added outline option for polygon models ; ; Revision 1.4 1994/03/25 18:23:51 matt ; Fixed a couple of subobject problems, and made g3_draw_polygon_model ; take a pointer to a list of angvecs for subobj animation. ; ; Revision 1.3 1994/03/18 16:07:57 matt ; Added subobject and rod bitmap opcodes ; ; Revision 1.2 1994/03/15 21:23:04 matt ; Added code ; ; Revision 1.1 1994/03/14 21:26:56 matt ; Initial revision ; ; .386 option oldstructs .nolist include types.inc include psmacros.inc include gr.inc include 3d.inc .list assume cs:_TEXT, ds:_DATA _DATA segment dword public USE32 'DATA' rcsid db "$Id: interp.asm 1.21 1994/10/26 23:57:49 john Exp $" align 4 ;table with address for each opcode opcode_table dd op_eof ;0 = eof dd op_defpoints ;1 = defpoints dd op_flatpoly ;2 = flat-shaded polygon dd op_tmappoly ;3 = texture-mapped polygon dd op_sortnorm ;4 = sort by normal dd op_rodbm ;5 = rod bitmap dd op_subcall ;6 = call a subobject dd op_defp_start ;7 = defpoints with start dd op_glow ;8 = glow value for next poly n_opcodes = ($-opcode_table)/4 bitmap_ptr dd ? anim_angles dd ? ;pointer to angle data morph_points dd ? ;alternate points for morph ;light value for the next tmap glow_num dd -1 ;-1 means off glow_values dd ? ;ptr to array of values public _highest_texture_num _highest_texture_num dw 0 zero_angles fixang 0,0,0 ;vms_angvec <0,0,0> ;for if no angles specified rod_top_p g3s_point <> rod_bot_p g3s_point <> ifndef NDEBUG public g3d_interp_outline,_g3d_interp_outline _g3d_interp_outline label dword g3d_interp_outline dd 0 endif morph_pointlist dd ?,?,? morph_uvls fix 3 dup (?,?,?) ;the light for the current model model_light fix ? ;ptr to array of points Interp_point_list dd ? MAX_POINTS_PER_POLY = 25 point_list dd MAX_POINTS_PER_POLY dup (?) _DATA ends _TEXT segment dword public USE32 'CODE' ;get and jump to next opcode next macro xor ebx,ebx mov bx,[ebp] ifndef NDEBUG cmp ebx,n_opcodes break_if ge,'Invalid opcode' endif mov ebx,opcode_table[ebx*4] jmp ebx endm ;get and call the next opcode call_next macro xor ebx,ebx mov bx,[ebp] ifndef NDEBUG cmp ebx,n_opcodes break_if ge,'Invalid opcode' endif mov ebx,opcode_table[ebx*4] call ebx endm ;give the interpreter an array of points to use g3_set_interp_points: mov Interp_point_list,eax ret ;interpreter to draw polygon model ;takes esi=ptr to object, edi=ptr to array of bitmap pointers, ;eax=ptr to anim angles, edx=light value, ebx=ptr to array of glow values g3_draw_polygon_model: pushm eax,ebx,ecx,edx,esi,edi,ebp mov ebp,esi ;ebp = interp ptr mov bitmap_ptr,edi ;save ptr to bitmap array mov anim_angles,eax mov model_light,edx mov glow_values,ebx mov glow_num,-1 ;;@@ mov depth,0 call_next popm eax,ebx,ecx,edx,esi,edi,ebp ret ;handlers for opcodes ;end of a model or sub-rountine op_eof: ret ;define a list of points op_defpoints: xor ecx,ecx mov cx,2[ebp] ;num points mov edi,Interp_point_list lea esi,4[ebp] rotate_loop: call g3_rotate_point add edi,size g3s_point add esi,size vms_vector dec ecx jnz rotate_loop mov ebp,esi next ;define a list of points, with starting point num specified op_defp_start: xor ecx,ecx xor eax,eax mov ax,w 4[ebp] ;starting point num imulc eax,size(g3s_point) ;get ofs of point ;changed the above line from "size g3s_point" to "size(g3s_point)" to make the compiler happy -KRB add eax,Interp_point_list mov edi,eax mov cx,2[ebp] ;num points lea esi,8[ebp] jmp rotate_loop next ;draw a flat-shaded polygon op_flatpoly: xor ecx,ecx mov cx,2[ebp] ;num verts lea esi,4[ebp] ;point lea edi,16[ebp] ;vector call g3_check_normal_facing jng flat_not_facing ;polygon is facing, so draw it xor eax,eax mov ax,28[ebp] ;get color call gr_setcolor_ ;set it lea esi,30[ebp] ;point number list ;make list of point pointers ifndef NDEBUG cmp ecx,MAX_POINTS_PER_POLY break_if ge,'Too many points in interp poly' endif lea edi,point_list xor ebx,ebx copy_loop: xor eax,eax mov ax,w [esi+ebx*2] ;get point number imulc eax,size(g3s_point);Modified to add Parentheses -KRB add eax,Interp_point_list mov [edi+ebx*4],eax inc ebx cmp ebx,ecx jne copy_loop mov esi,edi call g3_draw_poly xor ecx,ecx mov cx,2[ebp] ;restore count ifndef NDEBUG test g3d_interp_outline,-1 jz no_outline pushm ecx,esi lea esi,30[ebp] call draw_outline popm ecx,esi no_outline: endif ;polygon is not facing (or we've plotted it). jump to next opcode flat_not_facing: and ecx,0fffffffeh inc ecx ;adjust for pad lea ebp,30[ebp+ecx*2] next ;set the glow value for the next tmap op_glow: test glow_values,-1 jz skip_glow xor eax,eax mov ax,2[ebp] mov glow_num,eax skip_glow: add ebp,4 next ;draw a texture map op_tmappoly: xor ecx,ecx mov cx,2[ebp] ;num verts lea esi,4[ebp] ;point lea edi,16[ebp] ;normal call g3_check_normal_facing jng tmap_not_facing ;polygon is facing, so draw it xor edx,edx mov dx,28[ebp] ;get bitmap number mov eax,bitmap_ptr mov edx,[eax+edx*4] lea esi,30[ebp] ;point number list mov eax,ecx and eax,0fffffffeh inc eax lea ebx,30[ebp+eax*2] ;get uvl list ;calculate light from surface normal push esi test glow_num,-1 ;glow override? js no_glow ;special glow lighting, which doesn't care about surface normal mov eax,glow_num mov esi,glow_values mov eax,[esi+eax*4] mov glow_num,-1 jmp got_light_value no_glow: lea esi,View_matrix.fvec lea edi,16[ebp] ;normal call vm_vec_dotprod neg eax ;scale light by model light push edx mov edx,eax add eax,eax add eax,edx ;eax *= 3 sar eax,2 ;eax *= 3/4 add eax,f1_0/4 ;eax = 1/4 + eax * 3/4 fixmul model_light pop edx ;now poke light into l values got_light_value: pushm ecx,ebx l_loop: mov 8[ebx],eax add ebx,12 dec ecx jnz l_loop popm ecx,ebx pop esi ;now draw it ;make list of point pointers ifndef NDEBUG cmp ecx,MAX_POINTS_PER_POLY break_if ge,'Too many points in interp poly' endif push ebx lea edi,point_list xor ebx,ebx copy_loop2: xor eax,eax mov ax,w [esi+ebx*2] ;get point number imulc eax,size(g3s_point);;Modified to add Parentheses -KRB add eax,Interp_point_list mov [edi+ebx*4],eax inc ebx cmp ebx,ecx jne copy_loop2 mov esi,edi pop ebx call g3_draw_tmap xor ecx,ecx mov cx,2[ebp] ;restore count ifndef NDEBUG test g3d_interp_outline,-1 jz no_outline2 pushm ecx,esi lea esi,30[ebp] call draw_outline popm ecx,esi no_outline2: endif ;polygon is not facing (or we've plotted it). jump to next opcode tmap_not_facing: mov ebx,ecx and ebx,0fffffffeh inc ebx ;adjust for pad lea ebp,30[ebp+ebx*2] mov eax,ecx sal ecx,1 add ecx,eax sal ecx,2 ;ecx=ecx*12 add ebp,ecx ;point past uvls next ;sort based on surface normal op_sortnorm: lea esi,16[ebp] ;point lea edi,4[ebp] ;vector call g3_check_normal_facing jng sortnorm_not_facing ;is facing. draw back then front push ebp xor eax,eax mov ax,30[ebp] ;get back offset add ebp,eax call_next mov ebp,[esp] ;get ebp xor eax,eax mov ax,28[ebp] ;get front offset add ebp,eax call_next pop ebp lea ebp,32[ebp] next ;is not facing. draw front then back sortnorm_not_facing: push ebp xor eax,eax mov ax,28[ebp] ;get back offset add ebp,eax call_next mov ebp,[esp] ;get ebp xor eax,eax mov ax,30[ebp] ;get front offset add ebp,eax call_next pop ebp lea ebp,32[ebp] next ;draw a rod bitmap op_rodbm: lea esi,20[ebp] ;bot point lea edi,rod_bot_p call g3_rotate_point lea esi,4[ebp] ;top point lea edi,rod_top_p call g3_rotate_point lea esi,rod_bot_p ;esi=bot, edi=top mov eax,16[ebp] ;bot width mov edx,32[ebp] ;top width xor ebx,ebx mov bx,2[ebp] ;get bitmap number mov ecx,bitmap_ptr mov ebx,[ecx+ebx*4] call g3_draw_rod_tmap lea ebp,36[ebp] next ;draw a subobject op_subcall: xor eax,eax mov ax,2[ebp] ;get object number ;get ptr to angles mov edi,anim_angles or edi,edi jnz angles_not_null ;angles not specified. Use zero angles lea edi,zero_angles jmp got_angles angles_not_null: imulc eax,size(vms_angvec);Modified to add Parentheses -KRB add edi,eax got_angles: ;angles in edi lea esi,4[ebp] ;get position call g3_start_instance_angles push ebp xor eax,eax mov ax,16[ebp] add ebp,eax ;offset of subobject call_next ;draw the subobject pop ebp call g3_done_instance lea ebp,20[ebp] next ;initialize a polygon object ;translate colors, scale UV values ;takes esi=ptr to model g3_init_polygon_model: mov _highest_texture_num,-1 pushm eax,ebx,ecx,edx,esi,edi call init_loop popm eax,ebx,ecx,edx,esi,edi ret init_loop: mov ax,[esi] ;get opcode cmp ax,0 ;eof jne not_eof ret not_eof: ;defpoints cmp ax,1 ;defpoints jne not_defpoints xor eax,eax mov ax,2[esi] ;get count sal eax,1 add ax,2[esi] ;*3 lea esi,4[esi+eax*4] jmp init_loop not_defpoints: ;flat polygon cmp ax,2 jne not_flatpoly ifndef NDEBUG cmp w 2[esi],3 break_if l,'face must have 3 or more points' endif ;NO_INVERSE_TABLE xor ebx,ebx ;NO_INVERSE_TABLE mov bx,28[esi] ;get color ;NO_INVERSE_TABLE xor eax,eax ;NO_INVERSE_TABLE mov al,gr_inverse_table[ebx] ;xlate it ; The following 3 lines replace the above xor eax, eax mov ax,28[esi] ;get color call gr_find_closest_color_15bpp_ mov 28[esi],ax ;store new color xor ecx,ecx mov cx,2[esi] ;get nverts and ecx,0fffffffeh inc ecx ;adjust for pad lea esi,30[esi+ecx*2] jmp init_loop not_flatpoly: ;tmap polygon cmp ax,3 jne not_tmappoly ifndef NDEBUG cmp w 2[esi],3 break_if l,'face must have 3 or more points' endif mov ax,28[esi] ;get bitmap number cmp ax,_highest_texture_num jle not_new mov _highest_texture_num,ax not_new: xor ecx,ecx mov cx,2[esi] ;get nverts mov ebx,ecx and ebx,0fffffffeh inc ebx ;adjust for pad lea esi,30[esi+ebx*2] ;point at uvls imul ecx,12 ;size of uvls add esi,ecx ;skip them jmp init_loop ;;@@init_uv_loop: mov eax,[esi] ;get u ;;@@ imul eax,64 ;times bitmap w ;;@@ mov [esi],eax ;;@@ mov eax,4[esi] ;get v ;;@@ imul eax,64 ;times bitmap h ;;@@ mov 4[esi],eax ;;@@ add esi,12 ;point at next ;;@@ dec ecx ;;@@ jnz init_uv_loop ;;@@ jmp init_loop not_tmappoly: ;sort cmp ax,4 ;sortnorm jne not_sortnorm push esi xor eax,eax mov ax,28[esi] ;get front offset add esi,eax call init_loop mov esi,[esp] xor eax,eax mov ax,30[esi] ;get front offset add esi,eax call init_loop pop esi lea esi,32[esi] jmp init_loop not_sortnorm: cmp ax,5 jne not_rodbm add esi,36 jmp init_loop not_rodbm: cmp ax,6 jne not_subcall push esi xor eax,eax mov ax,16[esi] ;get subobj offset add esi,eax call init_loop pop esi add esi,20 jmp init_loop not_subcall: cmp ax,7 ;defpoints jne not_defpoints_st xor eax,eax mov ax,2[esi] ;get count sal eax,1 add ax,2[esi] ;*3 lea esi,8[esi+eax*4] jmp init_loop not_defpoints_st: cmp ax,8 jne not_glow add esi,4 jmp init_loop not_glow: debug_brk "Invalid opcode" jmp init_loop ;takes ecx=count, esi=ptr to point list draw_outline: pushm eax,ebx,ecx,edx,esi,edi ;NO_INVERSE_TABLE xor eax,eax ;NO_INVERSE_TABLE mov al,gr_inverse_table[7fffh] ;white mov eax, 255 ; bright white call gr_setcolor_ mov ebx,esi xor eax,eax mov ax,[ebx] ;get first point push eax ;save it outline_loop: xor esi,esi xor edi,edi mov si,[ebx] dec ecx jz done_loop mov di,2[ebx] push ebx imul esi,size g3s_point add esi,Interp_point_list imul edi,size g3s_point add edi,Interp_point_list call g3_draw_line pop ebx add ebx,2 jmp outline_loop done_loop: pop edi ;get first point back imul esi,size g3s_point add esi,Interp_point_list imul edi,size g3s_point add edi,Interp_point_list call g3_draw_line popm eax,ebx,ecx,edx,esi,edi ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Special code to draw morphing objects ;define a list of points morph_defpoints: xor ecx,ecx mov cx,2[ebp] ;num points mov edi,Interp_point_list lea esi,4[ebp] morph_rotate_list: lea eax,[ecx*2+ecx] ;eax=npoint * 3 lea esi,[esi+eax*4] ;point past points push esi mov esi,morph_points ;get alternate points morph_rotate_loop: call g3_rotate_point add edi,size g3s_point add esi,size vms_vector dec ecx jnz morph_rotate_loop pop esi ;restore pointer mov ebp,esi next ;define a list of points, with starting point num specified morph_defp_start: xor ecx,ecx xor eax,eax mov ax,w 4[ebp] ;starting point num imulc eax,size(g3s_point);Modified to add Parentheses -KRB ;get ofs of point add eax,Interp_point_list mov edi,eax mov cx,2[ebp] ;num points lea esi,8[ebp] jmp morph_rotate_list ;draw a flat-shaded polygon morph_flatpoly: xor ecx,ecx mov cx,2[ebp] ;num verts lea esi,4[ebp] ;point lea edi,16[ebp] ;vector ;set color xor eax,eax mov ax,28[ebp] ;get color call gr_setcolor_ ;set it ;check and draw lea esi,30[ebp] ;point number list xor eax,eax lodsw imulc eax,size(g3s_point);Modified to add Parentheses -KRB add eax,Interp_point_list mov morph_pointlist,eax xor eax,eax lodsw imulc eax,size(g3s_point);Modified to add Parentheses -KRB add eax,Interp_point_list mov morph_pointlist+4,eax xor eax,eax lodsw imulc eax,size(g3s_point);Modified to add Parentheses -KRB add eax,Interp_point_list mov morph_pointlist+8,eax cmp ecx,3 ;3 points is good! je flat_got3 sub ecx,2 ;tri count flat_tri_loop: xor edi,edi ;no normal, must compute pushm ecx,esi mov ecx,3 ;always draw triangle lea esi,morph_pointlist call g3_check_and_draw_poly popm ecx,esi mov eax,morph_pointlist+8 mov morph_pointlist+4,eax xor eax,eax lodsw imulc eax,size(g3s_point);Modified to add Parentheses -KRB add eax,Interp_point_list mov morph_pointlist+8,eax dec ecx jnz flat_tri_loop jmp flat_done_draw flat_got3: lea esi,morph_pointlist xor edi,edi ;no normal, must compute call g3_check_and_draw_poly flat_done_draw: xor ecx,ecx mov cx,2[ebp] ;restore count and ecx,0fffffffeh inc ecx ;adjust for pad lea ebp,30[ebp+ecx*2] next ;draw a texture map morph_tmappoly: xor ecx,ecx mov cx,2[ebp] ;num verts lea esi,4[ebp] ;point lea edi,16[ebp] ;normal ;get bitmap xor edx,edx mov dx,28[ebp] ;get bitmap number mov eax,bitmap_ptr mov edx,[eax+edx*4] lea esi,30[ebp] ;point number list mov eax,ecx and eax,0fffffffeh inc eax lea ebx,30[ebp+eax*2] ;get uvl list ;calculate light from surface normal push esi lea esi,View_matrix.fvec lea edi,16[ebp] ;normal call vm_vec_dotprod neg eax ;scale light by model light push edx mov edx,eax add eax,eax add eax,edx ;eax *= 3 sar eax,2 ;eax *= 3/4 add eax,f1_0/4 ;eax = 1/4 + eax * 3/4 fixmul model_light or eax,eax jge not_zero xor eax,eax not_zero: pop edx pop esi ;now eax=plane light value mov morph_uvls+8,eax mov morph_uvls+20,eax mov morph_uvls+32,eax xor eax,eax lodsw imulc eax,size(g3s_point);Modified to add Parentheses -KRB add eax,Interp_point_list mov morph_pointlist,eax xor eax,eax lodsw imulc eax,size(g3s_point);Modified to add Parentheses -KRB add eax,Interp_point_list mov morph_pointlist+4,eax xor eax,eax lodsw imulc eax,size(g3s_point);Modified to add Parentheses -KRB add eax,Interp_point_list mov morph_pointlist+8,eax cmp ecx,3 ;3 points is good! jl tmap_done_draw ;something is bad, abort je tmap_got3 sub ecx,2 ;tri count push edx mov edx,[ebx] mov morph_uvls,edx mov edx,4[ebx] mov morph_uvls+4,edx mov edx,12[ebx] mov morph_uvls+12,edx mov edx,16[ebx] mov morph_uvls+16,edx mov edx,24[ebx] mov morph_uvls+24,edx mov edx,28[ebx] mov morph_uvls+28,edx add ebx,3*12 pop edx tmap_tri_loop: xor edi,edi ;no normal, must compute pushm ebx,edx,ecx,esi mov ecx,3 ;always draw triangle lea esi,morph_pointlist lea ebx,morph_uvls call g3_check_and_draw_tmap popm ebx,edx,ecx,esi mov eax,morph_pointlist+8 mov morph_pointlist+4,eax xor eax,eax lodsw imulc eax,size(g3s_point);Modified to add Parentheses -KRB add eax,Interp_point_list mov morph_pointlist+8,eax push edx mov edx,morph_uvls+24 mov morph_uvls+12,edx mov edx,morph_uvls+28 mov morph_uvls+16,edx mov edx,[ebx] mov morph_uvls+24,edx mov edx,4[ebx] mov morph_uvls+28,edx add ebx,12 pop edx dec ecx jnz tmap_tri_loop jmp tmap_done_draw tmap_got3: ;poke in light values pusha tmap_l_loop: mov 8[ebx],eax add ebx,12 dec ecx jnz tmap_l_loop popa lea esi,morph_pointlist xor edi,edi ;no normal call g3_check_and_draw_tmap tmap_done_draw: xor ecx,ecx mov cx,2[ebp] ;restore count ;jump to next opcode mov ebx,ecx and ebx,0fffffffeh inc ebx ;adjust for pad lea ebp,30[ebp+ebx*2] mov eax,ecx sal ecx,1 add ecx,eax sal ecx,2 ;ecx=ecx*12 add ebp,ecx ;point past uvls next ;interpreter to draw polygon model ;takes esi=ptr to object, edi=ptr to array of bitmap pointers, ;eax=ptr to anim angles, ebx=alternate points, edx=light value g3_draw_morphing_model: pushm eax,ebx,ecx,edx,esi,edi,ebp mov bitmap_ptr,edi ;save ptr to bitmap array mov anim_angles,eax mov morph_points,ebx mov model_light,edx mov ebp,esi ;ebp = interp ptr ;set alternate opcode pointers push opcode_table[1*4] ;defpoints push opcode_table[2*4] ;flatpoly push opcode_table[3*4] ;tmappoly push opcode_table[7*4] ;defp_start mov opcode_table[1*4],offset morph_defpoints mov opcode_table[2*4],offset morph_flatpoly mov opcode_table[3*4],offset morph_tmappoly mov opcode_table[7*4],offset morph_defp_start call_next pop opcode_table[7*4] ;defp_start pop opcode_table[3*4] ;tmappoly pop opcode_table[2*4] ;flatpoly pop opcode_table[1*4] ;defpoints popm eax,ebx,ecx,edx,esi,edi,ebp ret _TEXT ends end
software/unused/generic_vector3d.ads
TUM-EI-RCS/StratoX
12
25742
<reponame>TUM-EI-RCS/StratoX -- Institution: Technische Universitaet Muenchen -- Department: Realtime Computer Systems (RCS) -- Project: StratoX -- -- Authors: <NAME> (<EMAIL>) -- -- Description: Generic vector package -- -- ToDo: -- [ ] Implementation with Ada.Numerics.Generic_Elementary_Functions; generic type Index_Type is (3); type Data_Type is Float; package Generic_Vector3D with SPARK_Mode is type Karthesian_Coordinate_Dimension_Type is (X, Y, Z); type Polar_Coordinate_Dimesion_Type is (Phi, Rho, Psi); type Earth_Coordinate_Dimension_Type is (LONGITUDE, LATITUDE, ALTITUDE); type Vector3D_Type is tagged array (Index_Type) of Float; type Karthesian_Vector_Type is record x : Data_Type; y : Data_Type; z : Data_Type; end record; function norm(vector : Karthesian_Vector_Type) return Data_Type; function "+" (Right : Vector3D_Type) return Vector3D_Type; function "-" (Right : Vector3D_Type) return Vector3D_Type; function "abs" (Right : Vector3D_Type) return Vector3D_Type; end Generic_Vector3D;
bb-runtimes/examples/tms570-leds/src/tms570-leds.ads
JCGobbi/Nucleo-STM32G474RE
0
28800
<filename>bb-runtimes/examples/tms570-leds/src/tms570-leds.ads ------------------------------------------------------------------------------ -- -- -- GNAT EXAMPLE -- -- -- -- Copyright (C) 2014, 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. -- -- -- ------------------------------------------------------------------------------ -- This file provides declarations for the user LEDs on the TMS570LS31 -- board from Texas Instruments. with TMS570.GPIO; use TMS570.GPIO; with System; package TMS570.LEDs is pragma Elaborate_Body; type User_LED is (Right_Top, Right, Left_Top, Bottom, Right_Bottom, Left, Left_Bottom, Top); for User_LED use (Right_Top => GPIO_Pin_0, Right => GPIO_Pin_5, Left_Top => GPIO_Pin_17, Bottom => GPIO_Pin_18, Right_Bottom => GPIO_Pin_25, Left => GPIO_Pin_27, Left_Bottom => GPIO_Pin_29, Top => GPIO_Pin_31); -- As a result of the representation clause, avoid iterating directly over -- the type since that will require an implicit lookup in the generated -- code of the loop. Such usage seems unlikely so this direct -- representation is reasonable, and efficient. for User_LED'Size use Word'Size; -- we convert the LED values to Word values in order to write them to -- the registers, so the size must be the same procedure On (This : User_LED); pragma Inline (On); procedure Off (This : User_LED); pragma Inline (Off); private HET_Port : GPIO_Register; pragma Volatile (HET_Port); for HET_Port'Address use System'To_Address (16#FFF7_B84C#); -- HET Port 1 pragma Import (Ada, HET_Port); end TMS570.LEDs;
src/AntlrTest.g4
andy-zhang-guohua/springboot-quickstart
0
4417
grammar AntlrTest; prog:stat+; stat: expr NEWLINE # print |ID '=' expr NEWLINE # assign |NEWLINE # blank ; expr:expr (MULTIPLY|DIVIDE) expr # MulDiv |expr (PLUS|MINUS) expr # AddSub |'('expr')' # Private |value # IdInt ; value:INT |ID ; MULTIPLY:'*'; DIVIDE:'/'; PLUS:'+'; MINUS:'-'; ID:[a-z]+; INT:[1-9]+; NEWLINE:'\r'?'\n'; WS:[ \t\r\n] -> skip;
thirdparty/adasdl/thin/adasdl/AdaSDL-from-glut/book/double_sprogs.ads
Lucretia/old_nehe_ada95
0
22939
with gl_h; use gl_h; package Double_Sprogs is spin : GLfloat := 0.0; -- =================================================================== procedure Spin_Display; -- =================================================================== procedure Null_Spin; end Double_Sprogs;
start.applescript
cerbero90/start
3
1296
# open Google Chrome in full screen mode tell application "Google Chrome" activate tell application "System Events" tell process "Chrome" keystroke "f" using {command down, control down} end tell end tell end tell # open Sublime Text in distraction-free mode delay 1 tell application "Sublime Text" activate delay 1.5 tell application "System Events" to set frontmost of process "Sublime Text" to true tell application "System Events" tell process "Sublime Text" keystroke "f" using {control down, shift down, command down} end tell end tell end tell # open the terminal in full screen mode and run Laravel Homestead delay 1.5 tell application "Terminal" tell application "System Events" to set frontmost of process "Terminal" to true tell application "System Events" tell process "Terminal" keystroke "f" using {command down, control down} end tell end tell do script "homestead up" in window 1 end tell # open SourceTree in full screen mode delay 1 tell application "SourceTree" activate tell application "System Events" to set frontmost of process "SourceTree" to true tell application "System Events" tell process "SourceTree" keystroke "f" using {control down, command down} end tell end tell end tell # focus on the Google Chrome window delay 1.5 tell application "System Events" to set frontmost of process "Chrome" to true
applescripts/iTerm.applescript
rkanter/Open-iTerm-or-Terminal-Here...
128
1011
tell application "Finder" if (count of windows) > 0 then set thePath to target of front window else display dialog "There are no open Finder windows." with icon caution buttons {"OK"} with title "Open iTerm Here..." return end if end tell if not (exists thePath) then tell application "Finder" to set theName to name of front window display dialog "The location of the Finder window \"" & theName & "\" is not a real location (e.g. smart folder, search, network, trash, etc) and cannot opened in iTerm." with icon caution buttons {"OK"} with title "Open iTerm Here..." return end if set thePath to quoted form of POSIX path of (thePath as alias) tell application "iTerm" -- Handles the case where iTerm is running but has no windows set createdWindow to false if it is running then if (count windows) is 0 then create window with default profile set createdWindow to true end if end if if not createdWindow then tell current window create tab with default profile tell current tab launch session tell the last session write text "cd " & thePath & " && clear" end tell end tell end tell end if activate end tell
unused/develop/obj/spritesheet_8.asm
pau-tomas/gbvm
33
95849
;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 4.1.4 #12246 (Mac OS X x86_64) ;-------------------------------------------------------- .module spritesheet_8 .optsdcc -mgbz80 ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- .globl _spritesheet_8 .globl _spritesheet_8_animations_lookup .globl _spritesheet_8_animations .globl _spritesheet_8_metasprites .globl _spritesheet_8_metasprite_7 .globl _spritesheet_8_metasprite_6 .globl _spritesheet_8_metasprite_5 .globl _spritesheet_8_metasprite_4 .globl _spritesheet_8_metasprite_3 .globl _spritesheet_8_metasprite_2 .globl _spritesheet_8_metasprite_1 .globl _spritesheet_8_metasprite_0 .globl ___bank_spritesheet_8 ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _DATA ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _INITIALIZED ;-------------------------------------------------------- ; absolute external ram data ;-------------------------------------------------------- .area _DABS (ABS) ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- .area _HOME .area _GSINIT .area _GSFINAL .area _GSINIT ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- .area _HOME .area _HOME ;-------------------------------------------------------- ; code ;-------------------------------------------------------- .area _CODE_255 .area _CODE_255 ___bank_spritesheet_8 = 0x00ff _spritesheet_8_metasprite_0: .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x08 ; 8 .db #0x02 ; 2 .db #0x00 ; 0 .db #0x80 ; -128 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 _spritesheet_8_metasprite_1: .db #0x00 ; 0 .db #0x00 ; 0 .db #0x04 ; 4 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x08 ; 8 .db #0x06 ; 6 .db #0x00 ; 0 .db #0x80 ; -128 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 _spritesheet_8_metasprite_2: .db #0x00 ; 0 .db #0x00 ; 0 .db #0x08 ; 8 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x08 ; 8 .db #0x0a ; 10 .db #0x00 ; 0 .db #0x80 ; -128 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 _spritesheet_8_metasprite_3: .db #0x00 ; 0 .db #0x00 ; 0 .db #0x0c ; 12 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x08 ; 8 .db #0x0e ; 14 .db #0x00 ; 0 .db #0x80 ; -128 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 _spritesheet_8_metasprite_4: .db #0x00 ; 0 .db #0x00 ; 0 .db #0x10 ; 16 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x08 ; 8 .db #0x12 ; 18 .db #0x00 ; 0 .db #0x80 ; -128 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 _spritesheet_8_metasprite_5: .db #0x00 ; 0 .db #0x00 ; 0 .db #0x14 ; 20 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x08 ; 8 .db #0x16 ; 22 .db #0x00 ; 0 .db #0x80 ; -128 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 _spritesheet_8_metasprite_6: .db #0x00 ; 0 .db #0x00 ; 0 .db #0x12 ; 18 .db #0x20 ; 32 .db #0x00 ; 0 .db #0x08 ; 8 .db #0x10 ; 16 .db #0x20 ; 32 .db #0x80 ; -128 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 _spritesheet_8_metasprite_7: .db #0x00 ; 0 .db #0x00 ; 0 .db #0x16 ; 22 .db #0x20 ; 32 .db #0x00 ; 0 .db #0x08 ; 8 .db #0x14 ; 20 .db #0x20 ; 32 .db #0x80 ; -128 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 _spritesheet_8_metasprites: .dw _spritesheet_8_metasprite_0 .dw _spritesheet_8_metasprite_1 .dw _spritesheet_8_metasprite_2 .dw _spritesheet_8_metasprite_3 .dw _spritesheet_8_metasprite_4 .dw _spritesheet_8_metasprite_5 .dw _spritesheet_8_metasprite_6 .dw _spritesheet_8_metasprite_7 _spritesheet_8_animations: .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 .db #0x00 ; 0 _spritesheet_8_animations_lookup: .dw #0x0000 _spritesheet_8: .db #0x06 ; 6 .dw _spritesheet_8_metasprites .dw _spritesheet_8_animations .dw _spritesheet_8_animations_lookup .db #0x00 ; 0 .db #0x0f ; 15 .db #0xf8 ; -8 .db #0x07 ; 7 .byte ___bank_spritesheet_8_tiles .dw _spritesheet_8_tiles .db #0x00 ; 0 .dw #0x0000 .area _INITIALIZER .area _CABS (ABS)
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/slice3.adb
best08618/asylo
7
3969
<gh_stars>1-10 -- { dg-do run } procedure Slice3 is type Varray is array (1 .. 1) of Natural; -- SImode type Sample is record Maybe : Boolean; Values : Varray; end record; pragma Pack (Sample); function Match (X, Y: Sample; Length : Positive) return Boolean is begin return X.Values (1 .. Length) = Y.Values (1 .. Length); end; X, Y : Sample := (Maybe => True, Values => (1 => 1)); begin X.Maybe := False; if not Match (X, Y, 1) then raise Program_Error; end if; end;
oeis/032/A032911.asm
neoneye/loda-programs
11
99339
; A032911: Numbers whose set of base-4 digits is {1,3}. ; Submitted by <NAME> ; 1,3,5,7,13,15,21,23,29,31,53,55,61,63,85,87,93,95,117,119,125,127,213,215,221,223,245,247,253,255,341,343,349,351,373,375,381,383,469,471,477,479,501,503,509,511,853,855,861,863,885,887,893,895,981,983,989,991,1013,1015,1021,1023,1365,1367,1373,1375,1397,1399,1405,1407,1493,1495,1501,1503,1525,1527,1533,1535,1877,1879,1885,1887,1909,1911,1917,1919,2005,2007,2013,2015,2037,2039,2045,2047,3413,3415,3421,3423,3445,3447 mov $1,$0 mov $2,2 mov $3,1 lpb $0 div $0,$2 sub $0,1 mul $3,2 mov $4,$0 mul $4,$3 add $1,$4 mul $3,$2 lpe mov $0,$1 mul $0,2 add $0,1
oeis/189/A189749.asm
neoneye/loda-programs
11
9388
<filename>oeis/189/A189749.asm ; A189749: a(1)=5, a(2)=5, a(n)=5*a(n-1) + 5*a(n-2). ; Submitted by <NAME>(s4) ; 5,5,50,275,1625,9500,55625,325625,1906250,11159375,65328125,382437500,2238828125,13106328125,76725781250,449160546875,2629431640625,15392960937500,90111962890625,527524619140625,3088182910156250,18078537646484375,105833602783203125,619560702148437500,3626971524658203125,21232661134033203125,124298163293457031250,727654122137451171875,4259761427154541015625,24937077746459960937500,145984195868072509765625,854606368072662353515625,5002952819703674316406250,29287795938881683349609375 lpb $0 sub $0,1 add $1,1 mov $2,$3 add $3,$1 mov $1,$2 mul $3,5 lpe mov $0,$1 mul $0,9 add $0,5
oeis/145/A145218.asm
neoneye/loda-programs
11
86968
<reponame>neoneye/loda-programs ; A145218: a(n) is the self-convolution series of the sum of 5th powers of the first n natural numbers. ; 1,64,1510,17600,130835,713216,3098604,11320320,36074325,102925120,268038706,646519744,1460878055,3120396800,6346379480,12363588096,23184837609,42023883840,73881649150,126362703040,210792998011,343726413824,548946959300,860095808000,1324078004925,2005432992576,2991886397514,4401338138560,6390584224975,9166116981760,12997401258416,18233082850304,25320650305745,34830142939200,47482576667670,64183845694656,86064952558819,114529522132480,151309667302300,198531395809280,258790879600421 add $0,1 lpb $0 add $2,10 mov $3,$2 mul $3,$0 sub $0,1 pow $3,5 add $1,$3 lpe mov $0,$1 div $0,100000
XcodePlugin/Resources/CleanCovAndBuild.applescript
zhouweiminghn/google-toolbox-for-mac
544
4667
(* CleanCovAndBuild.applescript Copyright 2007-2009 Google Inc. 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. *) (* gets passed a list of args from Xcode only arg is the dir to clean under *) on run args -- get our dir to clean set cleanDir to item 1 of args -- get rid of all our gcov data files set shellScript to "find " & quoted form of (cleanDir) & " -name \"*.gcda\" -print0 | /usr/bin/xargs -0 /bin/rm -f" do shell script shellScript -- now tell xcode to compile tell application "Xcode" tell project of active project document build end tell end tell end run
+extras/external_libs/zlib/src/zlib-1.2.11/contrib/vstudio/vc14/x86/TestZlibDebug/Tmp/uncompr.asm
dkovari/ExtrasToolbox
0
27765
<reponame>dkovari/ExtrasToolbox<gh_stars>0 ; Listing generated by Microsoft (R) Optimizing Compiler Version 19.14.26428.1 TITLE C:\Users\dkovari\Documents\GitHub\ExtrasToolbox\+extras\external_libs\zlib\src\zlib-1.2.11\uncompr.c .686P .XMM include listing.inc .model flat INCLUDELIB MSVCRTD INCLUDELIB OLDNAMES PUBLIC _uncompress@16 PUBLIC _uncompress2@16 EXTRN _inflate@8:PROC EXTRN _inflateEnd@4:PROC EXTRN _inflateInit_@12:PROC _DATA SEGMENT $SG92679 DB '1.2.11', 00H _DATA ENDS ; Function compile flags: /Odtp ; File c:\users\dkovari\documents\github\extrastoolbox\+extras\external_libs\zlib\src\zlib-1.2.11\uncompr.c _TEXT SEGMENT _stream$ = -96 ; size = 56 tv95 = -40 ; size = 4 tv94 = -36 ; size = 4 tv93 = -32 ; size = 4 tv76 = -28 ; size = 4 tv72 = -24 ; size = 4 _max$ = -20 ; size = 4 _len$ = -16 ; size = 4 _left$ = -12 ; size = 4 _err$ = -8 ; size = 4 _buf$ = -1 ; size = 1 _dest$ = 8 ; size = 4 _destLen$ = 12 ; size = 4 _source$ = 16 ; size = 4 _sourceLen$ = 20 ; size = 4 _uncompress2@16 PROC ; 32 : { push ebp mov ebp, esp sub esp, 96 ; 00000060H ; 33 : z_stream stream; ; 34 : int err; ; 35 : const uInt max = (uInt)-1; mov DWORD PTR _max$[ebp], -1 ; 36 : uLong len, left; ; 37 : Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */ ; 38 : ; 39 : len = *sourceLen; mov eax, DWORD PTR _sourceLen$[ebp] mov ecx, DWORD PTR [eax] mov DWORD PTR _len$[ebp], ecx ; 40 : if (*destLen) { mov edx, DWORD PTR _destLen$[ebp] cmp DWORD PTR [edx], 0 je SHORT $LN5@uncompress ; 41 : left = *destLen; mov eax, DWORD PTR _destLen$[ebp] mov ecx, DWORD PTR [eax] mov DWORD PTR _left$[ebp], ecx ; 42 : *destLen = 0; mov edx, DWORD PTR _destLen$[ebp] mov DWORD PTR [edx], 0 ; 43 : } jmp SHORT $LN6@uncompress $LN5@uncompress: ; 44 : else { ; 45 : left = 1; mov DWORD PTR _left$[ebp], 1 ; 46 : dest = buf; lea eax, DWORD PTR _buf$[ebp] mov DWORD PTR _dest$[ebp], eax $LN6@uncompress: ; 47 : } ; 48 : ; 49 : stream.next_in = (z_const Bytef *)source; mov ecx, DWORD PTR _source$[ebp] mov DWORD PTR _stream$[ebp], ecx ; 50 : stream.avail_in = 0; mov DWORD PTR _stream$[ebp+4], 0 ; 51 : stream.zalloc = (alloc_func)0; mov DWORD PTR _stream$[ebp+32], 0 ; 52 : stream.zfree = (free_func)0; mov DWORD PTR _stream$[ebp+36], 0 ; 53 : stream.opaque = (voidpf)0; mov DWORD PTR _stream$[ebp+40], 0 ; 54 : ; 55 : err = inflateInit(&stream); push 56 ; 00000038H push OFFSET $SG92679 lea edx, DWORD PTR _stream$[ebp] push edx call _inflateInit_@12 mov DWORD PTR _err$[ebp], eax ; 56 : if (err != Z_OK) return err; cmp DWORD PTR _err$[ebp], 0 je SHORT $LN7@uncompress mov eax, DWORD PTR _err$[ebp] jmp $LN1@uncompress $LN7@uncompress: ; 57 : ; 58 : stream.next_out = dest; mov eax, DWORD PTR _dest$[ebp] mov DWORD PTR _stream$[ebp+12], eax ; 59 : stream.avail_out = 0; mov DWORD PTR _stream$[ebp+16], 0 $LN4@uncompress: ; 60 : ; 61 : do { ; 62 : if (stream.avail_out == 0) { cmp DWORD PTR _stream$[ebp+16], 0 jne SHORT $LN8@uncompress ; 63 : stream.avail_out = left > (uLong)max ? max : (uInt)left; mov ecx, DWORD PTR _left$[ebp] cmp ecx, DWORD PTR _max$[ebp] jbe SHORT $LN14@uncompress mov edx, DWORD PTR _max$[ebp] mov DWORD PTR tv72[ebp], edx jmp SHORT $LN15@uncompress $LN14@uncompress: mov eax, DWORD PTR _left$[ebp] mov DWORD PTR tv72[ebp], eax $LN15@uncompress: mov ecx, DWORD PTR tv72[ebp] mov DWORD PTR _stream$[ebp+16], ecx ; 64 : left -= stream.avail_out; mov edx, DWORD PTR _left$[ebp] sub edx, DWORD PTR _stream$[ebp+16] mov DWORD PTR _left$[ebp], edx $LN8@uncompress: ; 65 : } ; 66 : if (stream.avail_in == 0) { cmp DWORD PTR _stream$[ebp+4], 0 jne SHORT $LN9@uncompress ; 67 : stream.avail_in = len > (uLong)max ? max : (uInt)len; mov eax, DWORD PTR _len$[ebp] cmp eax, DWORD PTR _max$[ebp] jbe SHORT $LN16@uncompress mov ecx, DWORD PTR _max$[ebp] mov DWORD PTR tv76[ebp], ecx jmp SHORT $LN17@uncompress $LN16@uncompress: mov edx, DWORD PTR _len$[ebp] mov DWORD PTR tv76[ebp], edx $LN17@uncompress: mov eax, DWORD PTR tv76[ebp] mov DWORD PTR _stream$[ebp+4], eax ; 68 : len -= stream.avail_in; mov ecx, DWORD PTR _len$[ebp] sub ecx, DWORD PTR _stream$[ebp+4] mov DWORD PTR _len$[ebp], ecx $LN9@uncompress: ; 69 : } ; 70 : err = inflate(&stream, Z_NO_FLUSH); push 0 lea edx, DWORD PTR _stream$[ebp] push edx call _inflate@8 mov DWORD PTR _err$[ebp], eax ; 71 : } while (err == Z_OK); cmp DWORD PTR _err$[ebp], 0 je SHORT $LN4@uncompress ; 72 : ; 73 : *sourceLen -= len + stream.avail_in; mov eax, DWORD PTR _len$[ebp] add eax, DWORD PTR _stream$[ebp+4] mov ecx, DWORD PTR _sourceLen$[ebp] mov edx, DWORD PTR [ecx] sub edx, eax mov eax, DWORD PTR _sourceLen$[ebp] mov DWORD PTR [eax], edx ; 74 : if (dest != buf) lea ecx, DWORD PTR _buf$[ebp] cmp DWORD PTR _dest$[ebp], ecx je SHORT $LN10@uncompress ; 75 : *destLen = stream.total_out; mov edx, DWORD PTR _destLen$[ebp] mov eax, DWORD PTR _stream$[ebp+20] mov DWORD PTR [edx], eax jmp SHORT $LN11@uncompress $LN10@uncompress: ; 76 : else if (stream.total_out && err == Z_BUF_ERROR) cmp DWORD PTR _stream$[ebp+20], 0 je SHORT $LN11@uncompress cmp DWORD PTR _err$[ebp], -5 ; fffffffbH jne SHORT $LN11@uncompress ; 77 : left = 1; mov DWORD PTR _left$[ebp], 1 $LN11@uncompress: ; 78 : ; 79 : inflateEnd(&stream); lea ecx, DWORD PTR _stream$[ebp] push ecx call _inflateEnd@4 ; 80 : return err == Z_STREAM_END ? Z_OK : cmp DWORD PTR _err$[ebp], 1 jne SHORT $LN22@uncompress mov DWORD PTR tv95[ebp], 0 jmp SHORT $LN23@uncompress $LN22@uncompress: cmp DWORD PTR _err$[ebp], 2 jne SHORT $LN20@uncompress mov DWORD PTR tv94[ebp], -3 ; fffffffdH jmp SHORT $LN21@uncompress $LN20@uncompress: cmp DWORD PTR _err$[ebp], -5 ; fffffffbH jne SHORT $LN18@uncompress mov edx, DWORD PTR _left$[ebp] add edx, DWORD PTR _stream$[ebp+16] je SHORT $LN18@uncompress mov DWORD PTR tv93[ebp], -3 ; fffffffdH jmp SHORT $LN19@uncompress $LN18@uncompress: mov eax, DWORD PTR _err$[ebp] mov DWORD PTR tv93[ebp], eax $LN19@uncompress: mov ecx, DWORD PTR tv93[ebp] mov DWORD PTR tv94[ebp], ecx $LN21@uncompress: mov edx, DWORD PTR tv94[ebp] mov DWORD PTR tv95[ebp], edx $LN23@uncompress: mov eax, DWORD PTR tv95[ebp] $LN1@uncompress: ; 81 : err == Z_NEED_DICT ? Z_DATA_ERROR : ; 82 : err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : ; 83 : err; ; 84 : } mov esp, ebp pop ebp ret 16 ; 00000010H _uncompress2@16 ENDP _TEXT ENDS ; Function compile flags: /Odtp ; File c:\users\dkovari\documents\github\extrastoolbox\+extras\external_libs\zlib\src\zlib-1.2.11\uncompr.c _TEXT SEGMENT _dest$ = 8 ; size = 4 _destLen$ = 12 ; size = 4 _source$ = 16 ; size = 4 _sourceLen$ = 20 ; size = 4 _uncompress@16 PROC ; 91 : { push ebp mov ebp, esp ; 92 : return uncompress2(dest, destLen, source, &sourceLen); lea eax, DWORD PTR _sourceLen$[ebp] push eax mov ecx, DWORD PTR _source$[ebp] push ecx mov edx, DWORD PTR _destLen$[ebp] push edx mov eax, DWORD PTR _dest$[ebp] push eax call _uncompress2@16 ; 93 : } pop ebp ret 16 ; 00000010H _uncompress@16 ENDP _TEXT ENDS END
src/tools/Dependency_Graph_Extractor/tests/Syntax_Examples/src/deferred_constant.ads
selroc/Renaissance-Ada
1
30091
package Deferred_Constant is I, J : constant Integer; K, L : Integer; private I : constant Integer := 42; J : constant Integer := 42; end Deferred_Constant; pragma Pure (Deferred_Constant);
Transynther/x86/_processed/NC/_ht_zr_/i9-9900K_12_0xca_notsx.log_21829_753.asm
ljhsiun2/medusa
9
167825
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r8 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x17cbd, %rsi lea addresses_WT_ht+0x1a12d, %rdi nop nop nop and %r10, %r10 mov $119, %rcx rep movsb nop nop nop cmp %rdx, %rdx lea addresses_A_ht+0x188ed, %rsi lea addresses_WC_ht+0x14be9, %rdi clflush (%rdi) nop nop nop nop nop inc %r10 mov $91, %rcx rep movsw nop nop nop nop xor $30820, %rsi lea addresses_WT_ht+0x1896d, %rax nop nop nop nop cmp %r8, %r8 movb (%rax), %r10b nop nop dec %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r8 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %r15 push %rax push %rcx push %rdx // Store mov $0x93d, %r12 nop nop nop nop sub %rax, %rax movw $0x5152, (%r12) nop nop sub $627, %r14 // Store lea addresses_PSE+0x1c62d, %r10 nop nop nop add $37465, %rcx mov $0x5152535455565758, %r15 movq %r15, %xmm1 vmovups %ymm1, (%r10) nop nop sub %r15, %r15 // Store mov $0x3be122000000026d, %rcx nop nop sub $37808, %rdx movw $0x5152, (%rcx) nop nop nop nop nop and %r12, %r12 // Load mov $0x692ea40000000d45, %r15 nop nop nop cmp $38860, %r14 mov (%r15), %rcx nop nop xor %rax, %rax // Faulty Load mov $0x3be122000000026d, %rax nop nop nop nop inc %r10 movups (%rax), %xmm3 vpextrq $1, %xmm3, %r15 lea oracles, %rcx and $0xff, %r15 shlq $12, %r15 mov (%rcx,%r15,1), %r15 pop %rdx pop %rcx pop %rax pop %r15 pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7}} {'00': 888, '45': 20941} 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 00 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 45 45 45 45 45 45 45 45 45 45 */
problems/031/a031.adb
melwyncarlo/ProjectEuler
0
5524
<filename>problems/031/a031.adb with Ada.Integer_Text_IO; -- Copyright 2021 <NAME> procedure A031 is use Ada.Integer_Text_IO; Combinations : Integer := 0; begin for I in 0 .. 1 loop for J in 0 .. 2 loop for K in 0 .. 4 loop for L in 0 .. 10 loop for M in 0 .. 20 loop for N in 0 .. 40 loop for O in 0 .. 100 loop for P in 0 .. 200 loop if ((I * 200) + (J * 100) + (K * 50) + (L * 20) + (M * 10) + (N * 5) + (O * 2) + P) = 200 then Combinations := Combinations + 1; end if; end loop; end loop; end loop; end loop; end loop; end loop; end loop; end loop; Put (Combinations, Width => 0); end A031;
programs/oeis/055/A055842.asm
jmorken/loda
1
246138
<reponame>jmorken/loda ; A055842: Expansion of (1-x)^2/(1-5*x). ; 1,3,16,80,400,2000,10000,50000,250000,1250000,6250000,31250000,156250000,781250000,3906250000,19531250000,97656250000,488281250000,2441406250000,12207031250000,61035156250000,305175781250000,1525878906250000,7629394531250000 mov $1,1 lpb $0 sub $3,$2 mov $4,$0 sub $4,1 mov $0,$4 mov $5,$1 add $6,3 add $6,$1 add $6,$1 mul $1,2 trn $3,$1 add $1,$3 trn $1,3 add $2,5 mov $3,14 add $5,$6 sub $5,1 add $1,$5 sub $1,2 add $2,2 mov $6,3 lpe
programs/oeis/189/A189933.asm
neoneye/loda
22
29070
<gh_stars>10-100 ; A189933: a(n) = n + [n*r/t] + [n*s/t]; r=1, s=(sin(Pi/5))^2, t=(cos(Pi/5))^2. ; 2,6,8,12,14,18,20,24,26,30,32,36,38,42,44,48,50,54,58,60,64,66,70,72,76,78,82,84,88,90,94,96,100,102,106,110,112,116,118,122,124,128,130,134,136,140,142,146,148,152,154,158,160,164,168,170,174,176,180,182,186,188,192,194,198,200,204,206,210,212,216,220,222,226,228,232,234,238,240,244,246,250,252,256,258,262,264,268,270,274,278,280,284,286,290,292,296,298,302,304 mul $0,2 add $0,2 mul $0,2 mov $1,$0 seq $1,60143 ; a(n) = floor(n/tau), where tau = (1 + sqrt(5))/2. sub $0,$1 sub $0,1 mul $0,2
asm/credits.ext.asm
RockmanEXEZone/MMBN45-English-Translation
6
94624
.align 2 credits_unlockNavis: push r4-r5,r14 mov r5,0x0 @@loop: add r0,=@navisToUnlock ldrb r4,[r0,r5] cmp r4,0xFF beq @@end mov r0,r4 bl 0x8005F64 ldr r0,=0xED0 add r0,r0,r4 bl 0x8028722 add r5,0x1 b @@loop @@end: bl 0x80D95CC pop r4-r5,r15 .pool @navisToUnlock: .db 0x0F .db 0x12 .db 0x13 .db 0x14 .db 0x15 .db 0x11 .db 0x10 .db 0xFF
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_2790.asm
ljhsiun2/medusa
9
163974
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r8 push %rax push %rcx push %rdi push %rsi lea addresses_WC_ht+0x14151, %rax add $38092, %r14 mov (%rax), %r13 nop nop nop nop cmp $3959, %rax lea addresses_D_ht+0x1e055, %rsi lea addresses_UC_ht+0xb021, %rdi nop nop nop nop add $21963, %r10 mov $43, %rcx rep movsb nop cmp $56663, %rcx lea addresses_UC_ht+0x9121, %rsi lea addresses_D_ht+0x4411, %rdi clflush (%rsi) nop sub %r8, %r8 mov $113, %rcx rep movsb nop and $24964, %r14 lea addresses_WT_ht+0xa321, %r10 nop nop sub %r14, %r14 mov $0x6162636465666768, %r8 movq %r8, %xmm6 and $0xffffffffffffffc0, %r10 movntdq %xmm6, (%r10) nop add $34037, %r13 lea addresses_D_ht+0x14659, %r10 nop nop nop nop inc %r13 movups (%r10), %xmm2 vpextrq $1, %xmm2, %rcx nop nop nop nop sub $7403, %rax pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r15 push %r8 push %rbx push %rsi // Load lea addresses_WC+0xf521, %rbx nop nop nop nop nop cmp %r10, %r10 movups (%rbx), %xmm0 vpextrq $0, %xmm0, %r8 nop nop nop cmp $55157, %r13 // Faulty Load lea addresses_WC+0xf521, %r15 nop nop sub %rsi, %rsi movups (%r15), %xmm7 vpextrq $1, %xmm7, %r10 lea oracles, %r13 and $0xff, %r10 shlq $12, %r10 mov (%r13,%r10,1), %r10 pop %rsi pop %rbx pop %r8 pop %r15 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': True, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 9, 'size': 16, 'same': True, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
List.agda
hazelgrove/hazelnut-agda
0
17223
<reponame>hazelgrove/hazelnut-agda open import Prelude open import Nat module List where -- lets us omit a bunch of parens infixr 99 _::_ infixr 9 _++_ -- standard definition of polymorphic lists data List (A : Set) : Set where [] : List A _::_ : A → List A → List A {-# BUILTIN LIST List #-} -- shorthand notation for small lists [_] : {A : Set} → A → List A [ x ] = x :: [] -- list append _++_ : {A : Set} → List A → List A → List A [] ++ l2 = l2 x :: l1 ++ l2 = x :: (l1 ++ l2)
test/Succeed/Issue907.agda
alhassy/agda
3
9181
-- Reported by guillaume.brunerie, Sep 18, 2013 -- Andreas, 2013-10-27 issue submitted by <NAME> {-# OPTIONS --copatterns #-} module Issue907 where -- Globular types as a coinductive record record Glob : Set1 where coinductive field Ob : Set Hom : (a b : Ob) → Glob open Glob public Glob-corec : {A : Set1} (Ob* : A → Set) (Hom* : (x : A) (a b : Ob* x) → A) → (A → Glob) Ob (Glob-corec Ob* Hom* x) = Ob* x Hom (Glob-corec Ob* Hom* x) a b = Glob-corec Ob* Hom* (Hom* x a b) -- For the second equation to type-check, -- we need to reduce with the first equation!
src/security-controllers-roles.ads
jquorning/ada-security
19
10942
----------------------------------------------------------------------- -- security-controllers-roles -- Simple role base security -- Copyright (C) 2011, 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 Security.Contexts; with Security.Permissions; with Security.Policies.Roles; package Security.Controllers.Roles is -- ------------------------------ -- Security Controller -- ------------------------------ -- The <b>Role_Controller</b> implements a simple role based permissions check. -- The permission is granted if the user has the role defined by the controller. type Role_Controller (Count : Positive) is limited new Controller with record Roles : Policies.Roles.Role_Type_Array (1 .. Count); end record; type Role_Controller_Access is access all Role_Controller'Class; -- Returns true if the user associated with the security context <b>Context</b> has -- one of the role defined in the <b>Handler</b>. overriding function Has_Permission (Handler : in Role_Controller; Context : in Security.Contexts.Security_Context'Class; Permission : in Security.Permissions.Permission'Class) return Boolean; end Security.Controllers.Roles;
System-Control/Toggle-Screen-Resolution.applescript
boisy/AppleScripts
116
3634
tell application "Finder" to set theRes to bounds of window of desktop tell application "System Preferences" activate set current pane to pane "com.apple.preference.displays" end tell delay 1 tell application "System Events" tell process "System Preferences" set scaledButton to radio button 2 of radio group 1 of tab group 1 of window 1 if value of scaledButton ≠ 1 then click scaledButton delay 0.5 end if if item 3 of theRes = 1680 then set resButton to radio button 5 of radio group 1 of group 2 of tab group 1 of window 1 else set resButton to radio button 4 of radio group 1 of group 2 of tab group 1 of window 1 end if click resButton end tell end tell tell application "System Preferences" to quit
programs/oeis/239/A239287.asm
karttu/loda
0
160595
<gh_stars>0 ; A239287: Triangle T(n,k), 0 <= k <= n, read by rows: T(n,k) = floor(n/2) - min(k,n-k). ; 0,0,0,1,0,1,1,0,0,1,2,1,0,1,2,2,1,0,0,1,2,3,2,1,0,1,2,3,3,2,1,0,0,1,2,3,4,3,2,1,0,1,2,3,4,4,3,2,1,0,0,1,2,3,4,5,4,3,2,1,0,1,2,3,4,5,5,4,3,2,1,0,0,1,2,3,4,5,6,5,4,3,2,1,0,1,2,3,4,5,6,6,5,4,3,2,1,0,0,1,2,3,4,5,6,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,7,6,5,4,3,2,1,0,0,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,8,7,6,5,4,3,2,1,0,0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,9,8,7,6,5,4,3,2,1,0,0,1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9,10,10,9,8,7,6,5,4,3,2,1,0,0,1,2,3,4,5,6,7 mov $1,1 cal $0,143182 ; Triangle T(n,m) = 1 + abs(n-2*m), read by rows, 0<=m<=n. add $1,$0 mul $1,2 div $1,4 sub $1,1
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr7.adb
best08618/asylo
7
5585
-- { dg-do compile } procedure Discr7 is subtype Index is Natural range 0..5; type BitString is array(Index range <>) of Boolean; pragma Pack(BitString); function Id (I : Integer) return Integer is begin return I; end; type E(D : Index) is record C : BitString(1..D); end record; subtype E0 is E(Id(0)); function F return E0 is begin return E'(D=>0, C=>(1..0=>FALSE)); end; begin null; end;
FormalAnalyzer/models/meta/cap_tone.als
Mohannadcse/IoTCOM_BehavioralRuleExtractor
0
2772
<reponame>Mohannadcse/IoTCOM_BehavioralRuleExtractor // filename: cap_tone.als module cap_tone open IoTBottomUp one sig cap_tone extends Capability {} { attributes = cap_tone_attr } abstract sig cap_tone_attr extends Attribute {}