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
|
---|---|---|---|---|
oeis/020/A020901.asm
|
neoneye/loda-programs
| 11 |
173786
|
; A020901: Greatest k such that k-th prime < 3 times n-th prime.
; Submitted by <NAME>(s3)
; 3,4,6,8,11,12,15,16,19,23,24,29,30,31,34,37,40,42,46,47,47,51,53,56,61,62,63,66,66,68,75,77,80,80,86,87,91,93,95,97,99,100,105,106,107,108,115,121,123,124,125,127,128,133,136,138,139,141,145,146,146,151,157,158,159,161,167,169,175,175,177,180,184,187,189,189,192,195,197,200,204,205,210,211,214,217,217,219,221,221,222,227,232,233,238,239,241,246,247,257
mul $0,2
max $0,1
seq $0,173919 ; Numbers that are prime or one less than a prime.
mul $0,3
sub $0,1
seq $0,230980 ; Number of primes <= n, starting at n=0.
|
programs/oeis/132/A132757.asm
|
neoneye/loda
| 22 |
90191
|
<gh_stars>10-100
; A132757: a(n) = n*(n+29)/2.
; 0,15,31,48,66,85,105,126,148,171,195,220,246,273,301,330,360,391,423,456,490,525,561,598,636,675,715,756,798,841,885,930,976,1023,1071,1120,1170,1221,1273,1326,1380,1435,1491,1548,1606,1665
add $0,15
bin $0,2
sub $0,105
|
tests/simpleOO/src/dds-request_reply-tests-simple-octets_replier.ads
|
persan/dds-requestreply
| 0 |
2648
|
<filename>tests/simpleOO/src/dds-request_reply-tests-simple-octets_replier.ads
with DDS.Request_Reply.Replier.Typed_Replier_Generic;
with Dds.Builtin_Octets_DataReader;
with Dds.Builtin_Octets_DataWriter;
package DDS.Request_Reply.Tests.Simple.Octets_Replier is new
DDS.Request_Reply.Replier.Typed_Replier_Generic
(Reply_DataWriter => Dds.Builtin_Octets_DataWriter,
Request_DataReader => Dds.Builtin_Octets_DataReader);
|
gnat-sockets-connection_state_machine.ads
|
jrcarter/Ada_GUI
| 19 |
4671
|
<filename>gnat-sockets-connection_state_machine.ads
-- --
-- package Copyright (c) <NAME> --
-- GNAT.Sockets.Connection_State_Machine Luebeck --
-- Interface Winter, 2012 --
-- --
-- Last revision : 18:41 01 Aug 2019 --
-- --
-- This library 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 2 of --
-- the License, or (at your option) any later version. This library --
-- is distributed in the hope that it will be useful, but WITHOUT --
-- ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have --
-- received a copy of the GNU General Public License along with --
-- this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
--____________________________________________________________________--
--
-- This package provides an implementation of server's side connection
-- object that implements a state machine to receive packets from the
-- client side. The structure of a packet is described by the contents
-- of connection object itself. Fields of the object derived from a
-- special abstract type (Data_Item) fed with the input received from
-- the client in the order they are declared in the object. Once all
-- fields are received a primitive operation is called to process the
-- packet. After that the cycle repeats.
-- Enumeration of the fields (introspection) is based on Ada stream
-- attributes. See ARM 13.13.2(9) for the legality of the approach.
--
with Ada.Finalization; use Ada.Finalization;
with Ada.Streams; use Ada.Streams;
with GNAT.Sockets.Server; use GNAT.Sockets.Server;
with System.Storage_Elements; use System.Storage_Elements;
with Generic_Unbounded_Array;
with Interfaces;
with System.Storage_Pools;
package GNAT.Sockets.Connection_State_Machine is
--
-- State_Machine -- Connection client driven by the contents. This is
-- the base type to derive from. The derived type
-- should contain a set of fields with the types derived from Data_Item.
-- These objects will be read automatically in their order.
--
type State_Machine is abstract new Connection with private;
--
-- Connected -- Overrides Connections_Server...
--
-- If the derived type overrides this procedure, it should call this one
-- from new implemetation.
--
procedure Connected (Client : in out State_Machine);
--
-- Finalize -- Destruction
--
-- Client - The connection client
--
-- This procedure is to be called from implementation when overridden.
--
procedure Finalize (Client : in out State_Machine);
--
-- Received -- Overrides GNAT.Sockets.Server...
--
procedure Received
( Client : in out State_Machine;
Data : Stream_Element_Array;
Pointer : in out Stream_Element_Offset
);
--
-- Enumerate -- Fake stream I/O procedure
--
-- This procedure is used internally in order to enumerate the contents
-- of the record type.
--
procedure Enumerate
( Stream : access Root_Stream_Type'Class;
Item : State_Machine
);
for State_Machine'Write use Enumerate;
------------------------------------------------------------------------
--
-- Data_Item -- Base type of a data item to read
--
type Data_Item is abstract
new Ada.Finalization.Limited_Controlled with null record;
type Data_Item_Ptr is access all Data_Item'Class;
type Data_Item_Offset is new Integer;
subtype Data_Item_Address is
Data_Item_Offset range 1..Data_Item_Offset'Last;
type Data_Item_Ptr_Array is
array (Data_Item_Address range <>) of Data_Item_Ptr;
--
-- Feed -- Incoming data
--
-- Item - The data item
-- Data - The array of stream elements containing incoming data
-- Pointer - The first element in the array
-- Client - The connection client
-- State - Of the data item processing
--
-- This procedure is called when data become available to get item
-- contents. The stream elements are Data (Pointer..Data'Last). The
-- procedure consumes data and advances Pointer beyond consumed elements
-- The parameter State indicates processing state. It is initially 0.
-- When Item contents is read in full State is set to 0. When State is
-- not 0 then Pointer must be set to Data'Last + 1, indicating that more
-- data required. Feed will be called again on the item when new data
-- come with the value of State returned from the last call.
--
procedure Feed
( Item : in out Data_Item;
Data : Stream_Element_Array;
Pointer : in out Stream_Element_Offset;
Client : in out State_Machine'Class;
State : in out Stream_Element_Offset
) is abstract;
--
-- Freed -- Deallocation notification
--
-- Item - The data item
--
-- This procedure is called when the shared data item is about to
-- deallocate items allocated there. See External_String_Buffer. The
-- default implementation does nothing.
--
procedure Freed (Item : in out Data_Item);
--
-- Get_Children -- Get list of immediate children
--
-- Item - The data item
--
-- Returns :
--
-- The list of immediate children (nested) data items
--
-- Exceptions :
--
-- Use_Error - The data item is not initialized
--
function Get_Children (Item : Data_Item) return Data_Item_Ptr_Array;
--
-- Get_Size -- Size of the data item in data items
--
-- Item - The data item
--
-- Returns :
--
-- The default implementation returns 1
--
function Get_Size (Item : Data_Item) return Natural;
--
-- End_Of_Subsequence -- Completion of a subsequence
--
-- Item - The data item
-- Data - The array of stream elements containing incoming data
-- Pointer - The first element in the array (can be Data'Last + 1)
-- Client - The connection client
-- State - Of the data item processing
--
-- This procedure is called when a subsequence of data items has been
-- processed. Item is the data item which was active prior to sequence
-- start. It is called only if the data item was not completed, i.e.
-- State is not 0. When the implementation changes State to 0 processing
-- of the data item completes and the next item is fetched. Note that
-- differently to Feed Pointer may point beyond Data when all available
-- input has been processed. The default implementation does nothing.
--
procedure End_Of_Subsequence
( Item : in out Data_Item;
Data : Stream_Element_Array;
Pointer : Stream_Element_Offset;
Client : in out State_Machine'Class;
State : in out Stream_Element_Offset
);
--
-- Enumerate -- Fake stream I/O procedure
--
-- This procedure is used internally in order to enumerate the contents
-- of the record type, a descendant of Connection. The elements of the
-- record type derived from Data_Item are ones which will be fed with
-- data received from the socket.
--
procedure Enumerate
( Stream : access Root_Stream_Type'Class;
Item : Data_Item
);
for Data_Item'Write use Enumerate;
type Shared_Data_Item;
type Shared_Data_Item_Ptr is access all Shared_Data_Item'Class;
--
-- External_Initialize
--
-- Item - The data item
-- Shared - The shared items stack to use
--
-- This procedure is used to initialize an object when it is used
-- outside an instance of State_Machine.
--
procedure External_Initialize
( Item : Data_Item'Class;
Shared : Shared_Data_Item_Ptr := null
);
--
-- Shared_Data_Item -- Base type for shared items
--
type Shared_Data_Item is abstract new Data_Item with record
Initialized : Boolean := False;
Previous : Shared_Data_Item_Ptr; -- Stacked items
end record;
--
-- Enumerate -- Fake stream I/O procedure
--
procedure Enumerate
( Stream : access Root_Stream_Type'Class;
Item : Shared_Data_Item
);
for Shared_Data_Item'Write use Enumerate;
--
-- Feed -- Implementation, makes the shared item active
--
procedure Feed
( Item : in out Shared_Data_Item;
Data : Stream_Element_Array;
Pointer : in out Stream_Element_Offset;
Client : in out State_Machine'Class;
State : in out Stream_Element_Offset
);
------------------------------------------------------------------------
-- Data_Block -- Base type of a sequence of data items. Derived data
-- types contain fields derived from Data_Item.
--
type Data_Block is abstract new Data_Item with private;
--
-- Feed -- Implementation
--
procedure Feed
( Item : in out Data_Block;
Data : Stream_Element_Array;
Pointer : in out Stream_Element_Offset;
Client : in out State_Machine'Class;
State : in out Stream_Element_Offset
);
--
-- Enumerate -- Fake stream I/O procedure
--
procedure Enumerate
( Stream : access Root_Stream_Type'Class;
Item : Data_Block
);
for Data_Block'Write use Enumerate;
--
-- Finalize -- Destruction
--
-- Item - Being finalized
--
-- To be called the from derived type's Finalize if overridden
--
procedure Finalize (Item : in out Data_Block);
--
-- Get_Children -- Overriding
--
function Get_Children (Item : Data_Block) return Data_Item_Ptr_Array;
--
-- Get_Length -- The number of items contained by the block item
--
-- Item - The block item
--
-- Exceptions :
--
-- Use_Error - The block was not initialized yet
--
function Get_Length (Item : Data_Block) return Positive;
--
-- Get_Size -- Overriding
--
function Get_Size (Item : Data_Block) return Natural;
------------------------------------------------------------------------
-- Data_Null -- No data item, used where a data item is required
--
type Data_Null is new Data_Item with null record;
--
-- Feed -- Implementation
--
procedure Feed
( Item : in out Data_Null;
Data : Stream_Element_Array;
Pointer : in out Stream_Element_Offset;
Client : in out State_Machine'Class;
State : in out Stream_Element_Offset
);
------------------------------------------------------------------------
-- Data_Selector -- Base type of a list of data items selected
-- alternatively. A derived type has fields derived
-- from Data_Item. One of the fields is used at a time. So the type
-- acts as a variant record. The field to select is set by calling
-- Set_Alternative. Usually it is done from Feed of some descendant
-- derived from Data_Item, placed after the field controlling selection
-- of the alternative. When an alternative should enclose several fields
-- a Data_Block descendant is used.
--
type Data_Selector is new Data_Item with private;
--
-- Feed -- Implementation
--
procedure Feed
( Item : in out Data_Selector;
Data : Stream_Element_Array;
Pointer : in out Stream_Element_Offset;
Client : in out State_Machine'Class;
State : in out Stream_Element_Offset
);
--
-- Finalize -- Destruction
--
-- Item - Being finalized
--
-- To be called the from derived type's Finalize if overridden
--
procedure Finalize (Item : in out Data_Selector);
--
-- Get_Alternative -- The currently selected alternative
--
-- Item - Selector item
--
-- Returns :
--
-- The alternative number 1..
--
function Get_Alternative (Item : Data_Selector) return Positive;
--
-- Get_Alternatives_Number -- The number of alternatives
--
-- Item - Selector item
--
-- Returns :
--
-- The total number of alternatives
--
-- Exceptions :
--
-- Use_Error - The selector was not initialized yet
--
function Get_Alternatives_Number (Item : Data_Selector)
return Positive;
--
-- Get_Children -- Overriding
--
function Get_Children
( Item : Data_Selector
) return Data_Item_Ptr_Array;
--
-- Enumerate -- Fake stream I/O procedure
--
procedure Enumerate
( Stream : access Root_Stream_Type'Class;
Item : Data_Selector
);
for Data_Selector'Write use Enumerate;
--
-- Set_Alternative -- Select an alternative
--
-- Item - Selector item
-- Alternative - To select (number 1..Get_Alternatives_Number (Item))
--
-- Exceptions :
--
-- Constraint_Error - Invalid alternative number
-- Use_Error - The selector was not initialized yet
--
procedure Set_Alternative
( Item : in out Data_Selector;
Alternative : Positive
);
--
-- Get_Size -- Overriding
--
function Get_Size (Item : Data_Selector) return Natural;
------------------------------------------------------------------------
--
-- External_String_Buffer -- The arena buffer to keep bodies of strings
-- and dynamically allocated elements. This
-- buffer can be shared by multiple instances of Data_Item. For example:
--
-- type Alternatives_Record is new Choice_Data_Item with record
-- Text_1 : Implicit_External_String_Data_Item;
-- Text_2 : Implicit_External_String_Data_Item;
-- Text_3 : Implicit_External_String_Data_Item;
-- end record;
-- type Packet is new State_Machine ... with record
-- Buffer : External_String_Buffer (1024); -- Shared buffer
-- Choice : Alternatives_Record;
-- end record;
--
-- When several buffers appear the nearest one before the data item
-- object is used.
--
type External_String_Buffer;
type External_String_Buffer_Ptr is
access all External_String_Buffer'Class;
--
-- Arena_Pool -- The pool component of the External_String_Buffer that
-- allocates memory as substrings in the buffer.
--
-- Parent - The buffer to take memory from
--
type Arena_Pool
( Parent : access External_String_Buffer'Class
) is new System.Storage_Pools.Root_Storage_Pool with
null record;
--
-- Allocate -- Allocate memory
--
-- The memory is allocated in the string buffer as a string.
--
procedure Allocate
( Pool : in out Arena_Pool;
Address : out System.Address;
Size : Storage_Count;
Alignment : Storage_Count
);
--
-- Deallocate -- Free memory
--
-- This a null operation. The memory is freed by Erase
--
procedure Deallocate
( Pool : in out Arena_Pool;
Address : System.Address;
Size : Storage_Count;
Alignment : Storage_Count
);
function Storage_Size
( Pool : Arena_Pool
) return Storage_Count;
procedure Enumerate
( Stream : access Root_Stream_Type'Class;
Pool : Arena_Pool
);
for Arena_Pool'Write use Enumerate;
--
-- Allocator_Data -- The allocator's list. The users of the pool
-- register themselves in order to get notifications
-- upon erasing the buffer. They should finalize all objects then have
-- allocated in the pool.
--
type Allocator_Data;
type Allocator_Data_Ptr is access all Allocator_Data;
type Allocator_Data (Allocator : access Data_Item'Class) is record
Previous : Allocator_Data_Ptr; -- List of allocators
end record;
type External_String_Buffer (Size : Natural) is
new Shared_Data_Item with
record
Pool : Arena_Pool (External_String_Buffer'Access);
Length : Natural := 0;
Count : Natural := 0; -- Allocatied items
Allocators : Allocator_Data_Ptr; -- List of objects using the pool
Buffer : String (1..Size);
end record;
--
-- Erase -- Deallocate all elements and all strings
--
-- Buffer - The buffer
--
-- The implementation walks the list of allocators to notify them that
-- the allocated items will be freed. The callee must finalize its
-- elements if necessary.
--
procedure Erase (Buffer : in out External_String_Buffer);
--
-- Feed -- Implementation of the feed operation
--
-- The implementation erases the buffer.
--
procedure Feed
( Item : in out External_String_Buffer;
Data : Stream_Element_Array;
Pointer : in out Stream_Element_Offset;
Client : in out State_Machine'Class;
State : in out Stream_Element_Offset
);
--
-- Fnalize -- Destruction
--
-- Buffer - The buffer
--
-- The derived type must call this if it overrides it.
--
procedure Finalize (Buffer : in out External_String_Buffer);
------------------------------------------------------------------------
generic
with procedure Put (Text : String) is <>;
with procedure Put_Line (Line : String) is <>;
package Generic_Dump is
--
-- Put -- Allocator list
--
-- Buffer - The external string buffer
-- Prefix - Of the output lines
--
procedure Put
( Buffer : in out External_String_Buffer;
Prefix : String
);
--
-- Put -- List item structure recursively
--
-- Item - The data item
-- Prefix - Of the output lines
--
procedure Put
( Item : Data_Item'Class;
Prefix : String := ""
);
--
-- Put_Call_Stack -- List the call stack of the state machine
--
-- Client - The state machine
-- Prefix - Of the output lines
--
procedure Put_Call_Stack
( Client : State_Machine'Class;
Prefix : String := ""
);
--
-- Put_Stream -- Stream and dump the result list
--
-- Item - The data item
-- Prefix - Of the output lines
--
procedure Put_Stream
( Item : Data_Item'Class;
Prefix : String := ""
);
end Generic_Dump;
private
use Interfaces;
Out_Of_Bounds : constant String := "Pointer is out of bounds";
No_Room : constant String := "No room for output";
package Data_Item_Arrays is
new Generic_Unbounded_Array
( Index_Type => Data_Item_Address,
Object_Type => Data_Item_Ptr,
Object_Array_Type => Data_Item_Ptr_Array,
Null_Element => null
);
use Data_Item_Arrays;
type Data_Item_Ptr_Array_Ptr is access Data_Item_Ptr_Array;
procedure Free is
new Ada.Unchecked_Deallocation
( Data_Item_Ptr_Array,
Data_Item_Ptr_Array_Ptr
);
type Sequence;
type Sequence_Ptr is access all Sequence;
type Sequence (Length : Data_Item_Address) is record
Caller : Sequence_Ptr;
State : Stream_Element_Offset := 0; -- Saved caller's state
Current : Data_Item_Offset := 1;
List : Data_Item_Ptr_Array (1..Length);
end record;
procedure Free is
new Ada.Unchecked_Deallocation (Sequence, Sequence_Ptr);
type State_Type is (Feeding, Packet_Processing);
type State_Machine is abstract new Connection with record
State : Stream_Element_Offset := 0;
Start : Stream_Element_Offset := 0; -- Saved pointer
Fed : Unsigned_64 := 0; -- Running count of octets processed
Data : Sequence_Ptr;
end record;
procedure Call
( Client : in out State_Machine;
Pointer : Stream_Element_Offset;
Data : Sequence_Ptr;
State : Stream_Element_Offset := 0
);
type Shared_Data_Item_Ptr_Ptr is access all Shared_Data_Item_Ptr;
type Initialization_Stream is new Root_Stream_Type with record
Shared : aliased Shared_Data_Item_Ptr; -- The latest shared item
Parent : Shared_Data_Item_Ptr_Ptr;
Count : Data_Item_Offset := 0;
Ignore : Data_Item_Offset := 0;
Data : Unbounded_Array;
end record;
procedure Add
( Stream : in out Initialization_Stream;
Item : Data_Item'Class;
Nested : Data_Item_Offset := 0
);
procedure Read
( Stream : in out Initialization_Stream;
Item : out Stream_Element_Array;
Last : out Stream_Element_Offset
);
procedure Write
( Stream : in out Initialization_Stream;
Item : Stream_Element_Array
);
function Get_Prefix (Stream : Root_Stream_Type'Class) return String;
procedure Set_Prefix
( Stream : Root_Stream_Type'Class;
Prefix : Natural
);
procedure Check_Initialization_Stream
( Item : Data_Item'Class;
Stream : Root_Stream_Type'Class
);
function To_Integer (Value : Unsigned_8 ) return Integer_8;
function To_Integer (Value : Unsigned_16) return Integer_16;
function To_Integer (Value : Unsigned_32) return Integer_32;
function To_Integer (Value : Unsigned_64) return Integer_64;
pragma Inline (To_Integer);
function To_Unsigned (Value : Integer_8 ) return Unsigned_8;
function To_Unsigned (Value : Integer_16) return Unsigned_16;
function To_Unsigned (Value : Integer_32) return Unsigned_32;
function To_Unsigned (Value : Integer_64) return Unsigned_64;
pragma Inline (To_Unsigned);
function Self (Item : Data_Item'Class) return Data_Item_Ptr;
type Data_Block_Ptr is access all Data_Block'Class;
type Data_Block is new Data_Item with record
Data : Sequence_Ptr;
Initialized : Boolean := False;
end record;
function Self (Item : Data_Block'Class) return Data_Block_Ptr;
type Sequence_Array is array (Positive range <>) of Sequence_Ptr;
type Alternatives_List (Size : Natural) is record
List : Sequence_Array (1..Size);
end record;
type Alternatives_List_Ptr is access Alternatives_List;
type Data_Selector_Ptr is access all Data_Selector'Class;
type Data_Selector is new Data_Item with record
Alternatives : Alternatives_List_Ptr;
Current : Positive := 1;
Initialized : Boolean := False;
end record;
function Self (Item : Data_Selector'Class) return Data_Selector_Ptr;
function Self (Item : Shared_Data_Item'Class)
return Shared_Data_Item_Ptr;
generic
with procedure Put_Line (Line : String) is <>;
procedure Generic_Dump_Stream
( Stream : Initialization_Stream'Class;
Prefix : String := ""
);
end GNAT.Sockets.Connection_State_Machine;
|
oeis/152/A152035.asm
|
neoneye/loda-programs
| 11 |
243603
|
<filename>oeis/152/A152035.asm
; A152035: G.f.: (1-2*x^2)/(1-2*x-2*x^2).
; Submitted by <NAME>
; 1,2,4,12,32,88,240,656,1792,4896,13376,36544,99840,272768,745216,2035968,5562368,15196672,41518080,113429504,309895168,846649344,2313089024,6319476736,17265131520,47169216512,128868696064,352075825152,961889042432,2627929735168,7179637555200,19615134580736
mov $2,1
lpb $0
sub $0,1
add $2,$4
mul $2,2
mov $4,$3
mov $3,$2
lpe
mov $0,$2
|
data/gfx.asm
|
martendo7/cookie-shooter-gb
| 3 |
246441
|
SECTION "Sprite Tiles", ROM0
SpriteTiles::
INCBIN "res/sprite-tiles.2bpp"
.end::
SECTION "In-Game Tiles", ROM0
InGameTiles::
INCBIN "res/in-game-tiles.2bpp"
INCBIN "res/power-ups.2bpp"
.end::
SECTION "Status Bar Map", ROM0
StatusBarMap::
INCBIN "res/status-bar.tilemap"
SECTION "Paused Strip Map", ROM0
PausedStripMap::
INCBIN "res/paused-strip.tilemap"
SECTION "Title Screen $9000 Tiles", ROM0
TitleScreen9000Tiles::
INCBIN "res/title-screen.2bpp", 0, (8 * 2) * $80
.end::
SECTION "Title Screen $8800 Tiles", ROM0
TitleScreen8800Tiles::
INCBIN "res/title-screen.2bpp", (8 * 2) * $80
.end::
SECTION "Title Screen Map", ROM0
TitleScreenMap::
INCBIN "res/title-screen.tilemap"
SECTION "Action Select Screen Tiles", ROM0
ActionSelectTiles::
INCBIN "res/action-select.2bpp"
.end::
SECTION "Action Select Screen Map", ROM0
ActionSelectMap::
INCBIN "res/action-select.tilemap"
SECTION "Mode Select Screen Tiles", ROM0
ModeSelectTiles::
INCBIN "res/mode-select.2bpp"
.end::
SECTION "Mode Select Screen Map", ROM0
ModeSelectMap::
INCBIN "res/mode-select.tilemap"
SECTION "Game Over Screen Tiles", ROM0
GameOverTiles::
INCBIN "res/game-over.2bpp"
.end::
SECTION "Game Over Screen Map", ROM0
GameOverMap::
INCBIN "res/game-over.tilemap"
SECTION "Top Scores Screen Tiles", ROM0
TopScoresTiles::
INCBIN "res/top-scores.2bpp"
INCBIN "res/top-scores-numbers.2bpp"
.end::
SECTION "Top Scores Screen Map", ROM0
TopScoresMap::
INCBIN "res/top-scores.tilemap"
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/varsize3_2.adb
|
best08618/asylo
| 7 |
30734
|
-- { dg-do compile }
with Varsize3_Pkg1; use Varsize3_Pkg1;
procedure Varsize3_2 is
Filter : constant Object := True;
begin
null;
end;
|
test/interaction/Issue4917.agda
|
cruhland/agda
| 1,989 |
14832
|
<reponame>cruhland/agda
data D (A : Set) : Set₁ where
|
oeis/173/A173184.asm
|
neoneye/loda-programs
| 11 |
177828
|
; A173184: Partial sums of A000166.
; Submitted by <NAME>
; 1,1,2,4,13,57,322,2176,17009,150505,1485466,16170036,192384877,2483177809,34554278858,515620794592,8212685046337,139062777326001,2494364438359954,47245095998005060,942259727190907181
mov $2,1
lpb $0
sub $0,1
mul $2,$0
mov $1,$2
add $3,1
add $2,$3
mov $3,$1
lpe
mov $0,$2
|
alloy4fun_models/trashltl/models/11/gHBxPoQH7iNu5i92g.als
|
Kaixi26/org.alloytools.alloy
| 0 |
4596
|
open main
pred idgHBxPoQH7iNu5i92g_prop12 {
all f: File |always f in Trash
}
pred __repair { idgHBxPoQH7iNu5i92g_prop12 }
check __repair { idgHBxPoQH7iNu5i92g_prop12 <=> prop12o }
|
test/Succeed/Issue3256/B.agda
|
cruhland/agda
| 1,989 |
8059
|
{-# OPTIONS --allow-unsolved-metas #-}
module Issue3256.B where
f : (a : Set) -> a -> a
f a y = {!!} y
|
src/sys/streams/util-streams.adb
|
My-Colaborations/ada-util
| 0 |
993
|
<filename>src/sys/streams/util-streams.adb
-----------------------------------------------------------------------
-- util-streams -- Stream utilities
-- Copyright (C) 2010, 2011, 2016, 2018, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Interfaces;
package body Util.Streams is
use Ada.Streams;
subtype Offset is Ada.Streams.Stream_Element_Offset;
-- ------------------------------
-- Copy the input stream to the output stream until the end of the input stream
-- is reached.
-- ------------------------------
procedure Copy (From : in out Input_Stream'Class;
Into : in out Output_Stream'Class) is
Buffer : Stream_Element_Array (0 .. 4_096);
Last : Stream_Element_Offset;
begin
loop
From.Read (Buffer, Last);
if Last > Buffer'First then
Into.Write (Buffer (Buffer'First .. Last));
end if;
exit when Last < Buffer'Last;
end loop;
end Copy;
-- ------------------------------
-- Copy the stream array to the string.
-- The string must be large enough to hold the stream array
-- or a Constraint_Error exception is raised.
-- ------------------------------
procedure Copy (From : in Ada.Streams.Stream_Element_Array;
Into : in out String) is
Pos : Positive := Into'First;
begin
for I in From'Range loop
Into (Pos) := Character'Val (From (I));
Pos := Pos + 1;
end loop;
end Copy;
-- ------------------------------
-- Copy the string to the stream array.
-- The stream array must be large enough to hold the string
-- or a Constraint_Error exception is raised.
-- ------------------------------
procedure Copy (From : in String;
Into : in out Ada.Streams.Stream_Element_Array) is
Pos : Ada.Streams.Stream_Element_Offset := Into'First;
begin
for I in From'Range loop
Into (Pos) := Character'Pos (From (I));
Pos := Pos + 1;
end loop;
end Copy;
-- ------------------------------
-- Write a raw character on the stream.
-- ------------------------------
procedure Write (Stream : in out Output_Stream'Class;
Item : in Character) is
Buf : constant Ada.Streams.Stream_Element_Array (1 .. 1)
:= (1 => Ada.Streams.Stream_Element (Character'Pos (Item)));
begin
Stream.Write (Buf);
end Write;
-- ------------------------------
-- Write a wide character on the stream doing some conversion if necessary.
-- The default implementation translates the wide character to a UTF-8 sequence.
-- ------------------------------
procedure Write_Wide (Stream : in out Output_Stream'Class;
Item : in Wide_Wide_Character) is
use Interfaces;
Val : Unsigned_32;
Buf : Ada.Streams.Stream_Element_Array (1 .. 4);
begin
-- UTF-8 conversion
-- 7 U+0000 U+007F 1 0xxxxxxx
-- 11 U+0080 U+07FF 2 110xxxxx 10xxxxxx
-- 16 U+0800 U+FFFF 3 1110xxxx 10xxxxxx 10xxxxxx
-- 21 U+10000 U+1FFFFF 4 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
Val := Wide_Wide_Character'Pos (Item);
if Val <= 16#7f# then
Buf (1) := Ada.Streams.Stream_Element (Val);
Stream.Write (Buf (1 .. 1));
elsif Val <= 16#07FF# then
Buf (1) := Stream_Element (16#C0# or Shift_Right (Val, 6));
Buf (2) := Stream_Element (16#80# or (Val and 16#03F#));
Stream.Write (Buf (1 .. 2));
elsif Val <= 16#0FFFF# then
Buf (1) := Stream_Element (16#E0# or Shift_Right (Val, 12));
Val := Val and 16#0FFF#;
Buf (2) := Stream_Element (16#80# or Shift_Right (Val, 6));
Buf (3) := Stream_Element (16#80# or (Val and 16#03F#));
Stream.Write (Buf (1 .. 3));
else
Val := Val and 16#1FFFFF#;
Buf (1) := Stream_Element (16#F0# or Shift_Right (Val, 18));
Val := Val and 16#3FFFF#;
Buf (2) := Stream_Element (16#80# or Shift_Right (Val, 12));
Val := Val and 16#0FFF#;
Buf (3) := Stream_Element (16#80# or Shift_Right (Val, 6));
Buf (4) := Stream_Element (16#80# or (Val and 16#03F#));
Stream.Write (Buf (1 .. 4));
end if;
end Write_Wide;
procedure Write_Wide (Stream : in out Output_Stream'Class;
Item : in Wide_Wide_String) is
begin
for C of Item loop
Stream.Write_Wide (C);
end loop;
end Write_Wide;
-- ------------------------------
-- Write a raw string on the stream.
-- ------------------------------
procedure Write (Stream : in out Output_Stream'Class;
Item : in String) is
Buf : Ada.Streams.Stream_Element_Array (Offset (Item'First) .. Offset (Item'Last));
for Buf'Address use Item'Address;
begin
Stream.Write (Buf);
end Write;
end Util.Streams;
|
oeis/235/A235882.asm
|
neoneye/loda-programs
| 11 |
244143
|
; A235882: Number of (n+1) X (6+1) 0..2 arrays with the minimum plus the upper median equal to the lower median plus the maximum in every 2 X 2 subblock.
; Submitted by <NAME>(s1)
; 2571,3345,4911,8097,14631,28185,56751,118257,254391,566025,1307391,3144417,7881351,20543865,55434831,153914577,436967511,1261353705,3684967071,10856716737,32173784871,95728627545,285600432111,853630398897,2554549405431,7650964637385,22927526757951,68731845969057,206094069301191,618079270695225,1853831937672591,5560684064195217,16680428694944151,50038039089553065,150107623278104031,450309881853205377,1350903669597406311,4052659056867802905,12157873266754580271,36473411992566087537
mov $1,2
mov $2,1
lpb $0
sub $0,1
sub $1,1
add $1,$2
mov $2,$1
mul $1,2
mul $3,2
sub $3,84
lpe
sub $1,$3
mov $0,$1
sub $0,2
mul $0,9
add $0,2571
|
examples/qemu/i386/oz-x86-32-asm-001/oz.asm
|
duanev/pgdb
| 9 |
80382
|
<filename>examples/qemu/i386/oz-x86-32-asm-001/oz.asm
; OZ - A more utopian OS
; ex: set expandtab softtabstop=4 shiftwidth=4 nowrap :
;
;
; x86-32 startup
;
;
; usage:
; $ qemu-system-i386 -boot a -fda oz_fd -monitor stdio
;
; requires: nasm-2.07 or later from: http://www.nasm.us
;
; contributors:
; djv - <NAME>
;
; history:
; 2007/03/03 - 0.00.01 - djv - begin with various web examples
; http://linuxgazette.net/issue82/misc/raghu/code.asm.txt
; http://www.osdever.net/tutorials/brunmar/simple_asm.txt
; 2007/03/04 - 0.00.02 - djv - add timer interrupt support with stray int dbg
; 2007/03/05 - 0.00.03 - djv - remove stray int dbg, add mbr data struc back
; 2007/03/11 - 0.00.04 - djv - debug USB boot problem
%ifdef USB
[map symbols oz_usb.map]
%else
[map symbols oz_fd.map]
%endif
; -------- stage 1 ---------------------------------------------------------
; A classic x86 Master Boot Record
section .text start=0x7c00 ; PC BIOS boot loader entry point
codestart :
bios_entry :
cli
jmp 0:main ; load cs, skip over mbr data struct
times 6-($-$$) db 0
oemid db "oz"
times 11-($-$$) db 0
; compute the size of the kernel image in 512 byte sectors
nsectors equ codesize/512
; MS MBR (http://support.microsoft.com/kb/140418)
%ifdef FLOPPY
dw 512 ; Bytes per sector
db 1 ; Sectors per cluster
dw nsectors ; Number of reserved sectors
db 2 ; Number of FATs
dw 0x00e0 ; Number of dirs in root
dw 0x0b40 ; Number of sectors in volume
db 0xf0 ; Media descriptor
dw 9 ; Number of sectors per FAT
dw 18 ; Number of sectors per track
dw 2 ; Number of heads
dd 0 ; Number of hidden sectors
dd 0 ; Large Sectors
%endif
%ifdef USB
dw 0 ; Bytes per sector
db 0 ; Sectors per cluster
dw nsectors ; Number of reserved sectors
db 0 ; Number of FATs
dw 0 ; Number of dirs in root
dw 0 ; Number of sectors in volume
db 0 ; Media descriptor
dw 0 ; Number of sectors per FAT
dw 0 ; Number of sectors per track
dw 0 ; Number of heads
dd 0 ; Number of hidden sectors
dd 0 ; Large Sectors
%endif
; -------- protected-mode support functions --------
bits 32
align 4
IRQA equ 32 ; system timer interrupt (after remap)
int_handler_timer :
mov ax,videosel ; point gs at video memory
mov gs,ax
mov bl,byte [gs:1] ; inc the color of the first two chars
inc bl
and bl,0xf ; just the foreground
mov byte [gs:1],bl
mov byte [gs:3],bl
mov al,0x20
out 0x20,al ; signal end of interrupt (eoi)
iret
;F - white
;E - yellow
;D - magenta
;C - red
;B - cyan
;A - green
;9 - blue
;8 - dark grey
align 4
IRQB equ 33 ; keyboard interrupt (after remap)
int_handler_kbd :
cli
mov al,0x20
out 0x20,al ; signal end of interrupt (eoi)
iret
; -------- main (enter protected mode) --------
bits 16
align 2
main :
mov ax,stack_loc
mov sp,ax
xor ax,ax
mov ss,ax
mov es,ax
mov ds,ax
mov fs,ax
mov gs,ax
cld
push dx ; save BIOS drive number
mov ax,0x0600 ; ah=06h : scroll window up, if al = 0 clrscr
mov cx,0x0000 ; clear window from 0,0
mov dx,0x174f ; to 23,79
mov bh,0xf ; fill with hi white
int 0x10 ; clear screen for direct writes to video memory
mov si,bootmsg
xor bx,bx
call puts_vga_rm
; puts_vga_rm leaves gs pointing at video mem
mov byte [gs:1],0xE ; turn the first two chars yellow
mov byte [gs:3],0xE
; mov ah,0x00 ; Fn 00h of int 16h: read next character
; int 0x16 ; wait for the user to respond...
lgdt [gdtr] ; initialize the gdt
mov eax,cr0
or al,0x01 ; set the protected mode bit (lsb of cr0)
mov cr0,eax
jmp codesel:flush_ip1 ; flush the cpu instruction pipeline
flush_ip1:
bits 32 ; instructions after this point are 32bit
mov ax,datasel
mov ds,ax ; initialize the data segments
mov es,ax
mov ax,stacksel ; setup a restricted stack segment
mov ss,ax
; re-program the 8259's to move the hardware vectors
; out of the soft int range ... what were people thinking!
mov al,0x11
out 0x20,al ; init the 1st 8259
mov al,0x11
out 0xA0,al ; init the 2nd 8259
mov al,0x20
out 0x21,al ; base the 1st 8259 at 0x20
mov al,0x28
out 0xA1,al ; base the 2nd 8259 at 0x28
mov al,0x04
out 0x21,al ; set 1st 8259 as master
mov al,0x02
out 0xA1,al ; set 2nd 8259 as slave
mov al,0x01
out 0x21,al
mov al,0x01
out 0xA1,al
mov al,0x00
out 0x21,al
mov al,0x00
out 0xA1,al
; ---- debug marker
mov ax,videosel ; point gs at video memory
mov gs,ax
mov byte [gs:1],0xA ; turn the first two chars green
mov byte [gs:3],0xA
; ---- setup interrupt handlers
mov eax,int_handler_timer
mov [idt+IRQA*8],ax
mov word [idt+IRQA*8+2],codesel
mov word [idt+IRQA*8+4],0x8E00
shr eax,16
mov [idt+IRQA*8+6],ax
mov eax,int_handler_kbd
mov [idt+IRQB*8],ax
mov word [idt+IRQB*8+2],codesel
mov word [idt+IRQB*8+4],0x8E00
shr eax,16
mov [idt+IRQB*8+6],ax
lidt [idtr] ; install the idt
mov sp,stack_size ; initialize the stack
sti
idle :
hlt ; wait for interrupts
jmp idle
; ----------------------------
; puts_vga_rm - write a null delimited string to the VGA controller
; in real mode
;
; esi - address of string
; ebx - screen location (2 bytes per char, 160 bytes per line)
; eax - destroyed
; gs - destroyed
bits 16
puts_vga_rm :
mov ax,0xb800 ; point gs at video memory
mov gs,ax
puts_vga_rm_loop :
lodsb
cmp al,0
jz puts_vga_rm_done
mov [gs:bx],al
inc ebx
inc ebx
jmp puts_vga_rm_loop
puts_vga_rm_done :
ret
align 8 ; only need 4 but 8 looks nicer when debugging
codesize equ ($-codestart)
; ---------------------------------------------------------
section .data
datastart :
; -------- descriptors --------------
; Intel SW dev manual 3a, 3.4.5, pg 103
;
; In my opinion, macros for descriptor entries
; don't make the code that much more readable.
gdt :
nullsel equ $-gdt ; nullsel = 0h
dd 0,0 ; first descriptor per convention is 0
codesel equ $-gdt ; codesel = 8h 4Gb flat over all logical mem
dw 0xffff ; limit 0-15
dw 0x0000 ; base 0-15
db 0x00 ; base 16-23
db 0x9a ; present, dpl=0, code e/r
db 0xcf ; 32bit, 4k granular, limit 16-19
db 0x00 ; base 24-31
datasel equ $-gdt ; datasel = 10h 4Gb flat over all logical mem
dw 0xffff ; limit 0-15
dw 0x0000 ; base 0-15
db 0x00 ; base 16-23
db 0x92 ; present, dpl=0, data r/w
db 0xcf ; 32bit, 4k granular, limit 16-19
db 0x00 ; base 24-31
stacksel equ $-gdt ; stacksel = 18h small limited stack
dw stack_size ; limit
dw stack_loc ; base
db 0
db 0x92 ; present, dpl=0, data, r/w
db 0 ; 16bit, byte granular
db 0
videosel equ $-gdt ; videosel = 20h
dw 3999 ; limit 80*25*2-1
dw 0x8000 ; base 0xb8000
db 0x0b
db 0x92 ; present, dpl=0, data, r/w
db 0x00 ; byte granular, 16 bit
db 0x00
gdt_end :
gdtr :
dw gdt_end - gdt - 1 ; gdt length
dd gdt ; gdt physical address
idtr :
dw idt_end - idt - 1 ; length of the idt
dd idt ; address of the idt
bootmsg db "OZ v0.00.04 - 2007/03/11 ",0
times 446-codesize-($-$$) db 0 ; Fill with zeros up to the partition table
%ifdef USB
; a partition table for my 512MB USB stick
db 0x80, 0x01, 0x01, 0, 0x06, 0x10, 0xe0, 0xbe, 0x20, 0, 0, 0, 0xe0, 0x7b, 0xf, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
%else
; A default partition table that matches a 1.44MB floppy
db 0x80,0x01,0x01,0x00,0x06,0x01,0x12,0x4f
db 0x12,0x00,0x00,0x00,0x2e,0x0b,0x00,0x00
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
%endif
times 510-codesize-($-$$) db 0 ; fill with zeros up to MBR signature
dw 0x0aa55 ; write aa55 in bytes 511,512 to indicate
; that it is a boot sector.
idt equ 0x6000 ; use some of the free memory below us
idt_end equ idt+48*8 ; 32 sw + 16 remapped hw vectors
stack_loc equ 0x7000
stack_size equ 1024
datasize equ ($-datastart)
kend :
|
aspects/automator/support/Open in Terminal Vim.applescript
|
humpangle/dotfile-wincent
| 1,090 |
3365
|
<reponame>humpangle/dotfile-wincent<filename>aspects/automator/support/Open in Terminal Vim.applescript
on run argv
set source to item 1 of argv
set js to (read POSIX file source)
tell application "Automator"
set tmp to POSIX path of (path to temporary items)
set flow to make new workflow with properties {name:tmp & "Open in Terminal Vim.app"}
add Automator action "Run JavaScript" to flow
set action to first Automator action of flow
set s to first setting of action
tell s to set value to js
set home to POSIX path of (path to home folder)
save flow as "application" in (home & "bin/Open in Terminal Vim.app")
-- TODO: set icon on app
-- TODO: maybe only quit if Automator wasn't running when we started
quit
end tell
end run
|
programs/oeis/335/A335741.asm
|
neoneye/loda
| 22 |
87394
|
<gh_stars>10-100
; A335741: Number of Pell numbers (A000129) <= n.
; 1,2,3,3,3,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
mov $2,$0
add $2,1
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,105349 ; Characteristic sequence for the Pell numbers.
add $1,$0
lpe
mov $0,$1
|
oeis/079/A079727.asm
|
neoneye/loda-programs
| 11 |
240076
|
<filename>oeis/079/A079727.asm
; A079727: a(n) = 1 + C(2,1)^3 + C(4,2)^3 + ... + C(2n,n)^3.
; 1,9,225,8225,351225,16354233,805243257,41229480825,2172976383825,117106008311825,6423711336265041,357470875526646609,20131502573232075025,1145190201805448075025,65706503254247744075025,3798058180969246635083025,220966981678640207498402025,12929128355561483798860250025,760339853877134760862837250025,44916742221387560424220909250025,2664230374259738500348958382218025,158609130349394333149352592006602025,9473944338706288560616168443677450025,567613121366089858201719871564253450025
sub $3,$0
lpb $0
mov $2,$0
sub $0,1
seq $2,2897 ; a(n) = binomial(2n,n)^3.
add $3,$2
add $3,1
lpe
mov $0,$3
add $0,1
|
oeis/165/A165663.asm
|
neoneye/loda-programs
| 11 |
18124
|
<filename>oeis/165/A165663.asm
; A165663: Decimal expansion of 3 + sqrt(3).
; Submitted by <NAME>
; 4,7,3,2,0,5,0,8,0,7,5,6,8,8,7,7,2,9,3,5,2,7,4,4,6,3,4,1,5,0,5,8,7,2,3,6,6,9,4,2,8,0,5,2,5,3,8,1,0,3,8,0,6,2,8,0,5,5,8,0,6,9,7,9,4,5,1,9,3,3,0,1,6,9,0,8,8,0,0,0,3,7,0,8,1,1,4,6,1,8,6,7,5,7,2,4,8,5,7,5
mov $1,5
mov $2,1
mov $3,$0
mul $3,4
lpb $3
add $1,$2
add $1,$2
add $2,$1
sub $3,1
lpe
sub $1,1
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
|
network/bonjourDiscovery.applescript
|
adriannier/applescript-functions
| 7 |
3328
|
<gh_stars>1-10
(*
Finds all services of the specified type on the local network and returns their host's name.
*)
-- Find AFP servers
log bonjourDiscovery("afpovertcp", 0.5)
-- Find SSH servers
log bonjourDiscovery("ssh", 0.5)
on bonjourDiscovery(aServiceType, aScanTime)
-- Service types can be looked up at: http://www.dns-sd.org/ServiceTypes.html
script BonjourDiscover
property serviceType : aServiceType
property scanTime : aScanTime
property discoveryResults : {}
property discoveredNames : {}
on init()
set discoveryResults to {}
set discoveredNames to {}
end init
on discover()
set discoveryResults to runDiscoveryScript()
set discoveredNames to sortList(discoveredHostnames())
return discoveredNames
end discover
on runDiscoveryScript()
try
-- Start the script
set shellScript to {"#!/bin/bash"}
-- Use the dns-sd tool to discover services
set end of shellScript to "/usr/bin/dns-sd -B _" & serviceType & "._tcp local &"
-- Keep track of the process id for the mDNS tool
set end of shellScript to "mDNSpid=$!"
-- Wait a little for mDNS to discover services
set end of shellScript to "/bin/sleep " & (scanTime as text)
-- Quit the mDNS tool
set end of shellScript to "/bin/kill -HUP $mDNSpid"
-- Compose the script
set shellScript to joinList(shellScript, ASCII character 10)
-- Run the script
set discoverResult to do shell script shellScript
-- Get the actual results without the header
set discoverResults to paragraphs 5 thru -1 of discoverResult
return discoverResults
on error eMsg number eNum
return {}
end try
end runDiscoveryScript
on discoveredHostnames()
set hostNames to {}
set prvDlmt to text item delimiters
set text item delimiters to ("_" & serviceType & "._tcp.")
repeat with i from 1 to count of discoveryResults
try
set hostName to trim(text item 2 of (item i of discoveryResults))
if hostName is not in hostNames then set end of hostNames to hostName
end try
end repeat
set text item delimiters to prvDlmt
return hostNames
end discoveredHostnames
on trim(aText)
(* Strips a text of its surrounding white space. *)
try
if class of aText is not text then error "Wrong type."
if length of aText is 0 then return ""
----------------------------------------------------
set start_WhiteSpaceEnd to false
repeat with i from 1 to count of characters in aText
if (ASCII number (character i of aText)) > 32 and (ASCII number (character i of aText)) is not 202 then
exit repeat
else
set start_WhiteSpaceEnd to i
end if
end repeat
----------------------------------------------------
set end_WhiteSpaceStart to false
set i to count of characters in aText
repeat
if start_WhiteSpaceEnd is not false and i ≤ (start_WhiteSpaceEnd + 1) then exit repeat
if (ASCII number (character i of aText)) > 32 and (ASCII number (character i of aText)) is not 202 then
exit repeat
else
set end_WhiteSpaceStart to i
end if
set i to i - 1
end repeat
----------------------------------------------------
if start_WhiteSpaceEnd is false and end_WhiteSpaceStart is false then
return aText
else if start_WhiteSpaceEnd is not false and end_WhiteSpaceStart is false then
return text (start_WhiteSpaceEnd + 1) thru -1 of aText
else if start_WhiteSpaceEnd is false and end_WhiteSpaceStart is not false then
return text 1 thru (end_WhiteSpaceStart - 1) of aText
else if start_WhiteSpaceEnd is not false and end_WhiteSpaceStart is not false then
return text (start_WhiteSpaceEnd + 1) thru (end_WhiteSpaceStart - 1) of aText
end if
on error eMsg number eNum
log "trim: " & eMsg & " (" & (eNum as text) & ")"
error "trim: " & eMsg number eNum
end try
end trim
on joinList(aList, aDelimiter)
if aDelimiter is false then set aDelimiter to ""
set prvDlmt to text item delimiters
set text item delimiters to aDelimiter
set aList to aList as text
set text item delimiters to prvDlmt
return aList
end joinList
on sortList(aList)
set prvDlmt to text item delimiters
set text item delimiters to ASCII character 10
set tempText to aList as text
set text item delimiters to prvDlmt
try
set sortedText to do shell script "/bin/echo " & quoted form of tempText & " | /usr/bin/sort"
on error
return aList
end try
set prvDlmt to text item delimiters
set text item delimiters to ASCII character 13
set sortedList to text items of sortedText
set text item delimiters to prvDlmt
return sortedList
end sortList
end script
tell BonjourDiscover
init()
set discoverResult to discover()
end tell
return discoverResult
end discoverBonjourServicesOfType
|
oeis/132/A132696.asm
|
neoneye/loda-programs
| 11 |
97031
|
<reponame>neoneye/loda-programs<gh_stars>10-100
; A132696: Decimal expansion of 6/Pi.
; Submitted by <NAME>
; 1,9,0,9,8,5,9,3,1,7,1,0,2,7,4,4,0,2,9,2,2,6,6,0,5,1,6,0,4,7,0,1,7,2,3,4,4,4,1,3,5,1,5,7,4,8,8,8,5,4,7,7,3,8,4,9,7,2,0,0,8,1,2,8,7,0,6,7,6,1,5,7,1,6,1,0,7,1,8,4,2,1,0,8,1,3,6,5,6,3,3,1,9,5,0,3,7,0,3,1
add $0,1
mov $2,1
mov $3,$0
mul $3,4
lpb $3
mul $1,$3
mul $2,2
sub $2,1
mov $5,$3
mul $5,2
add $5,1
mul $2,$5
add $1,$2
div $1,$0
mul $1,2
div $2,$0
sub $3,1
lpe
mul $2,$5
sub $1,$2
add $2,$1
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
add $1,3
sub $4,$1
mov $0,$4
add $0,2
div $0,5
mod $0,10
|
source/features/sound.asm
|
feliposz/FelipOS
| 0 |
13099
|
<gh_stars>0
; ==========================================================
; os_speaker_tone -- Generate PC speaker tone (call os_speaker_off to turn off)
; IN: AX = note frequency divisor (from 1193182 hz of the PIT)
; OUT: Nothing (registers preserved)
os_speaker_tone:
push ax
push bx
push dx
mov cx, ax
mov al, 10110110b ; 10 = channel 2, 11 = lobyte + hibyte, 011 = square wave generator, 0 = 16 bit mode
out 43h, al ; set mode for PIT
mov al, cl
out 42h, al ; output low byte on channel 2
mov al, ch
out 42h, al ; output high byte on channel 2
in al, 61h
or al, 3 ; set bits 0-1 to turn on speaker
out 61h, al
pop dx
pop cx
pop ax
ret
; ==========================================================
; os_speaker_off -- Turn off PC speaker
; IN/OUT: Nothing (registers preserved)
os_speaker_off:
push ax
in al, 61h
and al, 0fch ; clear bits 0-1 to turn off speaker
out 61h, al
pop ax
ret
|
src/asf-components-utils-scrollers.adb
|
jquorning/ada-asf
| 12 |
2038
|
<reponame>jquorning/ada-asf
-----------------------------------------------------------------------
-- components-utils-scrollers -- Data scrollers
-- Copyright (C) 2013, 2015 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Contexts.Writer;
package body ASF.Components.Utils.Scrollers is
-- ------------------------------
-- Get the list value holder that the scroller is controlling.
-- ------------------------------
function Get_List (UI : in UIScroller;
Context : in ASF.Contexts.Faces.Faces_Context'Class)
return Holders.List_Holder_Access is
use type Base.UIComponent_Access;
Id : constant String := UI.Get_Attribute ("for", Context, "");
C : Base.UIComponent_Access;
begin
C := UI.Find (Id);
if C = null then
return null;
elsif not (C.all in Holders.List_Holder'Class) then
return null;
else
return Holders.List_Holder'Class (C.all)'Access;
end if;
end Get_List;
-- Encode the data scroller.
overriding
procedure Encode_Children (UI : in UIScroller;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
use type Holders.List_Holder_Access;
List : Holders.List_Holder_Access;
begin
if not UI.Is_Rendered (Context) then
return;
end if;
List := UIScroller'Class (UI).Get_List (Context);
if List = null then
Base.Log_Error (UI, "There is no list object associated with the scroller");
return;
end if;
declare
Id : constant Ada.Strings.Unbounded.Unbounded_String := UI.Get_Client_Id;
Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer;
Row_Count : constant Natural := List.Get_Row_Count; -- (Context);
Row_Per_Page : constant Natural := List.Get_Row_Per_Page; -- (Context);
Current_Page : constant Natural := List.Get_Current_Page; -- (Context);
Page_Count : constant Natural := (Row_Count + Row_Per_Page - 1) / Row_Per_Page;
begin
Writer.Start_Element ("div");
UI.Render_Attributes (Context, Writer);
if Current_Page > 1 then
UI.Render_Page ("first", 1, Context);
end if;
if Current_Page > 1 then
UI.Render_Page ("previous", Current_Page - 1, Context);
end if;
if Current_Page < Page_Count then
UI.Render_Page ("next", Current_Page + 1, Context);
end if;
if Current_Page < Page_Count then
UI.Render_Page ("last", Page_Count, Context);
end if;
Writer.End_Element ("div");
Writer.Queue_Script ("$('#" & Id & "').scroller();");
end;
end Encode_Children;
procedure Render_Page (UI : in UIScroller;
Name : in String;
Page : in Positive;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
use type ASF.Components.Base.UIComponent_Access;
Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer;
F : constant ASF.Components.Base.UIComponent_Access := UI.Get_Facet (Name);
begin
Writer.Start_Element ("div");
Writer.Write_Attribute ("class", "asf-scroll-" & Name);
if F /= null then
F.Encode_All (Context);
else
Writer.Write_Text (Positive'Image (Page));
end if;
Writer.End_Element ("div");
end Render_Page;
end ASF.Components.Utils.Scrollers;
|
src/Data/Nat/Properties/Extra.agda
|
metaborg/mj.agda
| 10 |
10448
|
<gh_stars>1-10
module Data.Nat.Properties.Extra where
open import Data.Nat.Base
open import Data.Nat.Properties
open import Relation.Binary.PropositionalEquality
open ≡-Reasoning
open import Data.Empty
≤′-unique : ∀ {i u} (p q : i ≤′ u) → p ≡ q
≤′-unique ≤′-refl ≤′-refl = refl
≤′-unique ≤′-refl (≤′-step q) = ⊥-elim (1+n≰n (≤′⇒≤ q))
≤′-unique (≤′-step p) ≤′-refl = ⊥-elim (1+n≰n (≤′⇒≤ p))
≤′-unique (≤′-step p) (≤′-step q) = cong ≤′-step (≤′-unique p q)
m+n+o≡n+m+o : ∀ m n o → m + (n + o) ≡ n + (m + o)
m+n+o≡n+m+o m n o = begin
m + (n + o) ≡⟨ sym (+-assoc m n o) ⟩
(m + n) + o ≡⟨ cong (λ x → x + o) (+-comm m n) ⟩
(n + m) + o ≡⟨ +-assoc n m o ⟩
n + (m + o) ∎
|
programs/oeis/021/A021823.asm
|
karttu/loda
| 0 |
168739
|
<reponame>karttu/loda<filename>programs/oeis/021/A021823.asm
; A021823: Decimal expansion of 1/819.
; 0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1,2,2,1,0,0,1
add $0,46079
lpb $0,1
add $0,1
mul $0,5
mod $0,6
lpe
mov $1,$0
|
test/asset/agda-stdlib-1.0/Data/Vec/Relation/Binary/Pointwise/Inductive.agda
|
omega12345/agda-mode
| 0 |
10329
|
<filename>test/asset/agda-stdlib-1.0/Data/Vec/Relation/Binary/Pointwise/Inductive.agda
------------------------------------------------------------------------
-- The Agda standard library
--
-- Inductive pointwise lifting of relations to vectors
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Vec.Relation.Binary.Pointwise.Inductive where
open import Algebra.FunctionProperties
open import Data.Fin using (Fin; zero; suc)
open import Data.Nat using (ℕ; zero; suc)
open import Data.Product using (_×_; _,_)
open import Data.Vec as Vec hiding ([_]; head; tail; map; lookup)
open import Data.Vec.Relation.Unary.All using (All; []; _∷_)
open import Level using (_⊔_)
open import Function using (_∘_)
open import Function.Equivalence using (_⇔_; equivalence)
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open import Relation.Nullary
------------------------------------------------------------------------
-- Relation
infixr 5 _∷_
data Pointwise {a b ℓ} {A : Set a} {B : Set b} (_∼_ : REL A B ℓ) :
∀ {m n} (xs : Vec A m) (ys : Vec B n) → Set (a ⊔ b ⊔ ℓ)
where
[] : Pointwise _∼_ [] []
_∷_ : ∀ {m n x y} {xs : Vec A m} {ys : Vec B n}
(x∼y : x ∼ y) (xs∼ys : Pointwise _∼_ xs ys) →
Pointwise _∼_ (x ∷ xs) (y ∷ ys)
length-equal : ∀ {a b m n ℓ} {A : Set a} {B : Set b} {_∼_ : REL A B ℓ}
{xs : Vec A m} {ys : Vec B n} →
Pointwise _∼_ xs ys → m ≡ n
length-equal [] = P.refl
length-equal (_ ∷ xs∼ys) = P.cong suc (length-equal xs∼ys)
------------------------------------------------------------------------
-- Operations
module _ {a b ℓ} {A : Set a} {B : Set b} {_∼_ : REL A B ℓ} where
head : ∀ {m n x y} {xs : Vec A m} {ys : Vec B n} →
Pointwise _∼_ (x ∷ xs) (y ∷ ys) → x ∼ y
head (x∼y ∷ xs∼ys) = x∼y
tail : ∀ {m n x y} {xs : Vec A m} {ys : Vec B n} →
Pointwise _∼_ (x ∷ xs) (y ∷ ys) → Pointwise _∼_ xs ys
tail (x∼y ∷ xs∼ys) = xs∼ys
lookup : ∀ {n} {xs : Vec A n} {ys : Vec B n} → Pointwise _∼_ xs ys →
∀ i → (Vec.lookup xs i) ∼ (Vec.lookup ys i)
lookup (x∼y ∷ _) zero = x∼y
lookup (_ ∷ xs∼ys) (suc i) = lookup xs∼ys i
map : ∀ {ℓ₂} {_≈_ : REL A B ℓ₂} →
_≈_ ⇒ _∼_ → ∀ {m n} → Pointwise _≈_ ⇒ Pointwise _∼_ {m} {n}
map ∼₁⇒∼₂ [] = []
map ∼₁⇒∼₂ (x∼y ∷ xs∼ys) = ∼₁⇒∼₂ x∼y ∷ map ∼₁⇒∼₂ xs∼ys
------------------------------------------------------------------------
-- Relational properties
refl : ∀ {a ℓ} {A : Set a} {_∼_ : Rel A ℓ} →
∀ {n} → Reflexive _∼_ → Reflexive (Pointwise _∼_ {n})
refl ∼-refl {[]} = []
refl ∼-refl {x ∷ xs} = ∼-refl ∷ refl ∼-refl
sym : ∀ {a b ℓ} {A : Set a} {B : Set b}
{P : REL A B ℓ} {Q : REL B A ℓ} {m n} →
Sym P Q → Sym (Pointwise P) (Pointwise Q {m} {n})
sym sm [] = []
sym sm (x∼y ∷ xs∼ys) = sm x∼y ∷ sym sm xs∼ys
trans : ∀ {a b c ℓ} {A : Set a} {B : Set b} {C : Set c}
{P : REL A B ℓ} {Q : REL B C ℓ} {R : REL A C ℓ} {m n o} →
Trans P Q R →
Trans (Pointwise P {m}) (Pointwise Q {n} {o}) (Pointwise R)
trans trns [] [] = []
trans trns (x∼y ∷ xs∼ys) (y∼z ∷ ys∼zs) =
trns x∼y y∼z ∷ trans trns xs∼ys ys∼zs
decidable : ∀ {a b ℓ} {A : Set a} {B : Set b} {_∼_ : REL A B ℓ} →
Decidable _∼_ → ∀ {m n} → Decidable (Pointwise _∼_ {m} {n})
decidable dec [] [] = yes []
decidable dec [] (y ∷ ys) = no λ()
decidable dec (x ∷ xs) [] = no λ()
decidable dec (x ∷ xs) (y ∷ ys) with dec x y
... | no ¬x∼y = no (¬x∼y ∘ head)
... | yes x∼y with decidable dec xs ys
... | no ¬xs∼ys = no (¬xs∼ys ∘ tail)
... | yes xs∼ys = yes (x∼y ∷ xs∼ys)
isEquivalence : ∀ {a ℓ} {A : Set a} {_∼_ : Rel A ℓ} →
IsEquivalence _∼_ → ∀ n →
IsEquivalence (Pointwise _∼_ {n})
isEquivalence equiv n = record
{ refl = refl (IsEquivalence.refl equiv)
; sym = sym (IsEquivalence.sym equiv)
; trans = trans (IsEquivalence.trans equiv)
}
isDecEquivalence : ∀ {a ℓ} {A : Set a} {_∼_ : Rel A ℓ} →
IsDecEquivalence _∼_ → ∀ n →
IsDecEquivalence (Pointwise _∼_ {n})
isDecEquivalence decEquiv n = record
{ isEquivalence = isEquivalence (IsDecEquivalence.isEquivalence decEquiv) n
; _≟_ = decidable (IsDecEquivalence._≟_ decEquiv)
}
setoid : ∀ {a ℓ} → Setoid a ℓ → ℕ → Setoid a (a ⊔ ℓ)
setoid S n = record
{ isEquivalence = isEquivalence (Setoid.isEquivalence S) n
}
decSetoid : ∀ {a ℓ} → DecSetoid a ℓ → ℕ → DecSetoid a (a ⊔ ℓ)
decSetoid S n = record
{ isDecEquivalence = isDecEquivalence (DecSetoid.isDecEquivalence S) n
}
------------------------------------------------------------------------
-- map
module _ {a b c d} {A : Set a} {B : Set b} {C : Set c} {D : Set d} where
map⁺ : ∀ {ℓ₁ ℓ₂} {_∼₁_ : REL A B ℓ₁} {_∼₂_ : REL C D ℓ₂}
{f : A → C} {g : B → D} →
(∀ {x y} → x ∼₁ y → f x ∼₂ g y) →
∀ {m n xs ys} → Pointwise _∼₁_ {m} {n} xs ys →
Pointwise _∼₂_ (Vec.map f xs) (Vec.map g ys)
map⁺ ∼₁⇒∼₂ [] = []
map⁺ ∼₁⇒∼₂ (x∼y ∷ xs∼ys) = ∼₁⇒∼₂ x∼y ∷ map⁺ ∼₁⇒∼₂ xs∼ys
------------------------------------------------------------------------
-- _++_
module _ {a b ℓ} {A : Set a} {B : Set b} {_∼_ : REL A B ℓ} where
++⁺ : ∀ {m n p q}
{ws : Vec A m} {xs : Vec B p} {ys : Vec A n} {zs : Vec B q} →
Pointwise _∼_ ws xs → Pointwise _∼_ ys zs →
Pointwise _∼_ (ws ++ ys) (xs ++ zs)
++⁺ [] ys∼zs = ys∼zs
++⁺ (w∼x ∷ ws∼xs) ys∼zs = w∼x ∷ (++⁺ ws∼xs ys∼zs)
++ˡ⁻ : ∀ {m n}
(ws : Vec A m) (xs : Vec B m) {ys : Vec A n} {zs : Vec B n} →
Pointwise _∼_ (ws ++ ys) (xs ++ zs) → Pointwise _∼_ ws xs
++ˡ⁻ [] [] _ = []
++ˡ⁻ (w ∷ ws) (x ∷ xs) (w∼x ∷ ps) = w∼x ∷ ++ˡ⁻ ws xs ps
++ʳ⁻ : ∀ {m n}
(ws : Vec A m) (xs : Vec B m) {ys : Vec A n} {zs : Vec B n} →
Pointwise _∼_ (ws ++ ys) (xs ++ zs) → Pointwise _∼_ ys zs
++ʳ⁻ [] [] ys∼zs = ys∼zs
++ʳ⁻ (w ∷ ws) (x ∷ xs) (_ ∷ ps) = ++ʳ⁻ ws xs ps
++⁻ : ∀ {m n}
(ws : Vec A m) (xs : Vec B m) {ys : Vec A n} {zs : Vec B n} →
Pointwise _∼_ (ws ++ ys) (xs ++ zs) →
Pointwise _∼_ ws xs × Pointwise _∼_ ys zs
++⁻ ws xs ps = ++ˡ⁻ ws xs ps , ++ʳ⁻ ws xs ps
------------------------------------------------------------------------
-- concat
module _ {a b ℓ} {A : Set a} {B : Set b} {_∼_ : REL A B ℓ} where
concat⁺ : ∀ {m n p q}
{xss : Vec (Vec A m) n} {yss : Vec (Vec B p) q} →
Pointwise (Pointwise _∼_) xss yss →
Pointwise _∼_ (concat xss) (concat yss)
concat⁺ [] = []
concat⁺ (xs∼ys ∷ ps) = ++⁺ xs∼ys (concat⁺ ps)
concat⁻ : ∀ {m n} (xss : Vec (Vec A m) n) (yss : Vec (Vec B m) n) →
Pointwise _∼_ (concat xss) (concat yss) →
Pointwise (Pointwise _∼_) xss yss
concat⁻ [] [] [] = []
concat⁻ (xs ∷ xss) (ys ∷ yss) ps =
++ˡ⁻ xs ys ps ∷ concat⁻ xss yss (++ʳ⁻ xs ys ps)
------------------------------------------------------------------------
-- tabulate
module _ {a b ℓ} {A : Set a} {B : Set b} {_∼_ : REL A B ℓ} where
tabulate⁺ : ∀ {n} {f : Fin n → A} {g : Fin n → B} →
(∀ i → f i ∼ g i) →
Pointwise _∼_ (tabulate f) (tabulate g)
tabulate⁺ {zero} f∼g = []
tabulate⁺ {suc n} f∼g = f∼g zero ∷ tabulate⁺ (f∼g ∘ suc)
tabulate⁻ : ∀ {n} {f : Fin n → A} {g : Fin n → B} →
Pointwise _∼_ (tabulate f) (tabulate g) →
(∀ i → f i ∼ g i)
tabulate⁻ (f₀∼g₀ ∷ _) zero = f₀∼g₀
tabulate⁻ (_ ∷ f∼g) (suc i) = tabulate⁻ f∼g i
------------------------------------------------------------------------
-- Degenerate pointwise relations
module _ {a b ℓ} {A : Set a} {B : Set b} {P : A → Set ℓ} where
Pointwiseˡ⇒All : ∀ {m n} {xs : Vec A m} {ys : Vec B n} →
Pointwise (λ x y → P x) xs ys → All P xs
Pointwiseˡ⇒All [] = []
Pointwiseˡ⇒All (p ∷ ps) = p ∷ Pointwiseˡ⇒All ps
Pointwiseʳ⇒All : ∀ {n} {xs : Vec B n} {ys : Vec A n} →
Pointwise (λ x y → P y) xs ys → All P ys
Pointwiseʳ⇒All [] = []
Pointwiseʳ⇒All (p ∷ ps) = p ∷ Pointwiseʳ⇒All ps
All⇒Pointwiseˡ : ∀ {n} {xs : Vec A n} {ys : Vec B n} →
All P xs → Pointwise (λ x y → P x) xs ys
All⇒Pointwiseˡ {ys = []} [] = []
All⇒Pointwiseˡ {ys = _ ∷ _} (p ∷ ps) = p ∷ All⇒Pointwiseˡ ps
All⇒Pointwiseʳ : ∀ {n} {xs : Vec B n} {ys : Vec A n} →
All P ys → Pointwise (λ x y → P y) xs ys
All⇒Pointwiseʳ {xs = []} [] = []
All⇒Pointwiseʳ {xs = _ ∷ _} (p ∷ ps) = p ∷ All⇒Pointwiseʳ ps
------------------------------------------------------------------------
-- Pointwise _≡_ is equivalent to _≡_
module _ {a} {A : Set a} where
Pointwise-≡⇒≡ : ∀ {n} {xs ys : Vec A n} →
Pointwise _≡_ xs ys → xs ≡ ys
Pointwise-≡⇒≡ [] = P.refl
Pointwise-≡⇒≡ (P.refl ∷ xs∼ys) = P.cong (_ ∷_) (Pointwise-≡⇒≡ xs∼ys)
≡⇒Pointwise-≡ : ∀ {n} {xs ys : Vec A n} →
xs ≡ ys → Pointwise _≡_ xs ys
≡⇒Pointwise-≡ P.refl = refl P.refl
Pointwise-≡↔≡ : ∀ {n} {xs ys : Vec A n} →
Pointwise _≡_ xs ys ⇔ xs ≡ ys
Pointwise-≡↔≡ = equivalence Pointwise-≡⇒≡ ≡⇒Pointwise-≡
------------------------------------------------------------------------
-- DEPRECATED NAMES
------------------------------------------------------------------------
-- Please use the new names as continuing support for the old names is
-- not guaranteed.
-- Version 0.15
Pointwise-≡ = Pointwise-≡↔≡
{-# WARNING_ON_USAGE Pointwise-≡
"Warning: Pointwise-≡ was deprecated in v0.15.
Please use Pointwise-≡↔≡ instead."
#-}
|
programs/oeis/051/A051837.asm
|
neoneye/loda
| 22 |
87959
|
; A051837: Rank of Demjanenko matrix mod n-th prime.
; 2,3,5,6,8,9,11,11,15,18,20,21,23,26,29,30,33,35,36,39,41,44
mov $1,$0
mul $0,2
cmp $0,14
add $1,2
sub $1,$0
seq $1,40 ; The prime numbers.
mov $0,$1
div $0,2
|
test/Fail/Issue1698-data.agda
|
shlevy/agda
| 1,989 |
5914
|
data Foo : Set where
foo = Foo
-- Bad error message WAS:
-- A postulate block can only contain type signatures or instance blocks
|
programs/oeis/047/A047479.asm
|
jmorken/loda
| 1 |
14607
|
<gh_stars>1-10
; A047479: Numbers that are congruent to {0, 1, 5, 7} mod 8.
; 0,1,5,7,8,9,13,15,16,17,21,23,24,25,29,31,32,33,37,39,40,41,45,47,48,49,53,55,56,57,61,63,64,65,69,71,72,73,77,79,80,81,85,87,88,89,93,95,96,97,101,103,104,105,109,111,112,113,117,119,120,121,125,127,128,129,133,135,136,137,141,143,144,145,149,151,152,153,157,159,160,161,165,167,168,169,173,175,176,177,181,183,184,185,189,191,192,193,197,199,200,201,205,207,208,209,213,215,216,217,221,223,224,225,229,231,232,233,237,239,240,241,245,247,248,249,253,255,256,257,261,263,264,265,269,271,272,273,277,279,280,281,285,287,288,289,293,295,296,297,301,303,304,305,309,311,312,313,317,319,320,321,325,327,328,329,333,335,336,337,341,343,344,345,349,351,352,353,357,359,360,361,365,367,368,369,373,375,376,377,381,383,384,385,389,391,392,393,397,399,400,401,405,407,408,409,413,415,416,417,421,423,424,425,429,431,432,433,437,439,440,441,445,447,448,449,453,455,456,457,461,463,464,465,469,471,472,473,477,479,480,481,485,487,488,489,493,495,496,497
mov $1,$0
lpb $0
sub $0,4
add $1,4
lpe
lpb $0
mod $0,2
add $1,3
lpe
|
src/q_bingo-q_gtk-q_intl.ads
|
mgrojo/bingada
| 2 |
21751
|
<filename>src/q_bingo-q_gtk-q_intl.ads<gh_stars>1-10
--*****************************************************************************
--*
--* PROJECT: Bingada
--*
--* FILE: q_bingo-q_gtk-q_intl.ads
--*
--* AUTHOR: <NAME>
--*
--*****************************************************************************
package Q_BINGO.Q_GTK.Q_INTL is
procedure P_INITIALISE;
end Q_BINGO.Q_GTK.Q_INTL;
|
programs/oeis/184/A184617.asm
|
neoneye/loda
| 22 |
102554
|
; A184617: With nonadjacent forms: A184615(n) + A184616(n).
; 0,1,2,5,4,5,10,9,8,9,10,21,20,21,18,17,16,17,18,21,20,21,42,41,40,41,42,37,36,37,34,33,32,33,34,37,36,37,42,41,40,41,42,85,84,85,82,81,80,81,82,85,84,85,74,73,72,73,74,69,68,69,66,65,64,65,66,69,68,69,74,73,72,73,74,85,84,85,82,81,80,81,82,85,84,85,170,169,168,169,170,165,164,165,162,161,160,161,162,165
seq $0,178729 ; a(n) = n XOR 3n, where XOR is bitwise XOR.
div $0,2
|
case-studies/performance/verification/alloy/ppc/tests/bclwdww009.als
|
uwplse/memsynth
| 19 |
4791
|
<reponame>uwplse/memsynth
module tests/bclwdww009
open program
open model
/**
PPC bclwdww009
"DpdR Fre LwSyncdWW Wse LwSyncdWW Rfe"
Cycle=DpdR Fre LwSyncdWW Wse LwSyncdWW Rfe
Relax=BCLwSyncdWW
Safe=Fre Wse LwSyncdWW DpdR
{
0:r2=x; 0:r4=y;
1:r2=y; 1:r4=z;
2:r2=z; 2:r5=x;
}
P0 | P1 | P2 ;
li r1,1 | li r1,2 | lwz r1,0(r2) ;
stw r1,0(r2) | stw r1,0(r2) | xor r3,r1,r1 ;
lwsync | lwsync | lwzx r4,r3,r5 ;
li r3,1 | li r3,1 | ;
stw r3,0(r4) | stw r3,0(r4) | ;
exists
(y=2 /\ 2:r1=1 /\ 2:r4=0)
**/
one sig x, y, z extends Location {}
one sig P1, P2, P3 extends Processor {}
one sig op1 extends Write {}
one sig op2 extends Lwsync {}
one sig op3 extends Write {}
one sig op4 extends Write {}
one sig op5 extends Lwsync {}
one sig op6 extends Write {}
one sig op7 extends Read {}
one sig op8 extends Read {}
fact {
P1.write[1, op1, x, 1]
P1.lwsync[2, op2]
P1.write[3, op3, y, 1]
P2.write[4, op4, y, 2]
P2.lwsync[5, op5]
P2.write[6, op6, z, 1]
P3.read[7, op7, z, 1]
P3.read[8, op8, x, 0] and op8.dep[op7]
}
fact {
y.final[2]
}
Allowed:
run { Allowed_PPC } for 5 int expect 1
|
programs/oeis/079/A079947.asm
|
jmorken/loda
| 1 |
27718
|
; A079947: Partial sums of A030300.
; 1,1,1,2,3,4,5,5,5,5,5,5,5,5,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85
mov $3,$0
mov $4,$0
add $4,1
lpb $4
mov $0,$3
sub $4,1
sub $0,$4
mov $7,$0
mov $0,0
mov $2,$7
add $2,$7
mov $6,$2
add $6,7
pow $7,$5
add $6,$7
add $0,$6
lpb $0
div $0,2
add $0,3
mod $6,2
add $6,7
lpe
sub $6,7
add $1,$6
lpe
|
pwnlib/shellcraft/templates/i386/linux/stager.asm
|
DrKeineLust/pwntools
| 8,966 |
87254
|
<filename>pwnlib/shellcraft/templates/i386/linux/stager.asm
<% from pwnlib.shellcraft import common %>
<% from pwnlib.shellcraft.i386 import push, mov %>
<% from pwnlib.shellcraft.i386.linux import syscall %>
<% from pwnlib.constants import SYS_mmap2, PROT_EXEC, PROT_WRITE, PROT_READ, MAP_ANON, MAP_PRIVATE, SYS_read %>
<%docstring>
Recives a fixed sized payload into a mmaped buffer
Useful in conjuncion with findpeer.
Args:
sock, the socket to read the payload from.
size, the size of the payload
Example:
>>> stage_2 = asm(shellcraft.echo('hello') + "\n" + shellcraft.syscalls.exit(42))
>>> p = run_assembly(shellcraft.stager(0, len(stage_2)))
>>> for c in bytearray(stage_2):
... p.write(bytearray((c,)))
>>> p.wait_for_close()
>>> p.poll()
42
>>> p.recvall()
b'hello'
</%docstring>
<%page args="sock, size, handle_error=False, tiny=False"/>
<%
stager = common.label("stager")
looplabel = common.label("read_loop")
errlabel = common.label("error")
mmap_size = (size + 0xfff) & ~0xfff
rwx = PROT_EXEC | PROT_WRITE | PROT_READ
anon_priv = MAP_ANON | MAP_PRIVATE
%>
${push(sock)}
${stager}:
${mov('ebx', 0)}
${syscall(SYS_mmap2, 'ebx', mmap_size, rwx, anon_priv, -1, 'ebx')}
pop ebx /* socket */
push eax /* save for: pop eax; call eax later */
/* read/recv loop */
mov ecx, eax
${mov("edx", size)}
${looplabel}:
${syscall(SYS_read, 'ebx', 'ecx', 'edx')}
% if handle_error:
test eax, eax
js ${errlabel}
% endif
% if not tiny:
add ecx, eax /* increment destination pointer */
sub edx, eax /* decrement remaining amount */
jnz ${looplabel}
% endif
mov ebp, ebx
ret /* start of mmapped buffer, ebp = socket */
% if handle_error:
${errlabel}:
hlt
% endif
|
source/league/league-application.adb
|
svn2github/matreshka
| 24 |
30404
|
<filename>source/league/league-application.adb<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2011, <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 Matreshka.Internals.Strings.Configuration;
package body League.Application is
procedure Initialize_Arguments_Environment;
-- Initialize arguments list and process environment.
Args : League.String_Vectors.Universal_String_Vector;
Env : League.Environment_Variables.Environment_Variable_Set;
App_Name : League.Strings.Universal_String;
App_Version : League.Strings.Universal_String;
Org_Name : League.Strings.Universal_String;
Org_Domain : League.Strings.Universal_String;
----------------------
-- Application_Name --
----------------------
function Application_Name return League.Strings.Universal_String is
begin
return App_Name;
end Application_Name;
-------------------------
-- Application_Version --
-------------------------
function Application_Version return League.Strings.Universal_String is
begin
return App_Version;
end Application_Version;
---------------
-- Arguments --
---------------
function Arguments return League.String_Vectors.Universal_String_Vector is
begin
return Args;
end Arguments;
-----------------
-- Environment --
-----------------
function Environment
return League.Environment_Variables.Environment_Variable_Set is
begin
return Env;
end Environment;
--------------------------------------
-- Initialize_Arguments_Environment --
--------------------------------------
procedure Initialize_Arguments_Environment is separate;
-------------------------
-- Organization_Domain --
-------------------------
function Organization_Domain return League.Strings.Universal_String is
begin
return Org_Domain;
end Organization_Domain;
-----------------------
-- Organization_Name --
-----------------------
function Organization_Name return League.Strings.Universal_String is
begin
return Org_Name;
end Organization_Name;
--------------------------
-- Set_Application_Name --
--------------------------
procedure Set_Application_Name (Name : League.Strings.Universal_String) is
begin
App_Name := Name;
end Set_Application_Name;
-----------------------------
-- Set_Application_Version --
-----------------------------
procedure Set_Application_Version
(Name : League.Strings.Universal_String) is
begin
App_Version := Name;
end Set_Application_Version;
-----------------------------
-- Set_Organization_Domain --
-----------------------------
procedure Set_Organization_Domain
(Name : League.Strings.Universal_String) is
begin
Org_Domain := Name;
end Set_Organization_Domain;
---------------------------
-- Set_Organization_Name --
---------------------------
procedure Set_Organization_Name (Name : League.Strings.Universal_String) is
begin
Org_Name := Name;
end Set_Organization_Name;
begin
-- Setup most optimal string handler.
Matreshka.Internals.Strings.Configuration.Initialize;
-- Initialize arguments and environment.
Initialize_Arguments_Environment;
end League.Application;
|
boot.asm
|
vags-cin/awesome-bootloader
| 8 |
101409
|
<reponame>vags-cin/awesome-bootloader<filename>boot.asm
; ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥
; Assembly is love
;
; boot.asm by BootloaderBros
; BootloaderBros:
; <NAME> @jgfn
; <NAME> @nmf2
; <NAME> @vags
;
; ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥
org 0x00007C00
jmp 0x00000000:start
start:
xor ax,ax
mov ds,ax
loaderBoot:
;****************************************
; Reset disk
;****************************************
.reset:
mov ah, 0 ;
int 0x13 ; (13h) DISK interrupt (0h) (Reset)
; Resets the fixed disk or diskette controller and drive, forcing recalibration of the read/write head.
jc .reset ;
;****************************************
; Load second stage to memory
;****************************************
.load_disk:
mov ax, 0x0000050
mov es, ax
xor bx, bx ; set on BX the address of our code at PC Memory
mov ah, 0x02 ; Interrupt that read sectors into Memory
; this interrupt use all of registers below
mov ch, 0x0 ; Cylinder number
mov al, 0x03 ; Number of sectors to read
mov cl, 0x02 ; Sector to read.
mov dh, 0x0 ; Head number
mov dl, 0x0 ; Drive number
int 0x13 ; DISK interrupt
jc .load_disk
jmp 0x00000500 ; jump to execute the Stage two!
end:
times 510 - ($ - $$) db 0
dw 0xAA55
|
savefile/maps/1631_NorthernEncampment.asm
|
stranck/fools2018-1
| 35 |
172270
|
SECTION "Map_1631", ROM0[$B800]
Map_1631_Header:
hdr_tileset 0
hdr_dimensions 11, 10
hdr_pointers_a Map_1631_Blocks, Map_1631_TextPointers
hdr_pointers_b Map_1631_Script, Map_1631_Objects
hdr_pointers_c Map_1631_InitScript, Map_1631_RAMScript
hdr_palette $07
hdr_music MUSIC_CITIES2, AUDIO_1
hdr_connection NORTH, $0000, 0, 0
hdr_connection SOUTH, $152D, 7, 1
hdr_connection WEST, $1A3C, 10, 5
hdr_connection EAST, $1720, 1, 9
Map_1631_Objects:
hdr_border $0f
hdr_warp_count 3
hdr_warp 5, 7, 2, 7, $1670
hdr_warp 13, 11, 2, 7, $1671
hdr_warp 5, 15, 2, 7, $1672
hdr_sign_count 0
hdr_object_count 2
hdr_object SPRITE_FISHER2, 12, 4, WALK, ALL, $02
hdr_object SPRITE_GIRL, 10, 13, WALK, ALL, $01
Map_1631_RAMScript:
rs_fill_byte $55
rs_fill_3 $c72c
rs_fill_len $c73a, 6
rs_fill_3 $c74b
rs_fill_3 $c7cf
rs_fill_3 $c7e0
rs_end
Map_1631_Blocks:
db $0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f,$0f
db $90,$97,$80,$0a,$74,$0a,$74,$4d,$55,$55,$55
db $bf,$0a,$0a,$74,$0a,$74,$0a,$4d,$5d,$55,$55
db $0f,$5d,$02,$09,$03,$52,$52,$4f,$27,$55,$0f
db $0f,$26,$23,$23,$23,$23,$23,$23,$22,$55,$0f
db $0f,$27,$55,$55,$55,$55,$02,$03,$27,$55,$0f
db $0f,$27,$20,$21,$55,$55,$55,$55,$27,$55,$0f
db $0f,$27,$7c,$7e,$55,$55,$55,$55,$27,$55,$0f
db $0f,$44,$23,$23,$23,$23,$23,$23,$22,$55,$0f
db $0f,$0f,$0f,$0f,$0f,$0f,$0f,$55,$5e,$55,$0f
Map_1631_TextPointers:
dw Map_1631_TX1
dw Map_1631_TX2
Map_1631_InitScript:
ret
Map_1631_Script:
ret
Map_1631_TX1:
TX_ASM
jp EnhancedTextOnly
text "Oh, don't tell me you"
next "don't have a BIKE yet?"
para "The Cycling Shop in"
next "Western Glitchland is"
cont "where you should go!"
done
Map_1631_TX2:
TX_ASM
jp EnhancedTextOnly
text "Technology is incredible!"
para "By extending the link"
next "cable technology to the"
cont "Internet, you can stream"
cont "dank memes directly to"
cont "your Gameboy system."
para "The power of science is"
next "staggering!"
done
|
gillesdubois/used_apple_scripts/tunnelBlickOvpnConDis.applescript
|
gillesdubois/btt-touchbar-presets
| 1,879 |
527
|
<gh_stars>1000+
-- SET YOUR CONFIG NAME BELOW
set tunnelBlickConfigName to "YOURCONFIGNAME"
tell application "Tunnelblick"
set vpnState to get state of first configuration where name = tunnelBlickConfigName
if vpnState = "CONNECTED" then
disconnect tunnelBlickConfigName
end if
if vpnState ≠ "CONNECTED" then
connect tunnelBlickConfigName
end if
end tell
|
exercises/10_and.asm
|
Catherine22/Assembly
| 0 |
25600
|
STDIN equ 0
STDOUT equ 1
SYS_EXIT equ 1
SYS_READ equ 3
SYS_WRITE equ 4
section .data
even_msg db "Even Number!", 0xA
len1 equ $- even_msg
odd_msg db "Odd Number!", 0xA
len2 equ $- odd_msg
section .text
global main
main:
mov ax, 6h ;getting 8 in the ax
and ax, 1 ;and ax with 1
jz evnn
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, odd_msg
mov edx, len2
int 0x80
jmp outprog
evnn:
mov ah, 09h
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, even_msg
mov edx, len1
int 0x80
outprog:
mov eax, SYS_EXIT
int 0x80
|
source/amf/uml/amf-uml-object_flows.ads
|
svn2github/matreshka
| 24 |
10969
|
<reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- An object flow is an activity edge that can have objects or data passing
-- along it.
--
-- Object flows have support for multicast/receive, token selection from
-- object nodes, and transformation of tokens.
------------------------------------------------------------------------------
with AMF.UML.Activity_Edges;
limited with AMF.UML.Behaviors;
package AMF.UML.Object_Flows is
pragma Preelaborate;
type UML_Object_Flow is limited interface
and AMF.UML.Activity_Edges.UML_Activity_Edge;
type UML_Object_Flow_Access is
access all UML_Object_Flow'Class;
for UML_Object_Flow_Access'Storage_Size use 0;
not overriding function Get_Is_Multicast
(Self : not null access constant UML_Object_Flow)
return Boolean is abstract;
-- Getter of ObjectFlow::isMulticast.
--
-- Tells whether the objects in the flow are passed by multicasting.
not overriding procedure Set_Is_Multicast
(Self : not null access UML_Object_Flow;
To : Boolean) is abstract;
-- Setter of ObjectFlow::isMulticast.
--
-- Tells whether the objects in the flow are passed by multicasting.
not overriding function Get_Is_Multireceive
(Self : not null access constant UML_Object_Flow)
return Boolean is abstract;
-- Getter of ObjectFlow::isMultireceive.
--
-- Tells whether the objects in the flow are gathered from respondents to
-- multicasting.
not overriding procedure Set_Is_Multireceive
(Self : not null access UML_Object_Flow;
To : Boolean) is abstract;
-- Setter of ObjectFlow::isMultireceive.
--
-- Tells whether the objects in the flow are gathered from respondents to
-- multicasting.
not overriding function Get_Selection
(Self : not null access constant UML_Object_Flow)
return AMF.UML.Behaviors.UML_Behavior_Access is abstract;
-- Getter of ObjectFlow::selection.
--
-- Selects tokens from a source object node.
not overriding procedure Set_Selection
(Self : not null access UML_Object_Flow;
To : AMF.UML.Behaviors.UML_Behavior_Access) is abstract;
-- Setter of ObjectFlow::selection.
--
-- Selects tokens from a source object node.
not overriding function Get_Transformation
(Self : not null access constant UML_Object_Flow)
return AMF.UML.Behaviors.UML_Behavior_Access is abstract;
-- Getter of ObjectFlow::transformation.
--
-- Changes or replaces data tokens flowing along edge.
not overriding procedure Set_Transformation
(Self : not null access UML_Object_Flow;
To : AMF.UML.Behaviors.UML_Behavior_Access) is abstract;
-- Setter of ObjectFlow::transformation.
--
-- Changes or replaces data tokens flowing along edge.
end AMF.UML.Object_Flows;
|
wayland_egl_ada/src/wayland-egl.ads
|
onox/wayland-ada
| 5 |
3407
|
<reponame>onox/wayland-ada
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <<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.
private with Wayland.EGL_API;
with Wayland.Protocols.Client;
package Wayland.EGL is
pragma Preelaborate;
type Dimension is record
Width, Height : Natural;
end record;
type Window is tagged limited private;
function Is_Initialized (Object : Window) return Boolean;
procedure Create_Window
(Object : in out Window;
Surface : Protocols.Client.Surface;
Width, Height : Natural)
with Pre => not Object.Is_Initialized and Surface.Has_Proxy,
Post => Object.Is_Initialized;
procedure Destroy (Object : in out Window)
with Pre => Object.Is_Initialized,
Post => not Object.Is_Initialized;
procedure Resize
(Object : Window;
Size : Dimension;
X, Y : Integer := 0)
with Pre => Object.Is_Initialized;
function Attached_Size (Object : Window) return Dimension
with Pre => Object.Is_Initialized;
private
type Window is tagged limited record
Handle : EGL_API.EGL_Window_Ptr;
end record;
end Wayland.EGL;
|
tests/syntax_examples/src/other_basic_subprogram_calls.adb
|
TNO/Dependency_Graph_Extractor-Ada
| 1 |
26692
|
<reponame>TNO/Dependency_Graph_Extractor-Ada
package body Other_Basic_Subprogram_Calls is
function Other_F1 return Integer is
begin
return 42;
end Other_F1;
procedure Other_P1 is
begin
null;
end Other_P1;
end Other_Basic_Subprogram_Calls;
|
data/pokemon/dex_entries/piplup.asm
|
AtmaBuster/pokeplat-gen2
| 6 |
27603
|
db "PENGUIN@" ; species name
db "It dislikes being"
next "taken care of. It"
next "is difficult to"
page "bond with it since"
next "it won't listen to"
next "its trainer.@"
|
test/z80/test_call.asm
|
gb-archive/asmotor
| 0 |
88418
|
SECTION "Test",CODE[0]
call $1000
call nz,$1000
call z,$1000
call nc,$1000
call c,$1000
call po,$1000
call pe,$1000
call p,$1000
call m,$1000
|
programs/oeis/160/A160467.asm
|
neoneye/loda
| 22 |
9203
|
<reponame>neoneye/loda
; A160467: a(n) = 1 if n is odd; otherwise, a(n) = 2^(k-1) where 2^k is the largest power of 2 that divides n.
; 1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,16,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,32,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,16,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,64,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,16,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,32,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,16,1,1,1,2,1,1,1,4,1,1,1,2,1,1,1,8,1,1,1,2,1,1,1,4,1,1
bin $0,3
add $0,1
mov $1,1
mov $2,$0
lpb $2
mul $1,2
dif $2,2
lpe
mov $0,$1
|
src/Categories/Category/Monoidal/Core.agda
|
MirceaS/agda-categories
| 0 |
14249
|
<reponame>MirceaS/agda-categories
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
-- Definition of Monoidal Category
-- Big design decision that differs from the previous version:
-- Do not go through "Functor.Power" to encode variables and work
-- at the level of NaturalIsomorphisms, instead work at the object/morphism
-- level, via the more direct _⊗₀_ _⊗₁_ _⊗- -⊗_.
-- The original design needed quite a few contortions to get things working,
-- but these are simply not needed when working directly with the morphisms.
--
-- Smaller design decision: export some items with long names
-- (unitorˡ, unitorʳ and associator), but internally work with the more classical
-- short greek names (λ, ρ and α respectively).
module Categories.Category.Monoidal.Core {o ℓ e} (C : Category o ℓ e) where
open import Level
open import Function using (_$_)
open import Data.Product using (_×_; _,_; curry′)
open import Categories.Category.Product
open import Categories.Functor renaming (id to idF)
open import Categories.Functor.Bifunctor using (Bifunctor; appˡ; appʳ)
open import Categories.Functor.Properties using ([_]-resp-≅)
open import Categories.NaturalTransformation renaming (id to idN)
open import Categories.NaturalTransformation.NaturalIsomorphism
hiding (unitorˡ; unitorʳ; associator; _≃_)
open import Categories.Morphism C using (_≅_; module ≅)
open import Categories.Morphism.IsoEquiv C using (_≃_; ⌞_⌟)
open import Categories.Morphism.Isomorphism C using (_∘ᵢ_; lift-triangle′; lift-pentagon′)
open import Categories.Morphism.Reasoning C
private
module C = Category C
open C hiding (id; identityˡ; identityʳ; assoc)
open Commutation
private
variable
X Y Z W A B : Obj
f g h i a b : X ⇒ Y
record Monoidal : Set (o ⊔ ℓ ⊔ e) where
infixr 10 _⊗₀_ _⊗₁_
field
⊗ : Bifunctor C C C
unit : Obj
open Functor ⊗
_⊗₀_ : Obj → Obj → Obj
_⊗₀_ = curry′ F₀
-- this is also 'curry', but a very-dependent version
_⊗₁_ : X ⇒ Y → Z ⇒ W → X ⊗₀ Z ⇒ Y ⊗₀ W
f ⊗₁ g = F₁ (f , g)
_⊗- : Obj → Functor C C
X ⊗- = appˡ ⊗ X
-⊗_ : Obj → Functor C C
-⊗ X = appʳ ⊗ X
field
unitorˡ : unit ⊗₀ X ≅ X
unitorʳ : X ⊗₀ unit ≅ X
associator : (X ⊗₀ Y) ⊗₀ Z ≅ X ⊗₀ (Y ⊗₀ Z)
module unitorˡ {X} = _≅_ (unitorˡ {X = X})
module unitorʳ {X} = _≅_ (unitorʳ {X = X})
module associator {X} {Y} {Z} = _≅_ (associator {X} {Y} {Z})
-- for exporting, it makes sense to use the above long names, but for
-- internal consumption, the traditional (short!) categorical names are more
-- convenient. However, they are not symmetric, even though the concepts are, so
-- we'll use ⇒ and ⇐ arrows to indicate that
private
λ⇒ = unitorˡ.from
λ⇐ = unitorˡ.to
ρ⇒ = unitorʳ.from
ρ⇐ = unitorʳ.to
-- eta expansion fixes a problem in 2.6.1, will be reported
α⇒ = λ {X} {Y} {Z} → associator.from {X} {Y} {Z}
α⇐ = λ {X} {Y} {Z} → associator.to {X} {Y} {Z}
field
unitorˡ-commute-from : CommutativeSquare (C.id ⊗₁ f) λ⇒ λ⇒ f
unitorˡ-commute-to : CommutativeSquare f λ⇐ λ⇐ (C.id ⊗₁ f)
unitorʳ-commute-from : CommutativeSquare (f ⊗₁ C.id) ρ⇒ ρ⇒ f
unitorʳ-commute-to : CommutativeSquare f ρ⇐ ρ⇐ (f ⊗₁ C.id)
assoc-commute-from : CommutativeSquare ((f ⊗₁ g) ⊗₁ h) α⇒ α⇒ (f ⊗₁ (g ⊗₁ h))
assoc-commute-to : CommutativeSquare (f ⊗₁ (g ⊗₁ h)) α⇐ α⇐ ((f ⊗₁ g) ⊗₁ h)
triangle : [ (X ⊗₀ unit) ⊗₀ Y ⇒ X ⊗₀ Y ]⟨
α⇒ ⇒⟨ X ⊗₀ (unit ⊗₀ Y) ⟩
C.id ⊗₁ λ⇒
≈ ρ⇒ ⊗₁ C.id
⟩
pentagon : [ ((X ⊗₀ Y) ⊗₀ Z) ⊗₀ W ⇒ X ⊗₀ Y ⊗₀ Z ⊗₀ W ]⟨
α⇒ ⊗₁ C.id ⇒⟨ (X ⊗₀ Y ⊗₀ Z) ⊗₀ W ⟩
α⇒ ⇒⟨ X ⊗₀ (Y ⊗₀ Z) ⊗₀ W ⟩
C.id ⊗₁ α⇒
≈ α⇒ ⇒⟨ (X ⊗₀ Y) ⊗₀ Z ⊗₀ W ⟩
α⇒
⟩
|
experimental/TwoConstancyHIT.agda
|
UlrikBuchholtz/HoTT-Agda
| 1 |
834
|
{-# OPTIONS --without-K #-}
{-
Favonia: I was trying to generalize OneSkeleton but failed
to achieve what I wanted. Nicolai then told me this HIT
which is suitable for the constancy lemma I was looking for.
This construction should be attributed to <NAME>
and <NAME>. [1]
[1] Eliminating Higher Truncations via Constancy
by <NAME> and <NAME>
(in preparation/work in progress)
-}
open import HoTT
module experimental.TwoConstancyHIT where
module _ where
private
data #TwoConstancy-aux {i} (A : Type i) : Type i where
#point : A → #TwoConstancy-aux A
data #TwoConstancy {i} (A : Type i) : Type i where
#two-constancy : #TwoConstancy-aux A → (Unit → Unit) → #TwoConstancy A
TwoConstancy : ∀ {i} → Type i → Type i
TwoConstancy = #TwoConstancy
module _ {i} {A : Type i} where
point : A → TwoConstancy A
point a = #two-constancy (#point a) _
postulate -- HIT
link₀ : ∀ a₁ a₂ → point a₁ == point a₂
link₁ : ∀ a₁ a₂ a₃ → link₀ a₁ a₂ ∙' link₀ a₂ a₃ == link₀ a₁ a₃
TwoConstancy-level : is-gpd (TwoConstancy A)
module TwoConstancyElim
{l} {P : TwoConstancy A → Type l}
(p : ∀ x → is-gpd (P x))
(point* : ∀ a → P (point a))
(link₀* : ∀ a₁ a₂ → point* a₁ == point* a₂ [ P ↓ link₀ a₁ a₂ ])
(link₁* : ∀ a₁ a₂ a₃
→ link₀* a₁ a₂ ∙'ᵈ link₀* a₂ a₃
== link₀* a₁ a₃
[ (λ p → point* a₁ == point* a₃ [ P ↓ p ]) ↓ link₁ a₁ a₂ a₃ ]) where
f : Π (TwoConstancy A) P
f = f-aux phantom phantom phantom where
f-aux : Phantom p → Phantom link₀* → Phantom link₁* → Π (TwoConstancy A) P
f-aux phantom phantom phantom (#two-constancy (#point a) _) = point* a
postulate -- HIT
link₀-β : ∀ a₁ a₂ → apd f (link₀ a₁ a₂) == link₀* a₁ a₂
private
lemma : ∀ a₁ a₂ a₃
→ apd f (link₀ a₁ a₂ ∙' link₀ a₂ a₃)
== link₀* a₁ a₂ ∙'ᵈ link₀* a₂ a₃
lemma a₁ a₂ a₃ =
apd f (link₀ a₁ a₂ ∙' link₀ a₂ a₃)
=⟨ apd-∙' f (link₀ a₁ a₂) (link₀ a₂ a₃) ⟩
apd f (link₀ a₁ a₂) ∙'ᵈ apd f (link₀ a₂ a₃)
=⟨ link₀-β a₁ a₂ |in-ctx (λ u → u ∙'ᵈ apd f (link₀ a₂ a₃)) ⟩
link₀* a₁ a₂ ∙'ᵈ apd f (link₀ a₂ a₃)
=⟨ link₀-β a₂ a₃ |in-ctx (λ u → link₀* a₁ a₂ ∙'ᵈ u) ⟩
link₀* a₁ a₂ ∙'ᵈ link₀* a₂ a₃
∎
postulate -- HIT
link₁-β : ∀ a₁ a₂ a₃
→ apd (apd f) (link₁ a₁ a₂ a₃)
== lemma a₁ a₂ a₃ ◃ (link₁* a₁ a₂ a₃ ▹! link₀-β a₁ a₃)
open TwoConstancyElim public using () renaming (f to TwoConstancy-elim)
module TwoConstancyRec
{i} {A : Type i}
{l} {P : Type l}
(p : is-gpd P)
(point* : ∀ a → P)
(link₀* : ∀ a₁ a₂ → point* a₁ == point* a₂)
(link₁* : ∀ a₁ a₂ a₃
→ link₀* a₁ a₂ ∙' link₀* a₂ a₃
== link₀* a₁ a₃) where
private
module M = TwoConstancyElim {A = A}
{l = l} {P = λ _ → P}
(λ _ → p)
point*
(λ a₁ a₂ → ↓-cst-in (link₀* a₁ a₂))
(λ a₁ a₂ a₃
→ ↓-cst-in-∙' (link₀ a₁ a₂) (link₀ a₂ a₃) (link₀* a₁ a₂) (link₀* a₂ a₃)
!◃ ↓-cst-in2 (link₁* a₁ a₂ a₃))
f : TwoConstancy A → P
f = M.f
link₀-β : ∀ a₁ a₂ → ap f (link₀ a₁ a₂) == link₀* a₁ a₂
link₀-β a₁ a₂ = apd=cst-in {f = f} $ M.link₀-β a₁ a₂
private
lemma : ∀ a₁ a₂ a₃
→ ap f (link₀ a₁ a₂ ∙' link₀ a₂ a₃)
== link₀* a₁ a₂ ∙' link₀* a₂ a₃
lemma a₁ a₂ a₃ =
ap f (link₀ a₁ a₂ ∙' link₀ a₂ a₃)
=⟨ ap-∙' f (link₀ a₁ a₂) (link₀ a₂ a₃) ⟩
ap f (link₀ a₁ a₂) ∙' ap f (link₀ a₂ a₃)
=⟨ link₀-β a₁ a₂ |in-ctx (λ u → u ∙' ap f (link₀ a₂ a₃)) ⟩
link₀* a₁ a₂ ∙' ap f (link₀ a₂ a₃)
=⟨ link₀-β a₂ a₃ |in-ctx (λ u → link₀* a₁ a₂ ∙' u) ⟩
link₀* a₁ a₂ ∙' link₀* a₂ a₃
∎
-- I am a lazy person.
postulate -- HIT
link₁-β : ∀ a₁ a₂ a₃
→ ap (ap f) (link₁ a₁ a₂ a₃)
== (lemma a₁ a₂ a₃ ∙ link₁* a₁ a₂ a₃) ∙ (! $ link₀-β a₁ a₃)
open TwoConstancyRec public using () renaming (f to TwoConstancy-rec)
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cc/cc1221b.ada
|
best08618/asylo
| 7 |
19836
|
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cc/cc1221b.ada
-- CC1221B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- FOR A FORMAL INTEGER TYPE, CHECK THAT THE FOLLOWING BASIC
-- OPERATIONS ARE IMPLICITLY DECLARED AND ARE THEREFORE AVAILABLE
-- WITHIN THE GENERIC UNIT: ATTRIBUTES 'FIRST, 'LAST, 'WIDTH,
-- 'ADDRESS, AND 'SIZE.
-- HISTORY:
-- BCB 11/12/87 CREATED ORIGINAL TEST FROM SPLIT OF CC1221A.ADA.
WITH SYSTEM; USE SYSTEM;
WITH REPORT; USE REPORT;
PROCEDURE CC1221B IS
SUBTYPE SUBINT IS INTEGER RANGE -100 .. 100;
SUBTYPE NOINT IS INTEGER RANGE 1 .. -1;
TYPE NEWINT IS NEW INTEGER;
TYPE INT IS RANGE -300 .. 300;
SUBTYPE SINT1 IS INT
RANGE INT (IDENT_INT (-4)) .. INT (IDENT_INT (4));
SUBTYPE SINT2 IS INT RANGE 16#E#E1 .. 2#1111_1111#;
TYPE INT2 IS RANGE 0E8 .. 1E3;
BEGIN
TEST ( "CC1221B", "FOR A FORMAL INTEGER TYPE, CHECK THAT THE " &
"FOLLOWING BASIC OPERATIONS ARE IMPLICITLY " &
"DECLARED AND ARE THEREFORE AVAILABLE " &
"WITHIN THE GENERIC UNIT: ATTRIBUTES 'FIRST, " &
"'LAST, 'WIDTH, 'ADDRESS, AND 'SIZE");
DECLARE -- (B) CHECKS FOR BASIC OPERATIONS OF A DISCRETE TYPE.
-- PART II.
GENERIC
TYPE T IS RANGE <>;
F, L : T;
W : INTEGER;
PROCEDURE P (STR : STRING);
PROCEDURE P (STR : STRING) IS
I : INTEGER := F'SIZE;
T1 : T;
A : ADDRESS := T1'ADDRESS;
BEGIN
IF T'FIRST /= F THEN
FAILED ( "INCORRECT VALUE FOR " & STR & "'FIRST" );
END IF;
IF T'LAST /= L THEN
FAILED ( "INCORRECT VALUE FOR " & STR & "'LAST" );
END IF;
IF T'BASE'FIRST > T'FIRST THEN
FAILED ( "INCORRECT RESULTS WITH " & STR &
"'BASE'FIRST" );
END IF;
IF T'BASE'LAST < T'LAST THEN
FAILED ( "INCORRECT RESULTS WITH " & STR &
"'BASE'LAST" );
END IF;
IF T'WIDTH /= W THEN
FAILED ( "INCORRECT VALUE FOR " & STR &
"'WIDTH" );
END IF;
IF T'BASE'WIDTH < T'WIDTH THEN
FAILED ( "INCORRECT RESULTS WITH " & STR &
"'BASE'WIDTH" );
END IF;
END P;
GENERIC
TYPE T IS RANGE <>;
PROCEDURE Q;
PROCEDURE Q IS
BEGIN
IF T'FIRST /= 1 THEN
FAILED ( "INCORRECT VALUE FOR NOINT'FIRST" );
END IF;
IF T'LAST /= -1 THEN
FAILED ( "INCORRECT VALUE FOR NOINT'LAST" );
END IF;
IF T'BASE'FIRST > T'FIRST THEN
FAILED ( "INCORRECT RESULTS WITH " &
"NOINT'BASE'FIRST" );
END IF;
IF T'BASE'LAST < T'LAST THEN
FAILED ( "INCORRECT RESULTS WITH " &
"NOINT'BASE'LAST" );
END IF;
IF T'WIDTH /= 0 THEN
FAILED ( "INCORRECT VALUE FOR " &
"NOINT'WIDTH" );
END IF;
IF T'BASE'WIDTH < T'WIDTH THEN
FAILED ( "INCORRECT RESULTS WITH " &
"NOINT'BASE'WIDTH" );
END IF;
END Q;
PROCEDURE P1 IS NEW P (INTEGER, INTEGER'FIRST, INTEGER'LAST,
INTEGER'WIDTH);
PROCEDURE P2 IS NEW P (SUBINT, -100, 100, 4);
PROCEDURE P3 IS NEW P (NEWINT, NEWINT'FIRST, NEWINT'LAST,
NEWINT'WIDTH);
PROCEDURE P4 IS NEW P (SINT1, -4, 4, 2);
PROCEDURE P5 IS NEW P (SINT2, 224, 255, 4);
PROCEDURE P6 IS NEW P (INT2 , 0, 1000, 5);
PROCEDURE Q1 IS NEW Q (NOINT);
BEGIN
P1 ( "INTEGER" );
P2 ( "SUBINT" );
P3 ( "NEWINT" );
P4 ( "SINT1" );
P5 ( "SINT2" );
P6 ( "INT2" );
Q1;
END; -- (B).
RESULT;
END CC1221B;
|
libsrc/_DEVELOPMENT/adt/b_array/c/sccz80/b_array_capacity.asm
|
teknoplop/z88dk
| 8 |
82784
|
<reponame>teknoplop/z88dk<filename>libsrc/_DEVELOPMENT/adt/b_array/c/sccz80/b_array_capacity.asm
; size_t b_array_capacity(b_array_t *a)
SECTION code_clib
SECTION code_adt_b_array
PUBLIC b_array_capacity
EXTERN asm_b_array_capacity
defc b_array_capacity = asm_b_array_capacity
|
src/lib/int10.asm
|
darK-Zi0n-te4am-cr3vv/cg
| 1 |
84094
|
include model.inc
include macro.inc
include lib\int10.inc
INT10 macro
int 10h
endm
; INT 10 services
INT10_SET_VMODE equ 00h
INT10_SET_CURSOR_PARAMS equ 01h
INT10_SET_CURSOR_POSITION equ 02h
INT10_SET_ACTIVE_PAGE equ 05h
INT10_GET_CURRENT_VMODE equ 0fh
.code
Int10_SetVideoMode proc uses ax bVMode : byte
mov ah, INT10_SET_VMODE
mov al, bVMode
INT10
ret
Int10_SetVideoMode endp
Int10_GetCurrentVideoMode proc
mov ah, INT10_GET_CURRENT_VMODE
INT10
RETURNW ax
Int10_GetCurrentVideoMode endp
end
|
fpb-6/talk.agda
|
FPBrno/FPBrno.github.io
| 1 |
10073
|
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
{-# BUILTIN NATURAL ℕ #-}
_+_ : ℕ → ℕ → ℕ
zero + b = b
suc a + b = suc (a + b)
infix 100 _+_
data _≡_ : ℕ → ℕ → Set where
refl : {n : ℕ} → n ≡ n
sym : {n m : ℕ} → n ≡ m → m ≡ n
sym refl = refl
trans : {m n o : ℕ} → m ≡ n → n ≡ o → m ≡ o
trans refl p₂ = p₂
suc-inj : {m n : ℕ} → suc m ≡ suc n → m ≡ n
suc-inj refl = refl
data ⊥ : Set where
¬ : Set → Set
¬ A = A → ⊥
_≢_ : ℕ → ℕ → Set
m ≢ n = ¬(m ≡ n)
zero-img : ∀ {m} → suc m ≢ 0
zero-img ()
induction : (P : ℕ → Set) → P 0 → (∀ {n} → P n → P (suc n)) → (∀ m → P m)
induction pred base hypo zero = base
induction pred base hypo (suc m) = hypo (induction pred base hypo m)
cong : ∀ {m n} → (f : ℕ → ℕ) → m ≡ n → f m ≡ f n
cong f refl = refl
assoc : ∀ m n o → m + (n + o) ≡ (m + n) + o
assoc zero n o = refl
assoc (suc m) n o = cong suc (assoc m n o)
n+zero : ∀ n → n ≡ n + 0
n+zero zero = refl
n+zero (suc n) = cong suc (n+zero n)
suc+ : ∀ m n → suc (n + m) ≡ (n + suc m)
suc+ m zero = refl
suc+ m (suc n) = cong suc (suc+ m n)
comm : ∀ m n → m + n ≡ n + m
comm zero n = n+zero n
comm (suc m) n = trans (cong suc (comm m n)) (suc+ m n)
-- Where to go from here?
-- Agda:
-- • <NAME> - Verified Functional Programming in Agda, https://svn.divms.uiowa.edu/repos/clc/projects/agda/book/book.pdf
-- • <NAME> - Dependently Typed Metaprogramming (in Agda), http://cs.ioc.ee/ewscs/2014/mcbride/mcbride-deptypedmetaprog.pdf
-- Type theory:
-- • So you want to learn type theory, http://purelytheoretical.com/sywtltt.html
|
src/Categories/Category/Equivalence/Properties.agda
|
bblfish/agda-categories
| 5 |
13490
|
<reponame>bblfish/agda-categories
{-# OPTIONS --without-K --safe #-}
module Categories.Category.Equivalence.Properties where
open import Level
open import Categories.Adjoint.Equivalence using (⊣Equivalence)
open import Categories.Adjoint.TwoSided using (_⊣⊢_; withZig)
open import Categories.Category.Core
open import Categories.Category.Equivalence using (WeakInverse; StrongEquivalence)
import Categories.Morphism.Reasoning as MR
import Categories.Morphism.Properties as MP
open import Categories.Functor renaming (id to idF)
open import Categories.Functor.Properties using ([_]-resp-Iso)
open import Categories.NaturalTransformation using (ntHelper; _∘ᵥ_; _∘ˡ_; _∘ʳ_)
open import Categories.NaturalTransformation.NaturalIsomorphism as ≃
using (NaturalIsomorphism ; unitorˡ; unitorʳ; associator; _ⓘᵥ_; _ⓘˡ_; _ⓘʳ_)
private
variable
o ℓ e : Level
C D E : Category o ℓ e
module _ {F : Functor C D} {G : Functor D C} (W : WeakInverse F G) where
open WeakInverse W
private
module C = Category C
module D = Category D
module F = Functor F
module G = Functor G
-- adjoint equivalence
F⊣⊢G : F ⊣⊢ G
F⊣⊢G = withZig record
{ unit = ≃.sym G∘F≈id
; counit =
let open D
open HomReasoning
open MR D
open MP D
in record
{ F⇒G = ntHelper record
{ η = λ X → F∘G≈id.⇒.η X ∘ F.F₁ (G∘F≈id.⇒.η (G.F₀ X)) ∘ F∘G≈id.⇐.η (F.F₀ (G.F₀ X))
; commute = λ {X Y} f → begin
(F∘G≈id.⇒.η Y ∘ F.F₁ (G∘F≈id.⇒.η (G.F₀ Y)) ∘ F∘G≈id.⇐.η (F.F₀ (G.F₀ Y))) ∘ F.F₁ (G.F₁ f)
≈⟨ pull-last (F∘G≈id.⇐.commute (F.F₁ (G.F₁ f))) ⟩
F∘G≈id.⇒.η Y ∘ F.F₁ (G∘F≈id.⇒.η (G.F₀ Y)) ∘ (F.F₁ (G.F₁ (F.F₁ (G.F₁ f))) ∘ F∘G≈id.⇐.η (F.F₀ (G.F₀ X)))
≈˘⟨ refl⟩∘⟨ pushˡ F.homomorphism ⟩
F∘G≈id.⇒.η Y ∘ F.F₁ (G∘F≈id.⇒.η (G.F₀ Y) C.∘ G.F₁ (F.F₁ (G.F₁ f))) ∘ F∘G≈id.⇐.η (F.F₀ (G.F₀ X))
≈⟨ refl⟩∘⟨ F.F-resp-≈ (G∘F≈id.⇒.commute (G.F₁ f)) ⟩∘⟨refl ⟩
F∘G≈id.⇒.η Y ∘ F.F₁ (G.F₁ f C.∘ G∘F≈id.⇒.η (G.F₀ X)) ∘ F∘G≈id.⇐.η (F.F₀ (G.F₀ X))
≈⟨ refl⟩∘⟨ F.homomorphism ⟩∘⟨refl ⟩
F∘G≈id.⇒.η Y ∘ (F.F₁ (G.F₁ f) ∘ F.F₁ (G∘F≈id.⇒.η (G.F₀ X))) ∘ F∘G≈id.⇐.η (F.F₀ (G.F₀ X))
≈⟨ center⁻¹ (F∘G≈id.⇒.commute f) Equiv.refl ⟩
(f ∘ F∘G≈id.⇒.η X) ∘ F.F₁ (G∘F≈id.⇒.η (G.F₀ X)) ∘ F∘G≈id.⇐.η (F.F₀ (G.F₀ X))
≈⟨ assoc ⟩
f ∘ F∘G≈id.⇒.η X ∘ F.F₁ (G∘F≈id.⇒.η (G.F₀ X)) ∘ F∘G≈id.⇐.η (F.F₀ (G.F₀ X))
∎
}
; F⇐G = ntHelper record
{ η = λ X → (F∘G≈id.⇒.η (F.F₀ (G.F₀ X)) ∘ F.F₁ (G∘F≈id.⇐.η (G.F₀ X))) ∘ F∘G≈id.⇐.η X
; commute = λ {X Y} f → begin
((F∘G≈id.⇒.η (F.F₀ (G.F₀ Y)) ∘ F.F₁ (G∘F≈id.⇐.η (G.F₀ Y))) ∘ F∘G≈id.⇐.η Y) ∘ f
≈⟨ pullʳ (F∘G≈id.⇐.commute f) ⟩
(F∘G≈id.⇒.η (F.F₀ (G.F₀ Y)) ∘ F.F₁ (G∘F≈id.⇐.η (G.F₀ Y))) ∘ F.F₁ (G.F₁ f) ∘ F∘G≈id.⇐.η X
≈⟨ center (⟺ F.homomorphism) ⟩
F∘G≈id.⇒.η (F.F₀ (G.F₀ Y)) ∘ F.F₁ (G∘F≈id.⇐.η (G.F₀ Y) C.∘ G.F₁ f) ∘ F∘G≈id.⇐.η X
≈⟨ refl⟩∘⟨ F.F-resp-≈ (G∘F≈id.⇐.commute (G.F₁ f)) ⟩∘⟨refl ⟩
F∘G≈id.⇒.η (F.F₀ (G.F₀ Y)) ∘ F.F₁ (G.F₁ (F.F₁ (G.F₁ f)) C.∘ G∘F≈id.⇐.η (G.F₀ X)) ∘ F∘G≈id.⇐.η X
≈⟨ refl⟩∘⟨ F.homomorphism ⟩∘⟨refl ⟩
F∘G≈id.⇒.η (F.F₀ (G.F₀ Y)) ∘ (F.F₁ (G.F₁ (F.F₁ (G.F₁ f))) ∘ F.F₁ (G∘F≈id.⇐.η (G.F₀ X))) ∘ F∘G≈id.⇐.η X
≈⟨ center⁻¹ (F∘G≈id.⇒.commute _) Equiv.refl ⟩
(F.F₁ (G.F₁ f) ∘ F∘G≈id.⇒.η (F.F₀ (G.F₀ X))) ∘ F.F₁ (G∘F≈id.⇐.η (G.F₀ X)) ∘ F∘G≈id.⇐.η X
≈⟨ center Equiv.refl ⟩
F.F₁ (G.F₁ f) ∘ (F∘G≈id.⇒.η (F.F₀ (G.F₀ X)) ∘ F.F₁ (G∘F≈id.⇐.η (G.F₀ X))) ∘ F∘G≈id.⇐.η X
∎
}
; iso = λ X → Iso-∘ (Iso-∘ (Iso-swap (F∘G≈id.iso _)) ([ F ]-resp-Iso (G∘F≈id.iso _)))
(F∘G≈id.iso X)
}
; zig = λ {A} →
let open D
open HomReasoning
open MR D
in begin
(F∘G≈id.⇒.η (F.F₀ A) ∘ F.F₁ (G∘F≈id.⇒.η (G.F₀ (F.F₀ A))) ∘ F∘G≈id.⇐.η (F.F₀ (G.F₀ (F.F₀ A))))
∘ F.F₁ (G∘F≈id.⇐.η A)
≈⟨ pull-last (F∘G≈id.⇐.commute (F.F₁ (G∘F≈id.⇐.η A))) ⟩
F∘G≈id.⇒.η (F.F₀ A) ∘ F.F₁ (G∘F≈id.⇒.η (G.F₀ (F.F₀ A))) ∘
F.F₁ (G.F₁ (F.F₁ (G∘F≈id.⇐.η A))) ∘ F∘G≈id.⇐.η (F.F₀ A)
≈˘⟨ refl⟩∘⟨ pushˡ F.homomorphism ⟩
F∘G≈id.⇒.η (F.F₀ A) ∘ F.F₁ (G∘F≈id.⇒.η (G.F₀ (F.F₀ A)) C.∘ G.F₁ (F.F₁ (G∘F≈id.⇐.η A))) ∘ F∘G≈id.⇐.η (F.F₀ A)
≈⟨ refl⟩∘⟨ F.F-resp-≈ (G∘F≈id.⇒.commute (G∘F≈id.⇐.η A)) ⟩∘⟨refl ⟩
F∘G≈id.⇒.η (F.F₀ A) ∘ F.F₁ (G∘F≈id.⇐.η A C.∘ G∘F≈id.⇒.η A) ∘ F∘G≈id.⇐.η (F.F₀ A)
≈⟨ refl⟩∘⟨ elimˡ ((F.F-resp-≈ (G∘F≈id.iso.isoˡ _)) ○ F.identity) ⟩
F∘G≈id.⇒.η (F.F₀ A) ∘ F∘G≈id.⇐.η (F.F₀ A)
≈⟨ F∘G≈id.iso.isoʳ _ ⟩
id
∎
}
module F⊣⊢G = _⊣⊢_ F⊣⊢G
module _ {o ℓ e o′ ℓ′ e′} {C : Category o ℓ e} {D : Category o′ ℓ′ e′} (SE : StrongEquivalence C D) where
open StrongEquivalence SE
C≅D : ⊣Equivalence C D
C≅D = record
{ L = F
; R = G
; L⊣⊢R = F⊣⊢G weak-inverse
}
module C≅D = ⊣Equivalence C≅D
|
theorems/stash/modalities/NullifyFamily.agda
|
timjb/HoTT-Agda
| 294 |
2336
|
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import stash.modalities.Orthogonality
module stash.modalities.NullifyFamily where
module _ {ℓ} {I : Type ℓ} (X : I → Type ℓ) (A : Type ℓ) where
private
data #NullifyAll : Type ℓ where
#inj : A → #NullifyAll
#apex : (i : I) → (X i → #NullifyAll) → #NullifyAll
NullifyAll : Type ℓ
NullifyAll = #NullifyAll
inj : A → NullifyAll
inj = #inj
apex : (i : I) → (X i → #NullifyAll) → #NullifyAll
apex = #apex
postulate
apex-path : (i : I) (α : X i → NullifyAll) (x : X i) → apex i α == α x
apex-cst : (i : I) (n : NullifyAll) → apex i (λ _ → n) == n
apex-adj : (i : I) (n : NullifyAll) → ap (Δ NullifyAll (X i)) (apex-cst i n) == λ= (apex-path i (Δ NullifyAll (X i) n))
module NullifyAllElim (Q : NullifyAll → Type ℓ) (is-null : ⟦ X ⊥ Q ⟧) (φ : Π A (Q ∘ inj)) where
f : Π NullifyAll Q
f (#inj a) = φ a
f (#apex i α) = is-equiv.g (is-null i (#apex i α)) α'
where α' : X i → Q (#apex i α)
α' x = transport! Q (apex-path i α x) (f (α x))
module _ {ℓ} {I : Type ℓ} (X : I → Type ℓ) where
nullify-is-null : (A : Type ℓ) → ⟦ X ⊥ NullifyAll X A ⟧ₗ
is-equiv.g (nullify-is-null A i) = apex X A i
is-equiv.f-g (nullify-is-null A i) α = λ= (λ x → apex-path X A i α x)
is-equiv.g-f (nullify-is-null A i) = apex-cst X A i
is-equiv.adj (nullify-is-null A i) = apex-adj X A i
open Modality
NullifyAllModality : Modality ℓ
is-local NullifyAllModality A = ⟦ X ⊥ A ⟧ₗ
is-local-is-prop NullifyAllModality {A} = Π-level (λ i → is-equiv-is-prop)
◯ NullifyAllModality A = NullifyAll X A
◯-is-local NullifyAllModality {A} = nullify-is-null A
η NullifyAllModality {A} = inj X A
◯-elim NullifyAllModality Q Q-is-null φ = NullifyAllElim.f X _ Q (λ i n → Q-is-null n i) φ
◯-elim-β NullifyAllModality Q Q-is-null φ a = idp
◯-== NullifyAllModality {A} a₀ a₁ i = is-eq _ squash inv-l inv-r
where a₀' : NullifyAll X A
a₀' = apex X A i (λ _ → a₀)
a₁' : NullifyAll X A
a₁' = apex X A i (λ _ → a₁)
squash : (X i → a₀ == a₁) → a₀ == a₁
squash φ = ! (apex-cst X A i a₀) ∙ cyl ∙ apex-cst X A i a₁
where cyl : a₀' == a₁'
cyl = ap (apex X A i) (λ= φ)
inv-l : (φ : X i → a₀ == a₁) → (λ _ → squash φ) == φ
inv-l φ = {!!}
inv-r : (p : a₀ == a₁) → squash (λ _ → p) == p
inv-r p = {!!}
-- Main idea is to use this coherence ... (and possibly the other adjoint as well)
-- apex-adj : (i : I) (n : NullifyAll) → ap (Δ NullifyAll (X i)) (apex-cst i n) == λ= (apex-path i (Δ NullifyAll (X i) n))
|
libsrc/target/lviv/stdio/generic_console.asm
|
ahjelm/z88dk
| 640 |
22406
|
SECTION code_himem
PUBLIC generic_console_cls
PUBLIC generic_console_printc
PUBLIC generic_console_scrollup
PUBLIC generic_console_set_ink
PUBLIC generic_console_set_paper
PUBLIC generic_console_set_attribute
PUBLIC generic_console_xypos
EXTERN CONSOLE_COLUMNS
EXTERN CONSOLE_ROWS
EXTERN generic_console_font32
EXTERN generic_console_udg32
EXTERN generic_console_flags
EXTERN conio_map_colour
EXTERN __lviv_ink
EXTERN __lviv_paper
generic_console_set_paper:
and 3
call convert_to_mode
ld (__lviv_paper),a
ret
generic_console_set_attribute:
ret
generic_console_set_ink:
and 3
call convert_to_mode
ld (__lviv_ink),a
ret
generic_console_scrollup:
push bc
push de
ld a,$fd ;Page VRAM in
out ($c2),a
ld hl,16384 + 512
ld de,16384
ld bc,16384 - 512
scroll1:
ld a,(hl)
ld (de),a
inc hl
inc de
dec bc
ld a,b
or c
jp nz,scroll1
ld a,$ff ;Page VRAM out
out ($c2),a
ld bc,$1f00
scroll2:
push bc
ld d,' '
call generic_console_printc
pop bc
inc c
ld a,c
cp 32
jp nz,scroll2
pop de
pop bc
ret
generic_console_cls:
ld hl,16384
ld b,4
ld a,(__lviv_paper)
ld d,a
rlca
or d
rlca
or d
rlca
or d
; Page in
ld e,a
ld a,$fd
out ($c2),a
ld bc,16384
cls1:
ld (hl),e
inc hl
dec bc
ld a,b
or c
jp nz,cls1
;Page out
ld a,$ff
out ($c2),a
ret
generic_console_printc:
ld e,d
ld d,0
ld a,e
ld hl,(generic_console_font32)
rlca
jr nc,not_udg
ld a,e
and 127
ld e,a
ld hl,(generic_console_udg32)
inc h ;We decrement later
not_udg:
ex de,hl
add hl,hl
add hl,hl
add hl,hl
add hl,de
dec h ; -32 characters
ex de,hl ; de = font
call generic_console_xypos ;hl = screen
ex de,hl
;hl = font, de = screen
; Setup inverse flag
ld a,(generic_console_flags)
rlca
sbc a
ld c,a
ld b,8
printc_1:
push bc
ld a,b
cp 1
jr nz,no_need_for_underline
ld a,(generic_console_flags)
and @00001000
jr z,no_need_for_underline
ld a,255
jr not_bold
no_need_for_underline:
ld a,(generic_console_flags)
and @00010000
ld a,(hl)
jr z,not_bold
rrca
or (hl)
not_bold:
xor c ;Add in inverse
ld c,a ;Holds character to print
push hl
push de ;Screen address
ld hl,(__lviv_ink) ;l = ink, h = paper
ld b,4
ld d,0 ;final attribute
loop1:
ld a,c
rla
ld c,a
ld a,h ;paper
jr nc,is_paper_1
ld a,l
is_paper_1:
or d
ld d,a
; Rotate the colours
ld a,l
rra
ld l,a
and a
ld a,h
rra
ld h,a
dec b
jp nz,loop1
ld a,$fd ;Page VRAM in
out ($c2),a
ld a,d
pop de
ld (de),a
ld a,$ff ;Page VRAM out
out ($c2),a
inc de
push de
; And now second half of the character
ld hl,(__lviv_ink) ;l = ink, h = paper
ld b,4
ld d,0 ;final attribute
loop2:
ld a,c
rla
ld c,a
ld a,h ;paper
jr nc,is_paper_2
ld a,l
is_paper_2:
or d
ld d,a
; Rotate the colours
ld a,l
rra
ld l,a
and a
ld a,h
rra
ld h,a
dec b
jp nz,loop2
ld a,$fd ;Page VRAM in
out ($c2),a
ld a,d
pop de
ld (de),a
ld a,$ff ;Page VRAM out
out ($c2),a
ld hl,63
add hl,de
ex de,hl
pop hl ;font
inc hl
pop bc ;loop + inverse
dec b
jp nz,printc_1
ret
; Entry: b = row
; c = column
; Exit: hl = address
generic_console_xypos:
; Each row is 64 bytes long (32x32 chars)
ld l,0
ld h,b ;x256
add hl,hl ;x512 (8 x 64)
ld b,0
add hl,bc
ld b,$40
add hl,bc
ret
convert_to_mode:
ld hl,mode_table
ld c,a
ld b,0
add hl,bc
ld a,(hl)
ret
; p0-1 p1-1 p2-1 p3-1 p0-0 p1-0 p2-0 p3-0
mode_table:
defb @00000000
defb @00001000
defb @10000000
defb @10001000
|
FormalAnalyzer/models/meta/cap_washerOperatingState.als
|
Mohannadcse/IoTCOM_BehavioralRuleExtractor
| 0 |
4574
|
// filename: cap_washerOperatingState.als
module cap_washerOperatingState
open IoTBottomUp
one sig cap_washerOperatingState extends Capability {}
{
attributes = cap_washerOperatingState_attr
}
abstract sig cap_washerOperatingState_attr extends Attribute {}
one sig cap_washerOperatingState_attr_machineState extends cap_washerOperatingState_attr {}
{
values = cap_washerOperatingState_attr_machineState_val
}
abstract sig cap_washerOperatingState_attr_machineState_val extends AttrValue {}
one sig cap_washerOperatingState_attr_machineState_val_pause extends cap_washerOperatingState_attr_machineState_val {}
one sig cap_washerOperatingState_attr_machineState_val_run extends cap_washerOperatingState_attr_machineState_val {}
one sig cap_washerOperatingState_attr_machineState_val_stop extends cap_washerOperatingState_attr_machineState_val {}
one sig cap_washerOperatingState_attr_supportedMachineStates extends cap_washerOperatingState_attr {}
{
values = cap_washerOperatingState_attr_supportedMachineStates_val
}
abstract sig cap_washerOperatingState_attr_supportedMachineStates_val extends AttrValue {}
one sig cap_washerOperatingState_attr_washerJobState extends cap_washerOperatingState_attr {}
{
values = cap_washerOperatingState_attr_washerJobState_val
}
abstract sig cap_washerOperatingState_attr_washerJobState_val extends AttrValue {}
one sig cap_washerOperatingState_attr_washerJobState_val_airWash extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_washerJobState_val_cooling extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_washerJobState_val_delayWash extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_washerJobState_val_drying extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_washerJobState_val_finish extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_washerJobState_val_none extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_washerJobState_val_preWash extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_washerJobState_val_rinse extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_washerJobState_val_spin extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_washerJobState_val_wash extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_washerJobState_val_weightSensing extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_washerJobState_val_wrinklePrevent extends cap_washerOperatingState_attr_washerJobState_val {}
one sig cap_washerOperatingState_attr_completionTime extends cap_washerOperatingState_attr {}
{
values = cap_washerOperatingState_attr_completionTime_val
}
abstract sig cap_washerOperatingState_attr_completionTime_val extends AttrValue {}
|
scripts/diglettscaveroute11.asm
|
adhi-thirumala/EvoYellow
| 16 |
164393
|
DiglettsCaveEntranceRoute11Script:
call EnableAutoTextBoxDrawing
ld a, ROUTE_11
ld [wLastMap], a
ret
DiglettsCaveEntranceRoute11TextPointers:
dw DiglettsCaveEntranceRoute11Text1
DiglettsCaveEntranceRoute11Text1:
TX_FAR _DiglettsCaveEntRoute11Text1
db "@"
|
test/fail/WithoutK10.agda
|
np/agda-git-experiment
| 1 |
5351
|
<filename>test/fail/WithoutK10.agda
{-# OPTIONS --without-K --show-implicit #-}
module WithoutK10 where
data Unit : Set where
unit : Unit
data D {A : Set} (f : Unit → A) : A → Set where
d : ∀ {x} → D f x
Foo : ∀ {A} {x : A} → D (let f = λ { unit → x } in f) x → Set₁
Foo d = Set
|
GQLLexer.g4
|
cangfengzhs/gql-grammar
| 0 |
844
|
<gh_stars>0
// $antlr-format columnLimit 150
// $antlr-format groupedAlignments false
lexer grammar GQLLexer;
SPACE: [ \t\r\n]+ -> channel(HIDDEN);
/* reserved word */
END_NODE: 'endNode';
IN_DEGREE: 'inDegree';
L_TRIM: 'lTrim';
OUT_DEGREE: 'outDegree';
PERCENTILE_CONT: 'percentileCont';
PERCENTILE_DIST: 'percentileDist';
R_TRIM: 'rTrim';
START_NODE: 'startNode';
ST_Dev: 'stDev';
ST_Dev_P: 'stDevP';
TAIL: 'tail';
TO_LOWER: 'toLower';
TO_UPPER: 'toUpper';
/* case insensitive reserved word */
// a
ABS: A B S;
ACOS: A C O S;
AGGREGATE: A G G R E G A T E;
ALIAS: A L I A S;
ALL: A L L;
AND: A N D;
ADD: A D D;
ANY: A N Y;
ARRAY: A R R A Y;
AS: A S;
ASC: A S C;
ASCENDING: A S C E N D I N G;
ASIN: A S I N;
AT: A T;
ATAN: A T A N;
AVG: A V G;
// b
BINARY: B I N A R Y;
BOOLEAN: B O O L E A N;
BOTH: B O T H;
BY: B Y;
// c
CALL: C A L L;
CASE: C A S E;
CATALOG: C A T A L O G;
CEIL: C E I L;
CEILING: C E I L I N G;
CHARACTER: C H A R A C T E R;
CHARACTER_LENGTH: C H A R A C T E R '_' L E N G T H;
CLEAR: C L E A R;
CLONE: C L O N E;
CLOSE: C L O S E;
COALESCE: C O A L E S C E;
COLLECT: C O L L E C T;
COMMIT: C O M M I T;
CONSTANT: C O N S T A N T;
CONSTRUCT: C O N S T R U C T;
COPY: C O P Y;
COS: C O S;
COSH: C O S H;
COST: C O S T;
COT: C O T;
COUNT: C O U N T;
CURRENT_DATE: CURRENT '_' DATE;
CURRENT_GRAPH: CURRENT '_' GRAPH;
CURRENT_PROPERTY_GRAPH: CURRENT '_' PROPERTY '_' GRAPH;
CURRENT_ROLE: CURRENT '_' ROLE;
CURRENT_SCHEMA: C U R R E N T '_' S C H E M A;
CURRENT_TIME: CURRENT '_' TIME;
CURRENT_TIMESTAMP: CURRENT '_' TIMESTAMP;
CURRENT_USER: CURRENT '_' USER;
CREATE: C R E A T E;
// d
DATE: D A T E;
DATETIME: D A T E T I M E;
DECIMAL: D E C I M A L;
DEFAULT: D E F A U L T;
DEGREES: D E G R E E S;
DELETE: D E L E T E;
DETACH: D E T A C H;
DESC: D E S C;
DESCENDING: D E S C E N D I N G;
DIRECTORIES: D I R E C T O R I E S;
DIRECTORY: D I R E C T O R Y;
DISTINCT: D I S T I N C T;
DO: D O;
DROP: D R O P;
DURATION: D U R A T I O N;
// e
ELSE: E L S E;
END: E N D;
ENDS: E N D S;
EMPTY_BINDING_TABLE: EMPTY '_' BINDING '_' TABLE;
EMPTY_GRAPH: EMPTY '_' GRAPH;
EMPTY_PROPERTY_GRAPH: EMPTY '_' PROPERTY '_' GRAPH;
EMPTY_TABLE: EMPTY '_' TABLE;
EXCEPT: E X C E P T;
EXISTS: E X I S T S;
EXISTING: E X I S T I N G;
EXP: E X P;
EXPLAIN: E X P L A I N;
// f
FALSE: F A L S E;
FILTER: F I L T E R;
FLOAT128: FLOAT '128';
FLOAT32: FLOAT '32';
FLOAT64: FLOAT '64';
FLOAT: F L O A T;
FLOOR: F L O O R;
FOR: F O R;
FROM: F R O M;
FUNCTION: F U N C T I O N;
FUNCTIONS: F U N C T I O N S;
// g
GQLSTATUS: G Q L S T A T U S;
GRANT: G R A N T;
GROUP: G R O U P;
// h
HAVING: H A V I N G;
HOME_GRAPH: HOME '_' GRAPH;
HOME_PROPERTY_GRAPH: HOME '_' PROPERTY '_' GRAPH;
HOME_SCHEMA: H O M E '_' S C H E M A;
// i
IN: I N;
INSERT: I N S E R T;
INTEGER32: INTEGER '32';
INTEGER64: INTEGER '64';
INTEGER16: INTEGER '16';
INTEGER8: INTEGER '8';
INTEGER128: INTEGER '128';
INTEGER: I N T E G E R;
INTERSECT: I N T E R S E C T;
IF: I F;
IS: I S;
// k
KEEP: K E E P;
// l
LEADING: L E A D I N G;
LEFT: L E F T;
LENGTH: L E N G T H;
LET: L E T;
LIKE: L I K E;
LIKE_REGEX: L I K E '_' R E G E X;
LIMIT: L I M I T;
LIST: L I S T;
LN: L N;
LOCALDATETIME: L O C A L D A T E T I M E;
LOCALTIME: L O C A L T I M E;
LOCALTIMESTAMP: L O C A L T I M E S T A M P;
LOG10: L O G '10';
LOG: L O G;
LOWER: L O W E R;
// m
MANDATORY: M A N D A T O R Y;
MAP: M A P;
MATCH: M A T C H;
MAX: M A X;
MERGE: M E R G E;
MIN: M I N;
MOD: M O D;
MULTI: M U L T I;
MULTIPLE: M U L T I P L E;
MULTISET: M U L T I S E T;
// n
NEW: N E W;
NOT: N O T;
NORMALIZE: N O R M A L I Z E;
NOTHING: N O T H I N G;
NULL: N U L L;
NULLIF: N U L L I F;
// o
OCCURRENCES_REGEX: O C C U R R E N C E S '_' R E G E X;
OCTET_LENGTH: O C T E T '_' L E N G T H;
OF: O F;
OFFSET: O F F S E T;
ON: O N;
OPTIONAL: O P T I O N A L;
OR: O R;
ORDER: O R D E R;
ORDERED: O R D E R E D;
OTHERWISE: O T H E R W I S E;
// p
PARAMETER: P A R A M E T E R;
PATH: P A T H;
PATHS: P A T H S;
PARTITION: P A R T I T I O N;
POSITION_REGEX: P O S I T I O N '_' R E G E X;
POWER: P O W E R;
PROCEDURE: P R O C E D U R E;
PROCEDURES: P R O C E D U R E S;
PRODUCT: P R O D U C T;
PROFILE: P R O F I L E;
PROJECT: P R O J E C T;
// q
QUERY: Q U E R Y;
QUERIES: Q U E R I E S;
// r
RADIANS: R A D I A N S;
RECORD: R E C O R D;
RECORDS: R E C O R D S;
REFERENCE: R E F E R E N C E;
REMOVE: R E M O V E;
REPLACE: R E P L A C E;
REQUIRE: R E Q U I R E;
RESET: R E S E T;
RESULT: R E S U L T;
RETURN: R E T U R N;
REVOKE: R E V O K E;
RIGHT: R I G H T;
ROLLBACK: R O L L B A C K;
// s
SCALAR: S C A L A R;
SCHEMA: S C H E M A;
SCHEMAS: S C H E M A S;
SCHEMATA: S C H E M A T A;
SELECT: S E L E C T;
SESSION: S E S S I O N;
SET: S E T;
SKIP_: S K I P;
SIN: S I N;
SINGLE: S I N G L E;
SINH: S I N H;
SQRT: S Q R T;
START: S T A R T;
STARTS: S T A R T S;
STRING: S T R I N G;
SUBSTRING: S U B S T R I N G;
SUBSTRING_REGEX: S U B S T R I N G '_' R E G E X;
SUM: S U M;
// t
TAN: T A N;
TANH: T A N H;
THEN: T H E N;
TIME: T I M E;
TIMESTAMP: T I M E S T A M P;
TRAILING: T R A I L I N G;
TRANSLATE_REGEX: T R A N S L A T E '_' R E G E X;
TRIM: T R I M;
TRUE: T R U E;
TRUNCATE: T R U N C A T E;
// u
UNION: U N I O N;
UNIT: U N I T;
UNIT_BINDING_TABLE: UNIT '_' BINDING '_' TABLE;
UNIT_TABLE: UNIT '_' TABLE;
UNIQUE: U N I Q U E;
UNNEST: U N N E S T;
UNKNOWN: U N K N O W N;
UNWIND: U N W I N D;
UPPER: U P P E R;
USE: U S E;
// v
VALUE: V A L U E;
VALUES: V A L U E S;
// w
WHEN: W H E N;
WHERE: W H E R E;
WITH: W I T H;
// x
XOR: X O R;
// y
YIELD: Y I E L D;
// z
ZERO: Z E R O;
/* case insensitive non reserved word */
ACYCLIC: A C Y C L I C;
BINDING: B I N D I N G;
CLASS_ORIGIN: C L A S S '_' O R I G I N;
COMMAND_FUNCTION_CODE: C O M M A N D '_' F U N C T I O N '_' C O D E;
CONDITION_NUMBER: C O N D I T I O N '_' N U M B E R;
CONNECTING: C O N N E C T I N G;
DESTINATION: D E S T I N A T I O N;
DIRECTED: D I R E C T E D;
EDGE: E D G E;
EDGES: E D G E S;
FINAL: F I N A L;
GRAPH: G R A P H;
GRAPHS: G R A P H S;
GROUPS: G R O U P S;
INDEX: I N D E X;
LABEL: L A B E L;
LABELS: L A B E L S;
MESSAGE_TEXT: M E S S A G E '_' T E X T;
MORE_: M O R E;
MUTABLE: M U T A B L E;
NFC: N F C;
NFD: N F D;
NFKC: N F K C;
NFKD: N F K D;
NODE: N O D E;
NODES: N O D E S;
NORMALIZED: N O R M A L I Z E D;
NUMBER: N U M B E R;
ONLY: O N L Y;
ORDINALITY: O R D I N A L I T Y;
PATTERN: P A T T E R N;
PATTERNS: P A T T E R N S;
PROPERTY: P R O P E R T Y;
PROPERTIES: P R O P E R T I E S;
READ: R E A D;
RELATIONSHIP: R E L A T I O N S H I P;
RELATIONSHIPS: R E L A T I O N S H I P S;
RETURNED_GQLSTATUS: R E T U R N E D '_' G Q L S T A T U S;
SHORTEST: S H O R T E S T;
SIMPLE: S I M P L E;
SUBCLASS_ORIGIN: S U B C L A S S '_' O R I G I N;
TABLE: T A B L E;
TABLES: T A B L E S;
TIES: T I E S;
TO: T O;
TRAIL: T R A I L;
TRANSACTION: T R A N S A C T I O N;
TYPE: T Y P E;
TYPES: T Y P E S;
UNDIRECTED: U N D I R E C T E D;
VERTEX: V E R T E X;
VERTICES: V E R T I C E S;
WALK: W A L K;
WRITE: W R I T E;
ZONE: Z O N E;
/* punctuation */
P_AMPERSAND: '&';
P_STAR: '*';
P_circumflex: '^';
P_COLON: ':';
P_DOLLAR: '$';
P_DOUBLE_QUOTE: '"';
P_EQUAL: '=';
P_NOT_EQUAL: '<>';
P_LESS_THAN: P_L_ANGLE_BRACKET;
P_LESS_EQUAL: '<=';
P_GREATE_THAN: P_R_ANGLE_BRACKET;
P_GREATE_EQUAL: '>=';
P_EXCLAMATION: '!';
P_R_ANGLE_BRACKET: '>';
P_BACKQUOTE: '`';
P_L_BRACE: '{';
P_L_BRACKET: '[';
P_L_PAREN: '(';
P_L_ANGLE_BRACKET: '<';
P_MINUS: '-';
P_PERCENT: '%';
P_DOT: '.';
P_DOUBLE_DOT: '..';
P_PLUS: '+';
P_QUESTION: '?';
P_QUOTE: '\'';
P_REVERSE_SOLIDUS: '\\';
P_R_BRACE: '}';
P_R_BRACKET: ']';
P_R_PAREN: ')';
P_SEMI: ';';
P_SOLIDUS: '/';
P_TILDE: '~';
P_UNDERSCORE: '_';
P_V_BAR: '|';
P_COMMA: ',';
P_CONCATENATION: '||';
P_MULTISET_ALTERNATION: '|+|';
P_EXP: E;
// raw
LEFT_MINUS_SLASH: '<-/';
SLASH_MINUS: '/-';
TILDE_SLASH: '~/';
SLASH_TILDE: '/~';
MINUS_SLASH: '-/';
SLASH_MINUS_RIGHT: '/->';
LEFT_TILDE_SLASH: '<~/';
SLASH_TILDE_RIGTH: '/~>';
MINUS_LEFT_BRACKET: '-[';
BRACKET_RIGHT_ARROW: ']->';
LEFT_ARROW_BRACKET: '<-[';
RIGHT_BRACKET_MINUS: ']-';
TILDE_LEFT_BRACKET: '~[';
LEFT_ARROW_TILDE_BRACKET: '<~[';
RIGHT_BRACKET_TILDE: ']~';
BRACKET_TILDE_RIGHT_ARROW: ']~>';
RIGHT_ARROW: '->';
LEFT_ARROW_TILDE: '<~';
TILDE_RIGHT_ARROW: '~>';
LEFT_MINUS_RIGHT: '<->';
LEFT_ARROW: '<-';
// other
NODE_SYNONYM: NODE | VERTEX;
EDGE_SYNONYM: EDGE | RELATIONSHIP;
IF_EXISTS: IF EXISTS;
IF_NOT_EXISTS: IF NOT EXISTS;
// identifier
IDENTIFIER: ID_START ID_CONTINUE*;
DELIMITED_IDENTIFIER: P_BACKQUOTE ('\\' . | '``' | ~('`' | '\\'))* P_BACKQUOTE;
// literal
DOUBLE_QUOTE_STRING_LITERAL: '"' ('\\' . | '""' | ~('"' | '\\'))* '"';
QUOTE_STRING_LITERAL: '\'' ('\\' . | '\'\'' | ~('\'' | '\\'))* '\'';
STRING_LITERAL: QUOTE_STRING_LITERAL | DOUBLE_QUOTE_STRING_LITERAL;
UNSIGNED_BIN_INTEGER: '0b' BIN_DIGIT (P_UNDERSCORE? BIN_DIGIT)*;
UNSIGNED_DECIMAL_INTEGER: DIGIT ( P_UNDERSCORE? DIGIT)*;
UNSIGNED_HEX_INTEGER: '0x' HEX_DIGIT (P_UNDERSCORE? HEX_DIGIT)*;
UNSIGNED_OCT_INTEGER: '0o' OCT_DIGIT (P_UNDERSCORE? OCT_DIGIT)*;
BINARY_STRING_LITERAL: X '\'' HEX_DIGIT+ '\'';
fragment USER: U S E R;
fragment CURRENT: C U R R E N T;
fragment HOME: H O M E;
fragment ROLE: R O L E;
fragment EMPTY: E M P T Y;
fragment HEX_DIGIT: [0-9a-fA-F];
fragment OCT_DIGIT: [0-7];
fragment BIN_DIGIT: [01];
fragment DIGIT: [0-9];
fragment A: [aA];
fragment B: [bB];
fragment C: [cC];
fragment D: [dD];
fragment E: [eE];
fragment F: [fF];
fragment G: [gG];
fragment H: [hH];
fragment I: [iI];
fragment J: [jJ];
fragment K: [kK];
fragment L: [lL];
fragment M: [mM];
fragment N: [nN];
fragment O: [oO];
fragment P: [pP];
fragment Q: [qQ];
fragment R: [rR];
fragment S: [sS];
fragment T: [tT];
fragment U: [uU];
fragment V: [vV];
fragment W: [wW];
fragment X: [xX];
fragment Y: [yY];
fragment Z: [zZ];
fragment ID_START: [\p{L}\p{Nl}];
fragment ID_CONTINUE: [\p{ID_Start}\p{Mn}\p{Mc}\p{Nd}\p{Pc}];
|
oeis/024/A024444.asm
|
neoneye/loda-programs
| 11 |
172508
|
<gh_stars>10-100
; A024444: Expansion of 1/((1-x)(1-7x)(1-10x)(1-11x)).
; Submitted by <NAME>
; 1,29,556,8886,128247,1735335,22472122,281988512,3456550933,41615912481,494043113928,5799461900778,67460105552659,778834444699067,8935702988139574,101983512655795284,1158765208828679025
add $0,2
lpb $0
sub $0,1
add $2,2
mul $2,7
mul $3,10
add $3,$1
mul $1,11
add $1,$2
lpe
mov $0,$3
div $0,14
|
software/modules/buildinfo.adb
|
TUM-EI-RCS/StratoX
| 12 |
2503
|
with MyStrings; use MyStrings;
package body Buildinfo with SPARK_Mode is
function Short_Datetime return String is
l_date : constant String := Compilation_ISO_Date;
b_time : constant String := Strip_Non_Alphanum (Compilation_Time);
b_date : constant String := Strip_Non_Alphanum (l_date (l_date'First + 2 .. l_date'Last));
shortstring : String (1 .. 11);
begin
-- XXX array concatenation: L-value is should be a constrained array, see AARM-4.5.3-6f
if b_date'Length > 5 and then b_time'Length > 3 then
shortstring (1 .. 6) := b_date (b_date'First .. b_date'First + 5);
pragma Annotate (GNATProve, False_Positive, """shortstring"" might not be initialized", "that is done right here");
shortstring (7) := '_';
shortstring (8 .. 11) := b_time (b_time'First .. b_time'First + 3);
else
declare
tmp : String (1 .. 9);
begin
tmp (tmp'First .. tmp'First - 1 + b_date'Length) := b_date;
pragma Annotate (GNATProve, False_Positive, """tmp"" might not be initialized", "that is done right here");
tmp (tmp'First + b_date'Length) := '_';
tmp (tmp'First + b_date'Length + 1 .. tmp'First + b_date'Length + b_time'Length) := b_time;
StrCpySpace (instring => tmp, outstring => shortstring);
end;
end if;
return shortstring;
end Short_Datetime;
end Buildinfo;
|
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_495.asm
|
ljhsiun2/medusa
| 9 |
177134
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1599, %r14
nop
nop
nop
nop
and $15944, %r10
movw $0x6162, (%r14)
nop
nop
nop
nop
dec %r14
lea addresses_D_ht+0x151e9, %rsi
lea addresses_D_ht+0x1e349, %rdi
nop
nop
nop
xor %rbp, %rbp
mov $0, %rcx
rep movsq
nop
nop
nop
and %rsi, %rsi
lea addresses_UC_ht+0x17839, %r11
nop
nop
xor $23258, %rcx
mov (%r11), %ebp
nop
dec %rdi
lea addresses_UC_ht+0x13705, %r11
nop
nop
nop
add $16090, %rbp
mov (%r11), %r10d
nop
nop
cmp %r14, %r14
lea addresses_WT_ht+0x1e739, %r10
nop
nop
nop
nop
and %r14, %r14
mov (%r10), %esi
and $22832, %rdi
lea addresses_WC_ht+0x1339, %rdi
dec %rbp
movw $0x6162, (%rdi)
nop
nop
nop
nop
nop
dec %r11
lea addresses_WT_ht+0x941b, %rsi
lea addresses_UC_ht+0x1cdd9, %rdi
nop
nop
nop
nop
nop
sub $42115, %rbp
mov $4, %rcx
rep movsl
nop
dec %r11
lea addresses_A_ht+0xc229, %rsi
lea addresses_normal_ht+0x15039, %rdi
nop
nop
nop
dec %r10
mov $32, %rcx
rep movsb
nop
nop
nop
nop
cmp $2821, %r14
lea addresses_normal_ht+0x16439, %r10
nop
nop
dec %rcx
mov $0x6162636465666768, %rbp
movq %rbp, (%r10)
nop
nop
nop
nop
and $59078, %r14
lea addresses_D_ht+0x1f39, %r14
nop
nop
nop
add $20117, %r11
and $0xffffffffffffffc0, %r14
vmovntdqa (%r14), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rcx
add $10605, %rdi
lea addresses_A_ht+0x14e39, %rsi
lea addresses_WT_ht+0x1db8b, %rdi
clflush (%rdi)
nop
nop
add $25600, %rax
mov $3, %rcx
rep movsq
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_A_ht+0xdc39, %rsi
lea addresses_UC_ht+0x17a39, %rdi
nop
cmp $7259, %r10
mov $78, %rcx
rep movsq
nop
nop
cmp %r10, %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %rax
push %rcx
push %rdi
push %rsi
// Store
lea addresses_US+0x1e839, %r11
nop
nop
nop
nop
sub %r14, %r14
movw $0x5152, (%r11)
cmp $11205, %rcx
// Store
lea addresses_D+0xe539, %rsi
nop
nop
nop
nop
nop
cmp $51786, %rax
movb $0x51, (%rsi)
inc %rsi
// Store
lea addresses_PSE+0xd3c1, %r15
xor $43109, %r14
movw $0x5152, (%r15)
nop
nop
nop
nop
cmp %rdi, %rdi
// Store
lea addresses_RW+0x1efb9, %r14
nop
nop
nop
nop
xor %rax, %rax
movw $0x5152, (%r14)
nop
nop
nop
nop
xor %r14, %r14
// Load
lea addresses_WT+0x1d06a, %r14
nop
nop
nop
nop
nop
cmp %rdi, %rdi
vmovups (%r14), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rsi
nop
nop
add $44448, %rsi
// Store
lea addresses_A+0x11839, %r14
nop
nop
nop
nop
nop
and $60287, %rsi
movw $0x5152, (%r14)
nop
nop
nop
nop
xor %rax, %rax
// Load
lea addresses_RW+0xbb9, %rdi
nop
nop
cmp %rcx, %rcx
movb (%rdi), %r15b
nop
nop
nop
nop
and %rax, %rax
// Faulty Load
mov $0x58e3e80000000439, %rax
nop
cmp $6924, %r14
mov (%rax), %r11
lea oracles, %r15
and $0xff, %r11
shlq $12, %r11
mov (%r15,%r11,1), %r11
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_US', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_D', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_RW', 'AVXalign': True, 'size': 2}}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_A', 'AVXalign': False, 'size': 2}}
{'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_RW', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_D_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2}}
{'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 8}}
{'src': {'NT': True, 'same': False, 'congruent': 8, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WT_ht'}}
{'src': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_UC_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
*/
|
Task/N-queens-problem/Ada/n-queens-problem-2.ada
|
LaudateCorpus1/RosettaCodeData
| 1 |
20084
|
<filename>Task/N-queens-problem/Ada/n-queens-problem-2.ada
with Ada.Text_IO;
use Ada.Text_IO;
procedure CountQueens is
function Queens (N : Integer) return Long_Integer is
A : array (0 .. N) of Integer;
U : array (0 .. 2 * N - 1) of Boolean := (others => true);
V : array (0 .. 2 * N - 1) of Boolean := (others => true);
M : Long_Integer := 0;
procedure Sub (I: Integer) is
K, P, Q: Integer;
begin
if N = I then
M := M + 1;
else
for J in I .. N - 1 loop
P := I + A (J);
Q := I + N - 1 - A (J);
if U (P) and then V (Q) then
U (P) := false;
V (Q) := false;
K := A (I);
A (I) := A (J);
A (J) := K;
Sub (I + 1);
U (P) := true;
V (Q) := true;
K := A (I);
A (I) := A (J);
A (J) := K;
end if;
end loop;
end if;
end Sub;
begin
for I in 0 .. N - 1 loop
A (I) := I;
end loop;
Sub (0);
return M;
end Queens;
begin
for N in 1 .. 16 loop
Put (Integer'Image (N));
Put (" ");
Put_Line (Long_Integer'Image (Queens (N)));
end loop;
end CountQueens;
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-nbnbre.adb
|
djamal2727/Main-Bearing-Analytical-Model
| 0 |
7423
|
<filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-nbnbre.adb
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- ADA.NUMERICS.BIG_NUMBERS.BIG_REALS --
-- --
-- B o d y --
-- --
-- Copyright (C) 2019-2020, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is the default version of this package, based on Big_Integers only.
with Ada.Strings.Text_Output.Utils;
package body Ada.Numerics.Big_Numbers.Big_Reals is
use Big_Integers;
procedure Normalize (Arg : in out Big_Real);
-- Normalize Arg by ensuring that Arg.Den is always positive and that
-- Arg.Num and Arg.Den always have a GCD of 1.
--------------
-- Is_Valid --
--------------
function Is_Valid (Arg : Big_Real) return Boolean is
(Is_Valid (Arg.Num) and Is_Valid (Arg.Den));
---------
-- "/" --
---------
function "/" (Num, Den : Valid_Big_Integer) return Valid_Big_Real is
Result : Big_Real;
begin
if Den = To_Big_Integer (0) then
raise Constraint_Error with "divide by zero";
end if;
Result.Num := Num;
Result.Den := Den;
Normalize (Result);
return Result;
end "/";
---------------
-- Numerator --
---------------
function Numerator (Arg : Valid_Big_Real) return Valid_Big_Integer is
(Arg.Num);
-----------------
-- Denominator --
-----------------
function Denominator (Arg : Valid_Big_Real) return Big_Positive is
(Arg.Den);
---------
-- "=" --
---------
function "=" (L, R : Valid_Big_Real) return Boolean is
(abs L.Num = abs R.Num and then L.Den = R.Den);
---------
-- "<" --
---------
function "<" (L, R : Valid_Big_Real) return Boolean is
(abs L.Num * R.Den < abs R.Num * L.Den);
----------
-- "<=" --
----------
function "<=" (L, R : Valid_Big_Real) return Boolean is (not (R < L));
---------
-- ">" --
---------
function ">" (L, R : Valid_Big_Real) return Boolean is (R < L);
----------
-- ">=" --
----------
function ">=" (L, R : Valid_Big_Real) return Boolean is (not (L < R));
-----------------------
-- Float_Conversions --
-----------------------
package body Float_Conversions is
-----------------
-- To_Big_Real --
-----------------
function To_Big_Real (Arg : Num) return Valid_Big_Real is
begin
return From_String (Arg'Image);
end To_Big_Real;
-------------------
-- From_Big_Real --
-------------------
function From_Big_Real (Arg : Big_Real) return Num is
begin
return Num'Value (To_String (Arg));
end From_Big_Real;
end Float_Conversions;
-----------------------
-- Fixed_Conversions --
-----------------------
package body Fixed_Conversions is
-----------------
-- To_Big_Real --
-----------------
function To_Big_Real (Arg : Num) return Valid_Big_Real is
begin
return From_String (Arg'Image);
end To_Big_Real;
-------------------
-- From_Big_Real --
-------------------
function From_Big_Real (Arg : Big_Real) return Num is
begin
return Num'Value (To_String (Arg));
end From_Big_Real;
end Fixed_Conversions;
---------------
-- To_String --
---------------
function To_String
(Arg : Valid_Big_Real;
Fore : Field := 2;
Aft : Field := 3;
Exp : Field := 0) return String
is
Zero : constant Big_Integer := To_Big_Integer (0);
Ten : constant Big_Integer := To_Big_Integer (10);
function Leading_Padding
(Str : String;
Min_Length : Field;
Char : Character := ' ') return String;
-- Return padding of Char concatenated with Str so that the resulting
-- string is at least Min_Length long.
function Trailing_Padding
(Str : String;
Length : Field;
Char : Character := '0') return String;
-- Return Str with trailing Char removed, and if needed either
-- truncated or concatenated with padding of Char so that the resulting
-- string is Length long.
function Image (N : Natural) return String;
-- Return image of N, with no leading space.
function Numerator_Image
(Num : Big_Integer;
After : Natural) return String;
-- Return image of Num as a float value with After digits after the "."
-- and taking Fore, Aft, Exp into account.
-----------
-- Image --
-----------
function Image (N : Natural) return String is
S : constant String := Natural'Image (N);
begin
return S (2 .. S'Last);
end Image;
---------------------
-- Leading_Padding --
---------------------
function Leading_Padding
(Str : String;
Min_Length : Field;
Char : Character := ' ') return String is
begin
if Str = "" then
return Leading_Padding ("0", Min_Length, Char);
else
return (1 .. Integer'Max (Integer (Min_Length) - Str'Length, 0)
=> Char) & Str;
end if;
end Leading_Padding;
----------------------
-- Trailing_Padding --
----------------------
function Trailing_Padding
(Str : String;
Length : Field;
Char : Character := '0') return String is
begin
if Str'Length > 0 and then Str (Str'Last) = Char then
for J in reverse Str'Range loop
if Str (J) /= '0' then
return Trailing_Padding
(Str (Str'First .. J), Length, Char);
end if;
end loop;
end if;
if Str'Length >= Length then
return Str (Str'First .. Str'First + Length - 1);
else
return Str &
(1 .. Integer'Max (Integer (Length) - Str'Length, 0)
=> Char);
end if;
end Trailing_Padding;
---------------------
-- Numerator_Image --
---------------------
function Numerator_Image
(Num : Big_Integer;
After : Natural) return String
is
Tmp : constant String := To_String (Num);
Str : constant String (1 .. Tmp'Last - 1) := Tmp (2 .. Tmp'Last);
Index : Integer;
begin
if After = 0 then
return Leading_Padding (Str, Fore) & "."
& Trailing_Padding ("0", Aft);
else
Index := Str'Last - After;
if Index < 0 then
return Leading_Padding ("0", Fore)
& "."
& Trailing_Padding ((1 .. -Index => '0') & Str, Aft)
& (if Exp = 0 then "" else "E+" & Image (Natural (Exp)));
else
return Leading_Padding (Str (Str'First .. Index), Fore)
& "."
& Trailing_Padding (Str (Index + 1 .. Str'Last), Aft)
& (if Exp = 0 then "" else "E+" & Image (Natural (Exp)));
end if;
end if;
end Numerator_Image;
begin
if Arg.Num < Zero then
declare
Str : String := To_String (-Arg, Fore, Aft, Exp);
begin
if Str (1) = ' ' then
for J in 1 .. Str'Last - 1 loop
if Str (J + 1) /= ' ' then
Str (J) := '-';
exit;
end if;
end loop;
return Str;
else
return '-' & Str;
end if;
end;
else
-- Compute Num * 10^Aft so that we get Aft significant digits
-- in the integer part (rounded) to display.
return Numerator_Image
((Arg.Num * Ten ** Aft) / Arg.Den, After => Exp + Aft);
end if;
end To_String;
-----------------
-- From_String --
-----------------
function From_String (Arg : String) return Big_Real is
Ten : constant Big_Integer := To_Big_Integer (10);
Frac : Big_Integer;
Exp : Integer := 0;
Pow : Natural := 0;
Index : Natural := 0;
Last : Natural := Arg'Last;
begin
for J in reverse Arg'Range loop
if Arg (J) in 'e' | 'E' then
if Last /= Arg'Last then
raise Constraint_Error with "multiple exponents specified";
end if;
Last := J - 1;
Exp := Integer'Value (Arg (J + 1 .. Arg'Last));
Pow := 0;
elsif Arg (J) = '.' then
Index := J - 1;
exit;
else
Pow := Pow + 1;
end if;
end loop;
if Index = 0 then
raise Constraint_Error with "invalid real value";
end if;
declare
Result : Big_Real;
begin
Result.Den := Ten ** Pow;
Result.Num := From_String (Arg (Arg'First .. Index)) * Result.Den;
Frac := From_String (Arg (Index + 2 .. Last));
if Result.Num < To_Big_Integer (0) then
Result.Num := Result.Num - Frac;
else
Result.Num := Result.Num + Frac;
end if;
if Exp > 0 then
Result.Num := Result.Num * Ten ** Exp;
elsif Exp < 0 then
Result.Den := Result.Den * Ten ** (-Exp);
end if;
Normalize (Result);
return Result;
end;
end From_String;
--------------------------
-- From_Quotient_String --
--------------------------
function From_Quotient_String (Arg : String) return Valid_Big_Real is
Index : Natural := 0;
begin
for J in Arg'First + 1 .. Arg'Last - 1 loop
if Arg (J) = '/' then
Index := J;
exit;
end if;
end loop;
if Index = 0 then
raise Constraint_Error with "no quotient found";
end if;
return Big_Integers.From_String (Arg (Arg'First .. Index - 1)) /
Big_Integers.From_String (Arg (Index + 1 .. Arg'Last));
end From_Quotient_String;
---------------
-- Put_Image --
---------------
procedure Put_Image (S : in out Sink'Class; V : Big_Real) is
-- This is implemented in terms of To_String. It might be more elegant
-- and more efficient to do it the other way around, but this is the
-- most expedient implementation for now.
begin
Strings.Text_Output.Utils.Put_UTF_8 (S, To_String (V));
end Put_Image;
---------
-- "+" --
---------
function "+" (L : Valid_Big_Real) return Valid_Big_Real is
Result : Big_Real;
begin
Result.Num := L.Num;
Result.Den := L.Den;
return Result;
end "+";
---------
-- "-" --
---------
function "-" (L : Valid_Big_Real) return Valid_Big_Real is
(Num => -L.Num, Den => L.Den);
-----------
-- "abs" --
-----------
function "abs" (L : Valid_Big_Real) return Valid_Big_Real is
(Num => abs L.Num, Den => L.Den);
---------
-- "+" --
---------
function "+" (L, R : Valid_Big_Real) return Valid_Big_Real is
Result : Big_Real;
begin
Result.Num := L.Num * R.Den + R.Num * L.Den;
Result.Den := L.Den * R.Den;
Normalize (Result);
return Result;
end "+";
---------
-- "-" --
---------
function "-" (L, R : Valid_Big_Real) return Valid_Big_Real is
Result : Big_Real;
begin
Result.Num := L.Num * R.Den - R.Num * L.Den;
Result.Den := L.Den * R.Den;
Normalize (Result);
return Result;
end "-";
---------
-- "*" --
---------
function "*" (L, R : Valid_Big_Real) return Valid_Big_Real is
Result : Big_Real;
begin
Result.Num := L.Num * R.Num;
Result.Den := L.Den * R.Den;
Normalize (Result);
return Result;
end "*";
---------
-- "/" --
---------
function "/" (L, R : Valid_Big_Real) return Valid_Big_Real is
Result : Big_Real;
begin
Result.Num := L.Num * R.Den;
Result.Den := L.Den * R.Num;
Normalize (Result);
return Result;
end "/";
----------
-- "**" --
----------
function "**" (L : Valid_Big_Real; R : Integer) return Valid_Big_Real is
Result : Big_Real;
begin
if R = 0 then
Result.Num := To_Big_Integer (1);
Result.Den := To_Big_Integer (1);
else
if R < 0 then
Result.Num := L.Den ** (-R);
Result.Den := L.Num ** (-R);
else
Result.Num := L.Num ** R;
Result.Den := L.Den ** R;
end if;
Normalize (Result);
end if;
return Result;
end "**";
---------
-- Min --
---------
function Min (L, R : Valid_Big_Real) return Valid_Big_Real is
(if L < R then L else R);
---------
-- Max --
---------
function Max (L, R : Valid_Big_Real) return Valid_Big_Real is
(if L > R then L else R);
---------------
-- Normalize --
---------------
procedure Normalize (Arg : in out Big_Real) is
Zero : constant Big_Integer := To_Big_Integer (0);
begin
if Arg.Den < Zero then
Arg.Num := -Arg.Num;
Arg.Den := -Arg.Den;
end if;
if Arg.Num = Zero then
Arg.Den := To_Big_Integer (1);
else
declare
GCD : constant Big_Integer :=
Greatest_Common_Divisor (Arg.Num, Arg.Den);
begin
Arg.Num := Arg.Num / GCD;
Arg.Den := Arg.Den / GCD;
end;
end if;
end Normalize;
end Ada.Numerics.Big_Numbers.Big_Reals;
|
libsrc/_DEVELOPMENT/target/zx/driver/terminal/zx_01_output_fzx/zx_01_output_fzx_proc_move_left_right.asm
|
meesokim/z88dk
| 0 |
4995
|
<filename>libsrc/_DEVELOPMENT/target/zx/driver/terminal/zx_01_output_fzx/zx_01_output_fzx_proc_move_left_right.asm
SECTION code_fcntl
PUBLIC zx_01_output_fzx_proc_move_left_right
EXTERN l_divu_hl
zx_01_output_fzx_proc_move_left_right:
; helper for left/right functions
;
; on stack = return, function address
ld l,(ix+37)
ld h,(ix+38) ; hl = y coord
call l_divu_hl - 6 ; hl = y / 8
ld d,l ; d = y coord in characters
ld l,(ix+35)
ld h,(ix+36) ; hl = x coord
call l_divu_hl - 6 ; hl = x / 8
ld e,l ; e = x coord in characters
ld l,(ix+45)
ld h,(ix+46) ; hl = paper.height
call l_divu_hl - 6
ld b,l ; b = paper.height in characters
ld l,(ix+41)
ld h,(ix+42) ; hl = paper.width
call l_divu_hl - 6
ld c,l ; c = paper.width in characters
ld hl,return
ex (sp),hl
jp (hl) ; call function
return:
ld l,e
ld h,0 ; hl = x coord in characters
add hl,hl
add hl,hl
add hl,hl
ld (ix+35),l
ld (ix+36),h ; set new x coord
ld l,d ; hl = y coord in characters
add hl,hl
add hl,hl
add hl,hl
ld (ix+37),l
ld (ix+38),h ; set new y coord
ret
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/aggr9.ads
|
best08618/asylo
| 7 |
4294
|
with Aggr9_Pkg; use Aggr9_Pkg;
package Aggr9 is
procedure Proc (X : R1);
end Aggr9;
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48_notsx.log_21829_1950.asm
|
ljhsiun2/medusa
| 9 |
5351
|
<filename>Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48_notsx.log_21829_1950.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r15
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xead2, %rbp
nop
nop
nop
nop
nop
xor %rcx, %rcx
movw $0x6162, (%rbp)
nop
nop
nop
and $12972, %rdx
lea addresses_D_ht+0x175e6, %rbx
nop
nop
nop
sub %rbp, %rbp
movb (%rbx), %r15b
nop
nop
nop
nop
nop
and $44303, %rbp
lea addresses_normal_ht+0x106e, %rsi
lea addresses_A_ht+0x378c, %rdi
clflush (%rsi)
nop
nop
nop
add %r9, %r9
mov $37, %rcx
rep movsw
nop
add %rbx, %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r8
push %rax
push %rdi
push %rsi
// Store
lea addresses_WT+0x1f22, %rsi
nop
nop
xor %rdi, %rdi
movw $0x5152, (%rsi)
nop
sub $138, %rdi
// Store
lea addresses_WT+0x8ea2, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
dec %r12
movl $0x51525354, (%rdi)
nop
xor %r14, %r14
// Store
lea addresses_WC+0x10ac2, %r14
nop
dec %rsi
mov $0x5152535455565758, %r8
movq %r8, %xmm6
vmovups %ymm6, (%r14)
nop
nop
and $13226, %rsi
// Store
mov $0x53634e00000004cf, %rsi
nop
cmp %r11, %r11
mov $0x5152535455565758, %rax
movq %rax, %xmm3
movaps %xmm3, (%rsi)
nop
nop
nop
nop
nop
inc %rdi
// Faulty Load
mov $0x19f4f500000004a2, %rdi
nop
nop
and %rsi, %rsi
movb (%rdi), %r11b
lea oracles, %rax
and $0xff, %r11
shlq $12, %r11
mov (%rax,%r11,1), %r11
pop %rsi
pop %rdi
pop %rax
pop %r8
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_NC', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT', 'congruent': 6}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_NC', 'congruent': 0}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_NC', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_A_ht', 'congruent': 3}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 1}}
{'dst': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_normal_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
*/
|
sse/mb_mgr_hmac_submit_ni_sse.asm
|
kingwelx/intel-ipsec-mb
| 0 |
28817
|
;;
;; Copyright (c) 2012-2018, Intel Corporation
;;
;; 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 Intel Corporation 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 OWNER 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.
;;
;; In System V AMD64 ABI
;; calle saves: RBX, RBP, R12-R15
;; Windows x64 ABI
;; calle saves: RBX, RBP, RDI, RSI, RSP, R12-R15
;;
;; Registers: RAX RBX RCX RDX RBP RSI RDI R8 R9 R10 R11 R12 R13 R14 R15
;; -----------------------------------------------------------
;; Windows clobbers: RAX RCX RDX R8 R9 R10 R11
;; Windows preserves: RBX RBP RSI RDI R12 R13 R14 R15
;; -----------------------------------------------------------
;; Linux clobbers: RAX RCX RDX RSI RDI R8 R9 R10 R11
;; Linux preserves: RBX RBP R12 R13 R14 R15
;; -----------------------------------------------------------
;;
;; Linux/Windows clobbers: xmm0 - xmm15
;;
%include "os.asm"
%include "job_aes_hmac.asm"
%include "mb_mgr_datastruct.asm"
%include "reg_sizes.asm"
%include "memcpy.asm"
;%define DO_DBGPRINT
%include "dbgprint.asm"
extern sha1_ni
section .data
default rel
align 16
byteswap:
dq 0x0405060700010203
dq 0x0c0d0e0f08090a0b
section .text
%ifdef LINUX
%define arg1 rdi
%define arg2 rsi
%define reg3 rcx
%define reg4 rdx
%else
%define arg1 rcx
%define arg2 rdx
%define reg3 rdi
%define reg4 rsi
%endif
%define state arg1
%define job arg2
%define len2 arg2
; idx needs to be in rbx, rbp, r12-r15
%define last_len rbp
%define idx rbp
%define p4 rbp
%define p r11
%define start_offset r11
%define unused_lanes rbx
%define tmp4 rbx
%define p3 rbx
%define job_rax rax
%define len rax
%define size_offset reg3
%define tmp2 reg3
%define lane reg4
%define tmp3 reg4
%define extra_blocks r8
%define tmp r9
%define p2 r9
%define lane_data r10
struc STACK
_gpr_save: resq 4
_rsp_save: resq 1
endstruc
; JOB* submit_job_hmac_ni_sse(MB_MGR_HMAC_SHA_1_OOO *state, JOB_AES_HMAC *job)
; arg 1 : rcx : state
; arg 2 : rdx : job
MKGLOBAL(submit_job_hmac_ni_sse,function,internal)
submit_job_hmac_ni_sse:
mov rax, rsp
sub rsp, STACK_size
and rsp, -16
mov [rsp + _gpr_save + 8*0], rbx
mov [rsp + _gpr_save + 8*1], rbp
%ifndef LINUX
mov [rsp + _gpr_save + 8*2], rsi
mov [rsp + _gpr_save + 8*3], rdi
%endif
mov [rsp + _rsp_save], rax ; original SP
DBGPRINTL "enter sha1-ni-sse submit"
mov unused_lanes, [state + _unused_lanes]
movzx lane, BYTE(unused_lanes)
DBGPRINTL64 "lane: ", lane
shr unused_lanes, 8
imul lane_data, lane, _HMAC_SHA1_LANE_DATA_size
lea lane_data, [state + _ldata + lane_data]
mov [state + _unused_lanes], unused_lanes
mov len, [job + _msg_len_to_hash_in_bytes]
DBGPRINTL64 "length: ", len
mov tmp, len
shr tmp, 6 ; divide by 64, len in terms of blocks
mov [lane_data + _job_in_lane], job
mov dword [lane_data + _outer_done], 0
mov [state + _lens + 2*lane], WORD(tmp)
mov last_len, len
and last_len, 63
lea extra_blocks, [last_len + 9 + 63]
shr extra_blocks, 6
mov [lane_data + _extra_blocks], DWORD(extra_blocks)
mov p, [job + _src]
add p, [job + _hash_start_src_offset_in_bytes]
DBGPRINTL64 "src pointer + offset:", p
mov [state + _args_data_ptr + PTR_SZ*lane], p
cmp len, 64
jb copy_lt64
fast_copy:
add p, len
movdqu xmm0, [p - 64 + 0*16]
movdqu xmm1, [p - 64 + 1*16]
movdqu xmm2, [p - 64 + 2*16]
movdqu xmm3, [p - 64 + 3*16]
movdqa [lane_data + _extra_block + 0*16], xmm0
movdqa [lane_data + _extra_block + 1*16], xmm1
movdqa [lane_data + _extra_block + 2*16], xmm2
movdqa [lane_data + _extra_block + 3*16], xmm3
end_fast_copy:
mov size_offset, extra_blocks
shl size_offset, 6
sub size_offset, last_len
add size_offset, 64-8
mov [lane_data + _size_offset], DWORD(size_offset)
mov start_offset, 64
sub start_offset, last_len
mov [lane_data + _start_offset], DWORD(start_offset)
lea tmp, [8*64 + 8*len]
bswap tmp
mov [lane_data + _extra_block + size_offset], tmp
mov tmp, [job + _auth_key_xor_ipad]
movdqu xmm0, [tmp]
mov DWORD(tmp), [tmp + 4*SHA1_DIGEST_WORD_SIZE]
%if SHA1NI_DIGEST_ROW_SIZE != 20
%error "Below code has been optimized for SHA1NI_DIGEST_ROW_SIZE = 20!"
%endif
lea p4, [lane + lane*4]
movdqu [state + _args_digest + p4*4 + 0*SHA1_DIGEST_WORD_SIZE], xmm0
mov [state + _args_digest + p4*4 + 4*SHA1_DIGEST_WORD_SIZE], DWORD(tmp)
test len, ~63
jnz ge64_bytes
lt64_bytes:
mov [state + _lens + 2*lane], WORD(extra_blocks)
lea tmp, [lane_data + _extra_block + start_offset]
mov [state + _args_data_ptr + PTR_SZ*lane], tmp
mov dword [lane_data + _extra_blocks], 0
ge64_bytes:
cmp unused_lanes, 0xff
jne return_null
jmp start_loop
align 16
start_loop:
; Find min length - only two lanes available
xor len2, len2
mov p3, 0x10000
mov WORD(len2), word [state + _lens + 0*2] ; [0:15] - lane 0 length, [16:31] - lane index (0)
mov WORD(p3), word [state + _lens + 1*2] ; [0:15] - lane 1 length, [16:31] - lane index (1)
cmp WORD(len2), WORD(p3)
cmovg DWORD(len2), DWORD(p3) ; move if lane 0 length is greater than lane 1 length
mov idx, len2 ; retrieve index & length from [16:31] and [0:15] bit fields
shr DWORD(idx), 16
and DWORD(len2), 0xffff
je len_is_0
sub word [state + _lens + 0*2], WORD(len2)
sub word [state + _lens + 1*2], WORD(len2)
; "state" and "args" are the same address, arg1
; len is arg2
call sha1_ni
; state is intact
len_is_0:
; process completed job "idx"
imul lane_data, idx, _HMAC_SHA1_LANE_DATA_size
lea lane_data, [state + _ldata + lane_data]
mov DWORD(extra_blocks), [lane_data + _extra_blocks]
cmp extra_blocks, 0
jne proc_extra_blocks
cmp dword [lane_data + _outer_done], 0
jne end_loop
proc_outer:
mov dword [lane_data + _outer_done], 1
mov DWORD(size_offset), [lane_data + _size_offset]
mov qword [lane_data + _extra_block + size_offset], 0
mov word [state + _lens + 2*idx], 1
lea tmp, [lane_data + _outer_block]
mov job, [lane_data + _job_in_lane]
mov [state + _args_data_ptr + PTR_SZ*idx], tmp
%if SHA1NI_DIGEST_ROW_SIZE != 20
%error "Below code has been optimized for SHA1NI_DIGEST_ROW_SIZE = 20!"
%endif
lea p3, [idx + idx*4]
movdqu xmm0, [state + _args_digest + p3*4 + 0*SHA1_DIGEST_WORD_SIZE]
pshufb xmm0, [rel byteswap]
mov DWORD(tmp), [state + _args_digest + p3*4 + 4*SHA1_DIGEST_WORD_SIZE]
bswap DWORD(tmp)
movdqa [lane_data + _outer_block], xmm0
mov [lane_data + _outer_block + 4*SHA1_DIGEST_WORD_SIZE], DWORD(tmp)
mov tmp, [job + _auth_key_xor_opad]
movdqu xmm0, [tmp]
mov DWORD(tmp), [tmp + 4*SHA1_DIGEST_WORD_SIZE]
movdqu [state + _args_digest + p3*4 + 0*SHA1_DIGEST_WORD_SIZE], xmm0
mov [state + _args_digest + p3*4 + 4*SHA1_DIGEST_WORD_SIZE], DWORD(tmp)
jmp start_loop
align 16
proc_extra_blocks:
mov DWORD(start_offset), [lane_data + _start_offset]
mov [state + _lens + 2*idx], WORD(extra_blocks)
lea tmp, [lane_data + _extra_block + start_offset]
mov [state + _args_data_ptr + PTR_SZ*idx], tmp
mov dword [lane_data + _extra_blocks], 0
jmp start_loop
align 16
copy_lt64:
;; less than one message block of data
;; beginning of source block
;; destination extrablock but backwards by len from where 0x80 pre-populated
lea p2, [lane_data + _extra_block + 64]
sub p2, len
memcpy_sse_64_1 p2, p, len, tmp4, tmp2, xmm0, xmm1, xmm2, xmm3
mov unused_lanes, [state + _unused_lanes]
jmp end_fast_copy
return_null:
xor job_rax, job_rax
jmp return
align 16
end_loop:
mov job_rax, [lane_data + _job_in_lane]
mov unused_lanes, [state + _unused_lanes]
mov qword [lane_data + _job_in_lane], 0
or dword [job_rax + _status], STS_COMPLETED_HMAC
shl unused_lanes, 8
or unused_lanes, idx
mov [state + _unused_lanes], unused_lanes
mov p, [job_rax + _auth_tag_output]
; copy 12 bytes
%if SHA1NI_DIGEST_ROW_SIZE != 20
%error "Below code has been optimized for SHA1NI_DIGEST_ROW_SIZE = 20!"
%endif
lea idx, [idx + 4*idx]
mov DWORD(tmp), [state + _args_digest + idx*4 + 0*SHA1_DIGEST_WORD_SIZE]
mov DWORD(tmp2), [state + _args_digest + idx*4 + 1*SHA1_DIGEST_WORD_SIZE]
mov DWORD(tmp3), [state + _args_digest + idx*4 + 2*SHA1_DIGEST_WORD_SIZE]
bswap DWORD(tmp)
bswap DWORD(tmp2)
bswap DWORD(tmp3)
mov [p + 0*SHA1_DIGEST_WORD_SIZE], DWORD(tmp)
mov [p + 1*SHA1_DIGEST_WORD_SIZE], DWORD(tmp2)
mov [p + 2*SHA1_DIGEST_WORD_SIZE], DWORD(tmp3)
cmp qword [job_rax + _auth_tag_output_len_in_bytes], 12
je return
;; copy remaining 8 bytes to return 20 byte digest
mov DWORD(tmp), [state + _args_digest + idx*4 + 3*SHA1_DIGEST_WORD_SIZE]
mov DWORD(tmp2), [state + _args_digest + idx*4 + 4*SHA1_DIGEST_WORD_SIZE]
bswap DWORD(tmp)
bswap DWORD(tmp2)
mov [p + 3*4], DWORD(tmp)
mov [p + 4*4], DWORD(tmp2)
return:
mov rbx, [rsp + _gpr_save + 8*0]
mov rbp, [rsp + _gpr_save + 8*1]
%ifndef LINUX
mov rsi, [rsp + _gpr_save + 8*2]
mov rdi, [rsp + _gpr_save + 8*3]
%endif
mov rsp, [rsp + _rsp_save] ; original SP
ret
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
|
oeis/259/A259160.asm
|
neoneye/loda-programs
| 11 |
92473
|
<reponame>neoneye/loda-programs<gh_stars>10-100
; A259160: Positive squares (A000290) that are octagonal numbers (A000567) divided by 2.
; Submitted by <NAME>(s3)
; 4,39204,376437604,3614553835204,34706945549192004,333256087548787788004,3199924917936514791223204,30725678728770327476537417604,295027963953727766493197492611204,2832858479158015285097354847515364004,27201106821847298813777034752645032556004,261185024870519284051871802597542755087387204,2507898581605619343618774234764570781704059377604,24080841919392132066908186150337606048379623056367204,231224241602104670500833059796767458511970358883178516004
seq $0,54320 ; Expansion of g.f.: (1 + x)/(1 - 10*x + x^2).
mul $0,2
pow $0,2
add $0,1
pow $0,2
div $0,6
|
oeis/017/A017818.asm
|
neoneye/loda-programs
| 11 |
241193
|
; A017818: Expansion of 1/(1-x^3-x^4-x^5).
; Submitted by <NAME>
; 1,0,0,1,1,1,1,2,3,3,4,6,8,10,13,18,24,31,41,55,73,96,127,169,224,296,392,520,689,912,1208,1601,2121,2809,3721,4930,6531,8651,11460,15182,20112,26642,35293,46754,61936,82047,108689,143983,190737,252672,334719,443409,587392,778128,1030800,1365520,1808929,2396320,3174448,4205249,5570769,7379697,9776017,12950466,17155715,22726483,30106180,39882198,52832664,69988378,92714861,122821042,162703240,215535903,285524281,378239143,501060185,663763424,879299327,1164823609,1543062752,2044122936,2707886360
mov $5,$0
mov $7,2
lpb $7
mov $0,$5
mov $1,0
mov $2,0
mov $4,0
sub $7,1
add $0,$7
sub $0,1
lpb $0
sub $0,1
add $1,1
mov $3,$1
add $4,1
mul $4,2
mov $1,$4
add $1,$2
add $2,$3
sub $1,$2
mov $4,$2
sub $4,$3
div $4,2
lpe
mov $0,$4
add $0,1
mov $8,$7
mul $8,$0
add $6,$8
lpe
min $5,1
mul $5,$0
mov $0,$6
sub $0,$5
|
include/strings_h.ads
|
docandrew/troodon
| 5 |
18254
|
pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with System;
with stddef_h;
with Interfaces.C.Strings;
with bits_types_locale_t_h;
package strings_h is
-- Copyright (C) 1991-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/>.
-- Tell the caller that we provide correct C++ prototypes.
-- Compare N bytes of S1 and S2 (same as memcmp).
function bcmp
(uu_s1 : System.Address;
uu_s2 : System.Address;
uu_n : stddef_h.size_t) return int -- /usr/include/strings.h:34
with Import => True,
Convention => C,
External_Name => "bcmp";
-- Copy N bytes of SRC to DEST (like memmove, but args reversed).
procedure bcopy
(uu_src : System.Address;
uu_dest : System.Address;
uu_n : stddef_h.size_t) -- /usr/include/strings.h:38
with Import => True,
Convention => C,
External_Name => "bcopy";
-- Set N bytes of S to 0.
procedure bzero (uu_s : System.Address; uu_n : stddef_h.size_t) -- /usr/include/strings.h:42
with Import => True,
Convention => C,
External_Name => "bzero";
-- Find the first occurrence of C in S (same as strchr).
function index (uu_s : Interfaces.C.Strings.chars_ptr; uu_c : int) return Interfaces.C.Strings.chars_ptr -- /usr/include/strings.h:48
with Import => True,
Convention => C,
External_Name => "index";
-- Find the last occurrence of C in S (same as strrchr).
function rindex (uu_s : Interfaces.C.Strings.chars_ptr; uu_c : int) return Interfaces.C.Strings.chars_ptr -- /usr/include/strings.h:76
with Import => True,
Convention => C,
External_Name => "rindex";
-- Return the position of the first bit set in I, or 0 if none are set.
-- The least-significant bit is position 1, the most-significant 32.
function ffs (uu_i : int) return int -- /usr/include/strings.h:104
with Import => True,
Convention => C,
External_Name => "ffs";
-- The following two functions are non-standard but necessary for non-32 bit
-- platforms.
function ffsl (uu_l : long) return int -- /usr/include/strings.h:110
with Import => True,
Convention => C,
External_Name => "ffsl";
function ffsll (uu_ll : Long_Long_Integer) return int -- /usr/include/strings.h:111
with Import => True,
Convention => C,
External_Name => "ffsll";
-- Compare S1 and S2, ignoring case.
function strcasecmp (uu_s1 : Interfaces.C.Strings.chars_ptr; uu_s2 : Interfaces.C.Strings.chars_ptr) return int -- /usr/include/strings.h:116
with Import => True,
Convention => C,
External_Name => "strcasecmp";
-- Compare no more than N chars of S1 and S2, ignoring case.
function strncasecmp
(uu_s1 : Interfaces.C.Strings.chars_ptr;
uu_s2 : Interfaces.C.Strings.chars_ptr;
uu_n : stddef_h.size_t) return int -- /usr/include/strings.h:120
with Import => True,
Convention => C,
External_Name => "strncasecmp";
-- POSIX.1-2008 extended locale interface (see locale.h).
-- Compare S1 and S2, ignoring case, using collation rules from LOC.
function strcasecmp_l
(uu_s1 : Interfaces.C.Strings.chars_ptr;
uu_s2 : Interfaces.C.Strings.chars_ptr;
uu_loc : bits_types_locale_t_h.locale_t) return int -- /usr/include/strings.h:128
with Import => True,
Convention => C,
External_Name => "strcasecmp_l";
-- Compare no more than N chars of S1 and S2, ignoring case, using
-- collation rules from LOC.
function strncasecmp_l
(uu_s1 : Interfaces.C.Strings.chars_ptr;
uu_s2 : Interfaces.C.Strings.chars_ptr;
uu_n : stddef_h.size_t;
uu_loc : bits_types_locale_t_h.locale_t) return int -- /usr/include/strings.h:133
with Import => True,
Convention => C,
External_Name => "strncasecmp_l";
-- Functions with security checks.
end strings_h;
|
llvm-gcc-4.2-2.9/gcc/ada/bindusg.adb
|
vidkidz/crossbridge
| 1 |
26643
|
<filename>llvm-gcc-4.2-2.9/gcc/ada/bindusg.adb
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- B I N D U S G --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Osint; use Osint;
with Output; use Output;
procedure Bindusg is
-- Start of processing for Bindusg
begin
-- Usage line
Write_Str ("Usage: ");
Write_Program_Name;
Write_Char (' ');
Write_Str ("switches lfile");
Write_Eol;
Write_Eol;
-- Line for -aO switch
Write_Str (" -aOdir Specify library files search path");
Write_Eol;
-- Line for -aI switch
Write_Str (" -aIdir Specify source files search path");
Write_Eol;
-- Line for a switch
Write_Str (" -a Automatically initialize elaboration procedure");
Write_Eol;
-- Line for A switch
Write_Str (" -A Generate binder program in Ada (default)");
Write_Eol;
-- Line for -b switch
Write_Str (" -b Generate brief messages to std");
Write_Str ("err even if verbose mode set");
Write_Eol;
-- Line for -c switch
Write_Str (" -c Check only, no generation of b");
Write_Str ("inder output file");
Write_Eol;
-- Line for C switch
Write_Str (" -C Generate binder program in C");
Write_Eol;
-- Line for -d switch
Write_Str (" -dnn[k|m] Default primary stack size = nn [kilo|mega] ");
Write_Str ("bytes ");
Write_Eol;
-- Line for D switch
Write_Str (" -Dnn[k|m] Default secondary stack size = nnn [kilo|mega] ");
Write_Str ("bytes");
Write_Eol;
-- Line for -e switch
Write_Str (" -e Output complete list of elabor");
Write_Str ("ation order dependencies");
Write_Eol;
-- Line for -E switch
Write_Str (" -E Store tracebacks in Exception occurrences");
Write_Eol;
-- The -f switch is voluntarily omitted, because it is obsolete
-- Line for -F switch
Write_Str (" -F Force checking of elaboration Flags");
Write_Eol;
-- Line for -h switch
Write_Str (" -h Output this usage (help) infor");
Write_Str ("mation");
Write_Eol;
-- Lines for -I switch
Write_Str (" -Idir Specify library and source files search path");
Write_Eol;
Write_Str (" -I- Don't look for sources & library files");
Write_Str (" in default directory");
Write_Eol;
-- Line for -K switch
Write_Str (" -K Give list of linker options specified for link");
Write_Eol;
-- Line for -l switch
Write_Str (" -l Output chosen elaboration order");
Write_Eol;
-- Line of -L switch
Write_Str (" -Lxyz Library build: adainit/final ");
Write_Str ("renamed to xyzinit/final, implies -n");
Write_Eol;
-- Line for -m switch
Write_Str (" -mnnn Limit number of detected error");
Write_Str ("s to nnn (1-999999)");
Write_Eol;
-- Line for -M switch
Write_Str (" -Mxyz Rename generated main program from main to xyz");
Write_Eol;
-- Line for -n switch
Write_Str (" -n No Ada main program (foreign main routine)");
Write_Eol;
-- Line for -nostdinc
Write_Str (" -nostdinc Don't look for source files");
Write_Str (" in the system default directory");
Write_Eol;
-- Line for -nostdlib
Write_Str (" -nostdlib Don't look for library files");
Write_Str (" in the system default directory");
Write_Eol;
-- Line for -o switch
Write_Str (" -o file Give the output file name (default is b~xxx.adb) ");
Write_Eol;
-- Line for -O switch
Write_Str (" -O Give list of objects required for link");
Write_Eol;
-- Line for -p switch
Write_Str (" -p Pessimistic (worst-case) elaborat");
Write_Str ("ion order");
Write_Eol;
-- Line for -r switch
Write_Str (" -r List restrictions that could be a");
Write_Str ("pplied to this partition");
Write_Eol;
-- Line for -s switch
Write_Str (" -s Require all source files to be");
Write_Str (" present");
Write_Eol;
-- Line for -Sxx switch
Write_Str (" -S?? Sin/lo/hi/xx for Initialize_Scalars");
Write_Str (" invalid/low/high/hex");
Write_Eol;
-- Line for -static
Write_Str (" -static Link against a static GNAT run time");
Write_Eol;
-- Line for -shared
Write_Str (" -shared Link against a shared GNAT run time");
Write_Eol;
-- Line for -t switch
Write_Str (" -t Tolerate time stamp and other consistency errors");
Write_Eol;
-- Line for -T switch
Write_Str (" -Tn Set time slice value to n milliseconds (n >= 0)");
Write_Eol;
-- Line for -u switch
Write_Str (" -un Enable dynamic stack analysis, with n results ");
Write_Str ("stored");
Write_Eol;
-- Line for -v switch
Write_Str (" -v Verbose mode. Error messages, ");
Write_Str ("header, summary output to stdout");
Write_Eol;
-- Lines for -w switch
Write_Str (" -wx Warning mode. (x=s/e for supp");
Write_Str ("ress/treat as error)");
Write_Eol;
-- Line for -x switch
Write_Str (" -x Exclude source files (check ob");
Write_Str ("ject consistency only)");
Write_Eol;
-- Line for X switch
Write_Str (" -Xnnn Default exit status value = nnn");
Write_Eol;
-- Line for -z switch
Write_Str (" -z No main subprogram (zero main)");
Write_Eol;
-- Line for --RTS
Write_Str (" --RTS=dir specify the default source and object search path");
Write_Eol;
-- Line for sfile
Write_Str (" lfile Library file names");
Write_Eol;
end Bindusg;
|
src/test/resources/RegistryParser.g4
|
google/polymorphicDSL
| 3 |
3266
|
parser grammar RegistryParser;
import AlphaParser, BetaParser;
options {tokenVocab=RegistryLexer;}
|
Sources/Interfaces/keyboard.adb
|
ForYouEyesOnly/Space-Convoy
| 1 |
24437
|
<filename>Sources/Interfaces/keyboard.adb
--
-- Jan & <NAME>, Australia, July 2011
--
package body Keyboard is
-----------------------
-- Keyboard Commands --
-----------------------
procedure Get_Keys (Commands : in out Commands_Array;
Selected_Keyboard : access GLUT.Devices.Keyboard := GLUT.Devices.default_Keyboard'Access) is
begin
if Selected_Keyboard.all.modif_set (GLUT.Active_Alt) then -- Alt Button Commands
Commands (Full_Screen) := Selected_Keyboard.all.normal_set ('F');
Commands (Reset_Camera) := Selected_Keyboard.all.normal_set ('C');
Commands (Text_Overlay) := Selected_Keyboard.all.normal_set ('T');
Commands (Toggle_Axis) := Selected_Keyboard.all.normal_set (',');
Commands (Toggle_Lines) := Selected_Keyboard.all.normal_set ('.');
Commands (Screen_Shot) := Selected_Keyboard.all.normal_set ('S');
else
Commands (Move_Accelerator) := Selected_Keyboard.all.modif_set (GLUT.Active_Shift);
Commands (Space) := Selected_Keyboard.all.normal_set (' ');
-- Rotate Commands --
Commands (Rotate_Up) := Selected_Keyboard.all.normal_set ('I');
Commands (Rotate_Down) := Selected_Keyboard.all.normal_set ('K');
Commands (Rotate_Left) := Selected_Keyboard.all.normal_set ('J');
Commands (Rotate_Right) := Selected_Keyboard.all.normal_set ('L');
Commands (Rotate_CW) := Selected_Keyboard.all.normal_set ('O');
Commands (Rotate_AntiCW) := Selected_Keyboard.all.normal_set ('U');
-- Strafe Commands --
Commands (Strafe_Up) := Selected_Keyboard.all.normal_set ('Q');
Commands (Strafe_Down) := Selected_Keyboard.all.normal_set ('E');
Commands (Strafe_Left) := Selected_Keyboard.all.normal_set ('A');
Commands (Strafe_Right) := Selected_Keyboard.all.normal_set ('D');
Commands (Strafe_Forward) := Selected_Keyboard.all.normal_set ('W');
Commands (Strafe_Backward) := Selected_Keyboard.all.normal_set ('S');
-- Swarm
Commands (Add_Vehicle) := Selected_Keyboard.all.normal_set ('+');
Commands (Remove_Vehicle) := Selected_Keyboard.all.normal_set ('-');
end if;
end Get_Keys;
end Keyboard;
|
BASICLanguageParser.Grammar/jvmBasic.g4
|
ssorrrell/ECB2_Lib
| 0 |
192
|
grammar jvmBasic;
/*
[The "BSD licence"]
Copyright (c) 2012 <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.
*/// a program is a collection of lines
prog
: line + EOF
;
// a line starts with an INT
line
: (linenumber ((amprstmt (COLON amprstmt?)*) | (COMMENT | REM)))
;
amperoper
: AMPERSAND
;
linenumber
: NUMBER
;
amprstmt
: (amperoper? statement)
| (COMMENT | REM)
;
statement
: (CLS | LOAD | SAVE | TRACE | NOTRACE | FLASH | INVERSE | GR | NORMAL | SHLOAD | CLEAR | RUN | STOP | TEXT | HOME | HGR | HGR2)
| endstmt
| returnstmt
| restorestmt
| amptstmt
| popstmt
| liststmt
| storestmt
| getstmt
| recallstmt
| nextstmt
| instmt
| prstmt
| onerrstmt
| hlinstmt
| vlinstmt
| colorstmt
| speedstmt
| scalestmt
| rotstmt
| hcolorstmt
| himemstmt
| lomemstmt
| printstmt1
| pokestmt
| plotstmt
| ongotostmt
| ongosubstmt
| ifstmt
| forstmt1
| forstmt2
| inputstmt
| tabstmt
| dimstmt
| gotostmt
| gosubstmt
| callstmt
| readstmt
| hplotstmt
| vplotstmt
| vtabstmnt
| htabstmnt
| waitstmt
| datastmt
| xdrawstmt
| drawstmt
| defstmt
| letstmt
| includestmt
;
vardecl
: var_ (LPAREN exprlist RPAREN)*
;
printstmt1
: (PRINT | QUESTION) printlist?
;
printlist
: expression ((COMMA | SEMICOLON) expression?)*
;
getstmt
: GET exprlist
;
letstmt
: LET? variableassignment
;
variableassignment
: vardecl EQ exprlist
;
relop
: (GTE)
| (GT EQ)
| (EQ GT)
| LTE
| (LT EQ)
| (EQ LT)
| neq
| EQ
| GT
| LT
;
neq
: LT GT
;
ifstmt
: IF expression THEN? (statement | linenumber)
;
// for stmt 1 puts the for-next on one line
forstmt1
: FOR vardecl EQ expression TO expression (STEP expression)? (statement NEXT vardecl?)?
;
// for stmt 2 puts the for, the statment, and the next on 3 lines. It needs "nextstmt"
forstmt2
: FOR vardecl EQ expression TO expression (STEP expression)?
;
nextstmt
: NEXT (vardecl (',' vardecl)*)?
;
inputstmt
: INPUT (STRINGLITERAL (COMMA | SEMICOLON))? varlist
;
readstmt
: READ varlist
;
dimstmt
: DIM varlist
;
gotostmt
: GOTO linenumber
;
gosubstmt
: GOSUB expression
;
pokestmt
: POKE expression COMMA expression
;
callstmt
: CALL exprlist
;
hplotstmt
: HPLOT (expression COMMA expression)? (TO expression COMMA expression)*
;
vplotstmt
: VPLOT (expression COMMA expression)? (TO expression COMMA expression)*
;
plotstmt
: PLOT expression COMMA expression
;
ongotostmt
: ON expression GOTO linenumber (COMMA linenumber)*
;
ongosubstmt
: ON expression GOSUB linenumber (COMMA linenumber)*
;
vtabstmnt
: VTAB expression
;
htabstmnt
: HTAB expression
;
himemstmt
: HIMEM COLON expression
;
lomemstmt
: LOMEM COLON expression
;
datastmt
: DATA datum (COMMA datum?)*
;
datum
: number
| STRINGLITERAL
;
waitstmt
: WAIT expression COMMA expression (COMMA expression)?
;
xdrawstmt
: XDRAW expression (AT expression COMMA expression)?
;
drawstmt
: DRAW expression (AT expression COMMA expression)?
;
defstmt
: DEF FN? var_ LPAREN var_ RPAREN EQ expression
;
tabstmt
: TAB LPAREN expression RPAREN
;
speedstmt
: SPEED EQ expression
;
rotstmt
: ROT EQ expression
;
scalestmt
: SCALE EQ expression
;
colorstmt
: COLOR EQ expression
;
hcolorstmt
: HCOLOR EQ expression
;
hlinstmt
: HLIN expression COMMA expression AT expression
;
vlinstmt
: VLIN expression COMMA expression AT expression
;
onerrstmt
: ONERR GOTO linenumber
;
prstmt
: PRNUMBER NUMBER
;
instmt
: INNUMBER NUMBER
;
storestmt
: STORE vardecl
;
recallstmt
: RECALL vardecl
;
liststmt
: LIST expression?
;
popstmt
: POP (expression COMMA expression)?
;
amptstmt
: AMPERSAND expression
;
includestmt
: INCLUDE expression
;
endstmt
: END
;
returnstmt
: RETURN
;
restorestmt
: RESTORE
;
// expressions and such
number
: ('+' | '-')? (NUMBER | FLOAT)
;
func_
: STRINGLITERAL
| number
| tabfunc
| vardecl
| chrfunc
| sqrfunc
| lenfunc
| strfunc
| ascfunc
| scrnfunc
| midfunc
| pdlfunc
| peekfunc
| intfunc
| spcfunc
| frefunc
| posfunc
| usrfunc
| leftfunc
| valfunc
| rightfunc
| fnfunc
| sinfunc
| cosfunc
| tanfunc
| atnfunc
| rndfunc
| sgnfunc
| expfunc
| logfunc
| absfunc
| (LPAREN expression RPAREN)
;
signExpression
: NOT? (PLUS | MINUS)? func_
;
exponentExpression
: signExpression (EXPONENT signExpression)*
;
multiplyingExpression
: exponentExpression ((TIMES | DIV) exponentExpression)*
;
addingExpression
: multiplyingExpression ((PLUS | MINUS) multiplyingExpression)*
;
relationalExpression
: addingExpression ((relop) addingExpression)?
;
expression
: func_
| (relationalExpression ((AND | OR) relationalExpression)*)
;
// lists
var_
: varname varsuffix?
;
varname
: LETTERS (LETTERS | NUMBER)*
;
varsuffix
: (DOLLAR | PERCENT)
;
varlist
: vardecl (COMMA vardecl)*
;
exprlist
: expression (COMMA expression)*
;
// functions
sqrfunc
: SQR LPAREN expression RPAREN
;
chrfunc
: CHR LPAREN expression RPAREN
;
lenfunc
: LEN LPAREN expression RPAREN
;
ascfunc
: ASC LPAREN expression RPAREN
;
midfunc
: MID LPAREN expression COMMA expression COMMA expression RPAREN
;
pdlfunc
: PDL LPAREN expression RPAREN
;
peekfunc
: PEEK LPAREN expression RPAREN
;
intfunc
: INTF LPAREN expression RPAREN
;
spcfunc
: SPC LPAREN expression RPAREN
;
frefunc
: FRE LPAREN expression RPAREN
;
posfunc
: POS LPAREN expression RPAREN
;
usrfunc
: USR LPAREN expression RPAREN
;
leftfunc
: LEFT LPAREN expression COMMA expression RPAREN
;
rightfunc
: RIGHT LPAREN expression COMMA expression RPAREN
;
strfunc
: STR LPAREN expression RPAREN
;
fnfunc
: FN var_ LPAREN expression RPAREN
;
valfunc
: VAL LPAREN expression RPAREN
;
scrnfunc
: SCRN LPAREN expression COMMA expression RPAREN
;
sinfunc
: SIN LPAREN expression RPAREN
;
cosfunc
: COS LPAREN expression RPAREN
;
tanfunc
: TAN LPAREN expression RPAREN
;
atnfunc
: ATN LPAREN expression RPAREN
;
rndfunc
: RND LPAREN expression RPAREN
;
sgnfunc
: SGN LPAREN expression RPAREN
;
expfunc
: EXP LPAREN expression RPAREN
;
logfunc
: LOG LPAREN expression RPAREN
;
absfunc
: ABS LPAREN expression RPAREN
;
tabfunc
: TAB LPAREN expression RPAREN
;
DOLLAR
: '$'
;
PERCENT
: '%'
;
RETURN
: 'RETURN' | 'return'
;
PRINT
: 'PRINT' | 'print'
;
GOTO
: 'GOTO' | 'goto'
;
GOSUB
: 'GOSUB' | 'gosub'
;
IF
: 'IF' | 'if'
;
NEXT
: 'NEXT' | 'next'
;
THEN
: 'THEN' | 'then'
;
REM
: 'REM' | 'rem'
;
CHR
: 'CHR$'
;
MID
: 'MID$'
;
LEFT
: 'LEFT$'
;
RIGHT
: 'RIGHT$'
;
STR
: 'STR$'
;
LPAREN
: '('
;
RPAREN
: ')'
;
PLUS
: '+'
;
MINUS
: '-'
;
TIMES
: '*'
;
DIV
: '/'
;
CLEAR
: 'CLEAR' | 'clear'
;
GTE
: '>: '
;
LTE
: '<: '
;
GT
: '>'
;
LT
: '<'
;
COMMA
: ','
;
LIST
: 'LIST' | 'list'
;
RUN
: 'RUN' | 'run'
;
END
: 'END' | 'end'
;
LET
: 'LET' | 'let'
;
EQ
: '='
;
FOR
: 'FOR' | 'for'
;
TO
: 'TO' | 'to'
;
STEP
: 'STEP' | 'step'
;
INPUT
: 'INPUT' | 'input'
;
SEMICOLON
: ';'
;
DIM
: 'DIM' | 'dim'
;
SQR
: 'SQR' | 'sqr'
;
COLON
: ':'
;
TEXT
: 'TEXT' | 'text'
;
HGR
: 'HGR' | 'hgr'
;
HGR2
: 'HGR2' | 'hgr2'
;
LEN
: 'LEN' | 'len'
;
CALL
: 'CALL' | 'call'
;
ASC
: 'ASC' | 'asc'
;
HPLOT
: 'HPLOT' | 'hplot'
;
VPLOT
: 'VPLOT' | 'vplot'
;
PRNUMBER
: 'PR#'
;
INNUMBER
: 'IN#'
;
VTAB
: 'VTAB' | 'vtab'
;
HTAB
: 'HTAB' | 'htab'
;
HOME
: 'HOME' | 'home'
;
ON
: 'ON' | 'on'
;
PDL
: 'PDL' | 'pdl'
;
PLOT
: 'PLOT' | 'plot'
;
PEEK
: 'PEEK' | 'peek'
;
POKE
: 'POKE' | 'poke'
;
INTF
: 'INT' | 'int'
;
STOP
: 'STOP' | 'stop'
;
HIMEM
: 'HIMEM' | 'himem'
;
LOMEM
: 'LOMEM' | 'lomem'
;
FLASH
: 'FLASH' | 'flash'
;
INVERSE
: 'INVERSE' | 'inverse'
;
NORMAL
: 'NORMAL' | 'normal'
;
ONERR
: 'ONERR' | 'onerr'
;
SPC
: 'SPC' | 'spc'
;
FRE
: 'FRE' | 'fre'
;
POS
: 'POS' | 'pos'
;
USR
: 'USR' | 'usr'
;
TRACE
: 'TRACE' | 'trace'
;
NOTRACE
: 'NOTRACE' | 'notrace'
;
AND
: 'AND' | 'and'
;
OR
: 'OR' | 'or'
;
DATA
: 'DATA' | 'data'
;
WAIT
: 'WAIT' | 'wait'
;
READ
: 'READ' | 'read'
;
XDRAW
: 'XDRAW' | 'xdraw'
;
DRAW
: 'DRAW' | 'draw'
;
AT
: 'AT' | 'at'
;
DEF
: 'DEF' | 'def'
;
FN
: 'FN' | 'fn'
;
VAL
: 'VAL' | 'val'
;
TAB
: 'TAB' | 'tab'
;
SPEED
: 'SPEED' | 'speed'
;
ROT
: 'ROT' | 'rot'
;
SCALE
: 'SCALE' | 'scale'
;
COLOR
: 'COLOR' | 'color'
;
HCOLOR
: 'HCOLOR' | 'hcolor'
;
HLIN
: 'HLIN' | 'hlin'
;
VLIN
: 'VLIN' | 'vlin'
;
SCRN
: 'SCRN' | 'scrn'
;
POP
: 'POP' | 'pop'
;
SHLOAD
: 'SHLOAD' | 'shload'
;
SIN
: 'SIN' | 'sin'
;
COS
: 'COS' | 'cos'
;
TAN
: 'TAN' | 'tan'
;
ATN
: 'ATN' | 'atn'
;
RND
: 'RND' | 'rnd'
;
SGN
: 'SGN' | 'sgn'
;
EXP
: 'EXP' | 'exp'
;
LOG
: 'LOG' | 'log'
;
ABS
: 'ABS' | 'abs'
;
STORE
: 'STORE' | 'store'
;
RECALL
: 'RECALL' | 'recall'
;
GET
: 'GET' | 'get'
;
EXPONENT
: '^'
;
AMPERSAND
: '&'
;
GR
: 'GR' | 'gr'
;
NOT
: 'NOT' | 'not'
;
RESTORE
: 'RESTORE' | 'restore'
;
SAVE
: 'SAVE' | 'save'
;
LOAD
: 'LOAD' | 'load'
;
QUESTION
: '?'
;
INCLUDE
: 'INCLUDE' | 'include'
;
CLS
: 'CLS' | 'cls'
;
COMMENT
: REM ~ [\r\n]*
;
STRINGLITERAL
: '"' ~ ["\r\n]* '"'
;
LETTERS
: ('a' .. 'z' | 'A' .. 'Z') +
;
NUMBER
: ('0' .. '9') + (('e' | 'E') NUMBER)*
;
FLOAT
: ('0' .. '9')* '.' ('0' .. '9') + (('e' | 'E') ('0' .. '9') +)*
;
WS
: [ \r\n\t] + -> channel (HIDDEN)
;
|
programs/oeis/242/A242112.asm
|
neoneye/loda
| 22 |
2806
|
; A242112: a(n) = floor((2*n+6)/(5-(-1)^n)).
; 1,1,2,2,3,2,4,3,5,4,6,4,7,5,8,6,9,6,10,7,11,8,12,8,13,9,14,10,15,10,16,11,17,12,18,12,19,13,20,14,21,14,22,15,23,16,24,16,25,17,26,18,27,18,28,19,29,20,30,20,31,21,32,22,33,22,34,23,35,24,36
mov $1,$0
mod $1,2
add $1,2
div $0,$1
add $0,1
|
Cubical/HITs/Cost.agda
|
dan-iel-lee/cubical
| 0 |
12190
|
<reponame>dan-iel-lee/cubical
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.HITs.Cost where
open import Cubical.HITs.Cost.Base
|
test/link/align4/module1.asm
|
nigelperks/BasicAssembler
| 0 |
166111
|
IDEAL
SEGMENT ALL PUBLIC
ASSUME CS:ALL,DS:ALL,ES:ALL,SS:ALL
start:
EXTRN _aa:WORD,_dd:BYTE,_bb:WORD,fini:BYTE
mov ax, [_aa]
mov cl, [_dd]
mov si, OFFSET _bb
mov di, OFFSET fini
int 20h
ENDS ALL
END start
|
Telist.asm
|
CallMeMengMeng/ASSEMBLY-LANGUAGE
| 0 |
1796
|
<reponame>CallMeMengMeng/ASSEMBLY-LANGUAGE
; WRITE A SUB-PROGRAM NESTED STRUCTURE PROGRAM MODULE, INPUT THE NAME AND 8-CHARACTER PHONE NUMBER
; THE KEYBOARD, AND DISPLAY IT IN A CERTAIN FORMAT.
; MAIN PROGRAM 'TELIST'
; DISPLAY PROMPT 'INPUTNAME'
; CALL THE SUBPROGRAM 'INPUT_NAME' to INPUT THE NAME
; Display prompt INPUT A TELEPHONE NUMBER
; Call the subprogram INPHONE to enter the phone number;
; Call the subroutine PRINTLINE to display the name and phone number.
; Subroutine INPUT_NAME:
; Call the keyboard input subroutine GETCHAR to store the input name in the INBUF buffer
; Move the name in INBUF into the output line OUTNAME.
; Subroutine INPHONE:
; Call the keyboard input subroutine GETCHAR and store the entered 8-digit phone number in the INBUF buffer
; Move the number in INBUF into the output line OUTPHONE.
; Subroutine PRINTLINE:
; Display name and phone number in the format:
; NAME TEL
; XXXX XXXXXXXX
DATA SEGMENT
NAMEINPUTINFO DB 'PLEASE INPUT NAME: $'
PHONEINPUTINFO DB 'INPUT THE TELEPHONE NUMBER: $'
ERRORINFO DB 0DH,0AH,'THE NUMBER YOU INPUT SHOULD BETWEEN 0-9 OR * OR # !$'
NAMEWARNINFO DB 0DH,0AH,'LENGTH OF NAME CANNOT LONGER THAN 8 CHARACTERS!',0DH,0AH,'$'
OUTPUTINFO DB 0DH,0AH,'NAME TEL',0DH,0AH,'$'
INBUF DB 32 DUP(0)
TOTALLEN DW 0
DATA ENDS
STACK SEGMENT PARA STACK 'STACK'
DB 100H DUP(0)
STACK ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START: MOV AX,DATA
MOV DS,AX
MOV ES,AX
CALL TELIST
QUIT: MOV AH,4CH
INT 21H
TELIST PROC NEAR
MOV AH,09H
MOV DX,OFFSET NAMEINPUTINFO
INT 21H
CALL INPUT_NAME
MOV AH,09H
MOV DX,OFFSET PHONEINPUTINFO
INT 21H
CALL INPHONE
CALL PRINTLINE
RET
TELIST ENDP
INPUT_NAME PROC NEAR
MOV SI,0
MOV AH,01H
GETNAME: CMP SI,10H
JZ NAME_WARNING
INT 21H
CMP AL,0DH
JZ QUIT_INPUT
MOV INBUF[SI],AL
INC SI
JMP GETNAME
NAME_WARNING: MOV AH,09H
MOV DX,OFFSET NAMEWARNINFO
INT 21H
QUIT_INPUT: MOV TOTALLEN,SI
RET
INPUT_NAME ENDP
INPHONE PROC NEAR
MOV SI,TOTALLEN
MOV CX,18H ; THERE SHOULD BE 8 UNITS BETWEEN NAME STRING (16 CHARACTERS) AND
SUB CX,SI ; PHONE ARRAY (8 NUMBERS), BUT I WANNA FILLING ALL THE UNITS WHICH
FILLIN: MOV INBUF[SI],' ' ; START AFTER THE LAST CHARACTER AND END BEFORE THE FIRST NUMBER WITH
INC SI ; 'SPACE'.
LOOP FILLIN
MOV CX,08H
MOV AH,01H
GETPHONE: INT 21H
CMP AL,23H
JZ STORE
CMP AL,2AH
JZ STORE
CMP AL,30H
JL ERRORINPUT
CMP AL,39H
JG ERRORINPUT
STORE: MOV INBUF[SI],AL
INC SI
LOOP GETPHONE
MOV TOTALLEN,SI
RET
ERRORINPUT: MOV AH,09H
MOV DX,OFFSET ERRORINFO
INT 21H
JMP QUIT_INPUT
INPHONE ENDP
PRINTLINE PROC NEAR
MOV AH,09H
MOV DX,OFFSET OUTPUTINFO
INT 21H
MOV SI,TOTALLEN
MOV INBUF[SI],'$'
MOV AH,09H
MOV DX,OFFSET INBUF
INT 21H
RET
PRINTLINE ENDP
CODE ENDS
END START
|
cipher/serpent/serpent-internal.asm
|
jfehren/Crypto
| 0 |
26058
|
<reponame>jfehren/Crypto
.macro vnotpd x, y
vxorpd %xmm12, \x, \y
.endm
/* Transpose a 4x4 matrix, using 4 xmm registers as rows of 4 32-bit integers */
.macro TRANSPOSE a,b,c,d
/* Code adapted from the Intel x86 Assembly Intrinsic _MM_TRANSPOSE4_PS.
The function of this intrinsic, as well as others, can be found at
https:/*software.intel.com/sites/landingpage/IntrinsicsGuide/ */ */
/* a = |a0 a1 a2 a3|
b = |b0 b1 b2 b3|
c = |c0 c1 c2 c3|
d = |d0 d1 d2 d3| */
vunpcklps \b, \a, %xmm8
vunpcklps \d, \c, %xmm9
vunpckhps \b, \a, %xmm10
vunpckhps \d, \c, %xmm11
vmovlhps %xmm9, %xmm8, \a
vmovhlps %xmm8, %xmm9, \b
vmovlhps %xmm11, %xmm10, \c
vmovhlps %xmm10, %xmm11, \d
/* a = |a0 b0 c0 d0|
b = |a1 b1 c1 d1|
c = |a2 b2 c2 d2|
d = |a3 b3 c3 d3| */
.endm
.macro SBOX0 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x1, \y3
movl \x0, \y0
movl \x0, \y1
movl \x2, \y2
xorl \x2, \y3 /* y3 = x1 ^ x2 */
orl \x3, \y0 /* y0 = x0 | x3 */
xorl \x1, \y1 /* y1 = x0 ^ x1 */
xorl \y0, \y3 /* y3 = y3 ^ y0 */
orl \y3, \y2 /* y2 = x2 | y3 */
xorl \x3, \x0 /* x0 = x0 ^ x3 */
andl \x3, \y2 /* y2 = y2 & x3 */
xorl \x2, \x3 /* x3 = x3 ^ x2 */
orl \x1, \x2 /* x2 = x2 | x1 */
movl \y1, \y0
andl \x2, \y0 /* y0 = y1 & x2 */
xorl \y0, \y2 /* y2 = y2 ^ y0 */
andl \y2, \y0 /* y0 = y0 & y2 */
xorl \x2, \y0 /* y0 = y0 ^ x2 */
andl \x0, \x1 /* x1 = x1 & x0 */
xorl \x0, \y0 /* y0 = y0 ^ x0 */
notl \y0 /* y0 = ~y0 */
movl \y0, \y1
xorl \x1, \y1 /* y1 = y0 ^ x1 */
xorl \x3, \y1 /* y1 = y1 ^ x3 */
.else
.if \m==64
movq \x1, \y3
movq \x0, \y0
movq \x0, \y1
movq \x2, \y2
xorq \x2, \y3 /* y3 = x1 ^ x2 */
orq \x3, \y0 /* y0 = x0 | x3 */
xorq \x1, \y1 /* y1 = x0 ^ x1 */
xorq \y0, \y3 /* y3 = y3 ^ y0 */
orq \y3, \y2 /* y2 = x2 | y3 */
xorq \x3, \x0 /* x0 = x0 ^ x3 */
andq \x3, \y2 /* y2 = y2 & x3 */
xorq \x2, \x3 /* x3 = x3 ^ x2 */
orq \x1, \x2 /* x2 = x2 | x1 */
movq \y1, \y0
andq \x2, \y0 /* y0 = y1 & x2 */
xorq \y0, \y2 /* y2 = y2 ^ y0 */
andq \y2, \y0 /* y0 = y0 & y2 */
xorq \x2, \y0 /* y0 = y0 ^ x2 */
andq \x0, \x1 /* x1 = x1 & x0 */
xorq \x0, \y0 /* y0 = y0 ^ x0 */
notq \y0 /* y0 = ~y0 */
movq \y0, \y1
xorq \x1, \y1 /* y1 = y0 ^ x1 */
xorq \x3, \y1 /* y1 = y1 ^ x3 */
.else
.if \m==128
vxorpd \x2, \x1, \y3 /* y3 = x1 ^ x2 */
vorpd \x3, \x0, \y0 /* y0 = x0 | x3 */
vxorpd \x1, \x0, \y1 /* y1 = x0 ^ x1 */
vxorpd \y0, \y3, \y3 /* y3 = y3 ^ y0 */
vorpd \y3, \x2, \y2 /* y2 = x2 | y3 */
vxorpd \x3, \x0, \x0 /* x0 = x0 ^ x3 */
vandpd \x3, \y2, \y2 /* y2 = y2 & x3 */
vxorpd \x2, \x3, \x3 /* x3 = x3 ^ x2 */
vorpd \x1, \x2, \x2 /* x2 = x2 | x1 */
vandpd \x2, \y1, \y0 /* y0 = y1 & x2 */
vxorpd \y0, \y2, \y2 /* y2 = y2 ^ y0 */
vandpd \y2, \y0, \y0 /* y0 = y0 & y2 */
vxorpd \x2, \y0, \y0 /* y0 = y0 ^ x2 */
vandpd \x0, \x1, \x1 /* x1 = x1 & x0 */
vxorpd \x0, \y0, \y0 /* y0 = y0 ^ x0 */
vnotpd \y0, \y0 /* y0 = ~ y0 */
vxorpd \x3, \y1, \y1 /* y1 = y1 ^ x3 */
vxorpd \x1, \y0, \y1 /* y1 = y0 ^ x1 */
.else
.error "Invalid mode for SBOX0"
.endif
.endif
.endif
.endm
.macro IBOX0 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x2, \y1
movl \x0, \y2
movl \x0, \y0
xorl \x3, \y1 /* y1 = x2 ^ x3 */
orl \x1, \y2 /* y2 = x0 | x1 */
xorl \x2, \y0 /* y0 = x0 ^ x2 */
xorl \y1, \y2 /* y2 = y2 ^ y1 */
andl \x2, \y1 /* y1 = y1 & x2 */
orl \x1, \x2 /* x2 = x2 | x1 */
xorl \x3, \x1 /* x1 = x1 ^ x3 */
orl \x0, \y1 /* y1 = y1 | x0 */
andl \x2, \x1 /* x1 = x1 & x2 */
orl \y2, \x0 /* x0 = x0 | y2 */
xorl \x1, \y1 /* y1 = y1 ^ x1 */
movl \y2, \x1
xorl \y1, \x0 /* x0 = x0 ^ y1 */
notl \y2 /* y2 = ~ y2 */
andl \x0, \x1 /* x1 = x0 &~y2 */
orl \y2, \x3 /* x3 = x3 | y2 */
xorl \x2, \x3 /* x3 = x3 ^ x2 */
movl \x0, \y3
orl \x3, \x1 /* x1 = x1 | x3 */
xorl \x3, \y3 /* y3 = x0 ^ x3 */
xorl \x1, \y0 /* y0 = y0 ^ x1 */
.else
.if \m==64
movq \x2, \y1
movq \x0, \y2
movq \x0, \y0
xorq \x3, \y1 /* y1 = x2 ^ x3 */
orq \x1, \y2 /* y2 = x0 | x1 */
xorq \x2, \y0 /* y0 = x0 ^ x2 */
xorq \y1, \y2 /* y2 = y2 ^ y1 */
andq \x2, \y1 /* y1 = y1 & x2 */
orq \x1, \x2 /* x2 = x2 | x1 */
xorq \x3, \x1 /* x1 = x1 ^ x3 */
orq \x0, \y1 /* y1 = y1 | x0 */
andq \x2, \x1 /* x1 = x1 & x2 */
orq \y2, \x0 /* x0 = x0 | y2 */
xorq \x1, \y1 /* y1 = y1 ^ x1 */
movq \y2, \x1
xorq \y1, \x0 /* x0 = x0 ^ y1 */
notq \y2 /* y2 = ~ y2 */
andq \x0, \x1 /* x1 = x0 &~y2 */
orq \y2, \x3 /* x3 = x3 | y2 */
xorq \x2, \x3 /* x3 = x3 ^ x2 */
movq \x0, \y3
orq \x3, \x1 /* x1 = x1 | x3 */
xorq \x3, \y3 /* y3 = x0 ^ x3 */
xorq \x1, \y0 /* y0 = y0 ^ x1 */
.else
.if \m==128
vxorpd \x3, \x2, \y1 /* y1 = x2 ^ x3 */
vorpd \x1, \x0, \y2 /* y2 = x0 | x1 */
vxorpd \x2, \x0, \y0 /* y0 = x0 ^ x2 */
vxorpd \y1, \y2, \y2 /* y2 = y2 ^ y1 */
vandpd \x2, \y1, \y1 /* y1 = y1 & x2 */
vorpd \x1, \x2, \x2 /* x2 = x2 | x1 */
vxorpd \x3, \x1, \x1 /* x1 = x1 ^ x3 */
vorpd \x0, \y1, \y1 /* y1 = y1 | x0 */
vandpd \x2, \x1, \x1 /* x1 = x1 & x2 */
vorpd \y2, \x0, \x0 /* x0 = x0 | y2 */
vxorpd \x1, \y1, \y1 /* y1 = y1 ^ x1 */
vxorpd \y1, \x0, \y3 /* y3 = x0 ^ y1 */
vandpd \y3, \y2, \x1 /* x1 = y2 & y3 */
vnotpd \y2, \y2 /* y2 = ~ y2 */
vorpd \y2, \x3, \x3 /* x3 = x3 | y2 */
vxorpd \x2, \x3, \x3 /* x3 = x3 ^ x2 */
vorpd \x3, \x1, \x1 /* x1 = x1 | x3 */
vxorpd \x3, \y3, \y3 /* y3 = y3 ^ x3 */
vxorpd \x1, \y0, \y0 /* y0 = y0 ^ x1 */
.else
.error "Invalid mode for IBOX0"
.endif
.endif
.endif
.endm
.macro SBOX1 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x0, \y1
movl \x2, \y2
movl \x1, \y0
movl \x0, \y3
orl \x3, \y1 /* y1 = x0 | x3 */
xorl \x3, \y2 /* y2 = x2 ^ x3 */
notl \y0 /* y0 = ~ x1 */
xorl \x2, \y3 /* y3 = x0 ^ x2 */
orl \x0, \y0 /* y0 = y0 | x0 */
movl \y1, \x0
andl \x3, \y3 /* y3 = y3 & x3 */
andl \y2, \x0 /* x0 = y1 & y2 */
orl \x1, \y3 /* y3 = y3 | x1 */
xorl \y0, \y2 /* y2 = y2 ^ y0 */
xorl \x0, \y3 /* y3 = y3 ^ x0 */
movl \y1, \x0
xorl \y3, \x0 /* x0 = y1 ^ y3 */
movl \x1, \y1
xorl \y2, \x0 /* x0 = x0 ^ y2 */
andl \x3, \y1 /* y1 = x1 & x3 */
movl \y3, \x3
xorl \x0, \y1 /* y1 = y1 ^ x0 */
orl \y1, \x3 /* x3 = y1 | y3 */
notl \y3 /* y3 = ~ y3 */
andl \x3, \y0 /* y0 = y0 & x3 */
xorl \x2, \y0 /* y0 = y0 ^ x2 */
.else
.if \m==64
movq \x0, \y1
movq \x2, \y2
movq \x1, \y0
movq \x0, \y3
orq \x3, \y1 /* y1 = x0 | x3 */
xorq \x3, \y2 /* y2 = x2 ^ x3 */
notq \y0 /* y0 = ~ x1 */
xorq \x2, \y3 /* y3 = x0 ^ x2 */
orq \x0, \y0 /* y0 = y0 | x0 */
movq \y1, \x0
andq \x3, \y3 /* y3 = y3 & x3 */
andq \y2, \x0 /* x0 = y1 & y2 */
orq \x1, \y3 /* y3 = y3 | x1 */
xorq \y0, \y2 /* y2 = y2 ^ y0 */
xorq \x0, \y3 /* y3 = y3 ^ x0 */
movq \y1, \x0
xorq \y3, \x0 /* x0 = y1 ^ y3 */
movq \x1, \y1
xorq \y2, \x0 /* x0 = x0 ^ y2 */
andq \x3, \y1 /* y1 = x1 & x3 */
movq \y3, \x3
xorq \x0, \y1 /* y1 = y1 ^ x0 */
orq \y1, \x3 /* x3 = y1 | y3 */
notq \y3 /* y3 = ~ y3 */
andq \x3, \y0 /* y0 = y0 & x3 */
xorq \x2, \y0 /* y0 = y0 ^ x2 */
.else
.if \m==128
vorpd \x3, \x0, \y1 /* y1 = x0 | x3 */
vxorpd \x3, \x2, \y2 /* y2 = x2 ^ x3 */
vnotpd \x1, \y0 /* y0 = ~ x1 */
vxorpd \x2, \x0, \y3 /* y3 = x0 ^ x2 */
vorpd \x0, \y0, \y0 /* y0 = y0 | x0 */
vandpd \x3, \y3, \y3 /* y3 = y3 & x3 */
vandpd \y2, \y1, \x0 /* x0 = y1 & y2 */
vorpd \x1, \y3, \y3 /* y3 = y3 | x1 */
vxorpd \y0, \y2, \y2 /* y2 = y2 ^ y0 */
vxorpd \x0, \y3, \y3 /* y3 = y3 ^ x0 */
vxorpd \y3, \y1, \x0 /* x0 = y1 ^ y3 */
vxorpd \y2, \x0, \x0 /* x0 = x0 ^ y2 */
vandpd \x3, \x1, \y1 /* y1 = x1 & x3 */
vxorpd \x0, \y1, \y1 /* y1 = y1 ^ x0 */
vorpd \y3, \y1, \x3 /* x3 = y1 | y3 */
vnotpd \y3, \y3 /* y3 = ~ y3 */
vandpd \x3, \y0, \y0 /* y0 = y0 & x3 */
vxorpd \x2, \y0, \y0 /* y0 = y0 ^ x2 */
.else
.error "Invalid mode for SBOX1"
.endif
.endif
.endif
.endm
.macro IBOX1 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x1, \y1
movl \x0, \y3
movl \x0, \y0
orl \x3, \y1 /* y1 = x1 | x3 */
xorl \x1, \y3 /* y3 = x0 ^ x1 */
xorl \x2, \y1 /* y1 = y1 ^ x2 */
orl \y1, \y0 /* y0 = x0 | y1 */
movl \x0, \y2
andl \y3, \y0 /* y0 = y0 & y3 */
xorl \y1, \y3 /* y3 = y3 ^ y1 */
xorl \y0, \x1 /* x1 = x1 ^ y0 */
andl \x2, \y2 /* y2 = x0 & x2 */
andl \x3, \x1 /* x1 = x1 & x3 */
orl \y2, \y1 /* y1 = y1 | y2 */
orl \x3, \y2 /* y2 = y2 | x3 */
xorl \y0, \y2 /* y2 = y2 ^ y0 */
xorl \x1, \y1 /* y1 = y1 ^ x1 */
notl \y2 /* y2 = ~ y2 */
xorl \x2, \y0 /* y0 = y0 ^ x2 */
orl \y2, \x0 /* x0 = x0 | y2 */
xorl \y1, \y0 /* y0 = y0 ^ y1 */
xorl \x0, \y0 /* y0 = y0 ^ x0 */
.else
.if \m==64
movq \x1, \y1
movq \x0, \y3
movq \x0, \y0
orq \x3, \y1 /* y1 = x1 | x3 */
xorq \x1, \y3 /* y3 = x0 ^ x1 */
xorq \x2, \y1 /* y1 = y1 ^ x2 */
orq \y1, \y0 /* y0 = x0 | y1 */
movq \x0, \y2
andq \y3, \y0 /* y0 = y0 & y3 */
xorq \y1, \y3 /* y3 = y3 ^ y1 */
xorq \y0, \x1 /* x1 = x1 ^ y0 */
andq \x2, \y2 /* y2 = x0 & x2 */
andq \x3, \x1 /* x1 = x1 & x3 */
orq \y2, \y1 /* y1 = y1 | y2 */
orq \x3, \y2 /* y2 = y2 | x3 */
xorq \y0, \y2 /* y2 = y2 ^ y0 */
xorq \x1, \y1 /* y1 = y1 ^ x1 */
notq \y2 /* y2 = ~ y2 */
xorq \x2, \y0 /* y0 = y0 ^ x2 */
orq \y2, \x0 /* x0 = x0 | y2 */
xorq \y1, \y0 /* y0 = y0 ^ y1 */
xorq \x0, \y0 /* y0 = y0 ^ x0 */
.else
.if \m==128
vorpd \x3, \x1, \y1 /* y1 = x1 | x3 */
vxorpd \x1, \x0, \y3 /* y3 = x0 ^ x1 */
vxorpd \x2, \y1, \y1 /* y1 = y1 ^ x2 */
vorpd \y1, \x0, \y0 /* y0 = x0 | y1 */
vandpd \y3, \y0, \y0 /* y0 = y0 & y3 */
vxorpd \y1, \y3, \y3 /* y3 = y3 ^ y1 */
vxorpd \y0, \x1, \x1 /* x1 = x1 ^ y0 */
vandpd \x2, \x0, \y2 /* y2 = x0 & x2 */
vandpd \x3, \x1, \x1 /* x1 = x1 & x3 */
vorpd \y2, \y1, \y1 /* y1 = y1 | y2 */
vorpd \x3, \y2, \y2 /* y2 = y2 | x3 */
vxorpd \y0, \y2, \y2 /* y2 = y2 ^ y0 */
vxorpd \x1, \y1, \y1 /* y1 = y1 ^ x1 */
vnotpd \y2, \y2 /* y2 = ~ y2 */
vxorpd \x2, \y0, \y0 /* y0 = y0 ^ x2 */
vorpd \y2, \x0, \x0 /* x0 = x0 | y2 */
vxorpd \y1, \y0, \y0 /* y0 = y0 ^ y1 */
vxorpd \x0, \y0, \y0 /* y0 = y0 ^ x0 */
.else
.error "Invalid mode for IBOX1"
.endif
.endif
.endif
.endm
.macro SBOX2 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x0, \y1
movl \x0, \y2
movl \x3, \y3
xorl \x1, \y1 /* y1 = x0 ^ x1 */
orl \x2, \y2 /* y2 = x0 | x2 */
movl \y1, \y0
xorl \y2, \y3 /* y3 = x3 ^ y2 */
xorl \y3, \y0 /* y0 = y1 ^ y3 */
orl \x0, \x3 /* x3 = x3 | x0 */
xorl \y0, \x2 /* x2 = x2 ^ y0 */
movl \x1, \x0
xorl \x2, \x0 /* x0 = x1 ^ x2 */
orl \x1, \x2 /* x2 = x2 | x1 */
andl \y2, \x0 /* x0 = x0 & y2 */
xorl \x2, \y3 /* y3 = y3 ^ x2 */
orl \y3, \y1 /* y1 = y1 | y3 */
xorl \x0, \y1 /* y1 = y1 ^ x0 */
movl \y3, \y2
xorl \y1, \y2 /* y2 = y3 ^ y1 */
notl \y3 /* y3 = ~ y3 */
xorl \x1, \y2 /* y2 = y2 ^ x1 */
xorl \x3, \y2 /* y2 = y2 ^ x3 */
.else
.if \m==64
movq \x0, \y1
movq \x0, \y2
movq \x3, \y3
xorq \x1, \y1 /* y1 = x0 ^ x1 */
orq \x2, \y2 /* y2 = x0 | x2 */
movq \y1, \y0
xorq \y2, \y3 /* y3 = x3 ^ y2 */
xorq \y3, \y0 /* y0 = y1 ^ y3 */
orq \x0, \x3 /* x3 = x3 | x0 */
xorq \y0, \x2 /* x2 = x2 ^ y0 */
movq \x1, \x0
xorq \x2, \x0 /* x0 = x1 ^ x2 */
orq \x1, \x2 /* x2 = x2 | x1 */
andq \y2, \x0 /* x0 = x0 & y2 */
xorq \x2, \y3 /* y3 = y3 ^ x2 */
orq \y3, \y1 /* y1 = y1 | y3 */
xorq \x0, \y1 /* y1 = y1 ^ x0 */
movq \y3, \y2
xorq \y1, \y2 /* y2 = y3 ^ y1 */
notq \y3 /* y3 = ~ y3 */
xorq \x1, \y2 /* y2 = y2 ^ x1 */
xorq \x3, \y2 /* y2 = y2 ^ x3 */
.else
.if \m==128
vxorpd \x1, \x0, \y1 /* y1 = x0 ^ x1 */
vorpd \x2, \x0, \y2 /* y2 = x0 | x2 */
vxorpd \y2, \x3, \y3 /* y3 = x3 ^ y2 */
vxorpd \y3, \y1, \y0 /* y0 = y1 ^ y3 */
vorpd \x0, \x3, \x3 /* x3 = x3 | x0 */
vxorpd \y0, \x2, \x2 /* x2 = x2 ^ y0 */
vxorpd \x2, \x1, \x0 /* x0 = x1 ^ x2 */
vorpd \x1, \x2, \x2 /* x2 = x2 | x1 */
vandpd \y2, \x0, \x0 /* x0 = x0 & y2 */
vxorpd \x2, \y3, \y3 /* y3 = y3 ^ x2 */
vorpd \y3, \y1, \y1 /* y1 = y1 | y3 */
vxorpd \x0, \y1, \y1 /* y1 = y1 ^ x0 */
vxorpd \y1, \y3, \y2 /* y2 = y3 ^ y1 */
vxorpd \x1, \y2, \y2 /* y2 = y2 ^ x1 */
vnotpd \y3, \y3 /* y3 = ~ y3 */
vxorpd \x3, \y2, \y2 /* y2 = y2 ^ x3 */
.else
.error "Invalid mode for SBOX2"
.endif
.endif
.endif
.endm
.macro IBOX2 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x0, \y0
movl \x2, \y2
movl \x1, \y1
xorl \x3, \y2 /* y2 = x2 ^ x3 */
xorl \x3, \y0 /* y0 = x0 ^ x3 */
orl \y2, \y1 /* y1 = x1 | y2 */
xorl \y1, \y0 /* y0 = y0 ^ y1 */
movl \x3, \y1
orl \y0, \y1 /* y1 = x3 | y0 */
andl \x1, \y1 /* y1 = y1 & x1 */
movl \x0, \y3
notl \x3 /* x3 = ~ x3 */
orl \x2, \y3 /* y3 = x0 | x2 */
andl \y3, \y2 /* y2 = y2 & y3 */
andl \x1, \y3 /* y3 = y3 & x1 */
andl \x2, \x0 /* x0 = x0 & x2 */
xorl \y2, \y1 /* y1 = y1 ^ y2 */
orl \x3, \x0 /* x0 = x0 | x3 */
xorl \x0, \y3 /* y3 = y3 ^ x0 */
andl \y3, \x2 /* x2 = x2 & y3 */
movl \y0, \y2
xorl \x0, \x2 /* x2 = x2 ^ x0 */
xorl \y1, \y2 /* y2 = y0 ^ y1 */
xorl \x2, \y2 /* y2 = y2 ^ x2 */
.else
.if \m==64
movq \x0, \y0
movq \x2, \y2
movq \x1, \y1
xorq \x3, \y2 /* y2 = x2 ^ x3 */
xorq \x3, \y0 /* y0 = x0 ^ x3 */
orq \y2, \y1 /* y1 = x1 | y2 */
xorq \y1, \y0 /* y0 = y0 ^ y1 */
movq \x3, \y1
orq \y0, \y1 /* y1 = x3 | y0 */
andq \x1, \y1 /* y1 = y1 & x1 */
movq \x0, \y3
notq \x3 /* x3 = ~ x3 */
orq \x2, \y3 /* y3 = x0 | x2 */
andq \y3, \y2 /* y2 = y2 & y3 */
andq \x1, \y3 /* y3 = y3 & x1 */
andq \x2, \x0 /* x0 = x0 & x2 */
xorq \y2, \y1 /* y1 = y1 ^ y2 */
orq \x3, \x0 /* x0 = x0 | x3 */
xorq \x0, \y3 /* y3 = y3 ^ x0 */
andq \y3, \x2 /* x2 = x2 & y3 */
movq \y0, \y2
xorq \x0, \x2 /* x2 = x2 ^ x0 */
xorq \y1, \y2 /* y2 = y0 ^ y1 */
xorq \x2, \y2 /* y2 = y2 ^ x2 */
.else
.if \m==128
vxorpd \x3, \x2, \y2 /* y2 = x2 ^ x3 */
vxorpd \x3, \x0, \y0 /* y0 = x0 ^ x3 */
vorpd \y2, \x1, \y1 /* y1 = x1 | y2 */
vxorpd \y1, \y0, \y0 /* y0 = y0 ^ y1 */
vorpd \y0, \x3, \y1 /* y1 = x3 | y0 */
vandpd \x1, \y1, \y1 /* y1 = y1 & x1 */
vnotpd \x3, \x3 /* x3 = ~ x3 */
vorpd \x2, \x0, \y3 /* y3 = x0 | x2 */
vandpd \y3, \y2, \y2 /* y2 = y2 & y3 */
vandpd \x1, \y3, \y3 /* y3 = y3 & x1 */
vandpd \x2, \x0, \x0 /* x0 = x0 & x2 */
vxorpd \y2, \y1, \y1 /* y1 = y1 ^ y2 */
vorpd \x3, \x0, \x0 /* x0 = x0 | x3 */
vxorpd \x0, \y3, \y3 /* y3 = y3 ^ x0 */
vandpd \y3, \x2, \x2 /* x2 = x2 & y3 */
vxorpd \x0, \x2, \x2 /* x2 = x2 ^ x0 */
vxorpd \y1, \y0, \y2 /* y2 = y0 ^ y1 */
vxorpd \x2, \y2, \y2 /* y2 = y2 ^ x2 */
.else
.error "Invalid mode for IBOX2"
.endif
.endif
.endif
.endm
.macro SBOX3 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x0, \y1
movl \x0, \y0
movl \x0, \y3
movl \x0, \y2
xorl \x2, \y1 /* y1 = x0 ^ x2 */
orl \x3, \y0 /* y0 = x0 | x3 */
andl \x3, \y3 /* y3 = x0 & x3 */
andl \x1, \y2 /* y2 = x0 & x1 */
andl \y0, \y1 /* y1 = y1 & y0 */
orl \x2, \y2 /* y2 = y2 | x2 */
movl \x3, \x2
orl \x1, \y3 /* y3 = y3 | x1 */
xorl \y1, \x2 /* x2 = x3 ^ y1 */
xorl \y3, \y1 /* y1 = y1 ^ y3 */
orl \x2, \x0 /* x0 = x0 | x2 */
xorl \x1, \x2 /* x2 = x2 ^ x1 */
andl \x3, \y3 /* y3 = y3 & x3 */
xorl \y3, \y0 /* y0 = y0 ^ y3 */
movl \y2, \y3
xorl \x2, \y3 /* y3 = y2 ^ x2 */
xorl \y0, \y2 /* y2 = y2 ^ y0 */
orl \y3, \x3 /* x3 = x3 | y3 */
andl \x3, \x1 /* x1 = x1 & x3 */
movl \x0, \y0
xorl \x1, \y0 /* y0 = y0 ^ x1 */
.else
.if \m==64
movq \x0, \y1
movq \x0, \y0
movq \x0, \y3
movq \x0, \y2
xorq \x2, \y1 /* y1 = x0 ^ x2 */
orq \x3, \y0 /* y0 = x0 | x3 */
andq \x3, \y3 /* y3 = x0 & x3 */
andq \x1, \y2 /* y2 = x0 & x1 */
andq \y0, \y1 /* y1 = y1 & y0 */
orq \x2, \y2 /* y2 = y2 | x2 */
movq \x3, \x2
orq \x1, \y3 /* y3 = y3 | x1 */
xorq \y1, \x2 /* x2 = x3 ^ y1 */
xorq \y3, \y1 /* y1 = y1 ^ y3 */
orq \x2, \x0 /* x0 = x0 | x2 */
xorq \x1, \x2 /* x2 = x2 ^ x1 */
andq \x3, \y3 /* y3 = y3 & x3 */
xorq \y3, \y0 /* y0 = y0 ^ y3 */
movq \y2, \y3
xorq \x2, \y3 /* y3 = y2 ^ x2 */
xorq \y0, \y2 /* y2 = y2 ^ y0 */
orq \y3, \x3 /* x3 = x3 | y3 */
andq \x3, \x1 /* x1 = x1 & x3 */
movq \x0, \y0
xorq \x1, \y0 /* y0 = y0 ^ x1 */
.else
.if \m==128
vxorpd \x2, \x0, \y1 /* y1 = x0 ^ x2 */
vorpd \x3, \x0, \y0 /* y0 = x0 | x3 */
vandpd \x3, \x0, \y3 /* y3 = x0 & x3 */
vandpd \x1, \x0, \y2 /* y2 = x0 & x1 */
vandpd \y0, \y1, \y1 /* y1 = y1 & y0 */
vorpd \x2, \y2, \y2 /* y2 = y2 | x2 */
vorpd \x1, \y3, \y3 /* y3 = y3 | x1 */
vxorpd \y1, \x3, \x2 /* x2 = x3 ^ y1 */
vxorpd \y3, \y1, \y1 /* y1 = y1 ^ y3 */
vorpd \x2, \x0, \x0 /* x0 = x0 | x2 */
vxorpd \x1, \x2, \x2 /* x2 = x2 ^ x1 */
vandpd \x3, \y3, \y3 /* y3 = y3 & x3 */
vxorpd \y3, \y0, \y0 /* y0 = y0 ^ y3 */
vxorpd \x2, \y2, \y3 /* y3 = y2 ^ x2 */
vxorpd \y0, \y2, \y2 /* y2 = y2 ^ y0 */
vorpd \y3, \x3, \x3 /* x3 = x3 | y3 */
vandpd \x3, \x1, \x1 /* x1 = x1 & x3 */
vxorpd \x1, \x0, \y0 /* y0 = x0 ^ x1 */
.else
.error "Invalid mode for SBOX3"
.endif
.endif
.endif
.endm
.macro IBOX3 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x2, \y3
movl \x0, \y2
movl \x1, \y0
movl \x2, \y1
orl \x3, \y3 /* y3 = x2 | x3 */
orl \x3, \y2 /* y2 = x0 | x3 */
andl \y3, \y0 /* y0 = x1 & y3 */
xorl \y2, \y1 /* y1 = x2 ^ y2 */
xorl \x0, \x3 /* x3 = x3 ^ x0 */
xorl \y1, \y0 /* y0 = y0 ^ y1 */
xorl \x1, \y2 /* y2 = y2 ^ x1 */
xorl \x3, \y3 /* y3 = y3 ^ x3 */
andl \y1, \y2 /* y2 = y2 & y1 */
xorl \x0, \y1 /* y1 = y1 ^ x0 */
xorl \x3, \y2 /* y2 = y2 ^ x3 */
orl \y0, \x3 /* x3 = x3 | y0 */
andl \y2, \x0 /* x0 = x0 & y2 */
andl \x3, \y1 /* y1 = y1 & x3 */
orl \x1, \x0 /* x0 = x0 | x1 */
xorl \x1, \y1 /* y1 = y1 ^ x1 */
xorl \x0, \y3 /* y3 = y3 ^ x0 */
.else
.if \m==64
movq \x2, \y3
movq \x0, \y2
movq \x1, \y0
movq \x2, \y1
orq \x3, \y3 /* y3 = x2 | x3 */
orq \x3, \y2 /* y2 = x0 | x3 */
andq \y3, \y0 /* y0 = x1 & y3 */
xorq \y2, \y1 /* y1 = x2 ^ y2 */
xorq \x0, \x3 /* x3 = x3 ^ x0 */
xorq \y1, \y0 /* y0 = y0 ^ y1 */
xorq \x1, \y2 /* y2 = y2 ^ x1 */
xorq \x3, \y3 /* y3 = y3 ^ x3 */
andq \y1, \y2 /* y2 = y2 & y1 */
xorq \x0, \y1 /* y1 = y1 ^ x0 */
xorq \x3, \y2 /* y2 = y2 ^ x3 */
orq \y0, \x3 /* x3 = x3 | y0 */
andq \y2, \x0 /* x0 = x0 & y2 */
andq \x3, \y1 /* y1 = y1 & x3 */
orq \x1, \x0 /* x0 = x0 | x1 */
xorq \x1, \y1 /* y1 = y1 ^ x1 */
xorq \x0, \y3 /* y3 = y3 ^ x0 */
.else
.if \m==128
vorpd \x3, \x2, \y3 /* y3 = x2 | x3 */
vorpd \x3, \x0, \y2 /* y2 = x0 | x3 */
vandpd \y3, \x1, \y0 /* y0 = x1 & y3 */
vxorpd \y2, \x2, \y1 /* y1 = x2 ^ y2 */
vxorpd \x0, \x3, \x3 /* x3 = x3 ^ x0 */
vxorpd \y1, \y0, \y0 /* y0 = y0 ^ y1 */
vxorpd \x1, \y2, \y2 /* y2 = y2 ^ x1 */
vxorpd \x3, \y3, \y3 /* y3 = y3 ^ x3 */
vandpd \y1, \y2, \y2 /* y2 = y2 & y1 */
vxorpd \x0, \y1, \y1 /* y1 = y1 ^ x0 */
vxorpd \x3, \y2, \y2 /* y2 = y2 ^ x3 */
vorpd \y0, \x3, \x3 /* x3 = x3 | y0 */
vandpd \y2, \x0, \x0 /* x0 = x0 & y2 */
vandpd \x3, \y1, \y1 /* y1 = y1 & x3 */
vorpd \x1, \x0, \x0 /* x0 = x0 | x1 */
vxorpd \x1, \y1, \y1 /* y1 = y1 ^ x1 */
vxorpd \x0, \y3, \y3 /* y3 = y3 ^ x0 */
.else
.error "Invalid mode for IBOX3"
.endif
.endif
.endif
.endm
.macro SBOX4 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x0, \y3
movl \x1, \y2
movl \x1, \y0
orl \x1, \y3 /* y3 = x0 | x1 */
orl \x2, \y2 /* y2 = x1 | x2 */
andl \x3, \y3 /* y3 = y3 & x3 */
xorl \x0, \y2 /* y2 = y2 ^ x0 */
xorl \x3, \y0 /* y0 = x1 ^ x3 */
orl \y2, \x3 /* x3 = x3 | y2 */
andl \x2, \x1 /* x1 = x1 & x2 */
xorl \y3, \x2 /* x2 = x2 ^ y3 */
xorl \y2, \y3 /* y3 = y3 ^ y2 */
andl \x3, \x0 /* x0 = x0 & x3 */
movl \y3, \y1
orl \x1, \y2 /* y2 = y2 | x1 */
andl \y0, \y1 /* y1 = y3 & y0 */
xorl \y1, \y2 /* y2 = y2 ^ y1 */
xorl \y0, \y1 /* y1 = y1 ^ y0 */
andl \x3, \y0 /* y0 = y0 & x3 */
orl \x1, \y1 /* y1 = y1 | x1 */
xorl \x2, \y0 /* y0 = y0 ^ x2 */
xorl \x0, \y1 /* y1 = y1 ^ x0 */
notl \y0 /* y0 = ~ y0 */
.else
.if \m==64
movq \x0, \y3
movq \x1, \y2
movq \x1, \y0
orq \x1, \y3 /* y3 = x0 | x1 */
orq \x2, \y2 /* y2 = x1 | x2 */
andq \x3, \y3 /* y3 = y3 & x3 */
xorq \x0, \y2 /* y2 = y2 ^ x0 */
xorq \x3, \y0 /* y0 = x1 ^ x3 */
orq \y2, \x3 /* x3 = x3 | y2 */
andq \x2, \x1 /* x1 = x1 & x2 */
xorq \y3, \x2 /* x2 = x2 ^ y3 */
xorq \y2, \y3 /* y3 = y3 ^ y2 */
andq \x3, \x0 /* x0 = x0 & x3 */
movq \y3, \y1
orq \x1, \y2 /* y2 = y2 | x1 */
andq \y0, \y1 /* y1 = y3 & y0 */
xorq \y1, \y2 /* y2 = y2 ^ y1 */
xorq \y0, \y1 /* y1 = y1 ^ y0 */
andq \x3, \y0 /* y0 = y0 & x3 */
orq \x1, \y1 /* y1 = y1 | x1 */
xorq \x2, \y0 /* y0 = y0 ^ x2 */
xorq \x0, \y1 /* y1 = y1 ^ x0 */
notq \y0 /* y0 = ~ y0 */
.else
.if \m==128
vorpd \x1, \x0, \y3 /* y3 = x0 | x1 */
vorpd \x2, \x1, \y2 /* y2 = x1 | x2 */
vandpd \x3, \y3, \y3 /* y3 = y3 & x3 */
vxorpd \x0, \y2, \y2 /* y2 = y2 ^ x0 */
vxorpd \x3, \x1, \y0 /* y0 = x1 ^ x3 */
vorpd \y2, \x3, \x3 /* x3 = x3 | y2 */
vandpd \x2, \x1, \x1 /* x1 = x1 & x2 */
vxorpd \y3, \x2, \x2 /* x2 = x2 ^ y3 */
vxorpd \y2, \y3, \y3 /* y3 = y3 ^ y2 */
vandpd \x3, \x0, \x0 /* x0 = x0 & x3 */
vorpd \x1, \y2, \y2 /* y2 = y2 | x1 */
vandpd \y0, \y3, \y1 /* y1 = y3 & y0 */
vxorpd \y1, \y2, \y2 /* y2 = y2 ^ y1 */
vxorpd \y0, \y1, \y1 /* y1 = y1 ^ y0 */
vandpd \x3, \y0, \y0 /* y0 = y0 & x3 */
vorpd \x1, \y1, \y1 /* y1 = y1 | x1 */
vxorpd \x2, \y0, \y0 /* y0 = y0 ^ x2 */
vxorpd \x0, \y1, \y1 /* y1 = y1 ^ x0 */
vnotpd \y0, \y0 /* y0 = ~ y0 */
.else
.error "Invalid mode for SBOX4"
.endif
.endif
.endif
.endm
.macro IBOX4 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x2, \y1
movl \x2, \y2
movl \x0, \y0
orl \x3, \y2 /* y2 = x2 | x3 */
xorl \x3, \y1 /* y1 = x2 ^ x3 */
xorl \x1, \y2 /* y2 = y2 ^ x1 */
orl \x3, \x1 /* x1 = x1 | x3 */
xorl \y2, \y0 /* y0 = x0 ^ y2 */
xorl \y2, \x3 /* x3 = x3 ^ y2 */
andl \x0, \y2 /* y2 = y2 & x0 */
xorl \y2, \y1 /* y1 = y1 ^ y2 */
xorl \x0, \y2 /* y2 = y2 ^ x0 */
andl \x1, \x0 /* x0 = x0 & x1 */
orl \x2, \y2 /* y2 = y2 | x2 */
movl \x0, \y3
notl \x0 /* x0 = ~ x0 */
xorl \x3, \y3 /* y3 = x3 ^~x0 */
orl \y1, \x0 /* x0 = x0 | y1 */
xorl \x1, \y2 /* y2 = y2 ^ x1 */
xorl \x0, \y0 /* y0 = y0 ^ x0 */
xorl \x0, \y2 /* y2 = y2 ^ x0 */
.else
.if \m==64
movq \x2, \y1
movq \x2, \y2
movq \x0, \y0
orq \x3, \y2 /* y2 = x2 | x3 */
xorq \x3, \y1 /* y1 = x2 ^ x3 */
xorq \x1, \y2 /* y2 = y2 ^ x1 */
orq \x3, \x1 /* x1 = x1 | x3 */
xorq \y2, \y0 /* y0 = x0 ^ y2 */
xorq \y2, \x3 /* x3 = x3 ^ y2 */
andq \x0, \y2 /* y2 = y2 & x0 */
xorq \y2, \y1 /* y1 = y1 ^ y2 */
xorq \x0, \y2 /* y2 = y2 ^ x0 */
andq \x1, \x0 /* x0 = x0 & x1 */
orq \x2, \y2 /* y2 = y2 | x2 */
movq \x0, \y3
notq \x0 /* x0 = ~ x0 */
xorq \x3, \y3 /* y3 = x3 ^~x0 */
orq \y1, \x0 /* x0 = x0 | y1 */
xorq \x1, \y2 /* y2 = y2 ^ x1 */
xorq \x0, \y0 /* y0 = y0 ^ x0 */
xorq \x0, \y2 /* y2 = y2 ^ x0 */
.else
.if \m==128
vorpd \x3, \x2, \y2 /* y2 = x2 | x3 */
vxorpd \x3, \x2, \y1 /* y1 = x2 ^ x3 */
vxorpd \x1, \y2, \y2 /* y2 = y2 ^ x1 */
vorpd \x3, \x1, \x1 /* x1 = x1 | x3 */
vxorpd \y2, \x0, \y0 /* y0 = x0 ^ y2 */
vxorpd \y2, \x3, \x3 /* x3 = x3 ^ y2 */
vandpd \x0, \y2, \y2 /* y2 = y2 & x0 */
vxorpd \y2, \y1, \y1 /* y1 = y1 ^ y2 */
vxorpd \x0, \y2, \y2 /* y2 = y2 ^ x0 */
vandpd \x1, \x0, \x0 /* x0 = x0 & x1 */
vorpd \x2, \y2, \y2 /* y2 = y2 | x2 */
vxorpd \x0, \x3, \y3 /* y3 = x3 ^ x0 */
vnotpd \x0, \x0 /* x0 = ~ x0 */
vorpd \y1, \x0, \x0 /* x0 = x0 | y1 */
vxorpd \x1, \y2, \y2 /* y2 = y2 ^ x1 */
vxorpd \x0, \y0, \y0 /* y0 = y0 ^ x0 */
vxorpd \x0, \y2, \y2 /* y2 = y2 ^ x0 */
.else
.error "Invalid mode for IBOX4"
.endif
.endif
.endif
.endm
.macro SBOX5 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x1, \y0
movl \x0, \y2
orl \x3, \y0 /* y0 = x1 | x3 */
xorl \x2, \y0 /* y0 = y0 ^ x2 */
movl \x1, \x2
xorl \x3, \x2 /* x2 = x1 ^ x3 */
xorl \x2, \y2 /* y2 = x0 ^ x2 */
andl \x2, \x0 /* x0 = x0 & x2 */
movl \x1, \y3
xorl \x0, \y0 /* y0 = y0 ^ x0 */
orl \y2, \y3 /* y3 = x1 | y2 */
orl \y0, \x1 /* x1 = x1 | y0 */
notl \y0 /* y0 = ~ y0 */
xorl \x2, \y3 /* y3 = y3 ^ x2 */
orl \y0, \x0 /* x0 = x0 | y0 */
movl \x3, \y1
xorl \x0, \y3 /* y3 = y3 ^ x0 */
orl \y0, \y1 /* y1 = x3 | y0 */
xorl \y1, \x3 /* x3 = x3 ^ y1 */
xorl \y2, \y1 /* y1 = y1 ^ y2 */
orl \x3, \y2 /* y2 = y2 | x3 */
xorl \x1, \y2 /* y2 = y2 ^ x1 */
.else
.if \m==64
movq \x1, \y0
movq \x0, \y2
orq \x3, \y0 /* y0 = x1 | x3 */
xorq \x2, \y0 /* y0 = y0 ^ x2 */
movq \x1, \x2
xorq \x3, \x2 /* x2 = x1 ^ x3 */
xorq \x2, \y2 /* y2 = x0 ^ x2 */
andq \x2, \x0 /* x0 = x0 & x2 */
movq \x1, \y3
xorq \x0, \y0 /* y0 = y0 ^ x0 */
orq \y2, \y3 /* y3 = x1 | y2 */
orq \y0, \x1 /* x1 = x1 | y0 */
notq \y0 /* y0 = ~ y0 */
xorq \x2, \y3 /* y3 = y3 ^ x2 */
orq \y0, \x0 /* x0 = x0 | y0 */
movq \x3, \y1
xorq \x0, \y3 /* y3 = y3 ^ x0 */
orq \y0, \y1 /* y1 = x3 | y0 */
xorq \y1, \x3 /* x3 = x3 ^ y1 */
xorq \y2, \y1 /* y1 = y1 ^ y2 */
orq \x3, \y2 /* y2 = y2 | x3 */
xorq \x1, \y2 /* y2 = y2 ^ x1 */
.else
.if \m==128
vorpd \x3, \x1, \y0 /* y0 = x1 | x3 */
vxorpd \x2, \y0, \y0 /* y0 = y0 ^ x2 */
vxorpd \x3, \x1, \x2 /* x2 = x1 ^ x3 */
vxorpd \x2, \x0, \y2 /* y2 = x0 ^ x2 */
vandpd \x2, \x0, \x0 /* x0 = x0 & x2 */
vxorpd \x0, \y0, \y0 /* y0 = y0 ^ x0 */
vorpd \y2, \x1, \y3 /* y3 = x1 | y2 */
vorpd \y0, \x1, \x1 /* x1 = x1 | y0 */
vnotpd \y0, \y0 /* y0 = ~ y0 */
vxorpd \x2, \y3, \y3 /* y3 = y3 ^ x2 */
vorpd \y0, \x0, \x0 /* x0 = x0 | y0 */
vxorpd \x0, \y3, \y3 /* y3 = y3 ^ x0 */
vorpd \y0, \x3, \y1 /* y1 = x3 | y0 */
vxorpd \y1, \x3, \x3 /* x3 = x3 ^ y1 */
vxorpd \y2, \y1, \y1 /* y1 = y1 ^ y2 */
vorpd \x3, \y2, \y2 /* y2 = y2 | x3 */
vxorpd \x1, \y2, \y2 /* y2 = y2 ^ x1 */
.else
.error "Invalid mode for SBOX5"
.endif
.endif
.endif
.endm
.macro IBOX5 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x0, \y1
movl \x2, \y3
andl \x3, \y1 /* y1 = x0 & x3 */
movl \x1, \y0
xorl \y1, \y3 /* y3 = x2 ^ y1 */
movl \x0, \y2
andl \y3, \y0 /* y0 = x1 & y3 */
xorl \x3, \y2 /* y2 = x0 ^ x3 */
xorl \x1, \x3 /* x3 = x3 ^ x1 */
xorl \y2, \y0 /* y0 = y0 ^ y2 */
andl \x0, \x2 /* x2 = x2 & x0 */
andl \y0, \x0 /* x0 = x0 & y0 */
xorl \y0, \y1 /* y1 = y1 ^ y0 */
orl \x1, \x2 /* x2 = x2 | x1 */
xorl \x2, \y1 /* y1 = y1 ^ x2 */
movl \y0, \y2
notl \x1 /* x1 = ~ x1 */
orl \y1, \y2 /* y2 = y0 | y1 */
orl \x0, \x1 /* x1 = x1 | x0 */
xorl \y3, \y2 /* y2 = y2 ^ y3 */
xorl \x1, \y3 /* y3 = y3 ^ x1 */
xorl \x3, \y2 /* y2 = y2 ^ x3 */
.else
.if \m==64
movq \x0, \y1
movq \x2, \y3
andq \x3, \y1 /* y1 = x0 & x3 */
movq \x1, \y0
xorq \y1, \y3 /* y3 = x2 ^ y1 */
movq \x0, \y2
andq \y3, \y0 /* y0 = x1 & y3 */
xorq \x3, \y2 /* y2 = x0 ^ x3 */
xorq \x1, \x3 /* x3 = x3 ^ x1 */
xorq \y2, \y0 /* y0 = y0 ^ y2 */
andq \x0, \x2 /* x2 = x2 & x0 */
andq \y0, \x0 /* x0 = x0 & y0 */
xorq \y0, \y1 /* y1 = y1 ^ y0 */
orq \x1, \x2 /* x2 = x2 | x1 */
xorq \x2, \y1 /* y1 = y1 ^ x2 */
movq \y0, \y2
notq \x1 /* x1 = ~ x1 */
orq \y1, \y2 /* y2 = y0 | y1 */
orq \x0, \x1 /* x1 = x1 | x0 */
xorq \y3, \y2 /* y2 = y2 ^ y3 */
xorq \x1, \y3 /* y3 = y3 ^ x1 */
xorq \x3, \y2 /* y2 = y2 ^ x3 */
.else
.if \m==128
vandpd \x3, \x0, \y1 /* y1 = x0 & x3 */
vxorpd \y1, \x2, \y3 /* y3 = x2 ^ y1 */
vandpd \y3, \x1, \y0 /* y0 = x1 & y3 */
vxorpd \x3, \x0, \y2 /* y2 = x0 ^ x3 */
vxorpd \x1, \x3, \x3 /* x3 = x3 ^ x1 */
vxorpd \y2, \y0, \y0 /* y0 = y0 ^ y2 */
vandpd \x0, \x2, \x2 /* x2 = x2 & x0 */
vandpd \y0, \x0, \x0 /* x0 = x0 & y0 */
vxorpd \y0, \y1, \y1 /* y1 = y1 ^ y0 */
vorpd \x1, \x2, \x2 /* x2 = x2 | x1 */
vxorpd \x2, \y1, \y1 /* y1 = y1 ^ x2 */
vnotpd \x1, \x1 /* x1 = ~ x1 */
vorpd \y1, \y0, \y2 /* y2 = y0 | y1 */
vorpd \x0, \x1, \x1 /* x1 = x1 | x0 */
vxorpd \y3, \y2, \y2 /* y2 = y2 ^ y3 */
vxorpd \x1, \y3, \y3 /* y3 = y3 ^ x1 */
vxorpd \x3, \y2, \y2 /* y2 = y2 ^ x3 */
.else
.error "Invalid mode for IBOX5"
.endif
.endif
.endif
.endm
.macro SBOX6 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x0, \y0
movl \x0, \y1
movl \x0, \y2
xorl \x3, \y0 /* y0 = x0 ^ x3 */
andl \x3, \y1 /* y1 = x0 & x3 */
orl \x2, \y2 /* y2 = x0 | x2 */
movl \x1, \y3
orl \x1, \x3 /* x3 = x3 | x1 */
xorl \x1, \x0 /* x0 = x0 ^ x1 */
xorl \x2, \x3 /* x3 = x3 ^ x2 */
orl \x2, \y3 /* y3 = x1 | x2 */
xorl \x1, \x2 /* x2 = x2 ^ x1 */
andl \y0, \y3 /* y3 = y3 & y0 */
xorl \x2, \y1 /* y1 = y1 ^ x2 */
notl \y1 /* y1 = ~ y1 */
andl \y1, \x1 /* x1 = x1 & y1 */
andl \y1, \y0 /* y0 = y0 & y1 */
xorl \y3, \x1 /* x1 = x1 ^ y3 */
xorl \x3, \y3 /* y3 = y3 ^ x3 */
xorl \x1, \y2 /* y2 = y2 ^ x1 */
notl \y2 /* y2 = ~ y2 */
xorl \x0, \y0 /* y0 = y0 ^ x0 */
xorl \y2, \y0 /* y0 = y0 ^ y2 */
.else
.if \m==64
movq \x0, \y0
movq \x0, \y1
movq \x0, \y2
xorq \x3, \y0 /* y0 = x0 ^ x3 */
andq \x3, \y1 /* y1 = x0 & x3 */
orq \x2, \y2 /* y2 = x0 | x2 */
movq \x1, \y3
orq \x1, \x3 /* x3 = x3 | x1 */
xorq \x1, \x0 /* x0 = x0 ^ x1 */
xorq \x2, \x3 /* x3 = x3 ^ x2 */
orq \x2, \y3 /* y3 = x1 | x2 */
xorq \x1, \x2 /* x2 = x2 ^ x1 */
andq \y0, \y3 /* y3 = y3 & y0 */
xorq \x2, \y1 /* y1 = y1 ^ x2 */
notq \y1 /* y1 = ~ y1 */
andq \y1, \x1 /* x1 = x1 & y1 */
andq \y1, \y0 /* y0 = y0 & y1 */
xorq \y3, \x1 /* x1 = x1 ^ y3 */
xorq \x3, \y3 /* y3 = y3 ^ x3 */
xorq \x1, \y2 /* y2 = y2 ^ x1 */
notq \y2 /* y2 = ~ y2 */
xorq \x0, \y0 /* y0 = y0 ^ x0 */
xorq \y2, \y0 /* y0 = y0 ^ y2 */
.else
.if \m==128
vxorpd \x3, \x0, \y0 /* y0 = x0 ^ x3 */
vandpd \x3, \x0, \y1 /* y1 = x0 & x3 */
vorpd \x2, \x0, \y2 /* y2 = x0 | x2 */
vorpd \x1, \x3, \x3 /* x3 = x3 | x1 */
vxorpd \x1, \x0, \x0 /* x0 = x0 ^ x1 */
vxorpd \x2, \x3, \x3 /* x3 = x3 ^ x2 */
vorpd \x2, \x1, \y3 /* y3 = x1 | x2 */
vxorpd \x1, \x2, \x2 /* x2 = x2 ^ x1 */
vandpd \y0, \y3, \y3 /* y3 = y3 & y0 */
vxorpd \x2, \y1, \y1 /* y1 = y1 ^ x2 */
vnotpd \y1, \y1 /* y1 = ~ y1 */
vandpd \y1, \x1, \x1 /* x1 = x1 & y1 */
vandpd \y1, \y0, \y0 /* y0 = y0 & y1 */
vxorpd \y3, \x1, \x1 /* x1 = x1 ^ y3 */
vxorpd \x3, \y3, \y3 /* y3 = y3 ^ x3 */
vxorpd \x1, \y2, \y2 /* y2 = y2 ^ x1 */
vnotpd \y2, \y2 /* y2 = ~ y2 */
vxorpd \x0, \y0, \y0 /* y0 = y0 ^ x0 */
vxorpd \y2, \y0, \y0 /* y0 = y0 ^ y2 */
.else
.error "Invalid mode for SBOX6"
.endif
.endif
.endif
.endm
.macro IBOX6 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x0, \y2
movl \x1, \y0
movl \x0, \y1
xorl \x2, \y2 /* y2 = x0 ^ x2 */
xorl \x3, \y0 /* y0 = x1 ^ x3 */
notl \x2 /* x2 = ~ x2 */
movl \x1, \y3
orl \x2, \y1 /* y1 = x0 | x2 */
andl \y2, \y3 /* y3 = x1 & y2 */
xorl \y0, \y1 /* y1 = y1 ^ y0 */
orl \x3, \y3 /* y3 = y3 | x3 */
orl \x2, \x3 /* x3 = x3 | x2 */
orl \x1, \x2 /* x2 = x2 | x1 */
andl \x0, \x2 /* x2 = x2 & x0 */
movl \x2, \y0
xorl \y3, \y0 /* y0 = x2 ^ y3 */
andl \y2, \y3 /* y3 = y3 & y2 */
notl \y0 /* y0 = ~ y0 */
xorl \x2, \y3 /* y3 = y3 ^ x2 */
xorl \y1, \x0 /* x0 = x0 ^ y1 */
andl \y0, \x1 /* x1 = x1 & y0 */
xorl \x3, \y2 /* y2 = y2 ^ x3 */
xorl \x0, \y3 /* y3 = y3 ^ x0 */
xorl \x1, \y2 /* y2 = y2 ^ x1 */
.else
.if \m==64
movq \x0, \y2
movq \x1, \y0
movq \x0, \y1
xorq \x2, \y2 /* y2 = x0 ^ x2 */
xorq \x3, \y0 /* y0 = x1 ^ x3 */
notq \x2 /* x2 = ~ x2 */
movq \x1, \y3
orq \x2, \y1 /* y1 = x0 | x2 */
andq \y2, \y3 /* y3 = x1 & y2 */
xorq \y0, \y1 /* y1 = y1 ^ y0 */
orq \x3, \y3 /* y3 = y3 | x3 */
orq \x2, \x3 /* x3 = x3 | x2 */
orq \x1, \x2 /* x2 = x2 | x1 */
andq \x0, \x2 /* x2 = x2 & x0 */
movq \x2, \y0
xorq \y3, \y0 /* y0 = x2 ^ y3 */
andq \y2, \y3 /* y3 = y3 & y2 */
notq \y0 /* y0 = ~ y0 */
xorq \x2, \y3 /* y3 = y3 ^ x2 */
xorq \y1, \x0 /* x0 = x0 ^ y1 */
andq \y0, \x1 /* x1 = x1 & y0 */
xorq \x3, \y2 /* y2 = y2 ^ x3 */
xorq \x0, \y3 /* y3 = y3 ^ x0 */
xorq \x1, \y2 /* y2 = y2 ^ x1 */
.else
.if \m==128
vxorpd \x2, \x0, \y2 /* y2 = x0 ^ x2 */
vxorpd \x3, \x1, \y0 /* y0 = x1 ^ x3 */
vnotpd \x2, \x2 /* x2 = ~ x2 */
vorpd \x2, \x0, \y1 /* y1 = x0 | x2 */
vandpd \y2, \x1, \y3 /* y3 = x1 & y2 */
vxorpd \y0, \y1, \y1 /* y1 = y1 ^ y0 */
vorpd \x3, \y3, \y3 /* y3 = y3 | x3 */
vorpd \x2, \x3, \x3 /* x3 = x3 | x2 */
vorpd \x1, \x2, \x2 /* x2 = x2 | x1 */
vandpd \x0, \x2, \x2 /* x2 = x2 & x0 */
vxorpd \y3, \x2, \y0 /* y0 = x2 ^ y3 */
vandpd \y2, \y3, \y3 /* y3 = y3 & y2 */
vnotpd \y0, \y0 /* y0 = ~ y0 */
vxorpd \x2, \y3, \y3 /* y3 = y3 ^ x2 */
vxorpd \y1, \x0, \x0 /* x0 = x0 ^ y1 */
vandpd \y0, \x1, \x1 /* x1 = x1 & y0 */
vxorpd \x3, \y2, \y2 /* y2 = y2 ^ x3 */
vxorpd \x0, \y3, \y3 /* y3 = y3 ^ x0 */
vxorpd \x1, \y2, \y2 /* y2 = y2 ^ x1 */
.else
.error "Invalid mode for IBOX6"
.endif
.endif
.endif
.endm
.macro SBOX7 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x0, \y0
movl \x1, \y3
andl \x2, \y0 /* y0 = x0 & x2 */
movl \x3, \y1
orl \y0, \y3 /* y3 = x1 | y0 */
notl \y1 /* y1 = ~ y1 */
xorl \x2, \y3 /* y3 = y3 ^ x2 */
andl \x0, \y1 /* y1 = y1 & x0 */
xorl \y1, \y3 /* y3 = y3 ^ y1 */
movl \x2, \y1
movl \x0, \y2
orl \y3, \y1 /* y1 = x2 | y3 */
andl \x1, \y2 /* y2 = x0 & x1 */
xorl \x0, \y1 /* y1 = y1 ^ x0 */
xorl \y2, \x2 /* x2 = x2 ^ y2 */
orl \x3, \y2 /* y2 = y2 | x3 */
xorl \y2, \y1 /* y1 = y1 ^ y2 */
movl \x1, \y2
notl \x3 /* x3 = ~ x3 */
orl \y0, \y2 /* y2 = x1 | y0 */
xorl \y1, \y0 /* y0 = y0 ^ y1 */
xorl \y1, \x1 /* x1 = x1 ^ y1 */
andl \y3, \y2 /* y2 = y2 & y3 */
orl \x3, \y0 /* y0 = y0 | x3 */
orl \x1, \y2 /* y2 = y2 | x1 */
xorl \x2, \y0 /* y0 = y0 ^ x2 */
xorl \x0, \y2 /* y2 = y2 ^ x0 */
.else
.if \m==64
movq \x0, \y0
movq \x1, \y3
andq \x2, \y0 /* y0 = x0 & x2 */
movq \x3, \y1
orq \y0, \y3 /* y3 = x1 | y0 */
notq \y1 /* y1 = ~ y1 */
xorq \x2, \y3 /* y3 = y3 ^ x2 */
andq \x0, \y1 /* y1 = y1 & x0 */
xorq \y1, \y3 /* y3 = y3 ^ y1 */
movq \x2, \y1
movq \x0, \y2
orq \y3, \y1 /* y1 = x2 | y3 */
andq \x1, \y2 /* y2 = x0 & x1 */
xorq \x0, \y1 /* y1 = y1 ^ x0 */
xorq \y2, \x2 /* x2 = x2 ^ y2 */
orq \x3, \y2 /* y2 = y2 | x3 */
xorq \y2, \y1 /* y1 = y1 ^ y2 */
movq \x1, \y2
notq \x3 /* x3 = ~ x3 */
orq \y0, \y2 /* y2 = x1 | y0 */
xorq \y1, \y0 /* y0 = y0 ^ y1 */
xorq \y1, \x1 /* x1 = x1 ^ y1 */
andq \y3, \y2 /* y2 = y2 & y3 */
orq \x3, \y0 /* y0 = y0 | x3 */
orq \x1, \y2 /* y2 = y2 | x1 */
xorq \x2, \y0 /* y0 = y0 ^ x2 */
xorq \x0, \y2 /* y2 = y2 ^ x0 */
.else
.if \m==128
vandpd \x2, \x0, \y0 /* y0 = x0 & x2 */
vorpd \y0, \x1, \y3 /* y3 = x1 | y0 */
vnotpd \x3, \y1 /* y1 = ~ x3 */
vxorpd \x2, \y3, \y3 /* y3 = y3 ^ x2 */
vandpd \x0, \y1, \y1 /* y1 = y1 & x0 */
vxorpd \y1, \y3, \y3 /* y3 = y3 ^ y1 */
vorpd \y3, \x2, \y1 /* y1 = x2 | y3 */
vandpd \x1, \x0, \y2 /* y2 = x0 & x1 */
vxorpd \x0, \y1, \y1 /* y1 = y1 ^ x0 */
vxorpd \y2, \x2, \x2 /* x2 = x2 ^ y2 */
vorpd \x3, \y2, \y2 /* y2 = y2 | x3 */
vxorpd \y2, \y1, \y1 /* y1 = y1 ^ y2 */
vnotpd \x3, \x3 /* x3 = ~ x3 */
vorpd \y0, \x1, \y2 /* y2 = x1 | y0 */
vxorpd \y1, \y0, \y0 /* y0 = y0 ^ y1 */
vxorpd \y1, \x1, \x1 /* x1 = x1 ^ y1 */
vandpd \y3, \y2, \y2 /* y2 = y2 & y3 */
vorpd \x3, \y0, \y0 /* y0 = y0 | x3 */
vorpd \x1, \y2, \y2 /* y2 = y2 | x1 */
vxorpd \x2, \y0, \y0 /* y0 = y0 ^ x2 */
vxorpd \x0, \y2, \y2 /* y2 = y2 ^ x0 */
.else
.error "Invalid mode for SBOX7"
.endif
.endif
.endif
.endm
.macro IBOX7 x0,x1,x2,x3, y0,y1,y2,y3, m=32
.if \m==32
movl \x0, \y3
movl \x1, \y2
movl \x0, \y1
movl \x0, \y0
andl \x1, \y3 /* y3 = x0 & x1 */
xorl \x3, \y2 /* y2 = x1 ^ x3 */
orl \x3, \y1 /* y1 = x0 | x3 */
orl \y3, \y2 /* y2 = y2 | y3 */
andl \x2, \y1 /* y1 = y1 & x2 */
orl \x1, \y0 /* y0 = x0 | x1 */
orl \x2, \y3 /* y3 = y3 | x2 */
xorl \y1, \y2 /* y2 = y2 ^ y1 */
movl \x3, \y1
xorl \y0, \y3 /* y3 = y3 ^ y0 */
andl \x3, \y0 /* y0 = y0 & x3 */
xorl \y3, \y1 /* y1 = x3 ^ y3 */
xorl \x1, \y0 /* y0 = y0 ^ x1 */
notl \y1 /* y1 = ~ y1 */
orl \y0, \y1 /* y1 = y1 | y0 */
xorl \x2, \y0 /* y0 = y0 ^ x2 */
orl \y1, \x3 /* x3 = x3 | y1 */
xorl \x0, \y1 /* y1 = y1 ^ x0 */
xorl \x3, \y0 /* y0 = y0 ^ x3 */
.else
.if \m==64
movq \x0, \y3
movq \x1, \y2
movq \x0, \y1
movq \x0, \y0
andq \x1, \y3 /* y3 = x0 & x1 */
xorq \x3, \y2 /* y2 = x1 ^ x3 */
orq \x3, \y1 /* y1 = x0 | x3 */
orq \y3, \y2 /* y2 = y2 | y3 */
andq \x2, \y1 /* y1 = y1 & x2 */
orq \x1, \y0 /* y0 = x0 | x1 */
orq \x2, \y3 /* y3 = y3 | x2 */
xorq \y1, \y2 /* y2 = y2 ^ y1 */
movq \x3, \y1
xorq \y0, \y3 /* y3 = y3 ^ y0 */
andq \x3, \y0 /* y0 = y0 & x3 */
xorq \y3, \y1 /* y1 = x3 ^ y3 */
xorq \x1, \y0 /* y0 = y0 ^ x1 */
notq \y1 /* y1 = ~ y1 */
orq \y0, \y1 /* y1 = y1 | y0 */
xorq \x2, \y0 /* y0 = y0 ^ x2 */
orq \y1, \x3 /* x3 = x3 | y1 */
xorq \x0, \y1 /* y1 = y1 ^ x0 */
xorq \x3, \y0 /* y0 = y0 ^ x3 */
.else
.if \m==128
vandpd \x1, \x0, \y3 /* y3 = x0 & x1 */
vxorpd \x3, \x1, \y2 /* y2 = x1 ^ x3 */
vorpd \x3, \x0, \y1 /* y1 = x0 | x3 */
vorpd \y3, \y2, \y2 /* y2 = y2 | y3 */
vandpd \x2, \y1, \y1 /* y1 = y1 & x2 */
vorpd \x1, \x0, \y0 /* y0 = x0 | x1 */
vorpd \x2, \y3, \y3 /* y3 = y3 | x2 */
vxorpd \y1, \y2, \y2 /* y2 = y2 ^ y1 */
vxorpd \y0, \y3, \y3 /* y3 = y3 ^ y0 */
vandpd \x3, \y0, \y0 /* y0 = y0 & x3 */
vxorpd \y3, \x3, \y1 /* y1 = x3 ^ y3 */
vxorpd \x1, \y0, \y0 /* y0 = y0 ^ x1 */
vnotpd \y1, \y1 /* y1 = ~ y1 */
vorpd \y0, \y1, \y1 /* y1 = y1 | y0 */
vxorpd \x2, \y0, \y0 /* y0 = y0 ^ x2 */
vorpd \y1, \x3, \x3 /* x3 = x3 | y1 */
vxorpd \x0, \y1, \y1 /* y1 = y1 ^ x0 */
vxorpd \x3, \y0, \y0 /* y0 = y0 ^ x3 */
.else
.error "Invalid mode for IBOX7"
.endif
.endif
.endif
.endm
.macro LT t0,t1,t2,t3, x0,x1,x2,x3, m=32
.if \m==32
roll $13, \x0 /* x0 = ROL(x0, 13) */
roll $3, \x2 /* x2 = ROL(x2, 3) */
xorl \x0, \x1 /* x1 = x1 ^ x0 */
leal (,\x0,8), \t0 /* t0 = x0 << 3 */
xorl \x2, \x3 /* x3 = x3 ^ x2 */
xorl \x2, \x1 /* x1 = x1 ^ x0 ^ x2 */
xorl \t0, \x3 /* x3 = x3 ^ x2 ^ (x0 << 3) */
roll $1, \x1 /* x1 = ROL(x1, 1) */
roll $7, \x3 /* x3 = ROL(x3, 7) */
movl \x1, \t1 /* t1 = x1 */
xorl \x1, \x0 /* x0 = x0 ^ x1 */
shll $7, \x1 /* t1 = x1 << 7 */
xorl \x3, \x2 /* x3 = x3 ^ x2 */
xorl \x3, \x0 /* x0 = x0 ^ x1 ^ x3 */
xorl \t1, \x2 /* x2 = x2 ^ x3 ^ (x1 << 7) */
roll $5, \x0 /* x0 = ROL(x0, 5) */
roll $22, \x2 /* x2 = ROL(x2, 22) */
.else
.if \m==64
movq \x0, \t0
leaq (,\x2,8), \t2
shrq $19, \x0
shrq $29, \x2
shlq $13, \t0
andq %r8, \t2
andq LT64_mask_rsh19(%rip), \x0
andq LT64_mask_rsh29(%rip), \x2
andq LT64_mask_lsh13(%rip), \t0
orq \t2, \x2
orq \t0, \x0
xorq \x2, \x1
leaq (,\x0,8), \t2
xorq \x2, \x3
andq %r8, \t2
xorq \x0, \x1
xorq \t2, \x3
leaq (\x1,\x1), \t1
movq \x3, \t3
shrq $31, \x1
shrq $25, \x3
shlq $7, \t3
andq LT64_mask_lsh1(%rip), \t1
andq LT64_mask_rsh31(%rip), \x1
andq LT64_mask_rsh25(%rip), \x3
andq %r9, \t3
orq \t1, \x1
orq \t3, \x3
movq \x1, \t2
xorq \x3, \x2
andq %r9, \t2
xorq \x1, \x0
xorq \t2, \x2
movq \x0, \t0
movq \x2, \t2
shrq $27, \x0
shrq $10, \x2
shlq $5, \t0
shlq $22, \t2
andq LT64_mask_rsh27(%rip), \x0
andq LT64_mask_rsh10(%rip), \x2
andq LT64_mask_lsh5(%rip), \t0
andq LT64_mask_lsh22(%rip), \t2
orq \t0, \x0
orq \t2, \x2
.else
.if \m==128
vpsrld $19, \x0, %xmm8
vpsrld $29, \x2, %xmm9
vpslld $13, \x0, \x0
vpslld $3, \x2, \x2
vorpd %xmm8, \x0, \x0
vorpd %xmm9, \x2, \x2
vpslld $3, \x0, %xmm10
vxorpd \x0, \x1, \x1
vxorpd %xmm10, \x3, \x3
vxorpd \x2, \x1, \x1
vxorpd \x2, \x3, \x3
vpsrld $31, \x1, %xmm8
vpsrld $25, \x3, %xmm9
vpslld $1, \x1, \x1
vpslld $7, \x3, \x3
vorpd %xmm8, \x1, \x1
vorpd %xmm9, \x3, \x3
vpslld $7, \x1, %xmm10
vxorpd \x1, \x0, \x0
vxorpd %xmm10, \x2, \x2
vxorpd \x3, \x0, \x0
vxorpd \x3, \x2, \x2
vpsrld $27, \x0, %xmm8
vpsrld $10, \x2, %xmm9
vpslld $5, \x0, \x0
vpslld $22, \x2, \x2
vorpd %xmm8, \x0, \x0
vorpd %xmm9, \x2, \x2
.else
.error "Invalid mode for LT"
.endif
.endif
.endif
.endm
.macro ILT x0,x1,x2,x3, t0,t1,t2,t3, m=32
.if \m==32
roll $10, \x2 /* x2 = ROR(x2, 22) */
roll $27, \x0 /* x0 = ROR(x0, 5) */
movl \x1, \t1 /* t1 = x1 */
xorl \x3, \x2 /* x2 = x2 ^ x3 */
shll $7, \t1 /* t1 = x1 << 7 */
xorl \x1, \x0 /* x0 = x0 ^ x1 */
xorl \t1, \x2 /* x2 = x2 ^ x3 ^ (x1 << 7) */
xorl \x3, \x0 /* x0 = x0 ^ x1 ^ x3 */
roll $25, \x3 /* x3 = ROR(x3, 7) */
roll $31, \x1 /* x1 = ROR(x1, 1) */
leal (,\x0,8), \t0 /* t0 = x0 << 3 */
xorl \x2, \x3 /* x3 = x3 ^ x2 */
xorl \x0, \x1 /* x1 = x1 ^ x0 */
xorl \t0, \x3 /* x3 = x3 ^ x2 ^ (x0 << 3) */
xorl \x2, \x1 /* x1 = x1 ^ x0 ^ x2 */
roll $29, \x2 /* x2 = ROR(x2, 3) */
roll $19, \x0 /* x0 = ROR(x0, 13) */
.else
.if \m==64
movq \x2, \t2
movq \x0, \t0
movq \x1, \t1
shrq $22, \x2
shrq $5, \x0
shlq $10, \t2
shlq $27, \t0
shlq $7, \t1
andq LT64_mask_rsh22(%rip), \x2
andq LT64_mask_rsh5(%rip), \x0
andq LT64_mask_lsh10(%rip), \t2
andq LT64_mask_lsh27(%rip), \t0
andq LT64_mask_lsh7(%rip), \t1
orq \t2, \x2
orq \t0, \x0
xorq \x3, \x2
xorq \x1, \x0
xorq \t1, \x2
xorq \x3, \x0
movq \x3, \t3
movq \x1, \t1
shrq $7, \x3
shrq $1, \x1
shlq $25, \t3
shlq $31, \t1
leaq (,\x0,8), \t0
andq LT64_mask_rsh7(%rip), \x3
andq LT64_mask_rsh1(%rip), \x1
andq LT64_mask_lsh25(%rip), \t3
andq LT64_mask_lsh31(%rip), \t1
andq LT64_mask_lsh3(%rip), \t0
orq \t3, \x3
orq \t1, \x1
xorq \x2, \x3
xorq \x0, \x1
xorq \t0, \x3
xorq \x2, \x1
movq \x2, \t2
movq \x0, \t0
shrq $3, \x2
shrq $13, \x0
shlq $29, \t2
shlq $19, \t0
andq LT64_mask_rsh3(%rip), \x2
andq LT64_mask_rsh13(%rip), \x0
andq LT64_mask_lsh29(%rip), \t2
andq LT64_mask_lsh19(%rip), \t0
orq \t2, \x2
orq \t0, \x0
.else
.if \m==128
vpslld $27, \x0, %xmm8
vpslld $10, \x2, %xmm9
vpslld $7, \x1, %xmm10
vpsrld $5, \x0, \x0
vpsrld $22, \x2, \x2
vorpd %xmm8, \x0, \x0
vorpd %xmm9, \x2, \x2
vxorpd \x1, \x0, \x0
vxorpd %xmm10, \x2, \x2
vxorpd \x3, \x0, \x0
vxorpd \x3, \x2, \x2
vpslld $31, \x1, %xmm8
vpslld $25, \x3, %xmm9
vpslld $3, \x0, %xmm10
vpsrld $1, \x1, \x1
vpsrld $7, \x3, \x3
vorpd %xmm8, \x1, \x1
vorpd %xmm9, \x3, \x3
vxorpd \x0, \x1, \x1
vxorpd %xmm10, \x3, \x3
vxorpd \x2, \x1, \x1
vxorpd \x2, \x3, \x3
vpslld $29, \x0, %xmm8
vpslld $19, \x2, %xmm9
vpsrld $13, \x0, \x0
vpsrld $3, \x2, \x2
vorpd %xmm8, \x0, \x0
vorpd %xmm9, \x2, \x2
vprrld 13, %xmm8, \x0
vprrld 3, %xmm9, \x2
.else
.error "Invalid mode for ILT"
.endif
.endif
.endif
.endm
.macro ADDKEY x0,x1,x2,x3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
.if \m==32
xorl 0x0+\ko(\kr), \x0
xorl 0x4+\ko(\kr), \x1
xorl 0x8+\ko(\kr), \x2
xorl 0xC+\ko(\kr), \x3
.else
.if \m==64
movl 0x0+\ko(\kr), \t0d
movl 0x4+\ko(\kr), \t1d
movq \t0, \t2
movq \t1, \t3
shlq $32, \t0
shlq $32, \t1
orq \t0, \t2
orq \t1, \t3
xorq \t2, \x0
xorq \t3, \x1
movl 0x8+\ko(\kr), \t0d
movl 0xC+\ko(\kr), \t1d
movq \t0, \t2
movq \t1, \t3
shlq $32, \t0
shlq $32, \t1
orq \t0, \t2
orq \t1, \t3
xorq \t2, \x2
xorq \t3, \x3
.else
.if \m==128
vmovaps \ko(\kr), %xmm11
vpshufd $0x00, %xmm11, %xmm8
vpshufd $0x55, %xmm11, %xmm9
vpshufd $0xAA, %xmm11, %xmm10
vpshufd $0xFF, %xmm11, %xmm11
vxorpd %xmm8, \x0, \x0
vxorpd %xmm9, \x1, \x1
vxorpd %xmm10, \x2, \x2
vxorpd %xmm11, \x3, \x3
.else
.error "Invalid mode for ADDKEY"
.endif
.endif
.endif
.endm
.macro ENC0 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ADDKEY \x0,\x1,\x2,\x3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
SBOX0 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
LT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
.endm
.macro ENC1 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ADDKEY \x0,\x1,\x2,\x3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
SBOX1 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
LT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
.endm
.macro ENC2 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ADDKEY \x0,\x1,\x2,\x3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
SBOX2 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
LT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
.endm
.macro ENC3 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ADDKEY \x0,\x1,\x2,\x3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
SBOX3 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
LT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
.endm
.macro ENC4 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ADDKEY \x0,\x1,\x2,\x3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
SBOX4 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
LT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
.endm
.macro ENC5 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ADDKEY \x0,\x1,\x2,\x3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
SBOX5 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
LT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
.endm
.macro ENC6 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ADDKEY \x0,\x1,\x2,\x3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
SBOX6 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
LT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
.endm
.macro ENC7 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ADDKEY \x0,\x1,\x2,\x3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
SBOX7 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
LT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
.endm
.macro DEC0 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ILT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
IBOX0 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
ADDKEY \y0,\y1,\y2,\y3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
.endm
.macro DEC1 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ILT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
IBOX1 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
ADDKEY \y0,\y1,\y2,\y3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
.endm
.macro DEC2 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ILT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
IBOX2 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
ADDKEY \y0,\y1,\y2,\y3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
.endm
.macro DEC3 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ILT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
IBOX3 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
ADDKEY \y0,\y1,\y2,\y3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
.endm
.macro DEC4 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ILT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
IBOX4 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
ADDKEY \y0,\y1,\y2,\y3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
.endm
.macro DEC5 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ILT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
IBOX5 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
ADDKEY \y0,\y1,\y2,\y3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
.endm
.macro DEC6 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ILT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
IBOX6 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
ADDKEY \y0,\y1,\y2,\y3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
.endm
.macro DEC7 x0,x1,x2,x3, y0,y1,y2,y3, kr,ko, m=32, t0d=0,t1d=0,t0=0,t1=0,t2=0,t3=0
ILT \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
IBOX7 \x0,\x1,\x2,\x3, \y0,\y1,\y2,\y3, \m
ADDKEY \y0,\y1,\y2,\y3, \kr,\ko, \m, \t0d,\t1d,\t0,\t1,\t2,\t3
.endm
|
programs/oeis/001/A001533.asm
|
neoneye/loda
| 22 |
14985
|
<filename>programs/oeis/001/A001533.asm
; A001533: (8n+1)(8n+7).
; 7,135,391,775,1287,1927,2695,3591,4615,5767,7047,8455,9991,11655,13447,15367,17415,19591,21895,24327,26887,29575,32391,35335,38407,41607,44935,48391,51975,55687,59527,63495,67591,71815,76167,80647,85255,89991,94855,99847,104967,110215,115591,121095,126727,132487,138375,144391,150535,156807,163207,169735,176391,183175,190087,197127,204295,211591,219015,226567,234247,242055,249991,258055,266247,274567,283015,291591,300295,309127,318087,327175,336391,345735,355207,364807,374535,384391,394375,404487,414727,425095,435591,446215,456967,467847,478855,489991,501255,512647,524167,535815,547591,559495,571527,583687,595975,608391,620935,633607
sub $1,$0
bin $1,2
mul $1,128
add $1,7
mov $0,$1
|
src/asis/asis-ids.ads
|
My-Colaborations/dynamo
| 15 |
5258
|
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT INTERFACE COMPONENTS --
-- --
-- A S I S . I D S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1995-2008, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Semantic Interface --
-- Specification Standard (ISO/IEC 15291) 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. --
-- --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 59 Temple Place --
-- - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by Ada Core Technologies Inc --
-- (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- 21 package Asis.Ids
------------------------------------------------------------------------------
------------------------------------------------------------------------------
package Asis.Ids is
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Asis.Ids provides support for permanent unique Element "Identifiers" (Ids).
-- An Id is an efficient way for a tool to reference an ASIS element. The Id
-- is permanent from session to session provided that the Ada compilation
-- environment is unchanged.
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- This package encapsulates a set of operations and queries that implement
-- the ASIS Id abstraction. An Id is a way of identifying a particular
-- Element, from a particular Compilation_Unit, from a particular Context.
-- Ids can be written to files. Ids can be read from files and converted into
-- an Element value with the use of a suitable open Context.
--
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- 21.1 type Id
------------------------------------------------------------------------------
-- The Ada element Id abstraction (a private type).
--
-- The Id type is a distinct abstract type representing permanent "names"
-- that correspond to specific Element values.
--
-- These names can be written to files, retrieved at a later time, and
-- converted to Element values.
------------------------------------------------------------------------------
-- ASIS Ids are a means of identifying particular Element values obtained from
-- a particular physical compilation unit. Ids are "relative names". Each Id
-- value is valid (is usable, makes sense, can be interpreted) only in the
-- context of an appropriate open ASIS Context.
--
-- Id shall be an undiscriminated private type, or, shall be derived from an
-- undiscriminated private type. It shall be declared as a new type or as a
-- subtype of an existing type.
------------------------------------------------------------------------------
type Id is private;
Nil_Id : constant Id;
function "=" (Left : Id; Right : Id) return Boolean is abstract;
------------------------------------------------------------------------------
-- 21.2 function Hash
------------------------------------------------------------------------------
function Hash (The_Id : Id) return Asis.ASIS_Integer;
------------------------------------------------------------------------------
-- 21.3 function "<"
------------------------------------------------------------------------------
function "<" (Left : Id; Right : Id) return Boolean;
------------------------------------------------------------------------------
-- 21.4 function ">"
------------------------------------------------------------------------------
function ">" (Left : Id; Right : Id) return Boolean;
------------------------------------------------------------------------------
-- 21.5 function Is_Nil
------------------------------------------------------------------------------
function Is_Nil (Right : Id) return Boolean;
------------------------------------------------------------------------------
-- Right - Specifies the Id to check
--
-- Returns True if the Id is the Nil_Id.
--
------------------------------------------------------------------------------
-- 21.6 function Is_Equal
------------------------------------------------------------------------------
function Is_Equal (Left : Id; Right : Id) return Boolean;
------------------------------------------------------------------------------
-- Left - Specifies the left Id to compare
-- Right - Specifies the right Id to compare
--
-- Returns True if Left and Right represent the same physical Id, from the
-- same physical compilation unit. The two Ids convert
-- to Is_Identical Elements when converted with the same open ASIS Context.
--
------------------------------------------------------------------------------
-- 21.7 function Create_Id
------------------------------------------------------------------------------
function Create_Id (Element : Asis.Element) return Id;
------------------------------------------------------------------------------
-- Element - Specifies any Element value whose Id is desired
--
-- Returns a unique Id value corresponding to this Element, from the
-- corresponding Enclosing_Compilation_Unit and the corresponding
-- Enclosing_Context. The Id value will not be equal ("=") to the Id value
-- for any other Element value unless the two Elements are Is_Identical.
--
-- Nil_Id is returned for a Nil_Element.
--
-- All Element_Kinds are appropriate.
--
------------------------------------------------------------------------------
-- 21.8 function Create_Element
------------------------------------------------------------------------------
function Create_Element
(The_Id : Id;
The_Context : Asis.Context)
return Asis.Element;
------------------------------------------------------------------------------
-- The_Id - Specifies the Id to be converted to an Element
-- The_Context - Specifies the Context containing the Element with this Id
--
-- Returns the Element value corresponding to The_Id. The_Id shall
-- correspond to an Element available from a Compilation_Unit contained by
-- (referencible through) The_Context.
--
-- Raises ASIS_Inappropriate_Element if the Element value is not available
-- though The_Context. The Status is Value_Error and the Diagnosis
-- string will attempt to indicate the reason for the failure. (e.g., "Unit is
-- inconsistent", "No such unit", "Element is inconsistent (Unit
-- inconsistent)", etc.)
--
------------------------------------------------------------------------------
-- 21.9 function Debug_Image
------------------------------------------------------------------------------
function Debug_Image (The_Id : Id) return Wide_String;
------------------------------------------------------------------------------
-- The_Id - Specifies an Id to convert
--
-- Returns a string value containing implementation-defined debug
-- information associated with the Id.
--
-- The return value uses Asis.Text.Delimiter_Image to separate the lines
-- of multi-line results. The return value does not end with
-- Asis.Text.Delimiter_Image.
--
-- These values are intended for two purposes. They are suitable for
-- inclusion in problem reports sent to the ASIS implementor. They can
-- be presumed to contain information useful when debugging the
-- implementation itself. They are also suitable for use by the ASIS
-- application when printing simple application debugging messages during
-- application development. They are intended to be, to some worthwhile
-- degree, intelligible to the user.
--
------------------------------------------------------------------------------
private
-- The content of this private part is specific for the ASIS
-- implementation for GNAT
type Id is access String;
Nil_Id : constant Id := null;
------------------------------------------------------------------------------
end Asis.Ids;
|
src/main/resources/compressor/header.asm
|
yottatsa/basicv2
| 71 |
94498
|
*=$0801
.byte $15 $08 $00 $00 $9e $32 $30 $37 $32 $3a $8f $20 $4d $4f $53 $43 $4f $4d $50 $00 $00 $00 $00
MEMSTART=2049
MEMEND=53248
COPYFROM=$61
COPYTO=$63
COPYLEN=$65
DATAPOS=$69
TOTALLEN=$6B
COMPPOS=$6D
SCREEN=$0400
lda #<decruncher
sta COPYFROM
lda #>decruncher
sta COPYFROM+1
lda #<data
sec
sbc COPYFROM
sta COPYLEN
lda #>data
sbc COPYFROM+1
sta COPYLEN+1
lda #<SCREEN
sta COPYTO
lda #>SCREEN
sta COPYTO+1
jsr copydown
sei
lda $1
sta tmpreg
and #$fe
sta $1
lda #<data
clc
adc #6
sta COPYFROM
lda #>data
adc #0
sta COPYFROM+1
lda data+2
sec
sbc #6
sta COPYLEN
sta TOTALLEN
lda data+3
sbc #0
sta COPYLEN+1
sta TOTALLEN+1
lda data
sec
sbc #6
sta COMPPOS
lda data+1
sbc #0
sta COMPPOS+1
lda #<MEMEND
sec
sbc COPYLEN
sta COPYTO
sta DATAPOS
lda #>MEMEND
sbc COPYLEN+1
sta COPYTO+1
sta DATAPOS+1
lda COMPPOS
clc
adc DATAPOS
sta COMPPOS
lda COMPPOS+1
adc DATAPOS+1
sta COMPPOS+1
jsr copyup
lda tmpreg
sta $1
cli
jmp SCREEN
copyup:
ldx COPYLEN+1
clc
txa
adc COPYFROM+1
sta COPYFROM+1
clc
txa
adc COPYTO+1
sta COPYTO+1
inx
ldy COPYLEN
beq cskip3
dey
beq cskip2
cloop:
lda (COPYFROM),y
sta (COPYTO),y
dey
bne cloop
cskip2:
lda (COPYFROM),y
sta (COPYTO),y
cskip3:
dey
dec COPYFROM+1
dec COPYTO+1
dex
bne cloop
ldy #0
ldy #0
rts
copydown:
ldy #0
ldx COPYLEN+1
beq cdlowonly
cdloop:
lda (COPYFROM),y
sta (COPYTO),y
iny
bne cdloop
inc COPYFROM+1
inc COPYTO+1
dex
bne cdloop
cdlowonly:
ldx COPYLEN
beq cdendcopy
cdlooplow:
lda (COPYFROM),y
sta (COPYTO),y
iny
dex
bne cdlooplow
cdendcopy:
ldy #0
ldx #0
rts
tmpreg:
.byte 0
copystart:
.word 0
decruncher:
{code}
data:
|
src/keystore-io-files.adb
|
thierr26/ada-keystore
| 0 |
12512
|
<reponame>thierr26/ada-keystore
-----------------------------------------------------------------------
-- keystore-io-files -- Ada keystore IO for files
-- Copyright (C) 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.IO_Exceptions;
with Ada.Unchecked_Deallocation;
with Ada.Directories;
with Interfaces.C.Strings;
with Util.Encoders.AES;
with Util.Log.Loggers;
with Util.Strings;
with Util.Systems.Os;
with Util.Systems.Constants;
-- File header
-- +------------------+
-- | 41 64 61 00 | 4b = Ada
-- | 00 9A 72 57 | 4b = 10/12/1815
-- | 01 9D B1 AC | 4b = 27/11/1852
-- | 00 00 00 01 | 4b = Version 1
-- +------------------+
-- | Keystore UUID | 16b
-- | Storage ID | 4b
-- | Block size | 4b
-- | PAD 0 | 4b
-- | Header HMAC-256 | 32b
-- +------------------+-----
package body Keystore.IO.Files is
use Ada.Strings.Unbounded;
use type Util.Systems.Types.File_Type;
use type Interfaces.C.int;
use Util.Systems.Constants;
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Keystore.IO.Files");
subtype off_t is Util.Systems.Types.off_t;
function Sys_Error return String;
function Get_Default_Data (Path : in String) return String;
procedure Free is
new Ada.Unchecked_Deallocation (Object => File_Stream,
Name => File_Stream_Access);
function Sys_Error return String is
Msg : constant Interfaces.C.Strings.chars_ptr
:= Util.Systems.Os.Strerror (Util.Systems.Os.Errno);
begin
return Interfaces.C.Strings.Value (Msg);
end Sys_Error;
function Hash (Value : Storage_Identifier) return Ada.Containers.Hash_Type is
begin
return Ada.Containers.Hash_Type (Value);
end Hash;
function Get_Default_Data (Path : in String) return String is
Pos : constant Natural := Util.Strings.Rindex (Path, '.');
begin
if Pos > 0 then
return Path (Path'First .. Pos - 1);
else
return Ada.Directories.Containing_Directory (Path);
end if;
end Get_Default_Data;
-- ------------------------------
-- Open the wallet stream.
-- ------------------------------
procedure Open (Stream : in out Wallet_Stream;
Path : in String;
Data_Path : in String) is
begin
if Data_Path'Length > 0 then
Stream.Descriptor.Open (Path, Data_Path, Stream.Sign);
else
Stream.Descriptor.Open (Path, Get_Default_Data (Path), Stream.Sign);
end if;
end Open;
procedure Create (Stream : in out Wallet_Stream;
Path : in String;
Data_Path : in String;
Config : in Wallet_Config) is
begin
if Data_Path'Length > 0 then
Stream.Descriptor.Create (Path, Data_Path, Config, Stream.Sign);
else
Stream.Descriptor.Create (Path, Get_Default_Data (Path), Config, Stream.Sign);
end if;
if Config.Storage_Count > 1 then
Stream.Add_Storage (Config.Storage_Count - 1);
end if;
end Create;
-- ------------------------------
-- Get information about the keystore file.
-- ------------------------------
function Get_Info (Stream : in out Wallet_Stream) return Wallet_Info is
File : File_Stream_Access;
begin
Stream.Descriptor.Get (DEFAULT_STORAGE_ID, File);
return File.Get_Info;
end Get_Info;
-- ------------------------------
-- Read from the wallet stream the block identified by the number and
-- call the `Process` procedure with the data block content.
-- ------------------------------
overriding
procedure Read (Stream : in out Wallet_Stream;
Block : in Storage_Block;
Process : not null access
procedure (Data : in IO_Block_Type)) is
File : File_Stream_Access;
begin
Stream.Descriptor.Get (Block.Storage, File);
File.Read (Block.Block, Process);
end Read;
-- ------------------------------
-- Write in the wallet stream the block identified by the block number.
-- ------------------------------
overriding
procedure Write (Stream : in out Wallet_Stream;
Block : in Storage_Block;
Process : not null access
procedure (Data : out IO_Block_Type)) is
File : File_Stream_Access;
begin
Stream.Descriptor.Get (Block.Storage, File);
File.Write (Block.Block, Process);
end Write;
-- ------------------------------
-- Allocate a new block and return the block number in `Block`.
-- ------------------------------
overriding
procedure Allocate (Stream : in out Wallet_Stream;
Kind : in Block_Kind;
Block : out Storage_Block) is
File : File_Stream_Access;
begin
Stream.Descriptor.Allocate (Kind, Block.Storage, File);
File.Allocate (Block.Block);
end Allocate;
-- ------------------------------
-- Release the block number.
-- ------------------------------
overriding
procedure Release (Stream : in out Wallet_Stream;
Block : in Storage_Block) is
File : File_Stream_Access;
begin
Stream.Descriptor.Get (Block.Storage, File);
File.Release (Block.Block);
end Release;
overriding
function Is_Used (Stream : in out Wallet_Stream;
Block : in Storage_Block) return Boolean is
File : File_Stream_Access;
begin
Stream.Descriptor.Get (Block.Storage, File);
return File.Is_Used (Block.Block);
end Is_Used;
overriding
procedure Set_Header_Data (Stream : in out Wallet_Stream;
Index : in Header_Slot_Index_Type;
Kind : in Header_Slot_Type;
Data : in Ada.Streams.Stream_Element_Array) is
File : File_Stream_Access;
begin
Stream.Descriptor.Get (DEFAULT_STORAGE_ID, File);
File.Set_Header_Data (Index, Kind, Data, Stream.Sign);
end Set_Header_Data;
overriding
procedure Get_Header_Data (Stream : in out Wallet_Stream;
Index : in Header_Slot_Index_Type;
Kind : out Header_Slot_Type;
Data : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is
File : File_Stream_Access;
begin
Stream.Descriptor.Get (DEFAULT_STORAGE_ID, File);
File.Get_Header_Data (Index, Kind, Data, Last);
end Get_Header_Data;
-- ------------------------------
-- Add up to Count data storage files associated with the wallet.
-- ------------------------------
procedure Add_Storage (Stream : in out Wallet_Stream;
Count : in Positive) is
begin
Stream.Descriptor.Add_Storage (Count, Stream.Sign);
end Add_Storage;
-- ------------------------------
-- Close the wallet stream and release any resource.
-- ------------------------------
procedure Close (Stream : in out Wallet_Stream) is
begin
Stream.Descriptor.Close;
end Close;
function Get_Block_Offset (Block : in Block_Number) return off_t is
(Util.Systems.Types.off_t (Block) * Block_Size);
protected body File_Stream is
procedure Open (File_Descriptor : in Util.Systems.Types.File_Type;
Storage : in Storage_Identifier;
Sign : in Secret_Key;
File_Size : in Block_Count;
UUID : out UUID_Type) is
begin
File.Initialize (File_Descriptor);
Size := File_Size;
Current_Pos := Block_Size;
Header.Buffer := Buffers.Allocate ((Storage, HEADER_BLOCK_NUM));
declare
Buf : constant Buffers.Buffer_Accessor := Header.Buffer.Data.Value;
Last : Ada.Streams.Stream_Element_Offset;
begin
File.Read (Data, Last);
if Last /= Data'Last then
Log.Warn ("Header block is too short");
raise Invalid_Keystore;
end if;
Buf.Data := Data (Buf.Data'Range);
Keystore.IO.Headers.Sign_Header (Header, Sign);
if Header.HMAC /= Data (BT_HMAC_HEADER_POS .. Data'Last) then
Log.Warn ("Header block HMAC signature is invalid");
raise Invalid_Block;
end if;
Keystore.IO.Headers.Read_Header (Header);
UUID := Header.UUID;
end;
end Open;
procedure Create (File_Descriptor : in Util.Systems.Types.File_Type;
Storage : in Storage_Identifier;
UUID : in UUID_Type;
Sign : in Secret_Key) is
begin
File.Initialize (File_Descriptor);
Size := 1;
Current_Pos := Block_Size;
Header.Buffer := Buffers.Allocate ((Storage, HEADER_BLOCK_NUM));
Header.UUID := UUID;
Keystore.IO.Headers.Build_Header (UUID, Storage, Header);
Keystore.IO.Headers.Sign_Header (Header, Sign);
declare
Buf : constant Buffers.Buffer_Accessor := Header.Buffer.Data.Value;
begin
File.Write (Buf.Data);
File.Write (Header.HMAC);
end;
end Create;
function Get_Info return Wallet_Info is
Result : Wallet_Info;
begin
Result.UUID := Header.UUID;
Result.Header_Count := Header.Data_Count;
Result.Storage_Count := Header.Storage_Count;
return Result;
end Get_Info;
-- Read from the wallet stream the block identified by the number and
-- call the `Process` procedure with the data block content.
procedure Read (Block : in Block_Number;
Process : not null access
procedure (Data : in IO_Block_Type)) is
Pos : constant off_t := Get_Block_Offset (Block);
Last : Ada.Streams.Stream_Element_Offset;
begin
if Pos /= Current_Pos then
File.Seek (Pos => Pos, Mode => Util.Systems.Types.SEEK_SET);
end if;
File.Read (Data, Last);
Process (Data);
Current_Pos := Pos + Block_Size;
end Read;
-- Write in the wallet stream the block identified by the block number.
procedure Write (Block : in Block_Number;
Process : not null access
procedure (Data : out IO_Block_Type)) is
Pos : constant off_t := Get_Block_Offset (Block);
begin
if Pos /= Current_Pos then
File.Seek (Pos => Pos, Mode => Util.Systems.Types.SEEK_SET);
end if;
Process (Data);
File.Write (Data);
Current_Pos := Pos + Block_Size;
end Write;
-- ------------------------------
-- Returns true if the block number is allocated.
-- ------------------------------
function Is_Used (Block : in Block_Number) return Boolean is
begin
return Block <= Size and not Free_Blocks.Contains (Block);
end Is_Used;
-- ------------------------------
-- Allocate a new block and return the block number in `Block`.
-- ------------------------------
procedure Allocate (Block : out Block_Number) is
begin
if not Free_Blocks.Is_Empty then
Block := Free_Blocks.First_Element;
Free_Blocks.Delete_First;
else
Block := Block_Number (Size);
Size := Size + 1;
end if;
end Allocate;
-- ------------------------------
-- Release the block number.
-- ------------------------------
procedure Release (Block : in Block_Number) is
begin
Free_Blocks.Insert (Block);
end Release;
procedure Save_Header (Sign : in Secret_Key) is
Buf : constant Buffers.Buffer_Accessor := Header.Buffer.Data.Value;
begin
Keystore.IO.Headers.Sign_Header (Header, Sign);
File.Seek (Pos => 0, Mode => Util.Systems.Types.SEEK_SET);
File.Write (Buf.Data);
File.Write (Header.HMAC);
Current_Pos := Block_Size;
end Save_Header;
procedure Set_Header_Data (Index : in Header_Slot_Index_Type;
Kind : in Header_Slot_Type;
Data : in Ada.Streams.Stream_Element_Array;
Sign : in Secret_Key) is
begin
IO.Headers.Set_Header_Data (Header, Index, Kind, Data);
Save_Header (Sign);
end Set_Header_Data;
procedure Get_Header_Data (Index : in Header_Slot_Index_Type;
Kind : out Header_Slot_Type;
Data : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset) is
begin
IO.Headers.Get_Header_Data (Header, Index, Kind, Data, Last);
end Get_Header_Data;
procedure Add_Storage (Identifier : in Storage_Identifier;
Sign : in Secret_Key) is
Pos : Block_Index;
begin
IO.Headers.Add_Storage (Header, Identifier, 1, Pos);
Save_Header (Sign);
end Add_Storage;
procedure Scan_Storage (Process : not null
access procedure (Storage : in Wallet_Storage)) is
begin
IO.Headers.Scan_Storage (Header, Process);
end Scan_Storage;
procedure Close is
Last : Block_Number := Size;
Free_Block : Block_Number;
Iter : Block_Number_Sets.Cursor := Free_Blocks.Last;
begin
-- Look at free blocks to see if we can truncate the file when
-- the last blocks are all deleted.
while Block_Number_Sets.Has_Element (Iter) loop
Free_Block := Block_Number_Sets.Element (Iter);
exit when Free_Block /= Last - 1;
Last := Last - 1;
Block_Number_Sets.Previous (Iter);
end loop;
-- We have the last deleted block and we can truncate the file to it inclusive.
if Last /= Size then
declare
Length : constant off_t := Get_Block_Offset (Last);
Result : Integer;
begin
Result := Util.Systems.Os.Sys_Ftruncate (File.Get_File, Length);
if Result /= 0 then
Log.Warn ("Truncate to drop deleted blocks failed: {0}", Sys_Error);
end if;
end;
end if;
File.Close;
end Close;
end File_Stream;
protected body Stream_Descriptor is
function Get_Storage_Path (Storage_Id : in Storage_Identifier) return String is
Prefix : constant String := To_String (UUID);
Index : constant String := Storage_Identifier'Image (Storage_Id);
Name : constant String := Prefix & "-" & Index (Index'First + 1 .. Index'Last);
begin
return Ada.Directories.Compose (To_String (Directory), Name & ".dkt");
end Get_Storage_Path;
procedure Open (Path : in String;
Identifier : in Storage_Identifier;
Sign : in Secret_Key;
Tag : out UUID_Type) is
Fd : Util.Systems.Types.File_Type := Util.Systems.Os.NO_FILE;
P : Interfaces.C.Strings.chars_ptr;
File : File_Stream_Access;
Flags : Interfaces.C.int;
Stat : aliased Util.Systems.Types.Stat_Type;
Size : Block_Count;
Result : Integer;
begin
Flags := O_CLOEXEC + O_RDWR;
P := Interfaces.C.Strings.New_String (Path);
Fd := Util.Systems.Os.Sys_Open (P, Flags, 8#600#);
Interfaces.C.Strings.Free (P);
if Fd = Util.Systems.Os.NO_FILE then
Log.Error ("Cannot open keystore '{0}': {1}", Path, Sys_Error);
raise Ada.IO_Exceptions.Name_Error with Path;
end if;
Result := Util.Systems.Os.Sys_Fstat (Fd, Stat'Access);
if Result /= 0 then
Result := Util.Systems.Os.Sys_Close (Fd);
Log.Error ("Invalid keystore file '{0}': {1}", Path, Sys_Error);
raise Ada.IO_Exceptions.Name_Error with Path;
end if;
if Stat.st_size mod IO.Block_Size /= 0 then
Result := Util.Systems.Os.Sys_Close (Fd);
Log.Error ("Invalid or truncated keystore file '{0}': size is incorrect", Path);
raise Ada.IO_Exceptions.Name_Error with Path;
end if;
Size := Block_Count (Stat.st_size / IO.Block_Size);
File := new File_Stream;
Files.Insert (Identifier, File);
File.Open (Fd, Identifier, Sign, Size, Tag);
end Open;
procedure Open (Path : in String;
Data_Path : in String;
Sign : in Secret_Key) is
procedure Open_Storage (Storage : in Wallet_Storage);
procedure Open_Storage (Storage : in Wallet_Storage) is
Path : constant String := Get_Storage_Path (Storage.Identifier);
Tag : UUID_Type;
begin
Open (Path, Storage.Identifier, Sign, Tag);
if Tag /= UUID then
Log.Error ("Invalid UUID for storage file {0}", Path);
end if;
if Storage.Identifier > Last_Id then
Last_Id := Storage.Identifier;
end if;
Alloc_Id := 1;
end Open_Storage;
File : File_Stream_Access;
begin
if Data_Path'Length > 0 then
Directory := To_Unbounded_String (Data_Path);
else
Directory := To_Unbounded_String (Ada.Directories.Containing_Directory (Path));
end if;
Open (Path, DEFAULT_STORAGE_ID, Sign, UUID);
Get (DEFAULT_STORAGE_ID, File);
Last_Id := DEFAULT_STORAGE_ID;
File.Scan_Storage (Open_Storage'Access);
end Open;
procedure Create (Path : in String;
Data_Path : in String;
Config : in Wallet_Config;
Sign : in Secret_Key) is
Fd : Util.Systems.Types.File_Type := Util.Systems.Os.NO_FILE;
P : Interfaces.C.Strings.chars_ptr;
File : File_Stream_Access;
Flags : Interfaces.C.int;
Result : Integer with Unreferenced => True;
begin
Directory := To_Unbounded_String (Data_Path);
Flags := O_CREAT + O_TRUNC + O_CLOEXEC + O_RDWR;
if not Config.Overwrite then
Flags := Flags + O_EXCL;
end if;
P := Interfaces.C.Strings.New_String (Path);
Fd := Util.Systems.Os.Sys_Open (P, Flags, 8#600#);
Interfaces.C.Strings.Free (P);
if Fd = Util.Systems.Os.NO_FILE then
Log.Error ("Cannot create keystore '{0}': {1}", Path, Sys_Error);
raise Ada.IO_Exceptions.Name_Error with Path;
end if;
File := new File_Stream;
Random.Generate (UUID);
File.Create (Fd, DEFAULT_STORAGE_ID, UUID, Sign);
Files.Insert (DEFAULT_STORAGE_ID, File);
Last_Id := DEFAULT_STORAGE_ID;
end Create;
procedure Create_Storage (Storage_Id : in Storage_Identifier;
Sign : in Secret_Key) is
Path : constant String := Get_Storage_Path (Storage_Id);
Fd : Util.Systems.Types.File_Type := Util.Systems.Os.NO_FILE;
P : Interfaces.C.Strings.chars_ptr;
File : File_Stream_Access;
Flags : Interfaces.C.int;
Result : Integer with Unreferenced => True;
begin
Flags := O_CREAT + O_TRUNC + O_CLOEXEC + O_RDWR;
P := Interfaces.C.Strings.New_String (Path);
Fd := Util.Systems.Os.Sys_Open (P, Flags, 8#600#);
Interfaces.C.Strings.Free (P);
if Fd = Util.Systems.Os.NO_FILE then
Log.Error ("Cannot create keystore storage '{0}': {1}", Path, Sys_Error);
raise Ada.IO_Exceptions.Name_Error with Path;
end if;
File := new File_Stream;
File.Create (Fd, Storage_Id, UUID, Sign);
Files.Insert (Storage_Id, File);
end Create_Storage;
procedure Add_Storage (Count : in Positive;
Sign : in Secret_Key) is
File : File_Stream_Access;
Dir : constant String := To_String (Directory);
begin
Get (DEFAULT_STORAGE_ID, File);
if not Ada.Directories.Exists (Dir) then
Ada.Directories.Create_Path (Dir);
end if;
for I in 1 .. Count loop
Last_Id := Last_Id + 1;
Create_Storage (Last_Id, Sign);
File.Add_Storage (Last_Id, Sign);
end loop;
if Alloc_Id = DEFAULT_STORAGE_ID then
Alloc_Id := 1;
end if;
end Add_Storage;
procedure Get (Storage : in Storage_Identifier;
File : out File_Stream_Access) is
Pos : constant File_Stream_Maps.Cursor := Files.Find (Storage);
begin
if not File_Stream_Maps.Has_Element (Pos) then
Log.Error ("Storage{0} not found", Storage_Identifier'Image (Storage));
raise Keystore.Invalid_Storage;
end if;
File := File_Stream_Maps.Element (Pos);
end Get;
procedure Allocate (Kind : in Block_Kind;
Storage : out Storage_Identifier;
File : out File_Stream_Access) is
begin
if Kind = IO.MASTER_BLOCK or Kind = IO.DIRECTORY_BLOCK
or Last_Id = DEFAULT_STORAGE_ID
then
Storage := DEFAULT_STORAGE_ID;
else
Storage := Alloc_Id;
Alloc_Id := Alloc_Id + 1;
if Alloc_Id > Last_Id then
Alloc_Id := 1;
end if;
end if;
Get (Storage, File);
end Allocate;
procedure Close is
First : File_Stream_Maps.Cursor;
File : File_Stream_Access;
begin
while not File_Stream_Maps.Is_Empty (Files) loop
First := Files.First;
File := File_Stream_Maps.Element (First);
Files.Delete (First);
File.Close;
Free (File);
end loop;
end Close;
end Stream_Descriptor;
end Keystore.IO.Files;
|
16-bit-boot-sector/boot-sector.asm
|
AkselsLedins/kas-os
| 0 |
175551
|
<filename>16-bit-boot-sector/boot-sector.asm
; Often loaded into 0x7c00
[org 0x7c00] ; set the offset to bootsector code
mov bx, WELCOME
call print
call print_nl
mov bp, 0x8000 ; set the stack far from us
mov sp, bp
mov bx, 0x9000
mov dh, 2 ; read 2 sectors
call disk_load
; Infinite loop (e9 fd ff)
jmp $
%include "./boot-sector-helpers.asm"
%include "./boot-sector-disk.asm"
; data
WELCOME:
db 'Welcome on KAS-OS', 0
GOODBYE:
db 'Goodbye!', 0
; magic number
times 510-($-$$) db 0
dw 0xaa55
times 256 dw 0xdada ; sector 2 = 512 bytes
times 256 dw 0xface ; sector 3 = 512 bytes
|
stats/creditsnew.asm
|
KScl/z3rasm
| 0 |
163486
|
;===================================================================================================
CreditsLineTable:
fillword CreditsLineBlank : fill 800
;===================================================================================================
!CLINE = -1
;---------------------------------------------------------------------------------------------------
macro smallcredits(text, color)
!CLINE #= !CLINE+1
table "textmaps/credit_s_<color>.map"
?line:
db (32-(?end-?text))/2
db 2*(?end-?text)-1
?text:
db "<text>"
?end:
pushpc
org CreditsLineTable+!CLINE+!CLINE : dw ?line
pullpc
endmacro
;---------------------------------------------------------------------------------------------------
macro bigcredits(text)
!CLINE #= !CLINE+1
table "textmaps/credit_b_hi.map"
?line_top:
db (32-(?end-?text))/2
db 2*(?end-?text)-1
?text:
db "<text>"
?end:
pushpc
org CreditsLineTable+!CLINE+!CLINE : dw ?line_top
pullpc
table "textmaps/credit_b_lo.map"
?line_bottom:
db (32-(?end-?text))/2
db 2*(?end-?text)-1
db "<text>"
!CLINE #= !CLINE+1
pushpc
org CreditsLineTable+!CLINE+!CLINE : dw ?line_bottom
pullpc
endmacro
;---------------------------------------------------------------------------------------------------
macro bigcreditsleft(text)
!CLINE #= !CLINE+1
table "textmaps/credit_b_hi.map"
?line_top:
db 2
db 2*(?end-?text)-1
?text:
db "<text>"
?end:
pushpc
org CreditsLineTable+!CLINE+!CLINE : dw ?line_top
pullpc
table "textmaps/credit_b_lo.map"
?line_bottom:
db 2
db 2*(?end-?text)-1
db "<text>"
!CLINE #= !CLINE+1
pushpc
org CreditsLineTable+!CLINE+!CLINE : dw ?line_bottom
pullpc
endmacro
;---------------------------------------------------------------------------------------------------
macro emptyline()
!CLINE #= !CLINE+1
pushpc
org CreditsLineTable+!CLINE+!CLINE : dw CreditsEmptyLine
pullpc
endmacro
macro blankline()
!CLINE #= !CLINE+1
pushpc
org CreditsLineTable+!CLINE+!CLINE : dw CreditsLineBlank
pullpc
endmacro
macro addarbline(l)
!CLINE #= !CLINE+1
pushpc
org CreditsLineTable+!CLINE+!CLINE : dw <l>
pullpc
endmacro
;===================================================================================================
CreditsEmptyLine:
db $00, $01, $9F
CreditsLineBlank:
db $FF
;---------------------------------------------------------------------------------------------------
%emptyline() ; Pretty sure this is required to be at the start. Don't touch.
%smallcredits("ORIGINAL GAME STAFF", "yellow")
%blankline()
%blankline()
%emptyline()
%smallcredits("EXECUTIVE PRODUCER", "green")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("PRODUCER", "yellow")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("DIRECTOR", "red")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("SCRIPT WRITER", "green")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("ASSISTANT DIRECTORS", "yellow")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("SCREEN GRAPHICS DESIGNERS", "green")
%emptyline()
%emptyline()
%smallcredits("OBJECT DESIGNERS", "yellow")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("BACK GROUND DESIGNERS", "yellow")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("PROGRAM DIRECTOR", "red")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("MAIN PROGRAMMER", "yellow")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("OBJECT PROGRAMMER", "green")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("PROGRAMMERS", "yellow")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("SOUND COMPOSER", "red")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("COORDINATORS", "green")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("PRINTED ART WORK", "yellow")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%blankline()
%smallcredits("SPECIAL THANKS TO", "red")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
%bigcredits("<NAME>")
%blankline()
; Pad with extra lines
; Try to keep the padding equal after both credits sections
rep 16 : %emptyline()
;---------------------------------------------------------------------------------------------------
%smallcredits("RANDOMIZER CONTRIBUTORS", "red")
%blankline()
%blankline()
%emptyline()
%smallcredits("ITEM RANDOMIZER", "yellow")
%blankline()
%bigcredits("KATDEVSGAMES VEETORP")
%blankline()
%bigcredits("CHRISTOSOWEN DESSYREQT")
%blankline()
%bigcredits("SMALLHACKER SYNACK")
%blankline()
%blankline()
%smallcredits("<NAME>", "green")
%blankline()
%bigcredits("AMAZINGAMPHAROS LLCOOLDAVE")
%blankline()
%bigcredits("KEVINCATHCART CASSIDYMOEN")
%blankline()
%blankline()
%smallcredits("<NAME>", "red")
%blankline()
%bigcredits("ZARBY89 SOSUKE3")
%blankline()
%bigcredits("ENDEROFGAMES")
%blankline()
%blankline()
%smallcredits("<NAME>", "yellow")
%blankline()
%bigcredits("AERINON COMPILING")
%blankline()
%blankline()
%smallcredits("MULTIWORLD RANDOMIZER", "green")
%blankline()
%bigcredits("BONTA CAITSITH2")
%blankline()
%bigcredits("BERSERKER66")
%blankline()
%blankline()
%smallcredits("MSU SUPPORT", "red")
%blankline()
%bigcredits("QWERTYMODO")
%blankline()
%blankline()
%smallcredits("<NAME>", "yellow")
%blankline()
%bigcredits("NELSON AKA SWR")
%blankline()
%blankline()
%smallcredits("SPRITE DEVELOPMENT", "green")
%blankline()
%bigcredits("MIKETRETHEWEY IBAZLY")
%blankline()
%bigcredits("FISH_WAFFLE64 KRELBEL")
%blankline()
%bigcredits("ACHY ARTHEAU")
%blankline()
%bigcredits("GLAN TWROXAS")
%blankline()
%bigcredits("PLAGUEDONE TARTHORON")
%blankline()
%blankline()
%smallcredits("YOUR SPRITE BY", "red")
%blankline()
%addarbline(YourSpriteCreditsHi)
%addarbline(YourSpriteCreditsLo)
%blankline()
%blankline()
%smallcredits("SPECIAL THANKS", "yellow")
%blankline()
%bigcredits("SUPERSKUJ EVILASH25")
%blankline()
%bigcredits("MYRAMONG JOSHRTA")
%blankline()
%bigcredits("WALKINGEYE MATHONNAPKINS")
%blankline()
%bigcredits("EMOSARU PINKUS")
%blankline()
%bigcredits("YUZUHARA SAKURATSUBASA")
%blankline()
; Pad with extra lines
; Try to keep the padding equal after both credits sections
rep 16 : %emptyline()
;===================================================================================================
print "Line number: !CLINE | Expected: 290"
if !CLINE > 290
error "Too many credits lines. !CLINE > 290"
elseif !CLINE < 290
warn "Too few credits lines. !CLINE < 290; Adding additional empties for alignment."
endif
; Set line always to line up with stats
!CLINE #= 290
;===================================================================================================
!STAT_TIME_X = 19
!STAT_WITH_TOTAL_X = 22
!STAT_OTHER_X = 25
%smallcredits("THE IMPORTANT STUFF", "yellow")
%blankline()
%blankline()
%emptyline()
%smallcredits("TIME FOUND", "green")
%blankline()
!FOUND_SWORD_LINE #= !CLINE+1 : %bigcreditsleft("FIRST SWORD")
%blankline()
!FOUND_BOOTS_LINE #= !CLINE+1 : %bigcreditsleft("PEGASUS BOOTS")
%blankline()
!FOUND_FLUTE_LINE #= !CLINE+1 : %bigcreditsleft("FLUTE")
%blankline()
!FOUND_MIRROR_LINE #= !CLINE+1 : %bigcreditsleft("MIRROR")
%blankline()
%blankline()
%smallcredits("BOSS KILLS", "yellow")
%blankline()
!BOSSES_SWORD_0_LINE #= !CLINE+1 : %bigcreditsleft("SWORDLESS /13")
%blankline()
!BOSSES_SWORD_1_LINE #= !CLINE+1 : %bigcreditsleft("FIGHTER'S SWORD /13")
%blankline()
!BOSSES_SWORD_2_LINE #= !CLINE+1 : %bigcreditsleft("MASTER SWORD /13")
%blankline()
!BOSSES_SWORD_3_LINE #= !CLINE+1 : %bigcreditsleft("TEMPERED SWORD /13")
%blankline()
!BOSSES_SWORD_4_LINE #= !CLINE+1 : %bigcreditsleft("GOLDEN SWORD /13")
%blankline()
%blankline()
%smallcredits("GAME STATS", "red")
%blankline()
!CHEST_TURNS_LINE #= !CLINE+1 : %bigcreditsleft("CHEST TURNS")
%blankline()
!BOOTS_BONKS_LINE #= !CLINE+1 : %bigcreditsleft("BONKS")
%blankline()
!MIRROR_BONKS_LINE #= !CLINE+1 : %bigcreditsleft("MIRROR BONKS")
%blankline()
!SAVE_QUITS_LINE #= !CLINE+1 : %bigcreditsleft("SAVE AND QUITS")
%blankline()
!DEATHS_LINE #= !CLINE+1 : %bigcreditsleft("DEATHS")
%blankline()
!REVIVES_LINE #= !CLINE+1 : %bigcreditsleft("FAERIE REVIVALS")
%blankline()
!MENU_TIME_LINE #= !CLINE+1 : %bigcreditsleft("TOTAL MENU TIME")
%blankline()
!LAG_TIME_LINE #= !CLINE+1 : %bigcreditsleft("TOTAL LAG TIME")
%blankline()
%blankline()
%smallcredits("EXTRA STATS", "green")
%blankline()
%addarbline(ExtraStat1Hi) : %addarbline(ExtraStat1Lo) ; 357
%blankline()
%addarbline(ExtraStat2Hi) : %addarbline(ExtraStat2Lo) ; 360
%blankline()
%addarbline(ExtraStat3Hi) : %addarbline(ExtraStat3Lo) ; 363
%blankline()
; Pad with extra lines
rep 14 : %emptyline()
;===================================================================================================
if !CLINE > 379
error "Too many stats lines. !CLINE > 379"
elseif !CLINE < 379
error "Too few stats lines. !CLINE < 379"
endif
;===================================================================================================
!TOTAL_CHECKS_X = 21
!TOTAL_TIME_X = 19
!TOTAL_CHECKS_LINE #= !CLINE+1 : %addarbline(CollectionRateHi) : %addarbline(CollectionRateLo)
%blankline()
!TOTAL_TIME_LINE #= !CLINE+1 : %bigcreditsleft("TOTAL TIME")
%blankline()
%emptyline()
%emptyline()
%emptyline()
%emptyline()
%emptyline()
%emptyline()
;---------------------------------------------------------------------------------------------------
|
ugbc/src/hw/6502/sqr.asm
|
Samuel-DEVULDER/ugbasic
| 10 |
105024
|
; Square Root Calculator by <NAME>
;
; How to calculate the 8-bit unsigned integer square root of an unsigned 16-bit integer.
; By <NAME> (<EMAIL>), 23 July 2001.
; Calculates the 8 bit root and 9 bit remainder of a 16 bit unsigned integer in
; Numberl/Numberh. The result is always in the range 0 to 255 and is held in
; Root, the remainder is in the range 0 to 511 and is held in Reml/Remh
;
; partial results are held in templ/temph
;
; This routine is the complement to the integer square program.
;
; Destroys A, X registers.
;
; variables - must be in RAM
; Originally published on http://6502.org/source/integers/root.htm
; Adapted by <NAME> for ugBASIC
;
; @thirdparts <NAME> * *
Numberl = $F0 ; number to find square root of low byte
Numberh = Numberl+1 ; number to find square root of high byte
Reml = $F2 ; remainder low byte
Remh = Reml+1 ; remainder high byte
templ = $F4 ; temp partial low byte
temph = templ+1 ; temp partial high byte
Root = $F6 ; square root
SQROOT:
LDA #$00 ; clear A
STA Reml ; clear remainder low byte
STA Remh ; clear remainder high byte
STA Root ; clear Root
LDX #$08 ; 8 pairs of bits to do
SQROOTL1:
ASL Root ; Root = Root * 2
ASL Numberl ; shift highest bit of number ..
ROL Numberh ;
ROL Reml ; .. into remainder
ROL Remh ;
ASL Numberl ; shift highest bit of number ..
ROL Numberh ;
ROL Reml ; .. into remainder
ROL Remh ;
LDA Root ; copy Root ..
STA templ ; .. to templ
LDA #$00 ; clear byte
STA temph ; clear temp high byte
SEC ; +1
ROL templ ; temp = temp * 2 + 1
ROL temph ;
LDA Remh ; get remainder high byte
CMP temph ; comapre with partial high byte
BCC SQROOTNX ; skip sub if remainder high byte smaller
BNE SQROOTSB ; do sub if <> (must be remainder>partial !)
LDA Reml ; get remainder low byte
CMP templ ; comapre with partial low byte
BCC SQROOTNX ; skip sub if remainder low byte smaller
; else remainder>=partial so subtract then
; and add 1 to root. carry is always set here
SQROOTSB:
LDA Reml ; get remainder low byte
SBC templ ; subtract partial low byte
STA Reml ; save remainder low byte
LDA Remh ; get remainder high byte
SBC temph ; subtract partial high byte
STA Remh ; save remainder high byte
INC Root ; increment Root
SQROOTNX:
DEX ; decrement bit pair count
BNE SQROOTL1 ; loop if not all done
RTS
|
QueryParser/src/main/antlr/QueryParser.g4
|
samuylov/CodeSamples
| 0 |
3752
|
parser grammar QueryParser;
options {tokenVocab = QueryLexer;}
@header {
import ru.samuylov.queryparser.*;
import ru.samuylov.queryparser.expressions.*;
import ru.samuylov.queryparser.expressions.atomic.*;
import ru.samuylov.queryparser.expressions.combined.*;
import org.apache.commons.lang3.text.translate.LookupTranslator;
import org.apache.commons.lang3.StringUtils;
}
@parser::members {
private static final LookupTranslator exactTranslator =
new LookupTranslator(new String[][] { {"\\\\", "\\"},
{"\\\"", "\""},
});
private static final LookupTranslator termTranslator =
new LookupTranslator(new String[][] { {"\\(", "("},
{"\\)", ")"},
{"\\{", "{"},
{"\\}", "}"},
{"\\|", "|"},
{"\\\"", "\""},
{"\\:", ":"},
{"\\?", "?"},
{"\\*", "*"},
{"\\~", "~"},
{"\\\\", "\\"},
{"\\<", "<"},
{"\\>", ">"},
{"\\^", "^"}
});
private static String unescapeExact(CharSequence input)
{
return exactTranslator.translate( input );
}
private static String unescapeTerm(String input)
{
//в обычных выражениях допустимо искейпить операторы только в начале
if(input.startsWith("\\+") || input.startsWith("\\-"))
input = input.substring(1,input.length());
return termTranslator.translate( input );
}
private String cutFirstLastSymbols(String text)
{
return text.substring(1,text.length()-1);
}
}
query returns [ List<IQueryItem> items ]
@init { $items = new ArrayList<>();}
:
(queryItem {$items.add( $queryItem.value );})+
;
queryItem returns [IQueryItem value]
@init
{
QueryOperator operator = QueryOperator.None;
int operatorOffset = -1;
}
:
(operatorPrefix
{
operator = $operatorPrefix.value;
operatorOffset = $operatorPrefix.start.getStartIndex();
}
)?
queryExpression {$value = new QueryItem($queryExpression.value, operator,operatorOffset );}
;
queryExpression returns [AbstractQueryExpression value]
@init
{
List<IQueryExpression> synonymExpressions = new ArrayList<>();
}
:
(
firstExpression = expression_WithoutSynonym
(SYNONYM expression_WithoutSynonym { synonymExpressions.add($expression_WithoutSynonym.value);} )*
)
{
if(synonymExpressions.isEmpty())
{
//синонимов нет проставляем певому выражению данные об операторе
$value = $firstExpression.value;
} else {
// найдено перечисление синонимов.
List<IQueryExpression> expressions = new ArrayList<>();
expressions.add($firstExpression.value);
expressions.addAll(synonymExpressions);
$value = new SynonymExpression(expressions, $firstExpression.start.getStartIndex());
}
}
;
expression_WithoutSynonym returns [AbstractQueryExpression value]
@init { List<IQueryExpression> groupExpressions = new ArrayList<>();}
:
exactMatchExpression {$value = $exactMatchExpression.value; }
| WildcardExpression {$value = new WildcardExpression($WildcardExpression.text, $WildcardExpression.getStartIndex() ); }
| term {$value = new TermExpression($term.value, $term.start.getStartIndex() ); }
| fuzzyTerm {$value = $fuzzyTerm.expression; }
| (
LPAREN
(queryExpression {groupExpressions.add($queryExpression.value);} )+
RPAREN
){ $value = new GroupingExpression(groupExpressions, $LPAREN.getStartIndex());}
;
operatorPrefix returns [QueryOperator value]
:
PLUS {$value = QueryOperator.Must;}
| MINUS {$value = QueryOperator.MustNot;}
;
exactMatchExpression returns [ExactMatchExpression value]
:
ExactMatchExpression {$value = new ExactMatchExpression(
unescapeExact(cutFirstLastSymbols($ExactMatchExpression.text)),
$ExactMatchExpression.getStartIndex()); }
;
term returns [String value]
:
Identifier {$value = unescapeTerm($Identifier.text);}
;
fuzzyTerm returns [FuzzyTermExpression expression]
@init
{
String text = null;
int textStart = -1;
}
:
TILDE
Identifier
{
text = unescapeTerm($Identifier.text);
textStart = $Identifier.getStartIndex();
$expression = new FuzzyTermExpression(unescapeTerm($Identifier.text), $Identifier.getStartIndex() );
}
;
|
MSDOS/Virus.MSDOS.Unknown.gv.asm
|
fengjixuchui/Family
| 3 |
160653
|
xor cx,cx
mov dx,offset File
mov ah,4eh
int 21h
z:
mov dx,9eh
mov ax,3d02h
int 21h
mov bx,ax
mov dx,100h
mov cl,27h
mov ah,40h
int 21h
mov ah,3eh
int 21h
mov ah,4fh
int 21h
jnc z
ret
file db '*.com',0
e:
|
tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/based_numbers.ads
|
ouankou/rose
| 488 |
8424
|
package Based_Numbers is
TWO_HUNDRED_FIFTY_FIVE_0 : constant := 255;
TWO_HUNDRED_FIFTY_FIVE_1 : constant := 2#1111_1111#;
TWO_HUNDRED_FIFTY_FIVE_2 : constant := 16#FF#;
TWO_HUNDRED_FIFTY_FIVE_3 : constant := 016#0FF#;
TWO_HUNDRED_TWENTY_FOUR_0 : constant := 224;
TWO_HUNDRED_TWENTY_FOUR_1 : constant := 16#E#E1;
TWO_HUNDRED_TWENTY_FOUR_2 : constant := 2#1110_0000#;
F4095_0_0 : constant := 4095.0;
F4095_0_1 : constant := 16#F.FF#E+2;
F4095_0_2 : constant := 2#1.1111_1111_1110#E11;
end Based_Numbers;
|
Transynther/x86/_processed/NC/_st_zr_4k_sm_/i7-7700_9_0x48.log_1900_1631.asm
|
ljhsiun2/medusa
| 9 |
174519
|
<reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xb261, %rsi
lea addresses_WT_ht+0x111e1, %rdi
clflush (%rsi)
nop
nop
nop
dec %r14
mov $53, %rcx
rep movsb
nop
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_UC_ht+0x1e726, %rdi
nop
nop
nop
nop
and %r15, %r15
vmovups (%rdi), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %rbp
nop
nop
add %rdi, %rdi
lea addresses_A_ht+0x10261, %rcx
nop
nop
nop
nop
and $20310, %rbx
mov (%rcx), %edi
and %rsi, %rsi
lea addresses_D_ht+0x108a1, %rdi
clflush (%rdi)
nop
nop
dec %rcx
mov (%rdi), %r15d
nop
add $31791, %r14
lea addresses_normal_ht+0x11861, %r15
clflush (%r15)
nop
nop
nop
add %rdi, %rdi
movw $0x6162, (%r15)
and $48964, %r15
lea addresses_WT_ht+0x17911, %r14
nop
nop
nop
sub $40259, %r15
movb (%r14), %bl
add %rdi, %rdi
lea addresses_normal_ht+0x1427, %rdi
nop
sub %rbp, %rbp
mov $0x6162636465666768, %r15
movq %r15, %xmm6
movups %xmm6, (%rdi)
nop
nop
cmp %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %r9
push %rax
push %rcx
push %rsi
// Store
lea addresses_WC+0x10be1, %rax
clflush (%rax)
nop
nop
xor $53603, %r14
mov $0x5152535455565758, %r13
movq %r13, (%rax)
nop
add %rcx, %rcx
// Store
lea addresses_normal+0x11a3d, %rsi
nop
nop
nop
nop
nop
sub %r12, %r12
mov $0x5152535455565758, %rax
movq %rax, %xmm1
movups %xmm1, (%rsi)
nop
nop
nop
sub %r12, %r12
// Load
lea addresses_RW+0x11be1, %r9
nop
nop
nop
add $37242, %r12
movups (%r9), %xmm2
vpextrq $1, %xmm2, %r14
nop
nop
nop
nop
dec %r13
// Store
mov $0x72fb7400000003e1, %rcx
nop
nop
nop
nop
cmp %r9, %r9
mov $0x5152535455565758, %r14
movq %r14, %xmm7
vmovups %ymm7, (%rcx)
add $60242, %r14
// Store
lea addresses_normal+0xff61, %r12
nop
nop
nop
nop
sub $2262, %r9
movb $0x51, (%r12)
nop
nop
nop
nop
nop
cmp %rax, %rax
// Load
mov $0xb61, %rcx
nop
nop
nop
nop
nop
sub %rsi, %rsi
mov (%rcx), %rax
nop
nop
nop
nop
nop
sub %rcx, %rcx
// Store
lea addresses_normal+0x12be1, %rcx
nop
nop
nop
nop
nop
add $22483, %r9
movw $0x5152, (%rcx)
nop
sub $32035, %r14
// Faulty Load
mov $0x72fb7400000003e1, %rax
nop
and %r9, %r9
mov (%rax), %si
lea oracles, %r14
and $0xff, %rsi
shlq $12, %rsi
mov (%r14,%rsi,1), %rsi
pop %rsi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 7, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 5, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 11, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 6, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 6, 'size': 4, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 7, 'size': 2, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}}
{'58': 1725, '00': 175}
58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 00 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 00 58 58 58 58 58 58 00 58 00 58 58 58 58 58 58 58 58 58 58 00 00 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 00 58 58 58 58 00 58 58 58 00 58 58 58 00 58 58 00 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 00 58 58 58 58 00 00 00 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 00 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 00 00 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 00 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 00 58 58 58 58 00 00 58 58 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 58 58 58 00 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 00 58 58 58 58 58 58 00 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 00 58 58 00 58 58 00 00 58 58 58 58 58 00 00 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 00 58 58 58 00 58 00 00 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 00 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 00 00 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58
*/
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_982.asm
|
ljhsiun2/medusa
| 9 |
247202
|
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xe063, %rsi
lea addresses_D_ht+0x1b317, %rdi
clflush (%rsi)
nop
nop
nop
and $38662, %r8
mov $94, %rcx
rep movsw
nop
nop
nop
and %rdx, %rdx
lea addresses_UC_ht+0xa963, %r14
nop
nop
nop
nop
nop
and %r13, %r13
movb (%r14), %cl
nop
nop
and %r13, %r13
lea addresses_UC_ht+0xd063, %rsi
lea addresses_WT_ht+0x14763, %rdi
clflush (%rdi)
dec %r9
mov $20, %rcx
rep movsw
nop
nop
nop
nop
nop
cmp $24466, %r13
lea addresses_D_ht+0x99e3, %r13
nop
nop
nop
nop
nop
sub $42704, %r9
vmovups (%r13), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %rdi
nop
nop
nop
add $48845, %r8
lea addresses_A_ht+0x1d8ab, %rsi
lea addresses_WC_ht+0xcd63, %rdi
cmp $48109, %r14
mov $12, %rcx
rep movsb
nop
nop
dec %r13
lea addresses_WT_ht+0x5963, %rsi
lea addresses_D_ht+0x245d, %rdi
nop
nop
nop
xor $3503, %r9
mov $102, %rcx
rep movsq
nop
nop
nop
nop
add %r13, %r13
lea addresses_A_ht+0x19ac3, %rsi
lea addresses_UC_ht+0x1cd63, %rdi
nop
nop
nop
nop
xor $52713, %r8
mov $27, %rcx
rep movsb
nop
nop
xor $24722, %r14
lea addresses_UC_ht+0x14cb, %rcx
nop
nop
cmp $1498, %r14
movw $0x6162, (%rcx)
nop
nop
nop
nop
sub $49757, %r8
lea addresses_WC_ht+0x1f8f, %rdi
nop
nop
nop
nop
nop
add $48394, %rsi
mov $0x6162636465666768, %r8
movq %r8, %xmm1
movups %xmm1, (%rdi)
xor $29832, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r14
push %r9
push %rcx
// Faulty Load
lea addresses_UC+0x13163, %r9
nop
nop
nop
nop
sub $25008, %rcx
movups (%r9), %xmm1
vpextrq $0, %xmm1, %r13
lea oracles, %r10
and $0xff, %r13
shlq $12, %r13
mov (%r10,%r13,1), %r13
pop %rcx
pop %r9
pop %r14
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 5, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 11}}
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 3}}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}}
{'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 10, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC_ht', 'congruent': 2}, 'OP': 'STOR'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
agda/par-swap/dpg-pot.agda
|
florence/esterel-calculus
| 3 |
4591
|
<gh_stars>1-10
module par-swap.dpg-pot where
open import Data.Empty
open import Data.Product
open import Data.Sum
open import Data.Bool
open import Data.List using ([] ; [_] ; _∷_ ; List ; _++_)
open import Relation.Binary.PropositionalEquality
using (_≡_ ; refl ; sym)
open import Data.Maybe using ()
open import Data.List.Any using (here ; there)
open import Data.List.Any.Properties using ( ++-comm ; ++⁻ ; ++⁺ˡ ; ++⁺ʳ )
open import Data.Nat as Nat using (ℕ)
open import par-swap
open import par-swap.properties
open import Esterel.Lang.CanFunction
open import Esterel.Lang
open import Esterel.Lang.Properties
open import Esterel.Lang.CanFunction.Plug
open import Esterel.Environment as Env
open import Esterel.Context
open import utility
open import sn-calculus
open import context-properties -- get view, E-views
open import sn-calculus-props
open import Esterel.Variable.Signal as Signal
using (Signal ; _ₛ)
open import Esterel.Variable.Shared as SharedVar
using (SharedVar ; _ₛₕ)
open import Esterel.Variable.Sequential as SeqVar
using (SeqVar ; _ᵥ)
open import Esterel.CompletionCode as Code
using () renaming (CompletionCode to Code)
canₛ-par :
∀ r₁ r₂ -> ∀ (θ : Env) (S : ℕ) →
S ∈ Canₛ (r₂ ∥ r₁) θ →
S ∈ Canₛ (r₁ ∥ r₂) θ
canₛ-par r₁ r₂ θ S S∈r₂∥r₁
= ++-comm (proj₁ (Can r₂ θ)) (proj₁ (Can r₁ θ)) S∈r₂∥r₁
canₖ-par :
∀ r₁ r₂ -> ∀ (θ : Env) (k : Code) →
k ∈ Canₖ (r₂ ∥ r₁) θ →
k ∈ Canₖ (r₁ ∥ r₂) θ
canₖ-par
= \ {r₁ r₂ θ S S∈r₂∥r₁ ->
thing S
(proj₁ (proj₂ (Can r₁ θ)))
(proj₁ (proj₂ (Can r₂ θ)))
S∈r₂∥r₁} where
simplify-foldr++-[] : ∀ (l2 : List Code) ->
(Data.List.foldr{A = (List Code)}
_++_
[]
(Data.List.map (λ (k : Code) → []) l2)) ≡ []
simplify-foldr++-[] [] = refl
simplify-foldr++-[] (x ∷ l2) = simplify-foldr++-[] l2
whatevs-left : ∀ S (whatevs : Code -> Code) l1 l2 ->
Data.List.Any.Any (_≡_ S)
(Data.List.foldr _++_ []
(Data.List.map (λ k → Data.List.map (Code._⊔_ k) l2) l1))
->
Data.List.Any.Any (_≡_ S)
(Data.List.foldr _++_ []
(Data.List.map (λ k → (whatevs k) ∷ Data.List.map (Code._⊔_ k) l2) l1))
whatevs-left S whatevs [] l2 ()
whatevs-left S whatevs (x ∷ l1) l2 blob
with ++⁻ (Data.List.map (Code._⊔_ x) l2) blob
... | inj₁ y = there (++⁺ˡ y)
... | inj₂ y
with whatevs-left S whatevs l1 l2 y
... | R = there (++⁺ʳ (Data.List.map (Code._⊔_ x) l2) R)
whatevs-right :
∀ S (whatevs : Code -> List Code) x l1 ->
Data.List.Any.Any (_≡_ S) (Data.List.map (Code._⊔_ x) l1)
->
Data.List.Any.Any (_≡_ S)
(Data.List.foldr _++_ []
(Data.List.map (λ k → (k Code.⊔ x) ∷ whatevs k)
l1))
whatevs-right S whatevs x [] blob = blob
whatevs-right S whatevs x (x₁ ∷ l1) (here px)
rewrite px = here (Code.⊔-comm x x₁)
whatevs-right S whatevs x (x₁ ∷ l1) (there blob)
= there (++⁺ʳ (whatevs x₁) (whatevs-right S whatevs x l1 blob))
thing : ∀ S l1 l2 ->
Data.List.Any.Any (_≡_ S)
(Data.List.foldr _++_ []
(Data.List.map
(λ k → Data.List.map (Code._⊔_ k) l1)
l2))
->
Data.List.Any.Any (_≡_ S)
(Data.List.foldr _++_ []
(Data.List.map
(λ k → Data.List.map (Code._⊔_ k) l2)
l1))
thing S l1 [] blob
rewrite simplify-foldr++-[] l1
= blob
thing S l1 (x ∷ l2) blob
with ++⁻ (Data.List.map (Code._⊔_ x) l1) blob
thing S l1 (x ∷ l2) _ | inj₁ y =
whatevs-right S (λ { k → Data.List.map (Code._⊔_ k) l2 }) x l1 y
thing S l1 (x ∷ l2) _ | inj₂ y =
whatevs-left S (\ { k -> (k Code.⊔ x)}) l1 l2 (thing S l1 l2 y)
canₛₕ-par :
∀ r₁ r₂ -> ∀ (θ : Env) →
Canₛₕ (r₂ ∥ r₁) θ ⊆¹ Canₛₕ (r₁ ∥ r₂) θ
canₛₕ-par r₁ r₂ θ S S∈r₂∥r₁
= ++-comm (proj₂ (proj₂ (Can r₂ θ))) (proj₂ (proj₂ (Can r₁ θ))) S∈r₂∥r₁
canθₛ-C-par : ∀ sigs S'' -> ∀ {C p r₁ r₂} ->
p ≐ C ⟦ r₁ ∥ r₂ ⟧c ->
∀ {θ} S' ->
S' ∉ Canθₛ sigs S'' p θ ->
S' ∉ Canθₛ sigs S'' (C ⟦ r₂ ∥ r₁ ⟧c) θ
canθₛ-C-par sigs S'' {C} {p} {r₁} {r₂} pC {θ} S' S'∉Canθₛ[p] S'∈Canθₛ[C⟦r₂∥r₁⟧c]
with canθₛ-plug S'' sigs C (r₁ ∥ r₂) (r₂ ∥ r₁)
(canₛ-par r₁ r₂) (canₖ-par r₁ r₂) θ S'
... | r₂r₁->r₁r₂ rewrite sym (unplugc pC) = S'∉Canθₛ[p] (r₂r₁->r₁r₂ S'∈Canθₛ[C⟦r₂∥r₁⟧c])
canθₛₕ-C-par : ∀ sigs S' -> ∀ {C p r₁ r₂} ->
p ≐ C ⟦ r₁ ∥ r₂ ⟧c ->
∀ {θ} s' ->
s' ∉ Canθₛₕ sigs S' p θ ->
s' ∉ Canθₛₕ sigs S' (C ⟦ r₂ ∥ r₁ ⟧c) θ
canθₛₕ-C-par sigs S' {C} {p} {r₁} {r₂} pC {θ} s' s'∉Canθₛₕ[p] s'∈Canθₛₕ[C⟦r₂∥r₁⟧c]
with canθₛₕ-plug S' sigs C (r₁ ∥ r₂) (r₂ ∥ r₁)
(canₛₕ-par r₁ r₂) (canₖ-par r₁ r₂) (canₛ-par r₁ r₂) θ s'
... | r₂r₁->r₁r₂ rewrite sym (unplugc pC) = s'∉Canθₛₕ[p] (r₂r₁->r₁r₂ s'∈Canθₛₕ[C⟦r₂∥r₁⟧c])
DPG-pot-view :
∀ {C r₁ r₂ p q θ θ' A A'} ->
p ≐ C ⟦ r₁ ∥ r₂ ⟧c ->
(psn⟶₁q : ρ⟨ θ , A ⟩· p sn⟶₁ ρ⟨ θ' , A' ⟩· q) ->
(p≡q : p ≡ q) ->
(A≡A' : A ≡ A') ->
->pot-view psn⟶₁q p≡q A≡A' ->
Σ[ dd′ ∈ Term × Term ]
(ρ⟨ θ , A ⟩· C ⟦ r₂ ∥ r₁ ⟧c sn⟶ (proj₂ dd′))
×
((proj₂ dd′) sn⟶* (proj₁ dd′))
×
((ρ⟨ θ' , A' ⟩· q) ∥R* (proj₁ dd′))
DPG-pot-view pC (ris-present S∈ x x₁) p≡q A≡A' ()
DPG-pot-view pC (ris-absent S∈ x x₁) p≡q A≡A' ()
DPG-pot-view pC (remit S∈ ¬S≡a x) p≡q A≡A' ()
DPG-pot-view pC (rraise-shared e' x) p≡q A≡A' ()
DPG-pot-view pC (rset-shared-value-old e' s∈ x x₁) p≡q A≡A' ()
DPG-pot-view pC (rset-shared-value-new e' s∈ x x₁) p≡q A≡A' ()
DPG-pot-view pC (rraise-var e' x₁) p≡q A≡A' ()
DPG-pot-view pC (rset-var x∈ e' x₁) p≡q A≡A' ()
DPG-pot-view pC (rif-false x∈ x₁ x₂) p≡q A≡A' ()
DPG-pot-view pC (rif-true x∈ x₁ x₂) p≡q A≡A' ()
DPG-pot-view pC (rabsence{θ}{_}{S} S∈ x x₁) .refl .refl (vabsence .S .S∈ .x .x₁)
= _ , rcontext [] dchole
(rabsence{θ}{_}{S} S∈ x (canθₛ-C-par (sig θ) 0 pC (Signal.unwrap S) x₁)) ,
rrefl ,
Context1-∥R* (cenv _ _) (∥Rn (∥Rstep pC) ∥R0)
DPG-pot-view pC (rreadyness{θ}{_}{s} s∈ x x₁) .refl .refl (vreadyness .s .s∈ .x .x₁)
= _ , rcontext [] dchole
(rreadyness{s = s} s∈ x (canθₛₕ-C-par (sig θ) 0 pC (SharedVar.unwrap s) x₁)) ,
rrefl ,
Context1-∥R* (cenv _ _) (∥Rn (∥Rstep pC) ∥R0)
DPG-pot-view pC (rmerge x) p≡q A≡A' ()
|
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/mak.lzh/mak/kart-ppu-j.asm
|
prismotizm/gigaleak
| 0 |
105188
|
Name: kart-ppu-j.asm
Type: file
Size: 21805
Last-Modified: '1992-08-06T07:17:26Z'
SHA-1: F8D5CDE0B6E06303DB14FBF6173C6EBE13120584
Description: null
|
src/kernel/arch/x86_64/gdt.asm
|
Abb1x/tisix
| 13 |
96279
|
<reponame>Abb1x/tisix
bits 64
global gdt_update
gdt_update:
lgdt [rdi]
mov ax, 0x10
mov ss, ax
mov ds, ax
mov es, ax
pop rdi
mov rax, 0x8
push rax
push rdi
retfq
global tss_update
tss_update:
mov ax, 0x28
ltr ax
ret
|
test/Fail/Issue4986a.agda
|
cruhland/agda
| 1,989 |
2442
|
<filename>test/Fail/Issue4986a.agda
postulate
A : Set
open import Agda.Builtin.Equality
foo : (f : A → A → A) (@0 g : @0 A → @0 A → A)
→ @0 _≡_ {A = @0 A → @0 A → A} g (\ x y → f y x)
→ @0 A → @0 A → A
foo f g refl = g
-- In the goal, `C-c C-n g` gives
-- λ (@0 x) (@0 y) → f y x
-- which is only well-typed in an erased context.
bad : (f : A → A → A) → @0 A → @0 A → A
bad f = foo f (\ x y → f y x) refl
|
experiments/test-suite/mutation-based/10/7/ctree.als
|
kaiyuanw/AlloyFLCore
| 1 |
2058
|
<filename>experiments/test-suite/mutation-based/10/7/ctree.als
pred test20 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1, Node2: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1 + Node2
neighbors = Node0->Node1 + Node0->Node2 + Node1->Node0 + Node1->Node2 + Node2->Node0 + Node2->Node1
color = Node0->Blue0 + Node1->Blue0 + Node2->Red0
}}}}
}
run test20 for 3 expect 0
pred test18 {
some disj Red0: Red {some disj Blue0: Blue {some disj Red0, Blue0: Color {some disj Node0, Node1, Node2: Node {
Red = Red0
Blue = Blue0
Color = Red0 + Blue0
Node = Node0 + Node1 + Node2
neighbors = Node0->Node1 + Node0->Node2 + Node1->Node0 + Node1->Node2 + Node2->Node0 + Node2->Node1
color = Node0->Blue0 + Node1->Red0 + Node2->Red0
}}}}
}
run test18 for 3 expect 0
|
s3d/music-original/VVZ1.asm
|
Cancer52/flamedriver
| 9 |
246808
|
Snd_VVZ1_Header:
smpsHeaderStartSong 3
smpsHeaderVoice Snd_VVZ1_Voices
smpsHeaderChan $06, $03
smpsHeaderTempo $01, $1D
smpsHeaderDAC Snd_VVZ1_DAC
smpsHeaderFM Snd_VVZ1_FM1, $00, $18
smpsHeaderFM Snd_VVZ1_FM2, $0C, $0F
smpsHeaderFM Snd_VVZ1_FM3, $F4, $10
smpsHeaderFM Snd_VVZ1_FM4, $F4, $10
smpsHeaderFM Snd_VVZ1_FM5, $00, $1C
smpsHeaderPSG Snd_VVZ1_PSG1, $E8, $02, $00, $00
smpsHeaderPSG Snd_VVZ1_PSG2, $E8, $04, $00, $00
smpsHeaderPSG Snd_VVZ1_PSG3, $23, $02, $00, $00
; FM1 Data
Snd_VVZ1_FM1:
smpsModSet $0C, $01, $09, $07
Snd_VVZ1_Jump00:
smpsPan panCenter, $00
smpsSetvoice $01
dc.b nRst, $30
Snd_VVZ1_Jump03:
dc.b nRst, $60, nRst, nRst, nRst
Snd_VVZ1_Loop06:
smpsCall Snd_VVZ1_Call0A
dc.b nG3, $24, nF3, nEb3, $18, smpsNoAttack, $0C, nF3, $18, nEb3, nBb2, nB2
dc.b $0C
smpsCall Snd_VVZ1_Call0A
dc.b nG3, $24, nC4, $3C, smpsNoAttack, $60
smpsLoop $00, $02, Snd_VVZ1_Loop06
Snd_VVZ1_Loop07:
dc.b nAb4, $24, nF4, $18, nBb4, $0C, nAb4, nG4
smpsLoop $00, $05, Snd_VVZ1_Loop07
dc.b nAb4, $24, nG4, $18, nAb4, $0C, nG4, $18, nAb4, $60, smpsNoAttack, nF4
Snd_VVZ1_Loop08:
dc.b nAb4, $24, nF4, $18, nBb4, $0C, nAb4, nG4
smpsLoop $00, $05, Snd_VVZ1_Loop08
dc.b nAb4, $24, nG4, nEb4, $18, nF4, $60, smpsNoAttack, nF4
smpsJump Snd_VVZ1_Jump03
Snd_VVZ1_Call0A:
dc.b nC3, $24, nF3, nC4, $18, smpsNoAttack, $0C, nBb3, $18, nAb3, nG3, $0C
dc.b nF3, nAb3
smpsReturn
; FM2 Data
Snd_VVZ1_FM2:
smpsPan panCenter, $00
smpsModSet $01, $01, $01, $02
smpsSetvoice $00
smpsPan panCenter, $00
smpsModSet $07, $01, $03, $05
dc.b nRst, $30
Snd_VVZ1_Loop04:
smpsCall Snd_VVZ1_Call07
smpsLoop $00, $05, Snd_VVZ1_Loop04
smpsCall Snd_VVZ1_Call08
smpsCall Snd_VVZ1_Call09
smpsCall Snd_VVZ1_Call08
dc.b nAb2, nAb3, nG2, $0C, nAb2, nG2, $06, nG3, nFs2, $0C, nG2, nAb2
dc.b $06, nG2, nD2, nEb2, nF2, nF3, nE2, $0C, nF2, nF2, $06, nF3
dc.b nEb2, $0C, nEb3, nD2, $06, nEb2, nEb2, nEb3
smpsCall Snd_VVZ1_Call08
smpsCall Snd_VVZ1_Call09
smpsCall Snd_VVZ1_Call08
Snd_VVZ1_Loop05:
dc.b nF1, nF2, nF1, $0C, nF1, nF1, $06, nF2, nF1, $0C, nF1, nF1
dc.b $06, nF2, nF1, nF2
smpsLoop $00, $02, Snd_VVZ1_Loop05
smpsJump Snd_VVZ1_Loop04
Snd_VVZ1_Call07:
dc.b nF2, $0C, nC2, nEb2, nC2, $06, nF2, $0C, $06, nC2, $0C, nEb2
dc.b nC2, nF2, nC2, nEb2, $06, nE2, $0C, nF2, nF2, $06, nC2, $0C
dc.b nF2, nE2, nEb2, nBb1, nCs2, nD2, $06, nEb2, $0C, $06, nBb1, $0C
dc.b nCs2, nD2, nEb2, nBb1, nCs2, $06, nD2, $0C, nEb2, nEb2, $06, nBb1
dc.b $0C, nEb2, nE2
smpsReturn
Snd_VVZ1_Call08:
dc.b nCs2, $06, nCs3, nC2, $0C, nCs2, nCs2, $06, nCs3, nC2, $0C, nCs2
dc.b nCs2, $06, nCs3, nCs2, nD2, nEb2, nEb3, nD2, $0C, nEb2, nEb2, $06
dc.b nEb3, nD2, $0C, nEb2, nEb2, $06, nEb3, nEb2, nCs2
smpsReturn
Snd_VVZ1_Call09:
dc.b nC2, nC3, nB1, $0C, nC2, nC2, $06, nC3, nB1, $0C, nC2, nC2
dc.b $06, nB1, nC2, nEb2, nCs2, nCs3, nC2, $0C, nCs2, nCs2, $06, nCs3
dc.b nC2, $0C, nCs2, nCs2, $06, nAb1, nB1, nC2
smpsReturn
; FM3 Data
Snd_VVZ1_FM3:
smpsPan panRight, $00
smpsSetvoice $02
smpsAlterPitch $FB
smpsModSet $01, $01, $0A, $B7
dc.b nC3, $30
smpsAlterPitch $05
Snd_VVZ1_Jump02:
smpsSetvoice $02
smpsModSet $01, $01, $02, $06
dc.b nF3, $60, smpsNoAttack, $30
smpsModSet $01, $01, $0A, $B7
smpsAlterPitch $FB
dc.b nC3
smpsAlterPitch $05
smpsModSet $01, $01, $02, $06
dc.b nEb3, $60, smpsNoAttack, $30
smpsAlterPitch $FB
smpsModSet $01, $01, $0C, $BF
dc.b nC3, $30
smpsAlterPitch $05
Snd_VVZ1_Loop03:
smpsModSet $01, $01, $02, $06
dc.b nF3, $60, smpsNoAttack, $30
smpsAlterPitch $FB
smpsModSet $01, $01, $0C, $BF
dc.b nC3
smpsAlterPitch $05
smpsModSet $01, $01, $02, $06
dc.b nEb3, $60, smpsNoAttack, $30
smpsAlterPitch $FB
smpsModSet $01, $01, $0C, $BF
dc.b nC3
smpsAlterPitch $05
smpsLoop $00, $04, Snd_VVZ1_Loop03
smpsAlterPitch $F4
smpsFMAlterVol $03
smpsSetvoice $03
smpsModSet $01, $01, $02, $06
dc.b nAb5, $0C, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nBb5, nBb5, nBb5
dc.b nBb5, nBb5, nBb5, nBb5, nBb5, nG5, nG5, nG5, nG5, nG5, nG5, nG5
dc.b nG5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5
dc.b nAb5, nAb5, nAb5, nAb5, nAb5, nBb5, nBb5, nBb5, nBb5, nBb5, nBb5, nBb5
dc.b nBb5, nC6, nC6, nC6, nBb5, nBb5, nBb5, nBb5, nBb5, nAb5, nAb5, nAb5
dc.b nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5
dc.b nAb5, nBb5, nBb5, nBb5, nBb5, nBb5, nBb5, nBb5, nBb5, nG5, nG5, nG5
dc.b nG5, nG5, nG5, nG5, nG5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5
dc.b nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nBb5, nBb5, nBb5
dc.b nBb5, nBb5, nBb5, nBb5, nBb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5
dc.b nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5, nAb5
smpsFMAlterVol $FD
smpsAlterPitch $0C
smpsJump Snd_VVZ1_Jump02
; FM4 Data
Snd_VVZ1_FM4:
smpsPan panLeft, $00
smpsModSet $01, $01, $01, $05
smpsSetvoice $02
smpsAlterPitch $FB
smpsModSet $01, $01, $08, $B7
dc.b nG2, $30
smpsAlterPitch $05
Snd_VVZ1_Jump01:
smpsSetvoice $02
smpsModSet $01, $01, $02, $06
dc.b nC3, $60, smpsNoAttack, $30
smpsModSet $01, $01, $08, $B7
smpsAlterPitch $FB
dc.b nG2
smpsAlterPitch $05
smpsModSet $01, $01, $02, $06
dc.b nBb2, $60, smpsNoAttack, $30
smpsAlterPitch $FB
smpsModSet $01, $01, $08, $BF
dc.b nG2, $30
smpsAlterPitch $05
Snd_VVZ1_Loop02:
smpsModSet $01, $01, $02, $06
dc.b nC3, $60, smpsNoAttack, $30
smpsAlterPitch $FB
smpsModSet $01, $01, $08, $BF
dc.b nG2
smpsModSet $01, $01, $02, $06
smpsAlterPitch $05
dc.b nBb2, $60, smpsNoAttack, $30
smpsAlterPitch $FB
smpsModSet $01, $01, $08, $BF
dc.b nBb2
smpsAlterPitch $05
smpsModSet $01, $01, $02, $06
smpsLoop $00, $04, Snd_VVZ1_Loop02
smpsAlterPitch $F4
smpsFMAlterVol $03
smpsSetvoice $03
smpsModSet $01, $01, $02, $06
dc.b nCs5, $0C, nCs5, nCs5, nCs5, nCs5, nCs5, nCs5, nCs5, nEb5, nEb5, nEb5
dc.b nEb5, nEb5, nEb5, nEb5, nEb5, nC5, nC5, nC5, nEb5, nEb5, nEb5, nEb5
dc.b nEb5, nF5, nF5, nF5, nCs5, nCs5, nCs5, nCs5, nCs5, nCs5, nCs5, nCs5
dc.b nCs5, nCs5, nCs5, nCs5, nCs5, nEb5, nEb5, nEb5, nEb5, nEb5, nEb5, nEb5
dc.b nEb5, nAb5, nAb5, nAb5, nG5, nG5, nG5, nG5, nG5, nF5, nF5, nF5
dc.b nC5, nC5, nC5, nC5, nC5, nCs5, nCs5, nCs5, nCs5, nCs5, nCs5, nCs5
dc.b nCs5, nEb5, nEb5, nEb5, nEb5, nEb5, nEb5, nEb5, nEb5, nC5, nC5, nC5
dc.b nEb5, nEb5, nEb5, nEb5, nEb5, nF5, nF5, nF5, nCs5, nCs5, nCs5, nCs5
dc.b nCs5, nCs5, nCs5, nCs5, nCs5, nCs5, nCs5, nCs5, nCs5, nEb5, nEb5, nBb5
dc.b nBb5, nBb5, nBb5, nBb5, nBb5, nF5, nF5, nF5, nC5, nC5, nC5, nC5
dc.b nC5, nF5, nF5, nF5, nC5, nC5, nC5, nC5, nC5
smpsFMAlterVol $FD
smpsAlterPitch $0C
smpsJump Snd_VVZ1_Jump01
; FM5 Data
Snd_VVZ1_FM5:
smpsModSet $01, $01, $01, $08
dc.b nRst, $0B
smpsAlterNote $01
smpsJump Snd_VVZ1_Jump00
; Unreachable
smpsStop
; PSG1 Data
Snd_VVZ1_PSG1:
smpsModSet $01, $01, $01, $04
smpsPSGvoice sTone_11
smpsAlterPitch $FB
smpsModSet $01, $01, $F9, $A7
dc.b nC3, $30
smpsAlterPitch $05
Snd_VVZ1_Jump04:
smpsPSGvoice sTone_11
smpsModSet $0F, $01, $01, $06
dc.b nF3, $60, smpsNoAttack, $30
smpsModSet $01, $01, $FB, $A7
smpsAlterPitch $F7
dc.b nC3
smpsAlterPitch $09
smpsModSet $0F, $01, $01, $06
dc.b nEb3, $60, smpsNoAttack, $30
smpsAlterPitch $FB
smpsModSet $01, $01, $F9, $A7
dc.b nC3, $30
smpsAlterPitch $05
Snd_VVZ1_Loop0B:
smpsPSGvoice sTone_11
smpsModSet $0F, $01, $01, $06
dc.b nF3, $60, smpsNoAttack, $30
smpsAlterPitch $F7
smpsModSet $01, $01, $FB, $A7
dc.b nC3
smpsAlterPitch $09
smpsModSet $0F, $01, $01, $06
dc.b nEb3, $60, smpsNoAttack, $30
smpsAlterPitch $FB
smpsModSet $01, $01, $F9, $A7
dc.b nC3
smpsAlterPitch $05
smpsModSet $0F, $01, $01, $06
dc.b nF3, $60, smpsNoAttack, $30
smpsAlterPitch $F7
smpsModSet $01, $01, $FB, $A7
dc.b nC3
smpsAlterPitch $09
smpsModSet $0F, $01, $01, $06
dc.b nEb3, $6C
smpsAlterPitch $0C
smpsPSGvoice sTone_26
dc.b nG4, $18, nC5, $3C
smpsAlterPitch $F4
smpsLoop $00, $02, Snd_VVZ1_Loop0B
smpsAlterPitch $0C
smpsPSGvoice sTone_26
smpsModSet $0F, $01, $01, $06
dc.b nAb3, $0C, nC4, nF4, nC4, nF4, nAb4, nC5, nAb4, nBb4, nG4, nEb4
dc.b nG4, nEb4, nBb3, nG3, nBb3, nG3, nEb4, nG4, nBb3, nEb4, nG4, nAb4
dc.b nBb4, nAb4, nF4, nCs4, nF4, nCs4, nAb3, nC4, nCs4, nAb3, nCs4, nF4
dc.b nCs4, nF4, nAb4, nCs5, nAb4, nBb4, nG4, nEb4, nG4, nEb4, nBb3, nEb4
dc.b nE4, nF4, nEb4, nG4, nBb3, nEb4, nG4, nAb4, nBb4, nAb4, nF4, nCs4
dc.b nF4, nCs4, nAb3, nC4, nCs4, nAb3, nCs4, nF4, nCs4, nF4, nAb4, nCs5
dc.b nAb4, nBb4, nG4, nEb4, nG4, nEb4, nBb3, nG3, nBb3, nG3, nBb3, nEb4
dc.b nBb3, nEb4, nG4, nAb4, nBb4, nAb4, nF4, nCs4, nF4, nCs4, nAb3, nC4
dc.b nCs4, nAb3, nCs4, nF4, nCs4, nF4, nAb4, nCs5, nAb4, nBb4, nG4, nEb4
dc.b nG4, nEb4, nBb3, nEb4, nE4, nF4, nEb4, nC4, nAb4, nF4, nEb4, nG4
dc.b nEb4, nF4, nEb4, nC4, nAb4, nF4, nEb4, nG4, nEb4
smpsAlterPitch $F4
smpsJump Snd_VVZ1_Jump04
; PSG2 Data
Snd_VVZ1_PSG2:
smpsAlterNote $FE
dc.b nRst, $0D, nRst, $30
smpsJump Snd_VVZ1_Jump04
; PSG3 Data
Snd_VVZ1_PSG3:
smpsPSGform $E7
dc.b nRst, $30
Snd_VVZ1_Loop09:
smpsCall Snd_VVZ1_Call0B
smpsLoop $00, $14, Snd_VVZ1_Loop09
Snd_VVZ1_Loop0A:
smpsCall Snd_VVZ1_Call0C
smpsLoop $00, $10, Snd_VVZ1_Loop0A
smpsJump Snd_VVZ1_Loop09
Snd_VVZ1_Call0B:
smpsPSGvoice sTone_0F
dc.b (nMaxPSG2-$23)&$FF, $06, $06, $06, $06
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b (nMaxPSG2-$23)&$FF, $06, $06, $06, $06
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b (nMaxPSG2-$23)&$FF, $06, $06
smpsPSGvoice sTone_12
dc.b $0C
smpsReturn
Snd_VVZ1_Call0C:
smpsPSGvoice sTone_0F
dc.b (nMaxPSG2-$23)&$FF, $06, $06
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b (nMaxPSG2-$23)&$FF, $06, $06, $06, $06
smpsPSGvoice sTone_12
dc.b $0C
smpsPSGvoice sTone_0F
dc.b (nMaxPSG2-$23)&$FF, $06, $06, $06, $06
smpsPSGvoice sTone_12
dc.b $0C
smpsReturn
; DAC Data
Snd_VVZ1_DAC:
dc.b nRst, $30
Snd_VVZ1_Loop00:
smpsCall Snd_VVZ1_Call00
smpsCall Snd_VVZ1_Call01
smpsCall Snd_VVZ1_Call00
smpsCall Snd_VVZ1_Call02
smpsLoop $00, $05, Snd_VVZ1_Loop00
Snd_VVZ1_Loop01:
smpsCall Snd_VVZ1_Call03
smpsCall Snd_VVZ1_Call04
smpsCall Snd_VVZ1_Call03
smpsCall Snd_VVZ1_Call05
smpsCall Snd_VVZ1_Call03
smpsCall Snd_VVZ1_Call04
smpsCall Snd_VVZ1_Call06
smpsLoop $00, $02, Snd_VVZ1_Loop01
smpsJump Snd_VVZ1_Loop00
Snd_VVZ1_Call00:
dc.b dElectricHighTom, $06, dElectricMidTom, dElectricLowTom, $0C, dElectricLowTom, dElectricMidTom, $06, dElectricLowTom, dElectricFloorTom, $0C, dElectricFloorTom
dc.b dKickS3, $06, dKickS3, dKickS3, dSnareS3
smpsReturn
Snd_VVZ1_Call01:
dc.b dElectricHighTom, dElectricMidTom, dElectricLowTom, $0C, dElectricLowTom, dElectricMidTom, $06, dElectricLowTom, dElectricFloorTom, $0C, dElectricFloorTom, dSnareS3
dc.b $06, dSnareS3, $0C, $06
smpsReturn
Snd_VVZ1_Call02:
dc.b dElectricHighTom, dElectricMidTom, dElectricLowTom, $0C, dElectricLowTom, dElectricMidTom, $06, dElectricLowTom, dElectricFloorTom, $0C, dElectricFloorTom, dSnareS3
dc.b $06, dSnareS3, dSnareS3, dSnareS3
smpsReturn
Snd_VVZ1_Call03:
dc.b dKickS3, $06, dKickS3, dKickS3, dKickS3, dKickS3, $0C, dSnareS3, $06, $0C, dSnareS3, dSnareS3
dc.b $06
smpsReturn
Snd_VVZ1_Call04:
dc.b dElectricHighTom, $06, dElectricMidTom, dElectricLowTom, $0C
smpsReturn
Snd_VVZ1_Call05:
dc.b dElectricMidTom, $06, dElectricLowTom, dElectricFloorTom, $0C
smpsReturn
Snd_VVZ1_Call06:
dc.b dKickS3, $06, dKickS3, dKickS3, dKickS3, dKickS3, $0C, dElectricHighTom, $06, dElectricMidTom, $0C, dElectricLowTom
dc.b dElectricFloorTom, $06, dSnareS3, dSnareS3, dSnareS3, dSnareS3, dKickS3, dKickS3, dSnareS3, $0C, dKickS3, dKickS3
dc.b $06, dSnareS3, $0C, dSnareS3, dSnareS3, $06, dElectricHighTom, $04, dElectricHighTom, dElectricHighTom, dElectricMidTom, $06
dc.b dElectricLowTom, dKickS3, dKickS3, dSnareS3, $0C, dKickS3, dSnareS3, $06, $0C, dSnareS3, dSnareS3, $06
dc.b dElectricMidTom, $04, dElectricMidTom, dElectricMidTom, dElectricLowTom, $06, dElectricFloorTom, dKickS3, dKickS3, dKickS3, dKickS3, dKickS3
dc.b $0C, dSnareS3, $06, $0C, dSnareS3, dSnareS3, $06, dElectricHighTom, $04, dElectricMidTom, dElectricLowTom, dElectricFloorTom
dc.b $06, dElectricFloorTom, dSnareS3, $04, dSnareS3, dSnareS3, dElectricHighTom, $06, dElectricHighTom, dElectricMidTom, dElectricLowTom, dSnareS3
dc.b $04, dSnareS3, dSnareS3, dElectricMidTom, $06, dElectricMidTom, dElectricLowTom, dElectricFloorTom, dSnareS3, $0C, $06, dSnareS3
smpsReturn
Snd_VVZ1_Voices:
; Voice $00
; $08
; $0A, $70, $30, $00, $1F, $1F, $5F, $5F, $12, $0E, $0A, $0A
; $00, $04, $04, $03, $2F, $2F, $2F, $2F, $24, $2D, $13, $80
smpsVcAlgorithm $00
smpsVcFeedback $01
smpsVcUnusedBits $00
smpsVcDetune $00, $03, $07, $00
smpsVcCoarseFreq $00, $00, $00, $0A
smpsVcRateScale $01, $01, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $0A, $0A, $0E, $12
smpsVcDecayRate2 $03, $04, $04, $00
smpsVcDecayLevel $02, $02, $02, $02
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $13, $2D, $24
; Voice $01
; $3D
; $06, $21, $51, $06, $12, $14, $14, $0F, $0A, $06, $06, $06
; $00, $00, $00, $00, $2B, $2B, $2B, $1B, $19, $80, $80, $80
smpsVcAlgorithm $05
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $05, $02, $00
smpsVcCoarseFreq $06, $01, $01, $06
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $0F, $14, $14, $12
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $06, $06, $06, $0A
smpsVcDecayRate2 $00, $00, $00, $00
smpsVcDecayLevel $01, $02, $02, $02
smpsVcReleaseRate $0B, $0B, $0B, $0B
smpsVcTotalLevel $00, $00, $00, $19
; Voice $02
; $3E
; $07, $01, $02, $0A, $1F, $1F, $1F, $1F, $03, $06, $00, $00
; $08, $06, $07, $0C, $15, $0A, $0A, $0A, $20, $85, $86, $88
smpsVcAlgorithm $06
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $00, $00, $00
smpsVcCoarseFreq $0A, $02, $01, $07
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $00, $00, $06, $03
smpsVcDecayRate2 $0C, $07, $06, $08
smpsVcDecayLevel $00, $00, $00, $01
smpsVcReleaseRate $0A, $0A, $0A, $05
smpsVcTotalLevel $08, $06, $05, $20
; Voice $03
; $16
; $7A, $74, $3C, $31, $1F, $1F, $1F, $1F, $0A, $08, $0C, $0A
; $07, $0A, $07, $05, $2F, $AF, $AF, $5F, $14, $85, $8A, $80
smpsVcAlgorithm $06
smpsVcFeedback $02
smpsVcUnusedBits $00
smpsVcDetune $03, $03, $07, $07
smpsVcCoarseFreq $01, $0C, $04, $0A
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $0A, $0C, $08, $0A
smpsVcDecayRate2 $05, $07, $0A, $07
smpsVcDecayLevel $05, $0A, $0A, $02
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $0A, $05, $14
; Unused voice
; Voice $04
; $3C
; $71, $71, $11, $11, $17, $1E, $19, $1E, $04, $01, $07, $01
; $00, $00, $00, $00, $F7, $F8, $F7, $F8, $1E, $80, $14, $80
smpsVcAlgorithm $04
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $01, $01, $07, $07
smpsVcCoarseFreq $01, $01, $01, $01
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1E, $19, $1E, $17
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $01, $07, $01, $04
smpsVcDecayRate2 $00, $00, $00, $00
smpsVcDecayLevel $0F, $0F, $0F, $0F
smpsVcReleaseRate $08, $07, $08, $07
smpsVcTotalLevel $00, $14, $00, $1E
; Unused voice
; Voice $05
; $3A
; $01, $07, $01, $01, $8E, $8E, $8D, $53, $0E, $0E, $0E, $03
; $00, $00, $00, $07, $1F, $FF, $1F, $0F, $18, $28, $27, $80
smpsVcAlgorithm $02
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $00, $00, $00
smpsVcCoarseFreq $01, $01, $07, $01
smpsVcRateScale $01, $02, $02, $02
smpsVcAttackRate $13, $0D, $0E, $0E
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $03, $0E, $0E, $0E
smpsVcDecayRate2 $07, $00, $00, $00
smpsVcDecayLevel $00, $01, $0F, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $27, $28, $18
; Unused voice
; Voice $06
; $3A
; $06, $06, $06, $06, $8E, $8E, $8D, $53, $0E, $0E, $0E, $03
; $00, $00, $00, $06, $1F, $FF, $1F, $0F, $17, $28, $27, $80
smpsVcAlgorithm $02
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $00, $00, $00
smpsVcCoarseFreq $06, $06, $06, $06
smpsVcRateScale $01, $02, $02, $02
smpsVcAttackRate $13, $0D, $0E, $0E
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $03, $0E, $0E, $0E
smpsVcDecayRate2 $06, $00, $00, $00
smpsVcDecayLevel $00, $01, $0F, $01
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $27, $28, $17
; Unused voice
; Voice $07
; $35
; $06, $06, $13, $00, $1F, $1D, $18, $19, $00, $09, $06, $0D
; $00, $00, $02, $03, $00, $06, $15, $16, $1E, $80, $83, $80
smpsVcAlgorithm $05
smpsVcFeedback $06
smpsVcUnusedBits $00
smpsVcDetune $00, $01, $00, $00
smpsVcCoarseFreq $00, $03, $06, $06
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $19, $18, $1D, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $0D, $06, $09, $00
smpsVcDecayRate2 $03, $02, $00, $00
smpsVcDecayLevel $01, $01, $00, $00
smpsVcReleaseRate $06, $05, $06, $00
smpsVcTotalLevel $00, $03, $00, $1E
; Unused voice
; Voice $08
; $3D
; $01, $21, $50, $01, $12, $14, $14, $0F, $0A, $05, $05, $05
; $00, $00, $00, $00, $26, $28, $28, $18, $19, $80, $80, $80
smpsVcAlgorithm $05
smpsVcFeedback $07
smpsVcUnusedBits $00
smpsVcDetune $00, $05, $02, $00
smpsVcCoarseFreq $01, $00, $01, $01
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $0F, $14, $14, $12
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $05, $05, $05, $0A
smpsVcDecayRate2 $00, $00, $00, $00
smpsVcDecayLevel $01, $02, $02, $02
smpsVcReleaseRate $08, $08, $08, $06
smpsVcTotalLevel $00, $00, $00, $19
; Unused voice
; Voice $09
; $04
; $57, $02, $70, $50, $1F, $1F, $1F, $1F, $00, $00, $00, $00
; $06, $0A, $00, $0A, $00, $0F, $00, $0F, $1A, $80, $10, $80
smpsVcAlgorithm $04
smpsVcFeedback $00
smpsVcUnusedBits $00
smpsVcDetune $05, $07, $00, $05
smpsVcCoarseFreq $00, $00, $02, $07
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1F, $1F, $1F, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $00, $00, $00, $00
smpsVcDecayRate2 $0A, $00, $0A, $06
smpsVcDecayLevel $00, $00, $00, $00
smpsVcReleaseRate $0F, $00, $0F, $00
smpsVcTotalLevel $00, $10, $00, $1A
|
dataToTestOn/asm/4/prog03.asm
|
Epacik/8051-ASM-Plugin
| 1 |
246133
|
<filename>dataToTestOn/asm/4/prog03.asm
LJMP START
ORG 100H
START:
CALL LCD_CLR
KLAWISZ:
CALL WAIT_KEY
RRC A
CPL C
MOV P1.7, C
SJMP KLAWISZ
|
oeis/276/A276868.asm
|
neoneye/loda-programs
| 11 |
83619
|
; A276868: First differences of the Beatty sequence A276855 for 3 + tau, where tau = golden ratio = (1 + sqrt(5))/2.
; Submitted by <NAME>
; 4,5,4,5,5,4,5,4,5,5,4,5,5,4,5,4,5,5,4,5,4,5,5,4,5,5,4,5,4,5,5,4,5,5,4,5,4,5,5,4,5,4,5,5,4,5,5,4,5,4,5,5,4,5,4,5,5,4,5,5,4,5,4,5,5,4,5,5,4,5,4,5,5,4,5,4,5,5,4,5,5,4,5,4,5,5,4,5,5,4,5,4,5,5,4,5,4,5,5,4
mov $2,$0
trn $0,1
seq $0,5614 ; The binary complement of the infinite Fibonacci word A003849. Start with 1, apply 0->1, 1->10, iterate, take limit.
add $0,3
min $2,1
add $0,$2
|
02-bootsector-print/bl_print_function.asm
|
sreejithnt/os
| 0 |
10054
|
<gh_stars>0
;
; A simple boot sector that prints message to the screen using bios routine
;
[org 0x7c00] ; tell the assembler where this code should be loaded to
mov ah, 0x0e
mov bx, HELLO_MSG
call print_string
call print_nl
mov bx, GOODBYE_MSG
call print_string
call print_nl
mov dx, 0x12AF
call print_hex
jmp $ ; jump to current address (infinite loop)
%include 'print_string.asm'
%include 'print_hex.asm'
HELLO_MSG:
db 'Hello, World', 0 ; 0 is the ending marker, helps the function identify when to stop printing
GOODBYE_MSG:
db 'Good Bye', 0
;
; padding the magic number
;
times 510-($-$$) db 0
dw 0xaa55 ; last two bytes for magic number
; so that BIOS knows we are a boot sector
|
oeis/021/A021583.asm
|
neoneye/loda-programs
| 11 |
171085
|
<gh_stars>10-100
; A021583: Decimal expansion of 1/579.
; Submitted by Jon Maiga
; 0,0,1,7,2,7,1,1,5,7,1,6,7,5,3,0,2,2,4,5,2,5,0,4,3,1,7,7,8,9,2,9,1,8,8,2,5,5,6,1,3,1,2,6,0,7,9,4,4,7,3,2,2,9,7,0,6,3,9,0,3,2,8,1,5,1,9,8,6,1,8,3,0,7,4,2,6,5,9,7,5,8,2,0,3,7,9,9,6,5,4,5,7,6,8,5,6,6,4
add $0,1
mov $2,10
pow $2,$0
div $2,579
mov $0,$2
mod $0,10
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.