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
test/Succeed/Issue4481.agda
shlevy/agda
1,989
3765
<reponame>shlevy/agda -- Andreas, 2020-03-26, issue #4481, reported by gallais -- #952 unintentionally added named lambdas; tests here. -- {-# OPTIONS --show-implicit #-} -- {-# OPTIONS -v tc.term.expr.top:15 #-} -- {-# OPTIONS -v tc.term.lambda:30 #-} open import Agda.Primitive -- Named lambdas: postulate f : ({A : Set} → Set) → Set _ = f λ {A = A} → A postulate A : Set g : ({{a : A}} → A) → A _ = g λ {{a = a}} → a data ⊥ : Set where record ⊤ : Set where proj2 : ∀ a {A B : Set a} → Set a proj2 = λ _ {B = B} → B agdaIsConsistent : proj2 lzero {⊥} {⊤} agdaIsConsistent = _
Chapter01-Basics/05-led-blink.asm
Dentrax/AVR-Programming-with-Assembly
9
166308
; ==================================================== ; DLL-Injection-with-Assembly Copyright(C) 2017 <NAME> ; This program comes with ABSOLUTELY NO WARRANTY; This is free software, ; and you are welcome to redistribute it under certain conditions; See ; file LICENSE, which is part of this source code package, for details. ; ==================================================== ; Example : Blink the LED at intervals of about 700 ms. ; Ports : LED -> PORTB's 5th pin .org 0 rjmp main main: ldi r16, 0x20 ; Set PORTB's 5th pin to output mode [0x20 = 0010 0000, r16 = PORTB] out DDRB, r16 ; Write the r16's value at the PORTB's DDRB (DataDirectionRegister) clr r17 ; Using r17 as a tempory to activate/deactivate the LED loop_main: eor r17, r16 ; XOR the r16's unchanged 0x20 data with r17 (this command will change the 5th bit with 1 and 0, on every tick) out PORTB, r17 ; Write the r17's value at the PORTB call delay_ms ; Call the delay function rjmp loop_main ; Go to loop_main tag via RelativeJump and make it work in an infinite loop delay_ms: ; Delay function (700ms) push r16 ; We need to use loop_main's r16 and r17's values in delay_ms function push r17 ; Using the push command, we record the values inside these registers into stack ldi r16, 0x40 ; Run the loop 0x400000 times ldi r17, 0x00 ; Run the ~12 million command cycle ldi r18, 0x00 ; ~0.7s time delay will be obtained for 16Mhz working frequency _w0: dec r18 ; Decrement by 1 the r18's value brne _w0 ; If the result of reduction is not 0, callback _w0 branch dec r17 ; Decrement by 1 the r17's value brne _w0 ; If the result of reduction is not 0, callback _w0 branch dec r16 ; Decrement by 1 the r16's value brne _w0 ; If the result of reduction is not 0, return _w0 branch pop r17 ; Pop the latest pushed r17 before returning from function pop r16 ; Pop the latest pushed r16 before returning from function ret ; Return from the function
programs/oeis/218/A218324.asm
jmorken/loda
1
243908
<reponame>jmorken/loda ; A218324: Odd heptagonal pyramidal numbers ; 1,115,645,1911,4233,7931,13325,20735,30481,42883,58261,76935,99225,125451,155933,190991,230945,276115,326821,383383,446121,515355,591405,674591,765233,863651,970165,1085095,1208761,1341483,1483581,1635375,1797185,1969331 mul $0,4 add $0,3 lpb $0 sub $0,1 add $1,$3 add $2,1 mov $4,$2 add $2,4 add $3,$4 trn $3,5 lpe
alloy4fun_models/trainstlt/models/8/tMhw9sJ7n8nMZWNeZ.als
Kaixi26/org.alloytools.alloy
0
626
<reponame>Kaixi26/org.alloytools.alloy<gh_stars>0 open main pred idtMhw9sJ7n8nMZWNeZ_prop9 { always (all t:Train| (no t.pos => one (t.pos':>Entry)) ) } pred __repair { idtMhw9sJ7n8nMZWNeZ_prop9 } check __repair { idtMhw9sJ7n8nMZWNeZ_prop9 <=> prop9o }
third_party/antlr_grammars_v4/upnp/Upnp.g4
mikhan808/rsyntaxtextarea-antlr4-extension
4
4431
/* [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. */ grammar Upnp; /* * Parser Rules */ searchCrit : searchExp | ASTERISK ; searchExp : relExp | searchExp WCHAR+ LOGOP WCHAR+ searchExp | '(' WCHAR* searchExp WCHAR* ')' ; relExp : PROPERTY WCHAR+ BINOP WCHAR+ quotedVal | PROPERTY WCHAR+ EXISTSOP WCHAR+ BOOLVAL ; quotedVal : DQUOTE escapedQuote DQUOTE ; escapedQuote : STRING_LITERAL* WCHAR* STRING_LITERAL*; /* * Lexer Rules */ NUMBER : [0-9]+ ; WHITESPACE : [\r\t\n] -> skip ; LOGOP : 'and' | 'or' ; BINOP : RELOP | STRINGOP ; RELOP : '=' | '!=' | '<' | '<=' | '>' | '>=' ; STRINGOP : 'contains' | 'doesnotcontain' | 'derivedfrom' ; EXISTSOP : 'exists' ; BOOLVAL : 'true' | 'false' ; WCHAR : SPACE | HTAB ; PROPERTY : 'res@resolution' | 'res@duration' | 'dc:title' | 'dc:creator' | 'upnp:actor' | 'upnp:artist' | 'upnp:genre' | 'upnp:album' | 'dc:date' | 'upnp:class' | '@id' | '@refID' | '@protocolInfo' | 'upnp:author' | 'dc:description' | 'pv:avKeywords' | 'pv:rating' | 'upnp:seriesTitle' | 'upnp:episodeNumber' | 'upnp:director' | 'upnp:rating' | 'upnp:channelNr' | 'upnp:channelName' | 'upnp:longDescription' | 'pv:capturedate' | 'pv:custom' ; HTAB : '\t' ; SPACE : ' ' ; DQUOTE : '"' ; ASTERISK : '*' ; STRING_LITERAL : [a-zA-Z.] | '\\"';
SVD2ada/svd/stm32_svd-gpio.ads
JCGobbi/Nucleo-STM32H743ZI
0
1552
<reponame>JCGobbi/Nucleo-STM32H743ZI<gh_stars>0 pragma Style_Checks (Off); -- This spec has been automatically generated from STM32H743x.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package STM32_SVD.GPIO is pragma Preelaborate; --------------- -- Registers -- --------------- -- MODER_MODE array element subtype MODER_MODE_Element is HAL.UInt2; -- MODER_MODE array type MODER_MODE_Field_Array is array (0 .. 15) of MODER_MODE_Element with Component_Size => 2, Size => 32; -- GPIO port mode register type MODER_Register (As_Array : Boolean := False) is record case As_Array is when False => -- MODE as a value Val : HAL.UInt32; when True => -- MODE as an array Arr : MODER_MODE_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MODER_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- OTYPER_OT array type OTYPER_OT_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for OTYPER_OT type OTYPER_OT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- OT as a value Val : HAL.UInt16; when True => -- OT as an array Arr : OTYPER_OT_Field_Array; end case; end record with Unchecked_Union, Size => 16; for OTYPER_OT_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- GPIO port output type register type OTYPER_Register is record -- Port x configuration bits (y = 0..15) These bits are written by -- software to configure the I/O output type. OT : OTYPER_OT_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for OTYPER_Register use record OT at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- OSPEEDR_OSPEED array element subtype OSPEEDR_OSPEED_Element is HAL.UInt2; -- OSPEEDR_OSPEED array type OSPEEDR_OSPEED_Field_Array is array (0 .. 15) of OSPEEDR_OSPEED_Element with Component_Size => 2, Size => 32; -- GPIO port output speed register type OSPEEDR_Register (As_Array : Boolean := False) is record case As_Array is when False => -- OSPEED as a value Val : HAL.UInt32; when True => -- OSPEED as an array Arr : OSPEEDR_OSPEED_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for OSPEEDR_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- PUPDR_PUPD array element subtype PUPDR_PUPD_Element is HAL.UInt2; -- PUPDR_PUPD array type PUPDR_PUPD_Field_Array is array (0 .. 15) of PUPDR_PUPD_Element with Component_Size => 2, Size => 32; -- GPIO port pull-up/pull-down register type PUPDR_Register (As_Array : Boolean := False) is record case As_Array is when False => -- PUPD as a value Val : HAL.UInt32; when True => -- PUPD as an array Arr : PUPDR_PUPD_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for PUPDR_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- IDR array type IDR_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for IDR type IDR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- IDR as a value Val : HAL.UInt16; when True => -- IDR as an array Arr : IDR_Field_Array; end case; end record with Unchecked_Union, Size => 16; for IDR_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- GPIO port input data register type IDR_Register is record -- Read-only. Port input data bit (y = 0..15) These bits are read-only. -- They contain the input value of the corresponding I/O port. IDR : IDR_Field; -- unspecified Reserved_16_31 : HAL.UInt16; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for IDR_Register use record IDR at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- ODR array type ODR_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for ODR type ODR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- ODR as a value Val : HAL.UInt16; when True => -- ODR as an array Arr : ODR_Field_Array; end case; end record with Unchecked_Union, Size => 16; for ODR_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- GPIO port output data register type ODR_Register is record -- Port output data bit These bits can be read and written by software. -- Note: For atomic bit set/reset, the OD bits can be individually set -- and/or reset by writing to the GPIOx_BSRR or GPIOx_BRR registers (x = -- A..F). ODR : ODR_Field := (As_Array => False, Val => 16#0#); -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ODR_Register use record ODR at 0 range 0 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; -- BSRR_BS array type BSRR_BS_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for BSRR_BS type BSRR_BS_Field (As_Array : Boolean := False) is record case As_Array is when False => -- BS as a value Val : HAL.UInt16; when True => -- BS as an array Arr : BSRR_BS_Field_Array; end case; end record with Unchecked_Union, Size => 16; for BSRR_BS_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- BSRR_BR array type BSRR_BR_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for BSRR_BR type BSRR_BR_Field (As_Array : Boolean := False) is record case As_Array is when False => -- BR as a value Val : HAL.UInt16; when True => -- BR as an array Arr : BSRR_BR_Field_Array; end case; end record with Unchecked_Union, Size => 16; for BSRR_BR_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- GPIO port bit set/reset register type BSRR_Register is record -- Write-only. Port x set bit y (y= 0..15) These bits are write-only. A -- read to these bits returns the value 0x0000. BS : BSRR_BS_Field := (As_Array => False, Val => 16#0#); -- Write-only. Port x reset bit y (y = 0..15) These bits are write-only. -- A read to these bits returns the value 0x0000. Note: If both BSx and -- BRx are set, BSx has priority. BR : BSRR_BR_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for BSRR_Register use record BS at 0 range 0 .. 15; BR at 0 range 16 .. 31; end record; -- LCKR_LCK array type LCKR_LCK_Field_Array is array (0 .. 15) of Boolean with Component_Size => 1, Size => 16; -- Type definition for LCKR_LCK type LCKR_LCK_Field (As_Array : Boolean := False) is record case As_Array is when False => -- LCK as a value Val : HAL.UInt16; when True => -- LCK as an array Arr : LCKR_LCK_Field_Array; end case; end record with Unchecked_Union, Size => 16; for LCKR_LCK_Field use record Val at 0 range 0 .. 15; Arr at 0 range 0 .. 15; end record; -- This register is used to lock the configuration of the port bits when a -- correct write sequence is applied to bit 16 (LCKK). The value of bits -- [15:0] is used to lock the configuration of the GPIO. During the write -- sequence, the value of LCKR[15:0] must not change. When the LOCK -- sequence has been applied on a port bit, the value of this port bit can -- no longer be modified until the next MCU reset or peripheral reset.A -- specific write sequence is used to write to the GPIOx_LCKR register. -- Only word access (32-bit long) is allowed during this locking -- sequence.Each lock bit freezes a specific configuration register -- (control and alternate function registers). type LCKR_Register is record -- Port x lock bit y (y= 0..15) These bits are read/write but can only -- be written when the LCKK bit is 0. LCK : LCKR_LCK_Field := (As_Array => False, Val => 16#0#); -- Lock key This bit can be read any time. It can only be modified using -- the lock key write sequence. LOCK key write sequence: WR LCKR[16] = 1 -- + LCKR[15:0] WR LCKR[16] = 0 + LCKR[15:0] WR LCKR[16] = 1 + -- LCKR[15:0] RD LCKR RD LCKR[16] = 1 (this read operation is optional -- but it confirms that the lock is active) Note: During the LOCK key -- write sequence, the value of LCK[15:0] must not change. Any error in -- the lock sequence aborts the lock. After the first lock sequence on -- any bit of the port, any read access on the LCKK bit will return 1 -- until the next MCU reset or peripheral reset. LCKK : Boolean := False; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for LCKR_Register use record LCK at 0 range 0 .. 15; LCKK at 0 range 16 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; -- AFRL_AFSEL array element subtype AFRL_AFSEL_Element is HAL.UInt4; -- AFRL_AFSEL array type AFRL_AFSEL_Field_Array is array (0 .. 7) of AFRL_AFSEL_Element with Component_Size => 4, Size => 32; -- GPIO alternate function low register type AFRL_Register (As_Array : Boolean := False) is record case As_Array is when False => -- AFSEL as a value Val : HAL.UInt32; when True => -- AFSEL as an array Arr : AFRL_AFSEL_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AFRL_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; -- AFRH_AFSEL array element subtype AFRH_AFSEL_Element is HAL.UInt4; -- AFRH_AFSEL array type AFRH_AFSEL_Field_Array is array (8 .. 15) of AFRH_AFSEL_Element with Component_Size => 4, Size => 32; -- GPIO alternate function high register type AFRH_Register (As_Array : Boolean := False) is record case As_Array is when False => -- AFSEL as a value Val : HAL.UInt32; when True => -- AFSEL as an array Arr : AFRH_AFSEL_Field_Array; end case; end record with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AFRH_Register use record Val at 0 range 0 .. 31; Arr at 0 range 0 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- GPIO type GPIO_Peripheral is record -- GPIO port mode register MODER : aliased MODER_Register; -- GPIO port output type register OTYPER : aliased OTYPER_Register; -- GPIO port output speed register OSPEEDR : aliased OSPEEDR_Register; -- GPIO port pull-up/pull-down register PUPDR : aliased PUPDR_Register; -- GPIO port input data register IDR : aliased IDR_Register; -- GPIO port output data register ODR : aliased ODR_Register; -- GPIO port bit set/reset register BSRR : aliased BSRR_Register; -- This register is used to lock the configuration of the port bits when -- a correct write sequence is applied to bit 16 (LCKK). The value of -- bits [15:0] is used to lock the configuration of the GPIO. During the -- write sequence, the value of LCKR[15:0] must not change. When the -- LOCK sequence has been applied on a port bit, the value of this port -- bit can no longer be modified until the next MCU reset or peripheral -- reset.A specific write sequence is used to write to the GPIOx_LCKR -- register. Only word access (32-bit long) is allowed during this -- locking sequence.Each lock bit freezes a specific configuration -- register (control and alternate function registers). LCKR : aliased LCKR_Register; -- GPIO alternate function low register AFRL : aliased AFRL_Register; -- GPIO alternate function high register AFRH : aliased AFRH_Register; end record with Volatile; for GPIO_Peripheral use record MODER at 16#0# range 0 .. 31; OTYPER at 16#4# range 0 .. 31; OSPEEDR at 16#8# range 0 .. 31; PUPDR at 16#C# range 0 .. 31; IDR at 16#10# range 0 .. 31; ODR at 16#14# range 0 .. 31; BSRR at 16#18# range 0 .. 31; LCKR at 16#1C# range 0 .. 31; AFRL at 16#20# range 0 .. 31; AFRH at 16#24# range 0 .. 31; end record; -- GPIO GPIOA_Periph : aliased GPIO_Peripheral with Import, Address => GPIOA_Base; -- GPIO GPIOB_Periph : aliased GPIO_Peripheral with Import, Address => GPIOB_Base; -- GPIO GPIOC_Periph : aliased GPIO_Peripheral with Import, Address => GPIOC_Base; -- GPIO GPIOD_Periph : aliased GPIO_Peripheral with Import, Address => GPIOD_Base; -- GPIO GPIOE_Periph : aliased GPIO_Peripheral with Import, Address => GPIOE_Base; -- GPIO GPIOF_Periph : aliased GPIO_Peripheral with Import, Address => GPIOF_Base; -- GPIO GPIOG_Periph : aliased GPIO_Peripheral with Import, Address => GPIOG_Base; -- GPIO GPIOH_Periph : aliased GPIO_Peripheral with Import, Address => GPIOH_Base; -- GPIO GPIOI_Periph : aliased GPIO_Peripheral with Import, Address => GPIOI_Base; -- GPIO GPIOJ_Periph : aliased GPIO_Peripheral with Import, Address => GPIOJ_Base; -- GPIO GPIOK_Periph : aliased GPIO_Peripheral with Import, Address => GPIOK_Base; end STM32_SVD.GPIO;
classes/4/SeqFibonacci/Fibonacci01.asm
UFSCar-CS/computer-architecture-and-organization-2012-2
0
178555
TITLE Fibonacci Sequence ; Author: @LucasDavid ; ; Revision: INCLUDE Irvine32.inc .data fibonacci word 12 dup(?) .code main PROC mov edx, OFFSET fibonacci mov ax, 1 mov bx, 1 mov fibonacci, ax mov fibonacci[2], ax mov esi, 4 ;; // posiciona na terceira posicao L1: add ax, bx mov fibonacci[esi], ax mov cx, bx mov bx, ax mov ax, cx add esi, 2 cmp esi, LENGTH fibonacci je EXT jmp L1 EXT: exit main ENDP END main
programs/oeis/167/A167387.asm
karttu/loda
1
91973
<gh_stars>1-10 ; A167387: a(n) = (-1)^(n+1) * n*(n-1)*(n-4)*(n+1)/12. ; 1,-2,0,10,-35,84,-168,300,-495,770,-1144,1638,-2275,3080,-4080,5304,-6783,8550,-10640,13090,-15939,19228,-23000,27300,-32175,37674,-43848,50750,-58435,66960,-76384,86768,-98175,110670,-124320,139194,-155363,172900,-191880,212380,-234479,258258,-283800,311190,-340515,371864,-405328,441000,-478975,519350,-562224,607698,-655875,706860,-760760,817684,-877743,941050,-1007720,1077870,-1151619,1229088,-1310400,1395680,-1485055,1578654,-1676608,1779050,-1886115,1997940,-2114664,2236428,-2363375,2495650,-2633400,2776774,-2925923,3081000,-3242160,3409560,-3583359,3763718,-3950800,4144770,-4345795,4554044,-4769688,4992900,-5223855,5462730,-5709704,5964958,-6228675,6501040,-6782240,7072464,-7371903,7680750,-7999200,8327450,-8665699,9014148,-9373000,9742460,-10122735,10514034,-10916568,11330550,-11756195,12193720,-12643344,13105288,-13579775,14067030,-14567280,15080754,-15607683,16148300,-16702840,17271540,-17854639,18452378,-19065000,19692750,-20335875,20994624,-21669248,22360000,-23067135,23790910,-24531584,25289418,-26064675,26857620,-27668520,28497644,-29345263,30211650,-31097080,32001830,-32926179,33870408,-34834800,35819640,-36825215,37851814,-38899728,39969250,-41060675,42174300,-43310424,44469348,-45651375,46856810,-48085960,49339134,-50616643,51918800,-53245920,54598320,-55976319,57380238,-58810400,60267130,-61750755,63261604,-64800008,66366300,-67960815,69583890,-71235864,72917078,-74627875,76368600,-78139600,79941224,-81773823,83637750,-85533360,87461010,-89421059,91413868,-93439800,95499220,-97592495,99719994,-101882088,104079150,-106311555,108579680,-110883904,113224608,-115602175,118016990,-120469440,122959914,-125488803,128056500,-130663400,133309900,-135996399,138723298,-141491000,144299910,-147150435,150042984,-152977968,155955800,-158976895,162041670,-165150544,168303938,-171502275,174745980,-178035480,181371204,-184753583,188183050,-191660040,195184990,-198758339,202380528,-206052000,209773200,-213544575,217366574,-221239648,225164250,-229140835,233169860,-237251784,241387068,-245576175,249819570,-254117720,258471094,-262880163,267345400,-271867280,276446280,-281082879,285777558,-290530800,295343090,-300214915,305146764,-310139128,315192500,-320307375,325484250 mov $1,-4 bin $1,$0 mul $0,$1 mov $2,-3 sub $2,$1 add $2,$0 sub $1,$2 sub $1,3 div $1,2
Library/Styles/Manip/manipTrans.asm
steakknife/pcgeos
504
96799
<reponame>steakknife/pcgeos COMMENT @---------------------------------------------------------------------- Copyright (c) Berkeley Softworks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: Library/Styles FILE: Manip/manipTrans.asm REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 12/91 Initial version DESCRIPTION: This file contains code for StyleSheetGetStyle $Id: manipTrans.asm,v 1.1 97/04/07 11:15:31 newdeal Exp $ ------------------------------------------------------------------------------@ ManipCode segment resource COMMENT @---------------------------------------------------------------------- FUNCTION: StyleSheetCopyElement DESCRIPTION: Copy an element from an attribute array in document space to an attribute array in transfer space, copying underlying style information as needed CALLED BY: GLOBAL PASS: ss:bp - StyleSheetParams ax - element # to copy (in document space) bx - offset of attribute array to work on cx - non-zero to copy from transfer space dx - CA_NULL_ELEMENT to copy style or attribute token to base destination on di - optimization block handle (or 0 to allocate one) RETURN: bx - element # in destination (in transfer space) di - optimization block DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 12/91 Initial version ------------------------------------------------------------------------------@ StyleSheetCopyElement proc far STYLE_COPY_LOCALS transParam local word ; if no style array was passed then bail out tst ss:[bp].SSP_styleArray.SCD_chunk jnz 1$ ret 1$: .enter ENTER_FULL_EC clr substituteFlag push di call EnterStyleSheet pop optBlock mov transParam, dx ; set flags mov dx, 0x0100 ;assume TO jcxz 10$ mov dx, 0x0001 ;FROM 10$: mov fromTransfer, dl mov changeDestStyles, dh push ax, bx ;save element & offset call LockSpecificAttrArray call Load_dssi_sourceAttr call ChunkArrayElementToPtr ;ds:di = element, cx = size mov ax, ds:[di].SSEH_style ; if copying relative to another destination element then get the ; base style from there cmp transParam, CA_NULL_ELEMENT jz useStyle call Load_dssi_sourceStyle call ChunkArrayElementToPtr ;ds:di = element, cx = size add di, attrCounter2 mov ax, ds:[di].SEH_attrTokens ;ax = attr in destination space mov styleToChange, ax mov ax, transParam call Load_dssi_destAttr call ChunkArrayElementToPtr ;ds:di = element, cx = size mov ax, ds:[di].SSEH_style call UnlockSpecificAttrArray mov dx, 1 jmp common useStyle: call UnlockSpecificAttrArray mov styleToChange, ax call CopyStyle ;ax = style (in dest) clr dx common: mov destStyle, ax mov destCopyFromStyle, ax pop ax, bx call LockSpecificAttrArray push bx, dx mov bx, attrCounter2 add bx, OPT_ATTR_ARRAY_CHUNK mov dx, transParam call LookupOpt pop bx, dx jnc noOpt ; the optimization worked -- we know what the new token is, now we ; have to add a reference for it call Load_dssi_destAttr call ElementArrayAddReference jmp afterCopyElement noOpt: push ax call CopyElement ;ax = element (in dest) pop cx mov dx, transParam mov bx, attrCounter2 add bx, OPT_ATTR_ARRAY_CHUNK call AddOpt afterCopyElement: push ax call UnlockSpecificAttrArray call LeaveStyleSheet pop bx ;bx = element to return mov di, optBlock LEAVE_FULL_EC .leave ret StyleSheetCopyElement endp COMMENT @---------------------------------------------------------------------- FUNCTION: StyleSheetImportStyles DESCRIPTION: Import styles from an outside source. CALLED BY: GLOBAL PASS: cx - non-zero to change destination styles when there are duplicates ss:bp - StyleSheetParams RETURN: ax - non-zero if recalculation is necessary DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 12/91 Initial version ------------------------------------------------------------------------------@ StyleSheetImportStyles proc far STYLE_COPY_LOCALS ; if no style array was passed then bail out tst ss:[bp].SSP_styleArray.SCD_chunk jnz 1$ ret 1$: .enter ENTER_FULL_EC call EnterStyleSheet clr optBlock mov substituteFlag, 1 mov fromTransfer, 1 jcxz 10$ inc cl 10$: mov changeDestStyles, cl call Load_dssi_sourceStyle mov bx, cs mov di, offset ImportStyleCallback call ChunkArrayEnum mov bx, optBlock tst bx jz 20$ call MemFree 20$: call StyleSheetIncNotifyCounter ;mark styles changed call LeaveStyleSheet mov ax, recalcFlag LEAVE_FULL_EC .leave ret StyleSheetImportStyles endp COMMENT @---------------------------------------------------------------------- FUNCTION: ImportStyleCallback DESCRIPTION: Callback to import a style CALLED BY: StyleSheetImportStyles (via ChunkArrayEnum) PASS: *ds:si - array ds:di - element ss:bp - inherited variables RETURN: carry clear (continue enumeration) DESTROYED: ax, bx, cx, dx, si, di, ds, es REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 1/14/92 Initial version ------------------------------------------------------------------------------@ ImportStyleCallback proc far STYLE_COPY_LOCALS .enter inherit far ; skip free elements cmp ds:[di].REH_refCount.WAAH_high, EA_FREE_ELEMENT LONG jz done push ds call ChunkArrayPtrToElement ;ax = style (in source) call CopyStyle ;ax = style (in dest) pop ds done: clc .leave ret ImportStyleCallback endp COMMENT @---------------------------------------------------------------------- FUNCTION: StyleSheetOpenFileForImport DESCRIPTION: Open a file for importing a style sheet CALLED BY: GLOBAL PASS: ss:bp - SSCLoadStyleSheetParams RETURN: carry - set if error bx - file handle DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 2/22/92 Initial version ------------------------------------------------------------------------------@ StyleSheetOpenFileForImport proc far uses ax, cx, dx, si, di, ds mov bx, bp ;ss:bx = params SBCS <buffer local PATH_BUFFER_SIZE+FILE_LONGNAME_BUFFER_SIZE dup (char)> DBCS <buffer local PATH_BUFFER_SIZE/2+FILE_LONGNAME_BUFFER_SIZE/2 dup (wchar)> .enter call FilePushDir mov si, ss:[bx].SSCLSSP_fileSelector.chunk mov bx, ss:[bx].SSCLSSP_fileSelector.handle ;bx:si = file selector push bx push bp mov dx, ss lea bp, buffer mov cx, size buffer mov ax, MSG_GEN_PATH_GET mov di, mask MF_CALL call ObjMessage ;cx = disk handle mov bx, cx pop bp segmov ds, ss lea dx, buffer call FileSetCurrentPath pop bx jc done mov cx, ss lea dx, buffer push bp mov ax, MSG_GEN_FILE_SELECTOR_GET_SELECTION mov di, mask MF_CALL call ObjMessage pop bp segmov ds, ss lea dx, buffer mov ax, (VMO_OPEN shl 8) or mask VMAF_FORCE_READ_ONLY call VMOpen done: call FilePopDir .leave ret StyleSheetOpenFileForImport endp ManipCode ends
programs/oeis/083/A083324.asm
karttu/loda
0
13759
<filename>programs/oeis/083/A083324.asm<gh_stars>0 ; A083324: An alternating sum of decreasing powers. ; 1,3,11,45,191,813,3431,14325,59231,242973,990551,4019205,16249871,65522733,263668871,1059425685,4251986111,17050860093,68332318391,273716169765,1096025891951,4387588255053,17560809179111,70274609387445 mov $2,$0 add $2,1 mov $7,$0 lpb $2,1 mov $0,$7 sub $2,1 sub $0,$2 sub $0,1 mov $3,6 mov $4,1 sub $5,$5 lpb $0,1 sub $0,1 add $5,$3 mul $3,2 mov $6,$5 mul $6,2 add $5,$6 lpe sub $0,$3 mul $3,$0 add $4,$6 sub $0,$4 mul $0,2 sub $0,$3 mov $4,$0 sub $4,17 div $4,24 add $4,1 add $1,$4 lpe sub $1,1 mul $1,2 add $1,1
alloy4fun_models/trashltl/models/11/jGYKGwvwsnJ7JudFd.als
Kaixi26/org.alloytools.alloy
0
5333
open main pred idjGYKGwvwsnJ7JudFd_prop12 { some f:File | eventually f in Trash implies always f in Trash } pred __repair { idjGYKGwvwsnJ7JudFd_prop12 } check __repair { idjGYKGwvwsnJ7JudFd_prop12 <=> prop12o }
data/mapObjects/cinnabargym.asm
etdv-thevoid/pokemon-rgb-enhanced
1
20548
<filename>data/mapObjects/cinnabargym.asm CinnabarGymObject: db $2e ; border block db $2 ; warps db $11, $10, $1, $ff db $11, $11, $1, $ff db $0 ; signs db $9 ; objects object SPRITE_BLAINE, $3, $3, STAY, DOWN, $1, OPP_BLAINE, $1 object SPRITE_BLACK_HAIR_BOY_2, $11, $2, STAY, DOWN, $2, OPP_SUPER_NERD, $9 object SPRITE_BLACK_HAIR_BOY_2, $11, $8, STAY, DOWN, $3, OPP_BURGLAR, $1 object SPRITE_BLACK_HAIR_BOY_2, $b, $4, STAY, DOWN, $4, OPP_SUPER_NERD, $a object SPRITE_BLACK_HAIR_BOY_2, $b, $8, STAY, DOWN, $5, OPP_BURGLAR, $2 object SPRITE_BLACK_HAIR_BOY_2, $b, $e, STAY, DOWN, $6, OPP_SUPER_NERD, $b object SPRITE_BLACK_HAIR_BOY_2, $3, $e, STAY, DOWN, $7, OPP_BURGLAR, $3 object SPRITE_BLACK_HAIR_BOY_2, $3, $8, STAY, DOWN, $8, OPP_SUPER_NERD, $c object SPRITE_GYM_HELPER, $10, $d, STAY, DOWN, $9 ; person ; warp-to EVENT_DISP CINNABAR_GYM_WIDTH, $11, $10 EVENT_DISP CINNABAR_GYM_WIDTH, $11, $11
programs/oeis/095/A095832.asm
neoneye/loda
22
97788
<reponame>neoneye/loda ; A095832: Triangle read by rows: T(n,k) = (n-k+1)*(n-k), n>=1, 1<=k<=n. ; 0,2,0,6,2,0,12,6,2,0,20,12,6,2,0,30,20,12,6,2,0,42,30,20,12,6,2,0,56,42,30,20,12,6,2,0,72,56,42,30,20,12,6,2,0,90,72,56,42,30,20,12,6,2,0,110,90,72,56,42,30,20,12,6,2,0,132,110,90,72,56,42,30,20,12,6,2,0,156,132,110,90,72,56,42,30,20,12,6,2,0,182,156,132,110,90,72,56,42,30 mov $2,$0 lpb $2 sub $1,1 add $2,$1 lpe add $1,$2 bin $1,2 mul $1,2 mov $0,$1
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_1_1755.asm
ljhsiun2/medusa
9
82429
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r8 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x1efa4, %rcx nop nop nop nop add %rbx, %rbx mov $0x6162636465666768, %rdx movq %rdx, (%rcx) nop nop nop nop nop lfence lea addresses_WT_ht+0x187a4, %r11 nop nop nop nop nop xor %r14, %r14 movw $0x6162, (%r11) nop nop and $30081, %r11 lea addresses_WC_ht+0x410c, %rsi lea addresses_normal_ht+0x3764, %rdi nop and %rdx, %rdx mov $125, %rcx rep movsl nop nop xor %rdx, %rdx lea addresses_UC_ht+0xfa4, %rsi nop nop nop nop nop cmp $46149, %rdi movw $0x6162, (%rsi) nop xor %rdi, %rdi lea addresses_D_ht+0xfda4, %r14 inc %rdi mov $0x6162636465666768, %rbx movq %rbx, %xmm2 and $0xffffffffffffffc0, %r14 movntdq %xmm2, (%r14) sub $1313, %rsi lea addresses_WT_ht+0x11fa4, %rsi lea addresses_WC_ht+0xdd34, %rdi clflush (%rsi) nop nop nop nop nop and $47977, %r14 mov $52, %rcx rep movsq nop nop nop nop nop add %rbx, %rbx lea addresses_A_ht+0x1bf56, %rdx nop nop nop nop nop cmp $43431, %r11 mov $0x6162636465666768, %r14 movq %r14, %xmm2 and $0xffffffffffffffc0, %rdx vmovaps %ymm2, (%rdx) nop sub $25126, %rcx lea addresses_WC_ht+0x61a4, %rdi nop nop nop nop nop and %rsi, %rsi mov $0x6162636465666768, %r8 movq %r8, %xmm0 vmovups %ymm0, (%rdi) nop nop add $36843, %rdi lea addresses_WT_ht+0x1c1a4, %r11 nop nop nop nop nop and $7546, %r14 vmovups (%r11), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %rbx dec %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r8 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r14 push %r8 push %rax push %rbp push %rcx push %rdi push %rsi // Store lea addresses_D+0x78d0, %r8 nop nop nop nop cmp $49561, %rdi mov $0x5152535455565758, %r14 movq %r14, (%r8) nop nop cmp %rdi, %rdi // REPMOV lea addresses_WT+0x19ae4, %rsi lea addresses_D+0x1bfa4, %rdi clflush (%rsi) nop nop sub %r12, %r12 mov $74, %rcx rep movsb nop cmp %r12, %r12 // Load lea addresses_A+0x129a4, %rdi and %rsi, %rsi movups (%rdi), %xmm4 vpextrq $1, %xmm4, %r8 // Exception!!! nop nop nop nop nop mov (0), %r8 sub $726, %r8 // Load lea addresses_WC+0x16ef4, %rsi sub $9080, %rdi mov (%rsi), %rcx nop nop nop cmp $28688, %rcx // Load lea addresses_normal+0xc7a4, %r12 nop nop nop xor $25635, %rcx movups (%r12), %xmm1 vpextrq $0, %xmm1, %rax nop nop nop nop nop inc %rbp // Store lea addresses_RW+0x18054, %rsi nop add $25898, %rax movb $0x51, (%rsi) nop nop nop nop sub $4127, %rax // REPMOV lea addresses_A+0xb7a4, %rsi lea addresses_UC+0x132a4, %rdi clflush (%rsi) nop dec %r14 mov $110, %rcx rep movsq nop xor %r14, %r14 // Faulty Load lea addresses_normal+0xc7a4, %r14 nop nop and $54251, %r8 vmovups (%r14), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $0, %xmm2, %rax lea oracles, %rcx and $0xff, %rax shlq $12, %rax mov (%rcx,%rax,1), %rax pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r8 pop %r14 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_D', 'AVXalign': False, 'size': 8}} {'src': {'same': False, 'congruent': 5, 'type': 'addresses_WT'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_D'}} {'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_A', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_WC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_RW', 'AVXalign': False, 'size': 1}} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_A'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC'}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_normal', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 11, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}} {'src': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 9, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16}} {'src': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 1, 'type': 'addresses_A_ht', 'AVXalign': True, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32}} {'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} {'00': 1} 00 */
scripts/custom_terminal2item2.scpt
lroolle/ohmyalfred
8
4343
<reponame>lroolle/ohmyalfred -- Custom Terminal run shell commands in New iTerm2 window -- For iTerm 3.1.1+ on alfred_script(q) run script " on run {q} tell application \"iTerm\" activate create window with default profile select first window tell the first window tell current session to write text q end tell end tell end run " with parameters {q} end alfred_script
src/gnat/prj-env.ads
My-Colaborations/dynamo
15
11983
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . E N V -- -- -- -- S p e c -- -- -- -- Copyright (C) 2001-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. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package implements services for Project-aware tools, mostly related -- to the environment (configuration pragma files, path files, mapping files). with GNAT.Dynamic_HTables; with GNAT.OS_Lib; package Prj.Env is procedure Initialize (In_Tree : Project_Tree_Ref); -- Initialize global components relative to environment variables procedure Print_Sources (In_Tree : Project_Tree_Ref); -- Output the list of sources after Project files have been scanned procedure Create_Mapping (In_Tree : Project_Tree_Ref); -- Create in memory mapping from the sources of all the projects (in body -- of package Fmap), so that Osint.Find_File will find the correct path -- corresponding to a source. procedure Create_Temp_File (Shared : Shared_Project_Tree_Data_Access; Path_FD : out File_Descriptor; Path_Name : out Path_Name_Type; File_Use : String); -- Create temporary file, fail with an error if it could not be created procedure Create_Mapping_File (Project : Project_Id; Language : Name_Id; In_Tree : Project_Tree_Ref; Name : out Path_Name_Type); -- Create a temporary mapping file for project Project. For each source or -- template of Language in the Project, put the mapping of its file name -- and path name in this file. See fmap for a description of the format -- of the mapping file. -- -- Implementation note: we pass a language name, not a language_index here, -- since the latter would have to match exactly the index of that language -- for the specified project, and that is not information available in -- buildgpr.adb. procedure Create_Config_Pragmas_File (For_Project : Project_Id; In_Tree : Project_Tree_Ref); -- If we need SFN pragmas, either for non standard naming schemes or for -- individual units. procedure Create_New_Path_File (Shared : Shared_Project_Tree_Data_Access; Path_FD : out File_Descriptor; Path_Name : out Path_Name_Type); -- Create a new temporary path file, placing file name in Path_Name function Ada_Include_Path (Project : Project_Id; In_Tree : Project_Tree_Ref; Recursive : Boolean := False) return String; -- Get the source search path of a Project file. If Recursive it True, get -- all the source directories of the imported and modified project files -- (recursively). If Recursive is False, just get the path for the source -- directories of Project. Note: the resulting String may be empty if there -- is no source directory in the project file. function Ada_Objects_Path (Project : Project_Id; In_Tree : Project_Tree_Ref; Including_Libraries : Boolean := True) return String_Access; -- Get the ADA_OBJECTS_PATH of a Project file. For the first call with the -- exact same parameters, compute it and cache it. When Including_Libraries -- is True, the object directory of a library project is replaced with the -- library ALI directory of this project (usually the library directory of -- the project, except when attribute Library_ALI_Dir is declared) except -- when the library ALI directory does not contain any ALI file. procedure Set_Ada_Paths (Project : Project_Id; In_Tree : Project_Tree_Ref; Including_Libraries : Boolean; Include_Path : Boolean := True; Objects_Path : Boolean := True); -- Set the environment variables for additional project path files, after -- creating the path files if necessary. function File_Name_Of_Library_Unit_Body (Name : String; Project : Project_Id; In_Tree : Project_Tree_Ref; Main_Project_Only : Boolean := True; Full_Path : Boolean := False) return String; -- Returns the file name of a library unit, in canonical case. Name may or -- may not have an extension (corresponding to the naming scheme of the -- project). If there is no body with this name, but there is a spec, the -- name of the spec is returned. -- -- If Full_Path is False (the default), the simple file name is returned. -- If Full_Path is True, the absolute path name is returned. -- -- If neither a body nor a spec can be found, an empty string is returned. -- If Main_Project_Only is True, the unit must be an immediate source of -- Project. If it is False, it may be a source of one of its imported -- projects. function Project_Of (Name : String; Main_Project : Project_Id; In_Tree : Project_Tree_Ref) return Project_Id; -- Get the project of a source. The source file name may be truncated -- (".adb" or ".ads" may be missing). If the source is in a project being -- extended, return the ultimate extending project. If it is not a source -- of any project, return No_Project. procedure Get_Reference (Source_File_Name : String; In_Tree : Project_Tree_Ref; Project : out Project_Id; Path : out Path_Name_Type); -- Returns the project of a source and its path in displayable form generic with procedure Action (Path : String); procedure For_All_Source_Dirs (Project : Project_Id; In_Tree : Project_Tree_Ref); -- Iterate through all the source directories of a project, including those -- of imported or modified projects. Only returns those directories that -- potentially contain Ada sources (ie ignore projects that have no Ada -- sources generic with procedure Action (Path : String); procedure For_All_Object_Dirs (Project : Project_Id; Tree : Project_Tree_Ref); -- Iterate through all the object directories of a project, including those -- of imported or modified projects. ------------------ -- Project Path -- ------------------ type Project_Search_Path is private; -- An abstraction of the project path. This object provides subprograms -- to search for projects on the path (and caches the results to improve -- efficiency). No_Project_Search_Path : constant Project_Search_Path; procedure Initialize_Default_Project_Path (Self : in out Project_Search_Path; Target_Name : String; Runtime_Name : String := ""); -- Initialize Self. It will then contain the default project path on -- the given target and runtime (including directories specified by the -- environment variables GPR_PROJECT_PATH_FILE, GPR_PROJECT_PATH and -- ADA_PROJECT_PATH). If one of the directory or Target_Name is "-", then -- the path contains only those directories specified by the environment -- variables (except "-"). This does nothing if Self has already been -- initialized. procedure Copy (From : Project_Search_Path; To : out Project_Search_Path); -- Copy From into To procedure Initialize_Empty (Self : in out Project_Search_Path); -- Initialize self with an empty list of directories. If Self had already -- been set, it is reset. function Is_Initialized (Self : Project_Search_Path) return Boolean; -- Whether Self has been initialized procedure Free (Self : in out Project_Search_Path); -- Free the memory used by Self procedure Add_Directories (Self : in out Project_Search_Path; Path : String; Prepend : Boolean := False); -- Add one or more directories to the path. Directories added with this -- procedure are added in order after the current directory and before the -- path given by the environment variable GPR_PROJECT_PATH. A value of "-" -- will remove the default project directory from the project path. -- -- Calls to this subprogram must be performed before the first call to -- Find_Project below, or PATH will be added at the end of the search path. procedure Get_Path (Self : Project_Search_Path; Path : out String_Access); -- Return the current value of the project path, either the value set -- during elaboration of the package or, if procedure Set_Project_Path has -- been called, the value set by the last call to Set_Project_Path. The -- returned value must not be modified. -- Self must have been initialized first. procedure Set_Path (Self : in out Project_Search_Path; Path : String); -- Override the value of the project path. This also removes the implicit -- default search directories. generic with function Check_Filename (Name : String) return Boolean; function Find_Name_In_Path (Self : Project_Search_Path; Path : String) return String_Access; -- Find a name in the project search path of Self. Check_Filename is -- the predicate to valid the search. If Path is an absolute filename, -- simply calls the predicate with Path. Otherwise, calls the predicate -- for each component of the path. Stops as soon as the predicate -- returns True and returns the name, or returns null in case of failure. procedure Find_Project (Self : in out Project_Search_Path; Project_File_Name : String; Directory : String; Path : out Namet.Path_Name_Type); -- Search for a project with the given name either in Directory (which -- often will be the directory contain the project we are currently parsing -- and which we found a reference to another project), or in the project -- path Self. Self must have been initialized first. -- -- Project_File_Name can optionally contain directories, and the extension -- (.gpr) for the file name is optional. -- -- Returns No_Name if no such project was found function Get_Runtime_Path (Self : Project_Search_Path; Name : String) return String_Access; -- Compute the full path for the project-based runtime name. -- Name is simply searched on the project path. private package Projects_Paths is new GNAT.Dynamic_HTables.Simple_HTable (Header_Num => Header_Num, Element => Path_Name_Type, No_Element => No_Path, Key => Name_Id, Hash => Hash, Equal => "="); type Project_Search_Path is record Path : GNAT.OS_Lib.String_Access; -- As a special case, if the first character is '#:" or this variable -- is unset, this means that the PATH has not been fully initialized -- yet (although subprograms above will properly take care of that). Cache : Projects_Paths.Instance; end record; No_Project_Search_Path : constant Project_Search_Path := (Path => null, Cache => Projects_Paths.Nil); end Prj.Env;
preservation.agda
hazelgrove/hazelnat-myth-
1
8588
<reponame>hazelgrove/hazelnat-myth-<gh_stars>1-10 open import Nat open import Prelude open import List open import contexts open import core open import lemmas-env module preservation where preservation : ∀{⛽ Δ Σ' Γ E e r k τ} → Δ , Σ' , Γ ⊢ E → Δ , Σ' , Γ ⊢ e :: τ → E ⊢ e ⌊ ⛽ ⌋⇒ r ⊣ k → Δ , Σ' ⊢ r ·: τ preservation ctxcons ta EFix = TAFix ctxcons ta preservation ctxcons (TAVar tah) (EVar h) with env-all-Γ ctxcons tah ... | π3 , π4 , π5 rewrite ctxunicity h π4 = π5 preservation ctxcons (TAHole h) EHole = TAHole h ctxcons preservation ctxcons TAUnit EUnit = TAUnit preservation ctxcons (TAPair _ ta1 ta2) (EPair eval1 eval2) = TAPair (preservation ctxcons ta1 eval1 ) (preservation ctxcons ta2 eval2) preservation ctxcons (TACtor h1 h2 ta) (ECtor eval) = TACtor h1 h2 (preservation ctxcons ta eval) preservation ctxcons (TAApp _ ta-f ta-arg) (EAppFix _ h eval1 eval2 eval-ef) rewrite h with preservation ctxcons ta-f eval1 ... | TAFix ctxcons-Ef (TAFix ta-ef) = preservation (EnvInd (EnvInd ctxcons-Ef (preservation ctxcons ta-f eval1)) (preservation ctxcons ta-arg eval2)) ta-ef eval-ef preservation ctxcons (TAApp _ ta1 ta2) (EAppUnfinished eval1 _ eval2) = TAApp (preservation ctxcons ta1 eval1) (preservation ctxcons ta2 eval2) preservation ctxcons (TAFst ta) (EFst eval) with preservation ctxcons ta eval ... | TAPair ta1 ta2 = ta1 preservation ctxcons (TAFst ta) (EFstUnfinished eval x) = TAFst (preservation ctxcons ta eval) preservation ctxcons (TASnd ta) (ESnd eval) with preservation ctxcons ta eval ... | TAPair ta1 ta2 = ta2 preservation ctxcons (TASnd ta) (ESndUnfinished eval x) = TASnd (preservation ctxcons ta eval) preservation {Σ' = Σ'} ctxcons (TACase d∈Σ' ta h1 h2) (EMatch _ form eval-e eval-ec) with h2 form ... | _ , _ , _ , c∈cctx2 , ta-ec with preservation ctxcons ta eval-e ... | TACtor {cctx = cctx} d∈Σ'2 c∈cctx ta' with ctxunicity {Γ = π1 Σ'} d∈Σ' d∈Σ'2 ... | refl with ctxunicity {Γ = cctx} c∈cctx c∈cctx2 ... | refl = preservation (EnvInd ctxcons ta') ta-ec eval-ec preservation ctxcons (TACase d∈Σ' ta h1 h2) (EMatchUnfinished eval h) = TACase d∈Σ' ctxcons (preservation ctxcons ta eval) h1 λ form' → let _ , _ , _ , p2 , p3 = h2 form' in _ , p2 , p3 preservation ctxcons (TAAsrt _ ta1 ta2) (EAsrt eval1 eval2 _) = TAUnit
source/streams/machine-w64-mingw32/s-naiona.adb
ytomino/drake
33
679
<filename>source/streams/machine-w64-mingw32/s-naiona.adb with Ada.Exception_Identification.From_Here; with Ada.Exceptions.Finally; with Ada.Unchecked_Conversion; with System.Address_To_Named_Access_Conversions; with System.Storage_Map; with System.System_Allocators; with System.Zero_Terminated_WStrings; with C.string; with C.winternl; package body System.Native_IO.Names is use Ada.Exception_Identification.From_Here; use type Storage_Elements.Storage_Offset; use type C.char_array; use type C.size_t; use type C.winternl.NTSTATUS; use type C.winnt.LPWSTR; -- Name_Pointer use type C.winnt.WCHAR; -- Name_Character use type C.winnt.WCHAR_array; -- Name_String package Name_Pointer_Conv is new Address_To_Named_Access_Conversions ( Name_Character, Name_Pointer); package POBJECT_NAME_INFORMATION_Conv is new Address_To_Named_Access_Conversions ( C.winternl.struct_OBJECT_NAME_INFORMATION, C.winternl.POBJECT_NAME_INFORMATION); function "+" (Left : Name_Pointer; Right : C.ptrdiff_t) return Name_Pointer with Convention => Intrinsic; pragma Inline_Always ("+"); function "+" (Left : Name_Pointer; Right : C.ptrdiff_t) return Name_Pointer is begin return Name_Pointer_Conv.To_Pointer ( Name_Pointer_Conv.To_Address (Left) + Storage_Elements.Storage_Offset (Right) * (Name_Character'Size / Standard'Storage_Unit)); end "+"; type NtQueryObject_Type is access function ( Handle : C.winnt.HANDLE; ObjectInformationClass : C.winternl.OBJECT_INFORMATION_CLASS; ObjectInformation : C.winnt.PVOID; ObjectInformationLength : C.windef.ULONG; ReturnLength : access C.windef.ULONG) return C.winternl.NTSTATUS with Convention => WINAPI; NtQueryObject_Name : constant C.char_array (0 .. 13) := "NtQueryObject" & C.char'Val (0); function To_NtQueryObject_Type is new Ada.Unchecked_Conversion (C.windef.FARPROC, NtQueryObject_Type); -- implementation procedure Open_Ordinary ( Method : Open_Method; Handle : aliased out Handle_Type; Mode : File_Mode; Name : String; Out_Name : aliased out Name_Pointer; Form : Packed_Form) is C_Name : aliased Name_String ( 0 .. Name'Length * Zero_Terminated_WStrings.Expanding); begin Zero_Terminated_WStrings.To_C (Name, C_Name (0)'Access); Open_Ordinary (Method, Handle, Mode, C_Name (0)'Unchecked_Access, Form); Out_Name := null; end Open_Ordinary; procedure Get_Full_Name ( Handle : Handle_Type; Has_Full_Name : in out Boolean; Name : in out Name_Pointer; Is_Standard : Boolean; Raise_On_Error : Boolean) is procedure Finally (X : in out C.winnt.PVOID); procedure Finally (X : in out C.winnt.PVOID) is begin System_Allocators.Free (Address (X)); end Finally; package Holder is new Ada.Exceptions.Finally.Scoped_Holder (C.winnt.PVOID, Finally); NtQueryObject : constant NtQueryObject_Type := To_NtQueryObject_Type ( C.winbase.GetProcAddress ( Storage_Map.NTDLL, NtQueryObject_Name (0)'Access)); Info : aliased C.winnt.PVOID := C.void_ptr (Null_Address); ReturnLength : aliased C.windef.ULONG; Unicode_Name : C.winternl.PUNICODE_STRING; New_Name : Name_Pointer; Drives : aliased Name_String (0 .. 3 * 26); -- (A to Z) * "X:\" Drive : Name_String (0 .. 2); -- "X:" New_Name_Length : C.size_t; Relative_Index : C.size_t; Skip_Length : C.size_t; begin if NtQueryObject = null then -- Failed, keep Has_Full_Name and Name. if Raise_On_Error then raise Program_Error; -- ?? end if; return; -- error end if; -- Get ObjectNameInformation. Holder.Assign (Info); Info := C.winnt.PVOID (System_Allocators.Allocate (4096)); if Address (Info) = Null_Address then -- Failed, keep Has_Full_Name and Name. if Raise_On_Error then raise Storage_Error; end if; return; -- error end if; if NtQueryObject ( Handle, C.winternl.ObjectNameInformation, Info, 4096, ReturnLength'Access) /= 0 -- STATUS_SUCCESS then declare New_Info : constant C.winnt.PVOID := C.winnt.PVOID ( System_Allocators.Reallocate ( Address (Info), Storage_Elements.Storage_Offset (ReturnLength))); begin if Address (New_Info) = Null_Address then -- Failed, keep Has_Full_Name and Name. if Raise_On_Error then raise Storage_Error; end if; return; -- error end if; Info := New_Info; end; if NtQueryObject ( Handle, C.winternl.ObjectNameInformation, Info, ReturnLength, null) /= 0 -- STATUS_SUCCESS then -- Failed, keep Has_Full_Name and Name. if Raise_On_Error then Raise_Exception (Use_Error'Identity); end if; return; -- error end if; end if; Unicode_Name := POBJECT_NAME_INFORMATION_Conv.To_Pointer (Address (Info)).Name'Access; -- To DOS name. if C.winbase.GetLogicalDriveStrings (Drives'Length, Drives (0)'Access) >= Drives'Length then -- Failed, keep Has_Full_Name and Name. if Raise_On_Error then Raise_Exception (Use_Error'Identity); end if; return; -- error end if; Drive (1) := Name_Character'Val (Character'Pos (':')); Drive (2) := Name_Character'Val (0); Skip_Length := 0; Relative_Index := 0; New_Name_Length := C.size_t (Unicode_Name.Length); declare Unicode_Name_All : Name_String ( 0 .. C.size_t (Unicode_Name.Length) - 1); for Unicode_Name_All'Address use Name_Pointer_Conv.To_Address (Unicode_Name.Buffer); P : Name_Pointer := Drives (0)'Unchecked_Access; begin while P.all /= Name_Character'Val (0) loop declare Length : constant C.size_t := C.string.wcslen (P); Long_Name : aliased Name_String (0 .. C.windef.MAX_PATH - 1); begin if Length > 0 then Drive (0) := P.all; -- drop trailing '\' if C.winbase.QueryDosDevice ( Drive (0)'Access, Long_Name (0)'Access, C.windef.MAX_PATH) /= 0 then declare Long_Name_Length : C.size_t := 0; begin while Long_Name (Long_Name_Length) /= Name_Character'Val (0) loop if Long_Name (Long_Name_Length) = Name_Character'Val (Character'Pos (';')) then -- Skip ";X:\" (Is it a bug of VirtualBox?) Long_Name ( Long_Name_Length .. Long_Name'Last - 4) := Long_Name ( Long_Name_Length + 4 .. Long_Name'Last); end if; Long_Name_Length := Long_Name_Length + 1; end loop; if Long_Name (0 .. Long_Name_Length - 1) = Unicode_Name_All (0 .. Long_Name_Length - 1) and then Unicode_Name_All (Long_Name_Length) = Name_Character'Val (Character'Pos ('\')) then Skip_Length := Long_Name_Length; Relative_Index := 2; New_Name_Length := New_Name_Length - Skip_Length + 2; exit; end if; end; end if; end if; P := P + C.ptrdiff_t (Length); end; P := P + 1; -- skip NUL end loop; if Relative_Index = 0 and then Unicode_Name_All (1) /= Name_Character'Val (Character'Pos (':')) and then ( Unicode_Name_All (0) /= Name_Character'Val (Character'Pos ('\')) or else Unicode_Name_All (1) /= Name_Character'Val (Character'Pos ('\'))) then -- For example, a pipe's name is like "pipe:[N]". Drive (0) := Name_Character'Val (Character'Pos ('*')); Relative_Index := 1; New_Name_Length := New_Name_Length + 1; end if; end; -- Copy a name. New_Name := Name_Pointer_Conv.To_Pointer ( System_Allocators.Allocate ( (Storage_Elements.Storage_Offset (New_Name_Length) + 1) * (Name_Character'Size / Standard'Storage_Unit))); if New_Name = null then -- Failed, keep Has_Full_Name and Name. if Raise_On_Error then raise Storage_Error; end if; return; -- error end if; declare Unicode_Name_All : Name_String ( 0 .. C.size_t (Unicode_Name.Length) - 1); for Unicode_Name_All'Address use Name_Pointer_Conv.To_Address (Unicode_Name.Buffer); New_Name_All : Name_String (0 .. New_Name_Length); -- NUL for New_Name_All'Address use Name_Pointer_Conv.To_Address (New_Name); begin if Relative_Index > 0 then New_Name_All (0 .. Relative_Index - 1) := Drive (0 .. Relative_Index - 1); end if; New_Name_All (Relative_Index .. New_Name_Length - 1) := Unicode_Name_All ( Skip_Length .. C.size_t (Unicode_Name.Length) - 1); New_Name_All (New_Name_Length) := Name_Character'Val (0); end; -- Succeeded. if not Is_Standard then Free (Name); -- External or External_No_Close end if; Name := New_Name; Has_Full_Name := True; end Get_Full_Name; end System.Native_IO.Names;
programs/oeis/038/A038058.asm
neoneye/loda
22
179642
; A038058: Number of labeled trees with 2-colored nodes. ; 1,2,4,24,256,4000,82944,2151296,67108864,2448880128,102400000000,4829076871168,253613523861504,14681377947951104,928873060356849664,63772920000000000000,4722366482869645213696,375183514207494575620096,31834644439785603537567744,2873301064894278368461586432,274877906944000000000000000000,27784111226263492101313986035712,2958785768058379228237572188667904,331111646327539118477669005508214784 mov $1,$0 mul $0,2 pow $0,$1 mov $3,$1 pow $3,2 mov $2,$3 cmp $2,0 add $3,$2 div $0,$3
src/compiler/RQL.g4
michalwidera/abracadabradb
2
6252
grammar RQL; prog : ( select_statement | declare_statement | storage_statement )+ EOF ; storage_statement : STORAGE folder_name=STRING # Storage ; select_statement : SELECT select_list STREAM ID FROM stream_expression # Select ; rational : fraction # RationalAsFraction_proforma | FLOAT # RationalAsFloat | DECIMAL # RationalAsDecimal ; fraction : DECIMAL DIVIDE DECIMAL ; declare_statement : DECLARE declare_list STREAM stream_name=ID COMMA rational FILE file_name=STRING # Declare ; declare_list : field_declaration (COMMA field_declaration)* # DeclarationList ; field_declaration : ID field_type # SingleDeclaration ; field_type : (STRING_T | INTARRAY_T | BYTEARRAY_T) '[' type_size=DECIMAL ']' # typeArray | BYTE_T # typeByte | INTEGER_T # typeInt | UNSIGNED_T # typeUnsiged | FLOAT_T # typeFloat ; select_list : asterisk # SelectListFullscan | expression (COMMA expression)* # SelectList ; field_id : column_name=ID # FieldID // id - ID3 | tablename=ID '[' UNDERLINE ']' # FieldIDUnderline // id[_] - IDX | tablename=ID DOT column_name=ID # FieldIDColumnname // id.id - ID1 | tablename=ID '[' column_index=DECIMAL ']' # FieldIDTable // id[x] - ID2 ; unary_op_expression : BIT_NOT expression | op=(PLUS | MINUS) expression ; asterisk : (ID DOT)? STAR ; expression : expression_factor ; expression_factor : expression_factor PLUS expression_factor # ExpPlus | expression_factor MINUS expression_factor # ExpMinus | term # ExpTerm ; term : term STAR term # ExpMult | term DIVIDE term # ExpDiv | '(' expression_factor ')' # ExpIn | factor # ExpFactor ; factor : '-'? FLOAT # ExpFloat | '-'? DECIMAL # ExpDec | unary_op_expression # ExpUnary | field_id # ExpField | agregator # ExpAgg | function_call # ExpFnCall ; stream_expression : stream_term GREATER DECIMAL # SExpTimeMove | stream_term MINUS rational # SExpMinus | stream_term PLUS stream_term # SExpPlus | stream_term # SExpTerm ; stream_term : stream_factor SHARP stream_factor # SExpHash | stream_factor AND rational # SExpAnd | stream_factor MOD rational # SExpMod | stream_factor AT '(' '-'? window=DECIMAL COMMA step=DECIMAL ')' # SExpAgse | stream_factor DOT agregator # SExpAgregate_proforma | stream_factor # SExpFactor ; stream_factor : ID | '(' stream_expression ')' ; agregator : MIN # StreamMin | MAX # StreamMax | AVG # StreamAvg | SUMC # StreamSum ; function_call : ( 'Sqrt' | 'Ceil' | 'Abs' | 'Floor' | 'Sign' | 'Chr' | 'Length' | 'ToNumber' | 'ToTimeStamp' | 'FloatCast' | 'InstCast' | 'Count' | 'Crc' | 'Sum' | 'IsZero' | 'IsNonZero' ) '(' expression_factor ( COMMA expression_factor )* ')' ; // sync types with: src/include/rdb/desc.h STRING_T: 'STRING'|'String'; BYTEARRAY_T: 'BYTEARRAY'|'Bytearray'; INTARRAY_T: 'INTARRAY'|'Intarray'; BYTE_T: 'BYTE'|'Byte'; UNSIGNED_T: 'UINT'|'Uint'; INTEGER_T: 'INTEGER'|'Integer'; FLOAT_T: 'FLOAT'|'Float'; SELECT: 'SELECT'|'select'; STREAM: 'STREAM'|'stream'; FROM: 'FROM'|'from'; DECLARE: 'DECLARE'|'declare'; FILE: 'FILE'|'file'; STORAGE: 'STORAGE'|'storage'; MIN: 'MIN'|'min'; MAX: 'MAX'|'max'; AVG: 'AVG'|'avg'; SUMC: 'SUMC'|'sumc'; ID: ([A-Za-z]) ([A-Za-z_$0-9])*; STRING: '\'' (~'\'' | '\'\'')* '\''; FLOAT: DEC_DOT_DEC; DECIMAL: DEC_DIGIT+; REAL: (DECIMAL | DEC_DOT_DEC) ('E' [+-]? DEC_DIGIT+); EQUAL: '='; GREATER: '>'; LESS: '<'; EXCLAMATION: '!'; DOUBLE_BAR: '||'; DOT: '.'; UNDERLINE: '_'; AT: '@'; SHARP: '#'; AND: '&'; MOD: '%'; DOLLAR: '$'; COMMA: ','; SEMI: ';'; COLON: ':'; DOUBLE_COLON: '::'; STAR: '*'; DIVIDE: '/'; PLUS: '+'; MINUS: '-'; BIT_NOT: '~'; BIT_OR: '|'; BIT_XOR: '^'; SPACE: [ \t\r\n]+ -> skip; COMMENT: '/*' (COMMENT | .)*? '*/' -> channel(HIDDEN); LINE_COMMENT: '# ' ~[\r\n]* -> channel(HIDDEN); fragment LETTER: [A-Z_]; fragment DEC_DOT_DEC: (DEC_DIGIT+ '.' DEC_DIGIT+ | DEC_DIGIT+ '.' | '.' DEC_DIGIT+); fragment HEX_DIGIT: [0-9A-F]; fragment DEC_DIGIT: [0-9];
oeis/297/A297390.asm
neoneye/loda-programs
11
98925
; A297390: Number of n X 3 0..1 arrays with every 1 horizontally, diagonally or antidiagonally adjacent to 1 neighboring 1. ; Submitted by <NAME> ; 3,9,19,57,139,369,963,2489,6523,16929,44147,114953,299307,779697,2030243,5287833,13770971,35864001,93402579,243249193,633503627,1649849553,4296752131,11190160825,29142853947,75897603297,197662332211,514777809993,1340650929643,3491496420849,9093006430563,23681182733273,61673597578651,160618355689473,418303085748371,1089398972730473,2837153636788299,7388882276449041,19243082426069699,50115322914520569,130516802624544251,339908730028969761,885234256651909107,2305441490358794377,6004128766526193323 add $0,2 mov $2,1 lpb $0 sub $0,1 mul $4,-1 add $5,$1 mov $1,$3 mov $3,$2 mul $2,2 mul $5,2 sub $4,$5 sub $3,$4 mov $4,$2 mov $2,$3 add $5,$4 mov $3,$5 mov $5,0 lpe mov $0,$2
programs/oeis/088/A088821.asm
jmorken/loda
1
175427
; A088821: a(n) is the sum of smallest prime factors of numbers from 1 to n. ; 0,2,5,7,12,14,21,23,26,28,39,41,54,56,59,61,78,80,99,101,104,106,129,131,136,138,141,143,172,174,205,207,210,212,217,219,256,258,261,263,304,306,349,351,354,356,403,405,412,414,417,419,472,474,479,481,484,486,545,547,608,610,613,615,620,622,689,691,694,696,767,769,842,844,847,849,856,858,937,939,942,944,1027,1029,1034,1036,1039,1041,1130,1132,1139,1141,1144,1146,1151,1153,1250,1252,1255,1257,1358,1360,1463,1465,1468,1470,1577,1579,1688,1690,1693,1695,1808,1810,1815,1817,1820,1822,1829,1831,1842,1844,1847,1849,1854,1856,1983,1985,1988,1990,2121,2123,2130,2132,2135,2137,2274,2276,2415,2417,2420,2422,2433,2435,2440,2442,2445,2447,2596,2598,2749,2751,2754,2756,2761,2763,2920,2922,2925,2927,2934,2936,3099,3101,3104,3106,3273,3275,3288,3290,3293,3295,3468,3470,3475,3477,3480,3482,3661,3663,3844,3846,3849,3851,3856,3858,3869,3871,3874,3876,4067,4069,4262,4264,4267,4269,4466,4468,4667,4669,4672,4674,4681,4683,4688,4690,4693,4695,4706,4708,4919,4921,4924,4926,4931,4933,4940,4942,4945,4947,4960,4962,5185,5187,5190,5192,5419,5421,5650,5652,5655,5657,5890,5892,5897,5899,5902,5904,6143,6145,6386,6388,6391,6393,6398,6400,6413,6415,6418,6420 mov $3,$0 add $3,1 mov $5,$0 lpb $3 mov $0,$5 sub $3,1 sub $0,$3 mov $2,$0 mov $4,1 lpb $2 mul $2,$4 sub $2,1 add $4,$0 gcd $4,$2 lpe add $1,$4 lpe sub $1,1
test/Succeed/SizeSucMonotone.agda
shlevy/agda
3
5605
<filename>test/Succeed/SizeSucMonotone.agda -- Andreas, 2012-09-24 Ensure that size successor is monotone -- Andreas, 2015-03-16 SizeUniv is still imperfect, so we need type-in-type -- here to work around the conflation of sLub and the PTS rule. {-# OPTIONS --type-in-type #-} module SizeSucMonotone where open import Common.Size data Bool : Set where true false : Bool -- T should be monotone in its second arg T : Bool → Size → Set T true i = (Size< i → Bool) → Bool T false i = (Size< (↑ i) → Bool) → Bool test : {x : Bool}{i : Size}{j : Size< i} → T x j → T x i test h = h
libsrc/graphics/drawto.asm
meesokim/z88dk
0
80187
; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by <NAME> - 30/9/98 ; ; ; $Id: drawto.asm,v 1.5 2015/01/19 01:32:46 pauloscustodio Exp $ ; ;Usage: drawto(struct *pixels) PUBLIC drawto EXTERN swapgfxbk EXTERN swapgfxbk1 EXTERN coords EXTERN Line EXTERN plotpixel .drawto ld ix,0 add ix,sp ld hl,(coords) ld e,(ix+2) ;y ld d,(ix+4) ;x call swapgfxbk ld ix,plotpixel call Line jp swapgfxbk1
TI-86/inc/ascii.asm
aaronjamt/3-Player-Pong
1
6277
; Convert 16-bit binary value to decimal, in ASCII format. ; HL = address to output 5-characters of ASCII + null to ; DE = value to convert to ASCII Num2ASCII: ld bc,-10000 call _Num1 ld bc,-1000 call _Num1 ld bc,-100 call _Num1 ld c,-10 call _Num1 ld c,b _Num1: ld a,'0'-1 _Num2: inc a push hl ld h,d ld l,e add hl,bc ld d,h ld e,l pop hl jr c,_Num2 push hl ld h,d ld l,e sbc hl,bc ld d,h ld e,l pop hl ld (hl),a inc hl ld a,0 ld (hl),a ret ; Shrinks ASCII number by removing leading ASCII 0's ($30) ; Inputs: ; HL = Address to start of ASCII string ; Destroys D, E, H, L, A AsciiShrink: ld d,h ld e,l _ZeroLoop: ld a,(hl) cp $00 jp z,_ZeroDone cp '0' jp nz,_DoShrink inc hl jp _ZeroLoop _DoShrink: ld (de),a inc de inc hl ld a,(hl) cp $00 jp z,_Done jp _DoShrink _ZeroDone: ld a,'0' ld (de),a inc de _Done: ld a,0 ld (de),a ret ; Calculates the length of an ASCII string, not including the null-terminator. ; Inputs: ; HL = Address to start of ASCII string ; Outputs: ; B = Length of ASCII string, not including the null-terminator ; Destroys: ; A AsciiLength: ld a,0 ld b,0 _Loop: ld a,(hl) cp 0 jp z,_LengthDone inc b inc hl jp _Loop _LengthDone: ret
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-cofuba.adb
orb-zhuchen/Orb
0
15755
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- ADA.CONTAINERS.FUNCTIONAL_BASE -- -- -- -- B o d y -- -- -- -- Copyright (C) 2016-2019, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- 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/>. -- ------------------------------------------------------------------------------ pragma Ada_2012; package body Ada.Containers.Functional_Base with SPARK_Mode => Off is function To_Count (Idx : Extended_Index) return Count_Type is (Count_Type (Extended_Index'Pos (Idx) - Extended_Index'Pos (Extended_Index'First))); function To_Index (Position : Count_Type) return Extended_Index is (Extended_Index'Val (Position + Extended_Index'Pos (Extended_Index'First))); -- Conversion functions between Index_Type and Count_Type function Find (C : Container; E : access Element_Type) return Count_Type; -- Search a container C for an element equal to E.all, returning the -- position in the underlying array. --------- -- "=" -- --------- function "=" (C1 : Container; C2 : Container) return Boolean is begin if C1.Elements'Length /= C2.Elements'Length then return False; end if; for I in C1.Elements'Range loop if C1.Elements (I).all /= C2.Elements (I).all then return False; end if; end loop; return True; end "="; ---------- -- "<=" -- ---------- function "<=" (C1 : Container; C2 : Container) return Boolean is begin for I in C1.Elements'Range loop if Find (C2, C1.Elements (I)) = 0 then return False; end if; end loop; return True; end "<="; --------- -- Add -- --------- function Add (C : Container; I : Index_Type; E : Element_Type) return Container is A : constant Element_Array_Access := new Element_Array'(1 .. C.Elements'Last + 1 => <>); P : Count_Type := 0; begin for J in 1 .. C.Elements'Last + 1 loop if J /= To_Count (I) then P := P + 1; A (J) := C.Elements (P); else A (J) := new Element_Type'(E); end if; end loop; return Container'(Elements => A); end Add; ---------- -- Find -- ---------- function Find (C : Container; E : access Element_Type) return Count_Type is begin for I in C.Elements'Range loop if C.Elements (I).all = E.all then return I; end if; end loop; return 0; end Find; function Find (C : Container; E : Element_Type) return Extended_Index is (To_Index (Find (C, E'Unrestricted_Access))); --------- -- Get -- --------- function Get (C : Container; I : Index_Type) return Element_Type is (C.Elements (To_Count (I)).all); ------------------ -- Intersection -- ------------------ function Intersection (C1 : Container; C2 : Container) return Container is A : constant Element_Array_Access := new Element_Array'(1 .. Num_Overlaps (C1, C2) => <>); P : Count_Type := 0; begin for I in C1.Elements'Range loop if Find (C2, C1.Elements (I)) > 0 then P := P + 1; A (P) := C1.Elements (I); end if; end loop; return Container'(Elements => A); end Intersection; ------------ -- Length -- ------------ function Length (C : Container) return Count_Type is (C.Elements'Length); --------------------- -- Num_Overlaps -- --------------------- function Num_Overlaps (C1 : Container; C2 : Container) return Count_Type is P : Count_Type := 0; begin for I in C1.Elements'Range loop if Find (C2, C1.Elements (I)) > 0 then P := P + 1; end if; end loop; return P; end Num_Overlaps; ------------ -- Remove -- ------------ function Remove (C : Container; I : Index_Type) return Container is A : constant Element_Array_Access := new Element_Array'(1 .. C.Elements'Last - 1 => <>); P : Count_Type := 0; begin for J in C.Elements'Range loop if J /= To_Count (I) then P := P + 1; A (P) := C.Elements (J); end if; end loop; return Container'(Elements => A); end Remove; --------- -- Set -- --------- function Set (C : Container; I : Index_Type; E : Element_Type) return Container is Result : constant Container := Container'(Elements => new Element_Array'(C.Elements.all)); begin Result.Elements (To_Count (I)) := new Element_Type'(E); return Result; end Set; ----------- -- Union -- ----------- function Union (C1 : Container; C2 : Container) return Container is N : constant Count_Type := Num_Overlaps (C1, C2); begin -- if C2 is completely included in C1 then return C1 if N = Length (C2) then return C1; end if; -- else loop through C2 to find the remaining elements declare L : constant Count_Type := Length (C1) - N + Length (C2); A : constant Element_Array_Access := new Element_Array' (C1.Elements.all & (Length (C1) + 1 .. L => <>)); P : Count_Type := Length (C1); begin for I in C2.Elements'Range loop if Find (C1, C2.Elements (I)) = 0 then P := P + 1; A (P) := C2.Elements (I); end if; end loop; return Container'(Elements => A); end; end Union; end Ada.Containers.Functional_Base;
programs/oeis/197/A197903.asm
neoneye/loda
22
4043
; A197903: Ceiling((n+1/n)^4). ; 16,40,124,327,732,1447,2604,4359,6892,10407,15132,21319,29244,39207,51532,66567,84684,106279,131772,161607,196252,236199,281964,334087,393132,459687,534364,617799,710652,813607,927372,1052679,1190284,1340967,1505532,1684807,1879644,2090919,2319532,2566407,2832492,3118759,3426204,3755847,4108732,4485927,4888524,5317639,5774412,6260007,6775612,7322439,7901724,8514727,9162732,9847047,10569004,11329959,12131292,12974407,13860732,14791719,15768844,16793607,17867532,18992167,20169084,21399879,22686172,24029607,25431852,26894599,28419564,30008487,31663132,33385287,35176764,37039399,38975052,40985607,43072972,45239079,47485884,49815367,52229532,54730407,57320044,60000519,62773932,65642407,68608092,71673159,74839804,78110247,81486732,84971527,88566924,92275239,96098812,100040007 mov $1,2 sub $1,$0 mul $1,2 mov $3,$0 trn $0,$1 add $1,$0 add $1,12 mov $2,11 mov $4,$3 lpb $2 add $1,$4 sub $2,1 lpe mov $6,$3 lpb $6 add $5,$4 sub $6,1 lpe mov $2,10 mov $4,$5 lpb $2 add $1,$4 sub $2,1 lpe mov $5,0 mov $6,$3 lpb $6 add $5,$4 sub $6,1 lpe mov $2,4 mov $4,$5 lpb $2 add $1,$4 sub $2,1 lpe mov $5,0 mov $6,$3 lpb $6 add $5,$4 sub $6,1 lpe mov $2,1 mov $4,$5 lpb $2 add $1,$4 sub $2,1 lpe mov $0,$1
programs/oeis/082/A082655.asm
neoneye/loda
22
169473
<gh_stars>10-100 ; A082655: Number of distinct letters needed to spell English names of numbers 1 through n. ; 3,5,7,9,11,13,13,14,14,14,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16 mul $0,2 mov $2,2 mul $2,$0 sub $0,4 sub $2,1 mov $3,2 lpb $0 mul $0,20 sub $0,$3 div $0,$2 mov $2,1 lpe add $0,49 add $1,$0 sub $1,42 mov $0,$1
opengl-check.adb
io7m/coreland-opengl-ada
1
3866
with OpenGL.Error; package body OpenGL.Check is procedure State_OK (Message : in String := "") is use type Error.Error_t; Error_Value : constant Error.Error_t := Error.Get_Error; begin if Error_Value /= Error.No_Error then if Message'Length /= 0 then Raise_Exception (Message & ": " & Error.Error_t'Image (Error_Value)); else Raise_Exception (Error.Error_t'Image (Error_Value)); end if; end if; end State_OK; procedure Raise_Exception (Message : in String) is begin raise GL_Error with Message; end Raise_Exception; end OpenGL.Check;
source/nodes/program-nodes-attribute_references.ads
reznikmm/gela
0
27871
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Program.Elements.Expressions; with Program.Lexical_Elements; with Program.Elements.Identifiers; with Program.Elements.Attribute_References; with Program.Element_Visitors; package Program.Nodes.Attribute_References is pragma Preelaborate; type Attribute_Reference is new Program.Nodes.Node and Program.Elements.Attribute_References.Attribute_Reference and Program.Elements.Attribute_References.Attribute_Reference_Text with private; function Create (Prefix : not null Program.Elements.Expressions .Expression_Access; Apostrophe_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Attribute_Designator : not null Program.Elements.Identifiers .Identifier_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Expressions : Program.Elements.Expressions.Expression_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access) return Attribute_Reference; type Implicit_Attribute_Reference is new Program.Nodes.Node and Program.Elements.Attribute_References.Attribute_Reference with private; function Create (Prefix : not null Program.Elements.Expressions .Expression_Access; Attribute_Designator : not null Program.Elements.Identifiers .Identifier_Access; Expressions : Program.Elements.Expressions.Expression_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Attribute_Reference with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Attribute_Reference is abstract new Program.Nodes.Node and Program.Elements.Attribute_References.Attribute_Reference with record Prefix : not null Program.Elements.Expressions .Expression_Access; Attribute_Designator : not null Program.Elements.Identifiers .Identifier_Access; Expressions : Program.Elements.Expressions.Expression_Access; end record; procedure Initialize (Self : in out Base_Attribute_Reference'Class); overriding procedure Visit (Self : not null access Base_Attribute_Reference; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Prefix (Self : Base_Attribute_Reference) return not null Program.Elements.Expressions.Expression_Access; overriding function Attribute_Designator (Self : Base_Attribute_Reference) return not null Program.Elements.Identifiers.Identifier_Access; overriding function Expressions (Self : Base_Attribute_Reference) return Program.Elements.Expressions.Expression_Access; overriding function Is_Attribute_Reference (Self : Base_Attribute_Reference) return Boolean; overriding function Is_Expression (Self : Base_Attribute_Reference) return Boolean; type Attribute_Reference is new Base_Attribute_Reference and Program.Elements.Attribute_References.Attribute_Reference_Text with record Apostrophe_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; end record; overriding function To_Attribute_Reference_Text (Self : in out Attribute_Reference) return Program.Elements.Attribute_References .Attribute_Reference_Text_Access; overriding function Apostrophe_Token (Self : Attribute_Reference) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Left_Bracket_Token (Self : Attribute_Reference) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Right_Bracket_Token (Self : Attribute_Reference) return Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Attribute_Reference is new Base_Attribute_Reference with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Attribute_Reference_Text (Self : in out Implicit_Attribute_Reference) return Program.Elements.Attribute_References .Attribute_Reference_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Attribute_Reference) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Attribute_Reference) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Attribute_Reference) return Boolean; end Program.Nodes.Attribute_References;
color/dmg.asm
etdv-thevoid/pokemon-rgb-enhanced
1
4001
; This gets run when you try to play it on a DMG. Shows an error message, plays a jingle. ; There's a copy of the audio engine in bank $31 that's used for this, hasn't been ; disassembled for now... RunDmgError: ld hl,Code_d000 ld de,$d000 ld b,Code_d000_end-Code_d000 .codeCopyLoop ld a,[hli] ld [de],a inc de dec b jr nz,.codeCopyLoop xor a ld [wAudioFadeOutCounterReloadValue],a ld [wAudioFadeOutCounter],a ; Use sound engine copy in bank $31 ld a,$31 ld [wAudioSavedROMBank],a ld [wAudioROMBank],a ld a,$c3 ld [wAudioFadeOutControl],a di call DisableLCD ; Load font ld de,FontCopy ld bc,$0200 ld hl,$8800 .nextByte ld a,[de] ld [hli],a ld [hli],a inc de dec bc ld a,c or b jr nz,.nextByte ; Load text ld de,DmgText ld bc,$0414 ld hl,$98e0 .nextCharacter ld a,[de] inc de ldi [hl],a dec c jr nz,.nextCharacter push de ld de,$000c add hl,de pop de ld c,$14 dec b jr nz,.nextCharacter call EnableLCD ei jp $d000 ; Copied to RAM at $d000 Code_d000: push af push bc push de push hl call FadeOutAudio ld a,[wAudioROMBank] ld [H_LOADEDROMBANK],a ld [MBC1RomBank],a call $5177 pop hl pop de pop bc pop af ld hl,rSTAT .frameWait bit 2,[hl] jr z,.frameWait jr Code_d000 Code_d000_end: FontCopy: INCBIN "gfx/font.1bpp" DmgText: db "This game will only " db " work on a " db " Gameboy Color " db " or GBA handheld "
os/lib/shift.asm
SimonFJ20/jdh-8
911
93979
; OS-BUNDLED SHIFT (LEFT/RIGHT) OPS ; INCLUDED IN OSTEXT.ASM ; SHIFT LEFT ; a: number to shift ; b: number of times to shift shl: push b jz b, [.done] clb .shift: ; a + a equivalent to left shift add a, a dec b jnz b, [.shift] .done: pop b ret ; SHIFT LEFT (16-bit) ; a, b: number to shift ; c: times to shift shl16: push c jz c, [.done] clb .shift: ; ab + ab equivalent to left shift add16 a, b, a, b dec c jnz c, [.shift] .done: pop c ret ; SHIFT RIGHT ; a: number to shift ; b: number of times to shift shr: push b, c jz b, [.done] mw c, a mw a, 0 .shift: jmn c, 0x80, [.try_64] add a, 64 sub c, 128 .try_64: jmn c, 0x40, [.try_32] add a, 32 sub c, 64 .try_32: jmn c, 0x20, [.try_16] add a, 16 sub c, 32 .try_16: jmn c, 0x10, [.try_08] add a, 8 sub c, 16 .try_08: jmn c, 0x08, [.try_04] add a, 4 sub c, 8 .try_04: jmn c, 0x04, [.try_02] add a, 2 sub c, 4 .try_02: jmn c, 0x02, [.next] add a, 1 sub c, 2 .next: dec b jnz b, [.shift] .done: pop c, b ret
agda/Data/List/Filter.agda
oisdk/combinatorics-paper
0
1164
{-# OPTIONS --cubical --safe #-} module Data.List.Filter where open import Prelude open import Data.List open import Data.List.Membership open import Data.Sigma.Properties open import Data.Bool.Properties open import Data.Fin module _ {p} {P : A → Type p} where filter : (P? : ∀ x → Dec (P x)) → List A → List (∃ P) filter P? = foldr f [] where f : _ → List (∃ P) → List (∃ P) f y ys with P? y ... | yes t = (y , t) ∷ ys ... | no _ = ys filter-preserves : (isPropP : ∀ x → isProp (P x)) (P? : ∀ x → Dec (P x)) (xs : List A) → (x : A) → (v : P x) → (x ∈ xs) → ((x , v) ∈ filter P? xs) filter-preserves isPropP P? (x ∷ xs) y v (n , y∈xs) with P? x filter-preserves isPropP P? (x ∷ xs) y v (f0 , y∈xs) | yes t = f0 , ΣProp≡ isPropP y∈xs filter-preserves isPropP P? (x ∷ xs) y v (fs n , y∈xs) | yes t = let m , q = filter-preserves isPropP P? xs y v (n , y∈xs) in fs m , q filter-preserves isPropP P? (x ∷ xs) y v (f0 , y∈xs) | no ¬t = ⊥-elim (¬t (subst P (sym y∈xs) v)) filter-preserves isPropP P? (x ∷ xs) y v (fs n , y∈xs) | no ¬t = filter-preserves isPropP P? xs y v (n , y∈xs)
source/containers/a-coinve.adb
ytomino/drake
33
7306
with Ada.Containers.Array_Sorting; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; with System.Address_To_Named_Access_Conversions; with System.Growth; with System.Long_Long_Integer_Types; package body Ada.Containers.Indefinite_Vectors is pragma Check_Policy (Validate => Ignore); use type Copy_On_Write.Data_Access; use type System.Address; use type System.Long_Long_Integer_Types.Word_Integer; subtype Word_Integer is System.Long_Long_Integer_Types.Word_Integer; package DA_Conv is new System.Address_To_Named_Access_Conversions (Data, Data_Access); function Upcast is new Unchecked_Conversion (Data_Access, Copy_On_Write.Data_Access); function Downcast is new Unchecked_Conversion (Copy_On_Write.Data_Access, Data_Access); procedure Free is new Unchecked_Deallocation (Element_Type, Element_Access); procedure Free is new Unchecked_Deallocation (Data, Data_Access); -- diff (Assign_Element) -- -- -- -- -- -- -- -- procedure Swap_Element (I, J : Word_Integer; Params : System.Address); procedure Swap_Element (I, J : Word_Integer; Params : System.Address) is Data : constant Data_Access := DA_Conv.To_Pointer (Params); Temp : constant Element_Access := Data.Items (Index_Type'Val (I)); begin Data.Items (Index_Type'Val (I)) := Data.Items (Index_Type'Val (J)); -- diff -- diff Data.Items (Index_Type'Val (J)) := Temp; end Swap_Element; function Equivalent_Element (Left : Element_Access; Right : Element_Type) return Boolean; function Equivalent_Element (Left : Element_Access; Right : Element_Type) return Boolean is begin return Left /= null and then Left.all = Right; end Equivalent_Element; procedure Allocate_Element ( Item : out Element_Access; New_Item : Element_Type); procedure Allocate_Element ( Item : out Element_Access; New_Item : Element_Type) is begin Item := new Element_Type'(New_Item); end Allocate_Element; procedure Free_Data (Data : in out Copy_On_Write.Data_Access); procedure Free_Data (Data : in out Copy_On_Write.Data_Access) is X : Data_Access := Downcast (Data); begin for I in X.Items'Range loop Free (X.Items (I)); end loop; Free (X); Data := null; end Free_Data; procedure Allocate_Data ( Target : out not null Copy_On_Write.Data_Access; New_Length : Count_Type; Capacity : Count_Type); procedure Allocate_Data ( Target : out not null Copy_On_Write.Data_Access; New_Length : Count_Type; Capacity : Count_Type) is New_Data : constant Data_Access := new Data'( Capacity_Last => Index_Type'First - 1 + Index_Type'Base (Capacity), Super => <>, Max_Length => New_Length, Items => <>); begin Target := Upcast (New_Data); end Allocate_Data; procedure Move_Data ( Target : out not null Copy_On_Write.Data_Access; Source : not null Copy_On_Write.Data_Access; Length : Count_Type; New_Length : Count_Type; Capacity : Count_Type); procedure Move_Data ( Target : out not null Copy_On_Write.Data_Access; Source : not null Copy_On_Write.Data_Access; Length : Count_Type; New_Length : Count_Type; Capacity : Count_Type) is begin Allocate_Data (Target, New_Length, Capacity); declare subtype R is Extended_Index range Index_Type'First .. Index_Type'First - 1 + Index_Type'Base (Length); begin for I in R loop Downcast (Target).Items (I) := Downcast (Source).Items (I); Downcast (Source).Items (I) := null; end loop; end; end Move_Data; procedure Copy_Data ( Target : out not null Copy_On_Write.Data_Access; Source : not null Copy_On_Write.Data_Access; Length : Count_Type; New_Length : Count_Type; Capacity : Count_Type); procedure Copy_Data ( Target : out not null Copy_On_Write.Data_Access; Source : not null Copy_On_Write.Data_Access; Length : Count_Type; New_Length : Count_Type; Capacity : Count_Type) is begin Allocate_Data (Target, New_Length, Capacity); declare subtype R is Extended_Index range Index_Type'First .. Index_Type'First - 1 + Index_Type'Base (Length); begin for I in R loop if Downcast (Source).Items (I) /= null then Allocate_Element ( Downcast (Target).Items (I), Downcast (Source).Items (I).all); end if; end loop; end; end Copy_Data; function Max_Length (Data : not null Copy_On_Write.Data_Access) return not null access Count_Type; function Max_Length (Data : not null Copy_On_Write.Data_Access) return not null access Count_Type is begin return Downcast (Data).Max_Length'Access; end Max_Length; procedure Reallocate ( Container : in out Vector; Length : Count_Type; Capacity : Count_Type; To_Update : Boolean); procedure Reallocate ( Container : in out Vector; Length : Count_Type; Capacity : Count_Type; To_Update : Boolean) is begin Copy_On_Write.Unique ( Target => Container.Super'Access, Target_Length => Container.Length, Target_Capacity => Indefinite_Vectors.Capacity (Container), New_Length => Length, New_Capacity => Capacity, To_Update => To_Update, Allocate => Allocate_Data'Access, Move => Move_Data'Access, Copy => Copy_Data'Access, Free => Free_Data'Access, Max_Length => Max_Length'Access); end Reallocate; procedure Unique (Container : in out Vector; To_Update : Boolean); procedure Unique (Container : in out Vector; To_Update : Boolean) is begin if Copy_On_Write.Shared (Container.Super.Data) then Reallocate ( Container, Container.Length, Capacity (Container), -- not shrinking To_Update); end if; end Unique; -- implementation function Empty_Vector return Vector is begin return (Finalization.Controlled with Super => <>, Length => 0); end Empty_Vector; function Has_Element (Position : Cursor) return Boolean is begin return Position /= No_Element; end Has_Element; overriding function "=" (Left, Right : Vector) return Boolean is begin if Left.Length /= Right.Length then return False; elsif Left.Length = 0 or else Left.Super.Data = Right.Super.Data then return True; else Unique (Left'Unrestricted_Access.all, False); -- private Unique (Right'Unrestricted_Access.all, False); -- private for I in Index_Type'First .. Last (Left) loop if Downcast (Left.Super.Data).Items (I) = null then if Downcast (Right.Super.Data).Items (I) /= null then return False; end if; elsif not Equivalent_Element ( Downcast (Right.Super.Data).Items (I), Downcast (Left.Super.Data).Items (I).all) then return False; end if; end loop; return True; end if; end "="; function To_Vector (Length : Count_Type) return Vector is begin return Result : Vector do Insert_Space (Result, Index_Type'First, Length); end return; end To_Vector; function To_Vector (New_Item : Element_Type; Length : Count_Type) return Vector is begin return Result : Vector do Append (Result, New_Item, Length); end return; end To_Vector; -- diff (Generic_Array_To_Vector) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- function "&" (Left, Right : Vector) return Vector is begin return Result : Vector := Left do Append (Result, Right); end return; end "&"; function "&" (Left : Vector; Right : Element_Type) return Vector is begin return Result : Vector := Left do Append (Result, Right); end return; end "&"; function "&" (Left : Element_Type; Right : Vector) return Vector is begin return Result : Vector do Reallocate (Result, 0, 1 + Right.Length, True); Append (Result, Left); Append (Result, Right); end return; end "&"; function "&" (Left, Right : Element_Type) return Vector is begin return Result : Vector do Reallocate (Result, 0, 2, True); Append (Result, Left); Append (Result, Right); end return; end "&"; function Capacity (Container : Vector) return Count_Type is Data : constant Data_Access := Downcast (Container.Super.Data); begin if Data = null then return 0; else return Count_Type'Base (Data.Capacity_Last - Index_Type'First + 1); end if; end Capacity; procedure Reserve_Capacity ( Container : in out Vector; Capacity : Count_Type) is New_Capacity : constant Count_Type := Count_Type'Max (Capacity, Container.Length); begin Reallocate (Container, Container.Length, New_Capacity, True); end Reserve_Capacity; function Length (Container : Vector) return Count_Type is begin return Container.Length; end Length; procedure Set_Length (Container : in out Vector; Length : Count_Type) is Old_Capacity : constant Count_Type := Capacity (Container); Failure : Boolean; begin Copy_On_Write.In_Place_Set_Length ( Target => Container.Super'Access, Target_Length => Container.Length, Target_Capacity => Old_Capacity, New_Length => Length, Failure => Failure, Max_Length => Max_Length'Access); if Failure then declare function Grow is new System.Growth.Good_Grow ( Count_Type, Component_Size => Element_Array'Component_Size); New_Capacity : Count_Type; begin if Old_Capacity >= Length then New_Capacity := Old_Capacity; -- not shrinking else New_Capacity := Count_Type'Max (Grow (Old_Capacity), Length); end if; Reallocate (Container, Length, New_Capacity, False); end; end if; Container.Length := Length; end Set_Length; function Is_Empty (Container : Vector) return Boolean is begin return Container.Length = 0; end Is_Empty; procedure Clear (Container : in out Vector) is begin Copy_On_Write.Clear (Container.Super'Access, Free => Free_Data'Access); Container.Length := 0; end Clear; function To_Cursor ( Container : Vector'Class; Index : Extended_Index) return Cursor is pragma Check (Pre, Check => Index <= Last_Index (Container) + 1 or else raise Constraint_Error); begin if Index = Index_Type'First + Index_Type'Base (Container.Length) then return No_Element; -- Last_Index (Container) + 1 else return Index; end if; end To_Cursor; function Element ( Container : Vector'Class; Index : Index_Type) return Element_Type is begin return Constant_Reference ( Vector (Container), Index) -- checking Constraint_Error .Element.all; end Element; procedure Replace_Element ( Container : in out Vector; Position : Cursor; New_Item : Element_Type) is pragma Check (Pre, Check => Position in Index_Type'First .. Last (Container) or else raise Constraint_Error); begin Unique (Container, True); declare E : Element_Access renames Downcast (Container.Super.Data).Items (Position); begin Free (E); Allocate_Element (E, New_Item); end; end Replace_Element; procedure Query_Element ( Container : Vector'Class; Index : Index_Type; Process : not null access procedure (Element : Element_Type)) is begin Process ( Constant_Reference ( Vector (Container), Index) -- checking Constraint_Error .Element.all); end Query_Element; procedure Update_Element ( Container : in out Vector'Class; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)) is begin Process ( Reference (Vector (Container), Position) -- checking Constraint_Error .Element.all); end Update_Element; function Constant_Reference (Container : aliased Vector; Position : Cursor) return Constant_Reference_Type is pragma Check (Pre, Check => Position in Index_Type'First .. Last (Container) or else raise Constraint_Error); begin Unique (Container'Unrestricted_Access.all, False); declare Data : constant Data_Access := Downcast (Container.Super.Data); begin return (Element => Data.Items (Position).all'Access); end; end Constant_Reference; function Reference (Container : aliased in out Vector; Position : Cursor) return Reference_Type is pragma Check (Pre, Check => Position in Index_Type'First .. Last (Container) or else raise Constraint_Error); begin Unique (Container, True); declare Data : constant Data_Access := Downcast (Container.Super.Data); begin return (Element => Data.Items (Position).all'Access); end; end Reference; procedure Assign (Target : in out Vector; Source : Vector) is begin Copy_On_Write.Assign ( Target.Super'Access, Source.Super'Access, Free => Free_Data'Access); Target.Length := Source.Length; end Assign; function Copy (Source : Vector; Capacity : Count_Type := 0) return Vector is begin return Result : Vector := Source do Reserve_Capacity (Result, Capacity); end return; end Copy; procedure Move (Target : in out Vector; Source : in out Vector) is begin Copy_On_Write.Move ( Target.Super'Access, Source.Super'Access, Free => Free_Data'Access); Target.Length := Source.Length; Source.Length := 0; end Move; procedure Insert ( Container : in out Vector; Before : Cursor; New_Item : Vector) is Position : Cursor; begin Insert ( Container, Before, -- checking Constraint_Error New_Item, -- checking Program_Error if same nonempty container Position); end Insert; procedure Insert ( Container : in out Vector; Before : Cursor; New_Item : Vector; Position : out Cursor) is pragma Check (Pre, Check => Before <= Last (Container) + 1 or else raise Constraint_Error); pragma Check (Pre, Check => Container'Address /= New_Item'Address or else Is_Empty (Container) or else raise Program_Error); -- same nonempty container (should this case be supported?) New_Item_Length : constant Count_Type := New_Item.Length; begin if Container.Length = 0 and then Capacity (Container) < New_Item_Length -- New_Item_Length > 0 then Position := Index_Type'First; Assign (Container, New_Item); else Insert_Space (Container, Before, Position, New_Item_Length); if New_Item_Length > 0 then Unique (New_Item'Unrestricted_Access.all, False); -- private declare D : constant Index_Type'Base := Position - Index_Type'First; begin for I in Position .. Position + Index_Type'Base (New_Item_Length) - 1 loop declare E : Element_Access renames Downcast (Container.Super.Data).Items (I); S : Element_Access renames Downcast (New_Item.Super.Data).Items (I - D); begin pragma Check (Validate, E = null); Allocate_Element (E, S.all); end; end loop; end; end if; end if; end Insert; procedure Insert ( Container : in out Vector; Before : Cursor; New_Item : Element_Type; Count : Count_Type := 1) is Position : Cursor; begin Insert ( Container, Before, -- checking Constraint_Error New_Item, Position, Count); end Insert; procedure Insert ( Container : in out Vector; Before : Cursor; New_Item : Element_Type; Position : out Cursor; Count : Count_Type := 1) is begin Insert_Space ( Container, Before, -- checking Constraint_Error Position, Count); for I in Position .. Position + Index_Type'Base (Count) - 1 loop declare E : Element_Access renames Downcast (Container.Super.Data).Items (I); begin pragma Check (Validate, E = null); Allocate_Element (E, New_Item); end; end loop; end Insert; procedure Prepend (Container : in out Vector; New_Item : Vector) is begin Insert ( Container, Index_Type'First, New_Item); -- checking Program_Error if same nonempty container end Prepend; procedure Prepend ( Container : in out Vector; New_Item : Element_Type; Count : Count_Type := 1) is begin Insert (Container, Index_Type'First, New_Item, Count); end Prepend; procedure Append (Container : in out Vector; New_Item : Vector) is New_Item_Length : constant Count_Type := New_Item.Length; Old_Length : constant Count_Type := Container.Length; begin if Old_Length = 0 and then Capacity (Container) < New_Item_Length then Assign (Container, New_Item); elsif New_Item_Length > 0 then Set_Length (Container, Old_Length + New_Item_Length); Unique (New_Item'Unrestricted_Access.all, False); -- private declare D : constant Index_Type'Base := Index_Type'Base (Old_Length); begin for I in Index_Type'First + D .. Last (Container) loop declare E : Element_Access renames Downcast (Container.Super.Data).Items (I); S : Element_Access renames Downcast (New_Item.Super.Data).Items (I - D); begin pragma Check (Validate, E = null); if S /= null then Allocate_Element (E, S.all); end if; end; end loop; end; end if; end Append; procedure Append ( Container : in out Vector; New_Item : Element_Type; Count : Count_Type := 1) is Old_Length : constant Count_Type := Container.Length; begin Set_Length (Container, Old_Length + Count); for I in Index_Type'First + Index_Type'Base (Old_Length) .. Last (Container) loop declare E : Element_Access renames Downcast (Container.Super.Data).Items (I); begin pragma Check (Validate, E = null); Allocate_Element (E, New_Item); end; end loop; end Append; procedure Insert_Space ( Container : in out Vector'Class; Before : Extended_Index; Count : Count_Type := 1) is Position : Cursor; begin Insert_Space ( Vector (Container), Before, -- checking Constraint_Error Position, Count); end Insert_Space; procedure Insert_Space ( Container : in out Vector; Before : Cursor; Position : out Cursor; Count : Count_Type := 1) is pragma Check (Pre, Check => Before <= Last (Container) + 1 or else raise Constraint_Error); Old_Length : constant Count_Type := Container.Length; After_Last : constant Index_Type'Base := Index_Type'First + Index_Type'Base (Old_Length); begin Position := Before; if Position = No_Element then Position := After_Last; end if; if Count > 0 then Set_Length (Container, Old_Length + Count); if Position < After_Last then -- Last_Index (Container) + 1 Unique (Container, True); declare Data : constant Data_Access := Downcast (Container.Super.Data); subtype R1 is Extended_Index range Position + Index_Type'Base (Count) .. After_Last - 1 + Index_Type'Base (Count); subtype R2 is Extended_Index range Position .. After_Last - 1; begin for I in R2'Last + 1 .. R1'Last loop Free (Data.Items (I)); end loop; Data.Items (R1) := Data.Items (R2); for I in R2'First .. R1'First - 1 loop Data.Items (I) := null; end loop; end; end if; end if; end Insert_Space; procedure Delete ( Container : in out Vector; Position : in out Cursor; Count : Count_Type := 1) is pragma Check (Pre, Check => Position in Index_Type'First .. Last (Container) - Index_Type'Base (Count) + 1 or else raise Constraint_Error); begin if Count > 0 then declare Old_Length : constant Count_Type := Container.Length; After_Last : constant Index_Type'Base := Index_Type'First + Index_Type'Base (Old_Length); begin if Position + Index_Type'Base (Count) < After_Last then Unique (Container, True); declare Data : constant Data_Access := Downcast (Container.Super.Data); subtype R1 is Extended_Index range Position .. After_Last - 1 - Index_Type'Base (Count); subtype R2 is Extended_Index range Position + Index_Type'Base (Count) .. After_Last - 1; begin for I in R1'First .. R2'First - 1 loop Free (Data.Items (I)); end loop; Data.Items (R1) := Data.Items (R2); for I in R1'Last + 1 .. R2'Last loop Data.Items (I) := null; end loop; end; end if; Set_Length (Container, Old_Length - Count); Position := No_Element; end; end if; end Delete; procedure Delete_First ( Container : in out Vector'Class; Count : Count_Type := 1) is Position : Cursor := Index_Type'First; begin Delete (Vector (Container), Position, Count => Count); end Delete_First; procedure Delete_Last ( Container : in out Vector'Class; Count : Count_Type := 1) is begin Set_Length (Vector (Container), Container.Length - Count); end Delete_Last; procedure Reverse_Elements (Container : in out Vector) is begin if Container.Length > 1 then Unique (Container, True); Array_Sorting.In_Place_Reverse ( Index_Type'Pos (Index_Type'First), Index_Type'Pos (Last (Container)), DA_Conv.To_Address (Downcast (Container.Super.Data)), Swap => Swap_Element'Access); end if; end Reverse_Elements; procedure Swap (Container : in out Vector; I, J : Cursor) is pragma Check (Pre, Check => (I in Index_Type'First .. Last (Container) and then J in Index_Type'First .. Last (Container)) or else raise Constraint_Error); begin Unique (Container, True); Swap_Element ( Index_Type'Pos (I), Index_Type'Pos (J), DA_Conv.To_Address (Downcast (Container.Super.Data))); end Swap; function First_Index (Container : Vector'Class) return Index_Type is pragma Unreferenced (Container); begin return Index_Type'First; end First_Index; function First (Container : Vector) return Cursor is begin if Container.Length = 0 then return No_Element; else return Index_Type'First; end if; end First; function First_Element (Container : Vector'Class) return Element_Type is begin return Element (Container, Index_Type'First); end First_Element; function Last_Index (Container : Vector'Class) return Extended_Index is begin return Last (Vector (Container)); end Last_Index; function Last (Container : Vector) return Cursor is begin return Index_Type'First - 1 + Index_Type'Base (Container.Length); end Last; function Last_Element (Container : Vector'Class) return Element_Type is begin return Element (Container, Last_Index (Container)); end Last_Element; function Find_Index ( Container : Vector'Class; Item : Element_Type; Index : Index_Type := Index_Type'First) return Extended_Index is begin if Index = Index_Type'First and then Container.Length = 0 then return No_Index; else return Find ( Vector (Container), Item, Index); -- checking Constraint_Error end if; end Find_Index; function Find ( Container : Vector; Item : Element_Type) return Cursor is begin return Find (Container, Item, First (Container)); end Find; function Find ( Container : Vector; Item : Element_Type; Position : Cursor) return Cursor is pragma Check (Pre, Check => Position in Index_Type'First .. Last (Container) or else (Is_Empty (Container) and then Position = No_Element) or else raise Constraint_Error); Last : constant Cursor := Indefinite_Vectors.Last (Container); begin if Position in Index_Type'First .. Last then Unique (Container'Unrestricted_Access.all, False); -- private for I in Position .. Last loop if Equivalent_Element ( Downcast (Container.Super.Data).Items (I), Item) then return I; end if; end loop; end if; return No_Element; end Find; function Reverse_Find_Index ( Container : Vector'Class; Item : Element_Type; Index : Index_Type := Index_Type'Last) return Extended_Index is Start : constant Extended_Index := Extended_Index'Min (Index, Last_Index (Container)); begin return Reverse_Find ( Vector (Container), Item, Start); -- checking Constraint_Error end Reverse_Find_Index; function Reverse_Find ( Container : Vector; Item : Element_Type) return Cursor is begin return Reverse_Find (Container, Item, Last (Container)); end Reverse_Find; function Reverse_Find ( Container : Vector; Item : Element_Type; Position : Cursor) return Cursor is pragma Check (Pre, Check => (Position in Index_Type'First .. Last (Container)) or else (Is_Empty (Container) and then Position = No_Element) or else raise Constraint_Error); begin if Position >= Index_Type'First then Unique (Container'Unrestricted_Access.all, False); -- private for I in reverse Index_Type'First .. Position loop if Equivalent_Element ( Downcast (Container.Super.Data).Items (I), Item) then return I; end if; end loop; end if; return No_Element; end Reverse_Find; function Contains (Container : Vector; Item : Element_Type) return Boolean is begin return Find (Container, Item) /= No_Element; end Contains; procedure Iterate ( Container : Vector'Class; Process : not null access procedure (Position : Cursor)) is begin for I in Index_Type'First .. Last (Vector (Container)) loop Process (I); end loop; end Iterate; procedure Reverse_Iterate ( Container : Vector'Class; Process : not null access procedure (Position : Cursor)) is begin for I in reverse Index_Type'First .. Last (Vector (Container)) loop Process (I); end loop; end Reverse_Iterate; function Iterate (Container : Vector'Class) return Vector_Iterator_Interfaces.Reversible_Iterator'Class is begin return Vector_Iterator'( First => First (Vector (Container)), Last => Last (Vector (Container))); end Iterate; function Iterate (Container : Vector'Class; First, Last : Cursor) return Vector_Iterator_Interfaces.Reversible_Iterator'Class is pragma Check (Pre, Check => (First <= Indefinite_Vectors.Last (Vector (Container)) + 1 and then Last <= Indefinite_Vectors.Last (Vector (Container))) or else raise Constraint_Error); Actual_First : Cursor := First; Actual_Last : Cursor := Last; begin if Actual_First = No_Element or else Actual_Last < Actual_First -- implies Last = No_Element then Actual_First := No_Element; Actual_Last := No_Element; end if; return Vector_Iterator'(First => Actual_First, Last => Actual_Last); end Iterate; -- diff (Constant_Reference) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff (Reference) -- -- -- -- -- -- -- -- -- -- -- -- -- -- overriding procedure Adjust (Object : in out Vector) is begin Copy_On_Write.Adjust (Object.Super'Access); end Adjust; overriding function First (Object : Vector_Iterator) return Cursor is begin return Object.First; end First; overriding function Next (Object : Vector_Iterator; Position : Cursor) return Cursor is begin if Position >= Object.Last then return No_Element; else return Position + 1; end if; end Next; overriding function Last (Object : Vector_Iterator) return Cursor is begin return Object.Last; end Last; overriding function Previous (Object : Vector_Iterator; Position : Cursor) return Cursor is begin if Position <= Object.First then return No_Element; else return Position - 1; end if; end Previous; -- diff (Constant_Indexing) -- -- -- -- -- -- -- diff (Indexing) -- -- -- -- -- -- package body Generic_Sorting is function LT (Left, Right : Word_Integer; Params : System.Address) return Boolean; function LT (Left, Right : Word_Integer; Params : System.Address) return Boolean is Data : constant Data_Access := DA_Conv.To_Pointer (Params); begin return Data.Items (Index_Type'Val (Left)).all < Data.Items (Index_Type'Val (Right)).all; end LT; function Is_Sorted (Container : Vector) return Boolean is begin if Container.Length <= 1 then return True; else Unique (Container'Unrestricted_Access.all, False); -- private return Array_Sorting.Is_Sorted ( Index_Type'Pos (Index_Type'First), Index_Type'Pos (Last (Container)), DA_Conv.To_Address (Downcast (Container.Super.Data)), LT => LT'Access); end if; end Is_Sorted; procedure Sort (Container : in out Vector) is begin if Container.Length > 1 then Unique (Container, True); Array_Sorting.In_Place_Merge_Sort ( Index_Type'Pos (Index_Type'First), Index_Type'Pos (Last (Container)), DA_Conv.To_Address (Downcast (Container.Super.Data)), LT => LT'Access, Swap => Swap_Element'Access); end if; end Sort; procedure Merge (Target : in out Vector; Source : in out Vector) is pragma Check (Pre, Check => Target'Address /= Source'Address or else Is_Empty (Target) or else raise Program_Error); -- RM A.18.2(237/3), same nonempty container begin if Source.Length > 0 then declare Old_Length : constant Count_Type := Target.Length; begin if Old_Length = 0 then Move (Target, Source); else Set_Length (Target, Old_Length + Source.Length); Unique (Target, True); Unique (Source, True); -- splicing for I in Index_Type'First .. Last (Source) loop Downcast (Target.Super.Data).Items ( I + Index_Type'Base (Old_Length)) := Downcast (Source.Super.Data).Items (I); Downcast (Source.Super.Data).Items (I) := null; end loop; Set_Length (Source, 0); Array_Sorting.In_Place_Merge ( Index_Type'Pos (Index_Type'First), Word_Integer (Index_Type'First) + Word_Integer (Old_Length), Index_Type'Pos (Last (Target)), DA_Conv.To_Address (Downcast (Target.Super.Data)), LT => LT'Access, Swap => Swap_Element'Access); end if; end; end if; end Merge; end Generic_Sorting; package body Streaming is procedure Read ( Stream : not null access Streams.Root_Stream_Type'Class; Item : out Vector) is Length : Count_Type'Base; begin Count_Type'Base'Read (Stream, Length); Clear (Item); if Length > 0 then Set_Length (Item, Length); for I in Index_Type'First .. Last (Item) loop declare E : Element_Access renames Downcast (Item.Super.Data).Items (I); begin pragma Check (Validate, E = null); Allocate_Element (E, Element_Type'Input (Stream)); end; end loop; end if; end Read; procedure Write ( Stream : not null access Streams.Root_Stream_Type'Class; Item : Vector) is Length : constant Count_Type := Indefinite_Vectors.Length (Item); begin Count_Type'Write (Stream, Length); if Length > 0 then Unique (Item'Unrestricted_Access.all, False); -- private for I in Index_Type'First .. Last (Item) loop Element_Type'Output ( Stream, Downcast (Item.Super.Data).Items (I).all); end loop; end if; end Write; end Streaming; end Ada.Containers.Indefinite_Vectors;
programs/oeis/098/A098390.asm
neoneye/loda
22
103396
; A098390: Prime(n)+Log2(prime(n)), where Log2=A000523. ; 3,4,7,9,14,16,21,23,27,33,35,42,46,48,52,58,64,66,73,77,79,85,89,95,103,107,109,113,115,119,133,138,144,146,156,158,164,170,174,180,186,188,198,200,204,206,218,230,234,236,240,246,248,258,265,271,277,279 seq $0,40 ; The prime numbers. mov $1,$0 lpb $1 add $0,1 div $1,2 lpe sub $0,1
testsuite/league/TN-331/test_331.adb
svn2github/matreshka
24
2804
<reponame>svn2github/matreshka ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Testsuite Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 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$ ------------------------------------------------------------------------------ -- Checkh whether finalization of JSON_Object and JSON_Value doesn't result in -- memory corruption. ------------------------------------------------------------------------------ with League.JSON.Objects; with League.JSON.Values; with League.Strings; procedure Test_331 is Object : League.JSON.Objects.JSON_Object; Value : League.JSON.Values.JSON_Value; begin Object.Insert (League.Strings.To_Universal_String ("name"), League.JSON.Values.To_JSON_Value (League.Strings.To_Universal_String ("peter"))); Value := Object.Value (League.Strings.To_Universal_String ("name")); end Test_331;
tests/test5.asm
JiahaoChenConor/COMP2017-Virtual_Machine
0
169632
FUNC LABEL 0 MOV STK A VAL 10 REF REG 0 STK A CAL VAL 1 PRINT STK A RET FUNC LABEL 1 MOV STK A REG 0 REF REG 0 STK A CAL VAL 5 RET FUNC LABEL 5 MOV STK A REG 0 MOV STK B PTR A MOV PTR B VAL 11 RET
1-base/lace/source/strings/lace-strings-search.adb
charlie5/lace
20
2969
with System; package body lace.Strings.Search is use Ada.Strings.Maps, System; ----------------------- -- Local Subprograms -- ----------------------- function Belongs (Element : Character; Set : Maps.Character_Set; Test : Membership) return Boolean; pragma Inline (Belongs); -- Determines if the given element is in (Test = Inside) or not in -- (Test = Outside) the given character set. ------------- -- Belongs -- ------------- function Belongs (Element : Character; Set : Maps.Character_Set; Test : Membership) return Boolean is begin if Test = Inside then return Is_In (Element, Set); else return not Is_In (Element, Set); end if; end Belongs; ----------- -- Count -- ----------- function Count (Source : String; Pattern : String; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural is PL1 : constant Integer := Pattern'Length - 1; Num : Natural; Ind : Natural; Cur : Natural; begin if Pattern = "" then raise Pattern_Error; end if; Num := 0; Ind := Source'First; -- Unmapped case if Mapping'Address = Maps.Identity'Address then while Ind <= Source'Last - PL1 loop if Pattern = Source (Ind .. Ind + PL1) then Num := Num + 1; Ind := Ind + Pattern'Length; else Ind := Ind + 1; end if; end loop; -- Mapped case else while Ind <= Source'Last - PL1 loop Cur := Ind; for K in Pattern'Range loop if Pattern (K) /= Value (Mapping, Source (Cur)) then Ind := Ind + 1; goto Cont; else Cur := Cur + 1; end if; end loop; Num := Num + 1; Ind := Ind + Pattern'Length; <<Cont>> null; end loop; end if; -- Return result return Num; end Count; function Count (Source : String; Pattern : String; Mapping : Maps.Character_Mapping_Function) return Natural is PL1 : constant Integer := Pattern'Length - 1; Num : Natural; Ind : Natural; Cur : Natural; begin if Pattern = "" then raise Pattern_Error; end if; -- Check for null pointer in case checks are off if Mapping = null then raise Constraint_Error; end if; Num := 0; Ind := Source'First; while Ind <= Source'Last - PL1 loop Cur := Ind; for K in Pattern'Range loop if Pattern (K) /= Mapping (Source (Cur)) then Ind := Ind + 1; goto Cont; else Cur := Cur + 1; end if; end loop; Num := Num + 1; Ind := Ind + Pattern'Length; <<Cont>> null; end loop; return Num; end Count; function Count (Source : String; Set : Maps.Character_Set) return Natural is N : Natural := 0; begin for J in Source'Range loop if Is_In (Source (J), Set) then N := N + 1; end if; end loop; return N; end Count; ---------------- -- Find_Token -- ---------------- procedure Find_Token (Source : String; Set : Maps.Character_Set; From : Positive; Test : Membership; First : out Positive; Last : out Natural) is begin for J in From .. Source'Last loop if Belongs (Source (J), Set, Test) then First := J; for K in J + 1 .. Source'Last loop if not Belongs (Source (K), Set, Test) then Last := K - 1; return; end if; end loop; -- Here if J indexes first char of token, and all chars after J -- are in the token. Last := Source'Last; return; end if; end loop; -- Here if no token found First := From; Last := 0; end Find_Token; procedure Find_Token (Source : String; Set : Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural) is begin for J in Source'Range loop if Belongs (Source (J), Set, Test) then First := J; for K in J + 1 .. Source'Last loop if not Belongs (Source (K), Set, Test) then Last := K - 1; return; end if; end loop; -- Here if J indexes first char of token, and all chars after J -- are in the token. Last := Source'Last; return; end if; end loop; -- Here if no token found First := Source'First; Last := 0; end Find_Token; ----------- -- Index -- ----------- function Index (Source : String; Pattern : String; Going : Direction := Forward; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural is PL1 : constant Integer := Pattern'Length - 1; Cur : Natural; Ind : Integer; -- Index for start of match check. This can be negative if the pattern -- length is greater than the string length, which is why this variable -- is Integer instead of Natural. In this case, the search loops do not -- execute at all, so this Ind value is never used. begin if Pattern = "" then raise Pattern_Error; end if; -- Forwards case if Going = Forward then Ind := Source'First; -- Unmapped forward case if Mapping'Address = Maps.Identity'Address then for J in 1 .. Source'Length - PL1 loop if Pattern = Source (Ind .. Ind + PL1) then return Ind; else Ind := Ind + 1; end if; end loop; -- Mapped forward case else for J in 1 .. Source'Length - PL1 loop Cur := Ind; for K in Pattern'Range loop if Pattern (K) /= Value (Mapping, Source (Cur)) then goto Cont1; else Cur := Cur + 1; end if; end loop; return Ind; <<Cont1>> Ind := Ind + 1; end loop; end if; -- Backwards case else -- Unmapped backward case Ind := Source'Last - PL1; if Mapping'Address = Maps.Identity'Address then for J in reverse 1 .. Source'Length - PL1 loop if Pattern = Source (Ind .. Ind + PL1) then return Ind; else Ind := Ind - 1; end if; end loop; -- Mapped backward case else for J in reverse 1 .. Source'Length - PL1 loop Cur := Ind; for K in Pattern'Range loop if Pattern (K) /= Value (Mapping, Source (Cur)) then goto Cont2; else Cur := Cur + 1; end if; end loop; return Ind; <<Cont2>> Ind := Ind - 1; end loop; end if; end if; -- Fall through if no match found. Note that the loops are skipped -- completely in the case of the pattern being longer than the source. return 0; end Index; function Index (Source : String; Pattern : String; Going : Direction := Forward; Mapping : Maps.Character_Mapping_Function) return Natural is PL1 : constant Integer := Pattern'Length - 1; Ind : Natural; Cur : Natural; begin if Pattern = "" then raise Pattern_Error; end if; -- Check for null pointer in case checks are off if Mapping = null then raise Constraint_Error; end if; -- If Pattern longer than Source it can't be found if Pattern'Length > Source'Length then return 0; end if; -- Forwards case if Going = Forward then Ind := Source'First; for J in 1 .. Source'Length - PL1 loop Cur := Ind; for K in Pattern'Range loop if Pattern (K) /= Mapping.all (Source (Cur)) then goto Cont1; else Cur := Cur + 1; end if; end loop; return Ind; <<Cont1>> Ind := Ind + 1; end loop; -- Backwards case else Ind := Source'Last - PL1; for J in reverse 1 .. Source'Length - PL1 loop Cur := Ind; for K in Pattern'Range loop if Pattern (K) /= Mapping.all (Source (Cur)) then goto Cont2; else Cur := Cur + 1; end if; end loop; return Ind; <<Cont2>> Ind := Ind - 1; end loop; end if; -- Fall through if no match found. Note that the loops are skipped -- completely in the case of the pattern being longer than the source. return 0; end Index; function Index (Source : String; Set : Maps.Character_Set; Test : Membership := Inside; Going : Direction := Forward) return Natural is begin -- Forwards case if Going = Forward then for J in Source'Range loop if Belongs (Source (J), Set, Test) then return J; end if; end loop; -- Backwards case else for J in reverse Source'Range loop if Belongs (Source (J), Set, Test) then return J; end if; end loop; end if; -- Fall through if no match return 0; end Index; function Index (Source : String; Pattern : String; From : Positive; Going : Direction := Forward; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural is begin if Going = Forward then if From < Source'First then raise Index_Error; end if; return Index (Source (From .. Source'Last), Pattern, Forward, Mapping); else if From > Source'Last then raise Index_Error; end if; return Index (Source (Source'First .. From), Pattern, Backward, Mapping); end if; end Index; function Index (Source : String; Pattern : String; From : Positive; Going : Direction := Forward; Mapping : Maps.Character_Mapping_Function) return Natural is begin if Going = Forward then if From < Source'First then raise Index_Error; end if; return Index (Source (From .. Source'Last), Pattern, Forward, Mapping); else if From > Source'Last then raise Index_Error; end if; return Index (Source (Source'First .. From), Pattern, Backward, Mapping); end if; end Index; function Index (Source : String; Set : Maps.Character_Set; From : Positive; Test : Membership := Inside; Going : Direction := Forward) return Natural is begin if Going = Forward then if From < Source'First then raise Index_Error; end if; return Index (Source (From .. Source'Last), Set, Test, Forward); else if From > Source'Last then raise Index_Error; end if; return Index (Source (Source'First .. From), Set, Test, Backward); end if; end Index; --------------------- -- Index_Non_Blank -- --------------------- function Index_Non_Blank (Source : String; Going : Direction := Forward) return Natural is begin if Going = Forward then for J in Source'Range loop if Source (J) /= ' ' then return J; end if; end loop; else -- Going = Backward for J in reverse Source'Range loop if Source (J) /= ' ' then return J; end if; end loop; end if; -- Fall through if no match return 0; end Index_Non_Blank; function Index_Non_Blank (Source : String; From : Positive; Going : Direction := Forward) return Natural is begin if Going = Forward then if From < Source'First then raise Index_Error; end if; return Index_Non_Blank (Source (From .. Source'Last), Forward); else if From > Source'Last then raise Index_Error; end if; return Index_Non_Blank (Source (Source'First .. From), Backward); end if; end Index_Non_Blank; end lace.Strings.Search;
programs/oeis/194/A194715.asm
karttu/loda
1
15589
<reponame>karttu/loda ; A194715: 15 times triangular numbers. ; 0,15,45,90,150,225,315,420,540,675,825,990,1170,1365,1575,1800,2040,2295,2565,2850,3150,3465,3795,4140,4500,4875,5265,5670,6090,6525,6975,7440,7920,8415,8925,9450,9990,10545,11115,11700,12300,12915,13545,14190,14850,15525,16215,16920,17640,18375,19125,19890,20670,21465,22275,23100,23940,24795,25665,26550,27450,28365,29295,30240,31200,32175,33165,34170,35190,36225,37275,38340,39420,40515,41625,42750,43890,45045,46215,47400,48600,49815,51045,52290,53550,54825,56115,57420,58740,60075,61425,62790,64170,65565,66975,68400,69840,71295,72765,74250,75750,77265,78795,80340,81900,83475,85065,86670,88290,89925,91575,93240,94920,96615,98325,100050,101790,103545,105315,107100,108900,110715,112545,114390,116250,118125,120015,121920,123840,125775,127725,129690,131670,133665,135675,137700,139740,141795,143865,145950,148050,150165,152295,154440,156600,158775,160965,163170,165390,167625,169875,172140,174420,176715,179025,181350,183690,186045,188415,190800,193200,195615,198045,200490,202950,205425,207915,210420,212940,215475,218025,220590,223170,225765,228375,231000,233640,236295,238965,241650,244350,247065,249795,252540,255300,258075,260865,263670,266490,269325,272175,275040,277920,280815,283725,286650,289590,292545,295515,298500,301500,304515,307545,310590,313650,316725,319815,322920,326040,329175,332325,335490,338670,341865,345075,348300,351540,354795,358065,361350,364650,367965,371295,374640,378000,381375,384765,388170,391590,395025,398475,401940,405420,408915,412425,415950,419490,423045,426615,430200,433800,437415,441045,444690,448350,452025,455715,459420,463140,466875 sub $1,$0 bin $1,2 mul $1,15
alloy4fun_models/trashltl/models/5/Je9uBa3bvBEzF7qFe.als
Kaixi26/org.alloytools.alloy
0
3583
<gh_stars>0 open main pred idJe9uBa3bvBEzF7qFe_prop6 { all f : File | always (f in Trash implies always f in Trash) } pred __repair { idJe9uBa3bvBEzF7qFe_prop6 } check __repair { idJe9uBa3bvBEzF7qFe_prop6 <=> prop6o }
Snippets/Weekday Based Alarm.applescript
rogues-gallery/applescript
360
2163
<reponame>rogues-gallery/applescript set datte to current date set dayy to weekday of datte as text if dayy contains "Monday" then display dialog "yes" end if
include/alloca_h.ads
docandrew/troodon
5
6102
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with stddef_h; with System; package alloca_h is -- arg-macro: procedure alloca (size) -- __builtin_alloca (size) -- Copyright (C) 1992-2021 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- The GNU C 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 -- Lesser General Public License for more details. -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- <https://www.gnu.org/licenses/>. -- Remove any previous definition. -- Allocate a block that will be freed when the calling function exits. function alloca (uu_size : stddef_h.size_t) return System.Address -- /usr/include/alloca.h:32 with Import => True, Convention => C, External_Name => "alloca"; end alloca_h;
c++/compilers/xCode/ProjBuilder.applescript
OpenHero/gblastn
31
3363
<reponame>OpenHero/gblastn (* $Id: ProjBuilder.applescript 168971 2009-08-24 10:53:56Z lebedev $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Author: <NAME> * * File Description: * xCode Project Generator Script * * Know issues: * 1) Script build phase should be changed for "gui_project". Use better sed command-line options. *) property upper_alphabet : "ABCDEFGHIJKLMNOPQRSTUVWXYZ" property ret : " " -- For some reason standard return does not work. (* Project starts here *) global newProject (* external globals *) global TheNCBIPath, TheFLTKPath, TheBDBPath, ThePCREPath, TheOUTPath global libTypeDLL, guiLibs, zeroLink, fixContinue, xcodeTarget, projFile (**) (* Hold keys and values for object dictionary of the project *) global objValues global objKeys (* file count: file indexes and references will use this number*) global refFileCount (* all targets go here, as a dependencie for master target: Build All *) global allDepList, libDepList, appDepList (* Build settings: You could target older versions of Mac OS X with this settings*) property buildSettings10_1 : {|MACOSX_DEPLOYMENT_TARGET|:"10.1", |SDKROOT|:"/Developer/SDKs/MacOSX10.1.5.sdk"} property buildSettings10_2 : {|MACOSX_DEPLOYMENT_TARGET|:"10.2", |SDKROOT|:"/Developer/SDKs/MacOSX10.2.8.sdk"} (* Build settings for the project *) property buildSettingsCommon : {|GCC_MODEL_CPU|:"|none|", |GCC_MODEL_TUNING|:"|none|", |FRAMEWORK_SEARCH_PATHS|:"/System/Library/Frameworks/CoreServices.framework/Frameworks", |LIBRARY_SEARCH_PATHS|:"", |GCC_ALTIVEC_EXTENSIONS|:"NO", |PREBINDING|:"NO", |HEADER_SEARCH_PATHS|:"", |ZERO_LINK|:"NO", |GCC_PRECOMPILE_PREFIX_HEADER|:"YES", |OTHER_CPLUSPLUSFLAGS|:"", |GCC_PREFIX_HEADER|:"", |STRIP_INSTALLED_PRODUCT|:"NO", |DEAD_CODE_STRIPPING|:"YES", |OBJROOT|:""} property buildSettingsDebug : buildSettingsCommon & {|COPY_PHASE_STRIP|:"NO", |DEBUGGING_SYMBOLS|:"YES", |GCC_DYNAMIC_NO_PIC|:"NO", |GCC_ENABLE_FIX_AND_CONTINUE|:"NO", |GCC_OPTIMIZATION_LEVEL|:"0", |OPTIMIZATION_CFLAGS|:"-O0", |GCC_PREPROCESSOR_DEFINITIONS|:"NCBI_DLL_BUILD NCBI_XCODE_BUILD _DEBUG _MT HAVE_CONFIG_H"} property buildSettingsRelease : buildSettingsCommon & {|COPY_PHASE_STRIP|:"YES", |GCC_ENABLE_FIX_AND_CONTINUE|:"NO", |DEPLOYMENT_POSTPROCESSING|:"YES", |GCC_PREPROCESSOR_DEFINITIONS|:"NCBI_DLL_BUILD NCBI_XCODE_BUILD _MT NDEBUG HAVE_CONFIG_H"} (* Build styles for the project *) property buildStyleDebug : {isa:"PBXBuildStyle", |name|:"Debug", |buildRules|:{}, |buildSettings|:buildSettingsDebug} property buildStyleRelease : {isa:"PBXBuildStyle", |name|:"Release", |buildRules|:{}, |buildSettings|:buildSettingsRelease} property projectBuildStyles : {} (* Root Objects, project and main group *) property rootObject : {isa:"PBXProject", |hasScannedForEncodings|:"1", |mainGroup|:"MAINGROUP", |targets|:{}, |buildSettings|:{|name|:"NCBI", |GCC_GENERATE_DEBUGGING_SYMBOLS|:"NO"}, |buildStyles|:{}} property mainGroup : {isa:"PBXGroup", children:{"HEADERS", "SOURCES", "FRAMEWORKS"}, |name|:"NCBI C++ Toolkit", |refType|:"4"} property emptyProject : {|rootObject|:"ROOT_OBJECT", |archiveVersion|:"1", |objectVersion|:"39", objects:{}} (* Convinience Groups *) property headers : {isa:"PBXGroup", children:{}, |name|:"Headers", |refType|:"4"} property sources : {isa:"PBXGroup", children:{}, |name|:"Sources", |refType|:"4"} property fworks : {isa:"PBXGroup", children:{}, |name|:"External Frameworks", |refType|:"4"} (* Empty templates for the variouse things in the project *) property toolProduct : {isa:"PBXExecutableFileReference", |explicitFileType|:"compiled.mach-o.executable", |refType|:"3"} property libProduct : {isa:"PBXLibraryReference", |explicitFileType|:"compiled.mach-o.dylib", |refType|:"3"} property appProduct : {isa:"PBXFileReference", |explicitFileType|:"wrapper.application", |refType|:"3"} script ProjBuilder on Initialize() set libraryPath to "" set headerPath to TheNCBIPath & "/include/util/regexp" -- for local pcre library set headerPath to headerPath & " " & TheNCBIPath & "/include" set pack to {TheFLTKPath, TheBDBPath, ThePCREPath} repeat with p in pack -- add all paths to headers set headerPath to headerPath & " " & p & "/include" set libraryPath to libraryPath & " " & p & "/lib" end repeat set libraryPath to libraryPath & " " & TheOUTPath & "/lib" set |HEADER_SEARCH_PATHS| of buildSettingsDebug to headerPath set |HEADER_SEARCH_PATHS| of buildSettingsRelease to headerPath set |LIBRARY_SEARCH_PATHS| of buildSettingsDebug to libraryPath set |LIBRARY_SEARCH_PATHS| of buildSettingsRelease to libraryPath set PCH to x_Replace(TheNCBIPath, ":", "/") & "/include/ncbi_pch.hpp" set |GCC_PREFIX_HEADER| of buildSettingsDebug to PCH set |GCC_PREFIX_HEADER| of buildSettingsRelease to PCH (* no-permissive flag for GCC *) set |OTHER_CPLUSPLUSFLAGS| of buildSettingsDebug to "-fno-permissive" set |OTHER_CPLUSPLUSFLAGS| of buildSettingsDebug to "-fno-permissive" (* Output directories and intermidiate files (works staring xCode 1.5) *) set |OBJROOT| of buildSettingsDebug to TheOUTPath set |OBJROOT| of buildSettingsRelease to TheOUTPath (* Set other options *) if zeroLink then set |ZERO_LINK| of buildSettingsDebug to "YES" end if if fixContinue then set |GCC_ENABLE_FIX_AND_CONTINUE| of buildSettingsDebug to "YES" end if set newProject to emptyProject set objValues to {} set objKeys to {} set refFileCount to 1 set allDepList to {} set libDepList to {} set appDepList to {} if xcodeTarget is 1 then copy "BUILDSTYLE__Development" to the end of projectBuildStyles copy "BUILDSTYLE__Deployment" to the end of projectBuildStyles else copy "BUILDSTYLE__Deployment" to the end of projectBuildStyles end if set |buildStyles| of rootObject to projectBuildStyles addPair(mainGroup, "MAINGROUP") addPair(buildStyleRelease, "BUILDSTYLE__Deployment") if xcodeTarget is 1 then set |GCC_GENERATE_DEBUGGING_SYMBOLS| of |buildSettings| of rootObject to "YES" --property rootObject : {isa:"PBXProject", |hasScannedForEncodings|:"1", |mainGroup|:"MAINGROUP", |targets|:{}, |buildSettings|:{|name|:"NCBI"}, |buildStyles|:{}} addPair(buildStyleDebug, "BUILDSTYLE__Development") end if set |objectVersion| of newProject to "42" log "Done initialize ProjBuilder" end Initialize on MakeNewTarget(target_info, src_files, hdr_files, aTarget, aProduct, aType) set tgName to name of target_info set fullTargetName to tgName if aType is equal to 0 then set fullTargetName to "lib" & tgName -- Library set targetName to "TARGET__" & tgName set targetProxy to "PROXY__" & tgName set buildPhaseName to "BUILDPHASE__" & tgName set prodRefName to "PRODUCT__" & tgName set depName to "DEPENDENCE__" & tgName set tgNameH to tgName & "H" set targetDepList to {} -- dependencies for this target try -- set dependencies (if any) set depString to dep of target_info set depList to x_Str2List(depString) repeat with d in depList if d is "datatool" then copy "DEPENDENCE__" & d to the end of targetDepList end repeat end try copy depName to the end of allDepList -- store a dependency for use in master target: Build All if aType is equal to 0 then copy depName to the end of libDepList -- Library if aType is equal to 1 then copy depName to the end of appDepList -- Application --if aType equals 2 then copy depName to the end of testDepList -- Tests -- Add to proper lists copy targetName to the end of |targets| of rootObject copy tgName to the end of children of sources copy tgNameH to the end of children of headers set libDepend to {isa:"PBXTargetDependency", |target|:targetName} --, |targetProxy|:targetProxy} --set aProxy to {isa:"PBXContainerItemProxy", |proxyType|:"1", |containerPortal|:"ROOT_OBJECT", |remoteInfo|:fullTargetName} --|remoteGlobalIDString|:targetName} set buildFileRefs to {} set libFileRefs to {} -- Add Source Files repeat with F in src_files set nameRef to "FILE" & refFileCount set nameBuild to "REF_FILE" & refFileCount set filePath to F --"/" & x_Replace(f, ":", "/") -- f will contain something like "users:vlad:c++:src:corelib:ncbicore.cpp" set fileName to x_FileNameFromPath(F) --set first_char to first character of fileName --considering case --set valid_idx to offset of first_char in upper_alphabet --end considering --if valid_idx is 0 then -- no capital first letters! if fileName ends with ".cpp" then set fileType to "sourcecode.cpp.cpp" else set fileType to "sourcecode.c.c" end if set fileRef to {isa:"PBXFileReference", |lastKnownFileType|:fileType, |name|:fileName, |path|:filePath, |sourceTree|:"<absolute>"} set fileBuild to {isa:"PBXBuildFile", |fileRef|:nameRef} addPair(fileRef, nameRef) addPair(fileBuild, nameBuild) copy nameBuild to the end of buildFileRefs copy nameRef to the end of libFileRefs set refFileCount to refFileCount + 1 --end if --if refFileCount = 3 then exit repeat --log f end repeat -- Add Header Files set hdrFileRefs to {} repeat with F in hdr_files set nameRef to "FILE" & refFileCount set filePath to F set fileName to x_FileNameFromPath(F) if fileName ends with ".hpp" then set fileType to "sourcecode.hpp.hpp" else set fileType to "sourcecode.h.h" end if set fileRef to {isa:"PBXFileReference", |lastKnownFileType|:fileType, |name|:fileName, |path|:filePath, |sourceTree|:"<absolute>"} addPair(fileRef, nameRef) copy nameRef to the end of hdrFileRefs set refFileCount to refFileCount + 1 end repeat set libGroup to {isa:"PBXGroup", |name|:tgName, children:libFileRefs, |refType|:"4"} set hdrGroup to {isa:"PBXGroup", |name|:tgName, children:hdrFileRefs, |refType|:"4"} set aBuildPhase to {isa:"PBXSourcesBuildPhase", |files|:buildFileRefs} set |productReference| of aTarget to prodRefName set dependencies of aTarget to targetDepList -- Go through the lis of libraries and chech ASN1 dependency. Add a script phase and generate a datatool dep for each one of it. try -- generated from ASN? set subLibs to the libs of target_info set needDatatoolDep to false set ASNPaths to {} set ASNNames to {} repeat with theSubLib in subLibs try set asn1 to asn1 of theSubLib set needDatatoolDep to true set oneAsnPath to path of theSubLib --set oneAsnName to last word of oneAsnPath set oneAsnName to do shell script "ruby -e \"s='" & oneAsnPath & "'; puts s.split(':')[1]\"" try set oneAsnName to asn1Name of theSubLib -- have a special ASN name? end try copy oneAsnPath to the end of ASNPaths -- store all paths to asn files copy oneAsnName to the end of ASNNames -- store all names of asn files; Use either folder name or ASN1Name if provided end try end repeat if needDatatoolDep then -- add dependency to a data tool (when asn1 is true for at least sublibrary) copy "DEPENDENCE__datatool" to the end of dependencies of aTarget set shellScript to x_GenerateDatatoolScript(ASNPaths, ASNNames) --log shellScript -- Now add a new script build phase to regenerate dataobjects set scriptPhaseName to "SCRIPTPHASE__" & tgName set aScriptPhase to {isa:"PBXShellScriptBuildPhase", |files|:{}, |inputPaths|:{}, |outputPaths|:{}, |shellPath|:"/bin/sh", |shellScript|:shellScript} copy scriptPhaseName to the beginning of |buildPhases| of aTarget -- shell script phase goes first (before compiling) addPair(aScriptPhase, scriptPhaseName) end if end try (* Create a shell script phase to copy GBENCH Resources here *) try set tmp to gbench of target_info set shellScript to x_CopyGBENCHResourses() set scriptPhaseName to "SCRIPTPHASE__" & tgName set aScriptPhase to {isa:"PBXShellScriptBuildPhase", |files|:{}, |inputPaths|:{}, |outputPaths|:{}, |shellPath|:"/bin/sh", |shellScript|:shellScript} copy scriptPhaseName to the end of |buildPhases| of aTarget -- shell script phase goes first (before compiling) addPair(aScriptPhase, scriptPhaseName) end try -- Create a GBENCH Resources (* Create a shell script phase to add resource fork for gbench_feedback app *) if tgName is "gbench_feedback_agent" then set shellScript to "cd \"$TARGET_BUILD_DIR\"" & ret & "$SYSTEM_DEVELOPER_TOOLS/Rez -t APPL " & TheFLTKPath & "/include/FL/mac.r -o $EXECUTABLE_NAME" set scriptPhaseName to "SCRIPTPHASE__" & tgName set aScriptPhase to {isa:"PBXShellScriptBuildPhase", |files|:{}, |inputPaths|:{}, |outputPaths|:{}, |shellPath|:"/bin/sh", |shellScript|:shellScript} copy scriptPhaseName to the end of |buildPhases| of aTarget -- shell script phase goes first (before compiling) addPair(aScriptPhase, scriptPhaseName) end if -- Create a Resources Fork -- add to main object list addPair(aTarget, targetName) --addPair(aProxy, targetProxy) addPair(libDepend, depName) addPair(aProduct, prodRefName) addPair(aBuildPhase, buildPhaseName) addPair(libGroup, tgName) addPair(hdrGroup, tgNameH) end MakeNewTarget on MakeNewLibraryTarget(lib_info, src_files, hdr_files) set libName to name of lib_info set targetName to "TARGET__" & libName set buildPhaseName to "BUILDPHASE__" & libName set installPath to TheOUTPath & "/lib" --"/Users/lebedev/Projects/tmp3" set linkerFlags to "" -- -flat_namespace -undefined suppress" -- warning -- additional liker flags (like -lxncbi) set symRoot to TheOUTPath & "/lib" -- build DLLs by default set libraryStyle to "DYNAMIC" set fullLibName to "lib" & libName set libProdType to "com.apple.product-type.library.dynamic" set isBundle to false try -- are we building a loadable module? if bundle of lib_info then set libraryStyle to "DYNAMIC" --"BUNDLE" set linkerFlags to "" -- do not suppress undefined symbols. Bundles should be fully resolved --set linkerFlags to "-framework Carbon -framework AGL -framework OpenGL" set symRoot to TheOUTPath & "/bin/$(CONFIGURATION)/Genome Workbench.app/Contents/MacOS/plugins" set isBundle to true end try if libTypeDLL is false and isBundle is false then -- build as static set libraryStyle to "STATIC" set fullLibName to libName set libProdType to "com.apple.product-type.library.static" end if set linkerFlags to linkerFlags & x_CreateLinkerFlags(lib_info) -- additional liker flags (like -lxncbi) set buildSettings to {|LIB_COMPATIBILITY_VERSION|:"1", |DYLIB_CURRENT_VERSION|:"1", |INSTALL_PATH|:installPath, |LIBRARY_STYLE|:libraryStyle, |PRODUCT_NAME|:fullLibName, |OTHER_LDFLAGS|:linkerFlags, |SYMROOT|:symRoot, |TARGET_BUILD_DIR|:symRoot} set libTarget to {isa:"PBXNativeTarget", |buildPhases|:{buildPhaseName}, |buildSettings|:buildSettings, |name|:fullLibName, |productReference|:"", |productType|:libProdType, dependencies:{}} my MakeNewTarget(lib_info, src_files, hdr_files, libTarget, libProduct, 0) -- 0 is library end MakeNewLibraryTarget on MakeNewToolTarget(tool_info, src_files, hdr_files) set toolName to name of tool_info set targetName to "TARGET__" & toolName set buildPhaseName to "BUILDPHASE__" & toolName set fullToolName to toolName -- "app_" & toolName set linkerFlags to x_CreateLinkerFlags(tool_info) -- additional liker flags (like -lxncbi) set symRoot to TheOUTPath & "/bin" set buildSettings to {|PRODUCT_NAME|:fullToolName, |OTHER_LDFLAGS|:linkerFlags, |SYMROOT|:symRoot} if toolName is "gbench_plugin_scan" or toolName is "gbench_monitor" or toolName is "gbench_feedback_agent" or toolName is "gbench_cache_agent" then set symRoot to TheOUTPath & "/bin/$(CONFIGURATION)/Genome Workbench.app/Contents/MacOS" set |SYMROOT| of buildSettings to symRoot set buildSettings to buildSettings & {|TARGET_BUILD_DIR|:symRoot} end if set toolTarget to {isa:"PBXNativeTarget", |buildPhases|:{buildPhaseName}, |buildSettings|:buildSettings, |name|:fullToolName, |productReference|:"", |productType|:"com.apple.product-type.tool", dependencies:{}} my MakeNewTarget(tool_info, src_files, hdr_files, toolTarget, toolProduct, 2) -- is a tool end MakeNewToolTarget on MakeNewAppTarget(app_info, src_files, hdr_files) set appName to name of app_info set targetName to "TARGET__" & appName set buildPhaseName to "BUILDPHASE__" & appName --set fullAppName to "app_" & appName set linkerFlags to x_CreateLinkerFlags(app_info) -- additional liker flags (like -lxncbi) set symRoot to TheOUTPath & "/bin" set buildSettings to {|PRODUCT_NAME|:appName, |OTHER_LDFLAGS|:linkerFlags, |REZ_EXECUTABLE|:"YES", |INFOPLIST_FILE|:"", |SYMROOT|:symRoot, |KEEP_PRIVATE_EXTERNS|:"YES", |GENERATE_MASTER_OBJECT_FILE|:"YES"} set appTarget to {isa:"PBXNativeTarget", |buildPhases|:{buildPhaseName}, |buildSettings|:buildSettings, |name|:appName, |productReference|:"", |productType|:"com.apple.product-type.application", dependencies:{}} my MakeNewTarget(app_info, src_files, hdr_files, appTarget, appProduct, 1) -- 1 is application end MakeNewAppTarget (* Save everything *) on SaveProjectFile() (* Genome Workbench Disk Image *) (* Add a shell script only target to create a standalone disk image for distribution *) set shellScript to do shell script "cat " & TheNCBIPath & "/compilers/xCode/diskimage.tmpl" copy "TARGET__GBENCH_DISK" to the end of |targets| of rootObject set aScriptPhase to {isa:"PBXShellScriptBuildPhase", |files|:{}, |inputPaths|:{}, |outputPaths|:{}, |runOnlyForDeploymentPostprocessing|:1, |shellPath|:"/bin/sh", |shellScript|:shellScript} set theTarget to {isa:"PBXAggregateTarget", |buildPhases|:{}, |buildSettings|:{|PRODUCT_NAME|:"Genome Workbench Disk Image", |none|:""}, dependencies:{}, |name|:"Genome Workbench Disk Image"} copy "SCRIPTPHASE__GBENCH_DISK" to the beginning of |buildPhases| of theTarget addPair(aScriptPhase, "SCRIPTPHASE__GBENCH_DISK") addPair(theTarget, "TARGET__GBENCH_DISK") addPair({isa:"PBXTargetDependency", |target|:"TARGET__GBENCH_DISK"}, "DEPENDENCE__GBENCH_DISK") copy "DEPENDENCE__GBENCH_DISK" to the end of allDepList (* Target: Build Everything *) copy "TARGET__BUILD_APP" to the beginning of |targets| of rootObject addPair({isa:"PBXAggregateTarget", |buildPhases|:{}, |buildSettings|:{|PRODUCT_NAME|:"Build All Applications", |none|:""}, dependencies:appDepList, |name|:"Build All Applications"}, "TARGET__BUILD_APP") copy "TARGET__BUILD_LIB" to the beginning of |targets| of rootObject addPair({isa:"PBXAggregateTarget", |buildPhases|:{}, |buildSettings|:{|PRODUCT_NAME|:"Build All Libraries", |none|:""}, dependencies:libDepList, |name|:"Build All Libraries"}, "TARGET__BUILD_LIB") copy "TARGET__BUILD_ALL" to the beginning of |targets| of rootObject addPair({isa:"PBXAggregateTarget", |buildPhases|:{}, |buildSettings|:{|PRODUCT_NAME|:"Build All", |none|:""}, dependencies:allDepList, |name|:"Build All"}, "TARGET__BUILD_ALL") (* add frameworks*) -- Carbon copy "FW_CARBON" to the end of children of fworks addPair({isa:"PBXFileReference", |lastKnownFileType|:"wrapper.framework", |name|:"Carbon.framework", |path|:"/System/Library/Frameworks/Carbon.framework", |refType|:"0", |sourceTree|:"<absolute>"}, "FW_CARBON") -- OpenGL copy "FW_OpenGL" to the end of children of fworks addPair({isa:"PBXFileReference", |lastKnownFileType|:"wrapper.framework", |name|:"OpenGL.framework", |path|:"/System/Library/Frameworks/OpenGL.framework", |refType|:"0", |sourceTree|:"<absolute>"}, "FW_OpenGL") copy "FW_CORESERVICES" to the end of children of fworks addPair({isa:"PBXFileReference", |lastKnownFileType|:"wrapper.framework", |name|:"CoreServices.framework", |path|:"/System/Library/Frameworks/CoreServices.framework", |refType|:"0", |sourceTree|:"<absolute>"}, "FW_CORESERVICES") (* Add ROOT objects and groups *) addPair(rootObject, "ROOT_OBJECT") addPair(headers, "HEADERS") addPair(sources, "SOURCES") addPair(fworks, "FRAMEWORKS") (* Create a record from two lists *) set objects of newProject to CreateRecordFromList(objValues, objKeys) try -- create some folders set shScript to "if test ! -d " & TheOUTPath & "/" & projFile & " ; then mkdir " & TheOUTPath & "/" & projFile & " ; fi" do shell script shScript end try set fullProjName to (TheOUTPath & "/" & projFile & "/project.pbxproj") as string (* Call NSDictionary method to save data as XML property list *) --call method "writeToFile:atomically:" of newProject with parameters {"/Users/lebedev/111.txt", "YES"} --call method "writeToFile:atomically:" of newProject with parameters {"/Users/lebedev/!test.xcode/project.pbxproj", "YES"} call method "writeToFile:atomically:" of newProject with parameters {fullProjName, "YES"} (*set the_file to open for access "users:lebedev:111.txt" set hhh to read the_file as string log hhh close access the_file*) end SaveProjectFile (* Convinience method *) on addPair(aObj, aKey) copy aObj to the end of objValues copy aKey to the end of objKeys end addPair (* Workaround the AppleScript lack of variable property labels *) on CreateRecordFromList(objs, keys) return call method "dictionaryWithObjects:forKeys:" of class "NSDictionary" with parameters {objs, keys} end CreateRecordFromList (* Replace all occurances of "old" in the aString with "new" *) on x_Replace(aString, old, new) set OldDelims to AppleScript's text item delimiters set AppleScript's text item delimiters to old set newText to text items of aString set AppleScript's text item delimiters to new set finalText to newText as text set AppleScript's text item delimiters to OldDelims return finalText end x_Replace (* convert a space-separated "aString" to a list *) on x_Str2List(aString) set OldDelims to AppleScript's text item delimiters set AppleScript's text item delimiters to " " set aList to every text item in aString set AppleScript's text item delimiters to OldDelims return aList end x_Str2List (* Get file name and extension from the full file path *) on x_FileNameFromPath(fileNameWithPath) set OldDelims to AppleScript's text item delimiters set AppleScript's text item delimiters to "/" set partsList to text items of fileNameWithPath set AppleScript's text item delimiters to OldDelims return the last item of partsList as string end x_FileNameFromPath (* Create a linker flags string based on dependencies and libs to link *) on x_CreateLinkerFlags(info) set linkFlags to "" try -- set dependencies (if any) set depString to dep of info set depList to x_Str2List(depString) repeat with d in depList set linkFlags to linkFlags & " -l" & d end repeat end try try -- set libraries to link (if any) set libList to lib2link of info repeat with d in libList set linkFlags to linkFlags & " -l" & d end repeat end try try -- set frameworks set fwString to fworks of info set fwList to x_Str2List(fwString) repeat with d in fwList set linkFlags to linkFlags & " -framework " & d end repeat end try return linkFlags end x_CreateLinkerFlags (* Creates a shell script to regenerate ASN files *) on x_GenerateDatatoolScript(thePaths, theNames) set theScript to "echo Updating $PRODUCT_NAME" & ret set theScript to theScript & "" & ret set idx to 1 repeat with aPath in thePaths set asnName to item idx of theNames set posixPath to x_Replace(aPath, ":", "/") set fullPath to TheNCBIPath & "/src/" & posixPath set theScript to theScript & "echo Working in: " & fullPath & ret set theScript to theScript & "cd " & fullPath & ret set theScript to theScript & "if ! test -e " & asnName & ".files || find . -newer " & asnName & ".files | grep '.asn'; then" & ret set theScript to theScript & " m=\"" & asnName & "\"" & ret set theScript to theScript & " echo Running Datatool" & ret if asnName is "gui_project" or asnName is "data_handle" or asnName is "plugin" or asnName is "gbench_svc" or asnName is "seqalign_ext" then -- Should use sed properly here (but how?) set theScript to theScript & " M=\"$(grep ^MODULE_IMPORT $m.module | sed 's/^.*= *//' | sed 's/\\([/a-z0-9_]*\\)/\\1.asn/g')\"" & ret else set theScript to theScript & " M=\"\"" & ret set theScript to theScript & " if test -e $m.module; then" & ret set theScript to theScript & " M=\"$(grep ^MODULE_IMPORT $m.module | sed 's/^.*= *//' | sed 's/\\(objects[/a-z0-9]*\\)/\\1.asn/g')\"" & ret set theScript to theScript & " fi" & ret end if set theScript to theScript & " " & TheOUTPath & "/bin/$CONFIGURATION/datatool -oR " & TheNCBIPath set theScript to theScript & " -opm " & TheNCBIPath & "/src -m \"$m.asn\" -M \"$M\" -oA -of \"$m.files\" -or \"" & posixPath & "\" -oc \"$m\" -oex '' -ocvs -odi -od \"$m.def\"" & ret set theScript to theScript & "else" & ret set theScript to theScript & " echo ASN files are up to date" & ret set theScript to theScript & "fi" & ret & ret set idx to idx + 1 end repeat return theScript end x_GenerateDatatoolScript (* Creates a shell script to copy some additional files into GBENCH package *) (* Can be replaced with Copy Files Build phase *) on x_CopyGBENCHResourses() set theScript to "" set theScript to theScript & "echo Running GBench Plugin Scan" & ret set theScript to theScript & "if test ! -e " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/plugins/plugin-cache ; then" & ret set theScript to theScript & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/gbench_plugin_scan " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/plugins" & ret set theScript to theScript & "fi" & ret set theScript to theScript & "echo Copying GBench resources" & ret -- Create etc directory set theScript to theScript & "if test ! -d " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/etc ; then" & ret set theScript to theScript & " mkdir " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/etc" & ret set theScript to theScript & "fi" & ret -- Create Resources directory set theScript to theScript & "if test ! -d " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/Resources ; then" & ret set theScript to theScript & " mkdir " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/Resources" & ret set theScript to theScript & "fi" & ret -- Create share directory set theScript to theScript & "if test ! -d " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/share/gbench ; then" & ret set theScript to theScript & " mkdir " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/share" & ret set theScript to theScript & " mkdir " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/share/gbench" & ret set theScript to theScript & "fi" & ret -- Create executables directory --set theScript to theScript & "if test ! -d " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/executables ; then" & ret --set theScript to theScript & " mkdir " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/executables" & ret --set theScript to theScript & "fi" & ret --set theScript to theScript & "cp " & TheNCBIPath & "/src/gui/plugins/algo/executables/* " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/executables" & ret -- copy png images set theScript to theScript & "cp " & TheNCBIPath & "/src/gui/res/share/gbench/* " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/share/gbench" & ret -- copy Info.plist file set theScript to theScript & "cp " & TheNCBIPath & "/src/gui/res/share/gbench/Info.plist " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents" & ret -- copy Icon file set theScript to theScript & "cp " & TheNCBIPath & "/src/gui/res/share/gbench/gbench.icns " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/Resources/Genome\\ Workbench.icns" & ret set theScript to theScript & "cp " & TheNCBIPath & "/src/gui/res/share/gbench/gbench_workspace.icns " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/Resources/gbench_workspace.icns" & ret set theScript to theScript & "cp " & TheNCBIPath & "/src/gui/res/share/gbench/gbench_project.icns " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/Resources/gbench_project.icns" & ret ----set theScript to theScript & "cp -r " & TheNCBIPath & "/src/gui/plugins/algo/executables " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/executables" & ret set theScript to theScript & "rm -rf " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/etc/*" & ret set theScript to theScript & "cp -r " & TheNCBIPath & "/src/gui/res/etc/* " & TheOUTPath & "/bin/$CONFIGURATION/Genome\\ Workbench.app/Contents/MacOS/etc" & ret --set theScript to theScript & "cp -r " & TheNCBIPath & "/src/gui/gbench/patterns/ " & TheOUTPath & "/bin/Genome\\ Workbench.app/Contents/MacOS/etc/patterns" & ret --set theScript to theScript & "cp " & TheNCBIPath & "/src/gui/gbench/news.ini " & TheOUTPath & "/bin/Genome\\ Workbench.app/Contents/MacOS/etc" & ret --set theScript to theScript & "cp " & TheNCBIPath & "/src/gui/gbench/gbench.ini " & TheOUTPath & "/bin/Genome\\ Workbench.app/Contents/MacOS/etc" & ret --set theScript to theScript & "cp " & TheNCBIPath & "/src/gui/gbench/algo_urls " & TheOUTPath & "/bin/Genome\\ Workbench.app/Contents/MacOS/etc" & ret return theScript end x_CopyGBENCHResourses end script
heroic-parser/src/main/antlr4/com/spotify/heroic/grammar/HeroicQuery.g4
gaurav46/heroic
0
7403
/** * Define a grammar called Hello */ grammar HeroicQuery; queries : (query QuerySeparator)* query EOF ; query : select from where? groupBy? ; select : All | valueExpr ; from : From Identifier sourceRange? ; where : Where filter ; groupBy : GroupBy listValues ; eqExpr : valueExpr Eq valueExpr ; notEqExpr : valueExpr NotEq valueExpr ; keyEqExpr : SKey Eq valueExpr ; keyNotEqExpr : SKey NotEq valueExpr ; hasExpr : Plus valueExpr ; prefixExpr : valueExpr Prefix valueExpr ; notPrefixExpr : valueExpr NotPrefix valueExpr ; regexExpr : valueExpr Regex valueExpr ; notInExpr : valueExpr Not In valueExpr ; booleanExpr : True | False ; inExpr : valueExpr In valueExpr ; notRegexExpr : valueExpr NotRegex valueExpr ; notExpr : Bang filterExprs ; filterExpr : eqExpr | notEqExpr | keyEqExpr | keyNotEqExpr | hasExpr | prefixExpr | notPrefixExpr | regexExpr | notRegexExpr | inExpr | notInExpr | booleanExpr ; groupExpr : LParen filterExprs RParen ; filterExprs : filterExpr | notExpr | groupExpr | <assoc=left> filterExprs And filterExprs | <assoc=left> filterExprs Or filterExprs ; filter : filterExprs ; listValues : valueExpr (Colon valueExpr)* ; list : LBracket listValues? RBracket | LCurly listValues? RCurly ; keyValue : Identifier Eq valueExpr ; string : QuotedString | SimpleString | Identifier ; aggregationArgs : listValues (Colon keyValue)* | keyValue (Colon keyValue)* ; aggregation : string LParen aggregationArgs? RParen ; value : now | diff | aggregation | list | integer | string ; diff : Diff ; now : SNow ; integer: Integer ; groupValueExpr : LParen valueExpr RParen ; valueExpr : value | groupValueExpr |<assoc=right> valueExpr Plus valueExpr |<assoc=right> valueExpr Minus valueExpr ; relative : LParen valueExpr RParen ; absolute : LParen valueExpr Colon valueExpr RParen ; sourceRange : relative | absolute ; // keywords (must come before SimpleString!) All : '*' ; True : 'true' ; False : 'false' ; Where : 'where' ; GroupBy : 'group by' ; From : 'from' ; Or : 'or' ; And : 'and' ; Not : 'not' ; In : 'in' ; Plus : '+' ; Minus : '-' ; Eq : '=' ; Regex : '~' ; NotRegex : '!~' ; Prefix : '^' ; NotPrefix : '!^' ; Bang : '!' ; NotEq : '!=' ; QuerySeparator : ';' ; Colon : ',' ; LParen : '(' ; RParen : ')' ; LCurly : '{' ; RCurly : '}' ; LBracket : '[' ; RBracket : ']' ; QuotedString : '"' StringCharacters? '"' ; Identifier : [a-zA-Z] [a-zA-Z0-9]* ; // strings that do not have to be quoted SimpleString : [a-zA-Z] [a-zA-Z0-9:/_\-\.]* ; SKey : '$key' ; SNow : '$now' ; fragment Unit : 'ms' | 's' | 'm' | 'H' | 'h' | 'd' | 'w' | 'M' | 'y' ; Diff : Integer Unit ; Integer : '0' | [1-9] [0-9]* ; fragment StringCharacters : StringCharacter+ ; fragment StringCharacter : ~["\\] | EscapeSequence ; fragment EscapeSequence : '\\' [btnfr"'\\] ; WS : [ \t\n]+ -> skip ; // is used to specifically match string where the end quote is missing UnterminatedQutoedString : '"' StringCharacters? ; // match everything else so that we can handle errors in the parser. ErrorChar : . ;
src/edu/mit/compilers/grammar/DecafScanner.g4
devinmorgan/6035-compiler
0
2487
lexer grammar DecafScanner; options { language = 'Java'; superClass = 'Lexer'; //class DecafScanner extends Lexer; } @lexer::header { package edu.mit.compilers.grammar; } // Selectively turns on debug tracing mode. // You can insert arbitrary Java code into your parser/lexer this way. @lexer::memebers { /** Whether to display debug information. */ private boolean trace = false; public void setTrace(boolean shouldTrace) { trace = shouldTrace; } @Override public void traceIn(String rname) throws CharStreamException { if (trace) { super.traceIn(rname); } } @Override public void traceOut(String rname) throws CharStreamException { if (trace) { super.traceOut(rname); } } } // Note that here, the {} syntax allows you to literally command the lexer // to skip mark this token as skipped, or to advance to the next line // by directly adding Java commands. WS_ : (' ' | '\t' | '\n' ) -> skip; COMMENT : ('//'|'#') (~'\n')* '\n' -> skip; // Miscillaneous characters L_SQUARE : '['; R_SQUARE : ']'; L_PAREN : '('; R_PAREN : ')'; L_CURL : '{'; R_CURL : '}'; COMMA : ','; SEMI_COL : ';'; // boolean ops LT_OP : '<'; GT_OP : '>'; LEQ_OP : '<='; GEQ_OP : '>='; EQ_OP : '=='; NEQ_OP : '!='; AND_OP : '&&'; OR_OP : '||'; NOT_OP : '!'; // arithmatic ops ADD_OP : '+'; SUB_OP : '-'; MUL_OP : '*'; DIV_OP : '/'; MOD_OP : '%'; // assignment op AS_OP : '='; ADD_AS_OP : '+='; SUB_AS_OP : '-='; // reserved words RES_BOOL : 'bool'; RES_BREAK : 'break'; RES_EXTERN : 'extern'; RES_CONTINUE : 'continue'; RES_ELSE : 'else'; RES_FOR : 'for'; RES_WHILE : 'while'; RES_IF : 'if'; RES_INT : 'int'; RES_RETURN : 'return'; RES_SIZEOF : 'sizeof'; RES_VOID : 'void'; // prefixes HEX_PREFIX: '0x' -> more, mode(HEX_MODE); // modes mode HEX_MODE; HEX_INT : (DIGIT | HEX_LETTERS)+ ('ll')? -> type(INT), mode(DEFAULT_MODE); // return to DEFAULT_MODE mode DEFAULT_MODE; // main tokens BOOL : 'true' | 'false'; CHAR : '\'' (ESC | ALLOWED_CHARS ) '\''; STRING : '"' (ESC | ALLOWED_CHARS )* '"'; INT : DIGIT+ ('ll')?; ID : (ALL_LETTERS | '_')(ALL_LETTERS | DIGIT | '_')*; // fragments fragment ESC : '\\n' | '\\t' | '\\\\' | '\\"' | '\\\''; //'\\' ('n' | 't' | '\\' | '"' | '\''); fragment ALLOWED_CHARS : ' '..'!' | '#'..'&' | '('..'[' | ']'..'~' ; fragment HEX_LETTERS : 'a'..'f' | 'A'..'F'; fragment DIGIT : '0'..'9'; fragment ALL_LETTERS : HEX_LETTERS | 'g'..'z' | 'G'..'Z';
Sandbox/Pred.agda
banacorn/numeral
1
719
<reponame>banacorn/numeral<gh_stars>1-10 module Sandbox.Pred where open import Data.Num open import Data.Num.Properties open import Data.Nat open import Data.Fin using (Fin; suc; zero; #_) open import Data.Vec open import Relation.Nullary.Decidable using (True; fromWitness) open import Relation.Binary.PropositionalEquality hiding ([_]) -- open import Relation.Binary open ≡-Reasoning data Term : ℕ → Set where var : ∀ {n} → Fin n -- the index of this variable → Term n _∔_ : ∀ {n} → Term n → Term n → Term n data Pred : ℕ → Set where _≣_ : ∀ {n} → Term n → Term n → Pred n _⇒_ : ∀ {n} → Pred n → Pred n → Pred n -- captures 1 free variable in the Pred All : ∀ {n} → Pred (suc n) → Pred n record Signature : Set₁ where constructor signature field carrier : Set _⊕_ : carrier → carrier → carrier _≈_ : carrier → carrier → Set open Signature -- signatures ℕ-sig : Signature ℕ-sig = signature ℕ _+_ _≡_ Num-sig : (b d o : ℕ) → True (Surjective? b d o) → Signature Num-sig b d o surj = signature (Num b d o) (_⊹_ {surj = surj}) _≋_ ⟦_⟧Term : ∀ {n} → Term n → (sig : Signature) → let A = carrier sig in Vec A n → A ⟦ var x ⟧Term sig env = lookup x env ⟦ a ∔ b ⟧Term sig env = let (signature A _⊕_ _≈_) = sig in (⟦ a ⟧Term sig env) ⊕ (⟦ b ⟧Term sig env) ⟦_⟧ : ∀ {n} → Pred n → (sig : Signature) → Vec (carrier sig) n → Set ⟦ p ≣ q ⟧ sig env = let (signature carrier _⊕_ _≈_) = sig in ⟦ p ⟧Term sig env ≈ ⟦ q ⟧Term sig env ⟦ p ⇒ q ⟧ sig env = ⟦ p ⟧ sig env → ⟦ q ⟧ sig env ⟦ All p ⟧ sig env = ∀ x → ⟦ p ⟧ sig (x ∷ env) -- lemma for env lookup-map : ∀ {i j} → {A : Set i} {B : Set j} → (f : A → B) → ∀ {n} → (xs : Vec A n) (i : Fin n) → lookup i (map f xs) ≡ f (lookup i xs) lookup-map f [] () lookup-map f (x ∷ env) zero = refl lookup-map f (x ∷ env) (suc i) = lookup-map f env i toℕ-term-homo : ∀ {b d o} → {surj : True (Surjective? b d o)} → ∀ {n} → (t : Term n) → (env : Vec (Num b d o) n) → ⟦ t ⟧Term ℕ-sig (map toℕ env) ≡ toℕ (⟦ t ⟧Term (Num-sig b d o surj) env ) toℕ-term-homo (var x) env = lookup-map toℕ env x toℕ-term-homo {b} {d} {o} {surj} (s ∔ t) env = begin ⟦ s ∔ t ⟧Term ℕ-sig (map toℕ env) ≡⟨ cong₂ _+_ (toℕ-term-homo {surj = surj} s env) (toℕ-term-homo {surj = surj} t env) ⟩ toℕ (⟦ s ⟧Term _ env) + toℕ (⟦ t ⟧Term _ env) ≡⟨ sym (toℕ-⊹-homo (⟦ s ⟧Term _ env) (⟦ t ⟧Term _ env)) ⟩ toℕ (⟦ s ∔ t ⟧Term (Num-sig b d o surj) env) ∎ mutual toℕ-pred-ℕ⇒Num : ∀ {b d o} → {surj : True (Surjective? b d o)} → ∀ {n} → (p : Pred n) → (env : Vec (Num b d o) n) → ⟦ p ⟧ ℕ-sig (map toℕ env) → ⟦ p ⟧ (Num-sig b d o surj) env -- toℕ-pred-ℕ⇒Num (p ≣ q) env ⟦p≡q⟧ℕ = {! !} toℕ-pred-ℕ⇒Num {b} {d} {o} {surj} (p ≣ q) env a = -- a : ⟦ p ⟧Term ℕ-sig (ℕ-env) ≡ ⟦ q ⟧Term ℕ-sig (ℕ-env) let p' = ⟦ p ⟧Term {! Num-sig b d o surj !} {! !} {! !} temp = toℕ-injective p' {! !} a in {! toℕ-injective !} toℕ-pred-ℕ⇒Num (p ⇒ q) env a = {! !} toℕ-pred-ℕ⇒Num (All p) env a = {! !} toℕ-pred-Num→ℕ : ∀ {b d o} → {surj : True (Surjective? b d o)} → ∀ {n} → (p : Pred n) → (env : Vec (Num b d o) n) → ⟦ p ⟧ (Num-sig b d o surj) env → ⟦ p ⟧ ℕ-sig (map toℕ env) toℕ-pred-Num→ℕ (p ≣ q) env a = {! !} toℕ-pred-Num→ℕ (p ⇒ q) env a = {! !} toℕ-pred-Num→ℕ (All p) env a = {! !} -- begin -- {! !} -- ≡⟨ {! !} ⟩ -- {! !} -- ≡⟨ {! !} ⟩ -- {! !} -- ≡⟨ {! !} ⟩ -- {! !} -- ≡⟨ {! !} ⟩ -- {! !} -- ∎ -- -- toℕ-term-homo : ∀ {b n} -- → (t : Term n) -- → (env : Vec (BijN b) n) -- → ⟦ t ⟧Term ℕ-sig (map toℕ env) ≡ toℕ (⟦ t ⟧Term (BijN-sig b) env) -- toℕ-term-homo (var i) env = ? -- toℕ-term-homo {b} (t₁ ∔ t₂) env = ?
programs/oeis/189/A189661.asm
neoneye/loda
22
80796
; A189661: Fixed point of the morphism 0->010, 1->10 starting with 0. ; 0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,1,0,0 mov $3,2 mov $5,$0 lpb $3 mov $0,$5 sub $3,1 add $0,$3 sub $0,1 mul $0,55 mov $4,$0 lpb $0 mov $0,1 div $4,144 lpe add $0,$4 mov $2,$3 mov $4,$0 lpb $2 mov $1,$4 sub $2,1 lpe lpe lpb $5 sub $1,$4 mov $5,0 lpe mov $0,$1
3-mid/opengl/source/platform/egl/private/thin/egl-pointers.ads
charlie5/lace
20
1058
package eGL.Pointers is type Display_Pointer is access all eGL.Display; type NativeWindowType_Pointer is access all eGL.NativeWindowType; type NativePixmapType_Pointer is access all eGL.NativePixmapType; type EGLint_Pointer is access all eGL.EGLint; type EGLBoolean_Pointer is access all eGL.EGLBoolean; type EGLenum_Pointer is access all eGL.EGLenum; type EGLConfig_Pointer is access all eGL.EGLConfig; type EGLContext_Pointer is access all eGL.EGLContext; type EGLDisplay_Pointer is access all eGL.EGLDisplay; type EGLSurface_Pointer is access all eGL.EGLSurface; type EGLClientBuffer_Pointer is access all eGL.EGLClientBuffer; type Display_Pointer_array is array (C.size_t range <>) of aliased Display_Pointer; type NativeWindowType_Pointer_array is array (C.size_t range <>) of aliased NativeWindowType_Pointer; type NativePixmapType_Pointer_array is array (C.size_t range <>) of aliased NativePixmapType_Pointer; type EGLint_Pointer_array is array (C.size_t range <>) of aliased EGLint_Pointer; type EGLBoolean_Pointer_array is array (C.size_t range <>) of aliased EGLBoolean_Pointer; type EGLenum_Pointer_array is array (C.size_t range <>) of aliased EGLenum_Pointer; type EGLConfig_Pointer_array is array (C.size_t range <>) of aliased EGLConfig_Pointer; type EGLContext_Pointer_array is array (C.size_t range <>) of aliased EGLContext_Pointer; type EGLDisplay_Pointer_array is array (C.size_t range <>) of aliased EGLDisplay_Pointer; type EGLSurface_Pointer_array is array (C.size_t range <>) of aliased EGLSurface_Pointer; type EGLClientBuffer_Pointer_array is array (C.size_t range <>) of aliased EGLClientBuffer_Pointer; end eGL.Pointers;
tests/typing/bad/testfile-inout-2.adb
xuedong/mini-ada
0
15656
<reponame>xuedong/mini-ada<filename>tests/typing/bad/testfile-inout-2.adb with Ada.Text_IO; use Ada.Text_IO; procedure Test is procedure P(X: in Integer) is begin X := 0; end; begin P(42); end;
Aurora/Aurora/x64/Debug/block.asm
manaskamal/aurora-xeneva
8
82160
<reponame>manaskamal/aurora-xeneva<filename>Aurora/Aurora/x64/Debug/block.asm ; Listing generated by Microsoft (R) Optimizing Compiler Version 17.00.50727.1 include listing.inc INCLUDELIB LIBCMT INCLUDELIB OLDNAMES PUBLIC ?block_list_head@@3PEAU_thread_@@EA ; block_list_head PUBLIC ?block_list_last@@3PEAU_thread_@@EA ; block_list_last _BSS SEGMENT ?block_list_head@@3PEAU_thread_@@EA DQ 01H DUP (?) ; block_list_head ?block_list_last@@3PEAU_thread_@@EA DQ 01H DUP (?) ; block_list_last _BSS ENDS END
SOAS/Metatheory/Monoid.agda
JoeyEremondi/agda-soas
39
17538
<reponame>JoeyEremondi/agda-soas open import SOAS.Common open import SOAS.Families.Core open import Categories.Object.Initial open import SOAS.Coalgebraic.Strength import SOAS.Metatheory.MetaAlgebra -- Monoids with ⅀-algebra structure module SOAS.Metatheory.Monoid {T : Set} (⅀F : Functor 𝔽amiliesₛ 𝔽amiliesₛ) (⅀:Str : Strength ⅀F) where open import SOAS.Context open import SOAS.Variable open import SOAS.Construction.Structure as Structure open import SOAS.Abstract.Hom open import SOAS.Abstract.Monoid open import SOAS.Coalgebraic.Map open import SOAS.Coalgebraic.Monoid open import SOAS.Metatheory.Algebra {T} ⅀F open Strength ⅀:Str private variable Γ Δ : Ctx α : T -- Family with compatible monoid and ⅀-algebra structure record ΣMon (ℳ : Familyₛ) : Set where field ᵐ : Mon ℳ 𝑎𝑙𝑔 : ⅀ ℳ ⇾̣ ℳ open Mon ᵐ public field μ⟨𝑎𝑙𝑔⟩ : {σ : Γ ~[ ℳ ]↝ Δ}(t : ⅀ ℳ α Γ) → μ (𝑎𝑙𝑔 t) σ ≡ 𝑎𝑙𝑔 (str ᴮ ℳ (⅀₁ μ t) σ) record ΣMon⇒ {ℳ 𝒩 : Familyₛ}(ℳᴹ : ΣMon ℳ)(𝒩ᴹ : ΣMon 𝒩) (f : ℳ ⇾̣ 𝒩) : Set where private module ℳ = ΣMon ℳᴹ private module 𝒩 = ΣMon 𝒩ᴹ field ᵐ⇒ : Mon⇒ ℳ.ᵐ 𝒩.ᵐ f ⟨𝑎𝑙𝑔⟩ : {t : ⅀ ℳ α Γ} → f (ℳ.𝑎𝑙𝑔 t) ≡ 𝒩.𝑎𝑙𝑔 (⅀₁ f t) open Mon⇒ ᵐ⇒ public -- Category of Σ-monoids module ΣMonoidStructure = Structure 𝔽amiliesₛ ΣMon ΣMonoidCatProps : ΣMonoidStructure.CategoryProps ΣMonoidCatProps = record { IsHomomorphism = ΣMon⇒ ; id-hom = λ {ℳ}{ℳᴹ} → record { ᵐ⇒ = AsMonoid⇒.ᵐ⇒ 𝕄on.id ; ⟨𝑎𝑙𝑔⟩ = cong (ΣMon.𝑎𝑙𝑔 ℳᴹ) (sym ⅀.identity) } ; comp-hom = λ{ {𝐸ˢ = 𝒪ᴹ} g f record { ᵐ⇒ = gᵐ⇒ ; ⟨𝑎𝑙𝑔⟩ = g⟨𝑎𝑙𝑔⟩ } record { ᵐ⇒ = fᵐ⇒ ; ⟨𝑎𝑙𝑔⟩ = f⟨𝑎𝑙𝑔⟩ } → record { ᵐ⇒ = AsMonoid⇒.ᵐ⇒ ((g ⋉ gᵐ⇒) 𝕄on.∘ (f ⋉ fᵐ⇒)) ; ⟨𝑎𝑙𝑔⟩ = trans (cong g f⟨𝑎𝑙𝑔⟩) (trans g⟨𝑎𝑙𝑔⟩ (cong (ΣMon.𝑎𝑙𝑔 𝒪ᴹ) (sym ⅀.homomorphism))) } } } Σ𝕄onoids : Category 1ℓ 0ℓ 0ℓ Σ𝕄onoids = ΣMonoidStructure.StructCat ΣMonoidCatProps module Σ𝕄on = Category Σ𝕄onoids ΣMonoid : Set₁ ΣMonoid = Σ𝕄on.Obj ΣMonoid⇒ : ΣMonoid → ΣMonoid → Set ΣMonoid⇒ = Σ𝕄on._⇒_ module FreeΣMonoid = ΣMonoidStructure.Free ΣMonoidCatProps
oeis/121/A121613.asm
neoneye/loda-programs
11
174591
; A121613: Expansion of psi(-x)^4 in powers of x where psi() is a Ramanujan theta function. ; Submitted by <NAME> ; 1,-4,6,-8,13,-12,14,-24,18,-20,32,-24,31,-40,30,-32,48,-48,38,-56,42,-44,78,-48,57,-72,54,-72,80,-60,62,-104,84,-68,96,-72,74,-124,96,-80,121,-84,108,-120,90,-112,128,-120,98,-156,102,-104,192,-108,110,-152,114,-144,182,-144,133,-168,156,-128,176,-132,160,-240,138,-140,192,-168,180,-228,150,-152,234,-192,158,-216,192,-164,288,-168,183,-260,174,-248,240,-180,182,-248,228,-216,320,-192,194,-336,198,-200 mov $2,-1 pow $2,$0 mul $0,2 seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n). mul $0,$2
3-mid/opengl/source/lean/model/opengl-model-sphere-textured.ads
charlie5/lace
20
14061
with openGL.Font, openGL.Geometry; package openGL.Model.sphere.textured -- -- Models a textured sphere. -- is type Item is new Model.sphere.item with -- TODO: Make private. record Image : asset_Name := null_Asset; -- Usually a mercator projection to be mapped onto the sphere. is_Skysphere : Boolean := False; end record; type View is access all Item'Class; --------- --- Forge -- function new_Sphere (Radius : in Real; Image : in asset_Name := null_Asset; is_Skysphere : in Boolean := False) return View; -------------- --- Attributes -- overriding function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class; Fonts : in Font.font_id_Map_of_font) return Geometry.views; end openGL.Model.sphere.textured;
src/generic_cobs.ads
damaki/cobs
1
5551
<filename>src/generic_cobs.ads ------------------------------------------------------------------------------- -- Copyright (c) 2020 <NAME> -- -- Permission is hereby granted, free of charge, to any person obtaining a -- copy of this software and associated documentation files (the "Software"), -- to deal in the Software without restriction, including without limitation -- the rights to use, copy, modify, merge, publish, distribute, sublicense, -- and/or sell copies of the Software, and to permit persons to whom the -- Software is furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------- generic type Byte is mod <>; type Index is range <>; type Byte_Count is range <>; type Byte_Array is array (Index range <>) of Byte; package Generic_COBS with Pure, SPARK_Mode => On is pragma Compile_Time_Error (Byte'First /= 0, "Byte'First must be 0"); pragma Compile_Time_Error (Byte'Last <= 1, "Byte'Last must be greater than 1"); pragma Compile_Time_Error (Byte_Count'First /= 0, "Byte_Count'First must be 0"); pragma Compile_Time_Error (Byte_Count'Pos (Byte_Count'Last) /= Index'Pos (Index'Last), "Byte_Count'Last must be equal to Index'Last"); subtype Positive_Byte_Count is Byte_Count range 1 .. Byte_Count'Last; Frame_Delimiter : constant Byte := 0; -- COBS uses 0 as the frame delimiter byte. procedure Decode (Input : Byte_Array; Output : out Byte_Array; Length : out Byte_Count) with Global => null, Relaxed_Initialization => Output, Pre => ( -- The bounds of the input arrays must not be large enough to -- cause a Constraint_Error when reading the 'Length attribute. Array_Length_Within_Bounds (Input'First, Input'Last) and then Array_Length_Within_Bounds (Output'First, Output'Last) -- Cannot decode an empty Input array. and then Input'Length > 0 -- The Output array must be large enough to store all of the -- decoded data. and then Output'Length >= Input'Length), Post => ( -- The decoded length does not exceed the length of -- either array parameter. Length <= Output'Length and then Length <= Input'Length -- Only the first 'Length' bytes of the Output are initialized. and then (for all I in 0 .. Length - 1 => Output (Output'First + Index'Base (I))'Initialized)), Annotate => (GNATProve, Terminating); -- Decodes a COBS-encoded byte array. -- -- @param Input The COBS encoded bytes to be decoded. This may or may not -- contain a frame delimiter (zero) byte. If a frame delimiter -- is present then this subprogram decodes bytes up to the -- frame delimiter. Otherwise, if no frame delimiter byte is -- present then the entire input array is decoded. -- -- @param Output The decoded bytes are written to the first "Length" bytes -- of this array. -- -- @param Length The length of the decoded frame is written here. procedure Encode (Input : Byte_Array; Output : out Byte_Array; Length : out Byte_Count) with Global => null, Relaxed_Initialization => Output, Pre => ( -- The bounds of the input arrays must not be large enough to -- cause a Constraint_Error when reading the 'Length attribute. Array_Length_Within_Bounds (Input'First, Input'Last) and then Array_Length_Within_Bounds (Output'First, Output'Last) -- The number of bytes to encode in the Input array must leave -- enough headroom for COBS overhead bytes plus frame delimiter. and then Input'Length <= (Positive_Byte_Count'Last - (Max_Overhead_Bytes (Positive_Byte_Count'Last) + 1)) -- Output array must be large enough to encode the Input array -- and the additional overhead bytes. and then Output'Length >= Input'Length + Max_Overhead_Bytes (Input'Length) + 1), Post => ( -- The length of the output is always bigger than the input (Length in Input'Length + 1 .. Output'Length) -- Only the first 'Length' bytes of the Output are initialized. and then Output (Output'First .. Output'First + Index'Base (Length - 1))'Initialized -- The last byte in the output is a frame delimiter. -- All other bytes before the frame delimiter are non-zero. and then (for all I in Output'First .. Output'First + Index'Base (Length - 1) => (if I < Output'First + Index'Base (Length - 1) then Output (I) /= Frame_Delimiter else Output (I) = Frame_Delimiter))), Annotate => (GNATProve, Terminating); -- Encode a byte array. -- -- The contents of the "Input" array are encoded and written -- to the "Output" array, followed by a single frame delimiter. The length -- of the complete frame (including the frame delimiter) is output as the -- "Length" parameter. -- -- @param Input The bytes to encode. -- -- @param Output The COBS-encoded data is written to the first "Length" -- bytes of this array. The last byte is a frame delimiter. -- -- @param Length The length of the encoded frame is written here. function Max_Overhead_Bytes (Input_Length : Byte_Count) return Positive_Byte_Count with Global => null; -- Return the maximum number of overhead bytes that are inserted into -- the output during COBS encoding for a given input length. function Array_Length_Within_Bounds (First, Last : Index'Base) return Boolean is (Last < First or else First > 0 or else Last < First + Index (Byte_Count'Last)); -- Check that the length of the given range does not exceed Byte_Count'Last -- -- This check is equivalent to: (Last - First) + 1 <= Byte_Count'Last -- -- The purpose of this check is to ensure that we can take the 'Length -- of a Byte_Array without causing an integer overflow. Such an overflow -- could happen if the Index type is a signed integer. For example, -- consider the following concrete types: -- -- type Index is range -10 .. +10; -- subtype Byte_Count is Index range 0 .. Index'Last; -- -- With these types it is possible to construct a Byte_Array whose length -- is larger than Byte_Count'Last: -- -- Buffer : Byte_Array (-10 .. +10); -- -- The length of this array is 21 bytes, which does not fit in Byte_Count. -- -- This check constrains the range of the Byte_Array object's range such -- that the maximum length does not exceed 10. For example: -- Buffer_1 : Byte_Array (-10 .. 10); -- Not OK, 'Length = 21 -- Buffer_2 : Byte_Array ( 1 .. 10); -- OK, 'Length = 10 -- Buffer_3 : Byte_Array ( 0 .. 10); -- Not OK, 'Length = 11 -- BUffer_4 : Byte_Array ( 0 .. 9); -- OK, 'Length = 10 -- Buffer_5 : Byte_Array ( -5 .. -1); -- OK, 'Length = 5 private Maximum_Run_Length : constant Byte_Count := Byte_Count (Byte'Last - 1); -- Maximum run of non-zero bytes before an overhead byte is added. -- -- COBS specifies that data is grouped into either 254 non-zero bytes, -- or 0-253 non-zero bytes followed by a zero byte. The 254 byte case -- allows for the trailing zero byte to be omitted, but for simplicity -- this case is not implemented in our encoder (but is supported by -- the decoder). function Max_Overhead_Bytes (Input_Length : Byte_Count) return Positive_Byte_Count is ((Input_Length / Maximum_Run_Length) + 1); procedure Encode_Block (Input : Byte_Array; Output : out Byte_Array; Length : out Byte_Count) with Inline, Global => null, Relaxed_Initialization => Output, Pre => (Array_Length_Within_Bounds (Input'First, Input'Last) and then Array_Length_Within_Bounds (Output'First, Output'Last) and then Output'Length > Input'Length), Post => (Length <= Input'Length + 1 and then (if Length < Input'Length + 1 then Length >= Maximum_Run_Length + 1) and then Output (Output'First .. Output'First + Index'Base (Length - 1))'Initialized and then (for all I in Output'First .. Output'First + Index'Base (Length - 1) => Output (I) /= Frame_Delimiter)), Annotate => (GNATProve, Terminating); -- Encodes a single block of bytes. -- -- This prepends one overhead byte, then encodes as many bytes as possible -- until another overhead byte is needed. Another overhead byte is needed -- when another full run of Maximum_Run_Length non-zero bytes is reached. end Generic_COBS;
samples/nes/player_cntrl_NROM-128/data/dog_gfx.asm
0x8BitDev/MAPeD-SPReD
23
171224
;####################################################### ; ; Generated by SPReD-NES Copyright 2017-2019 0x8BitDev ; ;####################################################### SPR_MODE_8X16 = 1 ;chr0: .incbin "dog_gfx_chr0.bin" ; 512 of 1024 bytes dog_gfx_palette: .byte $21, $38, $16, $0D, $21, $14, $24, $34, $21, $38, $11, $1D, $21, $1A, $2A, $3A dog_gfx_num_frames: .byte $08 dog_gfx_frames_data: dog01_IDLE01_RIGHT_frame: .word dog01_IDLE01_RIGHT .byte dog01_IDLE01_RIGHT_end - dog01_IDLE01_RIGHT ; data size .byte 0 ; CHR bank index (chr0) dog01_IDLE02_RIGHT_frame: .word dog01_IDLE02_RIGHT .byte dog01_IDLE02_RIGHT_end - dog01_IDLE02_RIGHT .byte 0 dog01_RUN01_RIGHT_frame: .word dog01_RUN01_RIGHT .byte dog01_RUN01_RIGHT_end - dog01_RUN01_RIGHT .byte 0 dog01_JUMP_RIGHT_frame: .word dog01_JUMP_RIGHT .byte dog01_JUMP_RIGHT_end - dog01_JUMP_RIGHT .byte 0 dog01_IDLE01_LEFT_frame: .word dog01_IDLE01_LEFT .byte dog01_IDLE01_LEFT_end - dog01_IDLE01_LEFT .byte 0 dog01_IDLE02_LEFT_frame: .word dog01_IDLE02_LEFT .byte dog01_IDLE02_LEFT_end - dog01_IDLE02_LEFT .byte 0 dog01_RUN01_LEFT_frame: .word dog01_RUN01_LEFT .byte dog01_RUN01_LEFT_end - dog01_RUN01_LEFT .byte 0 dog01_JUMP_LEFT_frame: .word dog01_JUMP_LEFT .byte dog01_JUMP_LEFT_end - dog01_JUMP_LEFT .byte 0 ; #1: Y pos, #2: CHR index, #3: Attributes, #4: X pos dog01_IDLE01_RIGHT: .byte $E1, $00, $00, $F4 .byte $E1, $02, $00, $FC .byte $E1, $04, $00, $04 .byte $F1, $06, $02, $F4 .byte $F1, $0A, $02, $04 .byte $F1, $08, $02, $FC dog01_IDLE01_RIGHT_end: dog01_IDLE02_RIGHT: .byte $E0, $02, $00, $FC .byte $E0, $04, $00, $04 .byte $F0, $0C, $02, $F4 .byte $F0, $0E, $02, $FC .byte $F0, $10, $02, $04 .byte $E0, $12, $00, $F4 dog01_IDLE02_RIGHT_end: dog01_RUN01_RIGHT: .byte $E0, $02, $00, $FC .byte $E0, $04, $00, $04 .byte $F0, $1A, $02, $F4 .byte $F0, $1C, $02, $FC .byte $F0, $1E, $00, $04 .byte $E0, $00, $00, $F4 dog01_RUN01_RIGHT_end: dog01_JUMP_RIGHT: .byte $DE, $02, $00, $FC .byte $DE, $04, $00, $04 .byte $DE, $12, $00, $F4 .byte $EE, $14, $02, $F4 .byte $EE, $16, $02, $FC .byte $EE, $18, $02, $04 dog01_JUMP_RIGHT_end: dog01_IDLE01_LEFT: .byte $E1, $00, $40, $04 .byte $E1, $02, $40, $FC .byte $E1, $04, $40, $F4 .byte $F1, $06, $42, $04 .byte $F1, $0A, $42, $F4 .byte $F1, $08, $42, $FC dog01_IDLE01_LEFT_end: dog01_IDLE02_LEFT: .byte $E0, $02, $40, $FC .byte $E0, $04, $40, $F4 .byte $F0, $0C, $42, $04 .byte $F0, $0E, $42, $FC .byte $F0, $10, $42, $F4 .byte $E0, $12, $40, $04 dog01_IDLE02_LEFT_end: dog01_RUN01_LEFT: .byte $E0, $02, $40, $FC .byte $E0, $04, $40, $F4 .byte $F0, $1A, $42, $04 .byte $F0, $1C, $42, $FC .byte $F0, $1E, $40, $F4 .byte $E0, $00, $40, $04 dog01_RUN01_LEFT_end: dog01_JUMP_LEFT: .byte $DE, $02, $40, $FC .byte $DE, $04, $40, $F4 .byte $DE, $12, $40, $04 .byte $EE, $14, $42, $04 .byte $EE, $16, $42, $FC .byte $EE, $18, $42, $F4 dog01_JUMP_LEFT_end:
src/conversion.ads
joffreyhuguet/curve25519-spark2014
4
1587
<gh_stars>1-10 with Big_Integers; use Big_Integers; with Types; use Types; with Construct_Conversion_Array; package Conversion with SPARK_Mode, Ghost is pragma Annotate (GNATprove, Terminating, Conversion); Conversion_Array : constant Conversion_Array_Type := Construct_Conversion_Array.Conversion_Array; -- Conversion_Array is the array constructed in the -- Construct_Conversion_Array package. It has the -- property proven in the previous package. -- -- Conversion_Array = (1, 2**25, 2**51, 2**77, 2**102, 2**128, 2**153, -- 2**179, 2**204, 2**230, 2**255, 2**281, 2**306, -- 2**332, 2**357, 2**383, 2**408, 2**434, 2**459) function Partial_Conversion (X : Integer_Curve25519; L : Product_Index_Type) return Big_Integer is (if L = 0 then (+X(0)) * Conversion_Array (0) else Partial_Conversion (X, L - 1) + (+X (L)) * Conversion_Array (L)) with Pre => L in X'Range; -- Recursive function to convert the array of integers to the integer -- it represents. function To_Big_Integer (X : Integer_Curve25519) return Big_Integer is (Partial_Conversion (X, X'Last)) with Pre => X'Length > 0; -- Converts an array of 10 32-bits integers to the signed -- 255-bits integer it represents. function "+" (X : Integer_Curve25519) return Big_Integer renames To_Big_Integer; procedure Equal_To_Conversion (A, B : Integer_Curve25519; L : Product_Index_Type) with Pre => A'Length > 0 and then A'First = 0 and then B'First = 0 and then B'Last <= A'Last and then L in B'Range and then (for all J in 0 .. L => A (J) = B (J)), Post => Partial_Conversion (A, L) = Partial_Conversion (B, L); -- Lemma to prove that if A (0 .. L) = B (0 .. L) then -- Partial_Conversion (A, L) = Partial_Conversion (B, L). end Conversion;
src/model/l_system/lse-model-l_system-l_system.ads
mgrojo/lsystem-editor
2
8695
------------------------------------------------------------------------------- -- LSE -- L-System Editor -- Author: Heziode -- -- License: -- MIT License -- -- Copyright (c) 2018 <NAME> (Heziode) <<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.Strings.Unbounded; with LSE.Utils.Angle; with LSE.Model.Interpreter; with LSE.Model.L_System.Growth_Rule_Utils; with LSE.Model.Grammar.Symbol_Utils; with LSE.Model.IO.Turtle_Utils; use Ada.Strings.Unbounded; use LSE.Model.Interpreter; use LSE.Model.IO.Turtle_Utils; -- @description -- This package represent a L-System. -- package LSE.Model.L_System.L_System is -- Representing a L-System type Instance is new Interpreter.Instance with private; -- Constructor procedure Initialize (This : out Instance; Axiom : LSE.Model.Grammar.Symbol_Utils.P_List.List; Angle : LSE.Utils.Angle.Angle; Rules : LSE.Model.L_System.Growth_Rule_Utils.P_List.List; Turtle : LSE.Model.IO.Turtle_Utils.Holder); -- Accessor of current state function Get_State (This : Instance) return Natural; -- Mutator of current state procedure Set_State (This : out Instance; Value : Natural); -- Getting a string representation of this L-System function Get_LSystem (This : Instance) return String; -- Getting a string representation of the current development function Get_Value (This : Instance) return String; -- Getting the current development function Get_Value (This : Instance) return LSE.Model.Grammar.Symbol_Utils.P_List.List; -- Accessor of Turtle function Get_Turtle (This : Instance) return LSE.Model.IO.Turtle_Utils.Holder; -- Mutator of Turtle procedure Set_Turtle (This : out Instance; Value : LSE.Model.IO.Turtle_Utils.Holder); -- Develop this L-System to the next step procedure Develop (This : out Instance); overriding procedure Interpret (This : in out Instance; T : in out Holder); private type Instance is new Interpreter.Instance with record -- State to develop State : Natural := 0; -- Currently developed state Current_State : Natural := 0; -- Axiom Axiom : LSE.Model.Grammar.Symbol_Utils.P_List.List; -- Angle Angle : LSE.Utils.Angle.Angle; -- Growth rules Rules : LSE.Model.L_System.Growth_Rule_Utils.P_List.List; -- List of symbol of the currently developed state Current_Value : LSE.Model.Grammar.Symbol_Utils.P_List.List; -- "Empty" turtle to compute L-System dimensions during develop Turtle : LSE.Model.IO.Turtle_Utils.Holder; end record; -- Getting the string representation of a symbol list function Get_Symbol_List (This : LSE.Model.Grammar.Symbol_Utils.P_List.List) return Unbounded_String; -- Compute dimension of the L-System procedure Compute_Dimension (This : in out Instance); end LSE.Model.L_System.L_System;
alloy4fun_models/trashltl/models/9/Wjz5cbEi6YasADyfm.als
Kaixi26/org.alloytools.alloy
0
1645
<reponame>Kaixi26/org.alloytools.alloy<filename>alloy4fun_models/trashltl/models/9/Wjz5cbEi6YasADyfm.als open main pred idWjz5cbEi6YasADyfm_prop10 { (all f:File&Protected | always f in Protected) } pred __repair { idWjz5cbEi6YasADyfm_prop10 } check __repair { idWjz5cbEi6YasADyfm_prop10 <=> prop10o }
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_988.asm
ljhsiun2/medusa
9
26098
.global s_prepare_buffers s_prepare_buffers: push %r15 push %r8 push %rbp push %rcx push %rdi push %rsi lea addresses_A_ht+0x9897, %rsi lea addresses_A_ht+0x10e3f, %rdi nop nop nop and $4438, %r15 mov $68, %rcx rep movsl nop nop nop nop nop and $19460, %r8 lea addresses_WC_ht+0x1306f, %rdi sub $15370, %rbp mov (%rdi), %r15w inc %rsi pop %rsi pop %rdi pop %rcx pop %rbp pop %r8 pop %r15 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r8 push %r9 push %rdi push %rsi // Store lea addresses_D+0xd4df, %r9 nop nop nop cmp $11188, %r10 mov $0x5152535455565758, %r13 movq %r13, (%r9) nop nop nop nop sub %rsi, %rsi // Faulty Load lea addresses_A+0x1533f, %r10 nop nop nop nop nop add %r8, %r8 movups (%r10), %xmm1 vpextrq $1, %xmm1, %r9 lea oracles, %r10 and $0xff, %r9 shlq $12, %r9 mov (%r10,%r9,1), %r9 pop %rsi pop %rdi pop %r9 pop %r8 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 4}} {'35': 21829} 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
source/nls/machine-pc-linux-gnu/s-naenen.ads
ytomino/drake
33
25229
<reponame>ytomino/drake<gh_stars>10-100 pragma License (Unrestricted); -- implementation unit specialized for FreeBSD (or Linux) with Ada.IO_Exceptions; with Ada.Streams; with C.iconv; package System.Native_Environment_Encoding is -- Platform-depended text encoding. pragma Preelaborate; use type C.char_array; -- max length of one multi-byte character Max_Substitute_Length : constant := 6; -- UTF-8 -- encoding identifier type Encoding_Id is access constant C.char; for Encoding_Id'Storage_Size use 0; function Get_Image (Encoding : Encoding_Id) return String; function Get_Default_Substitute (Encoding : Encoding_Id) return Ada.Streams.Stream_Element_Array; function Get_Min_Size_In_Stream_Elements (Encoding : Encoding_Id) return Ada.Streams.Stream_Element_Offset; UTF_8_Name : aliased constant C.char_array (0 .. 5) := "UTF-8" & C.char'Val (0); UTF_8 : constant Encoding_Id := UTF_8_Name (0)'Access; UTF_16_Names : aliased constant array (Bit_Order) of aliased C.char_array (0 .. 8) := ( High_Order_First => "UTF-16BE" & C.char'Val (0), Low_Order_First => "UTF-16LE" & C.char'Val (0)); UTF_16 : constant Encoding_Id := UTF_16_Names (Default_Bit_Order)(0)'Access; UTF_16BE : constant Encoding_Id := UTF_16_Names (High_Order_First)(0)'Access; UTF_16LE : constant Encoding_Id := UTF_16_Names (Low_Order_First)(0)'Access; UTF_32_Names : aliased constant array (Bit_Order) of aliased C.char_array (0 .. 8) := ( High_Order_First => "UTF-32BE" & C.char'Val (0), Low_Order_First => "UTF-32LE" & C.char'Val (0)); UTF_32 : constant Encoding_Id := UTF_32_Names (Default_Bit_Order)(0)'Access; UTF_32BE : constant Encoding_Id := UTF_32_Names (High_Order_First)(0)'Access; UTF_32LE : constant Encoding_Id := UTF_32_Names (Low_Order_First)(0)'Access; function Get_Current_Encoding return Encoding_Id; -- Returns UTF-8. In POSIX, The system encoding is assumed as UTF-8. pragma Inline (Get_Current_Encoding); -- subsidiary types to converter type Subsequence_Status_Type is ( Finished, Success, Overflow, -- the output buffer is not large enough Illegal_Sequence, -- a input character could not be mapped to the output Truncated); -- the input buffer is broken off at a multi-byte character pragma Discard_Names (Subsequence_Status_Type); type Continuing_Status_Type is new Subsequence_Status_Type range Success .. Subsequence_Status_Type'Last; type Finishing_Status_Type is new Subsequence_Status_Type range Finished .. Overflow; type Status_Type is new Subsequence_Status_Type range Finished .. Illegal_Sequence; type Substituting_Status_Type is new Status_Type range Finished .. Overflow; subtype True_Only is Boolean range True .. True; -- converter type Converter is record iconv : C.iconv.iconv_t := C.void_ptr (Null_Address); -- about "From" Min_Size_In_From_Stream_Elements : Ada.Streams.Stream_Element_Offset; -- about "To" Substitute_Length : Ada.Streams.Stream_Element_Offset; Substitute : Ada.Streams.Stream_Element_Array ( 1 .. Max_Substitute_Length); end record; pragma Suppress_Initialization (Converter); Disable_Controlled : constant Boolean := False; procedure Open (Object : in out Converter; From, To : Encoding_Id); procedure Close (Object : in out Converter); function Is_Open (Object : Converter) return Boolean; pragma Inline (Is_Open); function Min_Size_In_From_Stream_Elements_No_Check (Object : Converter) return Ada.Streams.Stream_Element_Offset; function Substitute_No_Check (Object : Converter) return Ada.Streams.Stream_Element_Array; procedure Set_Substitute_No_Check ( Object : in out Converter; Substitute : Ada.Streams.Stream_Element_Array); -- convert subsequence procedure Convert_No_Check ( Object : Converter; Item : Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Out_Item : out Ada.Streams.Stream_Element_Array; Out_Last : out Ada.Streams.Stream_Element_Offset; Finish : Boolean; Status : out Subsequence_Status_Type); procedure Convert_No_Check ( Object : Converter; Item : Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Out_Item : out Ada.Streams.Stream_Element_Array; Out_Last : out Ada.Streams.Stream_Element_Offset; Status : out Continuing_Status_Type); procedure Convert_No_Check ( Object : Converter; Out_Item : out Ada.Streams.Stream_Element_Array; Out_Last : out Ada.Streams.Stream_Element_Offset; Finish : True_Only; Status : out Finishing_Status_Type); -- convert all character sequence -- procedure Convert_No_Check ( -- Object : Converter; -- Item : Ada.Streams.Stream_Element_Array; -- Last : out Ada.Streams.Stream_Element_Offset; -- Out_Item : out Ada.Streams.Stream_Element_Array; -- Out_Last : out Ada.Streams.Stream_Element_Offset; -- Finish : True_Only; -- Status : out Status_Type); -- convert all character sequence with substitute procedure Convert_No_Check ( Object : Converter; Item : Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset; Out_Item : out Ada.Streams.Stream_Element_Array; Out_Last : out Ada.Streams.Stream_Element_Offset; Finish : True_Only; Status : out Substituting_Status_Type); procedure Put_Substitute ( Object : Converter; Out_Item : out Ada.Streams.Stream_Element_Array; Out_Last : out Ada.Streams.Stream_Element_Offset; Is_Overflow : out Boolean); -- exceptions Name_Error : exception renames Ada.IO_Exceptions.Name_Error; Use_Error : exception renames Ada.IO_Exceptions.Use_Error; end System.Native_Environment_Encoding;
make/ddk_build/cpprtl_test.sys.project/ntke_cpprtl.syslib/AMD64/eh_execute_handler.x64.asm
133a/project_ntke_cpprtl
12
6913
<reponame>133a/project_ntke_cpprtl include eh/table_based/_x64/eh_execute_handler.x64.asm
ioctl/IokNotify.asm
osfree-project/FamilyAPI
1
81664
<filename>ioctl/IokNotify.asm ;-------------------------------------------------------- ; Category 4 Function 55H Notify of Change of Foreground Session ;-------------------------------------------------------- ; ; ; IOKNOTIFY PROC NEAR RET IOKNOTIFY ENDP
programs/oeis/317/A317301.asm
neoneye/loda
22
566
; A317301: Sequence obtained by taking the general formula for generalized k-gonal numbers: m*((k - 2)*m - k + 4)/2, where m = 0, +1, -1, +2, -2, +3, -3, ... and k >= 5. Here k = 1. ; 0,1,-2,1,-5,0,-9,-2,-14,-5,-20,-9,-27,-14,-35,-20,-44,-27,-54,-35,-65,-44,-77,-54,-90,-65,-104,-77,-119,-90,-135,-104,-152,-119,-170,-135,-189,-152,-209,-170,-230,-189,-252,-209,-275,-230,-299,-252,-324,-275,-350,-299,-377,-324,-405,-350,-434,-377,-464,-405,-495,-434,-527,-464,-560,-495,-594,-527,-629,-560,-665,-594,-702,-629,-740,-665,-779,-702,-819,-740,-860,-779,-902,-819,-945,-860,-989,-902,-1034,-945,-1080,-989,-1127,-1034,-1175,-1080,-1224,-1127,-1274,-1175 mov $1,$0 mov $2,$0 lpb $2 sub $1,7 sub $2,1 add $0,$2 add $0,$1 sub $2,1 lpe
03. 8086/04. Split and Copy.asm
nitrece/microprocessor-laboratory
0
88528
<gh_stars>0 ; Q 4> ; a> To store the elements of a given array in 2 separate arrays ; comprising of even and odd elements SW 2000h [2000h] = 2006h ; Address of source array A[] [2002h] = 2014h ; Address to even array E[] [2004h] = 2024h ; Address to odd array O[] [2006h] = 0006h ; A.length = 6 [2008h] = 0001h ; A[0] = 1 [200Ah] = 0002h ; A[1] = 2 [200Ch] = 0003h ; A[2] = 3 [200Eh] = 0004h ; A[3] = 4 [2010h] = 0005h ; A[4] = 5 [2012h] = 0006h ; A[5] = 6 . A 1000h mov bx, [2000h] mov si, [2002h] mov di, [2004h] mov ax, [bx] push ax mov bp, sp add bx, 0002h add si, 0002h add di, 0002h mov cx, 0000h mov dx, 0000h loop_label: mov ax, [bx] test ax, 0001h jnz odd_num mov [si], ax add si, 0002h inc cx jmp loop_comm odd_num: mov [di], ax add di, 0002h inc dx loop_comm: add bx, 0002h dec [bp] jnz loop_label pop ax mov [2014h], cx mov [2024h], dx hlt . GO 1000h INT ;(try '.' here) SW 2014h ; ans = 0003h => E.length = 3 SW 2016h ; ans = 0002h => E[0] = 2 SW 2018h ; ans = 0004h => E[1] = 4 SW 201Ah ; ans = 0006h => E[2] = 6 SW 2024h ; ans = 0003h => O.length = 3 SW 2026h ; ans = 0001h => O[0] = 1 SW 2028h ; ans = 0003h => O[1] = 3 SW 202Ah ; ans = 0005h => O[2] = 5 . ; b> To move the contents from a block in a memory location to a ; different memory location using stack SW 2000h [2000h] = 2006h ; Source Block Address SRC [2002h] = 2010h ; Destination Block Address DST [2004h] = 000Ah ; Transfer Size SZ = 10 [2006h] = 0001h ; 00h, 01h [2008h] = 0002h ; 00h, 02h [200Ah] = 0003h ; 00h, 03h [200Ch] = 0004h ; 00h, 04h [200Eh] = 0005h ; 00h, 05h . A 1000h mov si, [2000h] mov di, [2002h] mov cx, [2004h] add di, cx dec di mov ax, 0000h loop_label1: mov al, [si] push ax inc si dec cx jnz loop_label1 mov cx, [2004h] loop_label2: pop ax mov [di], al dec di dec cx jnz loop_label2 hlt . GO 1000h INT ;(try '.' here) SW 2010h ; ans = 0001h SW 2012h ; ans = 0002h SW 2014h ; ans = 0003h SW 2016h ; ans = 0004h SW 2018h ; ans = 0005h
oeis/128/A128116.asm
neoneye/loda-programs
11
244240
; A128116: A128064 * A122432. ; Submitted by <NAME> ; 1,5,2,12,7,3,22,15,9,4,35,26,18,11,5,51,40,30,21,13,6,70,57,45,34,24,15,7,92,77,63,50,38,27,17,8,117,100,84,69,55,42,30,19,9,145,126,108,91,75,60,46,33,21,10 lpb $0 add $1,1 sub $0,$1 lpe sub $1,$0 mul $0,2 add $0,$1 add $0,2 add $0,$1 add $0,$1 mul $1,$0 add $0,$1 div $0,2
oeis/050/A050621.asm
neoneye/loda-programs
11
27590
; A050621: Smallest n-digit number divisible by 2^n. ; 2,12,104,1008,10016,100032,1000064,10000128,100000256,1000000512,10000001024,100000002048,1000000004096,10000000008192,100000000016384,1000000000032768,10000000000065536,100000000000131072,1000000000000262144,10000000000000524288,100000000000001048576,1000000000000002097152,10000000000000004194304,100000000000000008388608,1000000000000000016777216,10000000000000000033554432,100000000000000000067108864,1000000000000000000134217728,10000000000000000000268435456,100000000000000000000536870912 mov $1,2 pow $1,$0 mov $2,10 pow $2,$0 add $1,$2 mov $0,$1
test/asset/agda-stdlib-1.0/Data/Unit/Base.agda
omega12345/agda-mode
0
14854
------------------------------------------------------------------------ -- The Agda standard library -- -- The unit type and the total relation on unit ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Unit.Base where ------------------------------------------------------------------------ -- A unit type defined as a record type -- Note that the name of this type is "\top", not T. open import Agda.Builtin.Unit public using (⊤; tt) record _≤_ (x y : ⊤) : Set where
oeis/312/A312475.asm
neoneye/loda-programs
11
94605
<filename>oeis/312/A312475.asm ; A312475: Coordination sequence Gal.3.16.1 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by <NAME> ; 1,4,8,14,18,22,26,30,36,40,44,48,52,58,62,66,70,74,80,84,88,92,96,102,106,110,114,118,124,128,132,136,140,146,150,154,158,162,168,172,176,180,184,190,194,198,202,206,212,216 mov $1,1 mov $2,$0 mul $2,4 lpb $0 mov $0,$2 div $0,10 mov $1,$0 lpe mod $0,2 add $1,$2 add $0,$1
fox32os/kernel/fxf/reloc.asm
ry755/fox32
6
177498
; FXF relocation routines ; relocate a FXF binary ; inputs: ; r0: pointer to memory buffer containing a FXF binary ; outputs: ; r0: relocation address fxf_reloc: push r1 push r2 push r3 push r4 push r5 ; calculate relocation address mov r5, r0 add r5, FXF_CODE_PTR mov r5, [r5] add r5, r0 ; get the number of entries in the reloc table mov r1, r0 add r1, FXF_RELOC_SIZE mov r1, [r1] div r1, 4 mov r31, r1 ; get the pointer to the table mov r1, r0 add r1, FXF_RELOC_PTR mov r1, [r1] add r1, r0 ; get the pointer to the code mov r2, r0 add r2, FXF_CODE_PTR mov r2, [r2] add r2, r0 ; loop over the reloc table entries and relocate the code fxf_reloc_loop: ; get the reloc table entry mov r3, [r1] ; point to the location in the code mov r4, r2 add r4, r3 ; relocate add [r4], r5 ; increment the reloc table pointer add r1, 4 loop fxf_reloc_loop ; return relocation address mov r0, r5 pop r5 pop r4 pop r3 pop r2 pop r1 ret
src/H-level/Truncation.agda
nad/equality
3
13779
<gh_stars>1-10 ------------------------------------------------------------------------ -- Truncation, defined as a HIT ------------------------------------------------------------------------ {-# OPTIONS --erased-cubical --safe #-} -- The beginning of this module follows the HoTT book rather closely. -- The module is parametrised by a notion of equality. The higher -- constructor of the HIT defining the truncation uses path equality, -- but the supplied notion of equality is used for many other things. import Equality.Path as P module H-level.Truncation {e⁺} (eq : ∀ {a p} → P.Equality-with-paths a p e⁺) where open P.Derived-definitions-and-properties eq hiding (elim) open import Logical-equivalence using (_⇔_) open import Prelude open import Bijection equality-with-J using (_↔_) open import Equality.Path.Isomorphisms eq open import Equivalence equality-with-J as Eq using (_≃_) open import Function-universe equality-with-J hiding (id; _∘_) open import H-level equality-with-J open import H-level.Closure equality-with-J open import H-level.Truncation.Propositional eq as TP using (∥_∥) open import Monad equality-with-J open import Nat equality-with-J as Nat using (_≤_; min) import Pointed-type equality-with-J as PT open import Sphere eq open import Suspension eq as Susp using (north) open import Univalence-axiom equality-with-J private variable a b ℓ p : Level A B C : Type a P : A → Type p e x y : A f g r : A → B m n : ℕ k : Isomorphism-kind -- A truncation operator for positive h-levels. data ∥_∥[1+_] (A : Type a) (n : ℕ) : Type a where ∣_∣ : A → ∥ A ∥[1+ n ] hub : (r : 𝕊 n → ∥ A ∥[1+ n ]) → ∥ A ∥[1+ n ] spokeᴾ : (r : 𝕊 n → ∥ A ∥[1+ n ]) (x : 𝕊 n) → r x P.≡ hub r -- Spoke equalities. spoke : (r : 𝕊 n → ∥ A ∥[1+ n ]) (x : 𝕊 n) → r x ≡ hub r spoke r x = _↔_.from ≡↔≡ (spokeᴾ r x) -- The truncation operator produces types of the right h-level. truncation-has-correct-h-level : ∀ n → H-level (1 + n) ∥ A ∥[1+ n ] truncation-has-correct-h-level {A = A} n = _↔_.from +↔∀contractible𝕊→ᴮ c where c : ∀ x → Contractible ((𝕊 n , north) PT.→ᴮ (∥ A ∥[1+ n ] , x)) c x = (const x , (const x (north {A = 𝕊 n}) ≡⟨⟩ x ∎)) , λ { (f , fn≡x) → Σ-≡,≡→≡ (⟨ext⟩ λ y → const x y ≡⟨⟩ x ≡⟨ sym fn≡x ⟩ f north ≡⟨ spoke f north ⟩ hub f ≡⟨ sym $ spoke f y ⟩∎ f y ∎) (subst (λ f → f north ≡ x) (⟨ext⟩ (λ y → trans (sym fn≡x) (trans (spoke f north) (sym (spoke f y))))) (refl x) ≡⟨ subst-ext _ _ ⟩ subst (_≡ x) (trans (sym fn≡x) (trans (spoke f north) (sym (spoke f north)))) (refl x) ≡⟨ cong (λ p → subst (_≡ x) (trans (sym fn≡x) p) (refl x)) $ trans-symʳ _ ⟩ subst (_≡ x) (trans (sym fn≡x) (refl (f north))) (refl x) ≡⟨ cong (λ p → subst (_≡ x) p (refl x)) $ trans-reflʳ _ ⟩ subst (_≡ x) (sym fn≡x) (refl x) ≡⟨ subst-trans _ ⟩ trans fn≡x (refl x) ≡⟨ trans-reflʳ _ ⟩∎ fn≡x ∎) } -- A dependent eliminator, expressed using paths. record Elimᴾ {A : Type a} (P : ∥ A ∥[1+ n ] → Type p) : Type (a ⊔ p) where no-eta-equality field ∣∣ʳ : ∀ x → P ∣ x ∣ hubʳ : (r : 𝕊 n → ∥ A ∥[1+ n ]) → (∀ x → P (r x)) → P (hub r) spokeʳ : (r : 𝕊 n → ∥ A ∥[1+ n ]) (p : ∀ x → P (r x)) (x : 𝕊 n) → P.[ (λ i → P (spokeᴾ r x i)) ] p x ≡ hubʳ r p open Elimᴾ public elimᴾ : Elimᴾ P → ∀ x → P x elimᴾ {P = P} e = helper where module E = Elimᴾ e helper : ∀ x → P x helper ∣ x ∣ = E.∣∣ʳ x helper (hub r) = E.hubʳ r (λ x → helper (r x)) helper (spokeᴾ r x i) = E.spokeʳ r (λ x → helper (r x)) x i -- A non-dependent eliminator, expressed using paths. record Recᴾ (n : ℕ) (A : Type a) (B : Type b) : Type (a ⊔ b) where no-eta-equality field ∣∣ʳ : A → B hubʳ : (𝕊 n → ∥ A ∥[1+ n ]) → (𝕊 n → B) → B spokeʳ : (r : 𝕊 n → ∥ A ∥[1+ n ]) (p : 𝕊 n → B) (x : 𝕊 n) → p x P.≡ hubʳ r p open Recᴾ public recᴾ : Recᴾ n A B → ∥ A ∥[1+ n ] → B recᴾ r = elimᴾ eᴾ where module R = Recᴾ r eᴾ : Elimᴾ _ eᴾ .∣∣ʳ = r .∣∣ʳ eᴾ .hubʳ = r .hubʳ eᴾ .spokeʳ = r .spokeʳ -- A dependent eliminator. record Elim′ {A : Type a} (P : ∥ A ∥[1+ n ] → Type p) : Type (a ⊔ p) where no-eta-equality field ∣∣ʳ : ∀ x → P ∣ x ∣ hubʳ : (r : 𝕊 n → ∥ A ∥[1+ n ]) → (∀ x → P (r x)) → P (hub r) spokeʳ : (r : 𝕊 n → ∥ A ∥[1+ n ]) (p : ∀ x → P (r x)) (x : 𝕊 n) → subst P (spoke r x) (p x) ≡ hubʳ r p open Elim′ public elim′ : Elim′ P → ∀ x → P x elim′ e′ = elimᴾ eᴾ where module E′ = Elim′ e′ eᴾ : Elimᴾ _ eᴾ .∣∣ʳ = E′.∣∣ʳ eᴾ .hubʳ = E′.hubʳ eᴾ .spokeʳ r p x = subst≡→[]≡ (E′.spokeʳ r p x) elim′-spoke : dcong (elim′ e) (spoke r x) ≡ Elim′.spokeʳ e r (λ x → elim′ e (r x)) x elim′-spoke = dcong-subst≡→[]≡ (refl _) -- A non-dependent eliminator. record Rec′ (n : ℕ) (A : Type a) (B : Type b) : Type (a ⊔ b) where no-eta-equality field ∣∣ʳ : A → B hubʳ : (𝕊 n → ∥ A ∥[1+ n ]) → (𝕊 n → B) → B spokeʳ : (r : 𝕊 n → ∥ A ∥[1+ n ]) (p : 𝕊 n → B) (x : 𝕊 n) → p x ≡ hubʳ r p open Rec′ public rec′ : Rec′ n A B → ∥ A ∥[1+ n ] → B rec′ r′ = recᴾ rᴾ where module R′ = Rec′ r′ rᴾ : Recᴾ _ _ _ rᴾ .∣∣ʳ = R′.∣∣ʳ rᴾ .hubʳ = R′.hubʳ rᴾ .spokeʳ r p x = _↔_.to ≡↔≡ (R′.spokeʳ r p x) rec′-spoke : cong (rec′ e) (spoke r x) ≡ Rec′.spokeʳ e r (λ x → rec′ e (r x)) x rec′-spoke = cong-≡↔≡ (refl _) -- A dependent eliminator that can be used when the motive is a family -- of types, all of a certain h-level. record Elim {A : Type a} (P : ∥ A ∥[1+ n ] → Type p) : Type (a ⊔ p) where no-eta-equality field ∣∣ʳ : ∀ x → P ∣ x ∣ h-levelʳ : ∀ x → H-level (1 + n) (P x) open Elim public elim : Elim {n = n} {A = A} P → ∀ x → P x elim {n = n} {A = A} {P = P} e = elim′ e′ where module _ (r : 𝕊 n → ∥ A ∥[1+ n ]) (p : ∀ x → P (r x)) where h′ : 𝕊 n → P (hub r) h′ x = subst P (spoke r x) (p x) h = h′ north lemma = $⟨ e .h-levelʳ ⟩ (∀ x → H-level (1 + n) (P x)) ↝⟨ _$ _ ⟩ H-level (1 + n) (P (hub r)) ↔⟨ +↔∀contractible𝕊→ᴮ ⟩ (∀ h → Contractible ((𝕊 n , north) PT.→ᴮ (P (hub r) , h))) ↝⟨ _$ _ ⟩ Contractible ((𝕊 n , north) PT.→ᴮ (P (hub r) , h)) ↝⟨ mono₁ _ ⟩□ Is-proposition ((𝕊 n , north) PT.→ᴮ (P (hub r) , h)) □ s = λ x → subst P (spoke r x) (p x) ≡⟨⟩ h′ x ≡⟨ cong (λ f → proj₁ f x) $ lemma (h′ , refl _) (const h , refl _) ⟩ const h x ≡⟨⟩ h ∎ e′ : Elim′ _ e′ .∣∣ʳ = e .∣∣ʳ e′ .hubʳ = h e′ .spokeʳ = s -- A non-dependent eliminator that can be used when the motive is a -- type of a certain h-level. record Rec (n : ℕ) (A : Type a) (B : Type b) : Type (a ⊔ b) where no-eta-equality field ∣∣ʳ : A → B h-levelʳ : H-level (1 + n) B open Rec public rec : Rec n A B → ∥ A ∥[1+ n ] → B rec r = elim λ where .∣∣ʳ → r .∣∣ʳ .h-levelʳ _ → r .h-levelʳ -- Dependent functions into P that agree on the image of ∣_∣ agree -- everywhere, if P is a family of types that all have a certain -- h-level. uniqueness′ : {f g : (x : ∥ A ∥[1+ n ]) → P x} → (∀ x → H-level (2 + n) (P x)) → ((x : A) → f ∣ x ∣ ≡ g ∣ x ∣) → ((x : ∥ A ∥[1+ n ]) → f x ≡ g x) uniqueness′ {n = n} P-h f≡g = elim λ where .∣∣ʳ → f≡g .h-levelʳ _ → +⇒≡ {n = suc n} (P-h _) -- A special case of the previous property. uniqueness : {f g : ∥ A ∥[1+ n ] → B} → H-level (1 + n) B → ((x : A) → f ∣ x ∣ ≡ g ∣ x ∣) → ((x : ∥ A ∥[1+ n ]) → f x ≡ g x) uniqueness h = uniqueness′ (λ _ → mono₁ _ h) -- The truncation operator's universal property. universal-property : H-level (1 + n) B → (∥ A ∥[1+ n ] → B) ↔ (A → B) universal-property h = record { surjection = record { logical-equivalence = record { to = _∘ ∣_∣ ; from = λ f → rec λ where .∣∣ʳ → f .h-levelʳ → h } ; right-inverse-of = refl } ; left-inverse-of = λ f → ⟨ext⟩ $ uniqueness h (λ x → f ∣ x ∣ ∎) } -- The truncation operator ∥_∥[1+ n ] is a functor. ∥∥-map : (A → B) → ∥ A ∥[1+ n ] → ∥ B ∥[1+ n ] ∥∥-map f = rec λ where .∣∣ʳ x → ∣ f x ∣ .h-levelʳ → truncation-has-correct-h-level _ ∥∥-map-id : (x : ∥ A ∥[1+ n ]) → ∥∥-map id x ≡ x ∥∥-map-id = uniqueness (truncation-has-correct-h-level _) (λ x → ∣ x ∣ ∎) ∥∥-map-∘ : (x : ∥ A ∥[1+ n ]) → ∥∥-map (f ∘ g) x ≡ ∥∥-map f (∥∥-map g x) ∥∥-map-∘ {f = f} {g = g} = uniqueness (truncation-has-correct-h-level _) (λ x → ∣ f (g x) ∣ ∎) -- A zip function. ∥∥-zip : (A → B → C) → ∥ A ∥[1+ n ] → ∥ B ∥[1+ n ] → ∥ C ∥[1+ n ] ∥∥-zip f = rec λ where .∣∣ʳ x → ∥∥-map (f x) .h-levelʳ → Π-closure ext _ λ _ → truncation-has-correct-h-level _ -- A has h-level 1 + n if and only if it is isomorphic to -- ∥ A ∥[1+ n ]. +⇔∥∥↔ : H-level (1 + n) A ⇔ (∥ A ∥[1+ n ] ↔ A) +⇔∥∥↔ {n = n} {A = A} = record { to = λ h → record { surjection = record { logical-equivalence = record { from = ∣_∣ ; to = rec λ where .∣∣ʳ → id .h-levelʳ → h } ; right-inverse-of = refl } ; left-inverse-of = elim λ where .∣∣ʳ x → ∣ x ∣ ∎ .h-levelʳ _ → ⇒≡ _ $ truncation-has-correct-h-level _ } ; from = ∥ A ∥[1+ n ] ↔ A ↝⟨ H-level-cong ext _ ⟩ (H-level (1 + n) ∥ A ∥[1+ n ] ↔ H-level (1 + n) A) ↝⟨ (λ hyp → _↔_.to hyp (truncation-has-correct-h-level _)) ⟩□ H-level (1 + n) A □ } -- The (1 + n)-truncation of x ≡ y, where x and y have type A, is -- equivalent to the equality of ∣ x ∣ and ∣ y ∣ (as elements of the -- (2 + n)-truncation of A), assuming univalence. -- -- Along with the fact that this lemma computes in a certain way (see -- below) this is more or less Theorem 7.3.12 from the HoTT book. ∥≡∥≃∣∣≡∣∣ : {A : Type a} {x y : A} → Univalence a → ∥ x ≡ y ∥[1+ n ] ≃ _≡_ {A = ∥ A ∥[1+ suc n ]} ∣ x ∣ ∣ y ∣ ∥≡∥≃∣∣≡∣∣ {n = n} {A = A} univ = Eq.↔→≃ (decode ∣ _ ∣ ∣ _ ∣) (encode ∣ _ ∣ ∣ _ ∣) (decode-encode _) (encode-decode _ _) where Eq : (_ _ : ∥ A ∥[1+ suc n ]) → ∃ λ (B : Type _) → H-level (suc n) B Eq = rec λ where .h-levelʳ → Π-closure ext (2 + n) λ _ → ∃-H-level-H-level-1+ ext univ (1 + n) .∣∣ʳ x → rec λ where .h-levelʳ → ∃-H-level-H-level-1+ ext univ (1 + n) .∣∣ʳ y → ∥ x ≡ y ∥[1+ n ] , truncation-has-correct-h-level n Eq-refl : (x : ∥ A ∥[1+ suc n ]) → proj₁ (Eq x x) Eq-refl = elim λ where .∣∣ʳ x → ∣ refl x ∣ .h-levelʳ x → mono₁ (1 + n) $ proj₂ (Eq x x) decode : ∀ x y → proj₁ (Eq x y) → x ≡ y decode = elim λ where .h-levelʳ _ → Π-closure ext (2 + n) λ _ → Π-closure ext (2 + n) λ _ → mono₁ (2 + n) $ truncation-has-correct-h-level (1 + n) .∣∣ʳ x → elim λ where .h-levelʳ _ → Π-closure ext (2 + n) λ _ → mono₁ (2 + n) $ truncation-has-correct-h-level (1 + n) .∣∣ʳ y → rec λ where .h-levelʳ → truncation-has-correct-h-level (1 + n) .∣∣ʳ → cong ∣_∣ encode : ∀ x y → x ≡ y → proj₁ (Eq x y) encode x y x≡y = subst (λ y → proj₁ (Eq x y)) x≡y (Eq-refl x) decode-encode : ∀ x (x≡y : x ≡ y) → decode x y (encode x y x≡y) ≡ x≡y decode-encode = elim λ where .h-levelʳ _ → Π-closure ext (2 + n) λ _ → mono₁ (3 + n) $ mono₁ (2 + n) $ truncation-has-correct-h-level (1 + n) .∣∣ʳ x → elim¹ (λ x≡y → decode _ _ (encode _ _ x≡y) ≡ x≡y) (decode (∣ x ∣) (∣ x ∣) (encode ∣ x ∣ ∣ x ∣ (refl ∣ x ∣)) ≡⟨⟩ decode (∣ x ∣) (∣ x ∣) (subst (λ y → proj₁ (Eq ∣ x ∣ y)) (refl ∣ x ∣) ∣ refl x ∣) ≡⟨ cong (decode _ _) $ subst-refl _ _ ⟩ decode (∣ x ∣) (∣ x ∣) (∣ refl x ∣) ≡⟨⟩ cong ∣_∣ (refl x) ≡⟨ cong-refl _ ⟩∎ refl ∣ x ∣ ∎) encode-decode : ∀ x y (eq : proj₁ (Eq x y)) → encode x y (decode x y eq) ≡ eq encode-decode = elim λ where .h-levelʳ x → Π-closure ext (2 + n) λ y → Π-closure ext (2 + n) λ _ → mono₁ (2 + n) $ mono₁ (1 + n) $ proj₂ (Eq x y) .∣∣ʳ x → elim λ where .h-levelʳ y → Π-closure ext (2 + n) λ _ → mono₁ (2 + n) $ mono₁ (1 + n) $ proj₂ (Eq ∣ x ∣ y) .∣∣ʳ y → elim λ where .h-levelʳ _ → mono₁ (1 + n) $ truncation-has-correct-h-level n .∣∣ʳ eq → encode ∣ x ∣ ∣ y ∣ (decode (∣ x ∣) (∣ y ∣) (∣ eq ∣)) ≡⟨⟩ subst (λ y → proj₁ (Eq ∣ x ∣ y)) (cong ∣_∣ eq) (∣ refl x ∣) ≡⟨ sym $ subst-∘ _ _ _ ⟩ subst (λ y → proj₁ (Eq ∣ x ∣ ∣ y ∣)) eq (∣ refl x ∣) ≡⟨⟩ subst (λ y → ∥ x ≡ y ∥[1+ n ]) eq (∣ refl x ∣) ≡⟨ elim¹ (λ eq → subst (λ y → ∥ x ≡ y ∥[1+ n ]) eq (∣ refl x ∣) ≡ ∣ subst (x ≡_) eq (refl x) ∣) (trans (subst-refl _ _) $ cong ∣_∣ $ sym $ subst-refl _ _) _ ⟩ ∣ subst (x ≡_) eq (refl x) ∣ ≡⟨ cong ∣_∣ $ sym trans-subst ⟩ ∣ trans (refl x) eq ∣ ≡⟨ cong ∣_∣ $ trans-reflˡ _ ⟩∎ ∣ eq ∣ ∎ _ : {A : Type a} {x y : A} {univ : Univalence a} {x≡y : x ≡ y} → _≃_.to (∥≡∥≃∣∣≡∣∣ {n = n} univ) ∣ x≡y ∣ ≡ cong ∣_∣ x≡y _ = refl _ -- The truncation operator commutes with _×_. -- -- This result is similar to Theorem 7.3.8 from the HoTT book. ∥∥×∥∥≃∥×∥ : (∥ A ∥[1+ n ] × ∥ B ∥[1+ n ]) ≃ ∥ A × B ∥[1+ n ] ∥∥×∥∥≃∥×∥ {n = n} = Eq.↔→≃ (uncurry $ rec λ where .h-levelʳ → Π-closure ext _ λ _ → truncation-has-correct-h-level _ .∣∣ʳ x → rec λ where .h-levelʳ → truncation-has-correct-h-level _ .∣∣ʳ y → ∣ x , y ∣) (rec λ where .∣∣ʳ → Σ-map ∣_∣ ∣_∣ .h-levelʳ → s) (elim λ where .∣∣ʳ _ → refl _ .h-levelʳ _ → mono₁ (1 + n) $ truncation-has-correct-h-level n) (uncurry $ elim λ where .h-levelʳ _ → Π-closure ext (1 + n) λ _ → mono₁ (1 + n) s .∣∣ʳ _ → elim λ where .h-levelʳ _ → mono₁ (1 + n) s .∣∣ʳ _ → refl _) where s = ×-closure _ (truncation-has-correct-h-level _) (truncation-has-correct-h-level _) -- Nested truncations where the inner truncation's h-level is at least -- as large as the outer truncation's h-level can be flattened. flatten-≥ : m ≤ n → ∥ ∥ A ∥[1+ n ] ∥[1+ m ] ↔ ∥ A ∥[1+ m ] flatten-≥ m≤n = record { surjection = record { logical-equivalence = record { from = ∥∥-map ∣_∣ ; to = rec λ where .h-levelʳ → truncation-has-correct-h-level _ .∣∣ʳ → rec λ where .∣∣ʳ → ∣_∣ .h-levelʳ → mono (Nat.suc≤suc m≤n) (truncation-has-correct-h-level _) } ; right-inverse-of = uniqueness (truncation-has-correct-h-level _) (λ x → ∣ x ∣ ∎) } ; left-inverse-of = uniqueness (truncation-has-correct-h-level _) (uniqueness (mono (Nat.suc≤suc m≤n) (truncation-has-correct-h-level _)) (λ x → ∣ ∣ x ∣ ∣ ∎)) } -- The remainder of this module is not based on the HoTT book. -- Nested truncations where the inner truncation's h-level is at most -- as large as the outer truncation's h-level can be flattened. flatten-≤ : m ≤ n → ∥ ∥ A ∥[1+ m ] ∥[1+ n ] ↔ ∥ A ∥[1+ m ] flatten-≤ m≤n = record { surjection = record { logical-equivalence = record { from = ∣_∣ ; to = rec λ where .∣∣ʳ → id .h-levelʳ → mono (Nat.suc≤suc m≤n) (truncation-has-correct-h-level _) } ; right-inverse-of = refl } ; left-inverse-of = uniqueness (truncation-has-correct-h-level _) (λ x → ∣ x ∣ ∎) } -- Nested truncations can be flattened. flatten : ∥ ∥ A ∥[1+ m ] ∥[1+ n ] ↔ ∥ A ∥[1+ min m n ] flatten {A = A} {m = m} {n = n} = case Nat.total m n of λ where (inj₁ m≤n) → ∥ ∥ A ∥[1+ m ] ∥[1+ n ] ↝⟨ flatten-≤ m≤n ⟩ ∥ A ∥[1+ m ] ↝⟨ ≡⇒↝ _ $ cong ∥ A ∥[1+_] $ sym $ _⇔_.to Nat.≤⇔min≡ m≤n ⟩□ ∥ A ∥[1+ min m n ] □ (inj₂ m≥n) → ∥ ∥ A ∥[1+ m ] ∥[1+ n ] ↝⟨ flatten-≥ m≥n ⟩ ∥ A ∥[1+ n ] ↝⟨ ≡⇒↝ _ $ cong ∥ A ∥[1+_] $ sym $ _⇔_.to Nat.≤⇔min≡ m≥n ⟩ ∥ A ∥[1+ min n m ] ↝⟨ ≡⇒↝ _ $ cong ∥ A ∥[1+_] $ Nat.min-comm _ _ ⟩□ ∥ A ∥[1+ min m n ] □ -- The propositional truncation operator ∥_∥ is pointwise isomorphic -- to ∥_∥[1+ 0 ]. ∥∥↔∥∥ : ∥ A ∥ ↔ ∥ A ∥[1+ 0 ] ∥∥↔∥∥ = record { surjection = record { logical-equivalence = record { to = TP.rec (truncation-has-correct-h-level 0) ∣_∣ ; from = rec λ where .∣∣ʳ → TP.∣_∣ .h-levelʳ → TP.truncation-is-proposition } ; right-inverse-of = λ _ → truncation-has-correct-h-level 0 _ _ } ; left-inverse-of = λ _ → TP.truncation-is-proposition _ _ } -- A universe-polymorphic variant of bind. infixl 5 _>>=′_ _>>=′_ : ∥ A ∥[1+ n ] → (A → ∥ B ∥[1+ n ]) → ∥ B ∥[1+ n ] _>>=′_ {A = A} {n = n} {B = B} = curry ( ∥ A ∥[1+ n ] × (A → ∥ B ∥[1+ n ]) ↝⟨ uncurry (flip ∥∥-map) ⟩ ∥ ∥ B ∥[1+ n ] ∥[1+ n ] ↔⟨ flatten-≤ Nat.≤-refl ⟩□ ∥ B ∥[1+ n ] □) -- ∥_∥[1+ n ] is a monad. instance monad : Monad {c = ℓ} (∥_∥[1+ n ]) Raw-monad.return (Monad.raw-monad monad) = ∣_∣ Raw-monad._>>=_ (Monad.raw-monad monad) = _>>=′_ Monad.left-identity monad = λ _ _ → refl _ Monad.right-identity monad = uniqueness (truncation-has-correct-h-level _) (λ _ → refl _) Monad.associativity monad = flip λ f → flip λ g → uniqueness (truncation-has-correct-h-level _) (λ x → f x >>=′ g ∎) -- The truncation operator preserves logical equivalences. ∥∥-cong-⇔ : A ⇔ B → ∥ A ∥[1+ n ] ⇔ ∥ B ∥[1+ n ] ∥∥-cong-⇔ A⇔B = record { to = ∥∥-map (_⇔_.to A⇔B) ; from = ∥∥-map (_⇔_.from A⇔B) } -- The truncation operator preserves bijections. ∥∥-cong : A ↔[ k ] B → ∥ A ∥[1+ n ] ↔[ k ] ∥ B ∥[1+ n ] ∥∥-cong {n = n} A↝B = from-bijection (record { surjection = record { logical-equivalence = record { to = ∥∥-map (_↔_.to A↔B) ; from = ∥∥-map (_↔_.from A↔B) } ; right-inverse-of = lemma A↔B } ; left-inverse-of = lemma (inverse A↔B) }) where A↔B = from-isomorphism A↝B lemma : (A↔B : A ↔ B) (x : ∥ B ∥[1+ n ]) → ∥∥-map (_↔_.to A↔B) (∥∥-map (_↔_.from A↔B) x) ≡ x lemma A↔B x = ∥∥-map (_↔_.to A↔B) (∥∥-map (_↔_.from A↔B) x) ≡⟨ sym $ ∥∥-map-∘ x ⟩ ∥∥-map (_↔_.to A↔B ∘ _↔_.from A↔B) x ≡⟨ cong (λ f → ∥∥-map f x) $ ⟨ext⟩ $ _↔_.right-inverse-of A↔B ⟩ ∥∥-map id x ≡⟨ ∥∥-map-id x ⟩∎ x ∎ -- ∥ A ∥[1+_] is downwards closed. downwards-closed : m ≤ n → ∥ A ∥[1+ n ] → ∥ A ∥[1+ m ] downwards-closed {m = m} {n = n} {A = A} m≤n = ∥ A ∥[1+ n ] ↝⟨ ∥∥-map ∣_∣ ⟩ ∥ ∥ A ∥[1+ m ] ∥[1+ n ] ↔⟨ flatten-≤ m≤n ⟩□ ∥ A ∥[1+ m ] □
exampl04/butntest/butntest.asm
AlexRogalskiy/Masm
0
244264
; ######################################################################### ; ; DEMO Custom colour button ; ; Characteristics : Button with seperate UP and DOWN colours as started. ; Adjustments : Dynamic colour change, both TEXT and BUTTON colours. ; Dynamic alignment control. Default font at startup is SYSTEM and ; can be changed dynamically by providing a valid font handle. Text ; can also be changed dynamically. ; The control uses a WM_COMMAND interface to perform most of the ajustments. ; invoke SendMessage,hButn,WM_COMMAND,0,000000DDh ; button up colour ; invoke SendMessage,hButn,WM_COMMAND,1,00000099h ; button down colour ; invoke SendMessage,hButn,WM_COMMAND,2,00000000h ; text up colour ; invoke SendMessage,hButn,WM_COMMAND,3,00FFFFFFh ; text down colour ; -------------------------------------------------- ; text alignment, left = 1, centre = 2 right = 3 ; -------------------------------------------------- ; invoke SendMessage,hButn,WM_COMMAND,4,2 ; align button text ; Either, ; invoke SetWindowText,hButn,ADDR YourText ; or ; invoke SendMessage,hButn,WM_SETTEXT,0,ADDR YourText ; ; can be used to change the text dynamically. ; The font is changed using a WM_SETFONT message. ; invoke SendMessage,hButn,WM_SETFONT,hFont,0 ; set the font ; NOTE : When you create a font for the control, it must be removed when ; it is no longer used to prevent a resource memory leak. ; It can be created by the procedure provided or a direct call to ; CreateFont API. The font handle must have GLOBAL scope by putting it ; in the .DATA section. ; To destroy the font after it is no longer needed, use the DeleteObject ; API function and test the return value to make sure the resource is ; released. ; ######################################################################### .486 ; create 32 bit code .model flat, stdcall ; 32 bit memory model option casemap :none ; case sensitive include butntest.inc ; local includes for this file ; ---------------------------------------------------- ; use the library with the font and button procedures ; ---------------------------------------------------- include btest.inc includelib btest.lib .code ; ######################################################################### start: invoke InitCommonControls ; ------------------ ; set global values ; ------------------ invoke GetModuleHandle, NULL mov hInstance, eax invoke GetCommandLine mov CommandLine, eax invoke LoadIcon,hInstance,500 ; icon ID mov hIcon, eax invoke LoadCursor,NULL,IDC_ARROW mov hCursor, eax invoke GetSystemMetrics,SM_CXSCREEN mov sWid, eax invoke GetSystemMetrics,SM_CYSCREEN mov sHgt, eax invoke MakeFont,18,8,700,FALSE,SADD("times new roman") mov RomanFont, eax ; <<<<<< DELETE this font on EXIT call Main invoke DeleteObject,RomanFont ; delete the font invoke ExitProcess,eax ; ######################################################################### Main proc LOCAL Wwd:DWORD,Wht:DWORD,Wtx:DWORD,Wty:DWORD STRING szClassName,"Prostart_Class" ; -------------------------------------------- ; register class name for CreateWindowEx call ; -------------------------------------------- invoke RegisterWinClass,ADDR WndProc,ADDR szClassName, hIcon,hCursor,COLOR_BTNFACE+1 ; ------------------------------------------------- ; macro to autoscale window co-ordinates to screen ; percentages and centre window at those sizes. ; ------------------------------------------------- AutoScale 75, 70 invoke CreateWindowEx,WS_EX_LEFT, ADDR szClassName, ADDR szDisplayName, WS_OVERLAPPEDWINDOW, Wtx,Wty,Wwd,Wht, NULL,NULL, hInstance,NULL mov hWnd,eax ; --------------------------- ; macros for unchanging code ; --------------------------- DisplayWindow hWnd,SW_SHOWNORMAL call MsgLoop ret Main endp ; ######################################################################### RegisterWinClass proc lpWndProc:DWORD, lpClassName:DWORD, Icon:DWORD, Cursor:DWORD, bColor:DWORD LOCAL wc:WNDCLASSEX mov wc.cbSize, sizeof WNDCLASSEX mov wc.style, CS_BYTEALIGNCLIENT or \ CS_BYTEALIGNWINDOW m2m wc.lpfnWndProc, lpWndProc mov wc.cbClsExtra, NULL mov wc.cbWndExtra, NULL m2m wc.hInstance, hInstance invoke CreateSolidBrush,00000044h mov wc.hbrBackground, eax mov wc.lpszMenuName, NULL m2m wc.lpszClassName, lpClassName m2m wc.hIcon, Icon m2m wc.hCursor, Cursor m2m wc.hIconSm, Icon invoke RegisterClassEx, ADDR wc ret RegisterWinClass endp ; ######################################################################## MsgLoop proc ; ------------------------------------------ ; The following 4 equates are available for ; processing messages directly in the loop. ; m_hWnd - m_Msg - m_wParam - m_lParam ; ------------------------------------------ LOCAL msg:MSG StartLoop: invoke GetMessage,ADDR msg,NULL,0,0 cmp eax, 0 je ExitLoop invoke TranslateMessage, ADDR msg invoke DispatchMessage, ADDR msg jmp StartLoop ExitLoop: mov eax, msg.wParam ret MsgLoop endp ; ######################################################################### WndProc proc hWin :DWORD, uMsg :DWORD, wParam :DWORD, lParam :DWORD LOCAL var :DWORD LOCAL caW :DWORD LOCAL caH :DWORD LOCAL Rct :RECT LOCAL buffer1[128]:BYTE ; these are two spare buffers LOCAL buffer2[128]:BYTE ; for text manipulation etc.. .if uMsg == WM_COMMAND ;======== toolbar commands ======== .if wParam == 550 invoke SetWindowText,hWin,SADD("Button One") invoke SendMessage,hButn1,WM_COMMAND,4,1 invoke SendMessage,hButn2,WM_COMMAND,4,1 invoke SendMessage,hButn3,WM_COMMAND,4,1 invoke SendMessage,hButn1,WM_COMMAND,0,0000DD00h ; up colour invoke SendMessage,hButn1,WM_COMMAND,1,00009900h ; down colour invoke SendMessage,hButn1,WM_COMMAND,2,00000000h ; up text colour invoke SendMessage,hButn1,WM_COMMAND,3,00FFFFFFh ; down text colour .elseif wParam == 551 invoke SetWindowText,hWin,SADD("Button Two") invoke SendMessage,hButn1,WM_COMMAND,4,2 invoke SendMessage,hButn2,WM_COMMAND,4,2 invoke SendMessage,hButn3,WM_COMMAND,4,2 invoke SendMessage,hButn1,WM_COMMAND,0,000000DDh ; up colour invoke SendMessage,hButn1,WM_COMMAND,1,00000099h ; down colour invoke SendMessage,hButn1,WM_COMMAND,2,00000000h ; up text colour invoke SendMessage,hButn1,WM_COMMAND,3,00FFFFFFh ; down text colour .elseif wParam == 552 invoke SetWindowText,hWin,SADD("Button Three") invoke SendMessage,hButn1,WM_COMMAND,4,3 invoke SendMessage,hButn2,WM_COMMAND,4,3 invoke SendMessage,hButn3,WM_COMMAND,4,3 .endif .elseif uMsg == WM_CREATE invoke Do_Status,hWin invoke colrbutn,hWin,hInstance,SADD(" Button 1 "), 000000FFh,000000AAh, 50,50,150,25,2,550 mov hButn1, eax invoke SendMessage,hButn1,WM_SETFONT,RomanFont,0 invoke colrbutn,hWin,hInstance,SADD(" Button 2 "), 00FFFFFFh,00AAAAAAh, 50,80,150,25,2,551 mov hButn2, eax invoke SendMessage,hButn2,WM_SETFONT,RomanFont,0 invoke colrbutn,hWin,hInstance,SADD(" Button 3 "), 00FF0000h,00AA0000h, 50,110,150,25,2,552 mov hButn3, eax invoke SendMessage,hButn3,WM_SETFONT,RomanFont,0 .elseif uMsg == WM_SYSCOLORCHANGE .elseif uMsg == WM_SIZE invoke MoveWindow,hStatus,0,0,0,0,TRUE .elseif uMsg == WM_PAINT invoke Paint_Proc,hWin return 0 .elseif uMsg == WM_CLOSE .elseif uMsg == WM_DESTROY invoke PostQuitMessage,NULL return 0 .endif invoke DefWindowProc,hWin,uMsg,wParam,lParam ret WndProc endp ; ######################################################################## TopXY proc wDim:DWORD, sDim:DWORD shr sDim, 1 ; divide screen dimension by 2 shr wDim, 1 ; divide window dimension by 2 mov eax, wDim ; copy window dimension into eax sub sDim, eax ; sub half win dimension from half screen dimension return sDim TopXY endp ; ######################################################################### Paint_Proc proc hWin:DWORD LOCAL hDC :DWORD LOCAL btn_hi :DWORD LOCAL btn_lo :DWORD LOCAL Font :DWORD LOCAL hOld :DWORD LOCAL Rct :RECT LOCAL Ps :PAINTSTRUCT invoke BeginPaint,hWin,ADDR Ps mov hDC, eax ; ---------------------------------------- invoke GetClientRect,hWin,ADDR Rct mov Rct.left, 20 mov Rct.top, 10 mov Rct.right, 550 mov Rct.bottom, 30 invoke MakeFont,24,12,700,FALSE,SADD("times new roman") mov Font, eax ; <<<<<< DELETE this font on EXIT invoke SelectObject,hDC,Font mov hOld, eax invoke SetBkMode,hDC,TRANSPARENT invoke SetTextColor,hDC,00888888h ; shadow invoke DrawText,hDC,SADD("Technicolor Custom Button Example"), -1,ADDR Rct,DT_CENTER or DT_VCENTER or DT_SINGLELINE sub Rct.left,2 sub Rct.top,2 sub Rct.right,2 sub Rct.bottom,2 invoke SetTextColor,hDC,000000FFh ; red invoke DrawText,hDC,SADD("Technicolor Custom Button Example"), -1,ADDR Rct,DT_CENTER or DT_VCENTER or DT_SINGLELINE invoke SelectObject,hDC,hOld invoke DeleteObject,Font ; delete the font ; ---------------------------------------- invoke EndPaint,hWin,ADDR Ps ret Paint_Proc endp ; ######################################################################## end start
programs/oeis/086/A086435.asm
karttu/loda
1
87360
; A086435: Maximum number of parts possible in a factorization of n into a product of distinct numbers > 1. ; 0,1,1,1,1,2,1,2,1,2,1,2,1,2,2,2,1,2,1,2,2,2,1,3,1,2,2,2,1,3,1,2,2,2,2,3,1,2,2,3,1,3,1,2,2,2,1,3,1,2,2,2,1,3,2,3,2,2,1,3,1,2,2,3,2,3,1,2,2,3,1,3,1,2,2,2,2,3,1,3,2,2,1,3,2,2,2,3,1,3,2,2,2,2,2,3,1,2,2,3,1,3,1,3,3,2,1,3,1,3,2,3,1,3,2,2,2,2,2,4,1,2,2,2,2,3,1,3,2,3,1,3,2,2,3,3,1,3,1,3,2,2,2,4,2,2,2,2,1,3,1,3,2,3,2,3,1,2,2,3,2,3,1,2,3,2,1,4,1,3,2,2,1,3,2,3,2,2,1,4,1,3,2,3,2,3,2,2,3,3,1,4,1,2,3,3,1,3,1,3,2,2,2,3,2,2,2,3,2,4,1,2,2,2,2,4,2,2,2,3,2,3,1,3,3,2,1,3,1,3,3,3,1,3,2,2,2,3,1,4,1,2,2,2,2,3,2,3,2,3 mov $1,5 cal $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. mul $1,$0 log $1,2 sub $1,2
source/web/spikedog/aws/matreshka-servlet_aws_responses.adb
reznikmm/matreshka
24
5744
<reponame>reznikmm/matreshka ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014-2019, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Strings.Unbounded; with AWS.Containers.Tables; with AWS.Cookie; with AWS.Headers; with AWS.Messages; with AWS.Response.Set; with Matreshka.RFC2616_Dates; package body Matreshka.Servlet_AWS_Responses is To_AWS_Status_Code : constant array (Servlet.HTTP_Responses.Status_Code) of AWS.Messages.Status_Code := (Servlet.HTTP_Responses.Continue => AWS.Messages.S100, Servlet.HTTP_Responses.Switching_Protocols => AWS.Messages.S101, Servlet.HTTP_Responses.OK => AWS.Messages.S200, Servlet.HTTP_Responses.Created => AWS.Messages.S201, Servlet.HTTP_Responses.Accepted => AWS.Messages.S202, Servlet.HTTP_Responses.Non_Authoritative_Information => AWS.Messages.S203, Servlet.HTTP_Responses.No_Content => AWS.Messages.S204, Servlet.HTTP_Responses.Reset_Content => AWS.Messages.S205, Servlet.HTTP_Responses.Partial_Content => AWS.Messages.S206, Servlet.HTTP_Responses.Multiple_Choices => AWS.Messages.S300, Servlet.HTTP_Responses.Moved_Permanently => AWS.Messages.S301, Servlet.HTTP_Responses.Moved_Temporarily => AWS.Messages.S302, Servlet.HTTP_Responses.Found => AWS.Messages.S302, Servlet.HTTP_Responses.See_Other => AWS.Messages.S303, Servlet.HTTP_Responses.Not_Modified => AWS.Messages.S304, Servlet.HTTP_Responses.Use_Proxy => AWS.Messages.S305, Servlet.HTTP_Responses.Temporary_Redirect => AWS.Messages.S307, Servlet.HTTP_Responses.Bad_Request => AWS.Messages.S400, Servlet.HTTP_Responses.Unauthorized => AWS.Messages.S401, Servlet.HTTP_Responses.Payment_Required => AWS.Messages.S402, Servlet.HTTP_Responses.Forbidden => AWS.Messages.S403, Servlet.HTTP_Responses.Not_Found => AWS.Messages.S404, Servlet.HTTP_Responses.Method_Not_Allowed => AWS.Messages.S405, Servlet.HTTP_Responses.Not_Acceptable => AWS.Messages.S406, Servlet.HTTP_Responses.Proxy_Authentication_Required => AWS.Messages.S407, Servlet.HTTP_Responses.Request_Timeout => AWS.Messages.S408, Servlet.HTTP_Responses.Conflict => AWS.Messages.S409, Servlet.HTTP_Responses.Gone => AWS.Messages.S410, Servlet.HTTP_Responses.Length_Required => AWS.Messages.S411, Servlet.HTTP_Responses.Precondition_Failed => AWS.Messages.S412, Servlet.HTTP_Responses.Request_Entity_Too_Large => AWS.Messages.S413, Servlet.HTTP_Responses.Request_URI_Too_Long => AWS.Messages.S414, Servlet.HTTP_Responses.Unsupported_Media_Type => AWS.Messages.S415, Servlet.HTTP_Responses.Requested_Range_Not_Satisfiable => AWS.Messages.S416, Servlet.HTTP_Responses.Expectation_Failed => AWS.Messages.S417, Servlet.HTTP_Responses.Internal_Server_Error => AWS.Messages.S500, Servlet.HTTP_Responses.Not_Implemented => AWS.Messages.S501, Servlet.HTTP_Responses.Bad_Gateway => AWS.Messages.S502, Servlet.HTTP_Responses.Service_Unavailable => AWS.Messages.S503, Servlet.HTTP_Responses.Gateway_Timeout => AWS.Messages.S504, Servlet.HTTP_Responses.HTTP_Version_Not_Supported => AWS.Messages.S505); Format : Matreshka.RFC2616_Dates.Format; ---------------- -- Add_Cookie -- ---------------- overriding procedure Add_Cookie (Self : in out AWS_Servlet_Response; Cookie : Servlet.HTTP_Cookies.Cookie) is Path : constant League.Strings.Universal_String := Cookie.Get_Path; AWS_Path : constant League.Strings.Universal_String := (if Path.Is_Empty then League.Strings.To_Universal_String ("/") else Path); -- AWS sends Path attributes always, so set its value to root. begin AWS.Cookie.Set (Content => Self.Data, Key => Cookie.Get_Name.To_UTF_8_String, Value => Cookie.Get_Value.To_UTF_8_String, Comment => Cookie.Get_Comment.To_UTF_8_String, Domain => Cookie.Get_Domain.To_UTF_8_String, -- XXX Must be encoded when containts non-ASCII characters. Max_Age => AWS.Cookie.No_Max_Age, -- XXX Not supported yet. Path => AWS_Path.To_UTF_8_String, Secure => Cookie.Get_Secure); end Add_Cookie; --------------------- -- Add_Date_Header -- --------------------- overriding procedure Add_Date_Header (Self : in out AWS_Servlet_Response; Name : League.Strings.Universal_String; Value : League.Calendars.Date_Time) is Image : constant League.Strings.Universal_String := Matreshka.RFC2616_Dates.To_String (Format, Value); begin AWS.Response.Set.Add_Header (Self.Data, Name.To_UTF_8_String, Image.To_UTF_8_String); end Add_Date_Header; ---------------- -- Add_Header -- ---------------- overriding procedure Add_Header (Self : in out AWS_Servlet_Response; Name : League.Strings.Universal_String; Value : League.Strings.Universal_String) is begin AWS.Response.Set.Add_Header (Self.Data, Name.To_UTF_8_String, Value.To_UTF_8_String); end Add_Header; ------------------------ -- Add_Integer_Header -- ------------------------ overriding procedure Add_Integer_Header (Self : in out AWS_Servlet_Response; Name : League.Strings.Universal_String; Value : League.Holders.Universal_Integer) is begin raise Program_Error; -- XXX Not implemented. end Add_Integer_Header; ----------- -- Build -- ----------- function Build (Self : in out AWS_Servlet_Response'Class) return AWS.Response.Data is begin Self.Set_Session_Cookie; return Self.Data; end Build; --------------------- -- Contains_Header -- --------------------- overriding function Contains_Header (Self : in out AWS_Servlet_Response; Name : League.Strings.Universal_String) return Boolean is List : constant AWS.Headers.List := AWS.Response.Header (Self.Data); begin return List.Exist (Name.To_UTF_8_String); end Contains_Header; ---------------------- -- Get_Header_Names -- ---------------------- overriding function Get_Header_Names (Self : in out AWS_Servlet_Response) return League.String_Vectors.Universal_String_Vector is List : constant AWS.Headers.List := AWS.Response.Header (Self.Data); Names : constant AWS.Containers.Tables.VString_Array := List.Get_Names; Result : League.String_Vectors.Universal_String_Vector; begin for J in Names'Range loop Result.Append (League.Strings.From_UTF_8_String (Ada.Strings.Unbounded.To_String (Names (J)))); end loop; return Result; end Get_Header_Names; ----------------- -- Get_Headers -- ----------------- overriding function Get_Headers (Self : in out AWS_Servlet_Response; Name : League.Strings.Universal_String) return League.String_Vectors.Universal_String_Vector is List : constant AWS.Headers.List := AWS.Response.Header (Self.Data); Values : constant AWS.Containers.Tables.VString_Array := List.Get_Values (Name.To_UTF_8_String); Result : League.String_Vectors.Universal_String_Vector; begin for J in Values'Range loop Result.Append (League.Strings.From_UTF_8_String (Ada.Strings.Unbounded.To_String (Values (J)))); end loop; return Result; end Get_Headers; ----------------------- -- Get_Output_Stream -- ----------------------- overriding function Get_Output_Stream (Self : AWS_Servlet_Response) return not null access Servlet.Output_Streams.Servlet_Output_Stream'Class is begin if AWS_Servlet_Response (Self.Output.all).Codec = null and not Self.Encoding.Is_Empty then AWS_Servlet_Response (Self.Output.all).Codec := new League.Text_Codecs.Text_Codec' (League.Text_Codecs.Codec (Self.Encoding)); end if; return Self.Output; end Get_Output_Stream; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out AWS_Servlet_Response'Class; Request : not null Matreshka.Servlet_HTTP_Requests.HTTP_Servlet_Request_Access) is begin Matreshka.Servlet_HTTP_Responses.Initialize (Self, Request); Self.Stream := new AWS.Resources.Streams.Memory.Stream_Type; AWS.Response.Set.Stream (Self.Data, Self.Stream); -- Memory will be released by AWS. Self.Output := Self'Unchecked_Access; end Initialize; -------------- -- Is_Ready -- -------------- overriding function Is_Ready (Self : AWS_Servlet_Response) return Boolean is begin -- Asynchronous mode is not supported by AWS. return False; end Is_Ready; ---------------- -- Send_Error -- ---------------- overriding procedure Send_Error (Self : in out AWS_Servlet_Response; Code : Servlet.HTTP_Responses.Status_Code; Message : League.Strings.Universal_String) is begin AWS.Response.Set.Status_Code (Self.Data, To_AWS_Status_Code (Code)); end Send_Error; ------------------- -- Send_Redirect -- ------------------- overriding procedure Send_Redirect (Self : in out AWS_Servlet_Response; Location : League.IRIs.IRI) is begin AWS.Response.Set.Status_Code (Self.Data, AWS.Messages.S302); AWS.Response.Set.Location (Self.Data, Location.To_Universal_String.To_UTF_8_String); AWS.Response.Set.Mode (Self.Data, AWS.Response.Header); end Send_Redirect; ---------------------------- -- Set_Character_Encoding -- ---------------------------- overriding procedure Set_Character_Encoding (Self : in out AWS_Servlet_Response; Encoding : League.Strings.Universal_String) is begin Self.Encoding := Encoding; if Self.Encoding.Is_Empty then AWS.Response.Set.Content_Type (Self.Data, Self.Content_Type.To_UTF_8_String); else AWS.Response.Set.Content_Type (Self.Data, Self.Content_Type.To_UTF_8_String & ";charset=" & Self.Encoding.To_UTF_8_String); end if; end Set_Character_Encoding; ---------------------- -- Set_Content_Type -- ---------------------- overriding procedure Set_Content_Type (Self : in out AWS_Servlet_Response; To : League.Strings.Universal_String) is begin -- XXX Encoding must be extracted from passed content type and set. Self.Content_Type := To; if Self.Encoding.Is_Empty then AWS.Response.Set.Content_Type (Self.Data, Self.Content_Type.To_UTF_8_String); else AWS.Response.Set.Content_Type (Self.Data, Self.Content_Type.To_UTF_8_String & ";charset=" & Self.Encoding.To_UTF_8_String); end if; end Set_Content_Type; --------------------- -- Set_Date_Header -- --------------------- overriding procedure Set_Date_Header (Self : in out AWS_Servlet_Response; Name : League.Strings.Universal_String; Value : League.Calendars.Date_Time) is Image : constant League.Strings.Universal_String := Matreshka.RFC2616_Dates.To_String (Format, Value); begin AWS.Response.Set.Update_Header (Self.Data, Name.To_UTF_8_String, Image.To_UTF_8_String); end Set_Date_Header; ---------------- -- Set_Header -- ---------------- overriding procedure Set_Header (Self : in out AWS_Servlet_Response; Name : League.Strings.Universal_String; Value : League.Strings.Universal_String) is begin AWS.Response.Set.Update_Header (Self.Data, Name.To_UTF_8_String, Value.To_UTF_8_String); end Set_Header; ------------------------ -- Set_Integer_Header -- ------------------------ overriding procedure Set_Integer_Header (Self : in out AWS_Servlet_Response; Name : League.Strings.Universal_String; Value : League.Holders.Universal_Integer) is begin raise Program_Error; -- XXX Not implemented. end Set_Integer_Header; ---------------- -- Set_Status -- ---------------- overriding procedure Set_Status (Self : in out AWS_Servlet_Response; Status : Servlet.HTTP_Responses.Status_Code) is begin Matreshka.Servlet_HTTP_Responses.Abstract_HTTP_Servlet_Response (Self).Set_Status (Status); AWS.Response.Set.Status_Code (Self.Data, To_AWS_Status_Code (Status)); end Set_Status; ------------------------ -- Set_Write_Listener -- ------------------------ overriding procedure Set_Write_Listener (Self : in out AWS_Servlet_Response; Listener : not null access Servlet.Write_Listeners.Write_Listener'Class) is begin null; end Set_Write_Listener; ----------- -- Write -- ----------- overriding procedure Write (Self : in out AWS_Servlet_Response; Item : Ada.Streams.Stream_Element_Array) is begin Self.Stream.Append (Item); end Write; ----------- -- Write -- ----------- overriding procedure Write (Self : in out AWS_Servlet_Response; Item : League.Strings.Universal_String) is begin Self.Stream.Append (Self.Codec.Encode (Item).To_Stream_Element_Array); end Write; end Matreshka.Servlet_AWS_Responses;
programs/oeis/212/A212704.asm
neoneye/loda
22
172914
; A212704: a(n) = 9*n*10^(n-1). ; 9,180,2700,36000,450000,5400000,63000000,720000000,8100000000,90000000000,990000000000,10800000000000,117000000000000,1260000000000000,13500000000000000,144000000000000000,1530000000000000000,16200000000000000000,171000000000000000000,1800000000000000000000,18900000000000000000000,198000000000000000000000,2070000000000000000000000,21600000000000000000000000,225000000000000000000000000,2340000000000000000000000000,24300000000000000000000000000,252000000000000000000000000000,2610000000000000000000000000000,27000000000000000000000000000000,279000000000000000000000000000000,2880000000000000000000000000000000,29700000000000000000000000000000000,306000000000000000000000000000000000 mov $1,$0 add $0,1 mov $2,10 pow $2,$1 mul $0,$2 mul $0,9
archive/agda-3/src/Test/SurjidentityP.agda
m0davis/oscar
0
12453
<reponame>m0davis/oscar open import Everything module Test.SurjidentityP where module _ {𝔬₁} {𝔒₁ : Ø 𝔬₁} {𝔯₁} (_∼₁_ : 𝔒₁ → 𝔒₁ → Ø 𝔯₁) {𝔬₂} {𝔒₂ : Ø 𝔬₂} {𝔯₂} (_∼₂_ : 𝔒₂ → 𝔒₂ → Ø 𝔯₂) (_∼₂2_ : 𝔒₂ → 𝔒₂ → Ø 𝔯₂) {𝔯₂'} (_∼₂'_ : 𝔒₂ → 𝔒₂ → Ø 𝔯₂') {ℓ₂} (_∼̇₂_ : ∀ {x y} → x ∼₂ y → x ∼₂ y → Ø ℓ₂) (_∼̇₂'_ : ∀ {x y} → x ∼₂' y → x ∼₂' y → Ø ℓ₂) (_∼̇₂2_ : ∀ {x y} → x ∼₂2 y → x ∼₂2 y → Ø ℓ₂) ⦃ _ : Surjection.class 𝔒₁ 𝔒₂ ⦄ ⦃ _ : Smap!.class _∼₁_ _∼₂_ ⦄ ⦃ _ : Smap!.class _∼₁_ _∼₂'_ ⦄ ⦃ _ : Smap!.class _∼₁_ _∼₂2_ ⦄ ⦃ _ : Reflexivity.class _∼₁_ ⦄ ⦃ _ : Reflexivity.class _∼₂_ ⦄ ⦃ _ : Reflexivity.class _∼₂'_ ⦄ ⦃ _ : Reflexivity.class _∼₂2_ ⦄ ⦃ _ : Surjidentity!.class _∼₁_ _∼₂_ _∼̇₂_ ⦄ ⦃ _ : Surjidentity!.class _∼₁_ _∼₂'_ _∼̇₂'_ ⦄ ⦃ _ : Surjidentity!.class _∼₁_ _∼₂2_ _∼̇₂2_ ⦄ where test-surj : Surjidentity!.type _∼₁_ _∼₂_ _∼̇₂_ test-surj = surjidentity test-surj[] : Surjidentity!.type _∼₁_ _∼₂_ _∼̇₂_ test-surj[] = surjidentity[ _∼₁_ , _∼̇₂_ ]
src/Data/List/Properties/Pointwise.agda
metaborg/mj.agda
10
3122
module Data.List.Properties.Pointwise where open import Data.Nat open import Data.List open import Relation.Binary.List.Pointwise hiding (refl; map) open import Relation.Binary.PropositionalEquality pointwise-∷ʳ : ∀ {a b ℓ A B P l m x y} → Rel {a} {b} {ℓ} {A} {B} P l m → P x y → Rel {a} {b} {ℓ} {A} {B} P (l ∷ʳ x) (m ∷ʳ y) pointwise-∷ʳ [] q = q ∷ [] pointwise-∷ʳ (x∼y ∷ p) q = x∼y ∷ (pointwise-∷ʳ p q) {-} pointwise-[]≔ : ∀ {a b ℓ A B P l m i x y} → Rel {a} {b} {ℓ} {A} {B} P l m → (p : l [ i ]= x) → P x y → Rel {a} {b} {ℓ} {A} {B} P l (m [ fromℕ ([]=-length l p) ]≔ y) pointwise-[]≔ r p q z = ? postulate pointwise-[]≔ [] () r pointwise-[]≔ (x∼y ∷ r) here (s≤s z≤n) z = z ∷ r pointwise-[]≔ (x∼y ∷ r) (there p) (s≤s q) z = subst (λ x → Rel _ _ x) {!!} (x∼y ∷ pointwise-[]≔ r p q z) -} pointwise-length : ∀ {a b ℓ A B P l m} → Rel {a} {b} {ℓ} {A} {B} P l m → length l ≡ length m pointwise-length [] = refl pointwise-length (x∼y ∷ p) = cong suc (pointwise-length p)
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_513.asm
ljhsiun2/medusa
9
244443
<filename>Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_513.asm .global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r9 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0xf14a, %rax nop nop sub %r12, %r12 mov $0x6162636465666768, %rsi movq %rsi, %xmm7 movups %xmm7, (%rax) nop nop nop cmp $64861, %r14 lea addresses_A_ht+0xf486, %r12 sub %rdi, %rdi and $0xffffffffffffffc0, %r12 vmovaps (%r12), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $0, %xmm6, %rdx nop add $37598, %r14 lea addresses_A_ht+0x148f6, %rsi lea addresses_UC_ht+0x598e, %rdi nop nop sub %r9, %r9 mov $62, %rcx rep movsq nop nop nop nop xor $43948, %r12 lea addresses_normal_ht+0x119ea, %r9 cmp $46955, %rdi movb $0x61, (%r9) nop nop dec %r12 lea addresses_WC_ht+0x98e, %rdx nop nop nop nop sub %r9, %r9 movl $0x61626364, (%rdx) nop nop nop nop nop xor %rdx, %rdx lea addresses_WT_ht+0x1ce31, %rax nop nop sub %rsi, %rsi movb $0x61, (%rax) cmp %rdx, %rdx lea addresses_normal_ht+0x558e, %rcx nop inc %rsi vmovups (%rcx), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $0, %xmm2, %rdi nop nop nop nop nop sub %rdx, %rdx lea addresses_WC_ht+0x98e, %rcx nop nop nop nop add $22564, %rdi mov $0x6162636465666768, %rax movq %rax, %xmm3 movups %xmm3, (%rcx) nop sub %r12, %r12 lea addresses_WC_ht+0x1cd8e, %rsi lea addresses_WC_ht+0xc98e, %rdi nop nop inc %r12 mov $65, %rcx rep movsl xor $58582, %rax lea addresses_D_ht+0x3d8e, %rdx nop mfence mov $0x6162636465666768, %r14 movq %r14, (%rdx) nop nop xor %rdi, %rdi lea addresses_WC_ht+0x198e, %r12 nop nop nop nop xor %r14, %r14 mov (%r12), %rsi cmp $48515, %rcx lea addresses_D_ht+0x1778e, %rdx nop lfence mov (%rdx), %di nop nop nop cmp %r12, %r12 lea addresses_WC_ht+0x9f0e, %r12 clflush (%r12) nop nop nop add %rsi, %rsi movw $0x6162, (%r12) xor %r12, %r12 lea addresses_A_ht+0xc58e, %rsi lea addresses_WT_ht+0x1a43, %rdi inc %r12 mov $62, %rcx rep movsw nop and %r14, %r14 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r9 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r9 push %rax push %rbx push %rcx push %rdi // Store lea addresses_PSE+0x98e, %rax cmp $49347, %rcx movw $0x5152, (%rax) // Exception!!! nop nop mov (0), %rax nop nop nop nop dec %r12 // Faulty Load lea addresses_UC+0x1318e, %r12 nop nop nop nop add %r9, %r9 mov (%r12), %r10 lea oracles, %rax and $0xff, %r10 shlq $12, %r10 mov (%rax,%r10,1), %r10 pop %rdi pop %rcx pop %rbx pop %rax pop %r9 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': True, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_PSE'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 3, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 3, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 9, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 9, 'same': True, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}} {'src': {'congruent': 11, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 9, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 9, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}} {'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 */
smsq/java/hwinit.asm
olifink/smsqe
0
161306
<reponame>olifink/smsqe ; SMSQmulator "Hardware" Initialisation V2.01 (c) <NAME> ; based on T. Tebby's code ; * 2003-09-27 v.2.00 (?) added OSPS config item (wl) * 2015 May 24 2.01 added config item for ieee floats (wl) ; Called with a7 a valid, safe stack ; d4 the host (QDOS) version number ; The hardware is initialised. ; If d7 = 0 The caches are invalidated ; The RAM is setup. ; It returns pointer to config info in a2 ; pointer to smsq write base routine in a3 ; pointer to module table in a4 ; pointer to communications block in a5 ; pointer to module install code in a6 ; zero in d5 ; zero in d6 ; top of RAM in d7 ; ; at the end of this routine, we must have : ; pointer to config info in a2 ; pointer to smsq write base routine in a3 ; pointer to module table in a4 ; pointer to communications block in a5 ; pointer to module install code in a6 ; stack pointer in a7 (usually just below sysvar) ; d4 may be 'ROM ' or 'RES ' (if set on call) ; if d7 HI RAM, d5 is top of base RAM, otherwise 0 ; if d7 HI RAM, d6 is base of HI RAM, otherwise 0 ; top of RAM in d7 section hwinit xref smsq_end xref.l smsq_vers xref gl_disptype include 'dev8_keys_68000' include 'dev8_keys_sys' include 'dev8_keys_qlhw' include 'dev8_keys_stella_bl' include 'dev8_smsq_smsq_ini_keys' include 'dev8_smsq_smsq_base_keys' include 'dev8_smsq_smsq_bl_keys' include 'dev8_smsq_gold_keys' include 'dev8_smsq_gold_kbd_abc_keys' include 'dev8_mac_config02' include 'dev8_mac_assert' include 'dev8_mac_creg' include 'dev8_keys_java' include 'dev8_keys_con' header_base dc.l hwinit_base-header_base ; length of header dc.l 0 ; module length unknown dc.l smsq_end-hwinit_base ; loaded length dc.l 0 ; checksum dc.l 0 ; always select dc.b 0 ; main level dc.b 0 dc.w hwinit_name-* hwinit_name dc.w 34,'Java Emul Initialisation for SMSQ ' dc.l ' ' dc.l jva_cfgf1 dc.l jva_cfgf2 dc.l jva_cfgf3 dc.l jva_cfgf4 dc.l 'SMSQ' dc.l 'XqXq' dc.l '3.37' dc.l '0000' glc_cx dc.b -1 glcxcpar dc.b -1 glc_sqr dc.b 0 glcxser2 dc.b 0 glcxbflp dc.b 0 glcxbwin dc.b 1 glc_lang dc.w 44 glcxbtarg dc.b 1 glcxbpart dc.b 0 glc_scr dc.b 0 glc_mode dc.b ptd.16 glcxidisp dc.b 0,0,0,0,0,0,0,0,0,0 glc_nqimi dc.b 1 ; use less cpu when idle? (used for qimi on gold card) glc_clock dc.b 0 glcxxxx dc.b 0,0 ; reset for small mem qcf_mlan dc.w 44 ; default message language qcf_kstuf dc.b 250 ; 1c = stuffer buffer key qcf_curs dc.b 0 ; sprite as cursor? qcf_bgio dc.b 1 ; background IO? qcf_ctlc dc.b 0 ; new ctrl c bahaviuor? glc.conf equ *-glc_cx mkcfhead {SMSQ},{smsq_vers} mkcfitem 'OSPM',word,'L',qcf_mlan,,,\ {Default Messages Language Code 33=F, 44=GB, 49=D, 39=IT},0,$7fff ;* mkcfitem 'OSPK',code,0,glc_mode,,,\ ;* {Initial colour depth},0,0,{QL},2,0,{16-bit} mkcfitem 'OSPS',byte,'S',qcf_kstuf,,,\ {Stuffer buffer key for edit line calls},0,$ff noyes mkcfitem 'OSPC',code,'C',qcf_curs,,,\ {Use sprite for cursor?} \ 0,N,{No},1,Y,{Yes} mkcfitem 'OSPB',code,'B',qcf_bgio,,,\ {Enable CON background I/O},.noyes mkcfitem 'OSPD',code,'S',qcf_ctlc,,,\ {Use new CTRL+C switch behaviour},.noyes mkcfitem 'OSPF',code,'F',glcxbtarg,,,\ {Use ieee floating point routines},.noyes mkcfend dc.l 0 ; copy module at (a0) to 4(a1) up to (a2), linking to (a3) and updating a3 to a1 jav_mdinst move.l a1,(a3) move.l a1,a3 clr.l (a1)+ jav_wbmloop move.w (a0)+,(a1)+ ; set cmp.l a2,a1 blt.s jav_wbmloop rts ; this is called from soft & hard reset. ; hard reset : d7 = 0 ; soft reset: d7<>0 hwinit_base ; this is called from soft & hard reset bra.s hwinit dc.w 0 hwinit tst.l d7 ; soft or hard reset? beq.s hwinit2 ; hwinit2 : hard reset moveq #2,d0 ; trap index = reset cpu (do hard reset) dc.w jva.trp5 ; reset CPU, (do hard reset) hwinit2 move.l a7,d7 ; top of ram sub.l #jva.ssp,d7 ; minus space for ssp = new ramptop move.l #sys.java+sys.mqlc,d6 ; 68000 / java + disp type move.w #$2700,sr ; stop interrupts hwi_comms move.l (sp)+,a0 ; return address clr.l -(sp) ; facilities clr.l -(sp) ; language move.l d6,-(sp) ; processor, mmu/fpu, std disp move.l #'JAVA',-(sp) ; this is a java machine emulator clr.l d6 ; no special RAM clr.l d5 move.l sp,a5 ; loader communications block lea glc_cx,a2 ; config block lea sms_wbase,a3 ; java emul write routine lea mod_table,a4 ; module table ; a5 is already set lea jav_mdinst,a6 ; java emul module install jmp (a0) ; go back (to loader_asm after label loader base sms_wbase move.w d0,(a5)+ ; write in "difficult" areas rts ; loader tables mod_table dc.l sms.base-4,sms.base dc.l 0 ; load everything in one slice ; dc.l sms.base-4,$4000 ; first slice ; dc.l $4200-4,$c000 ; second slice ; dc.l $10020-4,$17d00 ; third slice (avoid 'Gold') ; dc.l 0 end
examples/outdated-and-incorrect/AIM6/Cat/lib/Data/Real/Gauge.agda
cruhland/agda
1,989
7195
module Data.Real.Gauge where import Data.Rational open Data.Rational using (Rational) Gauge = Rational
test/succeed/Issue323.agda
asr/agda-kanso
1
9114
<filename>test/succeed/Issue323.agda -- {-# OPTIONS -v tc.meta:20 #-} -- Agdalist 2010-09-24 <NAME> module Issue323 where data Sigma (A : Set)(B : A -> Set) : Set where _,_ : (a : A) -> B a -> Sigma A B data Trivial {A : Set}(a : A) : Set where trivial : Trivial a lemma : (A : Set)(x y : A) -> Trivial (x , y) lemma A x y = trivial
awa/plugins/awa-jobs/src/awa-jobs-services.adb
twdroeger/ada-awa
81
8809
<gh_stars>10-100 ----------------------------------------------------------------------- -- awa-jobs-services -- Job services -- Copyright (C) 2012, 2014, 2015, 2016, 2019, 2020 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Serialize.Tools; with Util.Log.Loggers; with Ada.Tags; with Ada.Calendar; with ADO.Utils; with ADO.Statements; with AWA.Users.Models; with AWA.Services.Contexts; with AWA.Jobs.Modules; with AWA.Applications; with AWA.Modules; package body AWA.Jobs.Services is package ASC renames AWA.Services.Contexts; Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Jobs.Services"); -- ------------------------------ -- Get the job status. -- ------------------------------ function Get_Job_Status (Id : in ADO.Identifier) return Models.Job_Status_Type is Ctx : constant ASC.Service_Context_Access := ASC.Current; DB : constant ADO.Sessions.Session := ASC.Get_Session (Ctx); Stmt : ADO.Statements.Query_Statement := DB.Create_Statement ("SELECT status FROM awa_job WHERE id = ?"); begin Stmt.Add_Param (Id); Stmt.Execute; return Models.Job_Status_Type'Val (Stmt.Get_Result_Integer); end Get_Job_Status; -- ------------------------------ -- Set the job parameter identified by the `Name` to the value -- given in `Value`. -- ------------------------------ procedure Set_Parameter (Job : in out Abstract_Job_Type; Name : in String; Value : in String) is begin Job.Set_Parameter (Name, Util.Beans.Objects.To_Object (Value)); end Set_Parameter; -- ------------------------------ -- Set the job parameter identified by the `Name` to the value -- given in `Value`. -- ------------------------------ procedure Set_Parameter (Job : in out Abstract_Job_Type; Name : in String; Value : in Integer) is begin Job.Set_Parameter (Name, Util.Beans.Objects.To_Object (Value)); end Set_Parameter; -- ------------------------------ -- Set the job parameter identified by the `Name` to the value -- given in `Value`. -- ------------------------------ procedure Set_Parameter (Job : in out Abstract_Job_Type; Name : in String; Value : in ADO.Objects.Object_Ref'Class) is begin if Value.Is_Null then Job.Set_Parameter (Name, Util.Beans.Objects.Null_Object); else Job.Set_Parameter (Name, ADO.Objects.To_Object (Value.Get_Key)); end if; end Set_Parameter; -- ------------------------------ -- Set the job parameter identified by the `Name` to the value -- given in `Value`. -- The value object can hold any kind of basic value type -- (integer, enum, date, strings). If the value represents -- a bean, the `Invalid_Value` exception is raised. -- ------------------------------ procedure Set_Parameter (Job : in out Abstract_Job_Type; Name : in String; Value : in Util.Beans.Objects.Object) is begin Job.Props.Include (Name, Value); Job.Props_Modified := True; end Set_Parameter; -- ------------------------------ -- Set the job result identified by the `Name` to the value given -- in `Value`. The value object can hold any kind of basic value -- type (integer, enum, date, strings). If the value represents a bean, -- the `Invalid_Value` exception is raised. -- ------------------------------ procedure Set_Result (Job : in out Abstract_Job_Type; Name : in String; Value : in Util.Beans.Objects.Object) is begin Job.Results.Include (Name, Value); Job.Results_Modified := True; end Set_Result; -- ------------------------------ -- Set the job result identified by the `Name` to the value given in `Value`. -- ------------------------------ procedure Set_Result (Job : in out Abstract_Job_Type; Name : in String; Value : in String) is begin Job.Set_Result (Name, Util.Beans.Objects.To_Object (Value)); end Set_Result; -- ------------------------------ -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. -- ------------------------------ overriding function Get_Value (Job : in Abstract_Job_Type; Name : in String) return Util.Beans.Objects.Object is begin return Job.Get_Parameter (Name); end Get_Value; -- ------------------------------ -- Get the job parameter identified by the `Name` and convert -- the value into a string. -- ------------------------------ function Get_Parameter (Job : in Abstract_Job_Type; Name : in String) return String is Value : constant Util.Beans.Objects.Object := Job.Get_Parameter (Name); begin return Util.Beans.Objects.To_String (Value); end Get_Parameter; -- ------------------------------ -- Get the job parameter identified by the `Name` and convert -- the value as an integer. If the parameter is not defined, -- return the default value passed in `Default`. -- ------------------------------ function Get_Parameter (Job : in Abstract_Job_Type; Name : in String; Default : in Integer) return Integer is Pos : constant Util.Beans.Objects.Maps.Cursor := Job.Props.Find (Name); begin if Util.Beans.Objects.Maps.Has_Element (Pos) then declare Value : constant Util.Beans.Objects.Object := Util.Beans.Objects.Maps.Element (Pos); begin if Util.Beans.Objects.Is_Null (Value) then return Default; else return Util.Beans.Objects.To_Integer (Value); end if; end; else return Default; end if; end Get_Parameter; -- ------------------------------ -- Get the job parameter identified by the `Name` and convert -- the value as a database identifier. If the parameter is not defined, -- return the `ADO.NO_IDENTIFIER`. -- ------------------------------ function Get_Parameter (Job : in Abstract_Job_Type; Name : in String) return ADO.Identifier is Pos : constant Util.Beans.Objects.Maps.Cursor := Job.Props.Find (Name); begin if Util.Beans.Objects.Maps.Has_Element (Pos) then declare Value : constant Util.Beans.Objects.Object := Util.Beans.Objects.Maps.Element (Pos); begin if Util.Beans.Objects.Is_Null (Value) then return ADO.NO_IDENTIFIER; else return ADO.Utils.To_Identifier (Value); end if; end; else return ADO.NO_IDENTIFIER; end if; end Get_Parameter; -- ------------------------------ -- Get the job parameter identified by the `Name` and return it as -- a typed object. -- ------------------------------ function Get_Parameter (Job : in Abstract_Job_Type; Name : in String) return Util.Beans.Objects.Object is begin return Job.Props.Element (Name); end Get_Parameter; -- ------------------------------ -- Get the job status. -- ------------------------------ function Get_Status (Job : in Abstract_Job_Type) return Models.Job_Status_Type is begin return Job.Job.Get_Status; end Get_Status; -- ------------------------------ -- Get the job identifier once the job was scheduled. -- The job identifier allows to retrieve the job and check its -- execution and completion status later on. -- ------------------------------ function Get_Identifier (Job : in Abstract_Job_Type) return ADO.Identifier is begin return Job.Job.Get_Id; end Get_Identifier; -- ------------------------------ -- Set the job status. When the job is terminated, it is closed -- and the job parameters or results cannot be changed. -- ------------------------------ procedure Set_Status (Job : in out Abstract_Job_Type; Status : in AWA.Jobs.Models.Job_Status_Type) is begin case Job.Job.Get_Status is when AWA.Jobs.Models.CANCELED | Models.FAILED | Models.TERMINATED => Log.Info ("Job {0} is closed", ADO.Identifier'Image (Job.Job.Get_Id)); raise Closed_Error; when Models.SCHEDULED | Models.RUNNING => Job.Job.Set_Status (Status); end case; end Set_Status; -- ------------------------------ -- Save the job information in the database. Use the database session -- defined by `DB` to save the job. -- ------------------------------ procedure Save (Job : in out Abstract_Job_Type; DB : in out ADO.Sessions.Master_Session'Class) is begin if Job.Props_Modified then Job.Job.Set_Parameters (Util.Serialize.Tools.To_JSON (Job.Props)); Job.Props_Modified := False; end if; if Job.Results_Modified then Job.Job.Set_Results (Util.Serialize.Tools.To_JSON (Job.Results)); Job.Results_Modified := False; end if; Job.Job.Save (DB); end Save; -- ------------------------------ -- Schedule the job. -- ------------------------------ procedure Schedule (Job : in out Abstract_Job_Type; Definition : in Job_Factory'Class) is Ctx : constant ASC.Service_Context_Access := ASC.Current; DB : ADO.Sessions.Master_Session := ASC.Get_Master_Session (Ctx); User : constant AWA.Users.Models.User_Ref := Ctx.Get_User; Sess : constant AWA.Users.Models.Session_Ref := Ctx.Get_User_Session; App : constant AWA.Applications.Application_Access := Ctx.Get_Application; Msg : AWA.Events.Module_Event; begin if Job.Job.Is_Inserted then Log.Error ("Job is already scheduled"); raise Schedule_Error with "The job is already scheduled."; end if; Job.Job.Set_Create_Date (Ada.Calendar.Clock); DB.Begin_Transaction; Job.Job.Set_Name (Definition.Get_Name); Job.Job.Set_User (User); Job.Job.Set_Session (Sess); Job.Save (DB); -- Create the event Msg.Set_Parameters (Job.Props); Msg.Set_Entity (Job.Job, DB); Msg.Set_Event_Kind (Job_Create_Event.Kind); App.Send_Event (Msg); DB.Commit; end Schedule; -- ------------------------------ -- Execute the job and save the job information in the database. -- ------------------------------ procedure Execute (Job : in out Abstract_Job_Type'Class; DB : in out ADO.Sessions.Master_Session'Class) is use type AWA.Jobs.Models.Job_Status_Type; begin -- Execute the job with an exception guard. Log.Info ("Execute job {0}", String '(Job.Job.Get_Name)); begin Job.Execute; exception when E : others => Log.Error ("Exception when executing job {0}", Job.Job.Get_Name); Log.Error ("Exception:", E, True); Job.Job.Set_Status (Models.FAILED); end; -- If the job did not set a completion status, mark it as terminated. if Job.Job.Get_Status = Models.SCHEDULED or Job.Job.Get_Status = Models.RUNNING then Job.Job.Set_Status (Models.TERMINATED); end if; -- And save the job. DB.Begin_Transaction; Job.Job.Set_Finish_Date (ADO.Nullable_Time '(Is_Null => False, Value => Ada.Calendar.Clock)); Job.Save (DB); DB.Commit; end Execute; -- ------------------------------ -- Execute the job associated with the given event. -- ------------------------------ procedure Execute (Event : in AWA.Events.Module_Event'Class; Result : in out Job_Ref) is use AWA.Jobs.Modules; use type AWA.Modules.Module_Access; Ctx : constant ASC.Service_Context_Access := ASC.Current; App : constant AWA.Applications.Application_Access := Ctx.Get_Application; Module : constant AWA.Modules.Module_Access := App.Find_Module (AWA.Jobs.Modules.NAME); DB : ADO.Sessions.Master_Session := ASC.Get_Master_Session (Ctx); Job : AWA.Jobs.Models.Job_Ref; Id : constant ADO.Identifier := Event.Get_Entity_Identifier; begin if Module = null then Log.Warn ("There is no Job module to execute a job"); raise Execute_Error; end if; if not (Module.all in AWA.Jobs.Modules.Job_Module'Class) then Log.Warn ("The 'job' module is not a valid module for job execution"); raise Execute_Error; end if; DB.Begin_Transaction; Job.Load (Session => DB, Id => Id); Job.Set_Start_Date (ADO.Nullable_Time '(Is_Null => False, Value => Ada.Calendar.Clock)); Job.Set_Status (AWA.Jobs.Models.RUNNING); Job.Save (Session => DB); DB.Commit; declare Name : constant String := Job.Get_Name; Ident : constant String := ADO.Identifier'Image (Id); begin Log.Info ("Restoring job {0} - '{1}'", Ident, Name); declare Plugin : constant Job_Module_Access := Job_Module'Class (Module.all)'Access; Factory : constant Job_Factory_Access := Plugin.Find_Factory (Name); Work : AWA.Jobs.Services.Abstract_Job_Type_Access := null; begin if Factory /= null then Work := Factory.Create; Work.Job := Job; Event.Copy (Work.Props); Result := Job_Ref '(Job_Refs.Create (Work) with null record); Work.Execute (DB); else Log.Error ("There is no factory to execute job {0} - '{1}'", Ident, Name); Job.Set_Status (AWA.Jobs.Models.FAILED); Job.Set_Finish_Date (ADO.Nullable_Time '(Is_Null => False, Value => Ada.Calendar.Clock)); DB.Begin_Transaction; Job.Save (Session => DB); DB.Commit; end if; end; end; end Execute; -- ------------------------------ -- Get the job parameter identified by the `Name` and return it as -- a typed object. Return the `Null_Object` if the job is empty -- or there is no such parameter. -- ------------------------------ function Get_Parameter (Job : in Job_Ref; Name : in String) return Util.Beans.Objects.Object is begin if Job.Is_Null then return Util.Beans.Objects.Null_Object; else return Job.Value.Get_Parameter (Name); end if; end Get_Parameter; -- ------------------------------ -- Get the job factory name. -- ------------------------------ function Get_Name (Factory : in Job_Factory'Class) return String is begin return Ada.Tags.Expanded_Name (Factory'Tag); end Get_Name; procedure Execute (Job : in out Job_Type) is begin Job.Work (Job); end Execute; -- ------------------------------ -- Create the job instance to execute the associated `Work_Access` procedure. -- ------------------------------ overriding function Create (Factory : in Work_Factory) return Abstract_Job_Type_Access is begin return new Job_Type '(Util.Refs.Ref_Entity with Work => Factory.Work, others => <>); end Create; -- ------------------------------ -- Job Declaration -- ------------------------------ package body Definition is function Create (Factory : in Job_Type_Factory) return Abstract_Job_Type_Access is pragma Unreferenced (Factory); begin return new T; end Create; end Definition; end AWA.Jobs.Services;
src/basestypes.ads
thindil/steamsky
80
17049
<gh_stars>10-100 -- Copyright 2019-2021 <NAME> -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky 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 General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded.Hash; with Ada.Containers.Hashed_Maps; use Ada.Containers; with DOM.Readers; use DOM.Readers; with Game; use Game; with Items; use Items; -- ****h* BasesTypes/BasesTypes -- FUNCTION -- Provide code for bases types -- SOURCE package BasesTypes is -- **** -- ****t* BasesTypes/BasesTypes.Prices_Array -- FUNCTION -- Buy and sell prices for the item in selected base type -- SOURCE type Prices_Array is array(1 .. 2) of Natural with Default_Component_Value => 0; -- **** -- ****t* BasesTypes/BasesTypes.BasesTrade_Container -- FUNCTION -- Used to store base buy and sell prices for items in selected base type -- SOURCE package BasesTrade_Container is new Hashed_Maps (Key_Type => Unbounded_String, Element_Type => Prices_Array, Hash => Ada.Strings.Unbounded.Hash, Equivalent_Keys => "="); -- **** -- ****s* BasesTypes/Bases_Types.BaseType_Data -- FUNCTION -- Data structure for bases types -- PARAMETERS -- Name - Name of base type, will be presented to the player -- Color - Hexadecimal number of color used to show that base type on -- the map -- Trades - List of base items prices for buy and sale in that base -- type -- Recipes - List of available crafting recipes in that base type -- Flags - Special flags for selected base type (like shipyard, etc) -- Description - Description of the base type. Will be presented to the -- player, for example in new game menu -- SOURCE type Base_Type_Data is record Name: Unbounded_String; Color: String(1 .. 6); Trades: BasesTrade_Container.Map; Recipes: UnboundedString_Container.Vector; Flags: UnboundedString_Container.Vector; Description: Unbounded_String; end record; -- **** -- ****t* BasesTypes/BasesTypes.BasesTypes_Container -- FUNCTION -- Used to store information about all available bases types -- SOURCE package BasesTypes_Container is new Hashed_Maps (Key_Type => Unbounded_String, Element_Type => Base_Type_Data, Hash => Ada.Strings.Unbounded.Hash, Equivalent_Keys => "="); -- **** -- ****v* BasesTypes/BasesTypes.Bases_Types_List -- FUNCTION -- List of all available bases types -- SOURCE Bases_Types_List: BasesTypes_Container.Map; -- **** -- ****f* BasesTypes/BasesTypes.Load_Bases_Types -- FUNCTION -- Load bases types from file -- PARAMETERS -- Reader - XML Reader from which bases types will be read -- SOURCE procedure Load_Bases_Types(Reader: Tree_Reader); -- **** -- ****f* BasesTypes/BasesTypes.Is_Buyable -- FUNCTION -- Check if selected item is buyable in selected base type -- PARAMETERS -- Base_Type - Base type to check -- Item_Index - Index of item prototype to check -- Check_Flag - Check if selected base type has blackmarket flag -- Base_Index - Index of the selected base to check. Default value -- is 0 -- RESULT -- True if item is buyable in that type of bases otherwise false -- SOURCE function Is_Buyable (Base_Type, Item_Index: Unbounded_String; Check_Flag: Boolean := True; Base_Index: Extended_Base_Range := 0) return Boolean with Pre => Bases_Types_List.Contains(Key => Base_Type) and Items_List.Contains(Key => Item_Index), Test_Case => (Name => "Test_Is_Buyable", Mode => Nominal); -- **** -- ****f* BasesTypes/BasesTypes.Get_Price -- FUNCTION -- Get price of selected item in selected base type -- PARAMETERS -- Base_Type - Base type to check -- Item_Index - Index of item prototype to check -- RESULT -- Price of selected item in selected base type -- SOURCE function Get_Price (Base_Type, Item_Index: Unbounded_String) return Natural with Pre => Bases_Types_List.Contains(Key => Base_Type) and Items_List.Contains(Key => Item_Index), Test_Case => (Name => "Test_Get_Price", Mode => Nominal); -- **** end BasesTypes;
Cubical/Relation/Binary/Base.agda
Schippmunk/cubical
0
10234
<reponame>Schippmunk/cubical<filename>Cubical/Relation/Binary/Base.agda {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Relation.Binary.Base where open import Cubical.Core.Everything open import Cubical.Foundations.Prelude open import Cubical.Foundations.HLevels open import Cubical.Data.Sigma open import Cubical.HITs.SetQuotients.Base open import Cubical.HITs.PropositionalTruncation.Base open import Cubical.Foundations.Equiv.Fiberwise open import Cubical.Foundations.Equiv open import Cubical.Foundations.Isomorphism private variable ℓA ℓA' ℓ ℓ' ℓ≅A ℓ≅A' ℓB : Level -- Rel : ∀ {ℓ} (A B : Type ℓ) (ℓ' : Level) → Type (ℓ-max ℓ (ℓ-suc ℓ')) -- Rel A B ℓ' = A → B → Type ℓ' Rel : (A : Type ℓA) (B : Type ℓB) (ℓ : Level) → Type (ℓ-max (ℓ-suc ℓ) (ℓ-max ℓA ℓB)) Rel A B ℓ = A → B → Type ℓ PropRel : ∀ {ℓ} (A B : Type ℓ) (ℓ' : Level) → Type (ℓ-max ℓ (ℓ-suc ℓ')) PropRel A B ℓ' = Σ[ R ∈ Rel A B ℓ' ] ∀ a b → isProp (R a b) idPropRel : ∀ {ℓ} (A : Type ℓ) → PropRel A A ℓ idPropRel A .fst a a' = ∥ a ≡ a' ∥ idPropRel A .snd _ _ = squash invPropRel : ∀ {ℓ ℓ'} {A B : Type ℓ} → PropRel A B ℓ' → PropRel B A ℓ' invPropRel R .fst b a = R .fst a b invPropRel R .snd b a = R .snd a b compPropRel : ∀ {ℓ ℓ' ℓ''} {A B C : Type ℓ} → PropRel A B ℓ' → PropRel B C ℓ'' → PropRel A C (ℓ-max ℓ (ℓ-max ℓ' ℓ'')) compPropRel R S .fst a c = ∥ Σ[ b ∈ _ ] (R .fst a b × S .fst b c) ∥ compPropRel R S .snd _ _ = squash graphRel : ∀ {ℓ} {A B : Type ℓ} → (A → B) → Rel A B ℓ graphRel f a b = f a ≡ b module _ {ℓ ℓ' : Level} {A : Type ℓ} (_R_ : Rel A A ℓ') where -- R is reflexive isRefl : Type (ℓ-max ℓ ℓ') isRefl = (a : A) → a R a -- R is symmetric isSym : Type (ℓ-max ℓ ℓ') isSym = (a b : A) → a R b → b R a -- R is transitive isTrans : Type (ℓ-max ℓ ℓ') isTrans = (a b c : A) → a R b → b R c → a R c record isEquivRel : Type (ℓ-max ℓ ℓ') where constructor equivRel field reflexive : isRefl symmetric : isSym transitive : isTrans isPropValued : Type (ℓ-max ℓ ℓ') isPropValued = (a b : A) → isProp (a R b) isEffective : Type (ℓ-max ℓ ℓ') isEffective = (a b : A) → isEquiv (eq/ {R = _R_} a b) -- the total space corresponding to the binary relation w.r.t. a relSinglAt : (a : A) → Type (ℓ-max ℓ ℓ') relSinglAt a = Σ[ a' ∈ A ] (a R a') -- the statement that the total space is contractible at any a contrRelSingl : Type (ℓ-max ℓ ℓ') contrRelSingl = (a : A) → isContr (relSinglAt a) -- assume a reflexive binary relation module _ (ρ : isRefl) where -- identity is the least reflexive relation ≡→R : {a a' : A} → a ≡ a' → a R a' -- ≡→R {a} {a'} p = subst (λ z → a R z) p (ρ a) ≡→R {a} {a'} p = J (λ z q → a R z) (ρ a) p -- what it means for a reflexive binary relation to be univalent isUnivalent : Type (ℓ-max ℓ ℓ') isUnivalent = (a a' : A) → isEquiv (≡→R {a} {a'}) -- helpers for contrRelSingl→isUnivalent private module _ (a : A) where -- wrapper for ≡→R f = λ (a' : A) (p : a ≡ a') → ≡→R {a} {a'} p -- the corresponding total map that univalence -- of R will be reduced to totf : singl a → Σ[ a' ∈ A ] (a R a') totf (a' , p) = (a' , f a' p) -- if the total space corresponding to R is contractible -- then R is univalent -- because the singleton at a is also contractible contrRelSingl→isUnivalent : contrRelSingl → isUnivalent contrRelSingl→isUnivalent c a = q where abstract q = fiberEquiv (λ a' → a ≡ a') (λ a' → a R a') (f a) (snd (propBiimpl→Equiv (isContr→isProp (isContrSingl a)) (isContr→isProp (c a)) (totf a) (λ _ → fst (isContrSingl a)))) -- converse map. proof idea: -- equivalences preserve contractability, -- singletons are contractible -- and by the univalence assumption the total map is an equivalence isUnivalent→contrRelSingl : isUnivalent → contrRelSingl isUnivalent→contrRelSingl u a = q where abstract q = isContrRespectEquiv (totf a , totalEquiv (a ≡_) (a R_) (f a) λ a' → u a a') (isContrSingl a) isUnivalent' : Type (ℓ-max ℓ ℓ') isUnivalent' = (a a' : A) → (a ≡ a') ≃ a R a' private module _ (e : isUnivalent') (a : A) where -- wrapper for ≡→R g = λ (a' : A) (p : a ≡ a') → e a a' .fst p -- the corresponding total map that univalence -- of R will be reduced to totg : singl a → Σ[ a' ∈ A ] (a R a') totg (a' , p) = (a' , g a' p) isUnivalent'→contrRelSingl : isUnivalent' → contrRelSingl isUnivalent'→contrRelSingl u a = q where abstract q = isContrRespectEquiv (totg u a , totalEquiv (a ≡_) (a R_) (g u a) λ a' → u a a' .snd) (isContrSingl a) isUnivalent'→isUnivalent : isUnivalent' → isUnivalent isUnivalent'→isUnivalent u = contrRelSingl→isUnivalent (isUnivalent'→contrRelSingl u) isUnivalent→isUnivalent' : isUnivalent → isUnivalent' isUnivalent→isUnivalent' u a a' = ≡→R {a} {a'} , u a a' record RelIso {A : Type ℓA} (_≅_ : Rel A A ℓ≅A) {A' : Type ℓA'} (_≅'_ : Rel A' A' ℓ≅A') : Type (ℓ-max (ℓ-max ℓA ℓA') (ℓ-max ℓ≅A ℓ≅A')) where constructor reliso field fun : A → A' inv : A' → A rightInv : (a' : A') → fun (inv a') ≅' a' leftInv : (a : A) → inv (fun a) ≅ a RelIso→Iso : {A : Type ℓA} {A' : Type ℓA'} (_≅_ : Rel A A ℓ≅A) (_≅'_ : Rel A' A' ℓ≅A') {ρ : isRefl _≅_} {ρ' : isRefl _≅'_} (uni : isUnivalent _≅_ ρ) (uni' : isUnivalent _≅'_ ρ') (f : RelIso _≅_ _≅'_) → Iso A A' Iso.fun (RelIso→Iso _ _ _ _ f) = RelIso.fun f Iso.inv (RelIso→Iso _ _ _ _ f) = RelIso.inv f Iso.rightInv (RelIso→Iso _ _≅'_ {ρ' = ρ'} _ uni' f) a' = invEquiv (≡→R _≅'_ ρ' , uni' (RelIso.fun f (RelIso.inv f a')) a') .fst (RelIso.rightInv f a') Iso.leftInv (RelIso→Iso _≅_ _ {ρ = ρ} uni _ f) a = invEquiv (≡→R _≅_ ρ , uni (RelIso.inv f (RelIso.fun f a)) a) .fst (RelIso.leftInv f a) EquivRel : ∀ {ℓ} (A : Type ℓ) (ℓ' : Level) → Type (ℓ-max ℓ (ℓ-suc ℓ')) EquivRel A ℓ' = Σ[ R ∈ Rel A A ℓ' ] isEquivRel R EquivPropRel : ∀ {ℓ} (A : Type ℓ) (ℓ' : Level) → Type (ℓ-max ℓ (ℓ-suc ℓ')) EquivPropRel A ℓ' = Σ[ R ∈ PropRel A A ℓ' ] isEquivRel (R .fst)
Stream/Programs.agda
nad/codata
1
3112
------------------------------------------------------------------------ -- A universe for stream programs ------------------------------------------------------------------------ module Stream.Programs where open import Codata.Musical.Notation renaming (∞ to ∞_) import Stream as S open S using (Stream; _≈_; _≺_; head; tail) open import Relation.Binary.PropositionalEquality open import Data.Vec using (Vec; []; _∷_) ------------------------------------------------------------------------ -- Stream programs infix 8 _∞ infixr 7 _·_ infix 6 _⟨_⟩_ infixr 5 _≺_ _⋎_ _≺≺_ data Prog (A : Set) : Set1 where _≺_ : (x : A) (xs : ∞ (Prog A)) → Prog A _∞ : (x : A) → Prog A _·_ : ∀ {B} (f : B → A) (xs : Prog B) → Prog A _⟨_⟩_ : ∀ {B C} (xs : Prog B) (_∙_ : B → C → A) (ys : Prog C) → Prog A _⋎_ : (xs ys : Prog A) → Prog A iterate : (f : A → A) (x : A) → Prog A _≺≺_ : ∀ {n} (xs : Vec A n) (ys : Prog A) → Prog A data WHNF A : Set1 where _≺_ : (x : A) (xs : Prog A) → WHNF A ------------------------------------------------------------------------ -- Conversion whnf : ∀ {A} → Prog A → WHNF A whnf (x ≺ xs) = x ≺ ♭ xs whnf (x ∞) = x ≺ x ∞ whnf (f · xs) with whnf xs whnf (f · xs) | x ≺ xs′ = f x ≺ f · xs′ whnf (xs ⟨ _∙_ ⟩ ys) with whnf xs | whnf ys whnf (xs ⟨ _∙_ ⟩ ys) | x ≺ xs′ | y ≺ ys′ = (x ∙ y) ≺ xs′ ⟨ _∙_ ⟩ ys′ whnf (xs ⋎ ys) with whnf xs whnf (xs ⋎ ys) | x ≺ xs′ = x ≺ ys ⋎ xs′ whnf (iterate f x) = x ≺ iterate f (f x) whnf ([] ≺≺ ys) = whnf ys whnf ((x ∷ xs) ≺≺ ys) = x ≺ xs ≺≺ ys mutual value : ∀ {A} → WHNF A → Stream A value (x ≺ xs) = x ≺ ♯ ⟦ xs ⟧ ⟦_⟧ : ∀ {A} → Prog A → Stream A ⟦ xs ⟧ = value (whnf xs) fromStream : ∀ {A} → Stream A → Prog A fromStream (x ≺ xs) = x ≺ ♯ fromStream (♭ xs) lift : ∀ {A} → (Prog A → Prog A) → Stream A → Stream A lift f xs = ⟦ f (fromStream xs) ⟧ ------------------------------------------------------------------------ -- Some abbreviations infixr 5 _≺♯_ _≺♯_ : ∀ {A} → A → Prog A → Prog A x ≺♯ xs = x ≺ ♯ xs headP : ∀ {A} → Prog A → A headP xs = head ⟦ xs ⟧ tailP : ∀ {A} → Prog A → Prog A tailP xs with whnf xs tailP xs | x ≺ xs′ = xs′
test/Common/List.agda
KDr2/agda
0
14569
<reponame>KDr2/agda {-# OPTIONS --cubical-compatible #-} module Common.List where open import Agda.Builtin.List public open import Common.Nat infixr 5 _++_ _++_ : ∀ {a} {A : Set a} → List A → List A → List A [] ++ ys = ys (x ∷ xs) ++ ys = x ∷ (xs ++ ys) map : ∀ {a b} {A : Set a} {B : Set b} → (A → B) → List A → List B map _ [] = [] map f (x ∷ xs) = f x ∷ map f xs length : ∀ {a} {A : Set a} → List A → Nat length [] = 0 length (x ∷ xs) = 1 + length xs
src/aids.ads
OneWingedShark/ada-probe
6
23266
<filename>src/aids.ads package Aids with Pure is end Aids;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/debug5.adb
best08618/asylo
7
9692
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/debug5.adb -- { dg-do compile } -- { dg-options "-g" } procedure Debug5 is type Record_Type (L1, L2 : Natural) is record S1 : String (1 .. L1); case L2 is when 0 => null; when others => S2 : String (L1 .. L2); end case; end record; procedure Discard (R : Record_Type) is begin null; end Discard; R : constant Record_Type := (0, 0, others => <>); begin Discard (R); end Debug5;
Cubical/Algebra/Semigroup/Base.agda
thomas-lamiaux/cubical
0
15736
{-# OPTIONS --safe #-} module Cubical.Algebra.Semigroup.Base where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Equiv open import Cubical.Foundations.HLevels open import Cubical.Foundations.SIP open import Cubical.Data.Sigma open import Cubical.Reflection.RecordEquiv open import Cubical.Displayed.Base open import Cubical.Displayed.Auto open import Cubical.Displayed.Record open import Cubical.Displayed.Universe open Iso private variable ℓ : Level -- Semigroups as a record, inspired by the Agda standard library: -- -- https://github.com/agda/agda-stdlib/blob/master/src/Algebra/Bundles.agda#L48 -- https://github.com/agda/agda-stdlib/blob/master/src/Algebra/Structures.agda#L50 -- -- Note that as we are using Path for all equations the IsMagma record -- would only contain isSet A if we had it. record IsSemigroup {A : Type ℓ} (_·_ : A → A → A) : Type ℓ where no-eta-equality constructor issemigroup field is-set : isSet A ·Assoc : (x y z : A) → x · (y · z) ≡ (x · y) · z unquoteDecl IsSemigroupIsoΣ = declareRecordIsoΣ IsSemigroupIsoΣ (quote IsSemigroup) record SemigroupStr (A : Type ℓ) : Type ℓ where constructor semigroupstr field _·_ : A → A → A isSemigroup : IsSemigroup _·_ infixl 7 _·_ open IsSemigroup isSemigroup public Semigroup : ∀ ℓ → Type (ℓ-suc ℓ) Semigroup ℓ = TypeWithStr ℓ SemigroupStr module _ (A : Type ℓ) (_·_ : A → A → A) (h : IsSemigroup _·_) where semigroup : Semigroup ℓ semigroup .fst = A semigroup .snd .SemigroupStr._·_ = _·_ semigroup .snd .SemigroupStr.isSemigroup = h record IsSemigroupEquiv {A : Type ℓ} {B : Type ℓ} (M : SemigroupStr A) (e : A ≃ B) (N : SemigroupStr B) : Type ℓ where -- Shorter qualified names private module M = SemigroupStr M module N = SemigroupStr N field isHom : (x y : A) → equivFun e (x M.· y) ≡ equivFun e x N.· equivFun e y open SemigroupStr open IsSemigroup open IsSemigroupEquiv SemigroupEquiv : (M N : Semigroup ℓ) → Type ℓ SemigroupEquiv M N = Σ[ e ∈ ⟨ M ⟩ ≃ ⟨ N ⟩ ] IsSemigroupEquiv (M .snd) e (N .snd) isPropIsSemigroup : {A : Type ℓ} (_·_ : A → A → A) → isProp (IsSemigroup _·_) isPropIsSemigroup _·_ = isOfHLevelRetractFromIso 1 IsSemigroupIsoΣ (isPropΣ isPropIsSet (λ isSetA → isPropΠ3 λ _ _ _ → isSetA _ _)) 𝒮ᴰ-Semigroup : DUARel (𝒮-Univ ℓ) SemigroupStr ℓ 𝒮ᴰ-Semigroup = 𝒮ᴰ-Record (𝒮-Univ _) IsSemigroupEquiv (fields: data[ _·_ ∣ autoDUARel _ _ ∣ isHom ] prop[ isSemigroup ∣ (λ _ _ → isPropIsSemigroup _) ]) SemigroupPath : (M N : Semigroup ℓ) → SemigroupEquiv M N ≃ (M ≡ N) SemigroupPath = ∫ 𝒮ᴰ-Semigroup .UARel.ua
oeis/131/A131654.asm
neoneye/loda-programs
11
24486
<gh_stars>10-100 ; A131654: Difference mod 10 of successive digits of Pi. ; Submitted by <NAME> ; 8,3,7,4,4,3,4,9,8,2,3,1,8,2,4,9,1,5,6,2,6,4,8,9,0,5,5,9,5,2,6,5,2,6,0,6,7,8,8,4,5,3,4,6,0,4,4,8,6,9,5,3,4,8,9,8,7,5,5,0,1,4,3,1,7,7,1,3,5,8,6,6,6,6,8,6,8,8,1,0,9,8,6,6,2,3,1,4,4,3,8,1,8,9,0,6,3,6,1,2 mov $3,2 lpb $3 sub $3,1 add $0,$3 mov $5,$0 mov $7,2 lpb $7 sub $7,1 add $0,$7 sub $0,1 mov $2,$0 max $2,0 seq $2,81737 ; a(n) = (n-1)*10 + n-th decimal digit of Pi=3.14159... mov $3,0 mov $4,$2 mov $6,$7 mul $6,$2 add $8,$6 lpe min $5,1 mul $5,$4 mov $4,$8 sub $4,$5 lpe mov $0,$4 mod $0,10
SIM_ESAMI/1_ES/assembler.asm
mich2k/CE_LAB
0
11826
.586 .model flat .code _divisione_array proc push ebp mov ebp,esp push esi push edi push ebx mov ebx, dword ptr[ebp+8] ; arr ;dword ptr[ebp+12] ; divisore mov ecx, dword ptr[ebp+20] ; resto mov esi, 0d mov edi, 0d mov eax, 0d primo_ciclo: cmp esi, dword ptr[ebp+16] je fine_primo mov eax, dword ptr [ebx+esi*4] cdq idiv dword ptr[ebp+12] mov dword ptr [ecx+esi*4], edx mov dword ptr [ebx+esi*4], eax inc esi jmp primo_ciclo fine_primo: mov esi, 0 ; cont mov edi, 0 mov eax, 0 ; somma mov edx, 0 ; val subciclo: cmp esi, dword ptr[ebp+16] je fine_sub mov edx, dword ptr [ecx+esi*4] cmp edx, 0 jl negativo keep: jne non_zero keep_: add eax, edx inc esi jmp subciclo non_zero: inc edi jmp keep_ negativo: neg edx jmp keep fine_sub: cmp edi, dword ptr[ebp+16] je tutte_non_zero cmp eax, 0 jmp tutte_zero jmp fine tutte_zero: mov eax, -1 jmp fine tutte_non_zero: mov eax, 1 jmp fine fine: pop ebx pop edi pop esi mov esp, ebp pop ebp ret _divisione_array endp end
src/gl/implementation/gl-helpers.adb
Roldak/OpenGLAda
0
29187
-- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" package body GL.Helpers is function Float_Array (Value : Colors.Color) return Low_Level.Single_Array is use GL.Types.Colors; begin return Low_Level.Single_Array'(1 => Value (R), 2 => Value (G), 3 => Value (B), 4 => Value (A)); end Float_Array; function Color (Value : Low_Level.Single_Array) return Colors.Color is use GL.Types.Colors; begin return Colors.Color'(R => Value (1), G => Value (2), B => Value (3), A => Value (4)); end Color; end GL.Helpers;
extern/gnat_sdl/gnat_sdl/src/sdl_sdl_main_h.ads
AdaCore/training_material
15
4218
<reponame>AdaCore/training_material pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with System; with Interfaces.C.Strings; with SDL_SDL_stdinc_h; package SDL_SDL_main_h is C_LINKAGE : aliased constant String := "C" & ASCII.NUL; -- ../include/SDL/SDL_main.h:38 -- unsupported macro: main SDL_main function SDL_main (argc : int; argv : System.Address) return int; -- ../include/SDL/SDL_main.h:57 pragma Import (C, SDL_main, "SDL_main"); procedure SDL_SetModuleHandle (hInst : System.Address); -- ../include/SDL/SDL_main.h:70 pragma Import (C, SDL_SetModuleHandle, "SDL_SetModuleHandle"); function SDL_RegisterApp (name : Interfaces.C.Strings.chars_ptr; style : SDL_SDL_stdinc_h.Uint32; hInst : System.Address) return int; -- ../include/SDL/SDL_main.h:72 pragma Import (C, SDL_RegisterApp, "SDL_RegisterApp"); procedure SDL_UnregisterApp; -- ../include/SDL/SDL_main.h:74 pragma Import (C, SDL_UnregisterApp, "SDL_UnregisterApp"); end SDL_SDL_main_h;
libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sdcc_iy/wa_priority_queue_top.asm
jpoikela/z88dk
640
241883
<filename>libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sdcc_iy/wa_priority_queue_top.asm ; void *wa_priority_queue_top(wa_priority_queue_t *q) SECTION code_clib SECTION code_adt_wa_priority_queue PUBLIC _wa_priority_queue_top EXTERN asm_wa_priority_queue_top _wa_priority_queue_top: pop af pop hl push hl push af jp asm_wa_priority_queue_top
src/static/antlr4/grammars/PrimaryExpression.g4
jlenoble/ecmascript-parser
0
599
/* Source: ECMAScript® 2018 Language Specification - Annex A-2 */ grammar PrimaryExpression; // PrimaryExpression[Yield, Await]: // this // IdentifierReference[?Yield, ?Await] // Literal // ArrayLiteral[?Yield, ?Await] // ObjectLiteral[?Yield, ?Await] // FunctionExpression // ClassExpression[?Yield, ?Await] // GeneratorExpression // AsyncFunctionExpression // RegularExpressionLiteral // TemplateLiteral[?Yield, ?Await] // CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await] primaryExpression : This | identifierReference | literal | arrayLiteral | objectLiteral // | functionExpression // | classExpression // | generatorExpression // | asyncFunctionExpression | RegularExpressionLiteral | templateLiteral | coverParenthesizedExpressionAndArrowParameterList ; // Literal: // NullLiteral // BooleanLiteral // NumericLiteral // StringLiteral literal : NullLiteral | BooleanLiteral | NumericLiteral | StringLiteral ;
FormalAnalyzer/models/apps/Daily2TempSchedule.als
Mohannadcse/IoTCOM_BehavioralRuleExtractor
0
3520
module app_Daily2TempSchedule open IoTBottomUp as base open cap_thermostat one sig app_Daily2TempSchedule extends IoTApp { thermostat : one cap_thermostat, state : one cap_state, } { rules = r } one sig cap_state extends Capability {} { attributes = cap_state_attr } abstract sig cap_state_attr extends Attribute {} one sig cap_state_attr_runIn extends cap_state_attr {} { values = cap_state_attr_runIn_val } abstract sig cap_state_attr_runIn_val extends AttrValue {} one sig cap_state_attr_runIn_val_on extends cap_state_attr_runIn_val {} one sig cap_state_attr_runIn_val_off extends cap_state_attr_runIn_val {} // application rules base class abstract sig r extends Rule {} one sig r0 extends r {}{ no triggers conditions = r0_cond commands = r0_comm } abstract sig r0_cond extends Condition {} one sig r0_cond0 extends r0_cond {} { capabilities = app_Daily2TempSchedule.state attribute = cap_state_attr_runIn value = cap_state_attr_runIn_val_on } abstract sig r0_comm extends Command {} one sig r0_comm0 extends r0_comm {} { capability = app_Daily2TempSchedule.thermostat attribute = cap_thermostat_attr_thermostat value = cap_thermostat_attr_thermostat_val_setHeatingSetpoint } one sig r0_comm1 extends r0_comm {} { capability = app_Daily2TempSchedule.thermostat attribute = cap_thermostat_attr_thermostat value = cap_thermostat_attr_thermostat_val_setCoolingSetpoint }
random.asm
wiebow/tetris.c64
79
160331
<reponame>wiebow/tetris.c64 // generate random number code SetupRandom: // set the 16 bit rnd seed ldx #$89 stx rndseed dex stx rndseed+1 rts GetRandom: // get random number 0-6 // it's in accumulator when returning lda rndseed // load seed high byte and #%00000111 // keep values 0-7 cmp #$07 // we can only use 0-6 bne !skip+ // valid number! jsr UpdateRandom // retry jmp GetRandom !skip: rts UpdateRandom: lda rndseed // get first byte of rnd seed and #%00000010 // extract bit 1 sta rndtemp // save it lda rndseed+1 // get 2nd byte of rnd seed and #%00000010 // extract bit 1 eor rndtemp // one or the other but not both. clc // clear carry bit in case result was 0 beq !skip+ sec // set carry bit if result was 1 !skip: // shift the 16 bit seed value to the right // feeds the carry bit value into the msb ror rndseed // rotate 1st byte ror rndseed+1 // rotate 2nd byte rts rndseed: .byte 0,0 rndtemp: .byte 0
enduser/netmeeting/av/codecs/intel/h263/i386/yuv12enc.asm
npocmaka/Windows-Server-2003
17
94135
<filename>enduser/netmeeting/av/codecs/intel/h263/i386/yuv12enc.asm ;************************************************************************* ;** INTEL Corporation Proprietary Information ;** ;** This listing is supplied under the terms of a license ;** agreement with INTEL Corporation and may not be copied ;** nor disclosed except in accordance with the terms of ;** that agreement. ;** ;** Copyright (c) 1995 Intel Corporation. ;** All Rights Reserved. ;** ;************************************************************************* ;// ;// ;//////////////////////////////////////////////////////////////////////////// ; yuv12enc -- This function performs "color conversion" in the H26X decoder for ; consumption by the H26X encoder. This entails reformatting the decoder's ; YVU data into the shape required by the encoder - including YUV order. It ; Also includes 7-bit pels. ; $Header: S:\h26x\src\dec\yuv12enc.asv 1.5 30 Oct 1996 14:31:00 mbodart $ ; $Log: S:\h26x\src\dec\yuv12enc.asv $ ;// ;// Rev 1.5 30 Oct 1996 14:31:00 mbodart ;// Re-checking in changes originally made by Atul, but lost when the server ;// ran out of disk space during a PVCS operation. Atul's original log msg: ;// ;// Removed AGI in IA code. Added MMX code but it is not ready for prime-time. ;// ;// Rev 1.4 08 Mar 1996 15:11:10 AGUPTA2 ;// Removed segment register override when compiling for WIN32. ;// Should speed-up this routine substantially. ;// ; OPTION PROLOGUE:None OPTION EPILOGUE:ReturnAndRelieveEpilogueMacro include locals.inc include decconst.inc include iammx.inc IFNDEF DSEGNAME IFNDEF WIN32 DSEGNAME TEXTEQU <DataH26x_YUV12ForEnc> ENDIF ENDIF IFDEF WIN32 .xlist include memmodel.inc .list .DATA ELSE DSEGNAME SEGMENT WORD PUBLIC 'DATA' ENDIF ; any data would go here IFNDEF WIN32 DSEGNAME ENDS .xlist include memmodel.inc .list ENDIF IFNDEF SEGNAME IFNDEF WIN32 SEGNAME TEXTEQU <_CODE32> ENDIF ENDIF ifdef WIN32 .CODE else SEGNAME SEGMENT PARA PUBLIC USE32 'CODE' endif ifdef WIN32 ASSUME cs : FLAT ASSUME ds : FLAT ASSUME es : FLAT ASSUME fs : FLAT ASSUME gs : FLAT ASSUME ss : FLAT else ASSUME CS : SEGNAME ASSUME DS : Nothing ASSUME ES : Nothing ASSUME FS : Nothing ASSUME GS : Nothing endif ; void FAR ASM_CALLTYPE H26x_YUV12ForEnc ( ; U8 FAR * InstanceBase, ; X32 YPlane, ; X32 VPlane, ; X32 UPlane, ; UN FrameWidth, ; UN FrameHeight, ; UN Pitch, ; U8 FAR * ColorConvertedFrame, // encoder's buffers. ; X32 YOutputPlane, ; X32 VOutputPlane, ; X32 UOutputPlane) ; ; YPlane, VPlane, YOutputPlane, and VOutputPlane are offsets. In 16-bit Microsoft ; Windows (tm), space in this segment is used for local variables and tables. ; In 32-bit variants of Microsoft Windows (tm), the local variables are on ; the stack, while the tables are in the one and only data segment. ; PUBLIC H26x_YUV12ForEnc ; due to the need for the ebp reg, these parameter declarations aren't used, ; they are here so the assembler knows how many bytes to relieve from the stack H26x_YUV12ForEnc proc DIST LANG PUBLIC, AInstanceBase: DWORD, AYPlane: DWORD, AVPlane: DWORD, AUPlane: DWORD, AFrameWidth: DWORD, AFrameHeight: DWORD, APitch: DWORD, AColorConvertedFrame: DWORD, AYOutputPlane: DWORD, AVOutputPLane: DWORD, AUOutputPLane: DWORD LocalFrameSize = 0 RegisterStorageSize = 16 ; Arguments: InstanceBase = LocalFrameSize + RegisterStorageSize + 4 YPlane = LocalFrameSize + RegisterStorageSize + 8 VPlane = LocalFrameSize + RegisterStorageSize + 12 UPlane = LocalFrameSize + RegisterStorageSize + 16 FrameWidth = LocalFrameSize + RegisterStorageSize + 20 FrameHeight = LocalFrameSize + RegisterStorageSize + 24 Pitch = LocalFrameSize + RegisterStorageSize + 28 ColorConvertedFrame = LocalFrameSize + RegisterStorageSize + 32 YOutputPlane = LocalFrameSize + RegisterStorageSize + 36 VOutputPlane = LocalFrameSize + RegisterStorageSize + 40 UOutputPlane = LocalFrameSize + RegisterStorageSize + 44 EndOfArgList = LocalFrameSize + RegisterStorageSize + 48 LCL EQU <esp+> push esi push edi push ebp push ebx sub esp,LocalFrameSize mov eax,PD [esp+InstanceBase] add PD [esp+YPlane],eax add PD [esp+VPlane],eax add PD [esp+UPlane],eax mov eax,PD [esp+ColorConvertedFrame] add PD [esp+YOutputPlane],eax add PD [esp+VOutputPlane],eax add PD [esp+UOutputPlane],eax ; We copy 16 pels in one iteration of the inner loop ; Register usage: ; edi -- Y plane output cursor ; esi -- Y plane input cursor ; ebp -- Count down Y plane height ; ecx -- Count down Y plane width ; ebx -- Y plane input pitch ; eax,edx -- scratch Lebp FrameHeight Lecx FrameWidth Lesi YPlane Lebx Pitch Ledi YOutputPlane YLoopHeader: mov eax, PD [esi+ecx-8] ; mov edx, PD [esi+ecx-4] ALIGN 4 YLoop: shr eax, 1 ; Shift packed pel by 1 to convert to 7-bit and edx, 0FEFEFEFEH ; and to get rid of upper bit shr edx, 1 and eax, 07F7F7F7Fh ; and to get rid of upper bit mov PD [edi+ecx-8], eax mov PD [edi+ecx-4], edx ; NEXT 8 PELS mov eax, PD [esi+ecx-8-8] ; speculatively load next 8 pels mov edx, PD [esi+ecx-4-8] ; this avoids AGI shr eax, 1 ; Shift packed pel by 1 to convert to 7-bit and edx, 0FEFEFEFEH ; and to get rid of upper bit shr edx, 1 and eax, 07F7F7F7Fh ; and to get rid of upper bit mov PD [edi+ecx-8-8], eax mov PD [edi+ecx-4-8], edx mov eax, PD [esi+ecx-8-16] ; speculatively load next 8 pels mov edx, PD [esi+ecx-4-16] ; for next iteration sub ecx, 16 jg YLoop Lecx FrameWidth add esi, ebx add edi, ebx dec ebp jne YLoopHeader ; We copy 8 pels in one iteration of the inner loop ; Register usage: ; edi -- V plane output cursor ; esi -- V plane input cursor ; ebp -- Count down V plane height ; ecx -- Count down V plane width ; ebx -- Pitch ; eax,edx -- scratch Lebp FrameHeight Lecx FrameWidth sar ecx,1 Lesi VPlane sar ebp,1 Ledi VOutputPlane ALIGN 4 VLoopHeader: mov eax, PD [esi+ecx-8] mov edx, PD [esi+ecx-4] VLoop: shr eax, 1 ; Shift packed pel by 1 to convert to 7-bit and edx, 0FEFEFEFEH ; and to get rid of upper bit shr edx, 1 and eax, 07F7F7F7Fh ; and to get rid of upper bit mov PD [edi+ecx-8], eax mov PD [edi+ecx-4], edx mov eax, PD [esi+ecx-8-8] ; speculatively load next 8 pels mov edx, PD [esi+ecx-4-8] ; this avoids AGI sub ecx, 8 jg VLoop Lecx FrameWidth add esi,ebx shr ecx,1 add edi,ebx dec ebp jne VLoopHeader ; We copy 8 pels in one iteration of the inner loop ; Register usage: ; edi -- U plane output cursor ; esi -- U plane input cursor ; ebp -- Count down U plane height ; ecx -- Count down U plane width ; ebx -- Pitch ; eax,edx -- scratch Lebp FrameHeight Lecx FrameWidth sar ecx,1 Lesi UPlane sar ebp,1 Ledi UOutputPlane ALIGN 4 ULoopHeader: mov eax,PD [esi+ecx-8] mov edx,PD [esi+ecx-4] ULoop: shr eax, 1 ; Shift packed pel by 1 to convert to 7-bit and edx, 0FEFEFEFEH ; and to get rid of upper bit shr edx, 1 and eax, 07F7F7F7Fh ; and to get rid of upper bit mov PD [edi+ecx-8], eax mov PD [edi+ecx-4], edx mov eax, PD [esi+ecx-8-8] mov edx, PD [esi+ecx-4-8] sub ecx, 8 jg ULoop Lecx FrameWidth add esi, ebx shr ecx, 1 add edi, ebx dec ebp jne ULoopHeader add esp,LocalFrameSize pop ebx pop ebp pop edi pop esi rturn H26x_YUV12ForEnc endp IFDEF H263P MMXDATA1 SEGMENT PARA USE32 PUBLIC 'DATA' MMXDATA1 ENDS MMXDATA1 SEGMENT ALIGN 8 CLEAR_LOW_BIT_MASK LABEL DWORD DWORD 0FEFEFEFEH, 0FEFEFEFEH CLEAR_HIGH_BIT_MASK LABEL DWORD DWORD 07F7F7F7FH, 07F7F7F7FH MMXDATA1 ENDS PUBLIC MMX_H26x_YUV12ForEnc ; due to the need for the ebp reg, these parameter declarations aren't used, ; they are here so the assembler knows how many bytes to relieve from the stack MMX_H26x_YUV12ForEnc proc DIST LANG PUBLIC, AInstanceBase: DWORD, AYPlane: DWORD, AVPlane: DWORD, AUPlane: DWORD, AFrameWidth: DWORD, AFrameHeight: DWORD, APitch: DWORD, AColorConvertedFrame: DWORD, AYOutputPlane: DWORD, AVOutputPLane: DWORD, AUOutputPLane: DWORD LocalFrameSize = 0 RegisterStorageSize = 16 ; Arguments: InstanceBase = LocalFrameSize + RegisterStorageSize + 4 YPlane = LocalFrameSize + RegisterStorageSize + 8 VPlane = LocalFrameSize + RegisterStorageSize + 12 UPlane = LocalFrameSize + RegisterStorageSize + 16 FrameWidth = LocalFrameSize + RegisterStorageSize + 20 FrameHeight = LocalFrameSize + RegisterStorageSize + 24 Pitch = LocalFrameSize + RegisterStorageSize + 28 ColorConvertedFrame = LocalFrameSize + RegisterStorageSize + 32 YOutputPlane = LocalFrameSize + RegisterStorageSize + 36 VOutputPlane = LocalFrameSize + RegisterStorageSize + 40 UOutputPlane = LocalFrameSize + RegisterStorageSize + 44 EndOfArgList = LocalFrameSize + RegisterStorageSize + 48 LCL EQU <esp+> CLEAR_LOW_BIT EQU mm6 CLEAR_HIGH_BIT EQU mm7 push esi push edi push ebp push ebx sub esp,LocalFrameSize mov eax,PD [esp+InstanceBase] add PD [esp+YPlane],eax add PD [esp+VPlane],eax add PD [esp+UPlane],eax mov eax,PD [esp+ColorConvertedFrame] add PD [esp+YOutputPlane],eax add PD [esp+VOutputPlane],eax add PD [esp+UOutputPlane],eax ; We copy 16 pels of two lines in one iteration of the inner loop ; Register usage: ; edi -- Y plane output cursor (line 0) ; edx -- Y plane output cursor (line 1) ; esi -- Y plane input cursor (line 0) ; eax -- Y plane input cursor (line 1) ; ebp -- Count down Y plane height / 2 ; ecx -- Count down Y plane width ; ebx -- Y plane input pitch Lebp FrameHeight Lebx Pitch Lesi YPlane Lecx FrameWidth Ledi YOutputPlane lea eax, [esi + ebx] ; line 1 of input movq mm6, CLEAR_LOW_BIT_MASK lea edx, [edi + ebx] ; line 1 of output movq mm7, CLEAR_HIGH_BIT_MASK shr ebp, 1 ; two lines in one iteration YLoopHeader: movq mm0, [esi+ecx-16] ;00 ; movq mm1, [esi+ecx-8] ;01 psrlq mm0, 1 ;00 Shift packed pel by 1 to convert to 7-bit YLoop: movq mm2, [eax+ecx-16] ;10 pand mm0, CLEAR_HIGH_BIT ;00 and to get rid of high bit movq mm3, [eax+ecx-8] ;11 psrlq mm1, 1 ;01 movq [edi+ecx-16], mm0 ;00 pand mm1, CLEAR_LOW_BIT ;01 and to get rid of low bit movq mm0, [esi+ecx-16-16] ; speculatively load next 8 pels psrlq mm2, 1 ;10 Shift packed pel by 1 to convert to 7-bit movq [edi+ecx-8 ], mm1 ;01 pand mm2, CLEAR_HIGH_BIT ;10 and to get rid of high bit movq mm1, [esi+ecx-8 -16] ; for next iteration pand mm3, CLEAR_LOW_BIT ;11 and to get rid of low bit movq [edx+ecx-16], mm2 ;10 psrlq mm3, 1 ;11 psrlq mm0, 1 ;00 Shift packed pel by 1 to convert to 7-bit ; movq [edx+ecx-8 ], mm3 ;11 sub ecx, 16 jg YLoop Lecx FrameWidth lea esi, [esi + 2*ebx] lea edi, [edi + 2*ebx] lea eax, [eax + 2*ebx] ; line 1 of input lea edx, [edx + 2*ebx] ; line 1 of output dec ebp jne YLoopHeader ; We copy 8 pels in one iteration of the inner loop ; Register usage: ; edi -- V plane output cursor ; esi -- V plane input cursor ; ebp -- Count down V plane height ; ecx -- Count down V plane width ; ebx -- Pitch ; eax,edx -- scratch Lebp FrameHeight Lecx FrameWidth sar ecx,1 Lesi VPlane sar ebp,1 Ledi VOutputPlane ALIGN 4 VLoopHeader: mov eax, PD [esi+ecx-8] mov edx, PD [esi+ecx-4] VLoop: shr eax, 1 ; Shift packed pel by 1 to convert to 7-bit and edx, 0FEFEFEFEH ; and to get rid of upper bit shr edx, 1 and eax, 07F7F7F7Fh ; and to get rid of upper bit mov PD [edi+ecx-8], eax mov PD [edi+ecx-4], edx mov eax, PD [esi+ecx-8-8] ; speculatively load next 8 pels mov edx, PD [esi+ecx-4-8] ; this avoids AGI sub ecx, 8 jg VLoop Lecx FrameWidth add esi,ebx shr ecx,1 add edi,ebx dec ebp jne VLoopHeader ; We copy 8 pels in one iteration of the inner loop ; Register usage: ; edi -- U plane output cursor ; esi -- U plane input cursor ; ebp -- Count down U plane height ; ecx -- Count down U plane width ; ebx -- Pitch ; eax,edx -- scratch Lebp FrameHeight Lecx FrameWidth sar ecx,1 Lesi UPlane sar ebp,1 Ledi UOutputPlane ALIGN 4 ULoopHeader: mov eax,PD [esi+ecx-8] mov edx,PD [esi+ecx-4] ULoop: shr eax, 1 ; Shift packed pel by 1 to convert to 7-bit and edx, 0FEFEFEFEH ; and to get rid of upper bit shr edx, 1 and eax, 07F7F7F7Fh ; and to get rid of upper bit mov PD [edi+ecx-8], eax mov PD [edi+ecx-4], edx mov eax, PD [esi+ecx-8-8] mov edx, PD [esi+ecx-4-8] sub ecx, 8 jg ULoop Lecx FrameWidth add esi, ebx shr ecx, 1 add edi, ebx dec ebp jne ULoopHeader add esp,LocalFrameSize pop ebx pop ebp pop edi pop esi rturn MMX_H26x_YUV12ForEnc endp ENDIF ;H263P IFNDEF WIN32 SEGNAME ENDS ENDIF END
Appl/Art/Decks/GeoDeck/LCClub4.asm
steakknife/pcgeos
504
172475
<gh_stars>100-1000 LCClub4 label byte word C_BLACK Bitmap <71,100,BMC_PACKBITS,BMF_MONO> db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0x01, 0x00, 0x60, 0xfa, 0x00 db 0x01, 0x00, 0xe0, 0xfa, 0x00 db 0x01, 0x00, 0xe0, 0xfa, 0x00 db 0x01, 0x01, 0xe0, 0xfa, 0x00 db 0x01, 0x03, 0xe0, 0xfa, 0x00 db 0x01, 0x03, 0x60, 0xfa, 0x00 db 0x01, 0x07, 0x60, 0xfa, 0x00 db 0x05, 0x0e, 0x60, 0x01, 0xc0, 0x00, 0x07, 0xfe, 0x00 db 0x08, 0x1c, 0x60, 0x02, 0xe0, 0x00, 0x0b, 0x80, 0x00, 0x00 db 0x08, 0x1f, 0xf8, 0x05, 0xf0, 0x00, 0x17, 0xc0, 0x00, 0x00 db 0x08, 0x1f, 0xf8, 0x07, 0xf0, 0x00, 0x1f, 0xc0, 0x00, 0x00 db 0x08, 0x00, 0x60, 0x07, 0xf0, 0x00, 0x1f, 0xc0, 0x00, 0x00 db 0x08, 0x00, 0x60, 0x03, 0xe0, 0x00, 0x0f, 0x80, 0x00, 0x00 db 0x08, 0x01, 0xf8, 0x1d, 0xdc, 0x00, 0x77, 0x70, 0x00, 0x00 db 0x08, 0x01, 0xf8, 0x2e, 0xae, 0x00, 0xba, 0xb8, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x5f, 0xdf, 0x01, 0x7f, 0x7c, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x7f, 0xff, 0x01, 0xff, 0xfc, 0x00, 0x00 db 0x08, 0x01, 0xc0, 0x7f, 0xff, 0x01, 0xff, 0xfc, 0x00, 0x00 db 0x08, 0x02, 0xe0, 0x3e, 0xbe, 0x00, 0xfa, 0xf8, 0x00, 0x00 db 0x08, 0x03, 0xe0, 0x1c, 0x9c, 0x00, 0x72, 0x70, 0x00, 0x00 db 0x05, 0x03, 0xe0, 0x01, 0xc0, 0x00, 0x07, 0xfe, 0x00 db 0x08, 0x0d, 0xd8, 0x03, 0xe0, 0x00, 0x0f, 0x80, 0x00, 0x00 db 0x01, 0x17, 0xec, 0xfa, 0x00 db 0x01, 0x1f, 0xfc, 0xfa, 0x00 db 0x01, 0x1f, 0xfc, 0xfa, 0x00 db 0x01, 0x0e, 0xb8, 0xfa, 0x00 db 0x01, 0x01, 0xc0, 0xfa, 0x00 db 0x01, 0x03, 0xe0, 0xfa, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xfa, 0x00, 0x01, 0x0f, 0x80 db 0xfa, 0x00, 0x01, 0x07, 0x00 db 0xfa, 0x00, 0x01, 0x3a, 0xe0 db 0xfa, 0x00, 0x01, 0x5f, 0x70 db 0xfa, 0x00, 0x01, 0x7f, 0xf0 db 0xfa, 0x00, 0x01, 0x7f, 0xf0 db 0x08, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x0f, 0x80, 0x37, 0x60 db 0x08, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x07, 0x00, 0x0a, 0x80 db 0x08, 0x00, 0x00, 0x1c, 0x9c, 0x00, 0x72, 0x70, 0x0f, 0x80 db 0x08, 0x00, 0x00, 0x2e, 0xae, 0x00, 0xba, 0xb8, 0x0f, 0x80 db 0x08, 0x00, 0x00, 0x5f, 0xdf, 0x01, 0x7f, 0x7c, 0x07, 0x00 db 0x08, 0x00, 0x00, 0x7f, 0xff, 0x01, 0xff, 0xfc, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x7f, 0xff, 0x01, 0xff, 0xfc, 0x00, 0x00 db 0x08, 0x00, 0x00, 0x3e, 0xbe, 0x00, 0xfa, 0xf8, 0x3f, 0x00 db 0x08, 0x00, 0x00, 0x1d, 0xdc, 0x00, 0x77, 0x70, 0x3f, 0x00 db 0x08, 0x00, 0x00, 0x02, 0xe0, 0x00, 0x0b, 0x80, 0x0c, 0x00 db 0x08, 0x00, 0x00, 0x05, 0xf0, 0x00, 0x17, 0xc0, 0x0c, 0x00 db 0x08, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x1f, 0xc0, 0x3f, 0xf0 db 0x08, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x1f, 0xc0, 0x3f, 0xf0 db 0x08, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x0f, 0x80, 0x0c, 0x70 db 0x08, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x07, 0x00, 0x0c, 0xe0 db 0xfa, 0x00, 0x01, 0x0d, 0xc0 db 0xfa, 0x00, 0x01, 0x0d, 0x80 db 0xfa, 0x00, 0x01, 0x0f, 0x80 db 0xfa, 0x00, 0x01, 0x0f, 0x00 db 0xfa, 0x00, 0x01, 0x0e, 0x00 db 0xfa, 0x00, 0x01, 0x0e, 0x00 db 0xfa, 0x00, 0x01, 0x0c, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00 db 0xf8, 0x00
Driver/Net/NW/nwBindery.asm
steakknife/pcgeos
504
174617
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: nwBindery.asm AUTHOR: <NAME> ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 9/28/92 Initial version. DESCRIPTION: Common code to deal with the NetWare bindery $Id: nwBindery.asm,v 1.1 97/04/18 11:48:41 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ NetWareResidentCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NetWareObject %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Small fixed-code routine to pass off the "object" functions. CALLED BY: NetWareStrategy. PASS: al - NetObjectFunction to call RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 11/30/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ NetWareObject proc near call NetWareRealObject ret NetWareObject endp NetWareResidentCode ends NetWareCommonCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NetWareRealObject %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: "Real" object function -- in movable code resource. CALLED BY: NetWareObject PASS: al - NetObjectFunction to call RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 11/30/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ NetWareRealObject proc far clr ah mov_tr di, ax EC < cmp di, NetPrintFunction > EC < ERROR_AE NW_ERROR_INVALID_DRIVER_FUNCTION > call cs:[netWareObjectCalls][di] .leave ret NetWareRealObject endp netWareObjectCalls nptr \ offset NetWareObjectReadPropertyValue, offset NetWareObjectEnumProperties .assert (size netWareObjectCalls eq NetObjectFunction) COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NetWareObjectReadPropertyValue %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return the property of a given object CALLED BY: NetWareRealObject, NetWareUserGetFullName PASS: ss:bx - NetObjectReadPropertyValueStruct RETURN: nothing DESTROYED: es,di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 11/30/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ NetWareObjectReadPropertyValue proc near uses ds,si,bx,bp,cx,dx .enter mov bp, bx ; ss:bp - NetObjectReadPropertyValueStruct ; ; Allocate the request and reply buffers ; mov bx, size NReqBuf_ReadPropertyValue mov cx, size NRepBuf_ReadPropertyValue call NetWareAllocRRBuffers mov ax, ss:[bp].NORPVS_objectType mov es:[si].NREQBUF_RPV_objectType, ax ; ; Copy the object name into the request buffer. Store length ; in DX ; push di, si mov bx, si ; es:bx - request buf lea di, es:[si].NREQBUF_RPV_objectName lds si, ss:[bp].NORPVS_objectName call NetWareCopyStringButNotNull ; es:di - next byte in ; request buf EC < cmp cx, size NetObjectName > EC < ERROR_A STRING_BUFFER_OVERFLOW > mov es:[bx].NREQBUF_RPV_objectNameLen, cl ; ; store the initial segment number in the next byte -- leave a ; byte available to store the property length, which we'll ; fill in after we figure it out. ; mov {byte} es:[di], NW_BINARY_OBJECT_PROPERTY_INITIAL_SEGMENT inc di mov bx, di ; address of property length inc di ; ; Copy in the property name, and store its length ; lds si, ss:[bp].NORPVS_propertyName call NetWareCopyStringButNotNull ; cx - # chars in prop name EC < cmp cx, size NetPropertyName > EC < ERROR_A STRING_BUFFER_OVERFLOW > mov es:[bx], cl mov_tr ax, di ; ax - one byte AFTER last ; byte written pop di, si ;es:si - request, es:di - reply ; ;calculate the size of this request buffer, and place it at ;the beginning of the buffer sub ax, si sub ax, 2 mov es:[si].NREQBUF_RPV_length, ax ;now call NetWare to get the property's value callNW:: mov ax, NFC_READ_PROPERTY_VALUE call NetWareCallFunctionRR ;call NetWare, passing RR buffer jc done ;see if there will be another segment of data EC < tst es:[di].NREPBUF_RPV_moreSegments > EC < ERROR_NZ NW_ERROR_BAD_ASSUMPTION_THIS_PROPERTY_HAS_MORE_DATA_SEGMENTS > ; ; Copy the value into the caller's buffer ; segmov ds, es lea si, ds:[di].NREPBUF_RPV_propertyValue les di, ss:[bp].NORPVS_buffer mov cx, ss:[bp].NORPVS_bufferSize rep movsb segmov es, ds done: call NetWareFreeRRBuffers .leave ret NetWareObjectReadPropertyValue endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NetWareGetBinderyObjectID %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: High-level function to return the ID of an object, given its name CALLED BY: internal (NWPRedirectPort, NetWareUserCheckIfInGroup) PASS: ds:si - name of object ax - object type RETURN: IF ERROR: carry set al - error code ELSE: carry clear cx:dx - object ID DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 9/28/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ NetWareGetBinderyObjectID proc far uses ax,bx,di,si .enter push si mov bx, size NReqBuf_GetBinderyObjectID mov cx, size NRepBuf_GetBinderyObjectID call NetWareAllocRRBuffers ; es - rr buffers mov es:[si].NREQBUF_GBOID_objectType, ax mov bx, si ; es:bx - request buf pop si ; ; Copy the name into the request buffer, and determine its length ; clr cx push di lea di, es:[bx].NREQBUF_GBOID_objectName startLoop: lodsb stosb inc cx tst al jnz startLoop dec cx pop di ; es:di - reply buf mov si, bx ; es:si - request buf mov es:[si].NREQBUF_GBOID_objectNameLen, cl mov ax, NFC_GET_BINDERY_OBJECT_ID call NetWareCallFunctionRR jc done ; Move low word of HiLoDWord into DX movdw dxcx, es:[di].NREPBUF_GBOID_objectID mov bx, es:[NRR_handle] call MemFree clc done: .leave ret NetWareGetBinderyObjectID endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NetWareGetBinderyObjectName %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Return the name of a bindery object, given its ID CALLED BY: NWPGetCaptureQueue PASS: ds:si - buffer to fill in dx:ax - NetWareBinderyObjectID (dx - HIGH word as defined by Novell (ie, first word) RETURN: if error carry set else carry clear buffer filled in DESTROYED: ax,bx,cx,dx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 11/14/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ NetWareGetBinderyObjectName proc near uses si,es,di,bp .enter mov bp, si ; dest ptr mov bx, size NReqBuf_GetBinderyObjectName mov cx, size NRepBuf_GetBinderyObjectName call NetWareAllocRRBuffers movdw es:[si].NREQBUF_GBON_objectID, axdx mov ax, NFC_GET_BINDERY_OBJECT_NAME call NetWareCallFunctionRR jc freeBuffers ; ; Copy the data out ; lea si, es:[di].NREPBUF_GBON_objectName mov di, bp segxchg ds, es ; es:di - dest call NetWareCopyNTString segxchg ds, es clc freeBuffers: call NetWareFreeRRBuffers .leave ret NetWareGetBinderyObjectName endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% NetWareObjectEnumProperties %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Build a list of the properties defined for this object CALLED BY: NetWareRealObject PASS: ds - segment of NetEnumCallbackData cx:dx - NetObjectName bx - NetObjectType RETURN: nothing DESTROYED: es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- chrisb 12/20/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ NetWareObjectEnumProperties proc near uses ax,bx,cx,dx,di,si,bp .enter ; ; Allocate the request and reply buffers. ; push bx push cx mov bx, size NReqBuf_ScanProperty mov cx, size NRepBuf_ScanProperty call NetWareAllocRRBuffers pop cx pop es:[si].NREQBUF_SP_objectType ; ; Fill in the CallbackData fields ; mov ds:[NECD_curElement].segment, es lea ax, es:[di].NREPBUF_SP_propertyName mov ds:[NECD_curElement].offset, ax ; ; Fill in fields of request buffer ; push di push ds, si mov ds, cx lea di, es:[si].NREQBUF_SP_objectName mov si, dx call NetWareCopyStringButNotNull EC < cmp cx, size NREQBUF_SP_objectName > EC < ERROR_A STRING_BUFFER_OVERFLOW > pop ds, si mov es:[si].NREQBUF_SP_objectNameLen, cl ; ; Now, ES:DI is pointing at the sequenceNumber field. Save ; the offset in BX so that we can update this field on each ; iteration. ; mov bx, di mov ax, -1 stosw stosw ; NREQBUF_SP_sequenceNumber mov ax, 1 stosb ; NREQBUF_SP_propertyNameLen ; ; ; CheckHack <size wildcard eq 2> CheckHack <segment wildcard eq @CurSeg> mov ax, {word} cs:[wildcard] stosw ; NREQBUF_SP_propertyName pop di startLoop: ; ; Make the next call ; mov ax, NFC_SCAN_PROPERTY call NetWareCallFunctionRR jnc continue cmp al, 0xFB ; netware return code that ; signifies valid end of loop, ; according to the docs... je done stc jmp done continue: ; ; Call the callback routine to add our data to the caller's ; buffer. ; call NetEnumCallback tst es:[di].NREPBUF_SP_moreProperties jz done ; ; Copy the sequence number from the reply buffer back to the ; request buffer, and continue ; movdw es:[bx], es:[di].NREPBUF_SP_sequenceNumber, ax jmp startLoop done: ; ; Free the request / reply buffers ; call NetWareFreeRRBuffers .leave ret NetWareObjectEnumProperties endp NetWareCommonCode ends
programs/oeis/175/A175660.asm
karttu/loda
0
175472
<gh_stars>0 ; A175660: Eight bishops and one elephant on a 3 X 3 chessboard. a(n) = 2^(n+2) - 3*F(n+2). ; 1,2,7,17,40,89,193,410,859,1781,3664,7493,15253,30938,62575,126281,254392,511745,1028281,2064314,4141171,8302637,16638112,33329357,66744685,133628474,267482023,535328225,1071245704,2143444841,4288432369,8579360858,17162760523,34332055973,68674685680,137366480021,274760642437,549566075930,1099204625311,2198526515129,4397242768216,8794792538897,17590081818217,35180967379322,70363235241955,140728574710109,281460554129728,562926617195165,1125862148035549,2251738718652026,4503500773530199,9007039305867473 mov $1,3 mov $2,$0 mov $3,4 lpb $2,1 mov $0,$1 sub $0,1 add $0,$3 add $1,1 trn $4,2 add $1,$4 sub $2,1 mul $3,2 mov $4,$0 lpe sub $1,2