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 |
|---|---|---|---|---|
src/wiki-attributes.adb | jquorning/ada-wiki | 18 | 26968 | <reponame>jquorning/ada-wiki
-----------------------------------------------------------------------
-- wiki-attributes -- Wiki document attributes
-- Copyright (C) 2015, 2016 <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.
-----------------------------------------------------------------------
package body Wiki.Attributes is
-- ------------------------------
-- Get the attribute name.
-- ------------------------------
function Get_Name (Position : in Cursor) return String is
Attr : constant Attribute_Ref := Attribute_Vectors.Element (Position.Pos);
begin
return Attr.Value.Name;
end Get_Name;
-- ------------------------------
-- Get the attribute value.
-- ------------------------------
function Get_Value (Position : in Cursor) return String is
Attr : constant Attribute_Ref := Attribute_Vectors.Element (Position.Pos);
begin
return Wiki.Strings.To_String (Attr.Value.Value);
end Get_Value;
-- ------------------------------
-- Get the attribute wide value.
-- ------------------------------
function Get_Wide_Value (Position : in Cursor) return Wiki.Strings.WString is
Attr : constant Attribute_Ref := Attribute_Vectors.Element (Position.Pos);
begin
return Attr.Value.Value;
end Get_Wide_Value;
-- ------------------------------
-- Returns True if the cursor has a valid attribute.
-- ------------------------------
function Has_Element (Position : in Cursor) return Boolean is
begin
return Attribute_Vectors.Has_Element (Position.Pos);
end Has_Element;
-- ------------------------------
-- Move the cursor to the next attribute.
-- ------------------------------
procedure Next (Position : in out Cursor) is
begin
Attribute_Vectors.Next (Position.Pos);
end Next;
-- ------------------------------
-- Find the attribute with the given name.
-- ------------------------------
function Find (List : in Attribute_List;
Name : in String) return Cursor is
Iter : Attribute_Vectors.Cursor := List.List.First;
begin
while Attribute_Vectors.Has_Element (Iter) loop
declare
Attr : constant Attribute_Ref := Attribute_Vectors.Element (Iter);
begin
if Attr.Value.Name = Name then
return Cursor '(Pos => Iter);
end if;
end;
Attribute_Vectors.Next (Iter);
end loop;
return Cursor '(Pos => Iter);
end Find;
-- ------------------------------
-- Find the attribute with the given name and return its value.
-- ------------------------------
function Get_Attribute (List : in Attribute_List;
Name : in String) return Wiki.Strings.WString is
Attr : constant Cursor := Find (List, Name);
begin
if Has_Element (Attr) then
return Get_Wide_Value (Attr);
else
return "";
end if;
end Get_Attribute;
-- ------------------------------
-- Append the attribute to the attribute list.
-- ------------------------------
procedure Append (List : in out Attribute_List;
Name : in Wiki.Strings.WString;
Value : in Wiki.Strings.WString) is
Attr : constant Attribute_Access
:= new Attribute '(Util.Refs.Ref_Entity with
Name_Length => Name'Length,
Value_Length => Value'Length,
Name => Wiki.Strings.To_String (Name),
Value => Value);
begin
List.List.Append (Attribute_Refs.Create (Attr));
end Append;
-- ------------------------------
-- Append the attribute to the attribute list.
-- ------------------------------
procedure Append (List : in out Attribute_List;
Name : in String;
Value : in Wiki.Strings.WString) is
Attr : constant Attribute_Access
:= new Attribute '(Util.Refs.Ref_Entity with
Name_Length => Name'Length,
Value_Length => Value'Length,
Name => Name,
Value => Value);
begin
List.List.Append (Attribute_Refs.Create (Attr));
end Append;
-- ------------------------------
-- Append the attribute to the attribute list.
-- ------------------------------
procedure Append (List : in out Attribute_List;
Name : in String;
Value : in Wiki.Strings.UString) is
Val : constant Wiki.Strings.WString := Wiki.Strings.To_WString (Value);
Attr : constant Attribute_Access
:= new Attribute '(Util.Refs.Ref_Entity with
Name_Length => Name'Length,
Value_Length => Val'Length,
Name => Name,
Value => Val);
begin
List.List.Append (Attribute_Refs.Create (Attr));
end Append;
-- ------------------------------
-- Get the cursor to get access to the first attribute.
-- ------------------------------
function First (List : in Attribute_List) return Cursor is
begin
return Cursor '(Pos => List.List.First);
end First;
-- ------------------------------
-- Get the number of attributes in the list.
-- ------------------------------
function Length (List : in Attribute_List) return Natural is
begin
return Natural (List.List.Length);
end Length;
-- ------------------------------
-- Clear the list and remove all existing attributes.
-- ------------------------------
procedure Clear (List : in out Attribute_List) is
begin
List.List.Clear;
end Clear;
-- ------------------------------
-- Iterate over the list attributes and call the <tt>Process</tt> procedure.
-- ------------------------------
procedure Iterate (List : in Attribute_List;
Process : not null access procedure (Name : in String;
Value : in Wiki.Strings.WString)) is
Iter : Attribute_Vectors.Cursor := List.List.First;
Item : Attribute_Ref;
begin
while Attribute_Vectors.Has_Element (Iter) loop
Item := Attribute_Vectors.Element (Iter);
Process (Item.Value.Name, Item.Value.Value);
Attribute_Vectors.Next (Iter);
end loop;
end Iterate;
-- ------------------------------
-- Finalize the attribute list releasing any storage.
-- ------------------------------
overriding
procedure Finalize (List : in out Attribute_List) is
begin
List.Clear;
end Finalize;
end Wiki.Attributes;
|
compilers_visualization_backend/src/main/java/hmb/antlr4/CmmLexer.g4 | hengxin/compilers-visualization | 0 | 3295 | lexer grammar CmmLexer;
Whitespace
: [ \t]+
-> channel(HIDDEN)
;
Newline
: ( '\r' '\n'?
| '\n'
)
-> channel(HIDDEN)
;
BlockComment
: '/*' .*? '*/'
-> skip
;
LineComment
: '//' ~[\r\n]*
-> skip
;
WHILE : 'while';
IF : 'if';
ELSE : 'else';
RETURN : 'return';
STRUCT : 'struct';
TYPE : 'int' | 'float';
LP : '(';
RP : ')';
LB : '[';
RB : ']';
LC : '{';
RC : '}';
RELOP : '<' | '<=' | '>' | '>=' | '==' | '!=';
PLUS : '+';
MINUS : '-';
STAR : '*';
DIV : '/';
NOT : '!';
AND : '&&'; // &
OR : '||'; // |
SEMI : ';';
COMMA : ',';
ASSIGNOP : '=';
DOT : '.';
ID : Nondigit (Nondigit | Digit)*;
INT : Int8 | Int10 | Int16;
FLOAT : Science | Real;
fragment
Nondigit
: [a-zA-Z_]
;
fragment
Digit
: [0-9]
;
fragment
NonZeroDigit
: [1-9]
;
fragment
Int10
: NonZeroDigit Digit*
;
fragment
Int8
: '0' ([0-7])*
;
fragment
Int16
: '0' ('x'|'X') ([a-fA-F] | Digit)+ // should be '+' but not '*'
;
fragment
Real
: Digit+ DOT Digit+
;
fragment
Science
: ((Digit* DOT Digit+)|(Digit+ DOT Digit*)) ('e'|'E') (('+'|'-')?) Digit+
//: (Digit* DOT Digit*) ('e'|'E') (('+'|'-')?) Digit+
; |
private/ntos/rtl/i386/movemem.asm | King0987654/windows2000 | 11 | 176163 | title "User Mode Zero and Move Memory functions"
;++
;
; Copyright (c) 1989 Microsoft Corporation
;
; Module Name:
;
; movemem.asm
;
; Abstract:
;
; This module implements functions to zero and copy blocks of memory
;
;
; Author:
;
; <NAME> (stevewo) 25-May-1990
;
; Environment:
;
; User mode only.
;
; Revision History:
;
;--
.386p
.xlist
include ks386.inc
include callconv.inc ; calling convention macros
.list
if DBG
_DATA SEGMENT DWORD PUBLIC 'DATA'
public _RtlpZeroCount
public _RtlpZeroBytes
_RtlpZeroCount dd 0
_RtlpZeroBytes dd 0
ifndef BLDR_KERNEL_RUNTIME
_MsgUnalignedPtr db 'RTL: RtlCompare/FillMemoryUlong called with unaligned pointer (%x)\n',0
_MsgUnalignedCount db 'RTL: RtlCompare/FillMemoryUlong called with unaligned count (%x)\n',0
endif
_DATA ENDS
ifndef BLDR_KERNEL_RUNTIME
ifdef NTOS_KERNEL_RUNTIME
extrn _KdDebuggerEnabled:BYTE
endif
EXTRNP _DbgBreakPoint,0
extrn _DbgPrint:near
endif
endif
;
; Alignment parameters for zeroing and moving memory.
;
ZERO_MEMORY_ALIGNMENT = 4
ZERO_MEMORY_ALIGNMENT_LOG2 = 2
ZERO_MEMORY_ALIGNMENT_MASK = ZERO_MEMORY_ALIGNMENT - 1
MEMORY_ALIGNMENT = 4
MEMORY_ALIGNMENT_LOG2 = 2
MEMORY_ALIGNMENT_MASK = MEMORY_ALIGNMENT - 1
;
; Alignment for functions in this module
;
CODE_ALIGNMENT macro
align 16
endm
_TEXT$00 SEGMENT PARA PUBLIC 'CODE'
ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING
page , 132
subttl "RtlCompareMemory"
;++
;
; ULONG
; RtlCompareMemory (
; IN PVOID Source1,
; IN PVOID Source2,
; IN ULONG Length
; )
;
; Routine Description:
;
; This function compares two blocks of memory and returns the number
; of bytes that compared equal.
;
; Arguments:
;
; Source1 (esp+4) - Supplies a pointer to the first block of memory to
; compare.
;
; Source2 (esp+8) - Supplies a pointer to the second block of memory to
; compare.
;
; Length (esp+12) - Supplies the Length, in bytes, of the memory to be
; compared.
;
; Return Value:
;
; The number of bytes that compared equal is returned as the function
; value. If all bytes compared equal, then the length of the orginal
; block of memory is returned.
;
;--
RcmSource1 equ [esp+12]
RcmSource2 equ [esp+16]
RcmLength equ [esp+20]
CODE_ALIGNMENT
cPublicProc _RtlCompareMemory,3
cPublicFpo 3,0
push esi ; save registers
push edi ;
cld ; clear direction
mov esi,RcmSource1 ; (esi) -> first block to compare
mov edi,RcmSource2 ; (edi) -> second block to compare
;
; Compare dwords, if any.
;
rcm10: mov ecx,RcmLength ; (ecx) = length in bytes
shr ecx,2 ; (ecx) = length in dwords
jz rcm20 ; no dwords, try bytes
repe cmpsd ; compare dwords
jnz rcm40 ; mismatch, go find byte
;
; Compare residual bytes, if any.
;
rcm20: mov ecx,RcmLength ; (ecx) = length in bytes
and ecx,3 ; (ecx) = length mod 4
jz rcm30 ; 0 odd bytes, go do dwords
repe cmpsb ; compare odd bytes
jnz rcm50 ; mismatch, go report how far we got
;
; All bytes in the block match.
;
rcm30: mov eax,RcmLength ; set number of matching bytes
pop edi ; restore registers
pop esi ;
stdRET _RtlCompareMemory
;
; When we come to rcm40, esi (and edi) points to the dword after the
; one which caused the mismatch. Back up 1 dword and find the byte.
; Since we know the dword didn't match, we can assume one byte won't.
;
rcm40: sub esi,4 ; back up
sub edi,4 ; back up
mov ecx,5 ; ensure that ecx doesn't count out
repe cmpsb ; find mismatch byte
;
; When we come to rcm50, esi points to the byte after the one that
; did not match, which is TWO after the last byte that did match.
;
rcm50: dec esi ; back up
sub esi,RcmSource1 ; compute bytes that matched
mov eax,esi ;
pop edi ; restore registers
pop esi ;
stdRET _RtlCompareMemory
stdENDP _RtlCompareMemory
subttl "RtlCompareMemory"
EcmlSource equ [esp + 4 + 4]
EcmlLength equ [esp + 4 + 8]
EcmlPattern equ [esp + 4 + 12]
; end of arguments
CODE_ALIGNMENT
cPublicProc _RtlCompareMemoryUlong ,3
;
; Save the non-volatile registers that we will use, without the benefit of
; a frame pointer. No exception handling in this routine.
;
push edi
;
; Setup the registers for using REP STOS instruction to zero memory.
;
; edi -> memory to zero
; ecx = number of 32-bit words to zero
; edx = number of extra 8-bit bytes to zero at the end (0 - 3)
; eax = value to store in destination
; direction flag is clear for auto-increment
;
mov edi,EcmlSource
if DBG
ifndef BLDR_KERNEL_RUNTIME
test edi,3
jz @F
push edi
push offset FLAT:_MsgUnalignedPtr
call _DbgPrint
add esp, 2 * 4
ifdef NTOS_KERNEL_RUNTIME
cmp _KdDebuggerEnabled,0
else
mov eax,fs:[PcTeb]
mov eax,[eax].TebPeb
cmp byte ptr [eax].PebBeingDebugged,0
endif
je @F
call _DbgBreakPoint@0
@@:
endif
endif
mov ecx,EcmlLength
mov eax,EcmlPattern
shr ecx,ZERO_MEMORY_ALIGNMENT_LOG2
;
; If number of 32-bit words to compare is non-zero, then do it.
;
repe scasd
je @F
sub edi,4
@@:
sub edi,EcmlSource
mov eax,edi
pop edi
stdRET _RtlCompareMemoryUlong
stdENDP _RtlCompareMemoryUlong
subttl "RtlFillMemory"
;++
;
; VOID
; RtlFillMemory (
; IN PVOID Destination,
; IN ULONG Length,
; IN UCHAR Fill
; )
;
; Routine Description:
;
; This function fills memory with a byte value.
;
; Arguments:
;
; Destination - Supplies a pointer to the memory to zero.
;
; Length - Supplies the Length, in bytes, of the memory to be zeroed.
;
; Fill - Supplies the byte value to fill memory with.
;
; Return Value:
;
; None.
;
;--
; definitions for arguments
; (TOS) = Return address
EfmDestination equ [esp + 4 + 4]
EfmLength equ [esp + 4 + 8]
EfmFill equ byte ptr [esp + 4 + 12]
; end of arguments
CODE_ALIGNMENT
cPublicProc _RtlFillMemory ,3
cPublicFpo 3,1
;
; Save the non-volatile registers that we will use, without the benefit of
; a frame pointer. No exception handling in this routine.
;
push edi
;
; Setup the registers for using REP STOS instruction to zero memory.
;
; edi -> memory to zero
; ecx = number of 32-bit words to zero
; edx = number of extra 8-bit bytes to zero at the end (0 - 3)
; eax = value to store in destination
; direction flag is clear for auto-increment
;
mov edi,EfmDestination
mov ecx,EfmLength
mov al,EfmFill
mov ah,al
shl eax,16
mov al,EfmFill
mov ah,al
cld
mov edx,ecx
and edx,ZERO_MEMORY_ALIGNMENT_MASK
shr ecx,ZERO_MEMORY_ALIGNMENT_LOG2
;
; If number of 32-bit words to zero is non-zero, then do it.
;
rep stosd
;
; If number of extra 8-bit bytes to zero is non-zero, then do it. In either
; case restore non-volatile registers and return.
;
or ecx,edx
jnz @F
pop edi
stdRET _RtlFillMemory
@@:
rep stosb
pop edi
stdRET _RtlFillMemory
stdENDP _RtlFillMemory
subttl "RtlFillMemory"
;++
;
; VOID
; RtlFillMemoryUlonglong (
; IN PVOID Destination,
; IN ULONG Length,
; IN ULONG Fill
; )
;
; Routine Description:
;
; This function fills memory with a 64-bit value. The Destination pointer
; must be aligned on an 8 byte boundary and the low order two bits of the
; Length parameter are ignored.
;
; Arguments:
;
; Destination - Supplies a pointer to the memory to zero.
;
; Length - Supplies the Length, in bytes, of the memory to be zeroed.
;
; Fill - Supplies the 64-bit value to fill memory with.
;
; Return Value:
;
; None.
;
;--
; definitions for arguments
; (TOS) = Return address
EfmlDestination equ [esp + 0ch]
EfmlLength equ [esp + 10h]
EfmlFillLow equ [esp + 14h]
EfmlFillHigh equ [esp + 18h]
; end of arguments
CODE_ALIGNMENT
cPublicProc _RtlFillMemoryUlonglong ,4
cPublicFpo 4,1
;
; Save the non-volatile registers that we will use, without the benefit of
; a frame pointer. No exception handling in this routine.
;
push esi
push edi
;
; Setup the registers for using REP MOVSD instruction to zero memory.
;
; edi -> memory to fill
; esi -> first 8 byte chunk of the memory destination to fill
; ecx = number of 32-bit words to zero
; eax = value to store in destination
; direction flag is clear for auto-increment
;
mov ecx,EfmlLength ; # of bytes
mov esi,EfmlDestination ; Destination pointer
if DBG
ifndef BLDR_KERNEL_RUNTIME
test ecx,7
jz @F
push ecx
push offset FLAT:_MsgUnalignedPtr
call _DbgPrint
add esp, 2 * 4
mov ecx,EfmlLength ; # of bytes
ifdef NTOS_KERNEL_RUNTIME
cmp _KdDebuggerEnabled,0
else
mov eax,fs:[PcTeb]
mov eax,[eax].TebPeb
cmp byte ptr [eax].PebBeingDebugged,0
endif
je @F
call _DbgBreakPoint@0
@@:
test esi,3
jz @F
push esi
push offset FLAT:_MsgUnalignedPtr
call _DbgPrint
add esp, 2 * 4
ifdef NTOS_KERNEL_RUNTIME
cmp _KdDebuggerEnabled,0
else
mov eax,fs:[PcTeb]
mov eax,[eax].TebPeb
cmp byte ptr [eax].PebBeingDebugged,0
endif
je @F
call _DbgBreakPoint@0
@@:
endif
endif
mov eax,EfmlFillLow ; get low portion of the fill arg
shr ecx,ZERO_MEMORY_ALIGNMENT_LOG2 ; convert bytes to dwords
sub ecx,2 ; doing the 1st one by hand
mov [esi],eax ; fill 1st highpart
mov eax,EfmlFillHigh ; get high portion of the fill arg
lea edi,[esi+08] ; initialize the dest pointer
mov [esi+04],eax ; fill 1st lowpart
rep movsd ; ripple the rest
pop edi
pop esi
stdRET _RtlFillMemoryUlonglong
stdENDP _RtlFillMemoryUlonglong
subttl "RtlZeroMemory"
;++
;
; VOID
; RtlFillMemoryUlong (
; IN PVOID Destination,
; IN ULONG Length,
; IN ULONG Fill
; )
;
; Routine Description:
;
; This function fills memory with a 32-bit value. The Destination pointer
; must be aligned on a 4 byte boundary and the low order two bits of the
; Length parameter are ignored.
;
; Arguments:
;
; Destination - Supplies a pointer to the memory to zero.
;
; Length - Supplies the Length, in bytes, of the memory to be zeroed.
;
; Fill - Supplies the 32-bit value to fill memory with.
;
; Return Value:
;
; None.
;
;--
; definitions for arguments
; (TOS) = Return address
EfmlDestination equ [esp + 4 + 4]
EfmlLength equ [esp + 4 + 8]
EfmlFill equ [esp + 4 + 12]
; end of arguments
CODE_ALIGNMENT
cPublicProc _RtlFillMemoryUlong ,3
cPublicFpo 3,1
;
; Save the non-volatile registers that we will use, without the benefit of
; a frame pointer. No exception handling in this routine.
;
push edi
;
; Setup the registers for using REP STOS instruction to zero memory.
;
; edi -> memory to zero
; ecx = number of 32-bit words to zero
; edx = number of extra 8-bit bytes to zero at the end (0 - 3)
; eax = value to store in destination
; direction flag is clear for auto-increment
;
mov edi,EfmlDestination
if DBG
ifndef BLDR_KERNEL_RUNTIME
test edi,3
jz @F
push edi
push offset FLAT:_MsgUnalignedPtr
call _DbgPrint
add esp, 2 * 4
ifdef NTOS_KERNEL_RUNTIME
cmp _KdDebuggerEnabled,0
else
mov eax,fs:[PcTeb]
mov eax,[eax].TebPeb
cmp byte ptr [eax].PebBeingDebugged,0
endif
je @F
call _DbgBreakPoint@0
@@:
endif
endif
mov ecx,EfmlLength
mov eax,EfmlFill
shr ecx,ZERO_MEMORY_ALIGNMENT_LOG2
;
; If number of 32-bit words to zero is non-zero, then do it.
;
rep stosd
pop edi
stdRET _RtlFillMemoryUlong
stdENDP _RtlFillMemoryUlong
subttl "RtlZeroMemory"
;++
;
; VOID
; RtlZeroMemory (
; IN PVOID Destination,
; IN ULONG Length
; )
;
; Routine Description:
;
; This function zeros memory.
;
; Arguments:
;
; Destination - Supplies a pointer to the memory to zero.
;
; Length - Supplies the Length, in bytes, of the memory to be zeroed.
;
; Return Value:
;
; None.
;
;--
; definitions for arguments
; (TOS) = Return address
EzmDestination equ [esp + 4 + 4]
EzmLength equ [esp + 4 + 8]
; end of arguments
CODE_ALIGNMENT
cPublicProc _RtlZeroMemory ,2
cPublicFpo 2,1
;
; Save the non-volatile registers that we will use, without the benefit of
; a frame pointer. No exception handling in this routine.
;
push edi
;
; Setup the registers for using REP STOS instruction to zero memory.
;
; edi -> memory to zero
; ecx = number of 32-bit words to zero
; edx = number of extra 8-bit bytes to zero at the end (0 - 3)
; eax = zero (value to store in destination)
; direction flag is clear for auto-increment
;
mov edi,EzmDestination
mov ecx,EzmLength
xor eax,eax
cld
mov edx,ecx
and edx,ZERO_MEMORY_ALIGNMENT_MASK
shr ecx,ZERO_MEMORY_ALIGNMENT_LOG2
;
; If number of 32-bit words to zero is non-zero, then do it.
;
rep stosd
;
; If number of extra 8-bit bytes to zero is non-zero, then do it. In either
; case restore non-volatile registers and return.
;
or ecx,edx
jnz @F
pop edi
stdRET _RtlZeroMemory
@@:
rep stosb
pop edi
stdRET _RtlZeroMemory
stdENDP _RtlZeroMemory
page , 132
subttl "RtlMoveMemory"
;++
;
; VOID
; RtlMoveMemory (
; IN PVOID Destination,
; IN PVOID Source OPTIONAL,
; IN ULONG Length
; )
;
; Routine Description:
;
; This function moves memory either forward or backward, aligned or
; unaligned, in 4-byte blocks, followed by any remaining bytes.
;
; Arguments:
;
; Destination - Supplies a pointer to the destination of the move.
;
; Source - Supplies a pointer to the memory to move.
;
; Length - Supplies the Length, in bytes, of the memory to be moved.
;
; Return Value:
;
; None.
;
;--
; Definitions of arguments
; (TOS) = Return address
EmmDestination equ [esp + 8 + 4]
EmmSource equ [esp + 8 + 8]
EmmLength equ [esp + 8 + 12]
; End of arguments
CODE_ALIGNMENT
cPublicProc _RtlMoveMemory ,3
cPublicFpo 3,2
;
; Save the non-volatile registers that we will use, without the benefit of
; a frame pointer. No exception handling in this routine.
;
push esi
push edi
;
; Setup the registers for using REP MOVS instruction to move memory.
;
; esi -> memory to move (NULL implies the destination will be zeroed)
; edi -> destination of move
; ecx = number of 32-bit words to move
; edx = number of extra 8-bit bytes to move at the end (0 - 3)
; direction flag is clear for auto-increment
;
mov esi,EmmSource
mov edi,EmmDestination
mov ecx,EmmLength
if DBG
inc _RtlpZeroCount
add _RtlpZeroBytes,ecx
endif
cld
cmp esi,edi ; Special case if Source > Destination
jbe overlap
nooverlap:
mov edx,ecx
and edx,MEMORY_ALIGNMENT_MASK
shr ecx,MEMORY_ALIGNMENT_LOG2
;
; If number of 32-bit words to move is non-zero, then do it.
;
rep movsd
;
; If number of extra 8-bit bytes to move is non-zero, then do it. In either
; case restore non-volatile registers and return.
;
or ecx,edx
jnz @F
pop edi
pop esi
stdRET _RtlMoveMemory
@@:
rep movsb
movedone:
pop edi
pop esi
stdRET _RtlMoveMemory
;
; Here to handle special case when Source > Destination and therefore is a
; potential overlapping move. If Source == Destination, then nothing to do.
; Otherwise, increment the Source and Destination pointers by Length and do
; the move backwards, a byte at a time.
;
overlap:
je movedone
mov eax,edi
sub eax,esi
cmp ecx,eax
jbe nooverlap
std
add esi,ecx
add edi,ecx
dec esi
dec edi
rep movsb
cld
jmp short movedone
stdENDP _RtlMoveMemory
_TEXT$00 ends
end
|
libsrc/math/z88math/c/sccz80/ddiv.asm | jpoikela/z88dk | 640 | 8729 | ;
; Z88dk Z88 Maths Library
;
;
; $Id: ddiv.asm,v 1.4 2016-06-22 19:55:06 dom Exp $
SECTION code_fp
PUBLIC ddiv
EXTERN fsetup
EXTERN stkequ
IF FORz88
INCLUDE "target/z88/def/fpp.def"
ELSE
INCLUDE "fpp.def"
ENDIF
.ddiv
call fsetup
IF FORz88
fpp(FP_DIV)
ELSE
ld a,+(FP_DIV)
call FPP
ENDIF
jp stkequ
|
programs/oeis/141/A141958.asm | neoneye/loda | 22 | 15235 | <reponame>neoneye/loda
; A141958: Primes congruent to 16 mod 27.
; 43,97,151,313,367,421,691,853,907,1069,1123,1231,1447,1609,1663,1879,1933,1987,2203,2311,2473,2689,2797,2851,3067,3121,3229,3391,3499,3607,3769,3823,3877,3931,4093,4201,4363,4903,4957,5011,5119,5227,5281,5443,5659,5821,6037,6091,6199,6361,6469,6577,6793,7333,7549,7603,7873,7927,8089,8467,8521,8629,8737,9007,9277,9439,9547,9601,9817,9871,10141,10303,10357,10627,10789,11059,11113,11329,11383,11437,11491,11923,12301,12409,12517,12841,13003,13219,13327,13381,13597,13759,13921,14029,14083,14407,14461,14731,14947,15217
mov $2,$0
add $2,2
pow $2,2
lpb $2
add $1,15
sub $2,1
mov $3,$1
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,12
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
div $1,2
sub $1,22
mul $1,2
add $1,33
mov $0,$1
|
src/Nats/Add/Invert.agda | ice1k/Theorems | 1 | 275 | <reponame>ice1k/Theorems
module Nats.Add.Invert where
open import Equality
open import Nats
open import Nats.Add.Comm
open import Function
------------------------------------------------------------------------
-- internal stuffs
private
lemma′ : ∀ a b → (suc a ≡ suc b) → (a ≡ b)
lemma′ _ _ refl = refl
lemma : ∀ a b → (suc (a + suc a) ≡ suc (b + suc b)) → (a + a ≡ b + b)
lemma a b
rewrite nat-add-comm a $ suc a
| nat-add-comm b $ suc b
= lemma′ (a + a) (b + b) ∘ lemma′ (suc $ a + a) (suc $ b + b)
+-invert : ∀ a b → (a + a ≡ b + b) → a ≡ b
+-invert zero zero ev = refl
+-invert zero (suc b) ()
+-invert (suc a) zero ()
+-invert (suc a) (suc b) = cong suc ∘ +-invert a b ∘ lemma a b
------------------------------------------------------------------------
-- public aliases
nat-add-invert : ∀ a b → (a + a ≡ b + b) → a ≡ b
nat-add-invert = +-invert
nat-add-invert-1 : ∀ a b → (suc a ≡ suc b) → (a ≡ b)
nat-add-invert-1 = lemma′
|
sourcecode/main.asm | lynf/Arduino-GPS-clock | 0 | 9037 | ;
; m328-GPS-clock.asm
;
; Created: 7/16/2016 12:31:18 PM
; Author : lynf
;
;
;######################################################################################
; This software is Copyright by <NAME> and is issued under the following license:
;
; Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
;
;######################################################################################
;
;
; This file is used as a folder for all versions of m328-GPS-clock.asm to
; assemble, link and test the program.
;
; Notes:
; ======
;
; Must have TWI pull-up termination resistors installed else
; interface will not work!
;
.include "m328-GPS-clock(testing).asm"
;
;
.exit
;
|
libsrc/abc80/abc_cursor.asm | jpoikela/z88dk | 640 | 16764 | <reponame>jpoikela/z88dk
;
; ABC80 specific routines
; by <NAME>, Oct 2007
;
; Set cursor shape
;
; void abc_cursor(unsigned char shape);
;
;
; $Id: abc_cursor.asm,v 1.2 2016-06-11 19:38:47 dom Exp $
;
SECTION code_clib
PUBLIC abc_cursor
PUBLIC _abc_cursor
abc_cursor:
_abc_cursor:
ld a,11
out (56),a
ld a,l ; FASTCALL
out (57),a
ret
|
src/ada/src/comms/uxas-comms-transport-zeromq_sender-addr_attr_msg_senders.adb | VVCAS-Sean/OpenUxAS | 88 | 24302 | <filename>src/ada/src/comms/uxas-comms-transport-zeromq_sender-addr_attr_msg_senders.adb<gh_stars>10-100
with UxAS.Common.Configuration_Manager;
package body UxAS.Comms.Transport.ZeroMQ_Sender.Addr_Attr_Msg_Senders is
use ZMQ.Sockets;
------------------
-- Send_Message --
------------------
procedure Send_Message
(This : in out ZeroMq_Addressed_Attributed_Message_Sender;
Address : String;
Content_Type : String;
Descriptor : String;
Payload : String)
is
-- uxas::communications::data::AddressedAttributedMessage message;
Message : Addressed_Attributed_Message;
Success : Boolean;
begin
-- message.setAddressAttributesAndPayload(address, contentType, descriptor, m_sourceGroup,
-- m_entityIdString, m_serviceIdString, std::move(payload));
Message.Set_Address_Attributes_And_Payload
(Address => Address,
Content_Type => Content_Type,
Descriptor => Descriptor,
Source_Group => Value (This.Source_Group),
Source_Entity_Id => Value (This.Entity_Id_String),
Source_Service_Id => Value (This.Service_Id_String),
Payload => Payload,
Result => Success);
if This.Kind = STREAM then
raise Program_Error with "Send_Message is not implemented for Stream";
else -- not a stream socket
if UxAS.Common.Configuration_Manager.Is_ZeroMq_Multipart_Message then
raise Program_Error with "Send_Message is not implemented for multipart messages";
else
if Message.Is_Valid then
This.ZMQ_Socket.Send (Message.Content_String);
end if;
end if;
end if;
end Send_Message;
---------------------------------------
-- Send_Addressed_Attributed_Message --
---------------------------------------
procedure Send_Addressed_Attributed_Message
(This : in out ZeroMq_Addressed_Attributed_Message_Sender;
Message : Addressed_Attributed_Message_Ref)
is
begin
if This.Kind = STREAM then
raise Program_Error with "Send_Addressed_Attributed_Message is not implemented for Stream";
else -- not a stream socket
if UxAS.Common.Configuration_Manager.Is_ZeroMq_Multipart_Message then
raise Program_Error with "Send_Addressed_Attributed_Message is not implemented for multipart messages";
else
if Message.Is_Valid then
This.ZMQ_Socket.Send (Message.Content_String);
end if;
end if;
end if;
end Send_Addressed_Attributed_Message;
end UxAS.Comms.Transport.ZeroMQ_Sender.Addr_Attr_Msg_Senders;
|
model-sets/2021-05-06-10-28-11-watform/rdt_nancy.als | WatForm/catalyst | 0 | 2696 |
open util/steps[Snapshot]
open util/ordering[Snapshot]
open util/boolean
// Snapshot definition
sig Snapshot extends BaseSnapshot {
stable: one Bool,
events: set EventLabel,
}
/***************************** STATE SPACE ************************************/
abstract sig SystemState extends StateLabel {}
abstract sig RDT extends SystemState {}
abstract sig RDT_Sender extends RDT {}
one sig RDT_Sender_ReadySendNext extends RDT_Sender {}
one sig RDT_Sender_WaitAck extends RDT_Sender {}
one sig RDT_Sender_ReadyResend extends RDT_Sender {}
abstract sig RDT_Receiver extends RDT {}
one sig RDT_Receiver_ReadyReceiveNext extends RDT_Receiver {}
one sig RDT_Receiver_ReceiveSuccess extends RDT_Receiver {}
one sig RDT_Receiver_ReceiveError extends RDT_Receiver {}
one sig RDT_Receiver_ReadyReceiveResend extends RDT_Receiver {}
/***************************** EVENTS SPACE ***********************************/
one sig RDT_SendSuccess extends EnvironmentEvent {}
one sig RDT_SendError extends EnvironmentEvent {}
one sig RDT_AckSuccess extends EnvironmentEvent {}
one sig RDT_AckError extends EnvironmentEvent {}
/*************************** TRANSITIONS SPACE ********************************/
one sig RDT_Sender_OnSendSucess_1 extends TransitionLabel {}
one sig RDT_Sender_OnSendSucess_2 extends TransitionLabel {}
one sig RDT_Sender_OnSendSucess_3 extends TransitionLabel {}
one sig RDT_Sender_OnSendError_4 extends TransitionLabel {}
one sig RDT_Sender_OnSendError_5 extends TransitionLabel {}
one sig RDT_Sender_OnSendError_6 extends TransitionLabel {}
one sig RDT_Sender_t_3 extends TransitionLabel {}
one sig RDT_Sender_t_4 extends TransitionLabel {}
one sig RDT_Receiver__7 extends TransitionLabel {}
one sig RDT_Receiver__8 extends TransitionLabel {}
one sig RDT_Receiver__9 extends TransitionLabel {}
one sig RDT_Receiver__10 extends TransitionLabel {}
one sig RDT_Receiver__11 extends TransitionLabel {}
one sig RDT_Receiver__12 extends TransitionLabel {}
one sig RDT_Receiver__13 extends TransitionLabel {}
one sig RDT_Receiver__14 extends TransitionLabel {}
one sig RDT_Receiver_t_13 extends TransitionLabel {}
one sig RDT_Receiver_t_14 extends TransitionLabel {}
one sig RDT_Receiver_t_15 extends TransitionLabel {}
// Transition RDT_Sender_OnSendSucess_1
pred pre_RDT_Sender_OnSendSucess_1[s:Snapshot] {
RDT_Sender_ReadySendNext in s.conf
s.stable = True => {
RDT_SendSuccess in (s.events & EnvironmentEvent)
} else {
RDT_SendSuccess in s.events
}
}
pred pos_RDT_Sender_OnSendSucess_1[s, s':Snapshot] {
s'.conf = s.conf - RDT_Sender_ReadySendNext + {
RDT_Sender_WaitAck
}
testIfNextStable[s, s', {none}, RDT_Sender_OnSendSucess_1] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Sender_OnSendSucess_1[s, s': Snapshot] {
pre_RDT_Sender_OnSendSucess_1[s]
pos_RDT_Sender_OnSendSucess_1[s, s']
semantics_RDT_Sender_OnSendSucess_1[s, s']
}
pred enabledAfterStep_RDT_Sender_OnSendSucess_1[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Sender_ReadySendNext in s.conf
_s.stable = True => {
no t & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_SendSuccess in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_SendSuccess in {_s.events + genEvents}
}
}
pred semantics_RDT_Sender_OnSendSucess_1[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Sender_OnSendSucess_1
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Sender_OnSendSucess_1
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
}
}
// Transition RDT_Sender_OnSendSucess_2
pred pre_RDT_Sender_OnSendSucess_2[s:Snapshot] {
RDT_Sender_WaitAck in s.conf
s.stable = True => {
RDT_SendSuccess in (s.events & EnvironmentEvent)
} else {
RDT_SendSuccess in s.events
}
}
pred pos_RDT_Sender_OnSendSucess_2[s, s':Snapshot] {
s'.conf = s.conf - RDT_Sender_WaitAck + {
RDT_Sender_WaitAck
}
testIfNextStable[s, s', {none}, RDT_Sender_OnSendSucess_2] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Sender_OnSendSucess_2[s, s': Snapshot] {
pre_RDT_Sender_OnSendSucess_2[s]
pos_RDT_Sender_OnSendSucess_2[s, s']
semantics_RDT_Sender_OnSendSucess_2[s, s']
}
pred enabledAfterStep_RDT_Sender_OnSendSucess_2[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Sender_WaitAck in s.conf
_s.stable = True => {
no t & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_SendSuccess in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_SendSuccess in {_s.events + genEvents}
}
}
pred semantics_RDT_Sender_OnSendSucess_2[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Sender_OnSendSucess_2
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Sender_OnSendSucess_2
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
}
}
// Transition RDT_Sender_OnSendSucess_3
pred pre_RDT_Sender_OnSendSucess_3[s:Snapshot] {
RDT_Sender_ReadyResend in s.conf
s.stable = True => {
RDT_SendSuccess in (s.events & EnvironmentEvent)
} else {
RDT_SendSuccess in s.events
}
}
pred pos_RDT_Sender_OnSendSucess_3[s, s':Snapshot] {
s'.conf = s.conf - RDT_Sender_ReadyResend + {
RDT_Sender_WaitAck
}
testIfNextStable[s, s', {none}, RDT_Sender_OnSendSucess_3] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Sender_OnSendSucess_3[s, s': Snapshot] {
pre_RDT_Sender_OnSendSucess_3[s]
pos_RDT_Sender_OnSendSucess_3[s, s']
semantics_RDT_Sender_OnSendSucess_3[s, s']
}
pred enabledAfterStep_RDT_Sender_OnSendSucess_3[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Sender_ReadyResend in s.conf
_s.stable = True => {
no t & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_SendSuccess in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_SendSuccess in {_s.events + genEvents}
}
}
pred semantics_RDT_Sender_OnSendSucess_3[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Sender_OnSendSucess_3
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Sender_OnSendSucess_3
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
}
}
// Transition RDT_Sender_OnSendError_4
pred pre_RDT_Sender_OnSendError_4[s:Snapshot] {
RDT_Sender_ReadySendNext in s.conf
s.stable = True => {
RDT_SendError in (s.events & EnvironmentEvent)
} else {
RDT_SendError in s.events
}
}
pred pos_RDT_Sender_OnSendError_4[s, s':Snapshot] {
s'.conf = s.conf - RDT_Sender_ReadySendNext + {
RDT_Sender_WaitAck
}
testIfNextStable[s, s', {none}, RDT_Sender_OnSendError_4] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Sender_OnSendError_4[s, s': Snapshot] {
pre_RDT_Sender_OnSendError_4[s]
pos_RDT_Sender_OnSendError_4[s, s']
semantics_RDT_Sender_OnSendError_4[s, s']
}
pred enabledAfterStep_RDT_Sender_OnSendError_4[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Sender_ReadySendNext in s.conf
_s.stable = True => {
no t & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_SendError in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_SendError in {_s.events + genEvents}
}
}
pred semantics_RDT_Sender_OnSendError_4[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Sender_OnSendError_4
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Sender_OnSendError_4
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
}
}
// Transition RDT_Sender_OnSendError_5
pred pre_RDT_Sender_OnSendError_5[s:Snapshot] {
RDT_Sender_WaitAck in s.conf
s.stable = True => {
RDT_SendError in (s.events & EnvironmentEvent)
} else {
RDT_SendError in s.events
}
}
pred pos_RDT_Sender_OnSendError_5[s, s':Snapshot] {
s'.conf = s.conf - RDT_Sender_WaitAck + {
RDT_Sender_WaitAck
}
testIfNextStable[s, s', {none}, RDT_Sender_OnSendError_5] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Sender_OnSendError_5[s, s': Snapshot] {
pre_RDT_Sender_OnSendError_5[s]
pos_RDT_Sender_OnSendError_5[s, s']
semantics_RDT_Sender_OnSendError_5[s, s']
}
pred enabledAfterStep_RDT_Sender_OnSendError_5[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Sender_WaitAck in s.conf
_s.stable = True => {
no t & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendError_5 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4
}
RDT_SendError in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendError_5 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4
}
RDT_SendError in {_s.events + genEvents}
}
}
pred semantics_RDT_Sender_OnSendError_5[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Sender_OnSendError_5
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Sender_OnSendError_5
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendError_5 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4
}
}
}
// Transition RDT_Sender_OnSendError_6
pred pre_RDT_Sender_OnSendError_6[s:Snapshot] {
RDT_Sender_ReadyResend in s.conf
s.stable = True => {
RDT_SendError in (s.events & EnvironmentEvent)
} else {
RDT_SendError in s.events
}
}
pred pos_RDT_Sender_OnSendError_6[s, s':Snapshot] {
s'.conf = s.conf - RDT_Sender_ReadyResend + {
RDT_Sender_WaitAck
}
testIfNextStable[s, s', {none}, RDT_Sender_OnSendError_6] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Sender_OnSendError_6[s, s': Snapshot] {
pre_RDT_Sender_OnSendError_6[s]
pos_RDT_Sender_OnSendError_6[s, s']
semantics_RDT_Sender_OnSendError_6[s, s']
}
pred enabledAfterStep_RDT_Sender_OnSendError_6[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Sender_ReadyResend in s.conf
_s.stable = True => {
no t & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_SendError in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_SendError in {_s.events + genEvents}
}
}
pred semantics_RDT_Sender_OnSendError_6[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Sender_OnSendError_6
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Sender_OnSendError_6
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
}
}
// Transition RDT_Sender_t_3
pred pre_RDT_Sender_t_3[s:Snapshot] {
RDT_Sender_WaitAck in s.conf
s.stable = True => {
RDT_AckSuccess in (s.events & EnvironmentEvent)
} else {
RDT_AckSuccess in s.events
}
}
pred pos_RDT_Sender_t_3[s, s':Snapshot] {
s'.conf = s.conf - RDT_Sender_WaitAck + {
RDT_Sender_ReadySendNext
}
testIfNextStable[s, s', {none}, RDT_Sender_t_3] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Sender_t_3[s, s': Snapshot] {
pre_RDT_Sender_t_3[s]
pos_RDT_Sender_t_3[s, s']
semantics_RDT_Sender_t_3[s, s']
}
pred enabledAfterStep_RDT_Sender_t_3[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Sender_WaitAck in s.conf
_s.stable = True => {
no t & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_AckSuccess in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
RDT_AckSuccess in {_s.events + genEvents}
}
}
pred semantics_RDT_Sender_t_3[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Sender_t_3
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Sender_t_3
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_t_4 +
RDT_Sender_OnSendError_5
}
}
}
// Transition RDT_Sender_t_4
pred pre_RDT_Sender_t_4[s:Snapshot] {
RDT_Sender_WaitAck in s.conf
s.stable = True => {
RDT_AckError in (s.events & EnvironmentEvent)
} else {
RDT_AckError in s.events
}
}
pred pos_RDT_Sender_t_4[s, s':Snapshot] {
s'.conf = s.conf - RDT_Sender_WaitAck + {
RDT_Sender_ReadyResend
}
testIfNextStable[s, s', {none}, RDT_Sender_t_4] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Sender_t_4[s, s': Snapshot] {
pre_RDT_Sender_t_4[s]
pos_RDT_Sender_t_4[s, s']
semantics_RDT_Sender_t_4[s, s']
}
pred enabledAfterStep_RDT_Sender_t_4[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Sender_WaitAck in s.conf
_s.stable = True => {
no t & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_t_4 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_OnSendError_5
}
RDT_AckError in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_t_4 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_OnSendError_5
}
RDT_AckError in {_s.events + genEvents}
}
}
pred semantics_RDT_Sender_t_4[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Sender_t_4
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Sender_t_4
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Sender_OnSendError_4 +
RDT_Sender_t_3 +
RDT_Sender_OnSendSucess_1 +
RDT_Sender_OnSendSucess_3 +
RDT_Sender_OnSendError_6 +
RDT_Sender_t_4 +
RDT_Sender_OnSendSucess_2 +
RDT_Sender_OnSendError_5
}
}
}
// Transition RDT_Receiver__7
pred pre_RDT_Receiver__7[s:Snapshot] {
RDT_Receiver_ReadyReceiveNext in s.conf
s.stable = True => {
RDT_SendSuccess in (s.events & EnvironmentEvent)
} else {
RDT_SendSuccess in s.events
}
}
pred pos_RDT_Receiver__7[s, s':Snapshot] {
s'.conf = s.conf - RDT_Receiver_ReadyReceiveNext + {
RDT_Receiver_ReceiveSuccess
}
testIfNextStable[s, s', {none}, RDT_Receiver__7] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Receiver__7[s, s': Snapshot] {
pre_RDT_Receiver__7[s]
pos_RDT_Receiver__7[s, s']
semantics_RDT_Receiver__7[s, s']
}
pred enabledAfterStep_RDT_Receiver__7[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Receiver_ReadyReceiveNext in s.conf
_s.stable = True => {
no t & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver__7 +
RDT_Receiver_t_13 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendSuccess in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver__7 +
RDT_Receiver_t_13 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendSuccess in {_s.events + genEvents}
}
}
pred semantics_RDT_Receiver__7[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Receiver__7
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Receiver__7
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver__7 +
RDT_Receiver_t_13 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
}
}
// Transition RDT_Receiver__8
pred pre_RDT_Receiver__8[s:Snapshot] {
RDT_Receiver_ReceiveSuccess in s.conf
s.stable = True => {
RDT_SendSuccess in (s.events & EnvironmentEvent)
} else {
RDT_SendSuccess in s.events
}
}
pred pos_RDT_Receiver__8[s, s':Snapshot] {
s'.conf = s.conf - RDT_Receiver_ReceiveSuccess + {
RDT_Receiver_ReceiveSuccess
}
testIfNextStable[s, s', {none}, RDT_Receiver__8] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Receiver__8[s, s': Snapshot] {
pre_RDT_Receiver__8[s]
pos_RDT_Receiver__8[s, s']
semantics_RDT_Receiver__8[s, s']
}
pred enabledAfterStep_RDT_Receiver__8[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Receiver_ReceiveSuccess in s.conf
_s.stable = True => {
no t & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendSuccess in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendSuccess in {_s.events + genEvents}
}
}
pred semantics_RDT_Receiver__8[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Receiver__8
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Receiver__8
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
}
}
// Transition RDT_Receiver__9
pred pre_RDT_Receiver__9[s:Snapshot] {
RDT_Receiver_ReceiveError in s.conf
s.stable = True => {
RDT_SendSuccess in (s.events & EnvironmentEvent)
} else {
RDT_SendSuccess in s.events
}
}
pred pos_RDT_Receiver__9[s, s':Snapshot] {
s'.conf = s.conf - RDT_Receiver_ReceiveError + {
RDT_Receiver_ReceiveSuccess
}
testIfNextStable[s, s', {none}, RDT_Receiver__9] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Receiver__9[s, s': Snapshot] {
pre_RDT_Receiver__9[s]
pos_RDT_Receiver__9[s, s']
semantics_RDT_Receiver__9[s, s']
}
pred enabledAfterStep_RDT_Receiver__9[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Receiver_ReceiveError in s.conf
_s.stable = True => {
no t & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver__9 +
RDT_Receiver_t_14
}
RDT_SendSuccess in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver__9 +
RDT_Receiver_t_14
}
RDT_SendSuccess in {_s.events + genEvents}
}
}
pred semantics_RDT_Receiver__9[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Receiver__9
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Receiver__9
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver__9 +
RDT_Receiver_t_14
}
}
}
// Transition RDT_Receiver__10
pred pre_RDT_Receiver__10[s:Snapshot] {
RDT_Receiver_ReadyReceiveResend in s.conf
s.stable = True => {
RDT_SendSuccess in (s.events & EnvironmentEvent)
} else {
RDT_SendSuccess in s.events
}
}
pred pos_RDT_Receiver__10[s, s':Snapshot] {
s'.conf = s.conf - RDT_Receiver_ReadyReceiveResend + {
RDT_Receiver_ReceiveSuccess
}
testIfNextStable[s, s', {none}, RDT_Receiver__10] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Receiver__10[s, s': Snapshot] {
pre_RDT_Receiver__10[s]
pos_RDT_Receiver__10[s, s']
semantics_RDT_Receiver__10[s, s']
}
pred enabledAfterStep_RDT_Receiver__10[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Receiver_ReadyReceiveResend in s.conf
_s.stable = True => {
no t & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendSuccess in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendSuccess in {_s.events + genEvents}
}
}
pred semantics_RDT_Receiver__10[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Receiver__10
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Receiver__10
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
}
}
// Transition RDT_Receiver__11
pred pre_RDT_Receiver__11[s:Snapshot] {
RDT_Receiver_ReadyReceiveNext in s.conf
s.stable = True => {
RDT_SendError in (s.events & EnvironmentEvent)
} else {
RDT_SendError in s.events
}
}
pred pos_RDT_Receiver__11[s, s':Snapshot] {
s'.conf = s.conf - RDT_Receiver_ReadyReceiveNext + {
RDT_Receiver_ReceiveError
}
testIfNextStable[s, s', {none}, RDT_Receiver__11] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Receiver__11[s, s': Snapshot] {
pre_RDT_Receiver__11[s]
pos_RDT_Receiver__11[s, s']
semantics_RDT_Receiver__11[s, s']
}
pred enabledAfterStep_RDT_Receiver__11[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Receiver_ReadyReceiveNext in s.conf
_s.stable = True => {
no t & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendError in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendError in {_s.events + genEvents}
}
}
pred semantics_RDT_Receiver__11[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Receiver__11
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Receiver__11
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
}
}
// Transition RDT_Receiver__12
pred pre_RDT_Receiver__12[s:Snapshot] {
RDT_Receiver_ReceiveSuccess in s.conf
s.stable = True => {
RDT_SendError in (s.events & EnvironmentEvent)
} else {
RDT_SendError in s.events
}
}
pred pos_RDT_Receiver__12[s, s':Snapshot] {
s'.conf = s.conf - RDT_Receiver_ReceiveSuccess + {
RDT_Receiver_ReceiveError
}
testIfNextStable[s, s', {none}, RDT_Receiver__12] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Receiver__12[s, s': Snapshot] {
pre_RDT_Receiver__12[s]
pos_RDT_Receiver__12[s, s']
semantics_RDT_Receiver__12[s, s']
}
pred enabledAfterStep_RDT_Receiver__12[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Receiver_ReceiveSuccess in s.conf
_s.stable = True => {
no t & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendError in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendError in {_s.events + genEvents}
}
}
pred semantics_RDT_Receiver__12[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Receiver__12
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Receiver__12
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
}
}
// Transition RDT_Receiver__13
pred pre_RDT_Receiver__13[s:Snapshot] {
RDT_Receiver_ReceiveError in s.conf
s.stable = True => {
RDT_SendError in (s.events & EnvironmentEvent)
} else {
RDT_SendError in s.events
}
}
pred pos_RDT_Receiver__13[s, s':Snapshot] {
s'.conf = s.conf - RDT_Receiver_ReceiveError + {
RDT_Receiver_ReceiveError
}
testIfNextStable[s, s', {none}, RDT_Receiver__13] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Receiver__13[s, s': Snapshot] {
pre_RDT_Receiver__13[s]
pos_RDT_Receiver__13[s, s']
semantics_RDT_Receiver__13[s, s']
}
pred enabledAfterStep_RDT_Receiver__13[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Receiver_ReceiveError in s.conf
_s.stable = True => {
no t & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendError in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendError in {_s.events + genEvents}
}
}
pred semantics_RDT_Receiver__13[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Receiver__13
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Receiver__13
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
}
}
// Transition RDT_Receiver__14
pred pre_RDT_Receiver__14[s:Snapshot] {
RDT_Receiver_ReadyReceiveResend in s.conf
s.stable = True => {
RDT_SendError in (s.events & EnvironmentEvent)
} else {
RDT_SendError in s.events
}
}
pred pos_RDT_Receiver__14[s, s':Snapshot] {
s'.conf = s.conf - RDT_Receiver_ReadyReceiveResend + {
RDT_Receiver_ReceiveError
}
testIfNextStable[s, s', {none}, RDT_Receiver__14] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Receiver__14[s, s': Snapshot] {
pre_RDT_Receiver__14[s]
pos_RDT_Receiver__14[s, s']
semantics_RDT_Receiver__14[s, s']
}
pred enabledAfterStep_RDT_Receiver__14[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Receiver_ReadyReceiveResend in s.conf
_s.stable = True => {
no t & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendError in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_SendError in {_s.events + genEvents}
}
}
pred semantics_RDT_Receiver__14[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Receiver__14
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Receiver__14
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
}
}
// Transition RDT_Receiver_t_13
pred pre_RDT_Receiver_t_13[s:Snapshot] {
RDT_Receiver_ReceiveError in s.conf
s.stable = True => {
RDT_AckError in (s.events & EnvironmentEvent)
} else {
RDT_AckError in s.events
}
}
pred pos_RDT_Receiver_t_13[s, s':Snapshot] {
s'.conf = s.conf - RDT_Receiver_ReceiveError + {
RDT_Receiver_ReadyReceiveResend
}
testIfNextStable[s, s', {none}, RDT_Receiver_t_13] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Receiver_t_13[s, s': Snapshot] {
pre_RDT_Receiver_t_13[s]
pos_RDT_Receiver_t_13[s, s']
semantics_RDT_Receiver_t_13[s, s']
}
pred enabledAfterStep_RDT_Receiver_t_13[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Receiver_ReceiveError in s.conf
_s.stable = True => {
no t & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_AckError in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_AckError in {_s.events + genEvents}
}
}
pred semantics_RDT_Receiver_t_13[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Receiver_t_13
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Receiver_t_13
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
}
}
// Transition RDT_Receiver_t_14
pred pre_RDT_Receiver_t_14[s:Snapshot] {
RDT_Receiver_ReceiveSuccess in s.conf
s.stable = True => {
RDT_AckSuccess in (s.events & EnvironmentEvent)
} else {
RDT_AckSuccess in s.events
}
}
pred pos_RDT_Receiver_t_14[s, s':Snapshot] {
s'.conf = s.conf - RDT_Receiver_ReceiveSuccess + {
RDT_Receiver_ReadyReceiveNext
}
testIfNextStable[s, s', {none}, RDT_Receiver_t_14] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Receiver_t_14[s, s': Snapshot] {
pre_RDT_Receiver_t_14[s]
pos_RDT_Receiver_t_14[s, s']
semantics_RDT_Receiver_t_14[s, s']
}
pred enabledAfterStep_RDT_Receiver_t_14[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Receiver_ReceiveSuccess in s.conf
_s.stable = True => {
no t & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_AckSuccess in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_AckSuccess in {_s.events + genEvents}
}
}
pred semantics_RDT_Receiver_t_14[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Receiver_t_14
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Receiver_t_14
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
}
}
// Transition RDT_Receiver_t_15
pred pre_RDT_Receiver_t_15[s:Snapshot] {
RDT_Receiver_ReceiveSuccess in s.conf
s.stable = True => {
RDT_AckError in (s.events & EnvironmentEvent)
} else {
RDT_AckError in s.events
}
}
pred pos_RDT_Receiver_t_15[s, s':Snapshot] {
s'.conf = s.conf - RDT_Receiver_ReceiveSuccess + {
RDT_Receiver_ReadyReceiveNext
}
testIfNextStable[s, s', {none}, RDT_Receiver_t_15] => {
s'.stable = True
s.stable = True => {
no ((s'.events & InternalEvent) )
} else {
no ((s'.events & InternalEvent) - { (InternalEvent & s.events)})
}
} else {
s'.stable = False
s.stable = True => {
s'.events & InternalEvent = {none}
s'.events & EnvironmentEvent = s.events & EnvironmentEvent
} else {
s'.events = s.events + {none}
}
}
}
pred RDT_Receiver_t_15[s, s': Snapshot] {
pre_RDT_Receiver_t_15[s]
pos_RDT_Receiver_t_15[s, s']
semantics_RDT_Receiver_t_15[s, s']
}
pred enabledAfterStep_RDT_Receiver_t_15[_s, s: Snapshot, t: TransitionLabel, genEvents: set InternalEvent] {
// Preconditions
RDT_Receiver_ReceiveSuccess in s.conf
_s.stable = True => {
no t & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_AckError in {(_s.events & EnvironmentEvent) + genEvents}
} else {
no {_s.taken + t} & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
RDT_AckError in {_s.events + genEvents}
}
}
pred semantics_RDT_Receiver_t_15[s, s': Snapshot] {
(s.stable = True) => {
// SINGLE semantics
s'.taken = RDT_Receiver_t_15
} else {
// SINGLE semantics
s'.taken = s.taken + RDT_Receiver_t_15
// Bigstep "TAKE_ONE" semantics
no s.taken & {
RDT_Receiver__11 +
RDT_Receiver__12 +
RDT_Receiver__14 +
RDT_Receiver__10 +
RDT_Receiver_t_15 +
RDT_Receiver_t_13 +
RDT_Receiver__7 +
RDT_Receiver__8 +
RDT_Receiver__13 +
RDT_Receiver_t_14 +
RDT_Receiver__9
}
}
}
/****************************** INITIAL CONDITIONS ****************************/
pred init[s: Snapshot] {
s.conf = {
RDT_Sender_ReadySendNext +
RDT_Receiver_ReadyReceiveNext
}
no s.taken
s.stable = True
no s.events & InternalEvent
}
/***************************** MODEL DEFINITION *******************************/
pred operation[s, s': Snapshot] {
RDT_Sender_OnSendSucess_1[s, s'] or
RDT_Sender_OnSendSucess_2[s, s'] or
RDT_Sender_OnSendSucess_3[s, s'] or
RDT_Sender_OnSendError_4[s, s'] or
RDT_Sender_OnSendError_5[s, s'] or
RDT_Sender_OnSendError_6[s, s'] or
RDT_Sender_t_3[s, s'] or
RDT_Sender_t_4[s, s'] or
RDT_Receiver__7[s, s'] or
RDT_Receiver__8[s, s'] or
RDT_Receiver__9[s, s'] or
RDT_Receiver__10[s, s'] or
RDT_Receiver__11[s, s'] or
RDT_Receiver__12[s, s'] or
RDT_Receiver__13[s, s'] or
RDT_Receiver__14[s, s'] or
RDT_Receiver_t_13[s, s'] or
RDT_Receiver_t_14[s, s'] or
RDT_Receiver_t_15[s, s']
}
pred small_step[s, s': Snapshot] {
operation[s, s']
}
pred testIfNextStable[s, s': Snapshot, genEvents: set InternalEvent, t:TransitionLabel] {
!enabledAfterStep_RDT_Sender_OnSendSucess_1[s, s', t, genEvents]
!enabledAfterStep_RDT_Sender_OnSendSucess_2[s, s', t, genEvents]
!enabledAfterStep_RDT_Sender_OnSendSucess_3[s, s', t, genEvents]
!enabledAfterStep_RDT_Sender_OnSendError_4[s, s', t, genEvents]
!enabledAfterStep_RDT_Sender_OnSendError_5[s, s', t, genEvents]
!enabledAfterStep_RDT_Sender_OnSendError_6[s, s', t, genEvents]
!enabledAfterStep_RDT_Sender_t_3[s, s', t, genEvents]
!enabledAfterStep_RDT_Sender_t_4[s, s', t, genEvents]
!enabledAfterStep_RDT_Receiver__7[s, s', t, genEvents]
!enabledAfterStep_RDT_Receiver__8[s, s', t, genEvents]
!enabledAfterStep_RDT_Receiver__9[s, s', t, genEvents]
!enabledAfterStep_RDT_Receiver__10[s, s', t, genEvents]
!enabledAfterStep_RDT_Receiver__11[s, s', t, genEvents]
!enabledAfterStep_RDT_Receiver__12[s, s', t, genEvents]
!enabledAfterStep_RDT_Receiver__13[s, s', t, genEvents]
!enabledAfterStep_RDT_Receiver__14[s, s', t, genEvents]
!enabledAfterStep_RDT_Receiver_t_13[s, s', t, genEvents]
!enabledAfterStep_RDT_Receiver_t_14[s, s', t, genEvents]
!enabledAfterStep_RDT_Receiver_t_15[s, s', t, genEvents]
}
pred isEnabled[s:Snapshot] {
pre_RDT_Sender_OnSendSucess_1[s]or
pre_RDT_Sender_OnSendSucess_2[s]or
pre_RDT_Sender_OnSendSucess_3[s]or
pre_RDT_Sender_OnSendError_4[s]or
pre_RDT_Sender_OnSendError_5[s]or
pre_RDT_Sender_OnSendError_6[s]or
pre_RDT_Sender_t_3[s]or
pre_RDT_Sender_t_4[s]or
pre_RDT_Receiver__7[s]or
pre_RDT_Receiver__8[s]or
pre_RDT_Receiver__9[s]or
pre_RDT_Receiver__10[s]or
pre_RDT_Receiver__11[s]or
pre_RDT_Receiver__12[s]or
pre_RDT_Receiver__13[s]or
pre_RDT_Receiver__14[s]or
pre_RDT_Receiver_t_13[s]or
pre_RDT_Receiver_t_14[s]or
pre_RDT_Receiver_t_15[s]
}
pred equals[s, s': Snapshot] {
s'.conf = s.conf
s'.events = s.events
s'.taken = s.taken
}
fact {
all s: Snapshot | s in initial iff init[s]
all s, s': Snapshot | s->s' in nextStep iff small_step[s, s']
all s, s': Snapshot | equals[s, s'] => s = s'
all s: Snapshot | (isEnabled[s] && no s': Snapshot | small_step[s, s']) => s.stable = False
all s: Snapshot | s.stable = False => some s.nextStep
path
}
pred path {
all s:Snapshot, s': s.next | operation[s, s']
init[first]
}
run path for 5 Snapshot, 4 EventLabel
expect 1
assert safety {
ctl_mc[ag[{ s: Snapshot | s.stable = True => !((RDT_Sender_ReadyResend in s.conf and RDT_Receiver_ReadyReceiveNext in s.conf))}]]
}
check safety
for 10 Snapshot, 4 EventLabel expect 1
assert liveness {
ctl_mc[ag[{ (imp_ctl[
{s: Snapshot | s.stable = True and RDT_Receiver_ReceiveError in s.conf},
af[{ s: Snapshot | s.stable = True => (RDT_Receiver_ReceiveSuccess in s.conf)}]
])}]]
}
check liveness
for 10 Snapshot, 4 EventLabel expect 1
|
gcc-gcc-7_3_0-release/gcc/ada/a-chtgbo.ads | best08618/asylo | 7 | 23529 | <filename>gcc-gcc-7_3_0-release/gcc/ada/a-chtgbo.ads
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.HASH_TABLES.GENERIC_BOUNDED_OPERATIONS --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2015, 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/>. --
-- --
-- This unit was originally developed by <NAME>. --
------------------------------------------------------------------------------
-- Hash_Table_Type is used to implement hashed containers. This package
-- declares hash-table operations that do not depend on keys.
with Ada.Streams;
generic
with package HT_Types is
new Generic_Bounded_Hash_Table_Types (<>);
use HT_Types, HT_Types.Implementation;
with function Hash_Node (Node : Node_Type) return Hash_Type;
with function Next (Node : Node_Type) return Count_Type;
with procedure Set_Next
(Node : in out Node_Type;
Next : Count_Type);
package Ada.Containers.Hash_Tables.Generic_Bounded_Operations is
pragma Pure;
function Index
(Buckets : Buckets_Type;
Node : Node_Type) return Hash_Type;
pragma Inline (Index);
-- Uses the hash value of Node to compute its Buckets array index
function Index
(HT : Hash_Table_Type'Class;
Node : Node_Type) return Hash_Type;
pragma Inline (Index);
-- Uses the hash value of Node to compute its Hash_Table buckets array
-- index.
function Checked_Index
(Hash_Table : aliased in out Hash_Table_Type'Class;
Node : Count_Type) return Hash_Type;
-- Calls Index, but also locks and unlocks the container, per AI05-0022, in
-- order to detect element tampering by the generic actual Hash function.
generic
with function Find
(HT : Hash_Table_Type'Class;
Key : Node_Type) return Boolean;
function Generic_Equal (L, R : Hash_Table_Type'Class) return Boolean;
-- Used to implement hashed container equality. For each node in hash table
-- L, it calls Find to search for an equivalent item in hash table R. If
-- Find returns False for any node then Generic_Equal terminates
-- immediately and returns False. Otherwise if Find returns True for every
-- node then Generic_Equal returns True.
procedure Clear (HT : in out Hash_Table_Type'Class);
-- Deallocates each node in hash table HT. (Note that it only deallocates
-- the nodes, not the buckets array.) Program_Error is raised if the hash
-- table is busy.
procedure Delete_Node_At_Index
(HT : in out Hash_Table_Type'Class;
Indx : Hash_Type;
X : Count_Type);
-- Delete a node whose bucket position is known. extracted from following
-- subprogram, but also used directly to remove a node whose element has
-- been modified through a key_preserving reference: in that case we cannot
-- use the value of the element precisely because the current value does
-- not correspond to the hash code that determines its bucket.
procedure Delete_Node_Sans_Free
(HT : in out Hash_Table_Type'Class;
X : Count_Type);
-- Removes node X from the hash table without deallocating the node
generic
with procedure Set_Element (Node : in out Node_Type);
procedure Generic_Allocate
(HT : in out Hash_Table_Type'Class;
Node : out Count_Type);
-- Claim a node from the free store. Generic_Allocate first
-- calls Set_Element on the potential node, and then returns
-- the node's index as the value of the Node parameter.
procedure Free
(HT : in out Hash_Table_Type'Class;
X : Count_Type);
-- Return a node back to the free store, from where it had
-- been previously claimed via Generic_Allocate.
function First (HT : Hash_Table_Type'Class) return Count_Type;
-- Returns the head of the list in the first (lowest-index) non-empty
-- bucket.
function Next
(HT : Hash_Table_Type'Class;
Node : Count_Type) return Count_Type;
-- Returns the node that immediately follows Node. This corresponds to
-- either the next node in the same bucket, or (if Node is the last node in
-- its bucket) the head of the list in the first non-empty bucket that
-- follows.
generic
with procedure Process (Node : Count_Type);
procedure Generic_Iteration (HT : Hash_Table_Type'Class);
-- Calls Process for each node in hash table HT
generic
use Ada.Streams;
with procedure Write
(Stream : not null access Root_Stream_Type'Class;
Node : Node_Type);
procedure Generic_Write
(Stream : not null access Root_Stream_Type'Class;
HT : Hash_Table_Type'Class);
-- Used to implement the streaming attribute for hashed containers. It
-- calls Write for each node to write its value into Stream.
generic
use Ada.Streams;
with function New_Node (Stream : not null access Root_Stream_Type'Class)
return Count_Type;
procedure Generic_Read
(Stream : not null access Root_Stream_Type'Class;
HT : out Hash_Table_Type'Class);
-- Used to implement the streaming attribute for hashed containers. It
-- first clears hash table HT, then populates the hash table by calling
-- New_Node for each item in Stream.
end Ada.Containers.Hash_Tables.Generic_Bounded_Operations;
|
oeis/078/A078703.asm | neoneye/loda-programs | 11 | 23268 | ; A078703: Number of ways of subtracting twice a triangular number from a perfect square to obtain the integer n.
; Submitted by <NAME>
; 1,1,1,2,1,1,2,1,2,2,1,1,2,2,1,3,1,1,3,1,1,2,2,2,3,1,1,2,2,2,2,1,1,4,1,2,3,1,2,2,1,1,3,3,1,2,2,1,4,1,2,3,1,2,2,1,1,4,2,1,3,2,1,4,2,1,2,1,3,3,1,2,2,2,2,2,1,1,6,2,2,2,1,2,2,2,1,4,2,1,3,1,2,4,1,1,3,2,2,4
mov $1,1
mov $2,$0
mov $4,1
lpb $0
add $4,2
min $0,$4
mov $3,$2
dif $3,$0
cmp $3,$2
sub $2,$4
mov $0,$2
cmp $3,0
add $1,$3
lpe
mov $0,$1
|
src/tools/Dependency_Graph_Extractor/src/extraction-decl_types.adb | selroc/Renaissance-Ada | 1 | 14503 | with Extraction.Node_Edge_Types;
with Extraction.Utilities;
package body Extraction.Decl_Types is
use type LALCO.Ada_Node_Kind_Type;
function Get_Subp_Spec(Basic_Decl : LAL.Basic_Decl) return LAL.Base_Subp_Spec is
begin
if Basic_Decl.Kind = LALCO.Ada_Generic_Subp_Renaming_Decl then
return Get_Subp_Spec(Utilities.Get_Referenced_Decl(Basic_Decl.As_Generic_Subp_Renaming_Decl.F_Renames));
else
return Basic_Decl.P_Subp_Spec_Or_Null(Follow_Generic => True);
end if;
end Get_Subp_Spec;
function Get_Params(Subp_Spec : LAL.Base_Subp_Spec) return LAL.Params is
begin
case LALCO.Ada_Base_Subp_Spec(Subp_Spec.Kind) is
when LALCO.Ada_Entry_Spec =>
return Subp_Spec.As_Entry_Spec.F_Entry_Params;
when LALCO.Ada_Subp_Spec =>
return Subp_Spec.As_Subp_Spec.F_Subp_Params;
when others =>
raise Internal_Extraction_Error with "Unexpected Base_Subp_Spec in Get_Params";
end case;
end Get_Params;
function Get_Return_Type_Expr(Subp_Spec : LAL.Base_Subp_Spec) return LAL.Type_Expr is
begin
case LALCO.Ada_Base_Subp_Spec(Subp_Spec.Kind) is
when LALCO.Ada_Entry_Spec =>
return LAL.No_Type_Expr;
when LALCO.Ada_Subp_Spec =>
return Subp_Spec.As_Subp_Spec.F_Subp_Returns;
when others =>
raise Internal_Extraction_Error with "Unexpected Base_Subp_Spec in Get_Return_Type_Expr";
end case;
end Get_Return_Type_Expr;
function Get_Type(Type_Def : LAL.Type_Def) return LAL.Basic_Decl;
function Get_Type(Type_Expr : LAL.Type_Expr'Class) return LAL.Basic_Decl is
begin
case LALCO.Ada_Type_Expr(Type_Expr.Kind) is
when LALCO.Ada_Anonymous_Type =>
return Get_Type(Type_Expr.As_Anonymous_Type.F_Type_Decl.F_Type_Def);
when LALCO.Ada_Subtype_Indication =>
return Utilities.Get_Referenced_Decl(Type_Expr.As_Subtype_Indication.F_Name);
when others =>
raise Internal_Extraction_Error with "Unexpected Type_Expr in Get_Type";
end case;
end Get_Type;
function Get_Type(Type_Def : LAL.Type_Def) return LAL.Basic_Decl is
begin
case LALCO.Ada_Type_Def(Type_Def.Kind) is
when LALCO.Ada_Array_Type_Def =>
return Get_Type(Type_Def.As_Array_Type_Def.F_Component_Type.F_Type_Expr);
when LALCO.Ada_Type_Access_Def =>
return Get_Type(Type_Def.As_Type_Access_Def.F_Subtype_Indication);
when LALCO.Ada_Access_To_Subp_Def =>
return LAL.No_Basic_Decl;
when others =>
raise Internal_Extraction_Error with "Unexpected Type_Def in Get_Type";
end case;
end Get_Type;
procedure Extract_Edges
(Node : LAL.Ada_Node'Class;
Graph : Graph_Operations.Graph_Context)
is
begin
if Utilities.Is_Relevant_Basic_Decl(Node) then
declare
Source_Decl : constant LAL.Basic_Decl := Node.As_Basic_Decl;
Subp_Spec : constant LAL.Base_Subp_Spec := Get_Subp_Spec(Source_Decl);
begin
if Source_Decl.Kind /= LALCO.Ada_Enum_Literal_Decl
and then not Subp_Spec.Is_Null
then
declare
Params : constant LAL.Params := Get_Params(Subp_Spec);
Return_Type : constant LAL.Type_Expr := Get_Return_Type_Expr(Subp_Spec);
begin
if not Params.Is_Null then
for Param_Spec of Params.F_Params loop
declare
Type_Expr : constant LAL.Type_Expr := Param_Spec.F_Type_Expr;
Target_Decl : constant LAL.Basic_Decl := Get_Type(Type_Expr);
Edge_Attrs : constant GW.Attribute_Value_Sets.Map := Node_Edge_Types.Get_Edge_Attributes(Type_Expr, Can_Have_Array_Type => False);
begin
if not Target_Decl.Is_Null then
Graph.Write_Edge(Source_Decl, Target_Decl, Node_Edge_Types.Edge_Type_Has_Parameter_Of_Type, Edge_Attrs);
end if;
end;
end loop;
end if;
if not Return_Type.Is_Null then
declare
Target_Decl : constant LAL.Basic_Decl := Get_Type(Return_Type);
Edge_Attrs : constant GW.Attribute_Value_Sets.Map := Node_Edge_Types.Get_Edge_Attributes(Return_Type, Can_Have_Array_Type => False);
begin
if not Target_Decl.Is_Null then
Graph.Write_Edge(Source_Decl, Target_Decl, Node_Edge_Types.Edge_Type_Has_Return_Of_Type, Edge_Attrs);
end if;
end;
end if;
end;
elsif Source_Decl.Kind in LALCO.Ada_Component_Decl | LALCO.Ada_Discriminant_Spec | LALCO.Ada_Object_Decl then
declare
Type_Expr : constant LAL.Type_Expr := Source_Decl.P_Type_Expression;
Target_Decl : constant LAL.Basic_Decl := Get_Type(Type_Expr);
Edge_Attrs : constant GW.Attribute_Value_Sets.Map := Node_Edge_Types.Get_Edge_Attributes(Type_Expr, Can_Have_Array_Type => True);
begin
if not Target_Decl.Is_Null then
for Source_Name of Source_Decl.P_Defining_Names loop
Graph.Write_Edge(Source_Name, Source_Decl, Target_Decl, Node_Edge_Types.Edge_Type_Has_Type, Edge_Attrs);
end loop;
end if;
end;
end if;
end;
end if;
end Extract_Edges;
end Extraction.Decl_Types;
|
P6/data_P6/testpoint/testpoint86.asm | alxzzhou/BUAA_CO_2020 | 1 | 169653 | <filename>P6/data_P6/testpoint/testpoint86.asm
ori $1, $0, 6
ori $2, $0, 9
ori $3, $0, 1
ori $4, $0, 3
sw $4, 0($0)
sw $4, 4($0)
sw $2, 8($0)
sw $4, 12($0)
sw $2, 16($0)
sw $3, 20($0)
sw $4, 24($0)
sw $3, 28($0)
sw $2, 32($0)
sw $2, 36($0)
sw $3, 40($0)
sw $1, 44($0)
sw $1, 48($0)
sw $4, 52($0)
sw $1, 56($0)
sw $3, 60($0)
sw $2, 64($0)
sw $2, 68($0)
sw $3, 72($0)
sw $3, 76($0)
sw $1, 80($0)
sw $2, 84($0)
sw $4, 88($0)
sw $2, 92($0)
sw $3, 96($0)
sw $2, 100($0)
sw $4, 104($0)
sw $4, 108($0)
sw $3, 112($0)
sw $2, 116($0)
sw $2, 120($0)
sw $2, 124($0)
mflo $4
mult $4, $4
lui $4, 13
sll $0, $0, 0
TAG1:
mflo $1
lh $1, 0($1)
divu $4, $1
bgez $4, TAG2
TAG2:
lui $4, 7
lui $1, 6
bgez $1, TAG3
mflo $1
TAG3:
div $1, $1
sltu $1, $1, $1
mflo $1
bne $1, $1, TAG4
TAG4:
div $1, $1
beq $1, $1, TAG5
sb $1, 0($1)
lui $2, 13
TAG5:
mtlo $2
sb $2, 0($2)
lbu $4, 0($2)
mtlo $4
TAG6:
blez $4, TAG7
lui $3, 0
ori $3, $3, 8
mthi $3
TAG7:
mflo $2
blez $2, TAG8
lb $2, 0($2)
nor $2, $3, $3
TAG8:
mult $2, $2
mflo $2
lbu $1, 0($2)
mflo $4
TAG9:
mflo $3
lbu $2, 0($4)
lui $3, 8
bne $3, $2, TAG10
TAG10:
mthi $3
multu $3, $3
mult $3, $3
sll $0, $0, 0
TAG11:
bne $2, $2, TAG12
nor $1, $2, $2
andi $1, $2, 0
sw $1, 0($1)
TAG12:
sub $4, $1, $1
blez $1, TAG13
sh $4, 0($1)
lbu $1, 0($4)
TAG13:
beq $1, $1, TAG14
lw $3, 0($1)
lhu $4, 0($1)
bltz $3, TAG14
TAG14:
sh $4, 0($4)
srlv $1, $4, $4
bgez $4, TAG15
multu $1, $1
TAG15:
beq $1, $1, TAG16
subu $2, $1, $1
lui $3, 5
div $1, $2
TAG16:
lh $1, 0($3)
mfhi $1
bgtz $1, TAG17
lui $2, 9
TAG17:
sll $0, $0, 0
mthi $2
lui $4, 8
bgtz $2, TAG18
TAG18:
addu $2, $4, $4
andi $3, $4, 13
lui $3, 12
mfhi $4
TAG19:
sll $0, $0, 0
mtlo $3
mflo $3
lui $3, 4
TAG20:
sll $0, $0, 0
mflo $4
divu $4, $4
sll $0, $0, 0
TAG21:
bgez $4, TAG22
subu $1, $4, $4
bltz $1, TAG22
divu $1, $4
TAG22:
mflo $1
addu $3, $1, $1
mfhi $2
lui $2, 7
TAG23:
sll $0, $0, 0
slti $1, $2, 10
sll $0, $0, 0
ori $1, $2, 10
TAG24:
lui $2, 2
mthi $1
bgtz $1, TAG25
sra $2, $1, 15
TAG25:
lui $1, 13
mflo $4
lbu $1, 0($4)
lb $4, 0($1)
TAG26:
sw $4, 0($4)
bgtz $4, TAG27
lb $1, 0($4)
mflo $1
TAG27:
slti $3, $1, 14
bne $3, $3, TAG28
lb $1, 0($3)
mult $3, $1
TAG28:
lbu $1, 0($1)
sw $1, 0($1)
mflo $1
mtlo $1
TAG29:
sra $1, $1, 11
multu $1, $1
beq $1, $1, TAG30
mthi $1
TAG30:
lw $2, 0($1)
sw $1, 0($1)
or $2, $1, $1
mthi $1
TAG31:
beq $2, $2, TAG32
sub $4, $2, $2
mtlo $2
bltz $2, TAG32
TAG32:
lui $2, 1
mfhi $3
ori $3, $3, 11
addiu $3, $3, 14
TAG33:
multu $3, $3
bne $3, $3, TAG34
mthi $3
lb $4, 0($3)
TAG34:
mthi $4
mfhi $2
blez $4, TAG35
mult $4, $2
TAG35:
mtlo $2
addu $2, $2, $2
bne $2, $2, TAG36
ori $4, $2, 1
TAG36:
mult $4, $4
mflo $4
multu $4, $4
and $3, $4, $4
TAG37:
mthi $3
blez $3, TAG38
mfhi $4
blez $3, TAG38
TAG38:
multu $4, $4
mtlo $4
divu $4, $4
lui $3, 9
TAG39:
sll $0, $0, 0
divu $3, $3
mthi $3
addiu $1, $3, 8
TAG40:
beq $1, $1, TAG41
mfhi $3
mfhi $2
mfhi $2
TAG41:
sh $2, 0($2)
lb $4, 0($2)
lb $1, 0($4)
beq $1, $2, TAG42
TAG42:
mthi $1
and $4, $1, $1
mfhi $4
lbu $4, 0($1)
TAG43:
multu $4, $4
lui $1, 8
xor $3, $1, $1
mult $1, $1
TAG44:
addiu $3, $3, 3
div $3, $3
mtlo $3
beq $3, $3, TAG45
TAG45:
mflo $1
mflo $3
lui $2, 0
xor $3, $2, $2
TAG46:
lh $1, 0($3)
or $1, $1, $1
sh $3, 0($3)
multu $1, $1
TAG47:
lhu $4, 0($1)
srav $3, $1, $1
subu $4, $3, $3
lw $3, 0($3)
TAG48:
beq $3, $3, TAG49
mult $3, $3
bgtz $3, TAG49
mthi $3
TAG49:
slti $3, $3, 13
lui $2, 3
mtlo $2
bgtz $3, TAG50
TAG50:
sll $0, $0, 0
lui $3, 5
ori $2, $1, 7
multu $2, $1
TAG51:
bgez $2, TAG52
sllv $1, $2, $2
sw $1, 0($1)
add $1, $2, $1
TAG52:
sw $1, -896($1)
ori $1, $1, 6
xor $1, $1, $1
mtlo $1
TAG53:
mthi $1
bgez $1, TAG54
mflo $4
srav $1, $4, $1
TAG54:
bne $1, $1, TAG55
lb $1, 0($1)
mflo $4
bne $1, $1, TAG55
TAG55:
sh $4, 0($4)
sb $4, 0($4)
bne $4, $4, TAG56
lui $3, 15
TAG56:
lui $4, 5
mflo $4
lhu $3, 0($4)
addiu $2, $3, 14
TAG57:
mthi $2
multu $2, $2
beq $2, $2, TAG58
mflo $3
TAG58:
beq $3, $3, TAG59
mthi $3
mflo $1
lui $3, 11
TAG59:
sll $0, $0, 0
sh $3, -196($3)
beq $2, $2, TAG60
mult $3, $2
TAG60:
mthi $2
lui $2, 15
slt $3, $2, $2
mtlo $3
TAG61:
mthi $3
sh $3, 0($3)
xor $4, $3, $3
mflo $2
TAG62:
sw $2, 0($2)
mfhi $2
multu $2, $2
add $1, $2, $2
TAG63:
bne $1, $1, TAG64
lbu $3, 0($1)
multu $1, $3
sltu $1, $3, $1
TAG64:
lui $4, 15
addu $3, $4, $1
mthi $1
or $1, $4, $3
TAG65:
bne $1, $1, TAG66
mflo $4
bltz $1, TAG66
mthi $1
TAG66:
mfhi $2
mfhi $1
sltu $4, $4, $4
mult $4, $1
TAG67:
lui $1, 3
mfhi $1
lh $4, 0($1)
mthi $4
TAG68:
mflo $4
bgez $4, TAG69
mflo $2
ori $1, $4, 11
TAG69:
bgez $1, TAG70
mult $1, $1
beq $1, $1, TAG70
sb $1, 0($1)
TAG70:
mult $1, $1
sub $4, $1, $1
beq $4, $4, TAG71
lh $1, 0($1)
TAG71:
lui $2, 5
sltu $4, $2, $1
lbu $2, 0($1)
sra $1, $2, 1
TAG72:
srl $2, $1, 11
lui $2, 0
bne $2, $1, TAG73
mult $2, $2
TAG73:
beq $2, $2, TAG74
addi $4, $2, 12
lui $4, 14
srav $4, $4, $4
TAG74:
lui $3, 10
sh $3, 0($4)
sll $0, $0, 0
mult $3, $4
TAG75:
mult $3, $3
lui $3, 11
xor $2, $3, $3
sll $0, $0, 0
TAG76:
bltz $4, TAG77
sltiu $2, $4, 8
bne $2, $2, TAG77
addiu $2, $4, 8
TAG77:
srlv $3, $2, $2
blez $2, TAG78
sh $2, 0($2)
blez $2, TAG78
TAG78:
lui $2, 4
bltz $3, TAG79
sub $1, $2, $3
bgtz $1, TAG79
TAG79:
mflo $4
mflo $2
bgez $2, TAG80
lui $2, 10
TAG80:
lui $2, 15
andi $3, $2, 4
mthi $2
lui $2, 11
TAG81:
sll $3, $2, 0
sltu $3, $3, $3
mthi $2
mflo $4
TAG82:
mult $4, $4
lui $2, 14
lui $3, 5
beq $4, $4, TAG83
TAG83:
lui $3, 11
addiu $4, $3, 14
bgtz $3, TAG84
sll $0, $0, 0
TAG84:
divu $4, $4
mfhi $3
lui $1, 8
sll $0, $0, 0
TAG85:
bltz $2, TAG86
mult $2, $2
andi $3, $2, 8
mult $3, $2
TAG86:
andi $4, $3, 10
sll $1, $4, 5
blez $3, TAG87
sub $2, $1, $3
TAG87:
bne $2, $2, TAG88
sh $2, 0($2)
sw $2, 0($2)
and $1, $2, $2
TAG88:
mthi $1
blez $1, TAG89
mflo $2
sltiu $3, $2, 5
TAG89:
lh $1, 0($3)
bne $3, $1, TAG90
multu $1, $1
lb $3, 0($3)
TAG90:
bne $3, $3, TAG91
lb $3, 0($3)
sh $3, 0($3)
mthi $3
TAG91:
bne $3, $3, TAG92
nor $3, $3, $3
beq $3, $3, TAG92
mflo $3
TAG92:
bne $3, $3, TAG93
or $4, $3, $3
and $3, $3, $3
mflo $4
TAG93:
subu $3, $4, $4
mult $3, $3
lui $2, 8
lui $3, 14
TAG94:
sll $0, $0, 0
sll $0, $0, 0
mthi $3
mult $3, $3
TAG95:
bne $3, $3, TAG96
sll $0, $0, 0
bne $3, $3, TAG96
sltu $4, $3, $3
TAG96:
bne $4, $4, TAG97
sra $4, $4, 4
mflo $1
sw $4, 0($4)
TAG97:
lui $4, 12
sll $0, $0, 0
blez $4, TAG98
srl $1, $1, 9
TAG98:
bltz $1, TAG99
slt $1, $1, $1
mflo $2
mflo $3
TAG99:
mfhi $1
bgez $1, TAG100
mtlo $1
mthi $3
TAG100:
mthi $1
sh $1, -196($1)
addu $3, $1, $1
lh $2, -392($3)
TAG101:
beq $2, $2, TAG102
lui $3, 2
lbu $3, 0($2)
bltz $3, TAG102
TAG102:
mflo $1
and $2, $3, $3
lui $4, 6
beq $3, $4, TAG103
TAG103:
srav $3, $4, $4
mflo $1
srl $1, $3, 12
sll $0, $0, 0
TAG104:
sllv $1, $2, $2
bne $1, $2, TAG105
ori $1, $1, 11
sll $0, $0, 0
TAG105:
mult $1, $1
sltiu $2, $1, 15
mtlo $1
lui $2, 7
TAG106:
mtlo $2
mflo $1
mflo $1
beq $1, $2, TAG107
TAG107:
sll $0, $0, 0
andi $3, $1, 5
bgez $1, TAG108
sra $3, $3, 15
TAG108:
multu $3, $3
lui $4, 6
mtlo $3
sw $3, 0($3)
TAG109:
blez $4, TAG110
lui $3, 5
lui $2, 0
bne $2, $3, TAG110
TAG110:
sw $2, 0($2)
sll $1, $2, 5
beq $2, $2, TAG111
lhu $1, 0($1)
TAG111:
lui $2, 3
beq $1, $1, TAG112
srlv $4, $1, $1
add $4, $1, $2
TAG112:
lbu $1, 0($4)
sw $4, 0($1)
mult $4, $4
addu $1, $1, $4
TAG113:
bltz $1, TAG114
mfhi $3
beq $1, $3, TAG114
sb $3, 0($3)
TAG114:
mflo $2
sw $3, 0($2)
mflo $2
xor $1, $2, $3
TAG115:
bltz $1, TAG116
lw $4, 0($1)
lb $4, 0($1)
mflo $4
TAG116:
sh $4, 0($4)
mflo $4
mtlo $4
beq $4, $4, TAG117
TAG117:
sh $4, 0($4)
sb $4, 0($4)
sltu $4, $4, $4
sw $4, 0($4)
TAG118:
bgtz $4, TAG119
lbu $4, 0($4)
blez $4, TAG119
slt $3, $4, $4
TAG119:
bltz $3, TAG120
lhu $3, 0($3)
lbu $3, 0($3)
ori $2, $3, 11
TAG120:
srav $3, $2, $2
beq $2, $3, TAG121
mthi $2
bltz $3, TAG121
TAG121:
lb $3, 0($3)
lui $1, 11
lui $1, 11
beq $1, $1, TAG122
TAG122:
mthi $1
srl $1, $1, 6
sw $1, -11264($1)
bltz $1, TAG123
TAG123:
sltiu $1, $1, 14
xor $3, $1, $1
multu $1, $1
bne $1, $1, TAG124
TAG124:
srl $4, $3, 7
or $1, $4, $3
mult $1, $3
mtlo $4
TAG125:
mflo $3
addi $4, $3, 0
mthi $1
multu $1, $4
TAG126:
bgtz $4, TAG127
multu $4, $4
sra $3, $4, 15
bgtz $4, TAG127
TAG127:
lb $4, 0($3)
beq $4, $4, TAG128
multu $3, $3
bne $3, $4, TAG128
TAG128:
sllv $2, $4, $4
sh $2, 0($4)
mult $4, $4
sh $2, 0($4)
TAG129:
slti $1, $2, 10
bne $2, $1, TAG130
sll $2, $2, 1
mfhi $2
TAG130:
mult $2, $2
lui $3, 11
blez $2, TAG131
addu $1, $3, $2
TAG131:
mtlo $1
and $2, $1, $1
sll $0, $0, 0
slti $4, $1, 7
TAG132:
mtlo $4
sltiu $1, $4, 10
bne $1, $1, TAG133
addiu $4, $1, 3
TAG133:
bne $4, $4, TAG134
sh $4, 0($4)
lb $2, 0($4)
mflo $4
TAG134:
mtlo $4
multu $4, $4
lbu $3, 0($4)
sltiu $2, $3, 3
TAG135:
sb $2, 0($2)
sb $2, 0($2)
srav $3, $2, $2
multu $2, $2
TAG136:
beq $3, $3, TAG137
lb $2, 0($3)
mfhi $4
lhu $3, 0($2)
TAG137:
mflo $1
sw $3, 0($3)
lui $1, 6
sll $0, $0, 0
TAG138:
sll $0, $0, 0
sh $1, 0($4)
mthi $1
mtlo $1
TAG139:
mfhi $1
bltz $4, TAG140
sll $0, $0, 0
sw $4, 0($4)
TAG140:
bgez $1, TAG141
sll $0, $0, 0
sw $1, 0($1)
mtlo $1
TAG141:
mtlo $1
sltu $2, $1, $1
xor $3, $2, $1
sub $2, $3, $2
TAG142:
addu $4, $2, $2
div $4, $4
mult $4, $4
xor $4, $4, $2
TAG143:
lui $1, 8
sll $0, $0, 0
lui $4, 2
sll $0, $0, 0
TAG144:
beq $4, $4, TAG145
lui $2, 4
lhu $4, 0($4)
sh $4, 0($2)
TAG145:
beq $4, $4, TAG146
multu $4, $4
lui $4, 13
beq $4, $4, TAG146
TAG146:
sll $0, $0, 0
multu $4, $4
sll $0, $0, 0
sll $0, $0, 0
TAG147:
slt $2, $1, $1
sll $0, $0, 0
sh $1, 0($2)
addu $4, $1, $2
TAG148:
div $4, $4
mthi $4
mfhi $3
multu $3, $3
TAG149:
bltz $3, TAG150
lui $3, 10
mfhi $3
addu $3, $3, $3
TAG150:
bne $3, $3, TAG151
mflo $1
mfhi $4
bltz $4, TAG151
TAG151:
sh $4, 0($4)
nor $3, $4, $4
bltz $3, TAG152
srl $2, $3, 4
TAG152:
bltz $2, TAG153
sllv $4, $2, $2
subu $4, $4, $2
addu $1, $2, $2
TAG153:
srav $4, $1, $1
sb $1, 0($4)
divu $1, $4
ori $3, $4, 6
TAG154:
lbu $4, 0($3)
sb $4, 0($3)
mfhi $2
mflo $2
TAG155:
bltz $2, TAG156
sra $3, $2, 15
blez $2, TAG156
srlv $3, $3, $2
TAG156:
multu $3, $3
mfhi $4
mfhi $4
slti $3, $3, 3
TAG157:
lbu $1, 0($3)
nor $1, $1, $3
sra $1, $3, 11
bne $1, $1, TAG158
TAG158:
mfhi $1
sub $2, $1, $1
mtlo $1
srav $2, $1, $1
TAG159:
lui $1, 9
sll $0, $0, 0
lui $3, 9
mfhi $3
TAG160:
addiu $4, $3, 13
mthi $4
mfhi $1
mthi $1
TAG161:
slti $4, $1, 4
mfhi $4
beq $1, $4, TAG162
multu $4, $4
TAG162:
mult $4, $4
lbu $1, 0($4)
mflo $2
mfhi $4
TAG163:
lui $2, 14
sll $0, $0, 0
sb $4, 0($4)
blez $2, TAG164
TAG164:
mfhi $3
sll $4, $3, 11
lui $4, 5
sll $0, $0, 0
TAG165:
sll $0, $0, 0
bgez $4, TAG166
mthi $4
blez $4, TAG166
TAG166:
lui $4, 0
addiu $4, $4, 8
multu $4, $4
mthi $4
TAG167:
sw $4, 0($4)
beq $4, $4, TAG168
srl $1, $4, 15
bgez $4, TAG168
TAG168:
lui $2, 3
nor $4, $2, $1
blez $4, TAG169
xori $2, $1, 9
TAG169:
xor $2, $2, $2
or $4, $2, $2
lui $4, 10
addu $2, $4, $2
TAG170:
multu $2, $2
sllv $3, $2, $2
xor $3, $2, $3
mflo $2
TAG171:
lhu $1, 0($2)
sh $1, 0($2)
lui $4, 14
lb $4, 0($2)
TAG172:
nor $4, $4, $4
mtlo $4
mult $4, $4
bne $4, $4, TAG173
TAG173:
or $1, $4, $4
div $1, $4
beq $1, $4, TAG174
div $1, $1
TAG174:
ori $4, $1, 1
sw $1, 1($4)
lui $2, 13
and $2, $4, $2
TAG175:
sll $0, $0, 0
mtlo $2
bgez $2, TAG176
sll $0, $0, 0
TAG176:
multu $4, $4
mult $4, $4
lh $1, 1($4)
multu $4, $4
TAG177:
sb $1, 1($1)
and $2, $1, $1
lui $2, 6
lw $2, 1($1)
TAG178:
sltu $2, $2, $2
mult $2, $2
lui $4, 0
mfhi $1
TAG179:
lui $3, 0
mtlo $1
mult $1, $1
mflo $3
TAG180:
ori $4, $3, 11
mfhi $4
ori $1, $4, 5
mult $4, $4
TAG181:
sb $1, 0($1)
lui $1, 2
beq $1, $1, TAG182
nor $4, $1, $1
TAG182:
blez $4, TAG183
mthi $4
mfhi $4
lb $4, 0($4)
TAG183:
multu $4, $4
sll $0, $0, 0
lui $1, 11
sra $3, $1, 2
TAG184:
lui $2, 5
lui $3, 11
sll $0, $0, 0
sll $0, $0, 0
TAG185:
sll $0, $0, 0
sll $0, $0, 0
sll $0, $0, 0
sltiu $1, $4, 11
TAG186:
lb $1, 0($1)
sh $1, 1($1)
subu $4, $1, $1
sh $1, 1($1)
TAG187:
sh $4, 0($4)
mfhi $4
bltz $4, TAG188
sltiu $4, $4, 15
TAG188:
sw $4, 0($4)
bltz $4, TAG189
multu $4, $4
lb $2, 0($4)
TAG189:
lui $3, 10
mthi $2
mfhi $3
bgez $3, TAG190
TAG190:
lh $2, 0($3)
multu $3, $3
lb $3, 0($2)
sb $2, 0($3)
TAG191:
lh $3, 0($3)
sll $1, $3, 5
sh $3, 0($3)
lb $4, 0($3)
TAG192:
lb $4, 0($4)
mult $4, $4
mthi $4
multu $4, $4
TAG193:
bgez $4, TAG194
andi $2, $4, 7
bne $2, $2, TAG194
sltiu $4, $4, 0
TAG194:
beq $4, $4, TAG195
lhu $1, 0($4)
lh $2, 0($1)
sh $1, 0($4)
TAG195:
bgez $2, TAG196
sh $2, 0($2)
sb $2, 0($2)
mtlo $2
TAG196:
sw $2, 0($2)
sw $2, 0($2)
lui $4, 3
lw $4, 0($2)
TAG197:
lb $3, 0($4)
lhu $4, 0($3)
mtlo $4
mtlo $4
TAG198:
sw $4, 0($4)
mtlo $4
lh $2, 0($4)
mfhi $1
TAG199:
mflo $4
bne $4, $4, TAG200
slt $1, $4, $4
lw $1, 0($4)
TAG200:
bgtz $1, TAG201
mfhi $3
bne $3, $1, TAG201
mthi $3
TAG201:
andi $4, $3, 2
addi $2, $3, 7
blez $2, TAG202
mfhi $3
TAG202:
bgez $3, TAG203
lui $1, 0
multu $1, $1
blez $3, TAG203
TAG203:
lhu $4, 0($1)
beq $1, $4, TAG204
mfhi $1
bgez $1, TAG204
TAG204:
subu $4, $1, $1
mult $4, $1
lb $3, 0($4)
lb $2, 0($1)
TAG205:
bne $2, $2, TAG206
mflo $1
lui $1, 12
mthi $1
TAG206:
mflo $1
mfhi $3
lui $1, 14
mtlo $1
TAG207:
lui $3, 0
sll $0, $0, 0
sll $0, $0, 0
sll $1, $3, 8
TAG208:
multu $1, $1
multu $1, $1
beq $1, $1, TAG209
mflo $4
TAG209:
mflo $4
addiu $3, $4, 1
nor $2, $4, $4
mfhi $2
TAG210:
mtlo $2
mthi $2
mthi $2
lui $1, 14
TAG211:
mthi $1
bgtz $1, TAG212
divu $1, $1
mthi $1
TAG212:
beq $1, $1, TAG213
lui $2, 8
lui $4, 13
lui $4, 4
TAG213:
mfhi $1
srav $2, $4, $1
add $1, $2, $1
sh $1, 0($2)
TAG214:
lui $4, 3
mfhi $4
sll $4, $4, 1
mult $4, $1
TAG215:
mthi $4
lhu $3, 0($4)
bgtz $3, TAG216
mult $4, $4
TAG216:
bgtz $3, TAG217
multu $3, $3
mflo $4
slt $1, $4, $3
TAG217:
lui $1, 10
lui $2, 6
addiu $4, $1, 2
divu $2, $4
TAG218:
sll $0, $0, 0
sll $3, $4, 6
mult $3, $4
srl $1, $3, 0
TAG219:
sllv $2, $1, $1
divu $1, $2
slti $1, $2, 4
multu $1, $1
TAG220:
lbu $4, 0($1)
sll $1, $4, 3
bgez $1, TAG221
addi $2, $1, 3
TAG221:
beq $2, $2, TAG222
lui $3, 2
beq $2, $3, TAG222
sb $2, 0($3)
TAG222:
div $3, $3
divu $3, $3
addiu $4, $3, 11
mult $3, $3
TAG223:
bne $4, $4, TAG224
mthi $4
srav $2, $4, $4
xori $3, $4, 10
TAG224:
mflo $1
lui $1, 4
or $4, $3, $1
addiu $2, $1, 9
TAG225:
beq $2, $2, TAG226
divu $2, $2
mflo $4
sw $4, 0($4)
TAG226:
mflo $1
beq $4, $1, TAG227
andi $1, $4, 8
sh $4, 0($1)
TAG227:
lb $3, 0($1)
beq $3, $3, TAG228
sltiu $2, $1, 2
or $1, $2, $2
TAG228:
lh $4, 0($1)
bne $4, $1, TAG229
lui $4, 2
sb $4, 0($4)
TAG229:
mthi $4
mflo $3
bgez $4, TAG230
lui $3, 5
TAG230:
sll $0, $0, 0
beq $3, $3, TAG231
addiu $1, $3, 1
sw $1, 0($1)
TAG231:
divu $1, $1
bne $1, $1, TAG232
mtlo $1
mtlo $1
TAG232:
multu $1, $1
srl $4, $1, 6
lw $2, -5120($4)
lui $2, 3
TAG233:
sll $0, $0, 0
sll $0, $0, 0
div $4, $4
lui $4, 13
TAG234:
mthi $4
srl $4, $4, 8
srl $1, $4, 5
slti $2, $1, 3
TAG235:
mflo $1
lui $2, 3
beq $1, $1, TAG236
sll $2, $1, 8
TAG236:
subu $2, $2, $2
addu $3, $2, $2
sh $3, 0($2)
beq $2, $3, TAG237
TAG237:
sra $3, $3, 10
multu $3, $3
mtlo $3
beq $3, $3, TAG238
TAG238:
srav $1, $3, $3
sw $1, 0($1)
beq $3, $1, TAG239
lui $1, 0
TAG239:
mflo $3
bgtz $3, TAG240
srl $2, $1, 6
sw $2, 0($2)
TAG240:
xori $1, $2, 13
mult $2, $1
mult $2, $1
bne $2, $1, TAG241
TAG241:
sb $1, 0($1)
lui $1, 4
divu $1, $1
lui $2, 5
TAG242:
mtlo $2
div $2, $2
mthi $2
beq $2, $2, TAG243
TAG243:
sll $0, $0, 0
lui $4, 13
mfhi $4
bltz $2, TAG244
TAG244:
sll $0, $0, 0
xori $2, $4, 10
sll $0, $0, 0
xori $4, $4, 1
TAG245:
mthi $4
bne $4, $4, TAG246
mflo $3
andi $1, $3, 15
TAG246:
bne $1, $1, TAG247
mfhi $2
lb $4, 0($1)
lhu $4, 0($4)
TAG247:
add $1, $4, $4
bne $1, $1, TAG248
srl $3, $1, 15
mthi $4
TAG248:
beq $3, $3, TAG249
lhu $2, 0($3)
xor $4, $2, $2
lw $3, 0($3)
TAG249:
slti $2, $3, 3
lbu $4, 0($2)
bne $4, $2, TAG250
mfhi $3
TAG250:
sh $3, 0($3)
sll $4, $3, 11
bne $4, $4, TAG251
lui $2, 10
TAG251:
sll $0, $0, 0
mtlo $3
mult $3, $3
mfhi $1
TAG252:
addu $3, $1, $1
xori $2, $3, 2
sw $3, 0($3)
blez $2, TAG253
TAG253:
div $2, $2
xori $3, $2, 10
andi $3, $3, 6
lhu $1, 0($2)
TAG254:
lw $3, 0($1)
blez $3, TAG255
sb $1, 0($1)
bgez $3, TAG255
TAG255:
subu $4, $3, $3
lui $3, 12
mthi $4
multu $4, $4
TAG256:
sll $4, $3, 5
beq $3, $4, TAG257
sll $0, $0, 0
sll $0, $0, 0
TAG257:
mtlo $2
lui $4, 5
divu $2, $4
mthi $4
TAG258:
mthi $4
bgez $4, TAG259
addiu $2, $4, 11
xori $3, $2, 13
TAG259:
bgtz $3, TAG260
ori $4, $3, 14
sb $3, 0($4)
multu $4, $4
TAG260:
bne $4, $4, TAG261
sll $0, $0, 0
bgez $4, TAG261
mtlo $4
TAG261:
blez $4, TAG262
mflo $2
subu $1, $4, $4
or $3, $2, $2
TAG262:
mfhi $4
bgez $4, TAG263
mult $4, $3
beq $3, $4, TAG263
TAG263:
mfhi $1
beq $1, $4, TAG264
mthi $1
srl $2, $4, 13
TAG264:
lbu $2, 0($2)
bgez $2, TAG265
mflo $4
lb $2, 0($4)
TAG265:
lui $1, 12
div $2, $1
lbu $2, 0($2)
lh $1, 0($2)
TAG266:
lhu $1, 0($1)
blez $1, TAG267
sub $2, $1, $1
mflo $4
TAG267:
sll $0, $0, 0
lui $4, 2
lui $4, 2
sll $0, $0, 0
TAG268:
mflo $3
slti $3, $4, 2
lui $3, 8
div $3, $3
TAG269:
sra $1, $3, 11
xor $4, $1, $1
sh $3, 0($4)
or $3, $3, $4
TAG270:
subu $2, $3, $3
beq $3, $3, TAG271
mthi $2
bgtz $2, TAG271
TAG271:
multu $2, $2
mtlo $2
mfhi $1
lh $3, 0($1)
TAG272:
lbu $2, 0($3)
mflo $2
lui $4, 15
multu $2, $3
TAG273:
beq $4, $4, TAG274
mflo $4
lui $3, 9
sb $3, 0($4)
TAG274:
mult $3, $3
sll $3, $3, 11
mtlo $3
mfhi $2
TAG275:
mult $2, $2
sra $1, $2, 12
sub $1, $2, $2
bne $2, $1, TAG276
TAG276:
sltu $3, $1, $1
sb $3, 0($3)
mthi $3
lui $2, 8
TAG277:
bne $2, $2, TAG278
mult $2, $2
mflo $2
sh $2, 0($2)
TAG278:
xori $2, $2, 13
slt $1, $2, $2
nor $1, $2, $1
lui $3, 8
TAG279:
mthi $3
subu $3, $3, $3
beq $3, $3, TAG280
mflo $4
TAG280:
lui $2, 1
lui $2, 14
lui $2, 0
bltz $2, TAG281
TAG281:
lui $4, 5
mflo $2
mtlo $2
sll $0, $0, 0
TAG282:
mflo $3
sh $2, 0($2)
slti $4, $3, 3
mflo $3
TAG283:
mtlo $3
bltz $3, TAG284
lh $2, 0($3)
lui $1, 4
TAG284:
addu $4, $1, $1
sltiu $2, $4, 7
mtlo $1
srl $2, $2, 14
TAG285:
bne $2, $2, TAG286
sh $2, 0($2)
sw $2, 0($2)
lhu $1, 0($2)
TAG286:
mthi $1
mult $1, $1
srlv $3, $1, $1
sw $1, 0($1)
TAG287:
mult $3, $3
mthi $3
and $3, $3, $3
mthi $3
TAG288:
sb $3, 0($3)
mflo $3
mult $3, $3
srlv $3, $3, $3
TAG289:
mult $3, $3
addiu $3, $3, 12
lw $2, 0($3)
nor $2, $3, $2
TAG290:
multu $2, $2
lui $3, 2
divu $3, $3
mflo $2
TAG291:
sb $2, 0($2)
mthi $2
sb $2, 0($2)
lui $1, 2
TAG292:
bne $1, $1, TAG293
multu $1, $1
sll $0, $0, 0
divu $2, $2
TAG293:
srl $4, $2, 5
mtlo $2
mult $4, $2
mult $2, $2
TAG294:
and $2, $4, $4
lui $1, 9
multu $4, $4
mult $4, $4
TAG295:
mthi $1
sll $0, $0, 0
blez $1, TAG296
lui $4, 12
TAG296:
bne $4, $4, TAG297
lui $4, 14
bltz $4, TAG297
slti $4, $4, 13
TAG297:
multu $4, $4
mthi $4
sub $3, $4, $4
mtlo $4
TAG298:
bne $3, $3, TAG299
mflo $4
mtlo $3
lb $2, 0($3)
TAG299:
lhu $4, 0($2)
lui $3, 12
multu $3, $2
sll $0, $0, 0
TAG300:
sll $0, $0, 0
subu $2, $3, $3
mtlo $3
addiu $3, $2, 7
TAG301:
multu $3, $3
sb $3, 0($3)
xor $4, $3, $3
bgez $3, TAG302
TAG302:
lbu $2, 0($4)
multu $4, $4
mult $2, $4
lw $2, 0($4)
TAG303:
sllv $4, $2, $2
andi $4, $2, 4
bne $2, $4, TAG304
mflo $1
TAG304:
bne $1, $1, TAG305
srlv $1, $1, $1
mfhi $2
addiu $2, $1, 5
TAG305:
sb $2, 0($2)
lui $4, 15
mflo $2
lui $2, 15
TAG306:
slt $4, $2, $2
sw $2, 0($4)
sll $0, $0, 0
sw $2, 0($4)
TAG307:
bgtz $4, TAG308
lh $1, 0($4)
slti $4, $4, 15
srlv $1, $4, $4
TAG308:
or $3, $1, $1
addiu $1, $3, 15
lbu $3, 0($1)
bgtz $3, TAG309
TAG309:
srlv $3, $3, $3
bne $3, $3, TAG310
lui $1, 14
subu $1, $3, $3
TAG310:
mflo $2
sw $2, 0($2)
sb $2, 0($1)
mfhi $4
TAG311:
lw $2, 0($4)
beq $4, $4, TAG312
lui $3, 13
sllv $1, $3, $2
TAG312:
bgez $1, TAG313
xori $1, $1, 13
lhu $1, 0($1)
sra $4, $1, 7
TAG313:
lui $3, 9
ori $4, $3, 11
bgtz $3, TAG314
sll $0, $0, 0
TAG314:
bne $3, $3, TAG315
sll $0, $0, 0
beq $1, $3, TAG315
sll $0, $0, 0
TAG315:
mthi $1
lui $2, 9
bne $2, $1, TAG316
mthi $1
TAG316:
blez $2, TAG317
sll $0, $0, 0
sll $0, $0, 0
sll $0, $0, 0
TAG317:
sll $0, $0, 0
srl $3, $4, 2
bltz $4, TAG318
andi $3, $3, 13
TAG318:
mthi $3
mtlo $3
lbu $1, 0($3)
mfhi $1
TAG319:
sb $1, 0($1)
bgtz $1, TAG320
sb $1, 0($1)
mtlo $1
TAG320:
beq $1, $1, TAG321
lui $3, 3
lh $3, 0($3)
sb $3, 0($3)
TAG321:
mthi $3
nor $3, $3, $3
lui $1, 10
lui $3, 5
TAG322:
xori $4, $3, 5
lui $4, 10
lui $1, 6
addiu $2, $1, 5
TAG323:
mult $2, $2
mult $2, $2
sll $0, $0, 0
beq $2, $3, TAG324
TAG324:
multu $3, $3
bne $3, $3, TAG325
mtlo $3
lui $4, 14
TAG325:
mult $4, $4
addiu $3, $4, 1
bltz $3, TAG326
mflo $1
TAG326:
beq $1, $1, TAG327
lui $1, 11
sll $2, $1, 2
bgtz $1, TAG327
TAG327:
mult $2, $2
lui $2, 7
bne $2, $2, TAG328
mfhi $2
TAG328:
sltiu $3, $2, 3
subu $2, $2, $2
sll $1, $3, 13
multu $1, $3
TAG329:
lui $3, 0
sltu $2, $1, $3
mfhi $1
srav $3, $1, $1
TAG330:
bne $3, $3, TAG331
slti $1, $3, 7
sltu $1, $3, $3
mthi $1
TAG331:
sw $1, 0($1)
lui $1, 8
sll $0, $0, 0
sll $0, $0, 0
TAG332:
mthi $1
srav $2, $1, $1
sll $0, $0, 0
lui $1, 11
TAG333:
sll $0, $0, 0
mflo $1
mthi $1
sb $4, 0($1)
TAG334:
lui $3, 1
mtlo $3
sltiu $2, $3, 10
lui $4, 10
TAG335:
sll $2, $4, 2
lui $4, 6
beq $4, $4, TAG336
mtlo $4
TAG336:
srl $4, $4, 15
mfhi $3
add $1, $3, $4
multu $1, $4
TAG337:
bgtz $1, TAG338
mfhi $2
mtlo $2
bgez $2, TAG338
TAG338:
mfhi $3
addiu $3, $3, 3
addiu $4, $3, 2
lui $2, 10
TAG339:
mthi $2
beq $2, $2, TAG340
slti $4, $2, 0
lbu $2, 0($4)
TAG340:
sll $0, $0, 0
bne $2, $2, TAG341
sll $0, $0, 0
lui $1, 0
TAG341:
bne $1, $1, TAG342
mfhi $4
slti $1, $1, 3
bne $1, $1, TAG342
TAG342:
mtlo $1
nor $4, $1, $1
bgtz $1, TAG343
mflo $2
TAG343:
beq $2, $2, TAG344
subu $1, $2, $2
blez $2, TAG344
sh $2, 0($1)
TAG344:
bltz $1, TAG345
lui $4, 15
beq $1, $1, TAG345
sltu $4, $4, $1
TAG345:
sll $3, $4, 1
mtlo $3
sh $3, 0($3)
sh $3, 0($4)
TAG346:
mthi $3
mtlo $3
xori $3, $3, 10
sh $3, 0($3)
TAG347:
bne $3, $3, TAG348
lui $1, 2
mflo $1
mult $3, $3
TAG348:
lbu $2, 0($1)
andi $2, $2, 7
sb $1, 0($1)
mthi $1
TAG349:
sw $2, 0($2)
mflo $3
or $4, $3, $2
sh $4, 0($3)
TAG350:
lui $2, 9
slt $3, $2, $2
mfhi $1
addiu $4, $1, 13
TAG351:
sb $4, 0($4)
mthi $4
sb $4, 0($4)
mfhi $1
TAG352:
slti $1, $1, 12
addiu $3, $1, 1
sb $1, 0($1)
lui $4, 8
TAG353:
sll $0, $0, 0
lui $3, 3
mthi $4
sll $0, $0, 0
TAG354:
subu $3, $3, $3
addu $2, $3, $3
mflo $2
mtlo $2
TAG355:
mtlo $2
lui $1, 11
mfhi $4
sltiu $1, $1, 13
TAG356:
xor $2, $1, $1
mult $1, $2
sltiu $3, $2, 7
blez $1, TAG357
TAG357:
sra $2, $3, 13
mthi $3
bgtz $2, TAG358
mtlo $3
TAG358:
multu $2, $2
multu $2, $2
mflo $2
lw $3, 0($2)
TAG359:
sw $3, 0($3)
sw $3, 0($3)
lui $3, 12
mtlo $3
TAG360:
addu $2, $3, $3
mtlo $2
mthi $3
sll $0, $0, 0
TAG361:
mtlo $2
mtlo $2
sltiu $4, $2, 15
mtlo $2
TAG362:
xor $4, $4, $4
mthi $4
lb $2, 0($4)
mflo $1
TAG363:
lui $2, 0
beq $2, $2, TAG364
div $2, $1
andi $4, $2, 9
TAG364:
blez $4, TAG365
add $3, $4, $4
div $3, $4
bgtz $4, TAG365
TAG365:
lui $4, 15
sh $3, 0($3)
mult $4, $3
sll $0, $0, 0
TAG366:
sll $0, $0, 0
and $3, $4, $4
multu $3, $4
multu $4, $4
TAG367:
lui $4, 6
sll $0, $0, 0
multu $4, $1
srlv $4, $4, $1
TAG368:
sll $0, $0, 0
sll $0, $0, 0
lui $4, 4
andi $1, $4, 9
TAG369:
and $2, $1, $1
bne $1, $2, TAG370
mult $2, $1
sltiu $2, $1, 9
TAG370:
lui $2, 15
beq $2, $2, TAG371
lui $4, 11
beq $4, $4, TAG371
TAG371:
multu $4, $4
bne $4, $4, TAG372
multu $4, $4
lui $2, 4
TAG372:
mtlo $2
multu $2, $2
div $2, $2
sll $0, $0, 0
TAG373:
lui $1, 0
blez $3, TAG374
or $3, $1, $1
andi $4, $3, 0
TAG374:
lhu $1, 0($4)
bne $1, $4, TAG375
mthi $4
lhu $3, 0($4)
TAG375:
mult $3, $3
blez $3, TAG376
sh $3, 0($3)
mfhi $3
TAG376:
bne $3, $3, TAG377
slti $2, $3, 1
xori $3, $3, 5
sltiu $3, $2, 6
TAG377:
mtlo $3
mult $3, $3
addiu $4, $3, 14
bgez $4, TAG378
TAG378:
lui $1, 4
addu $3, $1, $1
sb $4, 0($4)
beq $4, $3, TAG379
TAG379:
slt $4, $3, $3
mfhi $3
sltiu $2, $3, 7
lui $1, 6
TAG380:
beq $1, $1, TAG381
mflo $3
lui $3, 4
mtlo $3
TAG381:
bne $3, $3, TAG382
multu $3, $3
sb $3, 0($3)
sb $3, 0($3)
TAG382:
sb $3, 0($3)
bne $3, $3, TAG383
lui $2, 12
bgez $2, TAG383
TAG383:
divu $2, $2
blez $2, TAG384
multu $2, $2
mthi $2
TAG384:
bltz $2, TAG385
addu $4, $2, $2
sll $0, $0, 0
sll $0, $0, 0
TAG385:
lui $1, 1
addiu $3, $1, 6
bne $1, $1, TAG386
mult $1, $3
TAG386:
multu $3, $3
sll $0, $0, 0
lui $1, 4
lui $4, 0
TAG387:
srav $4, $4, $4
lbu $1, 0($4)
bne $4, $4, TAG388
mtlo $1
TAG388:
sllv $2, $1, $1
sb $1, 0($1)
sb $2, 0($2)
sw $1, 0($2)
TAG389:
mthi $2
mthi $2
beq $2, $2, TAG390
sh $2, 0($2)
TAG390:
ori $2, $2, 15
divu $2, $2
sb $2, 0($2)
xor $1, $2, $2
TAG391:
lhu $4, 0($1)
sw $1, 0($1)
sra $3, $1, 15
lui $3, 6
TAG392:
srav $2, $3, $3
bgtz $2, TAG393
subu $4, $3, $2
sb $3, 0($4)
TAG393:
sh $4, 0($4)
beq $4, $4, TAG394
mthi $4
mfhi $1
TAG394:
bltz $1, TAG395
addu $1, $1, $1
lui $2, 4
lui $1, 12
TAG395:
srlv $2, $1, $1
bgtz $2, TAG396
sll $0, $0, 0
mthi $1
TAG396:
slt $3, $2, $2
bgez $3, TAG397
mtlo $3
lui $2, 14
TAG397:
sll $0, $0, 0
lui $2, 10
mult $2, $2
sll $0, $0, 0
TAG398:
lui $2, 3
srav $4, $2, $2
mfhi $2
beq $4, $2, TAG399
TAG399:
mfhi $4
addiu $3, $4, 4
lw $3, 0($4)
bne $3, $4, TAG400
TAG400:
lui $4, 8
sll $0, $0, 0
mtlo $3
bltz $4, TAG401
TAG401:
sll $0, $0, 0
mthi $4
mfhi $2
beq $2, $4, TAG402
TAG402:
mtlo $2
sll $0, $0, 0
bltz $2, TAG403
multu $2, $2
TAG403:
mtlo $2
bne $2, $2, TAG404
div $2, $2
or $3, $2, $2
TAG404:
sll $0, $0, 0
bne $3, $3, TAG405
sll $0, $0, 0
bgtz $3, TAG405
TAG405:
mflo $4
xor $3, $2, $4
mthi $2
blez $3, TAG406
TAG406:
mfhi $4
srl $1, $4, 10
lui $2, 13
bltz $1, TAG407
TAG407:
lui $2, 8
sll $3, $2, 11
bne $2, $2, TAG408
mult $2, $3
TAG408:
bne $3, $3, TAG409
sltiu $1, $3, 12
blez $3, TAG409
mthi $3
TAG409:
lhu $3, 0($1)
multu $3, $3
sh $1, 0($3)
lui $1, 15
TAG410:
bgtz $1, TAG411
divu $1, $1
srl $2, $1, 8
sh $1, 0($1)
TAG411:
addu $1, $2, $2
addu $2, $2, $2
bltz $2, TAG412
divu $2, $2
TAG412:
div $2, $2
beq $2, $2, TAG413
sra $3, $2, 1
multu $3, $3
TAG413:
beq $3, $3, TAG414
sll $0, $0, 0
xori $4, $1, 5
sh $1, 0($1)
TAG414:
mflo $2
mfhi $2
beq $2, $2, TAG415
lui $1, 11
TAG415:
bgez $1, TAG416
srl $1, $1, 15
bne $1, $1, TAG416
mthi $1
TAG416:
lui $3, 14
mthi $1
bne $1, $3, TAG417
sll $0, $0, 0
TAG417:
lui $4, 3
mflo $4
sb $4, 0($4)
multu $4, $2
TAG418:
mthi $4
andi $2, $4, 10
mfhi $3
lbu $2, 0($2)
TAG419:
slti $2, $2, 8
mflo $4
addu $1, $2, $2
bgez $2, TAG420
TAG420:
sh $1, 0($1)
mflo $3
lui $4, 2
lw $4, 0($3)
TAG421:
mult $4, $4
mult $4, $4
bne $4, $4, TAG422
mfhi $2
TAG422:
lui $2, 15
mthi $2
beq $2, $2, TAG423
sll $0, $0, 0
TAG423:
div $2, $2
div $2, $2
lui $1, 0
beq $2, $2, TAG424
TAG424:
addiu $1, $1, 1
blez $1, TAG425
lui $1, 4
addu $4, $1, $1
TAG425:
sltu $1, $4, $4
mfhi $1
mthi $1
mflo $1
TAG426:
sb $1, 0($1)
bgez $1, TAG427
ori $2, $1, 4
mtlo $1
TAG427:
mthi $2
lui $2, 4
beq $2, $2, TAG428
div $2, $2
TAG428:
bne $2, $2, TAG429
mult $2, $2
nor $4, $2, $2
sll $0, $0, 0
TAG429:
sll $0, $0, 0
andi $2, $4, 0
bne $2, $2, TAG430
lui $4, 13
TAG430:
mflo $1
sh $1, 0($1)
sll $0, $0, 0
bne $1, $1, TAG431
TAG431:
multu $1, $1
mtlo $1
mthi $1
sb $1, 0($1)
TAG432:
lui $3, 8
sb $1, 0($1)
lbu $1, 0($1)
and $4, $1, $1
TAG433:
mult $4, $4
sltu $4, $4, $4
mult $4, $4
mult $4, $4
TAG434:
lw $3, 0($4)
mfhi $3
beq $4, $3, TAG435
sh $4, 0($3)
TAG435:
sb $3, 0($3)
lb $1, 0($3)
mtlo $3
mflo $2
TAG436:
mfhi $2
mult $2, $2
lui $3, 9
bgez $2, TAG437
TAG437:
mthi $3
bne $3, $3, TAG438
and $3, $3, $3
xori $1, $3, 10
TAG438:
bne $1, $1, TAG439
mthi $1
nor $4, $1, $1
mfhi $1
TAG439:
bgtz $1, TAG440
mfhi $2
mflo $4
xor $2, $4, $2
TAG440:
sll $0, $0, 0
bltz $2, TAG441
sltiu $3, $2, 5
lhu $4, 0($3)
TAG441:
bne $4, $4, TAG442
mflo $3
sb $3, 0($3)
multu $4, $4
TAG442:
lb $4, 0($3)
multu $4, $4
mfhi $1
addu $3, $3, $3
TAG443:
bltz $3, TAG444
xor $1, $3, $3
andi $2, $1, 9
beq $3, $2, TAG444
TAG444:
addi $1, $2, 14
bne $2, $2, TAG445
add $3, $2, $1
lbu $4, 0($1)
TAG445:
mult $4, $4
bltz $4, TAG446
mtlo $4
sh $4, 0($4)
TAG446:
blez $4, TAG447
lui $4, 13
bgez $4, TAG447
lui $2, 2
TAG447:
mthi $2
bne $2, $2, TAG448
lui $4, 10
mflo $3
TAG448:
srl $4, $3, 9
mflo $3
lui $1, 3
sb $3, 0($3)
TAG449:
div $1, $1
or $1, $1, $1
multu $1, $1
bne $1, $1, TAG450
TAG450:
sll $0, $0, 0
bne $2, $1, TAG451
mult $1, $1
bne $1, $1, TAG451
TAG451:
mfhi $4
mult $4, $2
sb $4, 0($4)
bltz $2, TAG452
TAG452:
lbu $2, 0($4)
mflo $2
bgtz $4, TAG453
mflo $3
TAG453:
bgez $3, TAG454
lui $2, 3
beq $3, $2, TAG454
divu $2, $3
TAG454:
bne $2, $2, TAG455
lui $4, 12
bltz $2, TAG455
mtlo $2
TAG455:
divu $4, $4
lui $1, 13
lui $1, 4
lui $3, 10
TAG456:
bne $3, $3, TAG457
mtlo $3
subu $3, $3, $3
lui $4, 3
TAG457:
lui $1, 11
lui $2, 10
bne $1, $2, TAG458
divu $4, $2
TAG458:
sll $0, $0, 0
mult $2, $2
sll $0, $0, 0
beq $2, $2, TAG459
TAG459:
mfhi $2
blez $3, TAG460
and $3, $2, $3
lw $1, 0($2)
TAG460:
mtlo $1
mfhi $1
mflo $2
sll $0, $0, 0
TAG461:
xori $1, $2, 12
sll $0, $0, 0
xori $2, $1, 3
sll $0, $0, 0
TAG462:
sra $3, $3, 7
bne $3, $3, TAG463
sllv $4, $3, $3
mthi $3
TAG463:
bne $4, $4, TAG464
slti $3, $4, 7
mthi $4
multu $3, $3
TAG464:
lui $1, 3
beq $3, $3, TAG465
lui $2, 14
mflo $1
TAG465:
xori $2, $1, 4
bne $1, $2, TAG466
subu $4, $2, $2
div $1, $1
TAG466:
nor $1, $4, $4
sb $1, 1($1)
multu $4, $1
bne $4, $4, TAG467
TAG467:
multu $1, $1
mfhi $3
sh $1, 2($3)
beq $1, $3, TAG468
TAG468:
sb $3, 2($3)
divu $3, $3
sw $3, 2($3)
sh $3, 2($3)
TAG469:
xori $3, $3, 4
sllv $2, $3, $3
mflo $2
mthi $3
TAG470:
subu $2, $2, $2
mult $2, $2
mthi $2
beq $2, $2, TAG471
TAG471:
ori $1, $2, 3
beq $2, $2, TAG472
nor $3, $1, $1
lui $2, 6
TAG472:
lui $2, 5
addiu $3, $2, 15
bgez $3, TAG473
and $1, $2, $2
TAG473:
sll $0, $0, 0
andi $4, $1, 6
sll $0, $0, 0
multu $4, $1
TAG474:
mult $4, $4
blez $4, TAG475
ori $2, $4, 2
xori $4, $4, 9
TAG475:
slt $2, $4, $4
lui $3, 14
sub $3, $2, $2
sltu $4, $3, $3
TAG476:
lui $3, 1
mtlo $3
lui $1, 13
beq $3, $1, TAG477
TAG477:
mthi $1
bgez $1, TAG478
mult $1, $1
mflo $4
TAG478:
multu $4, $4
slt $4, $4, $4
sb $4, 0($4)
lui $2, 15
TAG479:
multu $2, $2
mflo $1
sh $1, 0($1)
sll $0, $0, 0
TAG480:
mflo $1
blez $1, TAG481
sb $1, 0($1)
mthi $1
TAG481:
sb $1, 0($1)
sb $1, 0($1)
sb $1, 0($1)
lb $4, 0($1)
TAG482:
sub $1, $4, $4
and $4, $4, $1
multu $4, $1
lui $2, 0
TAG483:
sb $2, 0($2)
bne $2, $2, TAG484
lui $4, 7
sb $4, 0($2)
TAG484:
bne $4, $4, TAG485
sll $0, $0, 0
addiu $3, $3, 2
sll $4, $3, 13
TAG485:
mfhi $3
sll $0, $0, 0
sh $4, 0($3)
bne $3, $4, TAG486
TAG486:
lui $1, 13
lui $4, 7
sw $1, 0($3)
bne $4, $4, TAG487
TAG487:
mtlo $4
and $4, $4, $4
sll $0, $0, 0
sll $0, $0, 0
TAG488:
beq $4, $4, TAG489
mfhi $2
bgez $2, TAG489
lui $2, 0
TAG489:
lui $1, 5
lui $1, 15
mflo $2
sra $4, $2, 5
TAG490:
or $4, $4, $4
bne $4, $4, TAG491
lui $4, 7
lui $3, 7
TAG491:
srl $2, $3, 12
sltiu $2, $3, 14
mflo $2
ori $2, $2, 3
TAG492:
sll $0, $0, 0
bne $2, $2, TAG493
sll $0, $0, 0
srav $3, $2, $2
TAG493:
mtlo $3
blez $3, TAG494
mthi $3
srlv $2, $3, $3
TAG494:
sll $0, $0, 0
beq $2, $2, TAG495
addu $3, $2, $2
sw $2, 0($3)
TAG495:
subu $1, $3, $3
mthi $1
bltz $3, TAG496
divu $1, $3
TAG496:
sll $3, $1, 11
mult $1, $1
beq $1, $1, TAG497
mfhi $1
TAG497:
bgez $1, TAG498
mfhi $3
sra $4, $3, 12
sw $4, 0($4)
TAG498:
ori $3, $4, 8
sll $0, $0, 0
xor $4, $4, $4
div $4, $3
TAG499:
lbu $3, 0($4)
beq $3, $4, TAG500
lw $1, 0($3)
bgez $4, TAG500
TAG500:
lui $3, 4
or $1, $1, $1
mfhi $4
sll $0, $0, 0
TAG501:
lh $3, 0($4)
mfhi $3
add $3, $4, $3
multu $3, $3
TAG502:
mthi $3
bltz $3, TAG503
sra $3, $3, 1
add $3, $3, $3
TAG503:
lui $1, 3
bne $1, $3, TAG504
xori $4, $1, 9
sltu $2, $3, $4
TAG504:
sll $0, $0, 0
mtlo $2
bne $2, $2, TAG505
mfhi $4
TAG505:
mthi $4
mtlo $4
sh $4, 0($4)
nor $1, $4, $4
TAG506:
mflo $2
mult $1, $2
lb $2, 0($2)
lhu $3, 0($2)
TAG507:
srl $3, $3, 0
mfhi $3
mthi $3
xor $3, $3, $3
TAG508:
multu $3, $3
addi $1, $3, 3
sub $2, $3, $3
sb $2, 0($2)
TAG509:
blez $2, TAG510
lui $4, 12
sw $4, 0($2)
lui $4, 4
TAG510:
mtlo $4
lui $3, 0
lui $2, 5
sll $4, $3, 14
TAG511:
mthi $4
sh $4, 0($4)
sh $4, 0($4)
slti $3, $4, 13
TAG512:
blez $3, TAG513
lui $3, 5
bgez $3, TAG513
addiu $2, $3, 3
TAG513:
bgez $2, TAG514
addiu $4, $2, 1
div $2, $2
xor $1, $4, $4
TAG514:
lb $2, 0($1)
divu $2, $1
beq $2, $2, TAG515
add $3, $2, $2
TAG515:
multu $3, $3
srlv $3, $3, $3
add $1, $3, $3
sw $3, 0($1)
TAG516:
beq $1, $1, TAG517
mthi $1
mtlo $1
lbu $2, 0($1)
TAG517:
mthi $2
mtlo $2
mult $2, $2
mult $2, $2
TAG518:
beq $2, $2, TAG519
lb $3, 0($2)
mflo $2
nor $1, $3, $2
TAG519:
bltz $1, TAG520
mflo $3
srlv $4, $3, $3
bgez $1, TAG520
TAG520:
lbu $3, 0($4)
lhu $2, 0($4)
lb $3, 0($4)
lbu $2, 0($2)
TAG521:
lbu $4, 0($2)
sb $2, 0($2)
lui $1, 12
multu $1, $2
TAG522:
sll $0, $0, 0
sll $0, $0, 0
lui $1, 15
sll $0, $0, 0
TAG523:
mfhi $1
lui $2, 13
mfhi $4
beq $1, $1, TAG524
TAG524:
mtlo $4
addu $4, $4, $4
bne $4, $4, TAG525
mult $4, $4
TAG525:
multu $4, $4
sw $4, 0($4)
lw $2, 0($4)
subu $3, $2, $4
TAG526:
mult $3, $3
sub $2, $3, $3
blez $2, TAG527
or $4, $3, $2
TAG527:
srlv $1, $4, $4
beq $1, $1, TAG528
mfhi $2
blez $1, TAG528
TAG528:
sw $2, 0($2)
lhu $1, 0($2)
bgez $1, TAG529
subu $3, $1, $2
TAG529:
sb $3, 0($3)
multu $3, $3
bgtz $3, TAG530
lui $2, 14
TAG530:
addiu $4, $2, 9
lui $4, 2
sra $2, $4, 12
multu $2, $2
TAG531:
bgtz $2, TAG532
divu $2, $2
mtlo $2
lui $3, 9
TAG532:
lb $1, 0($3)
bne $3, $1, TAG533
mfhi $1
sh $3, 0($1)
TAG533:
lh $4, 0($1)
sw $1, 0($4)
bne $1, $1, TAG534
mult $4, $1
TAG534:
mthi $4
mtlo $4
sw $4, 0($4)
bgez $4, TAG535
TAG535:
sltu $2, $4, $4
sh $4, 0($2)
subu $1, $4, $2
blez $4, TAG536
TAG536:
mflo $3
beq $3, $1, TAG537
multu $3, $1
mflo $2
TAG537:
mult $2, $2
blez $2, TAG538
lui $4, 8
lui $1, 4
TAG538:
mflo $3
srl $3, $1, 11
mflo $4
lbu $2, 0($3)
TAG539:
lw $2, 0($2)
sh $2, 0($2)
xor $2, $2, $2
lui $4, 11
TAG540:
beq $4, $4, TAG541
sll $0, $0, 0
bgtz $4, TAG541
sw $4, 0($4)
TAG541:
div $4, $4
sll $0, $0, 0
sh $4, 0($3)
mult $3, $3
TAG542:
multu $3, $3
mfhi $4
add $4, $4, $3
bne $3, $4, TAG543
TAG543:
multu $4, $4
blez $4, TAG544
lui $1, 10
beq $4, $4, TAG544
TAG544:
mtlo $1
sltiu $3, $1, 8
xori $2, $1, 8
lui $3, 6
TAG545:
mflo $1
multu $1, $3
mflo $3
lbu $1, 0($3)
TAG546:
bltz $1, TAG547
sh $1, 0($1)
xori $2, $1, 4
addiu $3, $2, 12
TAG547:
mthi $3
andi $2, $3, 3
bgez $2, TAG548
mult $3, $2
TAG548:
mthi $2
beq $2, $2, TAG549
mflo $3
lui $3, 15
TAG549:
addiu $2, $3, 0
mthi $3
bne $3, $3, TAG550
mthi $3
TAG550:
lw $2, 0($2)
beq $2, $2, TAG551
multu $2, $2
mtlo $2
TAG551:
sra $4, $2, 3
bgtz $4, TAG552
lui $2, 1
lui $2, 3
TAG552:
xor $2, $2, $2
beq $2, $2, TAG553
slti $3, $2, 1
mthi $3
TAG553:
mfhi $1
addu $2, $3, $1
bne $3, $1, TAG554
nor $4, $1, $3
TAG554:
bltz $4, TAG555
multu $4, $4
bne $4, $4, TAG555
mult $4, $4
TAG555:
mflo $1
beq $1, $4, TAG556
mthi $4
sra $1, $4, 4
TAG556:
lui $1, 9
divu $1, $1
sll $0, $0, 0
lui $4, 6
TAG557:
andi $3, $4, 15
xor $2, $4, $4
mtlo $3
or $3, $4, $3
TAG558:
sll $0, $0, 0
sll $0, $0, 0
beq $3, $2, TAG559
mflo $2
TAG559:
mtlo $2
sra $2, $2, 9
multu $2, $2
lw $2, 0($2)
TAG560:
mfhi $4
sb $2, 0($4)
mtlo $4
lui $4, 9
TAG561:
mtlo $4
multu $4, $4
sll $0, $0, 0
sll $0, $0, 0
TAG562:
sll $0, $0, 0
sltiu $4, $2, 5
sw $3, 0($2)
mult $2, $2
TAG563:
and $1, $4, $4
mfhi $3
mthi $4
addiu $4, $3, 11
TAG564:
srl $3, $4, 6
srav $4, $4, $4
lui $1, 8
lui $2, 4
TAG565:
lui $3, 12
mflo $4
ori $2, $2, 0
mthi $4
TAG566:
mult $2, $2
sll $0, $0, 0
lui $3, 9
mult $3, $3
TAG567:
blez $3, TAG568
lui $1, 12
lui $4, 4
bne $4, $3, TAG568
TAG568:
sll $0, $0, 0
sll $0, $0, 0
sll $0, $0, 0
multu $4, $2
TAG569:
beq $2, $2, TAG570
slti $4, $2, 9
lb $1, 0($4)
mfhi $2
TAG570:
srl $4, $2, 9
slt $3, $4, $4
mfhi $1
srl $4, $2, 11
TAG571:
bltz $4, TAG572
xori $2, $4, 9
sh $2, 0($4)
bne $2, $2, TAG572
TAG572:
mult $2, $2
sb $2, -137($2)
mtlo $2
mthi $2
TAG573:
ori $4, $2, 5
lui $1, 9
bgez $2, TAG574
sw $2, -141($4)
TAG574:
sll $0, $0, 0
sll $0, $0, 0
addiu $4, $1, 9
srav $3, $4, $4
TAG575:
mflo $2
lui $2, 10
srlv $3, $2, $2
mfhi $2
TAG576:
mtlo $2
sw $2, -137($2)
bne $2, $2, TAG577
mtlo $2
TAG577:
srlv $4, $2, $2
mtlo $2
lh $4, 0($4)
mtlo $2
TAG578:
bne $4, $4, TAG579
mtlo $4
sh $4, -137($4)
mflo $4
TAG579:
mult $4, $4
mflo $2
lui $1, 0
mflo $2
TAG580:
div $2, $2
bne $2, $2, TAG581
mtlo $2
mtlo $2
TAG581:
bne $2, $2, TAG582
mtlo $2
mthi $2
mtlo $2
TAG582:
divu $2, $2
mtlo $2
divu $2, $2
beq $2, $2, TAG583
TAG583:
sll $0, $0, 0
lui $3, 14
beq $2, $1, TAG584
divu $1, $3
TAG584:
ori $2, $3, 14
lui $4, 12
bne $2, $2, TAG585
mflo $2
TAG585:
mtlo $2
sw $2, 0($2)
mult $2, $2
bgez $2, TAG586
TAG586:
sh $2, 0($2)
lbu $1, 0($2)
bne $2, $2, TAG587
lui $4, 15
TAG587:
beq $4, $4, TAG588
sll $0, $0, 0
mflo $1
sltiu $2, $1, 5
TAG588:
bne $2, $2, TAG589
lui $4, 0
mult $2, $2
bltz $4, TAG589
TAG589:
lui $1, 12
mthi $4
mthi $4
blez $1, TAG590
TAG590:
mfhi $3
mfhi $2
xori $2, $3, 3
sltu $3, $2, $2
TAG591:
multu $3, $3
sra $4, $3, 3
multu $4, $3
beq $3, $3, TAG592
TAG592:
lui $4, 2
sll $0, $0, 0
andi $4, $4, 6
mfhi $1
TAG593:
sh $1, 0($1)
bgez $1, TAG594
lb $3, 0($1)
lui $4, 13
TAG594:
mtlo $4
mfhi $2
sb $4, 0($2)
sllv $1, $4, $4
TAG595:
blez $1, TAG596
mtlo $1
multu $1, $1
lb $3, 0($1)
TAG596:
bne $3, $3, TAG597
mfhi $1
sub $2, $1, $1
lhu $2, 0($1)
TAG597:
sw $2, 0($2)
add $2, $2, $2
sltiu $3, $2, 5
lb $4, 0($2)
TAG598:
xori $2, $4, 5
beq $4, $2, TAG599
mthi $4
mfhi $2
TAG599:
sh $2, 0($2)
bltz $2, TAG600
sw $2, 0($2)
beq $2, $2, TAG600
TAG600:
sw $2, 0($2)
lui $2, 9
srav $2, $2, $2
mtlo $2
TAG601:
sll $0, $0, 0
div $2, $2
subu $4, $2, $2
sh $4, 0($4)
TAG602:
bgtz $4, TAG603
multu $4, $4
mflo $2
mtlo $2
TAG603:
lw $3, 0($2)
mflo $1
mthi $2
sra $2, $3, 14
TAG604:
sw $2, 0($2)
mfhi $2
andi $1, $2, 0
mflo $4
TAG605:
ori $3, $4, 5
mthi $3
mult $3, $3
mfhi $4
TAG606:
lui $2, 9
sll $0, $0, 0
lh $2, 0($4)
srav $2, $4, $2
TAG607:
sub $1, $2, $2
slti $1, $2, 3
mthi $2
lb $1, 0($1)
TAG608:
addu $4, $1, $1
lbu $2, 0($4)
mflo $2
mtlo $4
TAG609:
sb $2, 0($2)
divu $2, $2
srav $4, $2, $2
beq $4, $4, TAG610
TAG610:
mtlo $4
nor $2, $4, $4
bne $2, $2, TAG611
mfhi $3
TAG611:
slti $2, $3, 11
bgez $3, TAG612
mthi $3
bgtz $2, TAG612
TAG612:
div $2, $2
sb $2, 0($2)
lbu $1, 0($2)
mflo $1
TAG613:
bne $1, $1, TAG614
nor $4, $1, $1
mflo $1
mfhi $2
TAG614:
add $2, $2, $2
lhu $1, 0($2)
mult $2, $2
mfhi $2
TAG615:
blez $2, TAG616
srav $1, $2, $2
lui $2, 12
mult $2, $2
TAG616:
bltz $2, TAG617
multu $2, $2
lbu $4, 0($2)
srl $2, $2, 9
TAG617:
sb $2, 0($2)
lw $1, 0($2)
lbu $4, -256($1)
divu $4, $1
TAG618:
mtlo $4
beq $4, $4, TAG619
lui $1, 1
addi $4, $4, 9
TAG619:
or $1, $4, $4
lui $1, 5
multu $4, $4
sll $0, $0, 0
TAG620:
beq $1, $1, TAG621
div $1, $1
beq $1, $1, TAG621
lh $1, 0($1)
TAG621:
subu $2, $1, $1
mult $1, $1
beq $1, $1, TAG622
lbu $1, 0($2)
TAG622:
slti $1, $1, 3
sb $1, 0($1)
lb $1, 0($1)
mfhi $4
TAG623:
beq $4, $4, TAG624
mflo $1
bgez $1, TAG624
sb $4, 0($1)
TAG624:
and $4, $1, $1
mflo $2
mflo $2
lui $3, 5
TAG625:
sll $0, $0, 0
sb $4, 0($4)
mfhi $3
sb $3, 0($3)
TAG626:
lbu $4, 0($3)
lb $4, 0($3)
mflo $1
lb $1, 0($3)
TAG627:
mthi $1
mtlo $1
lui $1, 1
mult $1, $1
TAG628:
srlv $1, $1, $1
blez $1, TAG629
sll $0, $0, 0
mflo $1
TAG629:
mthi $1
mtlo $1
mtlo $1
srl $1, $1, 13
TAG630:
mtlo $1
addiu $2, $1, 10
mthi $2
xor $3, $2, $2
TAG631:
addu $1, $3, $3
slt $1, $1, $3
mtlo $1
bltz $1, TAG632
TAG632:
mthi $1
bltz $1, TAG633
mfhi $1
bltz $1, TAG633
TAG633:
mflo $2
mfhi $1
mfhi $1
mfhi $2
TAG634:
multu $2, $2
slt $3, $2, $2
bne $2, $3, TAG635
lb $1, 0($2)
TAG635:
sltu $2, $1, $1
beq $2, $2, TAG636
lui $3, 5
lui $4, 2
TAG636:
mult $4, $4
blez $4, TAG637
mult $4, $4
sb $4, 0($4)
TAG637:
addiu $3, $4, 2
srlv $4, $3, $4
multu $3, $4
mthi $4
TAG638:
mult $4, $4
mtlo $4
bne $4, $4, TAG639
srl $3, $4, 0
TAG639:
mflo $3
bgtz $3, TAG640
lui $4, 0
mult $3, $3
TAG640:
srav $4, $4, $4
sw $4, 0($4)
lhu $2, 0($4)
addi $1, $4, 3
TAG641:
lui $4, 12
lui $1, 11
sll $0, $0, 0
div $4, $1
TAG642:
beq $1, $1, TAG643
lui $1, 3
mfhi $2
multu $1, $1
TAG643:
lui $3, 7
lui $1, 4
sll $0, $0, 0
sll $0, $0, 0
TAG644:
mfhi $2
bne $2, $2, TAG645
lui $3, 1
addiu $2, $2, 3
TAG645:
sll $0, $0, 0
sll $0, $0, 0
mfhi $3
bne $2, $3, TAG646
TAG646:
div $3, $3
mfhi $4
addu $2, $3, $3
mfhi $3
TAG647:
or $1, $3, $3
multu $3, $3
multu $1, $1
sltiu $2, $1, 0
TAG648:
xor $2, $2, $2
sw $2, 0($2)
sltu $2, $2, $2
lb $3, 0($2)
TAG649:
sltu $1, $3, $3
beq $3, $3, TAG650
sllv $4, $1, $3
mflo $1
TAG650:
multu $1, $1
sra $4, $1, 4
lhu $3, 0($4)
lui $2, 11
TAG651:
slt $3, $2, $2
mthi $3
div $2, $2
xor $2, $3, $3
TAG652:
sb $2, 0($2)
srlv $1, $2, $2
bgtz $1, TAG653
sh $2, 0($1)
TAG653:
bltz $1, TAG654
sh $1, 0($1)
lw $1, 0($1)
lui $2, 12
TAG654:
beq $2, $2, TAG655
and $1, $2, $2
sw $1, 0($1)
div $2, $1
TAG655:
sll $0, $0, 0
mtlo $1
sll $0, $0, 0
divu $1, $1
TAG656:
bltz $1, TAG657
addiu $3, $1, 9
lui $4, 14
sll $0, $0, 0
TAG657:
mfhi $1
blez $1, TAG658
mtlo $1
lhu $3, 0($1)
TAG658:
mflo $4
div $4, $3
sll $0, $0, 0
mflo $1
TAG659:
lw $2, 0($1)
sltu $1, $2, $1
ori $2, $1, 6
mult $1, $2
TAG660:
sltu $3, $2, $2
slt $4, $2, $3
xori $1, $2, 0
divu $4, $2
TAG661:
addu $1, $1, $1
sb $1, 0($1)
and $1, $1, $1
lbu $1, 0($1)
TAG662:
divu $1, $1
sh $1, 0($1)
mfhi $4
mfhi $2
TAG663:
bgtz $2, TAG664
multu $2, $2
mflo $1
lh $1, 0($2)
TAG664:
sh $1, 0($1)
sltiu $4, $1, 1
bne $4, $4, TAG665
mthi $4
TAG665:
mflo $1
bgez $1, TAG666
lh $3, 0($1)
lbu $3, 0($4)
TAG666:
mflo $4
lh $3, 0($3)
sb $3, 0($4)
multu $3, $4
TAG667:
srlv $1, $3, $3
lui $1, 14
sllv $1, $1, $1
mflo $3
TAG668:
bne $3, $3, TAG669
mult $3, $3
blez $3, TAG669
mthi $3
TAG669:
addiu $2, $3, 6
lui $4, 15
mult $3, $3
addiu $2, $4, 0
TAG670:
srlv $3, $2, $2
sltiu $2, $2, 1
mthi $2
mthi $3
TAG671:
sll $4, $2, 4
lui $1, 6
beq $1, $2, TAG672
mflo $1
TAG672:
sb $1, 0($1)
bltz $1, TAG673
sllv $1, $1, $1
lhu $4, 0($1)
TAG673:
sllv $2, $4, $4
bne $2, $2, TAG674
mult $4, $2
sw $4, 0($2)
TAG674:
lui $4, 12
lui $2, 8
lui $3, 12
mflo $2
TAG675:
beq $2, $2, TAG676
sub $4, $2, $2
mflo $3
lh $4, 0($4)
TAG676:
lw $2, 0($4)
slt $3, $4, $2
sw $2, 0($4)
blez $2, TAG677
TAG677:
mtlo $3
multu $3, $3
bgez $3, TAG678
mflo $3
TAG678:
bltz $3, TAG679
lui $1, 13
mfhi $3
lui $4, 5
TAG679:
srav $4, $4, $4
multu $4, $4
sll $0, $0, 0
bgez $4, TAG680
TAG680:
divu $4, $4
sll $0, $0, 0
sll $0, $0, 0
lui $3, 9
TAG681:
bne $3, $3, TAG682
sll $0, $0, 0
mthi $4
mflo $3
TAG682:
lbu $3, 0($3)
bne $3, $3, TAG683
sb $3, 0($3)
mflo $3
TAG683:
or $2, $3, $3
subu $2, $3, $3
multu $2, $3
bne $2, $2, TAG684
TAG684:
sw $2, 0($2)
lui $3, 2
mtlo $3
slti $2, $2, 6
TAG685:
beq $2, $2, TAG686
ori $1, $2, 1
nor $2, $1, $2
nor $1, $2, $1
TAG686:
bgtz $1, TAG687
sllv $3, $1, $1
bne $1, $1, TAG687
or $4, $3, $1
TAG687:
mthi $4
mthi $4
sra $1, $4, 3
mtlo $1
TAG688:
mflo $3
sll $0, $0, 0
mfhi $3
mfhi $3
TAG689:
beq $3, $3, TAG690
sltiu $2, $3, 11
sb $3, 0($2)
mtlo $3
TAG690:
mtlo $2
sb $2, 0($2)
lhu $1, 0($2)
ori $2, $2, 12
TAG691:
lbu $2, 0($2)
and $1, $2, $2
mflo $1
sb $1, 0($1)
TAG692:
bne $1, $1, TAG693
multu $1, $1
bgez $1, TAG693
sh $1, 0($1)
TAG693:
mtlo $1
sh $1, 0($1)
sb $1, 0($1)
mthi $1
TAG694:
bgez $1, TAG695
mtlo $1
mflo $4
mflo $1
TAG695:
sw $1, 0($1)
mult $1, $1
lui $3, 14
mtlo $3
TAG696:
mflo $1
div $3, $1
mfhi $1
add $4, $1, $1
TAG697:
lb $2, 0($4)
mtlo $4
sb $4, 0($4)
blez $2, TAG698
TAG698:
multu $2, $2
sb $2, 0($2)
blez $2, TAG699
addiu $4, $2, 13
TAG699:
sra $2, $4, 12
mflo $3
slti $2, $4, 7
mult $2, $3
TAG700:
beq $2, $2, TAG701
addiu $2, $2, 7
addi $4, $2, 12
mtlo $2
TAG701:
mflo $3
beq $4, $4, TAG702
sllv $4, $3, $4
mtlo $4
TAG702:
bgtz $4, TAG703
nor $2, $4, $4
sw $2, 1($2)
lui $1, 13
TAG703:
sll $0, $0, 0
sra $3, $2, 13
sll $0, $0, 0
mthi $1
TAG704:
sb $2, 1($2)
beq $2, $2, TAG705
andi $2, $2, 1
mfhi $1
TAG705:
sll $0, $0, 0
sll $0, $0, 0
sll $0, $0, 0
srav $2, $1, $1
TAG706:
beq $2, $2, TAG707
sll $0, $0, 0
lui $3, 6
lui $2, 8
TAG707:
mult $2, $2
multu $2, $2
lui $1, 6
ori $2, $2, 13
TAG708:
mthi $2
div $2, $2
nor $1, $2, $2
subu $3, $2, $2
TAG709:
sll $2, $3, 8
mult $3, $2
lui $4, 7
bgtz $4, TAG710
TAG710:
lui $2, 7
bgez $2, TAG711
mflo $3
subu $2, $3, $3
TAG711:
sll $0, $0, 0
mthi $3
sw $2, 0($3)
beq $3, $3, TAG712
TAG712:
lui $2, 5
mult $3, $3
mult $2, $3
lui $3, 0
TAG713:
blez $3, TAG714
mthi $3
add $1, $3, $3
sw $1, 0($1)
TAG714:
mflo $1
addiu $3, $1, 1
sh $3, 0($1)
or $2, $3, $3
TAG715:
mtlo $2
addu $3, $2, $2
mult $2, $2
lui $1, 10
TAG716:
addiu $4, $1, 4
multu $4, $1
multu $1, $4
bltz $1, TAG717
TAG717:
lui $2, 2
bgez $2, TAG718
mult $4, $2
bgtz $4, TAG718
TAG718:
lui $1, 8
multu $2, $1
bgez $2, TAG719
lui $3, 1
TAG719:
sll $0, $0, 0
lui $2, 10
multu $1, $3
sll $0, $0, 0
TAG720:
mtlo $2
beq $2, $2, TAG721
sra $4, $2, 8
bne $2, $2, TAG721
TAG721:
mfhi $4
mfhi $2
mflo $4
sll $4, $4, 8
TAG722:
and $3, $4, $4
mult $4, $3
mthi $4
sll $0, $0, 0
TAG723:
mult $3, $3
sll $0, $0, 0
blez $3, TAG724
sll $0, $0, 0
TAG724:
sll $0, $0, 0
mfhi $2
lui $2, 13
ori $1, $3, 13
TAG725:
sll $0, $0, 0
mflo $3
mfhi $2
mtlo $1
TAG726:
bne $2, $2, TAG727
lui $3, 7
mflo $3
sll $0, $0, 0
TAG727:
mthi $3
mfhi $4
addu $2, $3, $3
sll $0, $0, 0
TAG728:
xor $3, $2, $2
divu $3, $2
lh $1, 0($3)
bltz $1, TAG729
TAG729:
sb $1, 0($1)
lb $3, 0($1)
bne $1, $3, TAG730
lb $3, 0($3)
TAG730:
addiu $3, $3, 3
bne $3, $3, TAG731
lui $2, 5
mfhi $1
TAG731:
bne $1, $1, TAG732
mflo $2
sw $2, 0($1)
sh $2, 0($2)
TAG732:
mthi $2
multu $2, $2
sh $2, 0($2)
subu $3, $2, $2
TAG733:
mfhi $1
mthi $3
mfhi $4
addi $3, $3, 3
TAG734:
nor $2, $3, $3
mthi $3
beq $2, $2, TAG735
mthi $2
TAG735:
addiu $2, $2, 9
srlv $4, $2, $2
div $2, $2
mthi $2
TAG736:
sltu $3, $4, $4
sw $4, 0($4)
lw $2, 0($4)
beq $3, $2, TAG737
TAG737:
addu $2, $2, $2
mult $2, $2
lw $4, 0($2)
sh $2, 0($2)
TAG738:
sw $4, 0($4)
sh $4, 0($4)
lui $3, 4
bgtz $4, TAG739
TAG739:
multu $3, $3
addiu $3, $3, 14
bgez $3, TAG740
mthi $3
TAG740:
mthi $3
mfhi $1
bgez $1, TAG741
multu $3, $1
TAG741:
slti $4, $1, 13
mflo $1
lui $2, 6
lui $1, 2
TAG742:
subu $2, $1, $1
mflo $1
sltu $4, $1, $2
sll $0, $0, 0
TAG743:
bltz $1, TAG744
lui $4, 7
div $4, $4
sll $0, $0, 0
TAG744:
nor $2, $2, $2
andi $3, $2, 7
mfhi $2
bltz $2, TAG745
TAG745:
lui $4, 4
mult $2, $2
lui $2, 14
slti $1, $4, 2
TAG746:
sub $4, $1, $1
addiu $2, $1, 1
beq $4, $1, TAG747
lui $4, 9
TAG747:
beq $4, $4, TAG748
lui $1, 10
slti $3, $1, 9
mflo $1
TAG748:
xori $1, $1, 3
subu $1, $1, $1
lhu $2, 0($1)
beq $1, $1, TAG749
TAG749:
mthi $2
slti $4, $2, 6
ori $3, $2, 11
div $2, $3
TAG750:
nop
nop
test_end:
beq $0, $0, test_end
nop |
src/rejuvenation-indentation.ads | TNO/Rejuvenation-Ada | 1 | 15671 | package Rejuvenation.Indentation is
No_Indentation : constant Integer := -1;
function Indentation_Of_Node (Node : Ada_Node'Class) return Integer;
-- Note: No_Indentation signals that another non-white-space element
-- is earlier on the same line
function Node_On_Separate_Lines (Node : Ada_Node'Class) return Boolean;
-- Is Node on separate lines defined.
-- Useful for line-based pretty printing (e.g. offered by gnatpp).
end Rejuvenation.Indentation;
|
source/containers/a-cconwr.ads | ytomino/drake | 33 | 24838 | <filename>source/containers/a-cconwr.ads
pragma License (Unrestricted);
-- implementation unit
private package Ada.Containers.Copy_On_Write is
pragma Preelaborate;
type Container;
type Container_Access is access all Container;
for Container_Access'Storage_Size use 0;
Data_Size : constant := Standard'Address_Size;
type Data is limited record
Follower : Container_Access; -- first container is owner
pragma Atomic (Follower);
end record;
for Data'Size use Data_Size;
type Data_Access is access Data;
function Shared (Data : Data_Access) return Boolean;
type Container is record
Data : Data_Access;
pragma Atomic (Data);
Next_Follower : Container_Access;
pragma Atomic (Next_Follower);
end record;
procedure Adjust (
Target : not null access Container);
procedure Assign (
Target : not null access Container;
Source : not null access constant Container;
Free : not null access procedure (Object : in out Data_Access));
procedure Clear (
Target : not null access Container;
Free : not null access procedure (Object : in out Data_Access));
procedure Copy (
Target : not null access Container;
Source : not null access constant Container;
Allocate : not null access procedure (
Target : out not null Data_Access;
New_Length : Count_Type;
Capacity : Count_Type);
Copy : not null access procedure (
Target : out not null Data_Access;
Source : not null Data_Access;
Length : Count_Type; -- copying length
New_Length : Count_Type;
Capacity : Count_Type));
procedure Copy (
Target : not null access Container;
Source : not null access constant Container;
Length : Count_Type;
New_Capacity : Count_Type;
Allocate : not null access procedure (
Target : out not null Data_Access;
New_Length : Count_Type;
Capacity : Count_Type);
Copy : not null access procedure (
Target : out not null Data_Access;
Source : not null Data_Access;
Length : Count_Type; -- copying length
New_Length : Count_Type;
Capacity : Count_Type));
procedure Move (
Target : not null access Container;
Source : not null access Container;
Free : not null access procedure (Object : in out Data_Access));
procedure Unique (
Target : not null access Container;
To_Update : Boolean;
Allocate : not null access procedure (
Target : out not null Data_Access;
New_Length : Count_Type;
Capacity : Count_Type);
Move : not null access procedure (
Target : out not null Data_Access;
Source : not null Data_Access;
Length : Count_Type; -- copying length
New_Length : Count_Type;
Capacity : Count_Type);
Copy : not null access procedure (
Target : out not null Data_Access;
Source : not null Data_Access;
Length : Count_Type; -- copying length
New_Length : Count_Type;
Capacity : Count_Type);
Free : not null access procedure (Object : in out Data_Access));
procedure Unique (
Target : not null access Container;
Target_Length : Count_Type;
Target_Capacity : Count_Type;
New_Length : Count_Type;
New_Capacity : Count_Type;
To_Update : Boolean;
Allocate : not null access procedure (
Target : out not null Data_Access;
New_Length : Count_Type;
Capacity : Count_Type);
Move : not null access procedure (
Target : out not null Data_Access;
Source : not null Data_Access;
Length : Count_Type; -- copying length
New_Length : Count_Type;
Capacity : Count_Type);
Copy : not null access procedure (
Target : out not null Data_Access;
Source : not null Data_Access;
Length : Count_Type; -- copying length
New_Length : Count_Type;
Capacity : Count_Type);
Free : not null access procedure (Object : in out Data_Access);
Max_Length : not null access function (Data : not null Data_Access)
return not null access Count_Type);
-- Note: Copy and Reserve_Capacity also make a container unique.
procedure In_Place_Set_Length (
Target : not null access Container;
Target_Length : Count_Type;
Target_Capacity : Count_Type;
New_Length : Count_Type;
Failure : out Boolean; -- reallocation is needed
Max_Length : not null access function (Data : not null Data_Access)
return not null access Count_Type);
function Zero (Data : not null Data_Access)
return not null access Count_Type;
end Ada.Containers.Copy_On_Write;
|
asn1s-schema/src/main/antlr4/org/asn1s/schema/parser/Asn1.g4 | lastrix/asn1s | 5 | 7493 | <reponame>lastrix/asn1s
grammar Asn1;
@header {
import org.apache.commons.lang3.StringUtils;
import org.asn1s.api.*;
import org.asn1s.api.constraint.*;
import org.asn1s.api.encoding.*;
import org.asn1s.api.encoding.tag.*;
import org.asn1s.api.module.*;
import org.asn1s.api.type.*;
import org.asn1s.api.type.x681.*;
import org.asn1s.api.util.*;
import org.asn1s.api.value.*;
import org.asn1s.api.value.x680.*;
import org.asn1s.api.value.x681.*;
import org.asn1s.schema.x681.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
}
@parser::members {
public Asn1Parser(TokenStream input, ModuleResolver resolver, Asn1Factory factory) {
this(input);
this.resolver = resolver;
this.factory = factory;
typeFactory = factory.types();
valueFactory = factory.values();
constraintFactory = factory.constraints();
}
public Asn1Parser(TokenStream input, ModuleResolver resolver, Asn1Factory factory, ClassType classType) {
this(input);
this.resolver = resolver;
this.factory = factory;
this.classType = classType;
typeFactory = factory.types();
valueFactory = factory.values();
constraintFactory = factory.constraints();
}
private ModuleResolver resolver = new EmptyModuleResolver();
private Asn1Factory factory;
private ClassType classType;
private TypeFactory typeFactory;
private ValueFactory valueFactory;
private ConstraintFactory constraintFactory;
private String tokens2string( @NotNull Token start, @NotNull Token stop )
{
StringBuilder sb = new StringBuilder( );
sb.append( start.getText() );
for(int i = start.getTokenIndex()+1; i <= stop.getTokenIndex(); i++ )
sb.append( ' ' ).append( _input.get( i ).getText() );
return sb.toString();
}
boolean isSimpleString()
{
String text = _input.LT( 1 ).getText();
int idx = text.indexOf( '"' );
int length = text.length();
if( idx > 0 && idx < length - 1 )
return false;
for( int i = 1; i < length - 1; i++ )
{
char c = text.charAt( i );
//noinspection MagicNumber
if( c >= 32 && c <= 126 || c == '\r' || c == '\n' || c == '\t' )
continue;
return false;
}
return true;
}
boolean isTokenFollows( String text, int count )
{
int previous = -1;
for( int i = 0; i < count; i++ )
{
Token token = _input.LT( i + 1 );
if( !token.getText().equals( text ) )
return false;
if( previous != -1 && previous + 1 != token.getCharPositionInLine() )
return false;
previous = token.getCharPositionInLine();
}
return true;
}
public static boolean isObjectClassReference( String name )
{
int size = name.length();
for( int i = 0; i < size; i++ )
{
char c = name.charAt( i );
if( c != '-' && !Character.isDigit( c ) && !Character.isUpperCase( c ) )
return false;
}
return true;
}
////////////////////////////////////// Reference management ////////////////////////////////////////////////////////
public Ref<Type> getTypeRef( String name, String moduleName )
{
RefUtils.assertTypeRef( name );
if( moduleName != null )
RefUtils.assertTypeRef( moduleName );
return getModule().getTypeResolver().getTypeRef( name, moduleName );
}
public Ref<Value> getValueRef( String name, String moduleName )
{
RefUtils.assertValueRef( name );
if( moduleName != null )
RefUtils.assertTypeRef( moduleName );
return getModule().getValueResolver().getValueRef( name, moduleName );
}
public Ref<?> toReference( String reference )
{
return RefUtils.isTypeRef( reference )
? getTypeRef( reference, null )
: getValueRef( reference, null );
}
////////////////////////////////////// Module setup ////////////////////////////////////////////////////////////////
Module setupModule(ModuleReference name)
{
if( module != null )
throw new IllegalStateException( "Current module is not null" );
module = name == null ? typeFactory.dummyModule() : typeFactory.module(name);
return module;
}
void notifyModuleComplete(boolean registerModule)
{
if( module == null )
throw new IllegalStateException();
if ( registerModule )
resolver.registerModule( module );
module = null;
typeFactory.setModule(null);
}
Module getModule()
{
return module;
}
public void setModule(Module module)
{
this.module = module;
}
private Module module;
}
startStmt returns [List<Module> result]
@init { $result = new ArrayList<>(); }
: (moduleDefinition { $result.add($moduleDefinition.result); })*
;
pduStmt returns [Module result]
@init { $result = setupModule(null); }
@after { notifyModuleComplete(false);}
:
(
valueAssignment
//| value { $result = (Value)$value.result; }
)+
;
//typeStmt returns [Type result]
// : { setupModule(null); }
// typeAssignment { $result = $typeAssignment.result; }
// { notifyModuleComplete(false); }
// ;
// X.680, p 13.1
moduleDefinition returns [Module result]
:
moduleReference
{ $result = setupModule($moduleReference.result); }
DEFINITIONS
moduleEncodingInstructions?
moduleTaggingMethod?
moduleExtensibilityImplied?
ASSIGN BEGIN
moduleExports?
moduleImports?
definition*
END
{ notifyModuleComplete(true); }
;
moduleEncodingInstructions
: // Encoding instructions, module default is Tag
encodingReference INSTRUCTIONS
//TODO:{ getModule().setDefaultEncodingInstructions($encodingReference.text); }
;
moduleTaggingMethod
: // Tagging method, module default is Unknown
taggingMethod TAGS
{ getModule().setTagMethod($taggingMethod.result); }
;
moduleExtensibilityImplied
: // if types are extensible, module default is false
EXTENSIBILITY IMPLIED
{ getModule().setAllTypesExtensible(true); }
;
moduleExports
: EXPORTS
( ALL { getModule().setExports(null); }
| symbolList { getModule().setExports( $symbolList.result ); }
)?
SEMI
;
moduleImports
: IMPORTS
(
symbolList FROM globalModuleReference
{
getModule().getTypeResolver().addImports($globalModuleReference.result, $symbolList.result );
getModule().getValueResolver().addImports($globalModuleReference.result, $symbolList.result );
}
)*
SEMI
;
moduleReference returns [ModuleReference result]
: typeReference
{ $result = new ModuleReference($typeReference.text); }
(
OPEN_BRACE (oidComponent )* CLOSE_BRACE
iriValueString?
)?
;
globalModuleReference returns [ModuleReference result]
: typeReference
(
OPEN_BRACE ~CLOSE_BRACE* CLOSE_BRACE
| definedValue
)?
{ $result = new ModuleReference($typeReference.text); }
;
oidComponent
:
identifier ( OPEN_PAREN number CLOSE_PAREN)?
| number
;
symbolList returns [List<String> result]
@init{ $result = new ArrayList<>(); }
:
symbol
{ $result.add($symbol.result); }
(
COMMA symbol
{ $result.add($symbol.result); }
)*
;
symbol returns [String result]
: reference (OPEN_BRACE CLOSE_BRACE)? { $result = $reference.text; }
//| parameterizedReference // TODO: parameterizedReference
;
definition
: typeAssignment
| objectOrValueAssignment
//| objectAssignment
| objectSetAssignment
| valueSetTypeAssignment
| objectClassAssignment
//| xmlValueAssignment TODO: xmlValueAssignment
;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////// Types ///////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// X.680, p 16.1
typeAssignment returns [DefinedType result]
:
typeReference
params = templateTypeParameterList?
ASSIGN type
{ $result = typeFactory.define($typeReference.text, $type.result, $params.ctx == null ? null : $params.result); }
;
// X.680, p17.1
type returns [Ref<Type> result]
:
( taggedType { $result = $taggedType.result; }
| specialBuiltinType { $result = $specialBuiltinType.result; }
| builtinType { $result = typeFactory.builtin($builtinType.text); }
| enumeratedType { $result = $enumeratedType.result; }
| instanceOfType { $result = $instanceOfType.result; }
| objectClassFieldType { $result = $objectClassFieldType.result; }
| collectionType { $result = $collectionType.result; }
| collectionOfType { $result = $collectionOfType.result; }
| choiceType { $result = $choiceType.result; }
| referencedType { $result = $referencedType.result; }
)
(
constraint
{
if ( $constraint.result != null )
$result = typeFactory.constrained($constraint.result, $result);
}
)?
;
// X.680, p 31
// X.680, p 31.2
// X.680, p 31.3
taggedType returns [Type result]
locals
[
EncodingInstructions instructions = EncodingInstructions.TAG,
TagClass typeTagClass = TagClass.CONTEXT_SPECIFIC,
TagMethod typeTagMethod = TagMethod.UNKNOWN,
Ref<Value> tagNumberRef = null
]
: OPEN_BRACKET
(
encodingReference COLON
{
$instructions = EncodingInstructions.find($encodingReference.text);
if ( $instructions != EncodingInstructions.TAG )
throw new UnsupportedOperationException();
}
)?
( tagClass { $typeTagClass = $tagClass.result; } )?
(
integerValue
{ $tagNumberRef = $integerValue.result; }
| definedValue
{ $tagNumberRef = $definedValue.result; }
)
CLOSE_BRACKET
(
IMPLICIT
{ $typeTagMethod = TagMethod.IMPLICIT; }
| EXPLICIT
{ $typeTagMethod = TagMethod.EXPLICIT; }
)?
type
{
$result =
typeFactory.tagged( typeFactory.tagEncoding( $typeTagMethod, $typeTagClass, $tagNumberRef ), $type.result );
}
;
builtinType
:
// X.680, p 18
BOOLEAN
// X.680, p 38.4.1
| DATE
// X.680, p 38.4.3
| DATE_TIME
// X.680, p 38.4.4
| DURATION
// X.680, p 36
| EMBEDDED PDV
// X.680, p 37
| EXTERNAL
// X.680, p 34
| OID_IRI
// X.680, p 24
| NULL
// X.680, p 23
| OCTET STRING
// X.680, p 21
| REAL
// X.680, p 35
| RELATIVE_OID_IRI
// X.680, p 33
| RELATIVE_OID
// X.680, p 38.1.1
| TIME
// X.680, p 38.4.2
| TIME_OF_DAY
// X.680, p 32.1
| OBJECT IDENTIFIER
// X.680 p. 22
| BIT STRING
// X.680, p 19
| INTEGER
// X.680, p 40; X.680, p 44.1, X.680, p 41
| RestrictedString
| CHARACTER STRING
;
specialBuiltinType returns[Ref<Type> result]
: // X.680 p. 22
specialBuiltinTypeNames
OPEN_BRACE integerTypeValueList CLOSE_BRACE
{ $result = typeFactory.builtin($specialBuiltinTypeNames.text, $integerTypeValueList.result); }
;
specialBuiltinTypeNames
: // X.680 p. 22
BIT STRING
// X.680, p 19
| INTEGER
;
instanceOfType returns [Ref<Type> result]
: INSTANCE OF definedObjectClass { $result = typeFactory.instanceOf($definedObjectClass.result); }
;
// X.681, p 14.1
objectClassFieldType returns [Ref<Type> result]
: typeFromObject { $result = $typeFromObject.result; }
;
// X.680, p 17.3
referencedType returns [Ref<Type> result]
: definedType { $result = $definedType.result; }
| UsefullType { $result = typeFactory.builtin($UsefullType.text); }
| selectionType { $result = $selectionType.result; }
| typeFromObject { $result = $typeFromObject.result; }
| valueSetFromObjects { $result = $valueSetFromObjects.result; }
;
// X.680, p 14.1
definedType returns [Ref<Type> result]
: // X.680, p 14.6
(mr = typeReference DOT)? tr = typeReference args=actualTemplateTypeParameterList?
{
if ( $args.ctx == null )
$result = getTypeRef($tr.text, $mr.text);
else
$result = typeFactory.typeTemplateInstance( getTypeRef($tr.text, $mr.text), $args.result );
}
;
// X.680, p 30.1
selectionType returns [Type result]
: valueReference LT type
{ $result = typeFactory.selectionType( $valueReference.text, $type.result ); }
;
// X.680, p 20.1
enumeratedType returns [Enumerated result]
@init { $result = typeFactory.enumerated(); }
: ENUMERATED
OPEN_BRACE
enumValueList[$result, Enumerated.ItemKind.PRIMARY]
(
COMMA ELLIPSIS
{ $result.setExtensible(true); }
exceptionSpec?
(
COMMA
enumValueList[$result, Enumerated.ItemKind.EXTENSION]
)?
)?
CLOSE_BRACE
;
// X.680, p 25.1
// X.680, p 27.1
collectionType returns [CollectionType result]
:
(
SEQUENCE { $result = typeFactory.collection(Type.Family.SEQUENCE); }
| SET { $result = typeFactory.collection(Type.Family.SET); }
)
OPEN_BRACE
(
ELLIPSIS
exceptionSpec?
( COMMA collectionExtensionComponents[$result] )?
(
COMMA ELLIPSIS
COMMA collectionComponentTypeList[$result, ComponentType.Kind.SECONDARY]
| COMMA ELLIPSIS { $result.setExtensible(true); }
)?
| collectionComponentTypeList[$result, ComponentType.Kind.PRIMARY]
(
COMMA ELLIPSIS
(
exceptionSpec?
( COMMA collectionExtensionComponents[$result] )?
(
COMMA ELLIPSIS
COMMA collectionComponentTypeList[$result, ComponentType.Kind.SECONDARY]
| COMMA ELLIPSIS { $result.setExtensible(true); }
| { $result.setExtensible(true); }
)
)
)?
)?
CLOSE_BRACE
;
// X.680, p 26.1
// X.680, p 28.1
collectionOfType returns [Ref<Type> result]
locals [
CollectionOfType actualType,
ConstraintTemplate constraintTemplate = null,
String componentName = TypeUtils.DUMMY ]
:
(
SEQUENCE { $actualType = (CollectionOfType)typeFactory.collectionOf(Type.Family.SEQUENCE_OF); }
| SET { $actualType = (CollectionOfType)typeFactory.collectionOf(Type.Family.SET_OF); }
)
{ $result = $actualType; }
(
( constraint { $constraintTemplate = $constraint.result; }
| sizeConstraint { $constraintTemplate = $sizeConstraint.result; }
)
{ $result = typeFactory.constrained($constraintTemplate, $actualType); }
)?
OF
(valueReference { $componentName = $valueReference.text; } )?
type
{ $actualType.setComponent( $componentName, $type.result ); }
;
// X.680, p 29
choiceType returns [CollectionType result]
@init { $result = typeFactory.collection(Type.Family.CHOICE); }
: CHOICE
OPEN_BRACE
choiceComponentTypeList[$result]
(
COMMA ELLIPSIS { $result.setExtensible(true); }
exceptionSpec?
( COMMA choiceExtensionComponentTypeList[$result] )?
( COMMA ELLIPSIS )?
)?
CLOSE_BRACE
;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////// Misc ////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
templateTypeParameterList returns [Template result]
@init { $result = new Template(); }
:
OPEN_BRACE
templateTypeParameter[$result]
( COMMA templateTypeParameter[$result] )*
CLOSE_BRACE
;
templateTypeParameter[Template templateObject]
:
templateTypeParameterGovernor?
Identifier
{
TemplateParameter p =
new TemplateParameter(
$templateObject.getParameterCount(),
toReference($Identifier.getText()),
$templateTypeParameterGovernor.result );
$templateObject.addParameter( p );
}
;
templateTypeParameterGovernor returns [Ref<Type> result]
: (
type { $result = $type.result; }
| definedObjectClass { $result = $definedObjectClass.result; }
)
COLON
;
actualTemplateTypeParameterList returns[List<Ref<?>> result]
@init { $result = new ArrayList<>(); }
: OPEN_BRACE
(
actualTemplateTypeParameter[$result]
( COMMA actualTemplateTypeParameter[$result] )*
)?
CLOSE_BRACE
;
actualTemplateTypeParameter[List<Ref<?>> result]
: definedType { $result.add($definedType.result); }
| OPEN_BRACE definedType CLOSE_BRACE { $result.add($definedType.result); }
| definedValue { $result.add($definedValue.result); }
| builtinScalarValue { $result.add($builtinScalarValue.result); }
;
integerTypeValueList returns [List<NamedValue> result]
@init{ $result = new ArrayList<>(); }
: integerTypeValue[$result]
( COMMA integerTypeValue[$result] )*
;
integerTypeValue[List<NamedValue> valueList]
: valueReference OPEN_PAREN number CLOSE_PAREN
{ $valueList.add( valueFactory.named($valueReference.text, valueFactory.integer($number.text)) ); }
| valueReference OPEN_PAREN definedValue CLOSE_PAREN
{ $valueList.add( valueFactory.named($valueReference.text, $definedValue.result) ); }
;
enumValueList[Enumerated enumeration, Enumerated.ItemKind itemKind ]
:
enumValue[$enumeration, $itemKind]
( COMMA enumValue[$enumeration, $itemKind] )*
;
enumValue[Enumerated enumeration, Enumerated.ItemKind itemKind ]
:
valueReference OPEN_PAREN integerValue CLOSE_PAREN
{ $enumeration.addItem($itemKind, $valueReference.text, $integerValue.result); }
| valueReference OPEN_PAREN definedValue CLOSE_PAREN
{ $enumeration.addItem($itemKind, $valueReference.text, $definedValue.result); }
| valueReference
{ $enumeration.addItem($itemKind, $valueReference.text, null); }
;
exceptionSpec
:
EXCLAMATION
(
number
| definedValue
| type COLON value
)
;
collectionComponentTypeList[ComponentTypeConsumer consumer, ComponentType.Kind componentKind]
: collectionComponentType[$consumer, $componentKind]
( COMMA collectionComponentType[$consumer, $componentKind] )*
;
collectionExtensionComponents[ComponentTypeConsumer consumer]
: collectionExtensionComponent[$consumer]
( COMMA collectionExtensionComponent[$consumer] )*
;
collectionExtensionComponent[ComponentTypeConsumer consumer]
: collectionComponentType[$consumer, ComponentType.Kind.EXTENSION]
| collectionExtensionAdditionGroup[$consumer]
;
collectionExtensionAdditionGroup[ComponentTypeConsumer consumer]
: { isTokenFollows("[", 2) }? OPEN_BRACKET OPEN_BRACKET
{ CollectionTypeExtensionGroup extGroup = typeFactory.extensionGroup(((Type)consumer).getFamily()); }
( number COLON { extGroup.setVersion(Integer.parseInt($number.text)); } )?
collectionComponentType[extGroup, ComponentType.Kind.EXTENSION]
( COMMA collectionComponentType[extGroup, ComponentType.Kind.EXTENSION])*
{ isTokenFollows("]", 2) }? CLOSE_BRACKET CLOSE_BRACKET
{ $consumer.addExtensionGroup( extGroup ); }
;
collectionComponentType[ComponentTypeConsumer consumer, ComponentType.Kind componentKind]
locals[ boolean optional = false, Ref<Value> defaultValueRef = null, ComponentType component ]
:
valueReference type
(
OPTIONAL { $optional = true; }
| DEFAULT value { $defaultValueRef = $value.result; }
)?
{
$component = consumer.addComponent(componentKind, $valueReference.text, $type.result);
$component.setOptional($optional);
$component.setDefaultValueRef($defaultValueRef);
}
| COMPONENTS OF type
{ $consumer.addComponentsFromType($componentKind, $type.result); }
;
choiceComponentTypeList[ComponentTypeConsumer consumer]
: choiceComponentType[$consumer, ComponentType.Kind.PRIMARY]
( COMMA choiceComponentType[$consumer, ComponentType.Kind.PRIMARY] )*
;
// X.680, p 29.1
choiceExtensionComponentTypeList[ComponentTypeConsumer consumer]
: choiceExtensionComponentType[$consumer]
( COMMA choiceExtensionComponentType[$consumer] )*
;
choiceComponentType[ComponentTypeConsumer target, ComponentType.Kind componentKind]
:
valueReference type
{ $target.addComponent(componentKind, $valueReference.text, $type.result ); }
;
// X.680, p 29.1
choiceExtensionComponentType[ComponentTypeConsumer consumer]
: choiceComponentType[$consumer, ComponentType.Kind.EXTENSION]
| choiceExtensionAdditionGroup[$consumer]
;
// X.680, p 29.1
choiceExtensionAdditionGroup[ComponentTypeConsumer consumer]
: { isTokenFollows("[", 2) }? OPEN_BRACKET OPEN_BRACKET
{ CollectionTypeExtensionGroup extGroup = typeFactory.extensionGroup(((Type)consumer).getFamily()); }
( number COLON { extGroup.setVersion(Integer.parseInt($number.text)); } )?
choiceComponentType[extGroup, ComponentType.Kind.EXTENSION]
( COMMA choiceComponentType[extGroup, ComponentType.Kind.EXTENSION] )*
{ isTokenFollows("]", 2) }? CLOSE_BRACKET CLOSE_BRACKET
{ $consumer.addExtensionGroup( extGroup ); }
;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////// Values //////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// X.680, p 16.2
valueAssignment returns [DefinedValue result]
:
valueReference
params=templateTypeParameterList?
OBJECT IDENTIFIER ASSIGN objectIdentifierValue
{ $result = typeFactory.define( $valueReference.text, typeFactory.builtin("OBJECT IDENTIFIER" ), $objectIdentifierValue.result, $params.ctx == null ? null : $params.result ); }
| valueReference
params=templateTypeParameterList?
type ASSIGN value
{ $result = typeFactory.define( $valueReference.text, $type.result, $value.result, $params.ctx == null ? null : $params.result ); }
;
objectOrValueAssignment returns [DefinedValue result]
:
valueReference params=templateTypeParameterList?
(
OBJECT IDENTIFIER ASSIGN objectIdentifierValue
{ $result = typeFactory.define( $valueReference.text, typeFactory.builtin("OBJECT IDENTIFIER" ), $objectIdentifierValue.result, $params.ctx == null ? null : $params.result ); }
| definedObjectClass ASSIGN object
{ $result = typeFactory.define( $valueReference.text, $definedObjectClass.result, $object.result, $params.ctx == null ? null : $params.result ); }
| type ASSIGN value
{ $result = typeFactory.define( $valueReference.text, $type.result, $value.result, $params.ctx == null ? null : $params.result ); }
)
;
valueSetTypeAssignment returns[DefinedType result]
:
typeReference
templateTypeParameterList?
type ASSIGN valueSet
{
Type constrained = typeFactory.constrained($valueSet.result, $type.result);
$result = typeFactory.define(
$typeReference.text,
constrained,
$templateTypeParameterList.ctx == null ? null : $templateTypeParameterList.result);
}
;
// X.680, p 17.7
value returns [Ref<Value> result]
: builtinScalarValue { $result = $builtinScalarValue.result; }
| builtinValue { $result = $builtinValue.result; }
// X.680, p 17.11 referenced values
| definedValue { $result = $definedValue.result; }
| valueFromObject
| objectClassFieldValue { $result = $objectClassFieldValue.result; }
;
objectClassFieldValue returns [Value result]
: type COLON value { $result = valueFactory.openTypeValue($type.result, $value.result); }
;
// X.680, p 16.7
valueSet returns [ConstraintTemplate result]
: OPEN_BRACE
elementSetSpecs
CLOSE_BRACE
{ $result = $elementSetSpecs.result; }
;
builtinValue returns [Value result]
:
// X.680, p 23
namedValueCollection { $result = $namedValueCollection.result; }
| valueCollection { $result = $valueCollection.result; }
| choiceValue { $result = $choiceValue.result; }
| objectIdentifierValue { $result = $objectIdentifierValue.result; }
//| CONTAINING value { /*$result = new ContainingValue( $value.result );*/ }// TODO: CONTAINING value
;
builtinScalarValue returns [Value result]
: CString { $result = valueFactory.cString($CString.text); }
| HString { $result = valueFactory.hString($HString.text); }
| BString { $result = valueFactory.bString($BString.text); }
| integerValue { $result = $integerValue.result; }
// X.680, p 12.9
| RealLiteral { $result = valueFactory.real($RealLiteral.text); }
| SpecialRealValue { $result = valueFactory.real($SpecialRealValue.text); }
| TRUE { $result = BooleanValue.TRUE; }
| FALSE { $result = BooleanValue.FALSE; }
| NULL { $result = NullValue.INSTANCE; }
;
definedValue returns [Ref<Value> result]
: // X.680, p 14
// X.680, p 14.6
(mr=typeReference DOT)? valueReference args=actualTemplateTypeParameterList?
{
if ( $args.ctx == null )
$result = getValueRef($valueReference.text, $mr.text);
else
$result = typeFactory.valueTemplateInstance(getValueRef($valueReference.text, $mr.text), $args.ctx == null ? null : $args.result);
}
;
// X.680, p 12.8
integerValue returns [Value result]
: NumberLiteral { $result = valueFactory.integer( $NumberLiteral.text ); }
;
choiceValue returns [Value result]
: valueReference COLON value
{ $result = valueFactory.named($valueReference.text, $value.result); }
;
valueCollection returns [ValueCollection result]
@init { $result = valueFactory.collection(false); }
:
OPEN_BRACE
(
value
{ $result.add($value.result); }
(
COMMA value
{ $result.add($value.result); }
)*
)?
CLOSE_BRACE
;
namedValueCollection returns [ValueCollection result]
@init { $result = valueFactory.collection(true); }
:
OPEN_BRACE
(
valueReference value
{ $result.addNamed($valueReference.text, $value.result); }
(
COMMA valueReference value
{ $result.addNamed($valueReference.text, $value.result); }
)*
)?
CLOSE_BRACE
;
objectIdentifierValue returns [Value result]
locals [ List<Ref<Value>> values = new ArrayList<>(); ]
@after { $result = valueFactory.objectIdentifier($values); }
:
OPEN_BRACE
(objectIdentifierValueItem { $values.add($objectIdentifierValueItem.result); } )*
CLOSE_BRACE
;
objectIdentifierValueItem returns [Ref<Value> result]
: integerValue { $result = $integerValue.result; }
| valueReference OPEN_PAREN integerValue CLOSE_PAREN { $result = valueFactory.named($valueReference.text, $integerValue.result); }
| definedValue { $result = $definedValue.result; }
;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////// Constraints /////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// X.680, p 49.6
constraint returns [ConstraintTemplate result]
: OPEN_PAREN
( generalConstraint { $result = $generalConstraint.result; }
| elementSetSpecs { $result = $elementSetSpecs.result; }
)
CLOSE_PAREN
;
generalConstraint returns [ConstraintTemplate result]
: userDefinedConstraint { $result = $userDefinedConstraint.result; }
| tableConstraint { $result = $tableConstraint.result; }
| contentsConstraint { $result = $contentsConstraint.result; }
;
// X.682, p 9.1
userDefinedConstraint returns [ConstraintTemplate result]
: CONSTRAINED BY OPEN_BRACE braceConsumer CLOSE_BRACE
{ $result = null; }
// TODO: not implemented
;
braceConsumer
:
OPEN_BRACE ( ~(OPEN_BRACE|CLOSE_BRACE) | braceConsumer )* CLOSE_BRACE
;
// X.682, p 10.3
tableConstraint returns[ConstraintTemplate result]
:
OPEN_BRACE definedObjectSet CLOSE_BRACE
(OPEN_BRACE relationItemList CLOSE_BRACE)?
{ $result = constraintFactory.tableConstraint($definedObjectSet.result, $relationItemList.ctx == null ? null : $relationItemList.result); }
;
relationItemList returns[List<RelationItem> result]
@init { $result = new ArrayList<>(); }
@after { if ( $result.isEmpty() ) $result = null; }
:
relationItem { $result.add($relationItem.result); }
(COMMA relationItem { $result.add($relationItem.result); })*
;
relationItem returns[RelationItem result]
locals[ int level = 0, List<String> path = new ArrayList<>() ]
: AT
(DOT { $level++; } )*
(identifier DOT { $path.add($identifier.text); } )*
identifier
{ $result = new RelationItem($identifier.text, $path, $level); }
;
// X.682, p 11.1
contentsConstraint returns [ConstraintTemplate result ]
@init { $result = null; }
: CONTAINING type (ENCODED BY value)?
{ } // TODO: impl
| ENCODED BY value
{ } // TODO: impl
;
elementSetSpecs returns [ConstraintTemplate result]
locals[ boolean extensible = false; ]
:
root=elementSetSpec
(
COMMA ELLIPSIS { $extensible = true; }
( COMMA ext = elementSetSpec )?
)?
{ $result = constraintFactory.elementSetSpecs($root.result, $extensible, $ext.ctx == null ? null : $ext.result); }
| ELLIPSIS
{ $result = constraintFactory.elementSetSpecs(null, true, null); }
;
objectSetElementSpecs returns [ConstraintTemplate result]
locals[ boolean extensible = false; ]
:
root = objectSetElementSpec
(
COMMA ELLIPSIS { $extensible = true; }
( COMMA ext = objectSetElementSpec )?
)?
{ $result = constraintFactory.elementSetSpecs($root.result, $extensible, $ext.ctx == null ? null : $ext.result); }
| ELLIPSIS
{ $result = constraintFactory.elementSetSpecs(null, true, null); }
;
objectSetElementSpec returns [ConstraintTemplate result]
locals [List<ConstraintTemplate> list]
@init { $list = new ArrayList<>(); }
: objectSetElementSpecItem { $list.add($objectSetElementSpecItem.result); }
( ( UNION| OR ) objectSetElementSpecItem { $list.add($objectSetElementSpecItem.result); })*
{ $result = constraintFactory.elementSetSpec($list); }
;
objectSetElementSpecItem returns [ConstraintTemplate result]
: object { $result = constraintFactory.value( $object.result ); }
| definedObjectSet { $result = constraintFactory.type($definedObjectSet.result); }
;
elementSetSpec returns [ConstraintTemplate result]
:
unions { $result = constraintFactory.elementSetSpec($unions.result); }
| ALL EXCEPT elements { $result = constraintFactory.elementSetSpec($elements.result); }
;
exclusions returns [ConstraintTemplate result]
: EXCEPT elements { $result = $elements.result; }
;
unions returns [List<ConstraintTemplate> result]
@init { $result = new ArrayList<>(); }
:
union { $result.add($union.result); }
(( UNION | OR ) union { $result.add($union.result); } )*
;
union returns [ConstraintTemplate result]
: intersections
{ $result = constraintFactory.union($intersections.result); }
;
intersections returns [List<ConstraintTemplate> result]
@init { $result = new ArrayList<>(); }
: intersectionItem { $result.add( $intersectionItem.result ); }
( (INTERSECTION | CARET ) intersectionItem { $result.add( $intersectionItem.result ); } )*
;
intersectionItem returns [ConstraintTemplate result]
: elements exclusions?
{ $result = constraintFactory.elements($elements.result, $exclusions.ctx == null ? null : $exclusions.result); }
;
elements returns [ConstraintTemplate result]
: subtypeElements { $result = $subtypeElements.result; }
| objectSetElements { $result = $objectSetElements.result; }
| OPEN_PAREN elementSetSpecs CLOSE_PAREN { $result = $elementSetSpecs.result; }
;
// X.680, p 51.1
subtypeElements returns [ConstraintTemplate result]
:
OPEN_BRACE definedType CLOSE_BRACE
{ $result = constraintFactory.valuesFromSet($definedType.result); }
// X.680, p 51.2 Single value
| value { $result = constraintFactory.value( $value.result ); }
| containedSubtype { $result = $containedSubtype.result; }
| valueRange { $result = $valueRange.result; }
// X.680, p 51.7
| FROM elementSetSpecs { $result = constraintFactory.permittedAlphabet( $elementSetSpecs.result ); }
| sizeConstraint { $result = $sizeConstraint.result; }
// X.680, p 51.6
| type { $result = constraintFactory.type( $type.result ); }
| innerTypeConstraints { $result = $innerTypeConstraints.result; }
// X.680, p 51.9
| PATTERN value { $result = constraintFactory.pattern($value.result); }
// X.680, p 51.10
| SETTINGS simpleString { $result = constraintFactory.settings($simpleString.text); }
//TODO:| durationRange
//TODO:| timePointRange
//TODO:| recurrenceRange
;
objectSetElements returns [ ConstraintTemplate result]
: object { $result = constraintFactory.objectSetElements($object.result); }
| definedObjectSet { $result = constraintFactory.objectSetElements($definedObjectSet.result); }
| objectSetFromObjects { $result = constraintFactory.objectSetElements($objectSetFromObjects.result); }
;
// X.680, p 51.3
containedSubtype returns [ConstraintTemplate result]
locals [Ref<Type> contained = null;]
: { boolean includes = false; }
( NULL { $contained = typeFactory.builtin("NULL"); }
| INCLUDES {includes = true;} type { $contained = $type.result; }
)
{ $result = constraintFactory.containedSubtype( $contained, includes ); }
;
// X.680, p 51.4
valueRange returns [ConstraintTemplate result]
locals [
Ref<Value> minValue = null,
boolean minValueLt = false,
Ref<Value> maxValue = null,
boolean maxValueGt = false;
]
:
(
value { $minValue = $value.result; }
| MIN
)
(LT { $minValueLt = true; } )?
RANGE
(LT { $maxValueGt = true; } )?
(
value { $maxValue = $value.result; }
| MAX
)
{ $result = constraintFactory.valueRange($minValue, $minValueLt, $maxValue, $maxValueGt); }
;
// X.680, p 51.5
sizeConstraint returns[ConstraintTemplate result]
: SIZE constraint { $result = constraintFactory.size( $constraint.result ); }
;
innerTypeConstraints returns [ConstraintTemplate result]
: WITH
(
COMPONENT constraint
{ $result = constraintFactory.innerType( $constraint.result ); }
| COMPONENTS
{ List<ConstraintTemplate> list = new ArrayList<>(); boolean partial = false; }
OPEN_BRACE
(
componentConstraintList[list, Presence.PRESENT]
| { partial = true; }
ELLIPSIS COMMA componentConstraintList[list, Presence.OPTIONAL]
)
CLOSE_BRACE
{ $result = constraintFactory.innerTypes(list, partial); }
)
;
componentConstraintList[List<ConstraintTemplate> list, Presence presence]
: componentConstraint[$presence] { $list.add($componentConstraint.result); }
(COMMA componentConstraint[$presence] { $list.add($componentConstraint.result); } )*
;
// X.680, p 51.8.8; X.680, p 51.8.5
componentConstraint[Presence defaultPresence] returns [ConstraintTemplate result]
locals [ Presence presence = defaultPresence; ]
: identifier
constraint?
(
PRESENT { $presence = Presence.PRESENT; }
| ABSENT { $presence = Presence.ABSENT; }
| OPTIONAL { $presence = Presence.OPTIONAL; }
)?
{ $result = constraintFactory.component( $identifier.text, $constraint.ctx == null ? null : $constraint.result, $presence ); }
;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////// Class ///////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// X.681, p 9
objectClassAssignment returns [DefinedType result]
locals [Ref<Type> assigned]
:
objectClassReference
params=templateTypeParameterList?
ASSIGN (definedObjectClass {$assigned = $definedObjectClass.result; } | objectClass {$assigned = $objectClass.result; })
{ $result = typeFactory.define( $objectClassReference.text, $assigned, $params.ctx == null ? null : $params.result); }
;
objectClass returns [ClassType result]
@init { $result = typeFactory.classType(); }
: CLASS
OPEN_BRACE
fieldSpec[$result]
(COMMA fieldSpec[$result])*
CLOSE_BRACE
(WITH SYNTAX OPEN_BRACE syntaxList CLOSE_BRACE { $result.setSyntaxList($syntaxList.result); })?
;
syntaxList returns[List<String> result]
@init { $result = new ArrayList<>(); }
: tokenOrGroupSpec[$result]+
;
tokenOrGroupSpec[List<String> list]
:
OPEN_BRACKET { list.add("["); }
tokenOrGroupSpec[$list]+
CLOSE_BRACKET { list.add("]"); }
| (requiredToken { list.add($requiredToken.text); } )+
;
requiredToken
: FieldIdentifier | word | COMMA
;
fieldSpec[ClassType classType]
: typeFieldSpec { $classType.add($typeFieldSpec.result); }
// | objectFieldSpec { $classType.add($objectFieldSpec.result); }
// | objectSetFieldSpec { $classType.add($objectSetFieldSpec.result); }
| fixedTypeValueFieldSpec { $classType.add($fixedTypeValueFieldSpec.result); }
| variableTypeValueFieldSpec { $classType.add($variableTypeValueFieldSpec.result); }
| fixedTypeValueSetFieldSpec { $classType.add($fixedTypeValueSetFieldSpec.result); }
| variableTypeValueSetFieldSpec { $classType.add($variableTypeValueSetFieldSpec.result); }
;
typeFieldSpec returns [ClassFieldType result]
locals [boolean optional = false, Ref<Type> defaultType = null;]
: typeFieldReference
(OPTIONAL { $optional = true; } | DEFAULT type { $defaultType = $type.result; } )?
{ $result = typeFactory.typeField($typeFieldReference.text, $optional, $defaultType); }
;
fixedTypeValueFieldSpec returns [ClassFieldType result]
locals [boolean optional = false, boolean unique = false, Ref<Value> defaultValue = null;]
: valueFieldReference type
( UNIQUE { $unique = true; } (OPTIONAL { $optional = true; })?
| (OPTIONAL { $optional = true; } | DEFAULT value { $defaultValue = $value.result; } )
)?
{ $result = typeFactory.valueField($valueFieldReference.text, $type.result, $unique, $optional, $defaultValue); }
;
variableTypeValueFieldSpec returns [ClassFieldType result]
locals [boolean optional = false, Ref<Value> defaultValue = null;]
: valueFieldReference
fieldName
(OPTIONAL { $optional = true; } | DEFAULT value { $defaultValue = $value.result; } )?
{ $result = typeFactory.valueField($valueFieldReference.text, new ScopeClassFieldRef( $fieldName.text ), false, $optional, $defaultValue); }
;
fixedTypeValueSetFieldSpec returns [ClassFieldType result]
locals [boolean optional = false, ConstraintTemplate valueSetType = null;]
: valueSetFieldReference
type
(OPTIONAL { $optional = true; } | DEFAULT valueSet { $valueSetType = $valueSet.result; } )?
{ $result = typeFactory.valueSetField( $valueSetFieldReference.text, $type.result, $optional, $valueSetType ); }
;
variableTypeValueSetFieldSpec returns [ClassFieldType result]
locals [boolean optional = false, ConstraintTemplate valueSetType = null;]
: valueSetFieldReference
fieldName
(OPTIONAL { $optional = true; } | DEFAULT valueSet { $valueSetType = $valueSet.result; } )?
{ $result = typeFactory.valueSetField( $valueSetFieldReference.text, new ScopeClassFieldRef( $fieldName.text ), $optional, $valueSetType ); }
;
objectFieldSpec returns [ClassFieldType result]
locals [boolean optional = false, Ref<Value> defaultValue = null;]
: objectFieldReference
definedObjectClass
(OPTIONAL { $optional = true; } | DEFAULT object { $defaultValue = $object.result; } )?
{ $result = typeFactory.valueField($objectFieldReference.text, $definedObjectClass.result, false, $optional, $defaultValue); }
;
objectSetFieldSpec returns [ClassFieldType result]
locals [boolean optional = false, ConstraintTemplate valueSetType = null;]
: objectSetFieldReference
definedObjectClass
(OPTIONAL { $optional = true; } | DEFAULT objectSet { $valueSetType = $objectSet.result; } )?
{ $result = typeFactory.valueSetField( $objectSetFieldReference.text, $definedObjectClass.result, $optional, $valueSetType ); }
;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////// Object //////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// X.681, p 11.1
objectAssignment returns [DefinedValue result]
:
valueReference
params=templateTypeParameterList?
definedObjectClass ASSIGN object
{ $result = typeFactory.define( $valueReference.text, $definedObjectClass.result, $object.result, $params.ctx == null ? null : $params.result ); }
;
// X.681, p 12.1
objectSetAssignment returns[DefinedType result]
:
typeReference
params=templateTypeParameterList?
definedObjectClass ASSIGN objectSet
{
Type constrained = typeFactory.constrained($objectSet.result, $definedObjectClass.result);
$result = typeFactory.define(
$typeReference.text,
constrained,
$params.ctx == null ? null : $params.result);
}
;
definedObjectClass returns [Ref<Type> result]
: definedObjectClassRef { $result = $definedObjectClassRef.result; }
| TYPE_IDENTIFIER { $result = typeFactory.builtin("TYPE-IDENTIFIER"); }
| ABSTRACT_SYNTAX { $result = typeFactory.builtin("ABSTRACT SYNTAX"); }
;
definedObjectClassRef returns [Ref<Type> result]
: (mr=typeReference DOT)? ref=objectClassReference args=actualTemplateTypeParameterList?
{
if ( $args.ctx == null )
$result = getTypeRef($ref.text, $mr.text);
else
$result = $result = typeFactory.typeTemplateInstance( getTypeRef($ref.text, $mr.text), $args.result );
}
;
// X.681, p 11.3
object returns [Ref<Value> result]
: definedObject { $result = $definedObject.result; }
| objectDefn { $result = $objectDefn.result; }
| objectFromObject { $result = $objectFromObject.result; }
;
definedObject returns [Ref<Value> result]
: definedValue { $result = $definedValue.result; }
;
objectSet returns [ConstraintTemplate result]
:
OPEN_BRACE objectSetElementSpecs CLOSE_BRACE { $result = $objectSetElementSpecs.result; }
| valueSet { $result = $valueSet.result; }
;
definedObjectSet returns [Ref<Type> result]
: definedType { $result = $definedType.result; }
;
////////////////////////////////////// Object Misc /////////////////////////////////////////////////////////////////////
valueFromObject returns [Ref<Value> result]
: referencedObjects (DOT fieldName)? DOT valueFieldReference
{ $result = new ValueFromSourceRef($referencedObjects.result, $fieldName.ctx == null ? null : $fieldName.text, $valueFieldReference.text); }
;
// X.681, p 15.1
objectFromObject returns [Ref<Value> result]
: valueFromObject { $result = $valueFromObject.result; }
;
objectSetFromObjects returns [Ref<Type> result]
: valueSetFromObjects { $result = $valueSetFromObjects.result; }
;
valueSetFromObjects returns [Ref<Type> result]
: referencedObjects (DOT fieldName)* DOT typeFieldReference
{ $result = new ValueSetFromSourceRef($referencedObjects.result, $fieldName.ctx == null ? null : $fieldName.text, $typeFieldReference.text); }
;
typeFromObject returns [Ref<Type> result]
locals[ List<String> pathParts = new ArrayList<>(); ]
: referencedObjects
(DOT fieldName)*
DOT FieldIdentifier
{ $result = new ClassFieldFromSourceRef( $referencedObjects.result, $fieldName.ctx == null ? null : $fieldName.text, $FieldIdentifier.text ); }
;
referencedObjects returns [ Ref<?> result ]
: definedObject { $result = $definedObject.result; }
| definedObjectSet { $result = $definedObjectSet.result; }
;
// Object definition
objectDefn returns [Ref<Value> result]
:
OPEN_BRACE fieldSettings CLOSE_BRACE { $result = new ObjectValue( $fieldSettings.result ); }
// TODO: some garbage may pass thru here
| braceConsumer { $result = new AbstractSyntaxObjectRef(tokens2string($braceConsumer.start, $braceConsumer.stop)); }
;
fieldSettings returns [Map<String, Ref<?>> result]
@init { $result = new HashMap<>(); }
:
(
fieldSetting[$result]
(COMMA fieldSetting[$result])*
)?
;
fieldSetting [Map<String, Ref<?>> fieldMap]
: FieldIdentifier setting
{
if ( $fieldMap.containsKey($FieldIdentifier.text) )
throw new IllegalStateException( "Duplicate field: " + $FieldIdentifier.text);
$fieldMap.put($FieldIdentifier.text, $setting.result);
}
;
setting returns [Ref<? > result]
: type { $result = $type.result; }
| value { $result = $value.result; }
| valueSet { $result = $valueSet.result; }
| object { $result = $object.result; }
| objectSet { $result = $objectSet.result; }
;
definedFieldSetting
: definedSyntaxToken+
;
definedSyntaxToken returns [Object result]
:
FieldIdentifier { $result = $FieldIdentifier.text; }
| Identifier { $result = $Identifier.text; }
| COMMA { $result = ","; }
;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// Abstract Syntax Parser ///////////////////////////////////////////////////////////////////
abstractSyntaxWord
: objectClassReference
| COMMA
| ABSENT
| ABSTRACT_SYNTAX
| ALL
| APPLICATION
| AUTOMATIC
| BEGIN
| BY
| CLASS
| COMPONENT
| COMPONENTS
| CONSTRAINED
| CONTAINING
| DEFAULT
| DEFINITIONS
| ENCODED
| ENCODING_CONTROL
| EXCEPT
| EXPLICIT
| EXPORTS
| EXTENSIBILITY
| FROM
| IDENTIFIER
| IMPLICIT
| IMPLIED
| IMPORTS
| INCLUDES
| INSTRUCTIONS
| MAX
| MIN
| OF
| OID_IRI
| OPTIONAL
| PATTERN
| PDV
| PRESENT
| PRIVATE
| RELATIVE_OID_IRI
| SETTINGS
| SIZE
| STRING
| SYNTAX
| TAGS
| TYPE_IDENTIFIER
| UNIQUE
| UNIVERSAL
| WITH
;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
reference
: Identifier
;
taggingMethod returns[ TagMethod result ]
: AUTOMATIC { $result = TagMethod.AUTOMATIC; }
| EXPLICIT { $result = TagMethod.EXPLICIT; }
| IMPLICIT { $result = TagMethod.IMPLICIT; }
;
tagClass returns[TagClass result]
: APPLICATION { $result = TagClass.APPLICATION; }
| UNIVERSAL { $result = TagClass.UNIVERSAL; }
| PRIVATE { $result = TagClass.PRIVATE; }
;
fieldName
: FieldIdentifier (DOT FieldIdentifier)*
;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// ASN.1 Lexical items, X.680 p.12
// X.680, p 12.2
typeReference
: { RefUtils.isTypeRef( _input.LT( 1 ).getText() ) }? Identifier
;
// X.681, p 7.1
objectClassReference
: { isObjectClassReference(_input.LT( 1 ).getText()) }?
Identifier
;
//objectReference
// : valueReference
// ;
//
//objectSetReference
// : typeReference
// ;
// X.680, p 12.3
identifier
: { RefUtils.isValueRef( _input.LT( 1 ).getText() ) }?
Identifier
;
// X.680, p 12.4
valueReference
: { RefUtils.isValueRef( _input.LT( 1 ).getText() ) }? Identifier
;
// X.680, p 12.8
number
: NumberLiteral
;
// X.680, p 12.14
cstring
: CString
;
// X.680, p 12.16
simpleString
: { isSimpleString() }? cstring
;
iriValueString
: { RefUtils.isIriValue( _input.LT( 1 ).getText() ) }?
cstring
;
// X.680, p 12.25
encodingReference
: { StringUtils.isAllUpperCase(_input.LT( 1 ).getText()) }?
Identifier
;
typeFieldReference
: { RefUtils.isTypeRef( _input.LT( 1 ).getText().substring( 1 ) ) }?
FieldIdentifier
;
valueFieldReference
: { RefUtils.isValueRef( _input.LT( 1 ).getText().substring( 1 ) ) }?
FieldIdentifier
;
valueSetFieldReference
: typeFieldReference
;
objectFieldReference
: valueFieldReference
;
objectSetFieldReference
: typeFieldReference
;
word
: Identifier
;
/////////////////////////////////////////////// LEXER //////////////////////////////////////////////////////////////////
// X.680, p 21
SpecialRealValue : 'PLUS-INFINITY' | 'MINUS-INFINITY' | 'NOT-A-NUMBER';
// X.680, p.45.1
UsefullType : 'GeneralizedTime' | 'UTCTime' | 'ObjectDescriptor';
RestrictedString : 'BMPString' | 'GeneralString' | 'GraphicString' | 'IA5String' | 'ISO646String' | 'NumericString'
| 'PrintableString' | 'TeletexString' | 'T61String' | 'UniversalString' | 'UTF8String'
| 'VideotexString' | 'VisibleString';
// Reserved keywords X.680, p. 12.38
FALSE : 'FALSE';
TRUE : 'TRUE';
ABSENT : 'ABSENT';
ABSTRACT_SYNTAX : 'ABSTRACT-SYNTAX';
ALL : 'ALL';
APPLICATION : 'APPLICATION';
AUTOMATIC : 'AUTOMATIC';
BEGIN : 'BEGIN';
BIT : 'BIT';
BOOLEAN : 'BOOLEAN';
BY : 'BY';
CHARACTER : 'CHARACTER';
CHOICE : 'CHOICE';
CLASS : 'CLASS';
COMPONENT : 'COMPONENT';
COMPONENTS : 'COMPONENTS';
CONSTRAINED : 'CONSTRAINED';
CONTAINING : 'CONTAINING';
DATE : 'DATE';
DATE_TIME : 'DATE-TIME';
DEFAULT : 'DEFAULT';
DEFINITIONS : 'DEFINITIONS';
DURATION : 'DURATION';
EMBEDDED : 'EMBEDDED';
ENCODED : 'ENCODED';
ENCODING_CONTROL : 'ENCODING-CONTROL';
END : 'END';
ENUMERATED : 'ENUMERATED';
EXCEPT : 'EXCEPT';
EXPLICIT : 'EXPLICIT';
EXPORTS : 'EXPORTS';
EXTENSIBILITY : 'EXTENSIBILITY';
EXTERNAL : 'EXTERNAL';
FROM : 'FROM';
IDENTIFIER : 'IDENTIFIER';
IMPLICIT : 'IMPLICIT';
IMPLIED : 'IMPLIED';
IMPORTS : 'IMPORTS';
INCLUDES : 'INCLUDES';
INSTANCE : 'INSTANCE';
INSTRUCTIONS : 'INSTRUCTIONS';
INTEGER : 'INTEGER';
INTERSECTION : 'INTERSECTION';
MAX : 'MAX';
MIN : 'MIN';
NULL : 'NULL';
OBJECT : 'OBJECT';
OCTET : 'OCTET';
OF : 'OF';
OID_IRI : 'OID-IRI';
OPTIONAL : 'OPTIONAL';
PATTERN : 'PATTERN';
PDV : 'PDV';
PRESENT : 'PRESENT';
PRIVATE : 'PRIVATE';
REAL : 'REAL';
RELATIVE_OID : 'RELATIVE-OID';
RELATIVE_OID_IRI : 'RELATIVE-OID-IRI';
SEQUENCE : 'SEQUENCE';
SET : 'SET';
SETTINGS : 'SETTINGS';
SIZE : 'SIZE';
STRING : 'STRING';
SYNTAX : 'SYNTAX';
TAGS : 'TAGS';
TIME : 'TIME';
TIME_OF_DAY : 'TIME-OF-DAY';
TYPE_IDENTIFIER : 'TYPE-IDENTIFIER';
UNION : 'UNION';
UNIQUE : 'UNIQUE';
UNIVERSAL : 'UNIVERSAL';
WITH : 'WITH';
// X.680, p 12.20
ASSIGN : '::=';
// X.680, p 12.22
ELLIPSIS : '...';
// X.680, p 12.21
RANGE : '..';
// X.680, p 12.23
//LEFT_VER_BRACKETS : '[[';
// X.680, p 12.24
//RIGHT_VER_BRACKETS : ']]';
// X.680, p 12.37
OPEN_BRACE : '{';
CLOSE_BRACE : '}';
LT : '<';
GT : '>';
COMMA : ',';
DOT : '.';
SLASH : '/';
OPEN_PAREN : '(';
CLOSE_PAREN : ')';
OPEN_BRACKET : '[';
CLOSE_BRACKET : ']';
HYPEN : '-' | '\u2011';
COLON : ':';
EQUALS : '=';
QUOT : '"';
APOST : '\'';
SEMI : ';';
AT : '@';
OR : '|';
EXCLAMATION : '!';
CARET : '^';
AMP : '&';
FieldIdentifier : AMP [A-Za-z] (HYPEN? [A-Za-z0-9] )*;
// X.680, pp 12.2 12.3 12.4 12.5
Identifier : [A-Za-z] (HYPEN? [A-Za-z0-9] )*;
NumberLiteral : Sign? Number;
RealLiteral : Sign? Number (DOT Digits)? (Exponent Sign? Number)?
| Sign? Number DOT Digits? Exponent Sign? Number;
BString : '\'' [01 ]* '\'B';
HString : '\'' [A-F0-9 ]* '\'H';
CString : '"' (~["]| '""' )* '"'
| '\'' (~[']| '\'\'' )* '\'';
fragment
Number : '0' | (NonZeroDigit Digits*);
fragment
Digits : Digit+;
fragment
Digit : '0' | NonZeroDigit;
fragment
NonZeroDigit : [1-9];
fragment
Sign : [+-];
fragment
Exponent : [eE];
fragment
Letter : SmallLetter | HighLetter;
fragment
HighLetter : [A-Z];
fragment
SmallLetter : [a-z];
// X.680, p 12.6
MULTI_LINE_COMMENT : '/*' .*? '*/' -> skip;
SINGLE_LINE_COMMENT : '--' ( ~[\-] '-' | ~[\-\r\n])* ('\r'?'\n' | '--' ) -> skip;
WS : [ \t\r\n\u000C]+ -> skip;
|
oeis/234/A234464.asm | neoneye/loda-programs | 11 | 27356 | ; A234464: 5*binomial(8*n+5, n)/(8*n+5).
; Submitted by <NAME>
; 1,5,50,630,8925,135751,2165800,35759900,605902440,10475490875,184068392508,3277575482090,59012418601500,1072549882307925,19651558477204200,362592313327737592,6731396321743423000,125645122201355505000,2356570385677427920770,44390560090743416800250,839440645162011478764990,15930107212394436990644430,303276373779380516038602000,5790677636952797462401212100,110862796765912935362355009000,2127723415280357141373834827028,40929395377081901258580581913840,788993248060931605830545698595150
mov $1,$0
mul $0,4
mov $2,5
add $2,$0
add $0,$2
bin $0,$1
mul $0,10
mul $1,4
add $2,$1
div $0,$2
div $0,2
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/s-rannum.adb | djamal2727/Main-Bearing-Analytical-Model | 0 | 25514 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . R A N D O M _ N U M B E R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2007-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. --
-- --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- --
-- The implementation here is derived from a C-program for MT19937, with --
-- initialization improved 2002/1/26. As required, the following notice is --
-- copied from the original program. --
-- --
-- Copyright (C) 1997 - 2002, <NAME> and <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 names of its contributors may not 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. --
-- --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- --
-- This is an implementation of the Mersenne Twister, twisted generalized --
-- feedback shift register of rational normal form, with state-bit --
-- reflection and tempering. This version generates 32-bit integers with a --
-- period of 2**19937 - 1 (a Mersenne prime, hence the name). For --
-- applications requiring more than 32 bits (up to 64), we concatenate two --
-- 32-bit numbers. --
-- --
-- See http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html for --
-- details. --
-- --
-- In contrast to the original code, we do not generate random numbers in --
-- batches of N. Measurement seems to show this has very little if any --
-- effect on performance, and it may be marginally better for real-time --
-- applications with hard deadlines. --
-- --
------------------------------------------------------------------------------
with Ada.Strings.Text_Output.Utils;
with Ada.Unchecked_Conversion;
with System.Random_Seed;
with Interfaces; use Interfaces;
use Ada;
package body System.Random_Numbers with
SPARK_Mode => Off
is
Image_Numeral_Length : constant := Max_Image_Width / N;
subtype Image_String is String (1 .. Max_Image_Width);
----------------------------
-- Algorithmic Parameters --
----------------------------
Lower_Mask : constant := 2**31 - 1;
Upper_Mask : constant := 2**31;
Matrix_A : constant array (State_Val range 0 .. 1) of State_Val
:= (0, 16#9908b0df#);
-- The twist transformation is represented by a matrix of the form
--
-- [ 0 I(31) ]
-- [ _a ]
--
-- where 0 is a 31x31 block of 0s, I(31) is the 31x31 identity matrix and
-- _a is a particular bit row-vector, represented here by a 32-bit integer.
-- If integer x represents a row vector of bits (with x(0), the units bit,
-- last), then
-- x * A = [0 x(31..1)] xor Matrix_A(x(0)).
U : constant := 11;
S : constant := 7;
B_Mask : constant := 16#9d2c5680#;
T : constant := 15;
C_Mask : constant := 16#efc60000#;
L : constant := 18;
-- The tempering shifts and bit masks, in the order applied
Seed0 : constant := 5489;
-- Default seed, used to initialize the state vector when Reset not called
Seed1 : constant := 19650218;
-- Seed used to initialize the state vector when calling Reset with an
-- initialization vector.
Mult0 : constant := 1812433253;
-- Multiplier for a modified linear congruential generator used to
-- initialize the state vector when calling Reset with a single integer
-- seed.
Mult1 : constant := 1664525;
Mult2 : constant := 1566083941;
-- Multipliers for two modified linear congruential generators used to
-- initialize the state vector when calling Reset with an initialization
-- vector.
-----------------------
-- Local Subprograms --
-----------------------
procedure Init (Gen : Generator; Initiator : Unsigned_32);
-- Perform a default initialization of the state of Gen. The resulting
-- state is identical for identical values of Initiator.
procedure Insert_Image
(S : in out Image_String;
Index : Integer;
V : State_Val);
-- Insert image of V into S, in the Index'th 11-character substring
function Extract_Value (S : String; Index : Integer) return State_Val;
-- Treat S as a sequence of 11-character decimal numerals and return
-- the result of converting numeral #Index (numbering from 0)
function To_Unsigned is
new Unchecked_Conversion (Integer_32, Unsigned_32);
function To_Unsigned is
new Unchecked_Conversion (Integer_64, Unsigned_64);
------------
-- Random --
------------
function Random (Gen : Generator) return Unsigned_32 is
G : Generator renames Gen.Writable.Self.all;
Y : State_Val;
I : Integer; -- should avoid use of identifier I ???
begin
I := G.I;
if I < N - M then
Y := (G.S (I) and Upper_Mask) or (G.S (I + 1) and Lower_Mask);
Y := G.S (I + M) xor Shift_Right (Y, 1) xor Matrix_A (Y and 1);
I := I + 1;
elsif I < N - 1 then
Y := (G.S (I) and Upper_Mask) or (G.S (I + 1) and Lower_Mask);
Y := G.S (I + (M - N))
xor Shift_Right (Y, 1)
xor Matrix_A (Y and 1);
I := I + 1;
elsif I = N - 1 then
Y := (G.S (I) and Upper_Mask) or (G.S (0) and Lower_Mask);
Y := G.S (M - 1) xor Shift_Right (Y, 1) xor Matrix_A (Y and 1);
I := 0;
else
Init (G, Seed0);
return Random (Gen);
end if;
G.S (G.I) := Y;
G.I := I;
Y := Y xor Shift_Right (Y, U);
Y := Y xor (Shift_Left (Y, S) and B_Mask);
Y := Y xor (Shift_Left (Y, T) and C_Mask);
Y := Y xor Shift_Right (Y, L);
return Y;
end Random;
generic
type Unsigned is mod <>;
type Real is digits <>;
with function Random (G : Generator) return Unsigned is <>;
function Random_Float_Template (Gen : Generator) return Real;
pragma Inline (Random_Float_Template);
-- Template for a random-number generator implementation that delivers
-- values of type Real in the range [0 .. 1], using values from Gen,
-- assuming that Unsigned is large enough to hold the bits of a mantissa
-- for type Real.
---------------------------
-- Random_Float_Template --
---------------------------
function Random_Float_Template (Gen : Generator) return Real is
pragma Compile_Time_Error
(Unsigned'Last <= 2**(Real'Machine_Mantissa - 1),
"insufficiently large modular type used to hold mantissa");
begin
-- This code generates random floating-point numbers from unsigned
-- integers. Assuming that Real'Machine_Radix = 2, it can deliver all
-- machine values of type Real (as implied by Real'Machine_Mantissa and
-- Real'Machine_Emin), which is not true of the standard method (to
-- which we fall back for nonbinary radix): computing Real(<random
-- integer>) / (<max random integer>+1). To do so, we first extract an
-- (M-1)-bit significand (where M is Real'Machine_Mantissa), and then
-- decide on a normalized exponent by repeated coin flips, decrementing
-- from 0 as long as we flip heads (1 bits). This process yields the
-- proper geometric distribution for the exponent: in a uniformly
-- distributed set of floating-point numbers, 1/2 of them will be in
-- (0.5, 1], 1/4 will be in (0.25, 0.5], and so forth. It makes a
-- further adjustment at binade boundaries (see comments below) to give
-- the effect of selecting a uniformly distributed real deviate in
-- [0..1] and then rounding to the nearest representable floating-point
-- number. The algorithm attempts to be stingy with random integers. In
-- the worst case, it can consume roughly -Real'Machine_Emin/32 32-bit
-- integers, but this case occurs with probability around
-- 2**Machine_Emin, and the expected number of calls to integer-valued
-- Random is 1. For another discussion of the issues addressed by this
-- process, see <NAME>'s unpublished paper at
-- http://allendowney.com/research/rand/downey07randfloat.pdf.
if Real'Machine_Radix /= 2 then
return Real'Machine
(Real (Unsigned'(Random (Gen))) * 2.0**(-Unsigned'Size));
else
declare
type Bit_Count is range 0 .. 4;
subtype T is Real'Base;
Trailing_Ones : constant array (Unsigned_32 range 0 .. 15)
of Bit_Count :=
(2#00000# => 0, 2#00001# => 1, 2#00010# => 0, 2#00011# => 2,
2#00100# => 0, 2#00101# => 1, 2#00110# => 0, 2#00111# => 3,
2#01000# => 0, 2#01001# => 1, 2#01010# => 0, 2#01011# => 2,
2#01100# => 0, 2#01101# => 1, 2#01110# => 0, 2#01111# => 4);
Pow_Tab : constant array (Bit_Count range 0 .. 3) of Real
:= (0 => 2.0**(0 - T'Machine_Mantissa),
1 => 2.0**(-1 - T'Machine_Mantissa),
2 => 2.0**(-2 - T'Machine_Mantissa),
3 => 2.0**(-3 - T'Machine_Mantissa));
Extra_Bits : constant Natural :=
(Unsigned'Size - T'Machine_Mantissa + 1);
-- Random bits left over after selecting mantissa
Mantissa : Unsigned;
X : Real; -- Scaled mantissa
R : Unsigned_32; -- Supply of random bits
R_Bits : Natural; -- Number of bits left in R
K : Bit_Count; -- Next decrement to exponent
begin
K := 0;
Mantissa := Random (Gen) / 2**Extra_Bits;
R := Unsigned_32 (Mantissa mod 2**Extra_Bits);
R_Bits := Extra_Bits;
X := Real (2**(T'Machine_Mantissa - 1) + Mantissa); -- Exact
if Extra_Bits < 4 and then R < 2 ** Extra_Bits - 1 then
-- We got lucky and got a zero in our few extra bits
K := Trailing_Ones (R);
else
Find_Zero : loop
-- R has R_Bits unprocessed random bits, a multiple of 4.
-- X needs to be halved for each trailing one bit. The
-- process stops as soon as a 0 bit is found. If R_Bits
-- becomes zero, reload R.
-- Process 4 bits at a time for speed: the two iterations
-- on average with three tests each was still too slow,
-- probably because the branches are not predictable.
-- This loop now will only execute once 94% of the cases,
-- doing more bits at a time will not help.
while R_Bits >= 4 loop
K := Trailing_Ones (R mod 16);
exit Find_Zero when K < 4; -- Exits 94% of the time
R_Bits := R_Bits - 4;
X := X / 16.0;
R := R / 16;
end loop;
-- Do not allow us to loop endlessly even in the (very
-- unlikely) case that Random (Gen) keeps yielding all ones.
exit Find_Zero when X = 0.0;
R := Random (Gen);
R_Bits := 32;
end loop Find_Zero;
end if;
-- K has the count of trailing ones not reflected yet in X. The
-- following multiplication takes care of that, as well as the
-- correction to move the radix point to the left of the mantissa.
-- Doing it at the end avoids repeated rounding errors in the
-- exceedingly unlikely case of ever having a subnormal result.
X := X * Pow_Tab (K);
-- The smallest value in each binade is rounded to by 0.75 of
-- the span of real numbers as its next larger neighbor, and
-- 1.0 is rounded to by half of the span of real numbers as its
-- next smaller neighbor. To account for this, when we encounter
-- the smallest number in a binade, we substitute the smallest
-- value in the next larger binade with probability 1/2.
if Mantissa = 0 and then Unsigned_32'(Random (Gen)) mod 2 = 0 then
X := 2.0 * X;
end if;
return X;
end;
end if;
end Random_Float_Template;
------------
-- Random --
------------
function Random (Gen : Generator) return Float is
function F is new Random_Float_Template (Unsigned_32, Float);
begin
return F (Gen);
end Random;
function Random (Gen : Generator) return Long_Float is
function F is new Random_Float_Template (Unsigned_64, Long_Float);
begin
return F (Gen);
end Random;
function Random (Gen : Generator) return Unsigned_64 is
begin
return Shift_Left (Unsigned_64 (Unsigned_32'(Random (Gen))), 32)
or Unsigned_64 (Unsigned_32'(Random (Gen)));
end Random;
---------------------
-- Random_Discrete --
---------------------
function Random_Discrete
(Gen : Generator;
Min : Result_Subtype := Default_Min;
Max : Result_Subtype := Result_Subtype'Last) return Result_Subtype
is
begin
if Max = Min then
return Max;
elsif Max < Min then
raise Constraint_Error;
-- In the 64-bit case, we have to be careful since not all 64-bit
-- unsigned values are representable in GNAT's universal integer.
elsif Result_Subtype'Base'Size > 32 then
declare
-- Ignore unequal-size warnings since GNAT's handling is correct.
pragma Warnings ("Z");
function Conv_To_Unsigned is
new Unchecked_Conversion (Result_Subtype'Base, Unsigned_64);
function Conv_To_Result is
new Unchecked_Conversion (Unsigned_64, Result_Subtype'Base);
pragma Warnings ("z");
N : constant Unsigned_64 :=
Conv_To_Unsigned (Max) - Conv_To_Unsigned (Min) + 1;
X, Slop : Unsigned_64;
begin
if N = 0 then
return Conv_To_Result (Conv_To_Unsigned (Min) + Random (Gen));
else
Slop := Unsigned_64'Last rem N + 1;
loop
X := Random (Gen);
exit when Slop = N or else X <= Unsigned_64'Last - Slop;
end loop;
return Conv_To_Result (Conv_To_Unsigned (Min) + X rem N);
end if;
end;
-- In the 32-bit case, we need to handle both integer and enumeration
-- types and, therefore, rely on 'Pos and 'Val in the computation.
elsif Result_Subtype'Pos (Max) - Result_Subtype'Pos (Min) = 2 ** 32 - 1
then
return Result_Subtype'Val
(Result_Subtype'Pos (Min) + Unsigned_32'Pos (Random (Gen)));
else
declare
N : constant Unsigned_32 :=
Unsigned_32 (Result_Subtype'Pos (Max) -
Result_Subtype'Pos (Min) + 1);
Slop : constant Unsigned_32 := Unsigned_32'Last rem N + 1;
X : Unsigned_32;
begin
loop
X := Random (Gen);
exit when Slop = N or else X <= Unsigned_32'Last - Slop;
end loop;
return
Result_Subtype'Val
(Result_Subtype'Pos (Min) + Unsigned_32'Pos (X rem N));
end;
end if;
end Random_Discrete;
------------------
-- Random_Float --
------------------
function Random_Float (Gen : Generator) return Result_Subtype is
begin
if Result_Subtype'Base'Digits > Float'Digits then
return Result_Subtype'Machine (Result_Subtype
(Long_Float'(Random (Gen))));
else
return Result_Subtype'Machine (Result_Subtype
(Float'(Random (Gen))));
end if;
end Random_Float;
-----------
-- Reset --
-----------
procedure Reset (Gen : Generator) is
begin
Init (Gen, Unsigned_32'Mod (Random_Seed.Get_Seed));
end Reset;
procedure Reset (Gen : Generator; Initiator : Integer_32) is
begin
Init (Gen, To_Unsigned (Initiator));
end Reset;
procedure Reset (Gen : Generator; Initiator : Unsigned_32) is
begin
Init (Gen, Initiator);
end Reset;
procedure Reset (Gen : Generator; Initiator : Integer) is
begin
-- This is probably an unnecessary precaution against future change, but
-- since the test is a static expression, no extra code is involved.
if Integer'Size <= 32 then
Init (Gen, To_Unsigned (Integer_32 (Initiator)));
else
declare
Initiator1 : constant Unsigned_64 :=
To_Unsigned (Integer_64 (Initiator));
Init0 : constant Unsigned_32 :=
Unsigned_32 (Initiator1 mod 2 ** 32);
Init1 : constant Unsigned_32 :=
Unsigned_32 (Shift_Right (Initiator1, 32));
begin
Reset (Gen, Initialization_Vector'(Init0, Init1));
end;
end if;
end Reset;
procedure Reset (Gen : Generator; Initiator : Initialization_Vector) is
G : Generator renames Gen.Writable.Self.all;
I, J : Integer;
begin
Init (G, Seed1);
I := 1;
J := 0;
if Initiator'Length > 0 then
for K in reverse 1 .. Integer'Max (N, Initiator'Length) loop
G.S (I) :=
(G.S (I) xor ((G.S (I - 1)
xor Shift_Right (G.S (I - 1), 30)) * Mult1))
+ Initiator (J + Initiator'First) + Unsigned_32 (J);
I := I + 1;
J := J + 1;
if I >= N then
G.S (0) := G.S (N - 1);
I := 1;
end if;
if J >= Initiator'Length then
J := 0;
end if;
end loop;
end if;
for K in reverse 1 .. N - 1 loop
G.S (I) :=
(G.S (I) xor ((G.S (I - 1)
xor Shift_Right (G.S (I - 1), 30)) * Mult2))
- Unsigned_32 (I);
I := I + 1;
if I >= N then
G.S (0) := G.S (N - 1);
I := 1;
end if;
end loop;
G.S (0) := Upper_Mask;
end Reset;
procedure Reset (Gen : Generator; From_State : Generator) is
G : Generator renames Gen.Writable.Self.all;
begin
G.S := From_State.S;
G.I := From_State.I;
end Reset;
procedure Reset (Gen : Generator; From_State : State) is
G : Generator renames Gen.Writable.Self.all;
begin
G.I := 0;
G.S := From_State;
end Reset;
procedure Reset (Gen : Generator; From_Image : String) is
G : Generator renames Gen.Writable.Self.all;
begin
G.I := 0;
for J in 0 .. N - 1 loop
G.S (J) := Extract_Value (From_Image, J);
end loop;
end Reset;
----------
-- Save --
----------
procedure Save (Gen : Generator; To_State : out State) is
Gen2 : Generator;
begin
if Gen.I = N then
Init (Gen2, 5489);
To_State := Gen2.S;
else
To_State (0 .. N - 1 - Gen.I) := Gen.S (Gen.I .. N - 1);
To_State (N - Gen.I .. N - 1) := Gen.S (0 .. Gen.I - 1);
end if;
end Save;
-----------
-- Image --
-----------
function Image (Of_State : State) return String is
Result : Image_String;
begin
Result := (others => ' ');
for J in Of_State'Range loop
Insert_Image (Result, J, Of_State (J));
end loop;
return Result;
end Image;
function Image (Gen : Generator) return String is
Result : Image_String;
begin
Result := (others => ' ');
for J in 0 .. N - 1 loop
Insert_Image (Result, J, Gen.S ((J + Gen.I) mod N));
end loop;
return Result;
end Image;
---------------
-- Put_Image --
---------------
procedure Put_Image
(S : in out Strings.Text_Output.Sink'Class; V : State) is
begin
Strings.Text_Output.Utils.Put_String (S, Image (V));
end Put_Image;
-----------
-- Value --
-----------
function Value (Coded_State : String) return State is
Gen : Generator;
S : State;
begin
Reset (Gen, Coded_State);
Save (Gen, S);
return S;
end Value;
----------
-- Init --
----------
procedure Init (Gen : Generator; Initiator : Unsigned_32) is
G : Generator renames Gen.Writable.Self.all;
begin
G.S (0) := Initiator;
for I in 1 .. N - 1 loop
G.S (I) :=
(G.S (I - 1) xor Shift_Right (G.S (I - 1), 30)) * Mult0
+ Unsigned_32 (I);
end loop;
G.I := 0;
end Init;
------------------
-- Insert_Image --
------------------
procedure Insert_Image
(S : in out Image_String;
Index : Integer;
V : State_Val)
is
Value : constant String := State_Val'Image (V);
begin
S (Index * 11 + 1 .. Index * 11 + Value'Length) := Value;
end Insert_Image;
-------------------
-- Extract_Value --
-------------------
function Extract_Value (S : String; Index : Integer) return State_Val is
Start : constant Integer := S'First + Index * Image_Numeral_Length;
begin
return State_Val'Value (S (Start .. Start + Image_Numeral_Length - 1));
end Extract_Value;
end System.Random_Numbers;
|
oeis/121/A121326.asm | neoneye/loda-programs | 11 | 10706 | <filename>oeis/121/A121326.asm
; A121326: Primes of the form 4*k^2 + 1.
; Submitted by <NAME>(s1)
; 5,17,37,101,197,257,401,577,677,1297,1601,2917,3137,4357,5477,7057,8101,8837,12101,13457,14401,15377,15877,16901,17957,21317,22501,24337,25601,28901,30977,32401,33857,41617,42437,44101,50177,52901,55697,57601,62501,65537,67601,69697,72901,78401,80657,90001,93637,98597,106277,115601,122501,147457,148997,156817,160001,164837,176401,184901,190097,193601,197137,215297,217157,220901,224677,240101,246017,287297,295937,309137,324901,331777,341057,352837,401957,404497,414737,417317,427717,454277,462401
seq $0,1912 ; Numbers n such that 4*n^2 + 1 is prime.
pow $0,2
mul $0,4
add $0,1
|
mc-sema/validator/x86/tests/SBB32rm.asm | randolphwong/mcsema | 2 | 85816 | <reponame>randolphwong/mcsema<gh_stars>1-10
BITS 32
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=
;TEST_FILE_META_END
; SBB32rm
;TEST_BEGIN_RECORDING
lea edi, [esp-0x4]
mov DWORD [edi], 0x1234abcd
mov eax, 0x56781234
sbb eax, [edi]
mov edi, 0x0
;TEST_END_RECORDING
|
gyak/gyak8/proba.adb | balintsoos/LearnAda | 0 | 17827 | with Get_Discreet, Text_IO; use Text_IO;
procedure Proba is
function Get_Int is new Get_Discreet(Character);
begin
Put_Line( Character'Image(Get_Int) );
end Proba;
|
source/strings/a-suzsfm.ads | ytomino/drake | 33 | 17101 | pragma License (Unrestricted);
-- extended unit
with Ada.Strings.Wide_Wide_Functions.Maps;
package Ada.Strings.Unbounded_Wide_Wide_Strings.Functions.Maps is
new Generic_Maps (Wide_Wide_Functions.Maps);
pragma Preelaborate (Ada.Strings.Unbounded_Wide_Wide_Strings.Functions.Maps);
|
examples/yes.asm | KrzysztofSzewczyk/asmbf | 15 | 99383 | <gh_stars>10-100
mov r1, 121
mov r2, 10
@y
out r1
out r2
jmp %y
|
programs/oeis/070/A070474.asm | karttu/loda | 1 | 3182 | <filename>programs/oeis/070/A070474.asm
; A070474: a(n) = n^3 mod 12, n^5 mod 12.
; 0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9,4,11,0,1,8,3,4,5,0,7,8,9
mov $1,$0
pow $1,7
mod $1,12
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_17276_1017.asm | ljhsiun2/medusa | 9 | 91198 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xbff2, %r14
nop
xor %r15, %r15
mov (%r14), %ebp
add %rbp, %rbp
lea addresses_normal_ht+0x16b32, %rsi
lea addresses_WT_ht+0x2bf2, %rdi
nop
xor $55223, %rax
mov $3, %rcx
rep movsq
nop
sub $35354, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r8
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// Load
lea addresses_UC+0xb68, %r8
nop
nop
nop
nop
nop
sub $14178, %rdx
vmovups (%r8), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %rbx
nop
nop
nop
nop
nop
dec %r8
// REPMOV
lea addresses_WT+0x12ff2, %rsi
lea addresses_A+0x6c72, %rdi
nop
nop
nop
inc %rdx
mov $113, %rcx
rep movsq
and $63562, %rcx
// Store
lea addresses_WC+0x8630, %r14
nop
nop
nop
nop
cmp %rbx, %rbx
mov $0x5152535455565758, %rdi
movq %rdi, %xmm5
vmovups %ymm5, (%r14)
nop
nop
nop
nop
nop
xor %rdi, %rdi
// Store
lea addresses_WT+0x1c3ae, %r8
and $10022, %rdx
movw $0x5152, (%r8)
nop
nop
nop
nop
nop
sub $56051, %rdx
// REPMOV
lea addresses_WT+0x12ff2, %rsi
lea addresses_WT+0x12ff2, %rdi
nop
nop
add $63917, %r13
mov $62, %rcx
rep movsb
nop
nop
nop
nop
add $5091, %rbx
// Store
lea addresses_WT+0x196e2, %rcx
nop
nop
nop
dec %r8
mov $0x5152535455565758, %r13
movq %r13, %xmm4
vmovups %ymm4, (%rcx)
xor %rbx, %rbx
// Faulty Load
lea addresses_WT+0x12ff2, %r14
nop
and $24479, %r13
movb (%r14), %bl
lea oracles, %r8
and $0xff, %rbx
shlq $12, %rbx
mov (%r8,%rbx,1), %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_A', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_WT', 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'39': 17276}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
src/yaml/text.ads | jquorning/dynamo | 15 | 1547 | <filename>src/yaml/text.ads
-- part of ParserTools, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "copying.txt"
with Ada.Containers;
with Ada.Strings.UTF_Encoding;
with Ada.Strings.Unbounded;
with System.Storage_Elements;
package Text is
-- this package defines a reference-counted string pointer type. it is used
-- for all YAML data entities and relieves the user from the need to
-- manually dispose events created by the parser.
--
-- typically, YAML content strings are deallocated in the same order as they
-- are allocated. this knowledge is built into a storage pool for efficient
-- memory usage and to avoid fragmentation.
--
-- to be able to efficiently interface with C, this package allocates its
-- strings so that they can directly be passed on to C without the need to
-- copy any data. Use the subroutines Export and Delete_Exported to get
-- C-compatible string values from a Reference. these subroutines also
-- take care of reference counting for values exposed to C. this means that
-- after exporting a value, you *must* eventually call Delete_Exported in
-- order for the value to be freed.
--
-- HINT: this package makes use of compiler implementation details and may
-- not work with other compilers. however, since there currently are no
-- Ada 2012 compilers but GNAT, this is not considered a problem.
-- the pool allocates the memory it uses on the heap. it is allowed for the
-- pool to vanish while References created on it are still around. the
-- heap memory is reclaimed when the pool itself and all References
-- created by it vanish.
--
-- this type has pointer semantics in order to allow the usage of the same
-- pool at different places without the need of access types. copying a
-- value of this type will make both values use the same memory. use Create
-- to generate a new independent pool.
-- all strings generated by Yaml are encoded in UTF-8, regardless of input
-- encoding.
subtype UTF_8_String is Ada.Strings.UTF_Encoding.UTF_8_String;
type UTF_8_String_Access is access UTF_8_String;
subtype Pool_Offset is System.Storage_Elements.Storage_Offset
range 0 .. System.Storage_Elements.Storage_Offset (Integer'Last);
-- this is a smart pointer. use Value to access its value.
subtype Reference is Ada.Strings.Unbounded.Unbounded_String;
-- shortcut for Object.Value.Data'Length
function Length (Object : Reference) return Natural renames Ada.Strings.Unbounded.Length;
function "&" (Left, Right : Reference) return String;
-- compares the string content of two Content values.
function "=" (Left, Right : Reference) return Boolean renames Ada.Strings.Unbounded."=";
function Hash (Object : Reference) return Ada.Containers.Hash_Type;
-- equivalent to the empty string. default value for References.
Empty : constant Reference;
-- this can be used for constant Reference values that are declared at
-- library level where no Pool is available. References pointing to a
-- Constant_Content_Holder are never freed.
subtype Constant_Instance is Reference;
-- note that there is a limit of 128 characters for Content values created
-- like this.
function Hold (Content : String) return Constant_Instance
renames Ada.Strings.Unbounded.To_Unbounded_String;
-- get a Reference value which is a reference to the string contained in the
-- Holder.
function Held (Holder : Constant_Instance) return Reference is (Holder);
private
-- this forces GNAT to store the First and Last dope values right before
-- the first element of the String. we use that to our advantage.
for UTF_8_String_Access'Size use Standard'Address_Size;
type Chunk_Index_Type is range 1 .. 10;
subtype Refcount_Type is Integer range 0 .. 2 ** 24 - 1;
-- the pool consists of multiple chunks of memory. strings are allocated
-- inside the chunks.
type Pool_Array is array (Pool_Offset range <>) of System.Storage_Elements.Storage_Element;
type Chunk is access Pool_Array;
type Chunk_Array is array (Chunk_Index_Type) of Chunk;
type Usage_Array is array (Chunk_Index_Type) of Natural;
-- the idea is that Cur is the pointer to the active Chunk. all new strings
-- are allocated in that active Chunk until there is no more space. then,
-- we allocate a new Chunk of twice the size of the current one and make
-- that the current Chunk. the old Chunk lives on until all Content strings
-- allocated on it vanish. Usage is the number of strings currently
-- allocated on the Chunk and is used as reference count. the current Chunk
-- has Usage + 1 which prevents its deallocation even if the last Content
-- string on it vanishes. the Content type's finalization takes care of
-- decrementing the Usage value that counts allocated strings, while the
-- String_Pool type's deallocation takes care of removing the +1 for the
-- current Chunk.
--
-- we treat each Chunk basically as a bitvector ring list, and Pos is the
-- current offset in the current Chunk. instead of having a full bitvector
-- for allocating, we use the dope values from the strings that stay in the
-- memory after deallocation. besides the First and Last values, we also
-- store a reference count in the dope. so when searching for a place to
-- allocate a new string, we can skip over regions that have a non-zero
-- reference count in their header, and those with a 0 reference count are
-- available space. compared to a real bitvector, we always have the
-- information of the length of an free region available. we can avoid
-- fragmentation by merging a region that is freed with the surrounding free
-- regions.
type Pool_Data is record
Refcount : Refcount_Type := 1;
Chunks : Chunk_Array;
Usage : Usage_Array := (1 => 1, others => 0);
Cur : Chunk_Index_Type := 1;
Pos : Pool_Offset;
end record;
type Pool_Data_Access is access Pool_Data;
for Pool_Data_Access'Size use Standard'Address_Size;
-- this is the dope vector of each string allocated in a Chunk. it is put
-- immediately before the string's value. note that the First and Last
-- elements are at the exact positions where GNAT searches for the string's
-- boundary dope. this allows us to access those values for maintaining the
-- ring list.
type Header is record
Pool : Pool_Data_Access;
Chunk_Index : Chunk_Index_Type;
Refcount : Refcount_Type := 1;
First, Last : Pool_Offset;
end record;
Chunk_Index_Start : constant := Standard'Address_Size;
Refcount_Start : constant := Standard'Address_Size + 8;
First_Start : constant := Standard'Address_Size + 32;
Last_Start : constant := First_Start + Integer'Size;
Header_End : constant := Last_Start + Integer'Size - 1;
for Header use record
Pool at 0 range 0 .. Chunk_Index_Start - 1;
Chunk_Index at 0 range Chunk_Index_Start .. Refcount_Start - 1;
Refcount at 0 range Refcount_Start .. First_Start - 1;
First at 0 range First_Start .. Last_Start - 1;
Last at 0 range Last_Start .. Header_End;
end record;
for Header'Size use Header_End + 1;
use type System.Storage_Elements.Storage_Offset;
Header_Size : constant Pool_Offset := Header'Size / System.Storage_Unit;
Chunk_Start_Index : constant := Chunk_Index_Start / System.Storage_Unit + 1;
Refcount_Start_Index : constant := Refcount_Start / System.Storage_Unit + 1;
First_Start_Index : constant := First_Start / System.Storage_Unit + 1;
Last_Start_Index : constant := Last_Start / System.Storage_Unit + 1;
End_Index : constant := (Header_End + 1) / System.Storage_Unit;
type Accessor (Data : not null access constant UTF_8_String) is limited
record
-- holds a copy of the smart pointer, so the string cannot be freed
-- while the accessor lives.
Hold : Reference;
end record;
Empty : constant Reference := Ada.Strings.Unbounded.Null_Unbounded_String;
-- it is important that all allocated strings are aligned to the header
-- length. else, it may happen that we generate a region of free memory that
-- is not large enough to hold a header – but we need to write the header
-- there to hold information for the ring list. therefore, whenever we
-- calculate offsets, we use this to round them up to a multiple of
-- Header_Size.
function Round_To_Header_Size (Length : Pool_Offset)
return Pool_Offset is
((Length + Header_Size - 1) / Header_Size * Header_Size);
end Text;
|
src/08-events/damcyan-to-bridge.asm | chaoshades/snes-ffci | 0 | 100306 | org $15C6FA ; Routine to hack
skip 19 ; Skip to $15C70D
CMP #$97 ; Check if map is on row 97
skip 2 ; Skip to $15C711
LDA #$3F ; Load 1A (bridge)
STA $7F5D09,x ; Store new tile into 7F:9898
nop #5 ; Delete code until $15C71C
skip 1 ; Skip to $15C71D
CMP #$98 ; Check if map is on row 98
skip 2 ; Skip to $15C723
LDA #$3F ; Load 1A (bridge)
STA $7F5D09,x ; Store new tile into 7F:9898
nop #5 ; Delete code until $15C72C |
src/MJ/Semantics/Objects.agda | metaborg/mj.agda | 10 | 16896 | <reponame>metaborg/mj.agda
open import MJ.Types as Types
import MJ.Classtable.Core as Core
module MJ.Semantics.Objects {c}(Ct : Core.Classtable c) where
open import Prelude
open import Level renaming (suc to lsuc; zero to lzero)
open import Data.List
open import Data.List.Relation.Unary.All
open import Data.List.Prefix
open Core c
open Classtable Ct
open import MJ.Classtable.Membership Ct
open import MJ.Semantics.Values Ct
open import MJ.LexicalScope c
{-
Abstract interface for object encodings.
-}
record ObjEncoding : Set (lsuc lzero) where
field
Obj : World c → Cid c → Set
weaken-obj : ∀ {W W'} cid → W' ⊒ W → Obj W cid → Obj W' cid
getter : ∀ {W m a} c → Obj W c → IsMember c FIELD m a → Val W a
setter : ∀ {W m a} c → Obj W c → IsMember c FIELD m a → Val W a → Obj W c
defaultObject : ∀ {W} c → Obj W c
data StoreVal (W : World c) : Ty⁺ c → Set where
val : ∀ {ty} → Val W ty → StoreVal W (vty ty)
obj : ∀ cid → Obj W cid → StoreVal W (obj cid)
Store : World c → Set
Store W = All (StoreVal W) W
|
programs/oeis/101/A101402.asm | jmorken/loda | 1 | 94028 | ; A101402: a(0)=0, a(1)=1; for n>=2, let k = smallest power of 2 that is >= n, then a(n) = a(k/2) + a(n-1-k/2).
; 0,1,1,1,2,2,3,3,3,3,4,4,4,5,5,6,6,6,7,7,7,8,8,9,9,9,9,10,10,10,11,11,12,12,13,13,13,14,14,15,15,15,15,16,16,16,17,17,18,18,18,19,19,19,20,20,21,21,21,21,22,22,22,23,23,23,24,24,24,25,25,26,26,26,26,27,27,27,28,28,29,29,29,30,30,30,31,31,32,32,32,32,33,33,33,34,34,35,35,36,36,36,37,37,38,38,38,38,39,39,39,40,40,41,41,41,42,42,42,43,43,44,44,44,44,45,45,45,46,46,47,47,47,48,48,49,49,49,49,50,50,50,51,51,52,52,52,53,53,53,54,54,55,55,55,55,56,56,56,57,57,58,58,59,59,59,60,60,61,61,61,61,62,62,62,63,63,64,64,64,65,65,65,66,66,67,67,67,67,68,68,68,69,69,69,70,70,70,71,71,72,72,72,72,73,73,73,74,74,75,75,75,76,76,76,77,77,78,78,78,78,79,79,79,80,80,81,81,82,82,82,83,83,84,84,84,84,85,85,85,86,86,87,87,87,88,88,88,89,89
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
cal $0,164349 ; The limit of the string "0, 1" under the operation 'repeat string twice and remove last symbol'.
add $1,$0
lpe
|
Tests/sublime-syntax tests/syntax_test_preprocessor_context.nasm | 13xforever/x86-assembly-textmate-bundle | 69 | 9737 | ; SYNTAX TEST "Packages/User/x86_64 Assembly.tmbundle/Syntaxes/Nasm Assembly.sublime-syntax"
%push foobar
;<- punctuation.definition.keyword.preprocessor
;^^^^ keyword.control.preprocessor
%pop repeat
;<- punctuation.definition.keyword.preprocessor
;^^^ keyword.control.preprocessor
%macro repeat 0
%push repeat
%$begin:
; ^^ punctuation.definition.keyword.preprocessor
; ^^^^^ entity.name.constant
%endmacro
%macro until 1
j%-1 %$begin
%pop
%endmacro
%define %$localmac 3
%$$localmac
%$$$localmac
;<- punctuation.definition.keyword.preprocessor
;^^^ punctuation.definition.keyword.preprocessor
; ^^^^^^^^ entity.name.constant
; deprecated
%macro ctxthru 0
%push ctx1
%assign %$external 1
%push ctx2
%assign %$internal 1
mov eax, %$external
mov eax, %$internal
%pop
%pop
%endmacro
; correct
%macro ctxthru 0
%push ctx1
%assign %$external 1
%push ctx2
%assign %$internal 1
mov eax, %$$external ; notice $$
mov eax, %$internal
%pop
%pop
%endmacro
%repl newname
;<- punctuation.definition.keyword.preprocessor
;^^^^ keyword.control.preprocessor
%macro if 1
%push if
j%-1 %$ifnot
%endmacro
%macro else 0
%ifctx if
%repl else
jmp %$ifend
%$ifnot:
%else
%error "expected `if' before `else'"
%endif
%endmacro
%macro endif 0
%ifctx if
%$ifnot:
%pop
%elifctx else
%$ifend:
%pop
%else
%error "expected `if' or `else' before `endif'"
%endif
%endmacro
%arg
;<- punctuation.definition.keyword.preprocessor
;^^^ keyword.control.preprocessor
%stacksize
;<- punctuation.definition.keyword.preprocessor
;^^^^^^^^^ keyword.control.preprocessor
%local
;<- punctuation.definition.keyword.preprocessor
;^^^^^ keyword.control.preprocessor
some_function:
%push mycontext ; save the current context
%stacksize large ; tell NASM to use bp
; ^ punctuation.definition.keyword.preprocessor
; ^^^^^^^^^ keyword.control.preprocessor
; ^^^^^ support.constant.macro - invalid.illegal
%arg i:word, j_ptr:word
; ^ punctuation.definition.keyword.preprocessor
; ^^^ keyword.control.preprocessor
; ^ variable.parameter.macro
; ^ punctuation.separator
; ^^^^ storage.type
; ^ punctuation.separator
mov ax,[i]
mov bx,[j_ptr]
add ax,[bx]
ret
%pop ; restore original context
%arg invalid, valid:invalid
; ^^^^^^^ invalid.illegal
; ^^^^^ variable.parameter.macro
; ^^^^^^^ invalid.illegal
%stacksize flat
; ^^^^ support.constant.macro - invalid.illegal
%stacksize flat64
; ^^^^^^ support.constant.macro - invalid.illegal
%stacksize large
; ^^^^^ support.constant.macro - invalid.illegal
%stacksize small
; ^^^^^ support.constant.macro - invalid.illegal
%stacksize invalid
; ^^^^^^^ invalid.illegal
%stacksize flat32
; ^^^^^^ invalid.illegal
silly_swap:
%push mycontext ; save the current context
%stacksize small ; tell NASM to use bp
%assign %$localsize 0 ; see text for explanation
%local old_ax:word, old_dx:word
enter %$localsize,0 ; see text for explanation
mov [old_ax],ax ; swap ax & bx
mov [old_dx],dx ; and swap dx & cx
mov ax,bx
mov dx,cx
mov bx,[old_ax]
mov cx,[old_dx]
leave ; restore old bp
ret ;
%pop ; restore original context
%local invalid, valid:invalid
; ^^^^^^^ invalid.illegal
; ^^^^^ variable.parameter.macro
; ^^^^^^^ invalid.illegal
|
message/generation/swift-mt-generation/repository/SR2018/grammars/SwiftMtParser_MT506.g4 | Yanick-Salzmann/message-converter-c | 0 | 6356 | <filename>message/generation/swift-mt-generation/repository/SR2018/grammars/SwiftMtParser_MT506.g4<gh_stars>0
grammar SwiftMtParser_MT506;
@lexer::header {
#include "repository/ISwiftMtParser.h"
#include "SwiftMtMessage.pb.h"
#include <vector>
#include <string>
#include "BaseErrorListener.h"
}
@parser::header {
#include "repository/ISwiftMtParser.h"
#include "SwiftMtMessage.pb.h"
#include <vector>
#include <string>
#include "BaseErrorListener.h"
#include "SwiftMtParser_MT506Lexer.h"
}
@parser::members {
public:
typedef SwiftMtParser_MT506Lexer tLexer;
typedef SwiftMtParser_MT506Parser tParser;
private:
std::vector<std::string> _errors;
public:
[[nodiscard]] const std::vector<std::string>& errors() const { return _errors; }
private:
class DefaultErrorListener : public antlr4::BaseErrorListener {
private:
std::vector<std::string>& _errors;
public:
explicit DefaultErrorListener(std::vector<std::string>& errors) : _errors(errors) { }
void syntaxError(Recognizer *recognizer, antlr4::Token * offendingSymbol, size_t line, size_t charPositionInLine,
const std::string &msg, std::exception_ptr e) override {
_errors.push_back(msg);
}
};
DefaultErrorListener _error_listener { _errors };
public:
class Helper : public ISwiftMtParser {
public:
bool parse_message(const std::string& message, std::vector<std::string>& errors, SwiftMtMessage& out_message) override {
antlr4::ANTLRInputStream stream{message};
tLexer lexer{&stream};
antlr4::CommonTokenStream token_stream{&lexer};
tParser parser{&token_stream};
return parser.process(errors, out_message);
}
};
private:
SwiftMtMessage _message_builder{};
bool process(std::vector<std::string>& errors, SwiftMtMessage& out_message) {
_errors.clear();
removeErrorListeners();
addErrorListener(&_error_listener);
_message_builder = SwiftMtMessage{};
message();
if(!_errors.empty()) {
errors.insert(errors.end(), _errors.begin(), _errors.end());
return false;
}
out_message = _message_builder;
return true;
}
public:
[[nodiscard]] SwiftMtMessage parsed_message() const {
return _message_builder;
}
}
message : bh ah uh? mt tr? EOF;
bh : TAG_BH bh_content RBRACE ;
bh_content : ~(RBRACE)+ ;
ah : TAG_AH ah_content RBRACE ;
ah_content : ~( RBRACE )+ ;
uh : TAG_UH sys_block RBRACE ;
tr : TAG_TR sys_block RBRACE ;
sys_block : sys_element+ ;
sys_element : LBRACE sys_element_key COLON sys_element_content RBRACE ;
sys_element_key : ~( COLON | RBRACE )+ ;
sys_element_content : ~( RBRACE )+ ;
mt returns [message::definition::swift::mt::MessageText elem] @after { _message_builder.mutable_msg_text()->MergeFrom($elem); }
: TAG_MT seq_A seq_B seq_C* seq_D* seq_E? MT_END;
seq_A returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("A"); } :
fld_16R_A { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_A.fld); }
fld_28E_A { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_28E_A.fld); }
fld_20C_A+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_20C_A.fld); }
fld_23G_A { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_23G_A.fld); }
seq_A1+ { $elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom($seq_A1.elem); }
fld_98a_A? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_98a_A.fld); }
fld_22a_A { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_22a_A.fld); }
fld_95a_A+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_95a_A.fld); }
fld_70C_A? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_70C_A.fld); }
seq_A2* { $elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom($seq_A2.elem); }
fld_16S_A { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_A.fld); }
;
seq_A1 returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("A1"); } :
fld_16R_A1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_A1.fld); }
fld_22F_A1? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_22F_A1.fld); }
fld_98A_A1? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_98A_A1.fld); }
fld_13B_A1? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_13B_A1.fld); }
fld_70C_A1? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_70C_A1.fld); }
fld_16S_A1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_A1.fld); }
;
seq_A2 returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("A2"); } :
fld_16R_A2 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_A2.fld); }
fld_13a_A2? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_13a_A2.fld); }
fld_20C_A2 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_20C_A2.fld); }
fld_16S_A2 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_A2.fld); }
;
seq_B returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("B"); } :
fld_16R_B { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_B.fld); }
fld_95a_B { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_95a_B.fld); }
fld_19B_B+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_19B_B.fld); }
fld_98a_B+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_98a_B.fld); }
seq_B1? { $elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom($seq_B1.elem); }
fld_16S_B { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_B.fld); }
;
seq_B1 returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("B1"); } :
fld_16R_B1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_B1.fld); }
fld_19B_B1* { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_19B_B1.fld); }
fld_16S_B1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_B1.fld); }
;
seq_C returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("C"); } :
fld_16R_C { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_C.fld); }
fld_20C_C* { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_20C_C.fld); }
fld_22a_C { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_22a_C.fld); }
fld_98A_C? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_98A_C.fld); }
fld_95a_C* { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_95a_C.fld); }
fld_19A_C+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_19A_C.fld); }
fld_99A_C? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_99A_C.fld); }
fld_22F_C? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_22F_C.fld); }
fld_92a_C+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_92a_C.fld); }
fld_70D_C? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_70D_C.fld); }
seq_C1? { $elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom($seq_C1.elem); }
seq_C2? { $elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom($seq_C2.elem); }
seq_C3? { $elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom($seq_C3.elem); }
fld_16S_C { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_C.fld); }
;
seq_C1 returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("C1"); } :
fld_16R_C1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_C1.fld); }
fld_19B_C1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_19B_C1.fld); }
fld_35B_C1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_35B_C1.fld); }
fld_36B_C1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_36B_C1.fld); }
fld_92A_C1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_92A_C1.fld); }
fld_16S_C1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_C1.fld); }
;
seq_C2 returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("C2"); } :
fld_16R_C2 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_C2.fld); }
fld_98A_C2+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_98A_C2.fld); }
fld_19B_C2* { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_19B_C2.fld); }
fld_70C_C2? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_70C_C2.fld); }
fld_12B_C2? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_12B_C2.fld); }
fld_90a_C2? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_90a_C2.fld); }
fld_16S_C2 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_C2.fld); }
;
seq_C3 returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("C3"); } :
fld_16R_C3 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_C3.fld); }
fld_98A_C3+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_98A_C3.fld); }
fld_19B_C3+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_19B_C3.fld); }
fld_92A_C3 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_92A_C3.fld); }
fld_16S_C3 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_C3.fld); }
;
seq_D returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("D"); } :
fld_16R_D { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_D.fld); }
fld_20C_D { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_20C_D.fld); }
fld_22H_D { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_22H_D.fld); }
fld_25D_D? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_25D_D.fld); }
fld_19B_D+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_19B_D.fld); }
fld_99A_D? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_99A_D.fld); }
fld_22F_D? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_22F_D.fld); }
fld_92a_D+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_92a_D.fld); }
seq_D1? { $elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom($seq_D1.elem); }
seq_D2? { $elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom($seq_D2.elem); }
seq_D3? { $elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom($seq_D3.elem); }
fld_16S_D { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_D.fld); }
;
seq_D1 returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("D1"); } :
fld_16R_D1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_D1.fld); }
fld_19B_D1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_19B_D1.fld); }
fld_35B_D1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_35B_D1.fld); }
fld_36B_D1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_36B_D1.fld); }
fld_92A_D1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_92A_D1.fld); }
fld_98A_D1? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_98A_D1.fld); }
fld_94B_D1* { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_94B_D1.fld); }
fld_70C_D1? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_70C_D1.fld); }
fld_16S_D1 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_D1.fld); }
;
seq_D2 returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("D2"); } :
fld_16R_D2 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_D2.fld); }
fld_19B_D2 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_19B_D2.fld); }
fld_22H_D2 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_22H_D2.fld); }
fld_98A_D2? { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_98A_D2.fld); }
fld_16S_D2 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_D2.fld); }
;
seq_D3 returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("D3"); } :
fld_16R_D3 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_D3.fld); }
fld_22H_D3 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_22H_D3.fld); }
fld_98a_D3+ { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_98a_D3.fld); }
fld_95a_D3 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_95a_D3.fld); }
fld_19B_D3 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_19B_D3.fld); }
fld_16S_D3 { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_D3.fld); }
;
seq_E returns [message::definition::swift::mt::Sequence elem] @init { $elem.set_tag("E"); } :
fld_16R_E { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16R_E.fld); }
fld_95a_E* { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_95a_E.fld); }
fld_19A_E* { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_19A_E.fld); }
fld_16S_E { $elem.mutable_objects()->Add()->mutable_field()->MergeFrom($fld_16S_E.fld); }
;
fld_16R_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_28E_A returns [message::definition::swift::mt::Field fld] :
fld_28E_A_E { $fld.MergeFrom($fld_28E_A_E.fld); }
;
fld_20C_A returns [message::definition::swift::mt::Field fld] :
fld_20C_A_C { $fld.MergeFrom($fld_20C_A_C.fld); }
;
fld_23G_A returns [message::definition::swift::mt::Field fld] :
fld_23G_A_G { $fld.MergeFrom($fld_23G_A_G.fld); }
;
fld_16R_A1 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_22F_A1 returns [message::definition::swift::mt::Field fld] :
fld_22F_A1_F { $fld.MergeFrom($fld_22F_A1_F.fld); }
;
fld_98A_A1 returns [message::definition::swift::mt::Field fld] :
fld_98A_A1_A { $fld.MergeFrom($fld_98A_A1_A.fld); }
;
fld_13B_A1 returns [message::definition::swift::mt::Field fld] :
fld_13B_A1_B { $fld.MergeFrom($fld_13B_A1_B.fld); }
;
fld_70C_A1 returns [message::definition::swift::mt::Field fld] :
fld_70C_A1_C { $fld.MergeFrom($fld_70C_A1_C.fld); }
;
fld_16S_A1 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_98a_A returns [message::definition::swift::mt::Field fld] :
fld_98a_A_A { $fld.MergeFrom($fld_98a_A_A.fld); }
| fld_98a_A_C { $fld.MergeFrom($fld_98a_A_C.fld); }
| fld_98a_A_E { $fld.MergeFrom($fld_98a_A_E.fld); }
;
fld_22a_A returns [message::definition::swift::mt::Field fld] :
fld_22a_A_F { $fld.MergeFrom($fld_22a_A_F.fld); }
| fld_22a_A_H { $fld.MergeFrom($fld_22a_A_H.fld); }
;
fld_95a_A returns [message::definition::swift::mt::Field fld] :
fld_95a_A_P { $fld.MergeFrom($fld_95a_A_P.fld); }
| fld_95a_A_Q { $fld.MergeFrom($fld_95a_A_Q.fld); }
| fld_95a_A_R { $fld.MergeFrom($fld_95a_A_R.fld); }
;
fld_70C_A returns [message::definition::swift::mt::Field fld] :
fld_70C_A_C { $fld.MergeFrom($fld_70C_A_C.fld); }
;
fld_16R_A2 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_13a_A2 returns [message::definition::swift::mt::Field fld] :
fld_13a_A2_A { $fld.MergeFrom($fld_13a_A2_A.fld); }
| fld_13a_A2_B { $fld.MergeFrom($fld_13a_A2_B.fld); }
;
fld_20C_A2 returns [message::definition::swift::mt::Field fld] :
fld_20C_A2_C { $fld.MergeFrom($fld_20C_A2_C.fld); }
;
fld_16S_A2 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16S_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16R_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_95a_B returns [message::definition::swift::mt::Field fld] :
fld_95a_B_P { $fld.MergeFrom($fld_95a_B_P.fld); }
| fld_95a_B_Q { $fld.MergeFrom($fld_95a_B_Q.fld); }
| fld_95a_B_R { $fld.MergeFrom($fld_95a_B_R.fld); }
;
fld_19B_B returns [message::definition::swift::mt::Field fld] :
fld_19B_B_B { $fld.MergeFrom($fld_19B_B_B.fld); }
;
fld_98a_B returns [message::definition::swift::mt::Field fld] :
fld_98a_B_A { $fld.MergeFrom($fld_98a_B_A.fld); }
| fld_98a_B_C { $fld.MergeFrom($fld_98a_B_C.fld); }
;
fld_16R_B1 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_19B_B1 returns [message::definition::swift::mt::Field fld] :
fld_19B_B1_B { $fld.MergeFrom($fld_19B_B1_B.fld); }
;
fld_16S_B1 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16S_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16R_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_20C_C returns [message::definition::swift::mt::Field fld] :
fld_20C_C_C { $fld.MergeFrom($fld_20C_C_C.fld); }
;
fld_22a_C returns [message::definition::swift::mt::Field fld] :
fld_22a_C_F { $fld.MergeFrom($fld_22a_C_F.fld); }
| fld_22a_C_H { $fld.MergeFrom($fld_22a_C_H.fld); }
;
fld_98A_C returns [message::definition::swift::mt::Field fld] :
fld_98A_C_A { $fld.MergeFrom($fld_98A_C_A.fld); }
;
fld_95a_C returns [message::definition::swift::mt::Field fld] :
fld_95a_C_P { $fld.MergeFrom($fld_95a_C_P.fld); }
| fld_95a_C_Q { $fld.MergeFrom($fld_95a_C_Q.fld); }
| fld_95a_C_R { $fld.MergeFrom($fld_95a_C_R.fld); }
;
fld_19A_C returns [message::definition::swift::mt::Field fld] :
fld_19A_C_A { $fld.MergeFrom($fld_19A_C_A.fld); }
;
fld_99A_C returns [message::definition::swift::mt::Field fld] :
fld_99A_C_A { $fld.MergeFrom($fld_99A_C_A.fld); }
;
fld_22F_C returns [message::definition::swift::mt::Field fld] :
fld_22F_C_F { $fld.MergeFrom($fld_22F_C_F.fld); }
;
fld_92a_C returns [message::definition::swift::mt::Field fld] :
fld_92a_C_A { $fld.MergeFrom($fld_92a_C_A.fld); }
| fld_92a_C_B { $fld.MergeFrom($fld_92a_C_B.fld); }
;
fld_70D_C returns [message::definition::swift::mt::Field fld] :
fld_70D_C_D { $fld.MergeFrom($fld_70D_C_D.fld); }
;
fld_16R_C1 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_19B_C1 returns [message::definition::swift::mt::Field fld] :
fld_19B_C1_B { $fld.MergeFrom($fld_19B_C1_B.fld); }
;
fld_35B_C1 returns [message::definition::swift::mt::Field fld] :
fld_35B_C1_B { $fld.MergeFrom($fld_35B_C1_B.fld); }
;
fld_36B_C1 returns [message::definition::swift::mt::Field fld] :
fld_36B_C1_B { $fld.MergeFrom($fld_36B_C1_B.fld); }
;
fld_92A_C1 returns [message::definition::swift::mt::Field fld] :
fld_92A_C1_A { $fld.MergeFrom($fld_92A_C1_A.fld); }
;
fld_16S_C1 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16R_C2 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_98A_C2 returns [message::definition::swift::mt::Field fld] :
fld_98A_C2_A { $fld.MergeFrom($fld_98A_C2_A.fld); }
;
fld_19B_C2 returns [message::definition::swift::mt::Field fld] :
fld_19B_C2_B { $fld.MergeFrom($fld_19B_C2_B.fld); }
;
fld_70C_C2 returns [message::definition::swift::mt::Field fld] :
fld_70C_C2_C { $fld.MergeFrom($fld_70C_C2_C.fld); }
;
fld_12B_C2 returns [message::definition::swift::mt::Field fld] :
fld_12B_C2_B { $fld.MergeFrom($fld_12B_C2_B.fld); }
;
fld_90a_C2 returns [message::definition::swift::mt::Field fld] :
fld_90a_C2_A { $fld.MergeFrom($fld_90a_C2_A.fld); }
| fld_90a_C2_B { $fld.MergeFrom($fld_90a_C2_B.fld); }
;
fld_16S_C2 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16R_C3 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_98A_C3 returns [message::definition::swift::mt::Field fld] :
fld_98A_C3_A { $fld.MergeFrom($fld_98A_C3_A.fld); }
;
fld_19B_C3 returns [message::definition::swift::mt::Field fld] :
fld_19B_C3_B { $fld.MergeFrom($fld_19B_C3_B.fld); }
;
fld_92A_C3 returns [message::definition::swift::mt::Field fld] :
fld_92A_C3_A { $fld.MergeFrom($fld_92A_C3_A.fld); }
;
fld_16S_C3 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16S_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16R_D returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_20C_D returns [message::definition::swift::mt::Field fld] :
fld_20C_D_C { $fld.MergeFrom($fld_20C_D_C.fld); }
;
fld_22H_D returns [message::definition::swift::mt::Field fld] :
fld_22H_D_H { $fld.MergeFrom($fld_22H_D_H.fld); }
;
fld_25D_D returns [message::definition::swift::mt::Field fld] :
fld_25D_D_D { $fld.MergeFrom($fld_25D_D_D.fld); }
;
fld_19B_D returns [message::definition::swift::mt::Field fld] :
fld_19B_D_B { $fld.MergeFrom($fld_19B_D_B.fld); }
;
fld_99A_D returns [message::definition::swift::mt::Field fld] :
fld_99A_D_A { $fld.MergeFrom($fld_99A_D_A.fld); }
;
fld_22F_D returns [message::definition::swift::mt::Field fld] :
fld_22F_D_F { $fld.MergeFrom($fld_22F_D_F.fld); }
;
fld_92a_D returns [message::definition::swift::mt::Field fld] :
fld_92a_D_A { $fld.MergeFrom($fld_92a_D_A.fld); }
| fld_92a_D_B { $fld.MergeFrom($fld_92a_D_B.fld); }
;
fld_16R_D1 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_19B_D1 returns [message::definition::swift::mt::Field fld] :
fld_19B_D1_B { $fld.MergeFrom($fld_19B_D1_B.fld); }
;
fld_35B_D1 returns [message::definition::swift::mt::Field fld] :
fld_35B_D1_B { $fld.MergeFrom($fld_35B_D1_B.fld); }
;
fld_36B_D1 returns [message::definition::swift::mt::Field fld] :
fld_36B_D1_B { $fld.MergeFrom($fld_36B_D1_B.fld); }
;
fld_92A_D1 returns [message::definition::swift::mt::Field fld] :
fld_92A_D1_A { $fld.MergeFrom($fld_92A_D1_A.fld); }
;
fld_98A_D1 returns [message::definition::swift::mt::Field fld] :
fld_98A_D1_A { $fld.MergeFrom($fld_98A_D1_A.fld); }
;
fld_94B_D1 returns [message::definition::swift::mt::Field fld] :
fld_94B_D1_B { $fld.MergeFrom($fld_94B_D1_B.fld); }
;
fld_70C_D1 returns [message::definition::swift::mt::Field fld] :
fld_70C_D1_C { $fld.MergeFrom($fld_70C_D1_C.fld); }
;
fld_16S_D1 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16R_D2 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_19B_D2 returns [message::definition::swift::mt::Field fld] :
fld_19B_D2_B { $fld.MergeFrom($fld_19B_D2_B.fld); }
;
fld_22H_D2 returns [message::definition::swift::mt::Field fld] :
fld_22H_D2_H { $fld.MergeFrom($fld_22H_D2_H.fld); }
;
fld_98A_D2 returns [message::definition::swift::mt::Field fld] :
fld_98A_D2_A { $fld.MergeFrom($fld_98A_D2_A.fld); }
;
fld_16S_D2 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16R_D3 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_22H_D3 returns [message::definition::swift::mt::Field fld] :
fld_22H_D3_H { $fld.MergeFrom($fld_22H_D3_H.fld); }
;
fld_98a_D3 returns [message::definition::swift::mt::Field fld] :
fld_98a_D3_A { $fld.MergeFrom($fld_98a_D3_A.fld); }
| fld_98a_D3_B { $fld.MergeFrom($fld_98a_D3_B.fld); }
;
fld_95a_D3 returns [message::definition::swift::mt::Field fld] :
fld_95a_D3_P { $fld.MergeFrom($fld_95a_D3_P.fld); }
| fld_95a_D3_Q { $fld.MergeFrom($fld_95a_D3_Q.fld); }
| fld_95a_D3_R { $fld.MergeFrom($fld_95a_D3_R.fld); }
;
fld_19B_D3 returns [message::definition::swift::mt::Field fld] :
fld_19B_D3_B { $fld.MergeFrom($fld_19B_D3_B.fld); }
;
fld_16S_D3 returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16S_D returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_16R_E returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16R"); } :
START_OF_FIELD '16R:' ~(START_OF_FIELD)+;
fld_95a_E returns [message::definition::swift::mt::Field fld] :
fld_95a_E_P { $fld.MergeFrom($fld_95a_E_P.fld); }
| fld_95a_E_Q { $fld.MergeFrom($fld_95a_E_Q.fld); }
| fld_95a_E_R { $fld.MergeFrom($fld_95a_E_R.fld); }
;
fld_19A_E returns [message::definition::swift::mt::Field fld] :
fld_19A_E_A { $fld.MergeFrom($fld_19A_E_A.fld); }
;
fld_16S_E returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("16S"); } :
START_OF_FIELD '16S:' ~(START_OF_FIELD)+;
fld_28E_A_E returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("28E"); }:
START_OF_FIELD '28E:' ~(START_OF_FIELD)+ ;
fld_20C_A_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("20C"); }:
START_OF_FIELD '20C:' ~(START_OF_FIELD)+ ;
fld_23G_A_G returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("23G"); }:
START_OF_FIELD '23G:' ~(START_OF_FIELD)+ ;
fld_22F_A1_F returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("22F"); }:
START_OF_FIELD '22F:' ~(START_OF_FIELD)+ ;
fld_98A_A1_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98A"); }:
START_OF_FIELD '98A:' ~(START_OF_FIELD)+ ;
fld_13B_A1_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("13B"); }:
START_OF_FIELD '13B:' ~(START_OF_FIELD)+ ;
fld_70C_A1_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("70C"); }:
START_OF_FIELD '70C:' ~(START_OF_FIELD)+ ;
fld_98a_A_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98A"); }:
START_OF_FIELD '98A:' ~(START_OF_FIELD)+ ;
fld_98a_A_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98C"); }:
START_OF_FIELD '98C:' ~(START_OF_FIELD)+ ;
fld_98a_A_E returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98E"); }:
START_OF_FIELD '98E:' ~(START_OF_FIELD)+ ;
fld_22a_A_F returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("22F"); }:
START_OF_FIELD '22F:' ~(START_OF_FIELD)+ ;
fld_22a_A_H returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("22H"); }:
START_OF_FIELD '22H:' ~(START_OF_FIELD)+ ;
fld_95a_A_P returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95P"); }:
START_OF_FIELD '95P:' ~(START_OF_FIELD)+ ;
fld_95a_A_Q returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95Q"); }:
START_OF_FIELD '95Q:' ~(START_OF_FIELD)+ ;
fld_95a_A_R returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95R"); }:
START_OF_FIELD '95R:' ~(START_OF_FIELD)+ ;
fld_70C_A_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("70C"); }:
START_OF_FIELD '70C:' ~(START_OF_FIELD)+ ;
fld_13a_A2_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("13A"); }:
START_OF_FIELD '13A:' ~(START_OF_FIELD)+ ;
fld_13a_A2_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("13B"); }:
START_OF_FIELD '13B:' ~(START_OF_FIELD)+ ;
fld_20C_A2_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("20C"); }:
START_OF_FIELD '20C:' ~(START_OF_FIELD)+ ;
fld_95a_B_P returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95P"); }:
START_OF_FIELD '95P:' ~(START_OF_FIELD)+ ;
fld_95a_B_Q returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95Q"); }:
START_OF_FIELD '95Q:' ~(START_OF_FIELD)+ ;
fld_95a_B_R returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95R"); }:
START_OF_FIELD '95R:' ~(START_OF_FIELD)+ ;
fld_19B_B_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("19B"); }:
START_OF_FIELD '19B:' ~(START_OF_FIELD)+ ;
fld_98a_B_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98A"); }:
START_OF_FIELD '98A:' ~(START_OF_FIELD)+ ;
fld_98a_B_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98C"); }:
START_OF_FIELD '98C:' ~(START_OF_FIELD)+ ;
fld_19B_B1_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("19B"); }:
START_OF_FIELD '19B:' ~(START_OF_FIELD)+ ;
fld_20C_C_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("20C"); }:
START_OF_FIELD '20C:' ~(START_OF_FIELD)+ ;
fld_22a_C_F returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("22F"); }:
START_OF_FIELD '22F:' ~(START_OF_FIELD)+ ;
fld_22a_C_H returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("22H"); }:
START_OF_FIELD '22H:' ~(START_OF_FIELD)+ ;
fld_98A_C_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98A"); }:
START_OF_FIELD '98A:' ~(START_OF_FIELD)+ ;
fld_95a_C_P returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95P"); }:
START_OF_FIELD '95P:' ~(START_OF_FIELD)+ ;
fld_95a_C_Q returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95Q"); }:
START_OF_FIELD '95Q:' ~(START_OF_FIELD)+ ;
fld_95a_C_R returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95R"); }:
START_OF_FIELD '95R:' ~(START_OF_FIELD)+ ;
fld_19A_C_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("19A"); }:
START_OF_FIELD '19A:' ~(START_OF_FIELD)+ ;
fld_99A_C_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("99A"); }:
START_OF_FIELD '99A:' ~(START_OF_FIELD)+ ;
fld_22F_C_F returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("22F"); }:
START_OF_FIELD '22F:' ~(START_OF_FIELD)+ ;
fld_92a_C_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("92A"); }:
START_OF_FIELD '92A:' ~(START_OF_FIELD)+ ;
fld_92a_C_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("92B"); }:
START_OF_FIELD '92B:' ~(START_OF_FIELD)+ ;
fld_70D_C_D returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("70D"); }:
START_OF_FIELD '70D:' ~(START_OF_FIELD)+ ;
fld_19B_C1_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("19B"); }:
START_OF_FIELD '19B:' ~(START_OF_FIELD)+ ;
fld_35B_C1_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("35B"); }:
START_OF_FIELD '35B:' ~(START_OF_FIELD)+ ;
fld_36B_C1_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("36B"); }:
START_OF_FIELD '36B:' ~(START_OF_FIELD)+ ;
fld_92A_C1_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("92A"); }:
START_OF_FIELD '92A:' ~(START_OF_FIELD)+ ;
fld_98A_C2_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98A"); }:
START_OF_FIELD '98A:' ~(START_OF_FIELD)+ ;
fld_19B_C2_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("19B"); }:
START_OF_FIELD '19B:' ~(START_OF_FIELD)+ ;
fld_70C_C2_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("70C"); }:
START_OF_FIELD '70C:' ~(START_OF_FIELD)+ ;
fld_12B_C2_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("12B"); }:
START_OF_FIELD '12B:' ~(START_OF_FIELD)+ ;
fld_90a_C2_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("90A"); }:
START_OF_FIELD '90A:' ~(START_OF_FIELD)+ ;
fld_90a_C2_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("90B"); }:
START_OF_FIELD '90B:' ~(START_OF_FIELD)+ ;
fld_98A_C3_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98A"); }:
START_OF_FIELD '98A:' ~(START_OF_FIELD)+ ;
fld_19B_C3_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("19B"); }:
START_OF_FIELD '19B:' ~(START_OF_FIELD)+ ;
fld_92A_C3_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("92A"); }:
START_OF_FIELD '92A:' ~(START_OF_FIELD)+ ;
fld_20C_D_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("20C"); }:
START_OF_FIELD '20C:' ~(START_OF_FIELD)+ ;
fld_22H_D_H returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("22H"); }:
START_OF_FIELD '22H:' ~(START_OF_FIELD)+ ;
fld_25D_D_D returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("25D"); }:
START_OF_FIELD '25D:' ~(START_OF_FIELD)+ ;
fld_19B_D_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("19B"); }:
START_OF_FIELD '19B:' ~(START_OF_FIELD)+ ;
fld_99A_D_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("99A"); }:
START_OF_FIELD '99A:' ~(START_OF_FIELD)+ ;
fld_22F_D_F returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("22F"); }:
START_OF_FIELD '22F:' ~(START_OF_FIELD)+ ;
fld_92a_D_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("92A"); }:
START_OF_FIELD '92A:' ~(START_OF_FIELD)+ ;
fld_92a_D_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("92B"); }:
START_OF_FIELD '92B:' ~(START_OF_FIELD)+ ;
fld_19B_D1_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("19B"); }:
START_OF_FIELD '19B:' ~(START_OF_FIELD)+ ;
fld_35B_D1_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("35B"); }:
START_OF_FIELD '35B:' ~(START_OF_FIELD)+ ;
fld_36B_D1_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("36B"); }:
START_OF_FIELD '36B:' ~(START_OF_FIELD)+ ;
fld_92A_D1_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("92A"); }:
START_OF_FIELD '92A:' ~(START_OF_FIELD)+ ;
fld_98A_D1_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98A"); }:
START_OF_FIELD '98A:' ~(START_OF_FIELD)+ ;
fld_94B_D1_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("94B"); }:
START_OF_FIELD '94B:' ~(START_OF_FIELD)+ ;
fld_70C_D1_C returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("70C"); }:
START_OF_FIELD '70C:' ~(START_OF_FIELD)+ ;
fld_19B_D2_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("19B"); }:
START_OF_FIELD '19B:' ~(START_OF_FIELD)+ ;
fld_22H_D2_H returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("22H"); }:
START_OF_FIELD '22H:' ~(START_OF_FIELD)+ ;
fld_98A_D2_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98A"); }:
START_OF_FIELD '98A:' ~(START_OF_FIELD)+ ;
fld_22H_D3_H returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("22H"); }:
START_OF_FIELD '22H:' ~(START_OF_FIELD)+ ;
fld_98a_D3_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98A"); }:
START_OF_FIELD '98A:' ~(START_OF_FIELD)+ ;
fld_98a_D3_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("98B"); }:
START_OF_FIELD '98B:' ~(START_OF_FIELD)+ ;
fld_95a_D3_P returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95P"); }:
START_OF_FIELD '95P:' ~(START_OF_FIELD)+ ;
fld_95a_D3_Q returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95Q"); }:
START_OF_FIELD '95Q:' ~(START_OF_FIELD)+ ;
fld_95a_D3_R returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95R"); }:
START_OF_FIELD '95R:' ~(START_OF_FIELD)+ ;
fld_19B_D3_B returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("19B"); }:
START_OF_FIELD '19B:' ~(START_OF_FIELD)+ ;
fld_95a_E_P returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95P"); }:
START_OF_FIELD '95P:' ~(START_OF_FIELD)+ ;
fld_95a_E_Q returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95Q"); }:
START_OF_FIELD '95Q:' ~(START_OF_FIELD)+ ;
fld_95a_E_R returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("95R"); }:
START_OF_FIELD '95R:' ~(START_OF_FIELD)+ ;
fld_19A_E_A returns [message::definition::swift::mt::Field fld] @init { $fld.set_tag("19A"); }:
START_OF_FIELD '19A:' ~(START_OF_FIELD)+ ;
TAG_BH : '{1:' ;
TAG_AH : '{2:' ;
TAG_UH : '{3:' ;
TAG_MT : '{4:' ;
TAG_TR : '{5:' ;
MT_END : '-}';
LBRACE : '{';
RBRACE : '}' ;
COLON : ':';
START_OF_FIELD : '\r'? '\n:' ;
ANY : . ; |
appinventor/appengine/src/com/google/appinventor/client/thesis/TesiLexer.g4 | feduss/tesi_appinventor | 0 | 113 | lexer grammar TesiLexer;
WHITESPACE: [ \t\r\n]-> skip;
WHEN: 'when';
IF: 'if';
AND: 'AND';
OR : 'OR';
NOT : 'not';
THEN: 'then';
ELSE: 'else';
THROW: 'throw';
ARTICLE: 'the'|'a';
VERB : 'is';
SET : 'set';
CALL : 'call';
ACTION_WHEN_OBJ : 'after date set'|'after selecting'|'after time set'|
'changed'|
'got focus'|
'is long clicked'|'is clicked'|'after picking'|'before picking'|
'is touched down'|'is touched up'
'lost focus'|
'position changed to'
;
ACTION_IF_OBJ : 'background color'|
'clickable'|'color left'|'color right'|
'day'|
'enabled'|'elements'|
'font bold'|'font italic'|'font size'|
'html content'|'has margins'|'height'|'hint'|'hour'|
'image'|'instant'|'item background color'|'item text color'|
'month'|'month in text'|'max value'|'min value'|'multi line'|'minute'|
'numbers only'|
'on'|
'picture'|'password visible'|'prompt'|
'rotation angle'|'read only'|
'show feedback'|'scaling'|'selection'|'selection index'|'show filter bar'|'selection color'|
'text'|'text color'|'title'|'thumb enabled'|'thumb position'|'text size'|
'thumb color active'|'thumb color inactive'|'track color active'|'track color inactive'|
'visible'|
'width'|
'year'
;
ACTION_SET_OBJ : 'animation to'|
'clickable to'|'color left to'|'color right to'|
'background color to'|
'enabled to'|'elements to'|'elements from string to'|
'font size to'|'font bold to'|'font italic to'|
'hasmargin to'|'height percent to'|'height to'|'hint to'|
'image to'|'item background color to'|'item text color to'|
'max value to'|'min value to'|'multi line to'|
'numbers only to'|
'on to'|
'picture to'|'password visible to'|'prompt to'|
'rotation angle to'|'read only to'|
'show feedback to'|'scale picture to fit to'|'scaling to'|'selection to'|'selection index to'|'show filter bar to'|'selection color to'|
'text to'|'text color to'|'title to'|'text size to'|'thumb enabled to'|'thumb position to'|'thumb color active to'|
'thumb color inactive to'|'track color active to'|'track color inactive to'|
'visible to'|
'width to'|'width percent to'
;
ACTION_CALL_OBJ : 'display dropdown'|
'hide keyboard'|
'launch picker'|
'open list'|
'request focus'|
'set date to display'|'set date to display from instance'|
'set time to display'|'set time to display from instance'
;
ACTION_OPEN_OBJ: 'another screen with name';
COLON: ',';
SEMICOLON: ';';
OPEN_BRACKET: '(';
CLOSE_BRACKET: ')';
OPEN: 'open';
STRING : [a-zA-Z0-9]+; |
hazel/docx_to_pdf.applescript | patrickleweryharris/scripts | 1 | 3833 | <gh_stars>1-10
set _document to theFile
-- Open a docx document in pages and auto export to PDF
tell application "Finder"
set _directory to get container of file _document
set _documentName to name of _document
-- Figure out document name without sextension
if _documentName ends with ".docx.docx" then ¬
set _documentName to text 1 thru -6 of _documentName
if _documentName ends with ".docx" then ¬
set _documentName to text 1 thru -6 of _documentName
set _PDFName to _documentName & ".pdf"
set _location to (_directory as string) & _PDFName
end tell
tell application "Pages"
activate
open _document
with timeout of 1200 seconds
-- Export as PDF with _PDFName
export front document to file _location as PDF
end timeout
close front document
end tell
|
test/table-test/protypo-api-engine_values-table_wrappers.ads | fintatarta/protypo | 0 | 12070 | with Protypo.Api.Engine_Values.Handlers;
with Protypo.Api.Engine_Values.Engine_Value_Holders;
with Protypo.Api.Engine_Values.Engine_Value_Vectors;
with Protypo.Api.Engine_Values.Array_Wrappers;
with Ada.Containers.Indefinite_Ordered_Maps;
package Protypo.Api.Engine_Values.Table_Wrappers is
use type Ada.Containers.Count_Type;
type Table_Wrapper (<>) is new Handlers.Ambivalent_Interface with private;
type Table_Wrapper_Access is access Table_Wrapper;
type Title_Array is array (Positive range <>) of Unbounded_String;
type Label_Array is array (Positive range <>) of Unbounded_ID;
function Make_Table (N_Columns : Positive) return Table_Wrapper_Access
with Post => Make_Table'Result.N_Columns = N_Columns
and Make_Table'Result.N_Rows = 0;
function Make_Table (Column_Names : Title_Array) return Table_Wrapper_Access
with Post => Make_Table'Result.N_Columns = Column_Names'Length
and Make_Table'Result.N_Rows = 0;
function Make_Table (Labels : Label_Array) return Table_Wrapper_Access
with Post => Make_Table'Result.N_Columns = Labels'Length
and Make_Table'Result.N_Rows = 0;
function Make_Table (Column_Names : Title_Array;
Labels : Label_Array) return Table_Wrapper_Access
with
Pre => Column_Names'Length = Labels'Length,
Post => Make_Table'Result.N_Columns = Column_Names'Length
and Make_Table'Result.N_Rows = 0;
function N_Columns (Item : Table_Wrapper) return Positive;
function N_Rows (Item : Table_Wrapper) return Natural;
procedure Append (Table : in out Table_Wrapper;
Row : Engine_Value_Vectors.Vector)
with
Pre => Natural(Row.Length) = Table.N_Columns,
Post => Table.N_Rows = Table.N_Rows'Old + 1;
function Get (X : Table_Wrapper;
Index : Engine_Value_Vectors.Vector)
return Handler_Value
with
Pre => Index.Length = 1
and then Index.First_Element.Class = Int
and then Get_Integer (Index.First_Element) > 0
and then Get_Integer (Index.First_Element) <= X.N_Rows,
Post => Get'Result.Class = Ambivalent_Handler;
function Get (X : Table_Wrapper;
Field : ID)
return Handler_Value;
function Is_Field (X : Table_Wrapper; Field : Id) return Boolean;
generic
type Field_Type is (<>);
package Enumerated_Rows is
type Aggregate_Type is array (Field_Type) of Engine_Value_Holders.Holder;
type Enumerated_Title_Array is array (Field_Type) of Unbounded_String;
N_Fields : constant Integer :=
Field_Type'Pos (Field_Type'Last)-Field_Type'Pos (Field_Type'First)+1;
function Make_Table return Table_Wrapper_Access
with Post => Make_Table'Result.N_Columns = N_Fields;
function Make_Table (Titles : Enumerated_Title_Array) return Table_Wrapper_Access
with Post => Make_Table'Result.N_Columns = N_Fields;
procedure Append (Table : in out Table_Wrapper;
Item : Aggregate_Type);
generic
type Ada_Aggregate is limited private;
type Aggregate_Index is (<>);
type Generic_Aggregate_Array is
array (Aggregate_Index range <>) of Ada_Aggregate;
with function Convert (X : Ada_Aggregate) return Aggregate_Type;
procedure Append_Array (Table : in out Table_Wrapper;
Item : Generic_Aggregate_Array);
private
function Default_Titles return Enumerated_Title_Array;
function Make_Table return Table_Wrapper_Access
is (Make_Table (Default_Titles));
end Enumerated_Rows;
private
package Label_Maps is
new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => ID,
Element_Type => Positive);
type Row_Wrapper is
new Array_Wrappers.Array_Wrapper
with
record
Label_To_Column : Label_Maps.Map;
end record;
type Row_Wrapper_Access is access Row_Wrapper;
function Make_Row (Data : Engine_Value_Vectors.Vector;
Labels : Label_Maps.Map) return Row_Wrapper_Access;
function Make_Map (Labels : Label_Array) return Label_Maps.Map
with
Pre => (for all I in Labels'Range =>
(for all J in I + 1 .. Labels'Last =>
Labels (I) /= Labels (J))),
Post => Integer (Make_Map'Result.Length) = Labels'Length;
overriding function Get (X : Row_Wrapper;
Field : ID)
return Handler_Value;
overriding function Get (X : Row_Wrapper;
Index : Engine_Value_Vectors.Vector)
return Handler_Value;
overriding function Is_Field (X : Row_Wrapper; Field : Id) return Boolean;
type Table_Wrapper (N_Columns : Positive) is
new Ambivalent_Interface
with
record
Titles : Engine_Value_Vectors.Vector_Handler_Access;
Labels : Label_Array (1 .. N_Columns);
Rows : Engine_Value_Vectors.Vector_Handler_Access;
end record;
function Default_Titles (N_Columns : Positive) return Title_Array
with Post => Default_Titles'Result'Length = N_Columns;
function Default_Titles (Labels : Label_Array) return Title_Array
with Post => Default_Titles'Result'Length = Labels'Length;
function Default_Labels (N_Columns : Positive) return Label_Array
with Post => Default_Labels'Result'Length = N_Columns;
function Create (Titles : Title_Array)
return Engine_Value_Vectors.Vector_Handler_Access;
-- function Make_Table (Column_Names : Title_Array;
-- Labels : Label_Array) return Table_Wrapper_Access
-- is (new Table_Wrapper'(Titles => Create (Column_Names),
-- Rows => new Row_Wrapper'(Engine_Value_Vectors.Vector_Handler with
-- Label_To_Column => Make_Map (Labels))));
function Make_Table (Column_Names : Title_Array;
Labels : Label_Array) return Table_Wrapper_Access
is (new Table_Wrapper'(N_Columns => Column_Names'Length,
Titles => Create (Column_Names),
Labels => Labels,
Rows => new Engine_Value_Vectors.Vector_Handler));
function Make_Table (N_Columns : Positive) return Table_Wrapper_Access
is (Make_Table (Default_Titles (N_Columns), Default_Labels (N_Columns)));
function Make_Table (Column_Names : Title_Array) return Table_Wrapper_Access
is (Make_Table (Column_Names, Default_Labels (Column_Names'Length)));
function Make_Table (Labels : Label_Array) return Table_Wrapper_Access
is (Make_Table (Default_Titles (Labels), Labels));
function N_Columns (Item : Table_Wrapper) return Positive
is (Integer (Item.Titles.Vector.Length));
function N_Rows (Item : Table_Wrapper) return Natural
is (Natural (Item.Rows.Vector.Length));
end Protypo.Api.Engine_Values.Table_Wrappers;
|
Assembly/keyboard/monster_search_toUpper.asm | WildGenie/Ninokuni | 14 | 18051 | <reponame>WildGenie/Ninokuni<gh_stars>10-100
;;----------------------------------------------------------------------------;;
;; Char to upper case for familar wiki search function.
;; Copyright 2015 <NAME> (aka pleonex)
;;
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at
;;
;; http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.
;;----------------------------------------------------------------------------;;
.org 0x020CBE78
.area 0x64
@toUpper:
; Alphabet
CMP R1, 'z'
BGT @accents
CMP R1, 'a'
SUBGE R1, #0x20
; Accents
@accents:
CMP R1, #0xAC ; 'ú'
BGT @specialChars
CMP R1, #0xA8 ; 'á'
SUBGE R1, #0x05
@specialChars:
CMP R1, #0xAD ; 'ñ'
ADDEQ R1, #1
CMP R1, #0xAF ; 'ü'
ADDEQ R1, #1
@end:
BX LR
.endarea
|
programs/oeis/004/A004344.asm | neoneye/loda | 22 | 87534 | ; A004344: Binomial coefficient C(5n+10,n).
; 1,15,190,2300,27405,324632,3838380,45379620,536878650,6358402050,75394027566,895068996640,10638894058520,126600387152400,1508152231077400,17984495151670680,214667221708410075,2564603660132096265,30664510802988208300,366934961273420740200
mov $1,5
mul $1,$0
add $1,10
bin $1,$0
mov $0,$1
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1488.asm | ljhsiun2/medusa | 9 | 170724 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r9
push %rbx
push %rdi
// Faulty Load
lea addresses_PSE+0xdf04, %r11
nop
nop
nop
nop
nop
inc %r12
mov (%r11), %r9w
lea oracles, %r14
and $0xff, %r9
shlq $12, %r9
mov (%r14,%r9,1), %r9
pop %rdi
pop %rbx
pop %r9
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_PSE', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_PSE', 'congruent': 0}}
<gen_prepare_buffer>
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
filtros/pixelar_asm.asm | partu18/edge_detection_algorithm_SIMD | 0 | 25063 | <gh_stars>0
; void pixelar_asm (
; unsigned char *src,
; unsigned char *dst,
; int m,
; int n,
; int src_row_size,
; int dst_row_size
; );
section .data
mask: DQ 0x00000000FFFFFFFF
maskDejarPrimeroYCuarto: DW 0xFFFF, 0x0000, 0x0000, 0x0000, 0xFFFF, 0x0000, 0x0000, 0x0000
maskMultiplode4: DQ 0xFFFFFFFFFFFFFFFC
section .text
global pixelar_asm
pixelar_asm:
; *src en rdi
; *dst en rsi
; m en rdx
; n en rcx
; src_row_size en r8
; dst_row_size en r9
PUSH rbp ; Alinea
MOV rbp, rsp
PUSH rbx ; salva rbx Desalinea
PUSH r13 ; salva r13 Alinea
PUSH r14 ; salva r14 Desalinea
PUSH r15 ; salva r15 Alinea
MOV rax, [mask] ; pone en rax lo que se usa como máscara
AND rdx, rax ; máscara a rdx para dejar la parte baja únicamente
AND rcx, rax ; máscara a rcx para dejar la parte baja únicamente
AND r8, rax ; máscara a r8 para dejar la parte baja únicamente
AND r9, rax ; máscara a r9 para dejar la parte baja únicamente
AND rcx, [maskMultiplode4] ; corta el resto módulo 4 del ancho
AND rdx, [maskMultiplode4] ; corta el resto módulo 4 del alto
XOR r11,r11 ; limpia r11
cicloPorFila:
CMP edx, 0 ; para ver si termine de ciclar todas las filas
JE salir
MOV r11d, ecx ; muevo al cantidad de columnas a r11
MOV r14, rdi ; hago el iterador de columnas de src
MOV r13, rsi ; hago el iterador de columnas de dst
cicloPorColumna:
CMP r11d, 0 ; comparo para ver si ya miré todas las columnas
JE cambiarDeFila
CMP r11d, 16 ; comparo para ver si estoy cerca del w
JL redimensionar
; Desarma los 16 bytes en 16 words repartidas en 4 registros
MOVDQU xmm0, [r14] ; carga en xmm0 16 bytes de src
LEA rbx, [r14+r8] ; carga en rbx src+src_row_size
MOVDQU xmm2, [rbx] ; carga en xmm1 16 bytes de src+src_row_size
LEA rbx, [rbx+r8] ; carga en rbx src+src_row_size
MOVDQU xmm4, [rbx] ; carga en xmm2 16 bytes de src+2*src_row_size
LEA rbx, [rbx+r8] ; carga en rbx src+src_row_size
MOVDQU xmm6, [rbx] ; carga en xmm3 16 bytes de src+3*src_row_size
MOVDQU xmm1, xmm0 ; pasa xmm0 también a xmm1 para desempaquetar en los dos
MOVDQU xmm3, xmm2 ; pasa xmm2 también a xmm3 para desempaquetar en los dos
MOVDQU xmm5, xmm4 ; pasa xmm4 también a xmm5 para desempaquetar en los dos
MOVDQU xmm7, xmm6 ; pasa xmm6 también a xmm7 para desempaquetar en los dos
PXOR xmm15, xmm15 ; limpia xmm15
PUNPCKHBW xmm0, xmm15 ; desempaqueta en xmm0 la parte alta de la primer línea
PUNPCKLBW xmm1, xmm15 ; desempaqueta en xmm1 la parte baja de la primer línea
PUNPCKHBW xmm2, xmm15 ; desempaqueta en xmm2 la parte alta de la segunda línea
PUNPCKLBW xmm3, xmm15 ; desempaqueta en xmm3 la parte baja de la segunda línea
PUNPCKHBW xmm4, xmm15 ; desempaqueta en xmm4 la parte alta de la tercera línea
PUNPCKLBW xmm5, xmm15 ; desempaqueta en xmm5 la parte baja de la tercera línea
PUNPCKHBW xmm6, xmm15 ; desempaqueta en xmm6 la parte alta de la cuarta línea
PUNPCKLBW xmm7, xmm15 ; desempaqueta en xmm7 la parte baja de la cuarta línea
; Suma de las partes altas
PADDW xmm0, xmm2 ; coloca en xmm0 a 1A + 2A
PADDW xmm0, xmm4 ; coloca en xmm0 a 1A + 2A + 3A
PADDW xmm0, xmm6 ; coloca en xmm0 a 1A + 2A + 3A + 4A
; Suma de las partes bajas
PADDW xmm1, xmm3 ; coloca en xmm0 a 1B + 2B
PADDW xmm1, xmm5 ; coloca en xmm0 a 1B + 2B + 3B
PADDW xmm1, xmm7 ; coloca en xmm0 a 1B + 2B + 3B + 4B
; Resta sumar las sumas parciales de xmm0 y para eso hago shifts
MOVDQU xmm10, xmm0
MOVDQU xmm11, xmm0
MOVDQU xmm12, xmm0
PSRLDQ xmm10, 2 ; shiftea 2 bytes (1 word) a derecha
PSRLDQ xmm11, 4 ; shiftea 4 bytes (2 word) a derecha
PSRLDQ xmm12, 6 ; shiftea 6 bytes (3 word) a derecha
; Sea xmm0 = (4, 3, 2, ,1) y sea 0 una word de ceros
PADDW xmm0, xmm10 ; deja en xmm0 a (4+0 , 3+4, 3+2, 2+1)
PADDW xmm0, xmm11 ; deja en xmm0 a (4+0+0, 3+4+0, 4+3+2, 3+2+1)
PADDW xmm0, xmm12 ; deja en xmm0 a (4+0+0+0, 3+4+0+0, 2+3+4+0, 1+2+3+4) y lo mismo con el otro
; Hay que poner 1+2+3+4 en las cuatro posiciones, eso lo hago con máscaras y shifts
MOVDQU xmm15, [maskDejarPrimeroYCuarto]; pone en xmm15 la máscara para filtrar el primer word
PAND xmm0, xmm15 ; deja en xmm0 a (1+2+3+4, 0, 0, 0)
MOVDQU xmm10, xmm0 ; pone en xmm10 una copia de xmm0
PSLLDQ xmm10, 2 ; shiftea 1 word a derecha y queda xmm10 = (0, 1+2+3+4, 0, 0)
PADDW xmm0, xmm10 ; suma xmm0 y xmm10 y queda xmm0 = (1+2+3+4, 1+2+3+4, 0, 0)
PSLLDQ xmm10, 2 ; shiftea 1 word a derecha y queda xmm1 = (0, 0, 1+2+3+4, 0)
PADDW xmm0, xmm10 ; suma xmm0 y xmm10 y queda xmm0 = (1+2+3+4, 1+2+3+4, 1+2+3+4, 0)
PSLLDQ xmm10, 2 ; shiftea 1 word a derecha y queda xmm1 = (0, 0, 0, 1+2+3+4)
PADDW xmm0, xmm10 ; suma xmm0 y xmm10 y queda xmm0 = (1+2+3+4, 1+2+3+4, 1+2+3+4, 1+2+3+4) con los otro a derecha
; Hay que dividir cada parte por 16
PSRAW xmm0, 4 ; mueve dos bits a derecha (divide por 16)
; Resta sumar las sumas parciales de xmm1 y para eso hago shifts
MOVDQU xmm10, xmm1
MOVDQU xmm11, xmm1
MOVDQU xmm12, xmm1
PSRLDQ xmm10, 2 ; shiftea 2 bytes (1 word) a izquierda
PSRLDQ xmm11, 4 ; shiftea 4 bytes (2 word) a izquierda
PSRLDQ xmm12, 6 ; shiftea 6 bytes (3 word) a izquierda
; Sea xmm1 = (1, 2, 3, 4) y sea 0 una word de ceros
PADDW xmm1, xmm10 ; deja en xmm0 a (1+2, 2+3, 3+4, 4+0)
PADDW xmm1, xmm11 ; deja en xmm0 a (1+2+3, 2+3+4, 3+4+0, 4+0+0)
PADDW xmm1, xmm12 ; deja en xmm0 a (1+2+3+4, 2+3+4+0, 3+4+0+0, 4+0+0+0)
; Hay que poner 1+2+3+4 en las cuatro posiciones, eso lo hago con máscaras y shifts
MOVDQU xmm15, [maskDejarPrimeroYCuarto]; pone en xmm15 la máscara para filtrar el primer word (el cuarto también pero pienso en uno porque el otro es igual)
PAND xmm1, xmm15 ; deja en xmm1 a (0, 0, 0, 1+2+3+4)
MOVDQU xmm10, xmm1 ; pone en xmm1 una copia de xmm10
PSLLDQ xmm10, 2 ; shiftea 1 word a izquierda y queda xmm10 = (0, 0, 1+2+3+4, 0)
PADDW xmm1, xmm10 ; suma xmm1 y xmm10 y queda xmm1 = (0, 0, 1+2+3+4, 1+2+3+4)
PSLLDQ xmm10, 2 ; shiftea 1 word a izquierda y queda xmm10 = (0, 1+2+3+4, 0, 0)
PADDW xmm1, xmm10 ; suma xmm0 y xmm1 y queda xmm1 = (0, 1+2+3+4, 1+2+3+4, 1+2+3+4)
PSLLDQ xmm10, 2 ; shiftea 1 word a izquierda y queda xmm10 = (1+2+3+4, 0, 0, 0)
PADDW xmm1, xmm10 ; suma xmm1 y xmm10 y queda xmm1 = (1+2+3+4, 1+2+3+4, 1+2+3+4, 1+2+3+4)
; Hay que dividir cada parte por 16
PSRAW xmm1, 4 ; mueve dos bits a derecha (divide por 16)
PACKUSWB xmm1, xmm0 ; empaqueta
MOVDQU [r13], xmm1 ; pasa a dst el resultado
LEA rbx, [r13+r9] ; carga en rbx dst + dst_row_size
MOVDQU [rbx], xmm1 ; pasa a dst+dst_row_size el resultado
LEA rbx, [rbx+r9] ; carga en rbx dst + 2*dst_row_size
MOVDQU [rbx], xmm1 ; pasa a dst+dst_row_size el resultado
LEA rbx, [rbx+r9] ; carga en rbx dst + 3*dst_row_size
MOVDQU [rbx], xmm1 ; pasa a dst+dst_row_size el resultado
ADD r14, 16 ; avanzo iterador
ADD r13, 16 ; avanzo iterador
SUB r11d, 16 ; resto 16 columnas
JMP cicloPorColumna
redimensionar:
MOV eax, 16 ; rax finalmente va a tener el desplazamiento total
SUB eax, r11d ; calculo el desplazamiento total (16 - (totalCol - procesCol))
SUB r13, rax ; atraso los iteradores
SUB r14, rax ;
MOV r11d, 16 ;
JMP cicloPorColumna
cambiarDeFila:
ADD rdi, r8 ; aumenta a rdi el src_row_size
ADD rdi, r8 ; aumenta a rdi el src_row_size
ADD rdi, r8 ; aumenta a rdi el src_row_size
ADD rdi, r8 ; aumenta a rdi el src_row_size (queda rdi = rdi + 4*src_row_size)
ADD rsi, r9 ; aumenta a rsi el dst_row_size
ADD rsi, r9 ; aumenta a rsi el dst_row_size
ADD rsi, r9 ; aumenta a rsi el dst_row_size
ADD rsi, r9 ; aumenta a rsi el dst_row_size (queda rsi = rsi + 4*dst_row_size)
DEC edx
DEC edx
DEC edx
DEC edx
JMP cicloPorFila
salir:
POP r15
POP r14
POP r13
POP rbx
POP rbp
RET
|
test/Fail/Issue3592-1.agda | shlevy/agda | 1,989 | 8634 | <reponame>shlevy/agda
postulate
I : Set
f : Set → I
mutual
data P : I → Set where
Q : I → Set
Q x = P (f (P x))
|
out/aaa_read2.adb | FardaleM/metalang | 22 | 19203 |
with ada.text_io, ada.Integer_text_IO, Ada.Text_IO.Text_Streams, Ada.Strings.Fixed, Interfaces.C;
use ada.text_io, ada.Integer_text_IO, Ada.Strings, Ada.Strings.Fixed, Interfaces.C;
procedure aaa_read2 is
type stringptr is access all char_array;
procedure PString(s : stringptr) is
begin
String'Write (Text_Streams.Stream (Current_Output), To_Ada(s.all));
end;
procedure PChar(c : in Character) is
begin
Character'Write (Text_Streams.Stream (Current_Output), c);
end;
procedure PInt(i : in Integer) is
begin
String'Write (Text_Streams.Stream (Current_Output), Trim(Integer'Image(i), Left));
end;
procedure SkipSpaces is
C : Character;
Eol : Boolean;
begin
loop
Look_Ahead(C, Eol);
exit when Eol or C /= ' ';
Get(C);
end loop;
end;
--
--Ce test permet de vérifier si les différents backends pour les langages implémentent bien
--read int, read char et skip
--
type e is Array (Integer range <>) of Integer;
type e_PTR is access e;
type f is Array (Integer range <>) of Character;
type f_PTR is access f;
tmpc : Character;
tab4 : f_PTR;
tab2 : e_PTR;
tab : e_PTR;
strlen : Integer;
len : Integer;
c : Integer;
begin
Get(len);
SkipSpaces;
PInt(len);
PString(new char_array'( To_C("=len" & Character'Val(10))));
tab := new e (0..len - 1);
for a in integer range 0..len - 1 loop
Get(tab(a));
SkipSpaces;
end loop;
for i in integer range 0..len - 1 loop
PInt(i);
PString(new char_array'( To_C("=>")));
PInt(tab(i));
PString(new char_array'( To_C(" ")));
end loop;
PString(new char_array'( To_C("" & Character'Val(10))));
tab2 := new e (0..len - 1);
for b in integer range 0..len - 1 loop
Get(tab2(b));
SkipSpaces;
end loop;
for i_0 in integer range 0..len - 1 loop
PInt(i_0);
PString(new char_array'( To_C("==>")));
PInt(tab2(i_0));
PString(new char_array'( To_C(" ")));
end loop;
Get(strlen);
SkipSpaces;
PInt(strlen);
PString(new char_array'( To_C("=strlen" & Character'Val(10))));
tab4 := new f (0..strlen - 1);
for d in integer range 0..strlen - 1 loop
Get(tab4(d));
end loop;
SkipSpaces;
for i3 in integer range 0..strlen - 1 loop
tmpc := tab4(i3);
c := Character'Pos(tmpc);
PChar(tmpc);
PString(new char_array'( To_C(":")));
PInt(c);
PString(new char_array'( To_C(" ")));
if tmpc /= ' '
then
c := (c - Character'Pos('a') + 13) rem 26 + Character'Pos('a');
end if;
tab4(i3) := Character'Val(c);
end loop;
for j in integer range 0..strlen - 1 loop
PChar(tab4(j));
end loop;
end;
|
arch/ARM/STM32/svd/stm32wl5x_cm4/stm32_svd-hsem.ads | morbos/Ada_Drivers_Library | 2 | 2878 | -- This spec has been automatically generated from STM32WB55x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.HSEM is
pragma Preelaborate;
type Sema_Range is range 0 .. 31;
---------------
-- Registers --
---------------
subtype R_PROCID_Field is HAL.UInt8;
subtype R_COREID_Field is HAL.UInt4;
type R_Register is record
PROCID : R_PROCID_Field := 16#0#;
COREID : R_COREID_Field := 16#0#;
-- unspecified
Reserved_12_30 : HAL.UInt19 := 16#0#;
LOCK : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for R_Register use record
PROCID at 0 range 0 .. 7;
COREID at 0 range 8 .. 11;
Reserved_12_30 at 0 range 12 .. 30;
LOCK at 0 range 31 .. 31;
end record;
type R_Array is array (Sema_Range) of R_Register;
subtype RLR_PROCID_Field is HAL.UInt8;
subtype RLR_COREID_Field is HAL.UInt4;
type RLR_Register is record
PROCID : RLR_PROCID_Field := 16#0#;
COREID : RLR_COREID_Field := 16#0#;
-- unspecified
Reserved_12_30 : HAL.UInt19 := 16#0#;
LOCK : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RLR_Register use record
PROCID at 0 range 0 .. 7;
COREID at 0 range 8 .. 11;
Reserved_12_30 at 0 range 12 .. 30;
LOCK at 0 range 31 .. 31;
end record;
type RLR_Array is array (Sema_Range) of RLR_Register;
subtype CR_COREID_Field is HAL.UInt4;
subtype CR_KEY_Field is HAL.UInt16;
type CR_Register is record
-- unspecified
Reserved_0_7 : HAL.UInt8 := 16#0#;
COREID : CR_COREID_Field := 16#0#;
-- unspecified
Reserved_12_15 : HAL.UInt4 := 16#0#;
KEY : CR_KEY_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
Reserved_0_7 at 0 range 0 .. 7;
COREID at 0 range 8 .. 11;
Reserved_12_15 at 0 range 12 .. 15;
KEY at 0 range 16 .. 31;
end record;
subtype KEYR_KEY_Field is HAL.UInt16;
type KEYR_Register is record
-- unspecified
Reserved_0_15 : HAL.UInt16 := 16#0#;
KEY : KEYR_KEY_Field := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for KEYR_Register use record
Reserved_0_15 at 0 range 0 .. 15;
KEY at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
type HSEM_Peripheral is record
R : aliased R_Array;
RLR : aliased RLR_Array;
C1IER : aliased HAL.UInt32;
C1ICR : aliased HAL.UInt32;
C1ISR : aliased HAL.UInt32;
C1MISR : aliased HAL.UInt32;
C2IER : aliased HAL.UInt32;
C2ICR : aliased HAL.UInt32;
C2ISR : aliased HAL.UInt32;
C2MISR : aliased HAL.UInt32;
CR : aliased CR_Register;
KEYR : aliased KEYR_Register;
end record
with Volatile;
for HSEM_Peripheral use record
R at 16#0# range 0 .. 1023;
RLR at 16#80# range 0 .. 1023;
C1IER at 16#100# range 0 .. 31;
C1ICR at 16#104# range 0 .. 31;
C1ISR at 16#108# range 0 .. 31;
C1MISR at 16#10C# range 0 .. 31;
C2IER at 16#110# range 0 .. 31;
C2ICR at 16#114# range 0 .. 31;
C2ISR at 16#118# range 0 .. 31;
C2MISR at 16#11C# range 0 .. 31;
CR at 16#140# range 0 .. 31;
KEYR at 16#144# range 0 .. 31;
end record;
HSEM_Periph : aliased HSEM_Peripheral
with Import, Address => System'To_Address (16#58001400#);
end STM32_SVD.HSEM;
|
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca.log_21829_346.asm | ljhsiun2/medusa | 9 | 18101 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x18623, %rsi
lea addresses_WT_ht+0x18923, %rdi
nop
nop
nop
cmp $19897, %r15
mov $88, %rcx
rep movsw
nop
nop
add $62897, %r13
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %rax
push %rbp
push %rdx
// Faulty Load
lea addresses_RW+0xf523, %r10
nop
dec %rbp
movb (%r10), %al
lea oracles, %rdx
and $0xff, %rax
shlq $12, %rax
mov (%rdx,%rax,1), %rax
pop %rdx
pop %rbp
pop %rax
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': True, 'type': 'addresses_WT_ht'}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
unix-macos/02-unix-macos/unix_files/unix_files/Exercise Files/Chapter_09/09_08_files/unix_files/control_address_book.scpt | MaksimZinovev/courses | 0 | 3341 | <reponame>MaksimZinovev/courses<filename>unix-macos/02-unix-macos/unix_files/unix_files/Exercise Files/Chapter_09/09_08_files/unix_files/control_address_book.scpt
tell application "Address Book"
set emailList to {}
set peopleCount to (count every person)
repeat with i from 1 to peopleCount
set emailList to emailList & (get value of every email of person i)
end repeat
return items in emailList
end tell
|
testdata/sht/oscall.asm | cwood77/shtanky | 0 | 90033 | .seg data
._osCall_impl: .data, <qw> 0
.seg code
._osCall:
push, rbp
mov, rbp, rsp
sub, rsp, 32
call, qwordptr ._osCall_impl
mov, rsp, rbp
pop, rbp
ret
.seg code
._print:
mov, rdx, rcx
mov, rcx, 1
call, ._osCall
ret
|
Numeral/Natural/Relation/Order/Existence/Proofs.agda | Lolirofle/stuff-in-agda | 6 | 3141 | <reponame>Lolirofle/stuff-in-agda<filename>Numeral/Natural/Relation/Order/Existence/Proofs.agda
module Numeral.Natural.Relation.Order.Existence.Proofs where
import Lvl
open import Data.Tuple as Tuple using (_⨯_ ; _,_)
open import Functional
open import Logic.Propositional
open import Logic.Propositional.Theorems
open import Logic.Predicate
open import Numeral.Natural
open import Numeral.Natural.Oper
open import Numeral.Natural.Oper.Proofs
open import Numeral.Natural.Induction
open import Numeral.Natural.Relation.Order.Existence
open import Relator.Equals
open import Relator.Equals.Proofs
open import Structure.Function.Domain
open import Structure.Operator
open import Structure.Operator.Properties
import Structure.Relator.Names as Names
open import Structure.Relator.Ordering
open import Structure.Relator.Properties
open import Syntax.Transitivity
open import Type
[≡]-to-[≤] : ∀{x y : ℕ} → (x ≡ y) → (x ≤ y)
[≡]-to-[≤] x≡y = [∃]-intro 0 ⦃ x≡y ⦄
[≤]-minimum : ∀{x : ℕ} → (0 ≤ x)
[≤]-minimum {x} = [∃]-intro x ⦃ identityₗ(_+_)(𝟎) ⦄
[≤][0]ᵣ : ∀{x : ℕ} → (x ≤ 0) ↔ (x ≡ 0)
[≤][0]ᵣ {𝟎} = [↔]-intro [≡]-to-[≤] (const [≡]-intro)
[≤][0]ᵣ {𝐒(n)} = [↔]-intro (\()) (\{([∃]-intro _ ⦃ ⦄ )})
[≤][0]ᵣ-negation : ∀{x : ℕ} → ¬(𝐒(x) ≤ 0)
[≤][0]ᵣ-negation {x} (Sx≤0) = [𝐒]-not-0([↔]-to-[→] ([≤][0]ᵣ {𝐒(x)}) (Sx≤0))
[≤]-successor : ∀{a b : ℕ} → (a ≤ b) → (a ≤ 𝐒(b))
[≤]-successor ([∃]-intro(n) ⦃ proof ⦄) = [∃]-intro (𝐒(n)) ⦃ [≡]-with(𝐒) (proof) ⦄
[≤]-predecessor : ∀{a b : ℕ} → (𝐒(a) ≤ b) → (a ≤ b)
[≤]-predecessor ([∃]-intro n) = [∃]-intro(𝐒(n))
[≤]-without-[𝐒] : ∀{a b : ℕ} → (a ≤ b) ← (𝐒(a) ≤ 𝐒(b))
[≤]-without-[𝐒] {𝟎} {b} (_) = [≤]-minimum
[≤]-without-[𝐒] {𝐒(a)}{𝟎} ()
[≤]-without-[𝐒] {𝐒(a)}{𝐒(b)} ([∃]-intro(n) ⦃ proof ⦄) = [≤]-with-[𝐒] {a}{b} ([≤]-without-[𝐒] {a}{b} ([∃]-intro(n) ⦃ injective(𝐒) proof ⦄))
[≤][𝐒]ₗ : ∀{x : ℕ} → ¬(𝐒(x) ≤ x)
[≤][𝐒]ₗ {𝟎} (1≤0) = [≤][0]ᵣ-negation{0}(1≤0)
[≤][𝐒]ₗ {𝐒(n)} (SSn≤Sn) = [≤][𝐒]ₗ {n} ([≤]-without-[𝐒] {𝐒(n)}{n} (SSn≤Sn))
instance
[≤]-transitivity : Transitivity (_≤_)
Transitivity.proof [≤]-transitivity {a}{b}{c} ([∃]-intro n₁ ⦃ an₁b ⦄) ([∃]-intro n₂ ⦃ bn₂c ⦄) = [∃]-intro (n₁ + n₂) ⦃ p ⦄ where
p =
a + (n₁ + n₂) 🝖[ _≡_ ]-[ associativity(_+_) {a}{n₁}{n₂} ]-sym
(a + n₁) + n₂ 🝖[ _≡_ ]-[ congruence₂ₗ(_+_)(n₂) an₁b ]
b + n₂ 🝖[ _≡_ ]-[ bn₂c ]
c 🝖-end
instance
[≤]-reflexivity : Reflexivity (_≤_)
Reflexivity.proof [≤]-reflexivity = [≡]-to-[≤] [≡]-intro
instance
[≤]-antisymmetry : Antisymmetry (_≤_) (_≡_)
Antisymmetry.proof [≤]-antisymmetry {a} {b} ([∃]-intro(n₁) ⦃ an₁b ⦄) ([∃]-intro(n₂) ⦃ bn₂a ⦄) =
a 🝖[ _≡_ ]-[]
a + 𝟎 🝖[ _≡_ ]-[ congruence₂ᵣ(_+_)(a) n₁0 ]-sym
a + n₁ 🝖[ _≡_ ]-[ an₁b ]
b 🝖-end
where
n₁n₂0 : (n₁ + n₂ ≡ 0)
n₁n₂0 = cancellationₗ(_+_) $
a + (n₁ + n₂) 🝖[ _≡_ ]-[ associativity(_+_) {a}{n₁}{n₂} ]-sym
(a + n₁) + n₂ 🝖[ _≡_ ]-[ congruence₂ₗ(_+_)(n₂) an₁b ]
b + n₂ 🝖[ _≡_ ]-[ bn₂a ]
a 🝖[ _≡_ ]-[]
a + 0 🝖-end
n₁0 : (n₁ ≡ 0)
n₁0 = [∧]-elimₗ ([+]-sum-is-0 {n₁} {n₂} n₁n₂0)
instance
[≤]-weakPartialOrder : Weak.PartialOrder (_≤_) (_≡_)
[≤]-weakPartialOrder = record{}
[<]-minimum : ∀{x : ℕ} → (0 < 𝐒(x))
[<]-minimum = [≤]-with-[𝐒] {0} [≤]-minimum
[≥]-is-[≮] : ∀{a b : ℕ} → ¬(a < b) ← (a ≥ b)
[≥]-is-[≮] {a}{b} b≤a Sa≤b = [≤][𝐒]ₗ (transitivity(_≤_) {x = 𝐒(a)}{y = b}{z = a} Sa≤b b≤a)
-- [≤]-is-[≯] : ∀{a b : ℕ} → ¬(a > b) ← (a ≤ b)
-- [≤]-is-[≯] {a}{b} = [≥]-is-[≮] {b}{a}
-- [>]-is-[≰] : ∀{a b : ℕ} → ¬(a ≤ b) ← (a > b)
-- [>]-is-[≰] {a}{b} (Sb≤a) (a≤b) = [≤]-is-[≯] {a}{b} (a≤b) (Sb≤a)
-- [<]-is-[≱] : ∀{a b : ℕ} → ¬(a ≥ b) ← (a < b)
-- [<]-is-[≱] {a}{b} = [>]-is-[≰] {b}{a}
instance
[≤]-totality : ConverseTotal(_≤_)
[≤]-totality = intro p where
p : Names.ConverseTotal(_≤_)
p {𝟎} {𝟎} = [∨]-introₗ ([≡]-to-[≤] [≡]-intro)
p {𝐒(a)}{𝟎} = [∨]-introᵣ ([≤]-minimum)
p {𝟎} {𝐒(b)} = [∨]-introₗ ([≤]-minimum)
p {𝐒(a)}{𝐒(b)} = [∨]-elim ([∨]-introₗ ∘ ([≤]-with-[𝐒] {a}{b})) ([∨]-introᵣ ∘ ([≤]-with-[𝐒] {b}{a})) (p {a}{b})
|
SelectionSort/selection_sort.adb | mlurbe97/ABench2020 | 0 | 4997 | <gh_stars>0
--
-- ABench2020 Benchmark Suite
--
-- Selection Sort Program
--
-- Licensed under the MIT License. See LICENSE file in the ABench root
-- directory for license information.
--
-- Uncomment the line below to print the result.
-- with Ada.Text_IO; use Ada.Text_IO;
procedure Selection_Sort is
type Vector is array (Positive range<>) of Integer;
procedure Sort (Sort_Array : in out Vector) is
Temp_Value : Integer;
begin
for I in 1 .. Sort_Array'Last loop
for J in I .. Sort_Array'Last loop
if Sort_Array (I) > Sort_Array (J) then
Temp_Value := Sort_Array (I);
Sort_Array (I) := Sort_Array (J);
Sort_Array (J) := Temp_Value;
end if;
end loop;
end loop;
end;
Sort_Array : Vector := (1, 9, 5, 31, 25, 46, 98, 17, 21, 82, 2, 33, 64, 73,
56, 567, 5, 45, 445, 4, 76, 22, 34, 45, 56, 888, 66, 89, 9, 32, 46, 78,
87, 23, 37, 12, 3, 6, 89, 7);
begin
loop
Sort (Sort_Array);
Sort_Array := (1, 9, 5, 31, 25, 46, 98, 17, 21, 82, 2, 33, 64, 73,
56, 567, 5, 45, 445, 4, 76, 22, 34, 45, 56, 888, 66, 89, 9, 32, 46, 78,
87, 23, 37, 12, 3, 6, 89, 7);
end loop;
-- Uncomment the lines below to print the result.
-- Put_Line("Sorted Array:");
-- for I in Sort_Array'Range loop
-- Put (Integer'Image (Sort_Array (I)) & " ");
-- end loop;
end;
|
lib/chibiakumas/SrcALL/V2_Functions.asm | gilbertfrancois/msx | 0 | 92030 | <gh_stars>0
ifdef BuildCPC
ifdef V9K
read "..\SrcCPC\CPCVDP_V1_Functions.asm"
else
read "..\SrcCPC\CPC_V2_Functions.asm"
endif
endif
ifdef BuildMSX
ifdef BuildMSX_MSX1VDP
read "..\SrcMSX\MSX1VDP_V1_Functions.asm"
else
ifdef BuildMSX_MSXVDP
read "..\SrcMSX\MSXVDP_V1_Functions.asm"
else
read "..\SrcMSX\MSX_V2_Functions.asm"
endif
endif
endif
ifdef BuildTI8
read "..\SrcTI\TI_V2_Functions.asm"
endif
ifdef BuildZXS
read "..\SrcZX\ZX_V2_Functions.asm"
endif
ifdef BuildENT
read "..\SrcENT\ENT_V2_Functions.asm"
endif
ifdef BuildSAM
read "..\SrcSAM\SAM_V2_Functions.asm"
endif
ifdef BuildSMS
read "..\SrcSMS\SMS_V1_Functions.asm"
endif
ifdef BuildSGG
read "..\SrcSMS\SMS_V1_Functions.asm"
endif
ifdef BuildGMB
include "..\SrcGB\GB_V1_Functions.asm"
endif
ifdef BuildGBC
include "..\SrcGB\GB_V1_Functions.asm"
endif
ifdef BuildCLX
include "..\SrcCLX\CLX_V1_Functions.asm"
endif
|
Ada95/samples/sample-function_key_setting.adb | arc-aosp/external_libncurses | 35 | 5512 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Function_Key_Setting --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998,2004 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: <NAME>, 1996
-- Version Control
-- $Revision: 1.13 $
-- $Date: 2004/08/21 21:37:00 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Sample.Manifest; use Sample.Manifest;
-- This package implements a simple stack of function key label environments.
--
package body Sample.Function_Key_Setting is
Max_Label_Length : constant Positive := 8;
Number_Of_Keys : Label_Number := Label_Number'Last;
Justification : Label_Justification := Left;
subtype Label is String (1 .. Max_Label_Length);
type Label_Array is array (Label_Number range <>) of Label;
type Key_Environment (N : Label_Number := Label_Number'Last);
type Env_Ptr is access Key_Environment;
pragma Controlled (Env_Ptr);
type String_Access is access String;
pragma Controlled (String_Access);
Active_Context : String_Access := new String'("MAIN");
Active_Notepad : Panel := Null_Panel;
type Key_Environment (N : Label_Number := Label_Number'Last) is
record
Prev : Env_Ptr;
Help : String_Access;
Notepad : Panel;
Labels : Label_Array (1 .. N);
end record;
procedure Release_String is
new Ada.Unchecked_Deallocation (String,
String_Access);
procedure Release_Environment is
new Ada.Unchecked_Deallocation (Key_Environment,
Env_Ptr);
Top_Of_Stack : Env_Ptr := null;
procedure Push_Environment (Key : in String;
Reset : in Boolean := True)
is
P : constant Env_Ptr := new Key_Environment (Number_Of_Keys);
begin
-- Store the current labels in the environment
for I in 1 .. Number_Of_Keys loop
Get_Soft_Label_Key (I, P.Labels (I));
if Reset then
Set_Soft_Label_Key (I, " ");
end if;
end loop;
P.Prev := Top_Of_Stack;
-- now store active help context and notepad
P.Help := Active_Context;
P.Notepad := Active_Notepad;
-- The notepad must now vanish and the new notepad is empty.
if P.Notepad /= Null_Panel then
Hide (P.Notepad);
Update_Panels;
end if;
Active_Notepad := Null_Panel;
Active_Context := new String'(Key);
Top_Of_Stack := P;
if Reset then
Refresh_Soft_Label_Keys_Without_Update;
end if;
end Push_Environment;
procedure Pop_Environment
is
P : Env_Ptr := Top_Of_Stack;
begin
if Top_Of_Stack = null then
raise Function_Key_Stack_Error;
else
for I in 1 .. Number_Of_Keys loop
Set_Soft_Label_Key (I, P.Labels (I), Justification);
end loop;
pragma Assert (Active_Context /= null);
Release_String (Active_Context);
Active_Context := P.Help;
Refresh_Soft_Label_Keys_Without_Update;
Notepad_To_Context (P.Notepad);
Top_Of_Stack := P.Prev;
Release_Environment (P);
end if;
end Pop_Environment;
function Context return String
is
begin
if Active_Context /= null then
return Active_Context.all;
else
return "";
end if;
end Context;
function Find_Context (Key : String) return Boolean
is
P : Env_Ptr := Top_Of_Stack;
begin
if Active_Context.all = Key then
return True;
else
loop
exit when P = null;
if P.Help.all = Key then
return True;
else
P := P.Prev;
end if;
end loop;
return False;
end if;
end Find_Context;
procedure Notepad_To_Context (Pan : in Panel)
is
W : Window;
begin
if Active_Notepad /= Null_Panel then
W := Get_Window (Active_Notepad);
Clear (W);
Delete (Active_Notepad);
Delete (W);
end if;
Active_Notepad := Pan;
if Pan /= Null_Panel then
Top (Pan);
end if;
Update_Panels;
Update_Screen;
end Notepad_To_Context;
procedure Initialize (Mode : Soft_Label_Key_Format := PC_Style;
Just : Label_Justification := Left)
is
begin
case Mode is
when PC_Style .. PC_Style_With_Index
=> Number_Of_Keys := 12;
when others
=> Number_Of_Keys := 8;
end case;
Init_Soft_Label_Keys (Mode);
Justification := Just;
end Initialize;
procedure Default_Labels
is
begin
Set_Soft_Label_Key (FKEY_QUIT, "Quit");
Set_Soft_Label_Key (FKEY_HELP, "Help");
Set_Soft_Label_Key (FKEY_EXPLAIN, "Keys");
Refresh_Soft_Label_Keys_Without_Update;
end Default_Labels;
function Notepad_Window return Window
is
begin
if Active_Notepad /= Null_Panel then
return Get_Window (Active_Notepad);
else
return Null_Window;
end if;
end Notepad_Window;
end Sample.Function_Key_Setting;
|
alloy4fun_models/trashltl/models/18/cEin93iHnMqZ4YtYP.als | Kaixi26/org.alloytools.alloy | 0 | 3924 | open main
pred idcEin93iHnMqZ4YtYP_prop19 {
eventually (all f:Protected | eventually f not in Protected and f in Trash)
}
pred __repair { idcEin93iHnMqZ4YtYP_prop19 }
check __repair { idcEin93iHnMqZ4YtYP_prop19 <=> prop19o } |
oap-cache/oap/src/main/antlr4/org/apache/spark/sql/catalyst/parser/OapSqlBase.g4 | tsface/OAP | 32 | 624 | grammar OapSqlBase;
@members {
/**
* Verify whether current token is a valid decimal token (which contains dot).
* Returns true if the character that follows the token is not a digit or letter or underscore.
*
* For example:
* For char stream "2.3", "2." is not a valid decimal token, because it is followed by digit '3'.
* For char stream "2.3_", "2.3" is not a valid decimal token, because it is followed by '_'.
* For char stream "2.3W", "2.3" is not a valid decimal token, because it is followed by 'W'.
* For char stream "12.0D 34.E2+0.12 " 12.0D is a valid decimal token because it is folllowed
* by a space. 34.E2 is a valid decimal token because it is followed by symbol '+'
* which is not a digit or letter or underscore.
*/
public boolean isValidDecimal() {
int nextChar = _input.LA(1);
if (nextChar >= 'A' && nextChar <= 'Z' || nextChar >= '0' && nextChar <= '9' ||
nextChar == '_') {
return false;
} else {
return true;
}
}
}
singleStatement
: statement EOF
;
statement
: REFRESH SINDEX ON tableIdentifier partitionSpec? #oapRefreshIndices
| CREATE SINDEX (IF NOT EXISTS)? IDENTIFIER ON
tableIdentifier indexCols (USING indexType)?
partitionSpec? #oapCreateIndex
| DROP SINDEX (IF EXISTS)? IDENTIFIER ON tableIdentifier
partitionSpec? #oapDropIndex
| DISABLE SINDEX IDENTIFIER #oapDisableIndex
| ENABLE SINDEX IDENTIFIER #oapEnableIndex
| SHOW SINDEX (FROM | IN) tableIdentifier #oapShowIndex
| CHECK SINDEX ON tableIdentifier partitionSpec? #oapCheckIndex
| .*? #passThrough
;
tableIdentifier
: (db=identifier '.')? table=identifier
;
partitionSpec
: PARTITION '(' partitionVal (',' partitionVal)* ')'
;
partitionVal
: identifier (EQ constant)?
;
constant
: NULL #nullLiteral
| interval #intervalLiteral
| identifier STRING #typeConstructor
| number #numericLiteral
| booleanValue #booleanLiteral
| STRING+ #stringLiteral
;
indexCols
: '(' indexCol (',' indexCol)* ')'
;
indexCol
: identifier (ASC | DESC)?
;
indexType
: BTREE
| BITMAP
;
nonReserved
: CHECK
| DISABLE | ENABLE | TRUE | FALSE | REFRESH | CREATE | IF | NOT | EXISTS
| DROP | SHOW | FROM | IN | PARTITION | AS | ASC | DESC | INTERVAL | TO
;
interval
: INTERVAL intervalField*
;
intervalField
: value=intervalValue unit=identifier (TO to=identifier)?
;
intervalValue
: (PLUS | MINUS)? (INTEGER_VALUE | DECIMAL_VALUE)
| STRING
;
identifier
: IDENTIFIER #unquotedIdentifier
| quotedIdentifier #quotedIdentifierAlternative
| nonReserved #unquotedIdentifier
;
number
: MINUS? DECIMAL_VALUE #decimalLiteral
| MINUS? INTEGER_VALUE #integerLiteral
| MINUS? BIGINT_LITERAL #bigIntLiteral
| MINUS? SMALLINT_LITERAL #smallIntLiteral
| MINUS? TINYINT_LITERAL #tinyIntLiteral
| MINUS? DOUBLE_LITERAL #doubleLiteral
| MINUS? BIGDECIMAL_LITERAL #bigDecimalLiteral
;
booleanValue
: TRUE | FALSE
;
quotedIdentifier
: BACKQUOTED_IDENTIFIER
;
DISABLE: 'DISABLE';
ENABLE: 'ENABLE';
CHECK: 'CHECK';
SINDEX: 'SINDEX' | 'OINDEX';
SINDICES: 'SINDICES' | 'OINDICES';
BTREE: 'BTREE';
BLOOM: 'BLOOM';
BITMAP: 'BITMAP';
NULL: 'NULL';
TRUE: 'TRUE';
FALSE: 'FALSE';
ON: 'ON';
REFRESH: 'REFRESH';
CREATE: 'CREATE';
IF: 'IF';
NOT: 'NOT' | '!';
EXISTS: 'EXISTS';
USING: 'USING';
DROP: 'DROP';
SHOW: 'SHOW';
FROM: 'FROM';
IN: 'IN';
PARTITION: 'PARTITION';
AS: 'AS';
ASC: 'ASC';
DESC: 'DESC';
INTERVAL: 'INTERVAL';
TO: 'TO';
PLUS: '+';
MINUS: '-';
EQ : '=' | '==';
STRING
: '\'' ( ~('\''|'\\') | ('\\' .) )* '\''
| '"' ( ~('"'|'\\') | ('\\' .) )* '"'
;
BIGINT_LITERAL
: DIGIT+ 'L'
;
SMALLINT_LITERAL
: DIGIT+ 'S'
;
TINYINT_LITERAL
: DIGIT+ 'Y'
;
INTEGER_VALUE
: DIGIT+
;
DECIMAL_VALUE
: DIGIT+ EXPONENT
| DECIMAL_DIGITS EXPONENT? {isValidDecimal()}?
;
DOUBLE_LITERAL
: DIGIT+ EXPONENT? 'D'
| DECIMAL_DIGITS EXPONENT? 'D' {isValidDecimal()}?
;
BIGDECIMAL_LITERAL
: DIGIT+ EXPONENT? 'BD'
| DECIMAL_DIGITS EXPONENT? 'BD' {isValidDecimal()}?
;
IDENTIFIER
: (LETTER | DIGIT | '_')+
;
BACKQUOTED_IDENTIFIER
: '`' ( ~'`' | '``' )* '`'
;
fragment DECIMAL_DIGITS
: DIGIT+ '.' DIGIT*
| '.' DIGIT+
;
fragment EXPONENT
: 'E' [+-]? DIGIT+
;
fragment DIGIT
: [0-9]
;
fragment LETTER
: [A-Z]
;
SIMPLE_COMMENT
: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN)
;
BRACKETED_COMMENT
: '/*' .*? '*/' -> channel(HIDDEN)
;
WS : [ \r\n\t]+ -> channel(HIDDEN)
;
// Catch-all for anything we can't recognize.
// We use this to be able to ignore and recover all the text
// when splitting statements with DelimiterLexer
UNRECOGNIZED
: .
;
|
src/main/java/io/ballerina/plugins/idea/grammar/BallerinaParser.g4 | ballerina-platform/plugin-intellij | 7 | 5253 |
parser grammar BallerinaParser;
options {
language = Java;
tokenVocab = BallerinaLexer;
}
//todo revisit blockStatement
// starting point for parsing a bal file
compilationUnit
: (importDeclaration | namespaceDeclaration)*
(documentationString? annotationAttachment* definition)*
EOF
;
packageName
: Identifier (DOT Identifier)* version?
;
version
: VERSION versionPattern
;
versionPattern
: DecimalIntegerLiteral
| DecimalFloatingPointNumber
| DecimalExtendedFloatingPointNumber
;
importDeclaration
: IMPORT (orgName DIV)? packageName (AS Identifier)? SEMICOLON
;
orgName
: Identifier
;
definition
: serviceDefinition
| functionDefinition
| typeDefinition
| annotationDefinition
| globalVariableDefinition
| constantDefinition
| enumDefinition
;
serviceDefinition
: SERVICE Identifier? ON expressionList serviceBody
;
serviceBody
: LEFT_BRACE objectMethod* RIGHT_BRACE
;
blockFunctionBody
: LEFT_BRACE statement* (workerDeclaration+ statement*)? RIGHT_BRACE
;
blockStatement
: LEFT_BRACE statement* RIGHT_BRACE
;
externalFunctionBody
: ASSIGN annotationAttachment* EXTERNAL
;
exprFunctionBody
: EQUAL_GT expression
;
functionDefinitionBody
: blockFunctionBody
| exprFunctionBody SEMICOLON
| externalFunctionBody SEMICOLON
;
functionDefinition
: (PUBLIC | PRIVATE)? REMOTE? TRANSACTIONAL? FUNCTION anyIdentifierName functionSignature functionDefinitionBody
;
anonymousFunctionExpr
: explicitAnonymousFunctionExpr
| inferAnonymousFunctionExpr
;
explicitAnonymousFunctionExpr
: FUNCTION functionSignature (blockFunctionBody | exprFunctionBody)
;
inferAnonymousFunctionExpr
: inferParamList exprFunctionBody
;
inferParamList
: inferParam
| LEFT_PARENTHESIS (inferParam (COMMA inferParam)*)? RIGHT_PARENTHESIS
;
inferParam
: Identifier
;
functionSignature
: LEFT_PARENTHESIS formalParameterList? RIGHT_PARENTHESIS returnParameter?
;
typeDefinition
: PUBLIC? TYPE Identifier finiteType SEMICOLON
;
objectBody
: (objectFieldDefinition | objectMethod | typeReference)*
;
typeReference
: MUL simpleTypeName SEMICOLON
;
objectFieldDefinition
: documentationString? annotationAttachment* (PUBLIC | PRIVATE)? TYPE_READONLY? typeName Identifier
(ASSIGN expression)? SEMICOLON
;
fieldDefinition
: documentationString? annotationAttachment* TYPE_READONLY? typeName Identifier QUESTION_MARK?
(ASSIGN expression)? SEMICOLON
;
recordRestFieldDefinition
: typeName restDescriptorPredicate ELLIPSIS SEMICOLON
;
sealedLiteral
: NOT restDescriptorPredicate ELLIPSIS
;
restDescriptorPredicate : {_input.get(_input.index() -1).getType() != WS}? ;
objectMethod
: methodDeclaration
| methodDefinition
;
methodDeclaration
: documentationString? annotationAttachment* (PUBLIC | PRIVATE)? (REMOTE | RESOURCE)? FUNCTION
anyIdentifierName functionSignature SEMICOLON
;
methodDefinition
: documentationString? annotationAttachment* (PUBLIC | PRIVATE)? (REMOTE | RESOURCE)? FUNCTION
anyIdentifierName functionSignature functionDefinitionBody
;
annotationDefinition
: PUBLIC? CONST? ANNOTATION typeName? Identifier (ON attachmentPoint (COMMA attachmentPoint)*)? SEMICOLON
;
constantDefinition
: PUBLIC? CONST typeName? Identifier ASSIGN constantExpression SEMICOLON
;
enumDefinition
: documentationString? annotationAttachment* PUBLIC? ENUM Identifier LEFT_BRACE
(enumMember (COMMA enumMember)*)? RIGHT_BRACE
;
enumMember
: documentationString? annotationAttachment* Identifier (ASSIGN constantExpression)?
;
globalVariableDefinition
: PUBLIC? LISTENER typeName? Identifier ASSIGN expression SEMICOLON
| FINAL? (typeName | VAR) Identifier (ASSIGN expression)? SEMICOLON
;
attachmentPoint
: dualAttachPoint
| sourceOnlyAttachPoint
;
dualAttachPoint
: SOURCE? dualAttachPointIdent
;
dualAttachPointIdent
: OBJECT? TYPE
| (OBJECT | RESOURCE)? FUNCTION
| PARAMETER
| RETURN
| SERVICE
| (OBJECT | RECORD)? FIELD
;
sourceOnlyAttachPoint
: SOURCE sourceOnlyAttachPointIdent
;
sourceOnlyAttachPointIdent
: ANNOTATION
| EXTERNAL
| VAR
| CONST
| LISTENER
| WORKER
;
workerDeclaration
: annotationAttachment* workerDefinition LEFT_BRACE statement* RIGHT_BRACE
;
workerDefinition
: WORKER Identifier returnParameter?
;
finiteType
: finiteTypeUnit (PIPE finiteTypeUnit)*
;
finiteTypeUnit
: simpleLiteral
| typeName
;
typeName
: DISTINCT? simpleTypeName # simpleTypeNameLabel
| typeName (LEFT_BRACKET (integerLiteral | MUL)? RIGHT_BRACKET)+ # arrayTypeNameLabel
| typeName (PIPE typeName)+ # unionTypeNameLabel
| typeName BIT_AND typeName # intersectionTypeNameLabel
| typeName QUESTION_MARK # nullableTypeNameLabel
| LEFT_PARENTHESIS typeName RIGHT_PARENTHESIS # groupTypeNameLabel
| tupleTypeDescriptor # tupleTypeNameLabel
| DISTINCT? ((ABSTRACT? CLIENT?) | (CLIENT? ABSTRACT)) TYPE_READONLY? OBJECT LEFT_BRACE objectBody RIGHT_BRACE # objectTypeNameLabel
| inclusiveRecordTypeDescriptor # inclusiveRecordTypeNameLabel
| exclusiveRecordTypeDescriptor # exclusiveRecordTypeNameLabel
| tableTypeDescriptor # tableTypeNameLabel
;
inclusiveRecordTypeDescriptor
: RECORD LEFT_BRACE fieldDescriptor* RIGHT_BRACE
;
tupleTypeDescriptor
: LEFT_BRACKET ((typeName (COMMA typeName)* (COMMA tupleRestDescriptor)?) | tupleRestDescriptor) RIGHT_BRACKET
;
tupleRestDescriptor
: typeName ELLIPSIS
;
exclusiveRecordTypeDescriptor
: RECORD LEFT_CLOSED_RECORD_DELIMITER fieldDescriptor* recordRestFieldDefinition? RIGHT_CLOSED_RECORD_DELIMITER
;
fieldDescriptor
: fieldDefinition
| typeReference
;
// Temporary production rule name
simpleTypeName
: TYPE_ANY
| TYPE_ANYDATA
| TYPE_HANDLE
| TYPE_NEVER
| TYPE_READONLY
| valueTypeName
| referenceTypeName
| nilLiteral
;
referenceTypeName
: builtInReferenceTypeName
| userDefineTypeName
;
userDefineTypeName
: nameReference
;
valueTypeName
: TYPE_BOOL
| TYPE_INT
| TYPE_BYTE
| TYPE_FLOAT
| TYPE_DECIMAL
| TYPE_STRING
;
builtInReferenceTypeName
: TYPE_MAP LT typeName GT
| TYPE_FUTURE (LT typeName GT)?
| TYPE_XML (LT typeName GT)?
| TYPE_JSON
| TYPE_DESC (LT typeName GT)?
| SERVICE
| errorTypeName
| streamTypeName
| functionTypeName
;
streamTypeName
: TYPE_STREAM (LT typeName (COMMA typeName)? GT)?
;
tableConstructorExpr
: TYPE_TABLE tableKeySpecifier? LEFT_BRACKET tableRowList? RIGHT_BRACKET
;
tableRowList
: recordLiteral (COMMA recordLiteral)*
;
tableTypeDescriptor
: TYPE_TABLE LT typeName GT tableKeyConstraint?
;
tableKeyConstraint
: tableKeySpecifier | tableKeyTypeConstraint
;
tableKeySpecifier
: KEY LEFT_PARENTHESIS (Identifier (COMMA Identifier)*)? RIGHT_PARENTHESIS
;
tableKeyTypeConstraint
: KEY LT typeName GT
;
functionTypeName
: FUNCTION LEFT_PARENTHESIS (parameterList | parameterTypeNameList)? RIGHT_PARENTHESIS returnParameter?
;
errorTypeName
: TYPE_ERROR (LT (typeName | MUL) GT)?
;
xmlNamespaceName
: QuotedStringLiteral
;
xmlLocalName
: Identifier
;
annotationAttachment
: AT nameReference recordLiteral?
;
//============================================================================================================
// STATEMENTS / BLOCKS
statement
: errorDestructuringStatement
| assignmentStatement
| variableDefinitionStatement
| listDestructuringStatement
| recordDestructuringStatement
| compoundAssignmentStatement
| ifElseStatement
| matchStatement
| foreachStatement
| whileStatement
| continueStatement
| breakStatement
| forkJoinStatement
| tryCatchStatement
| throwStatement
| panicStatement
| returnStatement
| workerSendAsyncStatement
| expressionStmt
| transactionStatement
| rollbackStatement
| retryStatement
| retryTransactionStatement
| lockStatement
| namespaceDeclarationStatement
| blockStatement
;
variableDefinitionStatement
: typeName Identifier SEMICOLON
| FINAL? (typeName | VAR) bindingPattern ASSIGN expression SEMICOLON
;
recordLiteral
: LEFT_BRACE (recordField (COMMA recordField)*)? RIGHT_BRACE
;
staticMatchLiterals
: simpleLiteral # staticMatchSimpleLiteral
| recordLiteral # staticMatchRecordLiteral
| listConstructorExpr # staticMatchListLiteral
| Identifier # staticMatchIdentifierLiteral
| staticMatchLiterals PIPE staticMatchLiterals # staticMatchOrExpression
;
recordField
: TYPE_READONLY? Identifier
| TYPE_READONLY? recordKey COLON expression
| ELLIPSIS expression
;
recordKey
: Identifier
| LEFT_BRACKET expression RIGHT_BRACKET
| expression
;
listConstructorExpr
: LEFT_BRACKET expressionList? RIGHT_BRACKET
;
assignmentStatement
: variableReference ASSIGN expression SEMICOLON
;
listDestructuringStatement
: listRefBindingPattern ASSIGN expression SEMICOLON
;
recordDestructuringStatement
: recordRefBindingPattern ASSIGN expression SEMICOLON
;
errorDestructuringStatement
: errorRefBindingPattern ASSIGN expression SEMICOLON
;
compoundAssignmentStatement
: variableReference compoundOperator expression SEMICOLON
;
compoundOperator
: COMPOUND_ADD
| COMPOUND_SUB
| COMPOUND_MUL
| COMPOUND_DIV
| COMPOUND_BIT_AND
| COMPOUND_BIT_OR
| COMPOUND_BIT_XOR
| COMPOUND_LEFT_SHIFT
| COMPOUND_RIGHT_SHIFT
| COMPOUND_LOGICAL_SHIFT
;
variableReferenceList
: variableReference (COMMA variableReference)*
;
ifElseStatement
: ifClause elseIfClause* elseClause?
;
ifClause
: IF expression LEFT_BRACE statement* RIGHT_BRACE
;
elseIfClause
: ELSE IF expression LEFT_BRACE statement* RIGHT_BRACE
;
elseClause
: ELSE LEFT_BRACE statement*RIGHT_BRACE
;
matchStatement
: MATCH expression LEFT_BRACE matchPatternClause+ RIGHT_BRACE
;
matchPatternClause
: staticMatchLiterals EQUAL_GT LEFT_BRACE statement* RIGHT_BRACE
| VAR bindingPattern (IF expression)? EQUAL_GT LEFT_BRACE statement* RIGHT_BRACE
| errorMatchPattern (IF expression)? EQUAL_GT LEFT_BRACE statement* RIGHT_BRACE
;
bindingPattern
: Identifier
| structuredBindingPattern
;
structuredBindingPattern
: listBindingPattern
| recordBindingPattern
| errorBindingPattern
;
errorBindingPattern
: TYPE_ERROR LEFT_PARENTHESIS errorBindingPatternParamaters RIGHT_PARENTHESIS
| userDefineTypeName LEFT_PARENTHESIS errorBindingPatternParamaters RIGHT_PARENTHESIS
;
errorBindingPatternParamaters
: Identifier (COMMA Identifier)? (COMMA errorDetailBindingPattern)* (COMMA errorRestBindingPattern)?
;
errorMatchPattern
: TYPE_ERROR LEFT_PARENTHESIS errorArgListMatchPattern RIGHT_PARENTHESIS
| typeName LEFT_PARENTHESIS errorFieldMatchPatterns RIGHT_PARENTHESIS
;
errorArgListMatchPattern
: simpleMatchPattern (COMMA errorDetailBindingPattern)* (COMMA restMatchPattern)?
| errorDetailBindingPattern (COMMA errorDetailBindingPattern)* (COMMA restMatchPattern)?
| restMatchPattern
;
errorFieldMatchPatterns
: errorDetailBindingPattern (COMMA errorDetailBindingPattern)* (COMMA restMatchPattern)?
| restMatchPattern
;
errorRestBindingPattern
: ELLIPSIS Identifier
;
restMatchPattern
: ELLIPSIS VAR Identifier
;
simpleMatchPattern
: VAR? (Identifier | QuotedStringLiteral)
;
errorDetailBindingPattern
: Identifier ASSIGN bindingPattern
;
listBindingPattern
: LEFT_BRACKET ((bindingPattern (COMMA bindingPattern)* (COMMA restBindingPattern)?) | restBindingPattern?) RIGHT_BRACKET
;
recordBindingPattern
: LEFT_BRACE entryBindingPattern RIGHT_BRACE
;
entryBindingPattern
: fieldBindingPattern (COMMA fieldBindingPattern)* (COMMA restBindingPattern)?
| restBindingPattern?
;
fieldBindingPattern
: Identifier (COLON bindingPattern)?
;
restBindingPattern
: ELLIPSIS Identifier
;
bindingRefPattern
: errorRefBindingPattern
| variableReference
| structuredRefBindingPattern
;
structuredRefBindingPattern
: listRefBindingPattern
| recordRefBindingPattern
;
listRefBindingPattern
: LEFT_BRACKET ((bindingRefPattern (COMMA bindingRefPattern)* (COMMA listRefRestPattern)?) | listRefRestPattern) RIGHT_BRACKET
;
listRefRestPattern
: ELLIPSIS variableReference
;
recordRefBindingPattern
: LEFT_BRACE entryRefBindingPattern RIGHT_BRACE
;
errorRefBindingPattern
: TYPE_ERROR LEFT_PARENTHESIS errorRefArgsPattern RIGHT_PARENTHESIS
| typeName LEFT_PARENTHESIS errorRefArgsPattern RIGHT_PARENTHESIS
;
errorRefArgsPattern
: variableReference (COMMA variableReference)? (COMMA errorNamedArgRefPattern)* (COMMA errorRefRestPattern)?
;
errorNamedArgRefPattern
: Identifier ASSIGN bindingRefPattern
;
errorRefRestPattern
: ELLIPSIS variableReference
;
entryRefBindingPattern
: fieldRefBindingPattern (COMMA fieldRefBindingPattern)* (COMMA restRefBindingPattern)?
| restRefBindingPattern?
;
fieldRefBindingPattern
: Identifier (COLON bindingRefPattern)?
;
restRefBindingPattern
: ELLIPSIS variableReference
| sealedLiteral
;
foreachStatement
: FOREACH LEFT_PARENTHESIS? (typeName | VAR) bindingPattern IN expression RIGHT_PARENTHESIS? LEFT_BRACE statement* RIGHT_BRACE
;
intRangeExpression
: (LEFT_BRACKET | LEFT_PARENTHESIS) expression RANGE expression? (RIGHT_BRACKET | RIGHT_PARENTHESIS)
;
whileStatement
: WHILE expression LEFT_BRACE statement* RIGHT_BRACE
;
continueStatement
: CONTINUE SEMICOLON
;
breakStatement
: BREAK SEMICOLON
;
// typeName is only message
forkJoinStatement
: FORK LEFT_BRACE workerDeclaration* RIGHT_BRACE
;
// Depricated since 0.983.0, use trap expressoin. TODO : Remove this.
tryCatchStatement
: TRY LEFT_BRACE statement* RIGHT_BRACE catchClauses
;
// TODO : Remove this.
catchClauses
: catchClause+ finallyClause?
| finallyClause
;
// TODO : Remove this.
catchClause
: CATCH LEFT_PARENTHESIS typeName Identifier RIGHT_PARENTHESIS LEFT_BRACE statement* RIGHT_BRACE
;
// TODO : Remove this.
finallyClause
: FINALLY LEFT_BRACE statement* RIGHT_BRACE
;
// Depricated since 0.983.0, use panic instead. TODO : Remove this.
throwStatement
: THROW expression SEMICOLON
;
panicStatement
: PANIC expression SEMICOLON
;
returnStatement
: RETURN expression? SEMICOLON
;
workerSendAsyncStatement
: expression RARROW peerWorker (COMMA expression)? SEMICOLON
;
peerWorker
: workerName
| DEFAULT
;
workerName
: Identifier
;
flushWorker
: FLUSH Identifier?
;
waitForCollection
: LEFT_BRACE waitKeyValue (COMMA waitKeyValue)* RIGHT_BRACE
;
waitKeyValue
: Identifier
| Identifier COLON expression
;
variableReference
: nameReference # simpleVariableReference
| variableReference field # fieldVariableReference
| variableReference ANNOTATION_ACCESS nameReference # annotAccessExpression
| variableReference xmlAttrib # xmlAttribVariableReference
| variableReference xmlElementFilter # xmlElementFilterReference
| functionInvocation # functionInvocationReference
| LEFT_PARENTHESIS variableReference RIGHT_PARENTHESIS field # groupFieldVariableReference
| LEFT_PARENTHESIS variableReference RIGHT_PARENTHESIS invocation # groupInvocationReference
| LEFT_PARENTHESIS variableReference RIGHT_PARENTHESIS index # groupMapArrayVariableReference
| LEFT_PARENTHESIS QuotedStringLiteral RIGHT_PARENTHESIS invocation # groupStringFunctionInvocationReference
| typeDescExpr invocation # typeDescExprInvocationReference
| QuotedStringLiteral invocation # stringFunctionInvocationReference
| variableReference invocation # invocationReference
| variableReference index # mapArrayVariableReference
| variableReference xmlStepExpression # xmlStepExpressionReference
;
field
: (DOT | OPTIONAL_FIELD_ACCESS) ((Identifier COLON)? Identifier | MUL)
;
xmlElementFilter
: DOT xmlElementNames
;
xmlStepExpression
: DIV xmlElementNames index?
| DIV MUL index?
| DIV MUL MUL DIV xmlElementNames index?
;
xmlElementNames
: LT xmlElementAccessFilter (PIPE xmlElementAccessFilter)* GT
;
xmlElementAccessFilter
: (Identifier COLON)? (Identifier | MUL)
;
index
: LEFT_BRACKET (expression | multiKeyIndex) RIGHT_BRACKET
;
multiKeyIndex
: expression (COMMA expression)+
;
xmlAttrib
: AT (LEFT_BRACKET expression RIGHT_BRACKET)?
;
functionInvocation
: functionNameReference LEFT_PARENTHESIS invocationArgList? RIGHT_PARENTHESIS
;
invocation
: DOT anyIdentifierName LEFT_PARENTHESIS invocationArgList? RIGHT_PARENTHESIS
;
invocationArgList
: invocationArg (COMMA invocationArg)*
;
invocationArg
: expression // required args
| namedArgs // named args
| restArgs // rest args
;
actionInvocation
: (annotationAttachment* START)? variableReference RARROW functionInvocation
;
expressionList
: expression (COMMA expression)*
;
expressionStmt
: expression SEMICOLON
;
transactionStatement
: TRANSACTION LEFT_BRACE statement* RIGHT_BRACE
;
rollbackStatement
: ROLLBACK expression? SEMICOLON
;
lockStatement
: LOCK LEFT_BRACE statement* RIGHT_BRACE
;
retrySpec
: (LT typeName GT)? (LEFT_PARENTHESIS invocationArgList? RIGHT_PARENTHESIS)?
;
retryStatement
: RETRY retrySpec LEFT_BRACE statement* RIGHT_BRACE
;
retryTransactionStatement
: RETRY retrySpec transactionStatement
;
namespaceDeclarationStatement
: namespaceDeclaration
;
namespaceDeclaration
: XMLNS QuotedStringLiteral (AS Identifier)? SEMICOLON
;
expression
: simpleLiteral # simpleLiteralExpression
| listConstructorExpr # listConstructorExpression
| recordLiteral # recordLiteralExpression
| tableConstructorExpr # tableConstructorExpression
| xmlLiteral # xmlLiteralExpression
| stringTemplateLiteral # stringTemplateLiteralExpression
| (annotationAttachment* START)? variableReference # variableReferenceExpression
| actionInvocation # actionInvocationExpression
| typeInitExpr # typeInitExpression
| serviceConstructorExpr # serviceConstructorExpression
| CHECK expression # checkedExpression
| CHECKPANIC expression # checkPanickedExpression
| (ADD | SUB | BIT_COMPLEMENT | NOT | TYPEOF) expression # unaryExpression
| LT (annotationAttachment+ typeName? | typeName) GT expression # typeConversionExpression
| expression (MUL | DIV | MOD) expression # binaryDivMulModExpression
| expression (ADD | SUB) expression # binaryAddSubExpression
| expression (shiftExpression) expression # bitwiseShiftExpression
| expression (ELLIPSIS | HALF_OPEN_RANGE) expression # integerRangeExpression
| expression (LT | GT | LT_EQUAL | GT_EQUAL) expression # binaryCompareExpression
| expression IS typeName # typeTestExpression
| expression (EQUAL | NOT_EQUAL) expression # binaryEqualExpression
| expression JOIN_EQUALS expression # binaryEqualsExpression
| expression (REF_EQUAL | REF_NOT_EQUAL) expression # binaryRefEqualExpression
| expression (BIT_AND | BIT_XOR | PIPE) expression # bitwiseExpression
| expression AND expression # binaryAndExpression
| expression OR expression # binaryOrExpression
| expression ELVIS expression # elvisExpression
| expression QUESTION_MARK expression COLON expression # ternaryExpression
| explicitAnonymousFunctionExpr # explicitAnonymousFunctionExpression
| inferAnonymousFunctionExpr # inferAnonymousFunctionExpression
| LEFT_PARENTHESIS expression RIGHT_PARENTHESIS # groupExpression
| expression SYNCRARROW peerWorker # workerSendSyncExpression
| WAIT (waitForCollection | expression) # waitExpression
| trapExpr # trapExpression
| LARROW peerWorker (COMMA expression)? # workerReceiveExpression
| flushWorker # flushWorkerExpression
| typeDescExpr # typeAccessExpression
| queryExpr # queryExpression
| queryAction # queryActionExpression
| letExpr # letExpression
| transactionalExpr # transactionalExpression
| commitAction # commitActionExpression
;
constantExpression
: simpleLiteral # constSimpleLiteralExpression
| recordLiteral # constRecordLiteralExpression
| constantExpression (DIV | MUL) constantExpression # constDivMulModExpression
| constantExpression (ADD | SUB) constantExpression # constAddSubExpression
| LEFT_PARENTHESIS constantExpression RIGHT_PARENTHESIS # constGroupExpression
;
letExpr
: LET letVarDecl (COMMA letVarDecl)* IN expression
;
letVarDecl
: annotationAttachment* (typeName | VAR) bindingPattern ASSIGN expression
;
typeDescExpr
: typeName
;
typeInitExpr
: NEW (LEFT_PARENTHESIS invocationArgList? RIGHT_PARENTHESIS)?
| NEW (userDefineTypeName | streamTypeName) LEFT_PARENTHESIS invocationArgList? RIGHT_PARENTHESIS
;
serviceConstructorExpr
: annotationAttachment* SERVICE serviceBody
;
trapExpr
: TRAP expression
;
shiftExpression
: LT shiftExprPredicate LT
| GT shiftExprPredicate GT
| GT shiftExprPredicate GT shiftExprPredicate GT
;
shiftExprPredicate : {_input.get(_input.index() -1).getType() != WS}? ;
transactionalExpr
: TRANSACTIONAL
;
commitAction
: COMMIT
;
limitClause
: LIMIT expression
;
onConflictClause
: ON CONFLICT expression
;
selectClause
: SELECT expression
;
onClause
: ON expression
;
whereClause
: WHERE expression
;
letClause
: LET letVarDecl (COMMA letVarDecl)*
;
joinClause
: (JOIN (typeName | VAR) bindingPattern | OUTER JOIN VAR bindingPattern) IN expression
;
fromClause
: FROM (typeName | VAR) bindingPattern IN expression
;
doClause
: DO LEFT_BRACE statement* RIGHT_BRACE
;
queryPipeline
: fromClause ((fromClause | letClause | whereClause)* | (joinClause onClause)?)
;
queryConstructType
: TYPE_TABLE tableKeySpecifier | TYPE_STREAM
;
queryExpr
: queryConstructType? queryPipeline selectClause onConflictClause? limitClause?
;
queryAction
: queryPipeline doClause limitClause?
;
//reusable productions
nameReference
: (Identifier COLON)? Identifier
;
functionNameReference
: (Identifier COLON)? anyIdentifierName
;
returnParameter
: RETURNS annotationAttachment* typeName
;
parameterTypeNameList
: parameterTypeName (COMMA parameterTypeName)* (COMMA restParameterTypeName)?
| restParameterTypeName
;
parameterTypeName
: typeName
;
parameterList
: parameter (COMMA parameter)* (COMMA restParameter)?
| restParameter
;
parameter
: annotationAttachment* PUBLIC? typeName Identifier
;
defaultableParameter
: parameter ASSIGN expression
;
restParameter
: annotationAttachment* typeName ELLIPSIS Identifier
;
restParameterTypeName
: typeName restDescriptorPredicate ELLIPSIS
;
formalParameterList
: (parameter | defaultableParameter) (COMMA (parameter | defaultableParameter))* (COMMA restParameter)?
| restParameter
;
simpleLiteral
: (ADD | SUB)? integerLiteral
| (ADD | SUB)? floatingPointLiteral
| QuotedStringLiteral
| BooleanLiteral
| nilLiteral
| blobLiteral
| NullLiteral
;
floatingPointLiteral
: DecimalFloatingPointNumber
| HexadecimalFloatingPointLiteral
;
// §3.10.1 Integer Literals
integerLiteral
: DecimalIntegerLiteral
| HexIntegerLiteral
;
nilLiteral
: LEFT_PARENTHESIS RIGHT_PARENTHESIS
;
blobLiteral
: Base16BlobLiteral
| Base64BlobLiteral
;
namedArgs
: Identifier ASSIGN expression
;
restArgs
: ELLIPSIS expression
;
// XML parsing
xmlLiteral
: XMLLiteralStart xmlItem XMLLiteralEnd
;
xmlItem
: element
| procIns
| comment
| text
| CDATA
;
content
: text? ((element | CDATA | procIns | comment) text?)*
;
comment
: XML_COMMENT_START (XMLCommentTemplateText expression RIGHT_BRACE)* XMLCommentText* XML_COMMENT_END
;
element
: startTag content closeTag
| emptyTag
;
startTag
: XML_TAG_OPEN xmlQualifiedName attribute* XML_TAG_CLOSE
;
closeTag
: XML_TAG_OPEN_SLASH xmlQualifiedName XML_TAG_CLOSE
;
emptyTag
: XML_TAG_OPEN xmlQualifiedName attribute* XML_TAG_SLASH_CLOSE
;
procIns
: XML_TAG_SPECIAL_OPEN (XMLPITemplateText expression RIGHT_BRACE)* XMLPIText
;
attribute
: xmlQualifiedName EQUALS xmlQuotedString;
text
: (XMLTemplateText expression RIGHT_BRACE)+ XMLText?
| XMLText
;
xmlQuotedString
: xmlSingleQuotedString
| xmlDoubleQuotedString
;
xmlSingleQuotedString
: SINGLE_QUOTE (XMLSingleQuotedTemplateString expression RIGHT_BRACE)* XMLSingleQuotedString? SINGLE_QUOTE_END
;
xmlDoubleQuotedString
: DOUBLE_QUOTE (XMLDoubleQuotedTemplateString expression RIGHT_BRACE)* XMLDoubleQuotedString? DOUBLE_QUOTE_END
;
xmlQualifiedName
: (XMLQName QNAME_SEPARATOR)? XMLQName
;
stringTemplateLiteral
: StringTemplateLiteralStart stringTemplateContent? StringTemplateLiteralEnd
;
stringTemplateContent
: (StringTemplateExpressionStart expression RIGHT_BRACE)+ StringTemplateText?
| StringTemplateText
;
anyIdentifierName
: Identifier
| reservedWord
;
reservedWord
: FOREACH
| TYPE_MAP
| START
| CONTINUE
| OBJECT_INIT
| TYPE_ERROR
;
// Markdown documentation
documentationString
: documentationLine+ parameterDocumentationLine* returnParameterDocumentationLine? deprecatedParametersDocumentationLine? deprecatedAnnotationDocumentationLine?
;
documentationLine
: DocumentationLineStart documentationContent
;
parameterDocumentationLine
: parameterDocumentation parameterDescriptionLine*
;
returnParameterDocumentationLine
: returnParameterDocumentation returnParameterDescriptionLine*
;
deprecatedAnnotationDocumentationLine
: deprecatedAnnotationDocumentation deprecateAnnotationDescriptionLine*
;
deprecatedParametersDocumentationLine
: deprecatedParametersDocumentation parameterDocumentationLine+
;
documentationContent
: documentationText?
;
parameterDescriptionLine
: DocumentationLineStart documentationText?
;
returnParameterDescriptionLine
: DocumentationLineStart documentationText?
;
deprecateAnnotationDescriptionLine
: DocumentationLineStart documentationText?
;
documentationText
: (documentationReference | documentationTextContent | referenceType | singleBacktickedBlock | doubleBacktickedBlock | tripleBacktickedBlock)+
;
documentationReference
: referenceType singleBacktickedContent SingleBacktickEnd
;
referenceType
: DOCTYPE
| DOCSERVICE
| DOCVARIABLE
| DOCVAR
| DOCANNOTATION
| DOCMODULE
| DOCFUNCTION
| DOCPARAMETER
| DOCCONST
;
parameterDocumentation
: ParameterDocumentationStart docParameterName DescriptionSeparator documentationText?
;
returnParameterDocumentation
: ReturnParameterDocumentationStart documentationText?
;
deprecatedAnnotationDocumentation
: DeprecatedDocumentation
;
deprecatedParametersDocumentation
: DeprecatedParametersDocumentation
;
docParameterName
: ParameterName
;
singleBacktickedBlock
: SingleBacktickStart singleBacktickedContent SingleBacktickEnd
;
singleBacktickedContent
: SingleBacktickContent
;
doubleBacktickedBlock
: DoubleBacktickStart doubleBacktickedContent DoubleBacktickEnd
;
doubleBacktickedContent
: DoubleBacktickContent
;
tripleBacktickedBlock
: TripleBacktickStart tripleBacktickedContent TripleBacktickEnd
;
tripleBacktickedContent
: TripleBacktickContent
;
documentationTextContent
: DocumentationText
| DocumentationEscapedCharacters
;
// Rules for parsing the content in the backticked block for documentation validation.
documentationFullyqualifiedIdentifier
: documentationIdentifierQualifier? documentationIdentifierTypename? documentationIdentifier braket?
;
documentationFullyqualifiedFunctionIdentifier
: documentationIdentifierQualifier? documentationIdentifierTypename? documentationIdentifier braket
;
documentationIdentifierQualifier
: Identifier COLON
;
documentationIdentifierTypename
: Identifier DOT
;
documentationIdentifier
: Identifier
| TYPE_INT
| TYPE_BYTE
| TYPE_FLOAT
| TYPE_DECIMAL
| TYPE_BOOL
| TYPE_STRING
| TYPE_ERROR
| TYPE_MAP
| TYPE_JSON
| TYPE_XML
| TYPE_STREAM
| TYPE_TABLE
| TYPE_ANY
| TYPE_DESC
| TYPE_FUTURE
| TYPE_ANYDATA
| TYPE_HANDLE
| TYPE_READONLY
;
braket
: LEFT_PARENTHESIS RIGHT_PARENTHESIS
;
|
Transynther/x86/_processed/US/_ht_zr_/i9-9900K_12_0xca_notsx.log_21829_1911.asm | ljhsiun2/medusa | 9 | 103150 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1e836, %rsi
lea addresses_normal_ht+0x17bee, %rdi
nop
nop
nop
cmp %r8, %r8
mov $2, %rcx
rep movsb
lfence
lea addresses_WT_ht+0x1602e, %rbx
cmp $29630, %rcx
movw $0x6162, (%rbx)
nop
dec %rcx
lea addresses_normal_ht+0x1adae, %rdi
nop
nop
nop
nop
nop
cmp %r13, %r13
mov $0x6162636465666768, %r8
movq %r8, (%rdi)
nop
nop
nop
nop
nop
xor $58731, %r8
lea addresses_A_ht+0x17dae, %r13
nop
nop
cmp %rsi, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
movups %xmm3, (%r13)
dec %rsi
lea addresses_WT_ht+0x156e, %r8
nop
nop
nop
xor %rcx, %rcx
movb $0x61, (%r8)
nop
nop
xor $10324, %rdi
lea addresses_A_ht+0x136ee, %rsi
lea addresses_D_ht+0xb5f4, %rdi
nop
nop
inc %r14
mov $21, %rcx
rep movsq
cmp %r14, %r14
lea addresses_WT_ht+0x4746, %rdi
nop
dec %r13
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
movups %xmm5, (%rdi)
nop
nop
nop
nop
nop
sub $39523, %rcx
lea addresses_normal_ht+0x1c0ee, %r13
nop
nop
nop
nop
and $6968, %rbx
movl $0x61626364, (%r13)
nop
nop
and %r8, %r8
lea addresses_WC_ht+0x183ae, %rsi
lea addresses_WT_ht+0x1e5ae, %rdi
nop
nop
add %rbx, %rbx
mov $41, %rcx
rep movsb
nop
nop
nop
nop
nop
xor %rdi, %rdi
lea addresses_UC_ht+0x9a6e, %rbp
xor %rbx, %rbx
mov $0x6162636465666768, %r8
movq %r8, %xmm3
movups %xmm3, (%rbp)
nop
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_WT_ht+0x919e, %rsi
lea addresses_A_ht+0xe4ee, %rdi
nop
nop
nop
nop
add %rbp, %rbp
mov $8, %rcx
rep movsl
sub $15139, %r8
lea addresses_A_ht+0x1430e, %r13
nop
nop
nop
nop
nop
sub $11101, %r14
mov (%r13), %ebx
nop
nop
dec %rsi
lea addresses_WC_ht+0x1b9ae, %rdi
inc %rsi
vmovups (%rdi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %rbx
nop
nop
nop
nop
cmp %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r9
push %rax
push %rbp
push %rdi
push %rsi
// Store
lea addresses_A+0x13e6e, %rax
nop
nop
nop
nop
nop
sub $5420, %rdi
mov $0x5152535455565758, %r9
movq %r9, %xmm5
vmovups %ymm5, (%rax)
nop
nop
nop
nop
nop
xor %r9, %r9
// Store
lea addresses_RW+0x91b6, %rsi
nop
nop
nop
nop
nop
and $44426, %r14
mov $0x5152535455565758, %rax
movq %rax, (%rsi)
// Exception!!!
nop
nop
mov (0), %rbp
nop
nop
nop
nop
add $44868, %r9
// Faulty Load
lea addresses_US+0x95ae, %rdi
nop
nop
add %r9, %r9
vmovups (%rdi), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rax
lea oracles, %r14
and $0xff, %rax
shlq $12, %rax
mov (%r14,%rax,1), %rax
pop %rsi
pop %rdi
pop %rbp
pop %rax
pop %r9
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'dst': {'same': True, 'congruent': 0, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}}
{'00': 20993, '45': 89, '48': 6, '44': 741}
48 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
projects/batfish-common-protocol/src/test/antlr4/org/batfish/grammar/recovery_inline_alts/RecoveryInlineAltsLexer.g4 | zabrewer/batfish | 16 | 5339 | <filename>projects/batfish-common-protocol/src/test/antlr4/org/batfish/grammar/recovery_inline_alts/RecoveryInlineAltsLexer.g4
lexer grammar RecoveryInlineAltsLexer;
options {
superClass = 'org.batfish.grammar.BatfishLexer';
}
tokens {
WORD
}
// Keywords
ADDRESS
:
'address'
;
COST
:
'cost'
;
DNS
:
'dns'
;
INTERFACE
:
'interface' -> pushMode ( M_Word )
;
IP
:
'ip'
;
MTU
:
'mtu'
;
OSPF
:
'ospf'
;
PERMIT
:
'permit'
;
ROUTING
:
'routing'
;
SSH
:
'ssh'
;
// Complext tokens
IP_ADDRESS
:
F_IpAddress
;
NEWLINE
:
F_Newline
;
UINT32
:
F_Uint32
;
WS
:
F_Whitespace+ -> channel ( HIDDEN )
;
fragment
F_IpAddress
:
F_Uint8 '.' F_Uint8 '.' F_Uint8 '.' F_Uint8
;
fragment
F_Uint8
:
F_Digit
| F_PositiveDigit F_Digit
| '1' F_Digit F_Digit
| '2' [0-4] F_Digit
| '25' [0-5]
;
fragment
F_PositiveDigit
:
[1-9]
;
fragment
F_Digit
:
[0-9]
;
fragment
F_Uint32
:
// 0-4294967295
F_Digit
| F_PositiveDigit F_Digit F_Digit? F_Digit? F_Digit? F_Digit? F_Digit?
F_Digit? F_Digit?
| [1-3] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
F_Digit
| '4' [0-1] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
| '42' [0-8] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
| '429' [0-3] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
| '4294' [0-8] F_Digit F_Digit F_Digit F_Digit F_Digit
| '42949' [0-5] F_Digit F_Digit F_Digit F_Digit
| '429496' [0-6] F_Digit F_Digit F_Digit
| '4294967' [0-1] F_Digit F_Digit
| '42949672' [0-8] F_Digit
| '429496729' [0-5]
;
fragment
F_Whitespace
:
' '
| '\t'
| '\u000C'
| '\u00A0'
;
fragment
F_Newline
:
[\n\r]
;
fragment
F_Word
:
F_WordChar+
;
fragment
F_WordChar
:
[0-9A-Za-z!@#$%^&*()_=+.;:{}/]
| '-'
;
mode M_Word;
M_Word_NEWLINE
:
F_Newline+ -> type ( NEWLINE ) , popMode
;
M_Word_WORD
:
F_Word -> type ( WORD ) , popMode
;
M_Word_WS
:
F_Whitespace+ -> channel ( HIDDEN )
;
|
src/grammar.g4 | brinxmat/json-ld-patch | 0 | 3977 | <reponame>brinxmat/json-ld-patch<gh_stars>0
grammar LDPatch;
/** based partially on https://github.com/antlr/grammars-v4/blob/master/json/JSON.g4 **/
@lexer::header {
package no.deichman.ldpatchjson.parser;
}
@parser::header {
package no.deichman.ldpatchjson.parser;
import no.deichman.ldpatchjson.parser.Patch;
}
parseJSON : patch EOF ;
patch : statement | statementList ;
statementList : '[' statement ( SEP statement )* ']';
statement : '{' declaration '}' ;
declaration : op_jobj SEP s_jobj SEP p_jobj SEP o_jobj
| op_jobj SEP s_jobj SEP o_jobj SEP p_jobj
| op_jobj SEP p_jobj SEP s_jobj SEP o_jobj
| op_jobj SEP p_jobj SEP o_jobj SEP s_jobj
| op_jobj SEP o_jobj SEP s_jobj SEP p_jobj
| op_jobj SEP o_jobj SEP p_jobj SEP s_jobj
| s_jobj SEP op_jobj SEP p_jobj SEP o_jobj
| s_jobj SEP op_jobj SEP o_jobj SEP p_jobj
| s_jobj SEP p_jobj SEP op_jobj SEP o_jobj
| s_jobj SEP p_jobj SEP o_jobj SEP op_jobj
| s_jobj SEP o_jobj SEP op_jobj SEP p_jobj
| s_jobj SEP o_jobj SEP p_jobj SEP op_jobj
| p_jobj SEP op_jobj SEP s_jobj SEP o_jobj
| p_jobj SEP op_jobj SEP o_jobj SEP s_jobj
| p_jobj SEP s_jobj SEP op_jobj SEP o_jobj
| p_jobj SEP s_jobj SEP o_jobj SEP op_jobj
| p_jobj SEP o_jobj SEP op_jobj SEP s_jobj
| p_jobj SEP o_jobj SEP s_jobj SEP op_jobj
| o_jobj SEP op_jobj SEP s_jobj SEP p_jobj
| o_jobj SEP op_jobj SEP p_jobj SEP s_jobj
| o_jobj SEP s_jobj SEP op_jobj SEP p_jobj
| o_jobj SEP s_jobj SEP p_jobj SEP op_jobj
| o_jobj SEP p_jobj SEP op_jobj SEP s_jobj
| o_jobj SEP p_jobj SEP s_jobj SEP op_jobj
;
op_jobj : OP ':' OPERATION ;
s_jobj : S ':' ( JSONURI | BLANKNODE ) ;
p_jobj : P ':' JSONURI ;
o_jobj : O ':' ( JSONURI
| BLANKNODE
| typedstring
| langstring )
;
jsonuri : JSONURI ;
typedstring : '{' VALUE ':' STRING SEP TYPE ':' JSONURI '}' ;
langstring : '{' VALUE ':' in1=STRING SEP LANG ':' in2=STRING '}' ;
string : STRING ;
number : NUMBER ;
plainliteral : ( string | number ) ;
VALUE : '"value"' ;
TYPE : '"datatype"' ;
LANG : '"lang"' ;
SEP : ',' ;
OP : '"op"' ;
S : '"s"' ;
P : '"p"' ;
O : '"o"' ;
OPERATION : ( ADD | DEL ) ;
BLANKNODE : '"_:' UNQUOTED_STRING '"' ;
JSONURI : '"' HTTP ( PN_CHARS | '.' | ':' | '/' | '\\' | '#' | '@' | '%' | '&' | UCHAR )+ '"' ;
STRING : '"' UNQUOTED_STRING '"' ;
NUMBER
: '-'? INT '.' [0-9]+ EXP?
| '-'? INT EXP
| '-'? INT
;
WS : [ \t\r\n]+ -> skip ;
fragment ADD : '"add"' ;
fragment DEL : '"del"' ;
fragment UNQUOTED_STRING : ( ESC | ~["\\] )* ;
fragment ESC : '\\' ["\\/bfnrt] | UNICODE ;
fragment HTTP : ('http' 's'? | 'HTTP' 'S'?) '://' ;
fragment UCHAR : UNICODE | '\\U' HEX HEX HEX HEX HEX HEX HEX HEX;
fragment PN_CHARS_BASE : 'A'..'Z'
| 'a'..'z'
| '\u00C0'..'\u00D6'
| '\u00D8'..'\u00F6'
| '\u00F8'..'\u02FF'
| '\u0370'..'\u037D'
| '\u037F'..'\u1FFF'
| '\u200C'..'\u200D'
| '\u2070'..'\u218F'
| '\u2C00'..'\u2FEF'
| '\u3001'..'\uD7FF'
| '\uF900'..'\uFDCF'
| '\uFDF0'..'\uFFFD'
;
fragment PN_CHARS_U : PN_CHARS_BASE | '_';
fragment PN_CHARS : PN_CHARS_U | '-' | [0-9] | '\u00B7' | [\u0300-\u036F] | [\u203F-\u2040];
fragment HEX : [0-9] | [A-F] | [a-f];
fragment UNICODE : '\\u' HEX HEX HEX HEX ;
fragment INT : '0' | [1-9] [0-9]* ;
fragment EXP : [Ee] [+\-]? INT ;
|
pirataMOD2021/pirata_fixed.asm | ruyrybeyro/pirate128 | 1 | 4231 | ; PIRATA bugs fixed, code optimized and smaller
; <NAME> - 2021
;
; https://github.com/ruyrybeyro/pirate128/blob/main/pirataMOD2021/PirataMOD2021.tap
;
; border cyan/red - insert tape to copy
; SPACE to end, jump to save
;
; border yellow - insert blank tape and press 1
; (and some other keys, including space,
; see BIT0KEY)
;
; border green - 1 make another copy
; 2 start over
;
;
; FORMAT of tape block in memory from $4000 onwards
;
; BYTE 1 - LSB size of block
; BYTE 2 - MSB size of block
; BYTE 3 - flag identifying type of tape block
; -------- block of data
; if BYTE1 and BYTE2 = 0, no more blocks, otherwise another block follows
; 149 bytes = 141 bytes + 8 bytes for stack
; ROM CALL - alternate LD_BYTES entry point
; https://skoolkid.github.io/rom/asm/0556.html
;
; for not returning to SA_LD_RET at the end of load.
; Interrupts must be disabled
;
; A' - header block + Z=1
; IX = start address
; DE = block length
;
; returns from LD_FLAG if different flag
; returns when SPACE pressed or end of data on tape
;
; Returns upon completion:
;
; DE = number of bytes loaded + 1
; IX = IX + number of bytes loaded + 1
;
LD_BYTES2 EQU $0562
; ROM CALL - LD_FLAG alternate entry point
;
; after loading headers and byte of flag
;
; if flag was different than 0
; we need to reenter load routine
;
; returns when SPACE pressed or end of data on tape
;
; Returns upon completion:
;
; DE = number of bytes loaded + 1
; IX = IX + number of bytes loaded + 1
;
LD_FLAG3 EQU $05B7
; ROM CALL - SA-BYTES subroutine alternate entry
; https://skoolkid.github.io/rom/asm/04C2.html
;
; alternate entry, does not return using SA_LD_RET
; does not reenable interrupts
;
;A = flag, usually 00 header block, $FF data block
;DE = block length
;IX = start address
;
SA_BYTES2 EQU $04C6
; constants
RAM_BEGIN EQU $4000 ; first byte of RAM (screen)
MAX_SIZE EQU BEGIN - RAM_BEGIN - 5
;
; entry point of PIRATA MC subroutine
; originally stored in a REM statement in BASIC
; in this MOD2021 stored inside A$
; transfered to ORG ADDRESS via LDIR
;
; ORG 65387
ORG $FF6B
;
; ===========================
; Initialisation/setup
; ===========================
;
START:
DI ; Disabling interrupts
; only needed once
LD SP,0 ; stack to end of RAM
;
; ===========================
; Block(s) loading
; ===========================
;
; load blocks from tape
; until SPACE pressed
;
BEGIN: LD HL,RAM_BEGIN ; beggining of RAM
L_NEXTBLK:
PUSH HL
INC HL ; size of block LSB
INC HL ; size of block MSB
XOR A ; header block
LD (HL),A ; flag type of block
INC HL
LD DE,MAX_SIZE ; max number of bytes
PUSH HL
POP IX
; set carry flag for LOADing
SCF
; setup for the ROM instructions we are skipping
; Z'=1, A'=code block flag (0)
;
; better be 0, because header blocks expect a shorter tone
; in the ROM LD_BYTES routine
;
INC D
EX AF,AF'
DEC D
LD A,$0F ; border white/MIC off
OUT ($FE),A
; end of "ROM" code
CALL LD_BYTES2 ; call $0562 - load block
JR Z,END_BLOCK ; end of tape byte stream
; read keyboard port $7FFE
; select keyboard half row BNM Symbol SPACE
LD A,$7F
IN A,($FE)
RR A
JR NC,END_LOAD ; if bit 0 = 0
; SPACE pressed, finish block(s) loading loop
; and jump to save
; if this block is executed is because
; the block flag is different than 0
; though at the LD_BYTES routine point
; it is stored now in L (and not A)
; (L is used to store/put together the last loaded byte/bits
; at LD_BYTES 8-bit loading loop)
LD (IX-01),L ; save flag block identifier byte in RAM
; after block size
; IX = first data byte
XOR A ; Z=1
; comparation failed if here
; we need to change Z flag
; as it is used ahead on ROM
; Z=1 flag already loaded, C=0 loading/not verifying
CALL $LD_FLAG3 ; $05B7 - load entry after flag check.
;
; ===========================
; Loading block housekeeping
; ===========================
;
; Calculate loaded bytes, and store the length.
; Restore IX.
; Jump to load another block.
;
; subtract from max number of bytes / original length
; to get bytes loaded
; eg. original DE calling LD_BYTES vs new DE returning from LD_BYTES
; DE (length) = original DE - new DE - 1
END_BLOCK: LD HL,MAX_SIZE
OR A ; carry =0
SBC HL,DE ; HL=bytes loaded
LD D,H
LD E,L ; DE=HL=bytes loaded(+checksum)
DEC DE ; DE=bytes loaded
POP HL ; POP IX before loading, beggining of block
LD (HL),E ; (HL) = size (word) at beggining of block
INC HL
LD (HL),D
PUSH IX
POP HL ; HL=IX
DEC HL ; loading leaves IX at IX+1, DEC it
JR L_NEXTBLK ; next block
;
; ===========================
; Finished loading all blocks
; ===========================
;
; Execute this code after SPACE is pressed.
;
; (Next) block with size of word 0, means END.
;
END_LOAD: POP HL ; POP IX before loading
; (latter IX) = 0 word, no more blocks
XOR A
LD (HL),A ; (latter IX) = LSB 0 word
INC HL ; point to next byte
LD (HL),A ; (latter IX) = MSB 0 word
;
; ===========================
; Waiting for user input
; ===========================
;
; Border yellow
; waits for a key for saving loaded blocks.
;
LD A,06 ; border yellow
OUT ($FE),A
CALL DELAY
; wait for a pressed key
; works for not only for "1"
; but also SPACE, ENTER, P, 0, Q, A, Shift
;
BIT0KEY: XOR A ; select all keyboard half-rows
IN A,($FE) ; IN A,($00FE)
RR A ; rotate 1 bit to the right
JR C,BIT0KEY ; if bit 0=1 (no key pressed), try again
;
; =========================
; Block(s) saving
; =========================
;
; save all blocks
; with a delay of 0.9 seconds between them
BEGIN_SBLOCK: LD HL,RAM_BEGIN ; first RAM address
NEXT_SBLOCK: CALL DELAY
LD E,(HL) ; LSB size of block
INC HL
LD D,(HL) ; MSB size of block
; DE = size of block kept on RAM
LD A,E
OR D
JR Z,EXIT_SAVE ; size = 0, jump to EXIT_SAVE
INC HL
LD A,(HL) ; load flag
INC HL
PUSH HL
POP IX
; IX is now pointing at data to be saved
; DE has length of data to be saved
CALL SA_BYTES2 ; CALL $04C6
PUSH IX
POP HL ; HL=IX
DEC HL ; IX+1 returned from SA_BYTES needs to be corrected
JR NEXT_SBLOCK ; save next block
;
; =========================
; After Saving all blocks
; =========================
;
; border green
; Reads keyboard:
;
; "1" - saves blocks again
; "2" - starts from scratch loading
EXIT_SAVE: LD A,04 ; border green
OUT ($FE),A
; read keyboard port $F7FE
LD BC,$F7FE ; keyboard half row 1-5
WAIT_1_2: IN A,(C)
BIT 1,A ; key "2"
JR Z,BEGIN ; begin from scratch
BIT 0,A ; key "1"
JR Z,BEGIN_SBLOCK ; save again another copy
JR WAIT_1_2 ; read keyboard port again
;
; =========================
; Delay routine
; =========================
;
; delay of aprox 0.9 seconds
DELAY: LD BC,$FFFF
DLOOP: DEC BC ; decrement BC $FFFF/65535 times
LD A,B ; till BC=0
OR C
JR NZ,DLOOP ; JR if BC not equal 0
RET
; 8 bytes at the end of RAM empty
STACK: ;DEFS (8)
END START
|
8088/memtimer/onetimer.asm | reenigne/reenigne | 92 | 81271 | <reponame>reenigne/reenigne<filename>8088/memtimer/onetimer.asm
%include "../defaults_bin.asm"
mov al,TIMER0 | BOTH | MODE2 | BINARY
out 0x43,al
xor al,al
out 0x40,al
out 0x40,al
cli
mov ax,0
mov ds,ax
mov ax,cs
mov word[0x20],interrupt8
mov [0x22],ax
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0
mov si,experimentData
nextExperiment:
xor bx,bx
mov [lastQuotient],bx
; Print name of experiment
printLoop:
lodsb
cmp al,'$'
je donePrint
outputCharacter
inc bx
jmp printLoop
donePrint:
cmp bx,0
jne printSpaces
; Finish
complete
; Print spaces for alignment
printSpaces:
mov cx,21 ; Width of column
sub cx,bx
jg spaceLoop
mov cx,1
spaceLoop:
outputCharacter ' '
loop spaceLoop
mov cx,5 ; Number of repeats
repeatLoop:
push cx
mov cx,480+48 ; Number of iterations in primary measurement
call doMeasurement
push bx
mov cx,48 ; Number of iterations in secondary measurement
call doMeasurement
pop ax ; The primary measurement will have the lower value, since the counter counts down
sub ax,bx ; Subtract the secondary value, which will be higher, now AX is negative
neg ax ; Negate to get the positive difference.
xor dx,dx
mov cx,120
div cx ; Divide by 120 to get number of cycles (quotient) and number of extra tcycles (remainder)
push dx ; Store remainder
; Output quotient
xor dx,dx
mov [quotient],ax
mov cx,10
div cx
add dl,'0'
mov [output+2],dl
xor dx,dx
div cx
add dl,'0'
mov [output+1],dl
xor dx,dx
div cx
add dl,'0'
mov [output+0],dl
; Output remainder
pop ax
xor dx,dx
div cx
add dl,'0'
mov [output+7],dl
xor dx,dx
div cx
add dl,'0'
mov [output+6],dl
xor dx,dx
div cx
add dl,'0'
mov [output+5],dl
; Emit the final result text
push si
mov ax,[quotient]
cmp ax,[lastQuotient]
jne fullPrint
mov cx,6
mov si,output+4
jmp doPrint
fullPrint:
mov [lastQuotient],ax
mov cx,10
mov si,output
doPrint:
printString
pop si
pop cx
loop repeatLoop1
; Advance to the next experiment
lodsw
add si,ax
printNewLine
jmp nextExperiment
repeatLoop1:
jmp repeatLoop
quotient: dw 0
lastQuotient: dw 0
output:
db "000 +000 "
doMeasurement:
push si
push cx ; Save number of iterations
; Copy init
lodsw ; Number of init bytes
mov cx,ax
mov di,timerStartEnd
call codeCopy
; Copy timer end
mov si,timerEndStart
mov cx,timerEndEnd-timerEndStart
call codeCopy
pop cx
refreshOff
; Enable IRQ0
mov al,0xfe ; Enable IRQ 0 (timer), disable others
out 0x21,al
; Use IRQ0 to go into lockstep with timer 0
mov al,TIMER0 | LSB | MODE2 | BINARY
out 0x43,al
mov al,0x04 ; Count = 0x0004 which should be after the hlt instruction has
out 0x40,al ; taken effect.
sti
hlt
; The actual measurement happens in the the IRQ0 handler which runs here and
; returns the timer value in BX.
; Pop the flags pushed when the interrupt occurred
pop ax
pop si
ret
codeCopy:
cmp cx,0
je codeCopyDone
codeCopyLoop:
cmp di,0
je codeCopyOutOfSpace
movsb
loop codeCopyLoop
codeCopyDone:
ret
codeCopyOutOfSpace:
mov si,outOfSpaceMessage
mov cx,outOfSpaceMessageEnd-outOfSpaceMessage
outputString
complete
outOfSpaceMessage:
db "Copy out of space - use fewer iterations"
outOfSpaceMessageEnd:
experimentData:
experimeentJJ:
db "pearce_jj$"
dw .endCode - ($+2)
mov dx,0x3d8
mov ax,0x9000
mov es,ax
mov di,0
.l:
in ax,dx
stosw
loop .l
.endCode
experiment1:
db "samples 1$"
dw .endCode - ($+2)
mov al,TIMER2 | LSB | MODE1 | BINARY
out 0x43,al
mov dx,0x42
mov ax,0x8000
mov ds,ax
mov si,0
mov di,0
sub di,cx
mov cl,5 ;5
.l:
pop bx ;nnnnnnnnnnnSSSSS
mov al,bl
and al,0x1f
out dx,al
shr bx,cl ;00000nnnnnnSSSSS
mov al,bl
and al,0x1f
out dx,al
shr bx,cl ;0000000000nSSSSS
mov al,bl
and al,0x1f
out dx,al
lodsb
add si,4
shr al,1
shr al,1
and al,0x1f
out dx,al
pop bx ;nnnnnnSSSSSppppp
shr bx,cl ;00000nnnnnnSSSSS
mov al,bl
and al,0x1f
out dx,al
shr bx,cl ;0000000000nSSSSS
mov al,bl
and al,0x1f
out dx,al
dec sp
pop bx ;nnnnnnnnnnSSSSSp
shr bx,1 ;0nnnnnnnnnnSSSSS
mov al,bl
and al,0x1f
out dx,al
shr bx,cl ;000000nnnnnSSSSS
mov al,bl
and al,0x1f
out dx,al
shr bx,cl ;00000000000SSSSS
mov al,bl
out dx,al
add di,1
jnz .l
.endCode
lastExperiment:
db '$'
savedSS: dw 0
savedSP: dw 0
timerEndStart:
in al,0x40
mov bl,al
in al,0x40
mov bh,al
refreshOn
mov al,0x20
out 0x20,al
mov ax,cs
mov ds,ax
mov es,ax
mov ss,[savedSS]
mov sp,[savedSP]
; Don't use IRET here - it'll turn interrupts back on and IRQ0 will be
; triggered a second time.
popf
retf
timerEndEnd:
; This must come last in the program so that the experiment code can be
; copied after it.
interrupt8:
pushf
mov ax,cs
mov ds,ax
mov es,ax
mov [savedSS],ss
mov [savedSP],sp
mov ss,ax
mov dx,0;xffff
mov bx,0
mov ax,0
mov si,0
mov di,0
mov bp,0
; mov sp,0
times 528 push cs
mov al,TIMER0 | BOTH | MODE2 | BINARY
out 0x43,al
mov al,0x00
out 0x40,al
out 0x40,al
timerStartEnd:
|
source/web/tools/a2js/properties-definitions-tagged_record_type.adb | svn2github/matreshka | 24 | 15011 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, <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 <NAME>, 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 Asis.Declarations;
with Asis.Definitions;
with Asis.Elements;
with Properties.Tools;
with Properties.Expressions.Identifiers;
package body Properties.Definitions.Tagged_Record_Type is
function Is_Universal_String
(Engine : access Engines.Contexts.Context;
Element : Asis.Declaration) return Boolean;
function Is_Null_Procedure (Decl : Asis.Declaration) return Boolean;
----------
-- Code --
----------
function Code
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
use type Asis.Type_Kinds;
Parent : Asis.Subtype_Indication := Asis.Nil_Element;
Result : League.Strings.Universal_String;
Text : League.Strings.Universal_String;
begin
if Asis.Elements.Type_Kind (Element) =
Asis.A_Derived_Record_Extension_Definition
then
Parent := Asis.Definitions.Parent_Subtype_Indication (Element);
end if;
Result.Append ("(function (){"); -- Wrapper
Result.Append ("var _result = function ("); -- Constructor
-- Declare type's discriminant
declare
List : constant Asis.Discriminant_Association_List :=
Properties.Tools.Corresponding_Type_Discriminants (Element);
begin
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
begin
for N in Names'Range loop
Id := Engine.Text.Get_Property (Names (N), Name);
Result.Append (Id);
if J /= List'Last or N /= Names'Last then
Result.Append (",");
end if;
end loop;
end;
end loop;
Result.Append ("){");
-- Copy type's discriminant
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
Init : constant Asis.Expression :=
Asis.Declarations.Initialization_Expression (List (J));
begin
for N in Names'Range loop
Id := Engine.Text.Get_Property (Names (N), Name);
if not Asis.Elements.Is_Nil (Init) then
Result.Append ("if (typeof ");
Result.Append (Id);
Result.Append ("=== 'undefined')");
Result.Append (Id);
Result.Append ("=");
Result.Append (Engine.Text.Get_Property (Init, Name));
Result.Append (";");
end if;
Result.Append ("this.");
Result.Append (Id);
Result.Append (" = ");
Result.Append (Id);
Result.Append (";");
end loop;
end;
end loop;
if not Asis.Elements.Is_Nil (Parent) then
Result.Append
(Engine.Text.Get_Property (Parent, Name));
Result.Append (".call (this");
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
begin
for N in Names'Range loop
Result.Append (",");
Id := Engine.Text.Get_Property (Names (N), Name);
Result.Append (Id);
end loop;
end;
end loop;
Result.Append (");");
end if;
end;
-- Initialize type's components
declare
Props : League.Strings.Universal_String;
List : constant Asis.Declaration_List :=
Properties.Tools.Corresponding_Type_Components (Element);
begin
Props.Append ("var _props = {");
for J in List'Range loop
declare
Id : League.Strings.Universal_String;
Init : constant Asis.Expression :=
Asis.Declarations.Initialization_Expression (List (J));
Names : constant Asis.Defining_Name_List :=
Asis.Declarations.Names (List (J));
Value : League.Strings.Universal_String;
begin
if not Asis.Elements.Is_Nil (Init) then
Value := Engine.Text.Get_Property (Init, Name);
end if;
for N in Names'Range loop
Id := Engine.Text.Get_Property (Names (N), Name);
Result.Append ("this.");
Result.Append (Id);
Result.Append (" = ");
if Asis.Elements.Is_Nil (Init) then
Result.Append
(Engine.Text.Get_Property
(List (J), Engines.Initialize));
else
Result.Append (Value);
end if;
Result.Append (";");
Props.Append ("_pos_");
Props.Append (Id);
Props.Append (": {value: '");
Props.Append (Id);
Props.Append ("'},");
end loop;
end;
end loop;
Result.Append ("};"); -- End of Constructor
Props.Append ("};");
Result.Append (Props);
end;
-- Set prototype
Result.Append ("_result.prototype = _ec._tag('");
Text := Engine.Text.Get_Property (Element, Engines.Tag_Name);
Result.Append (Text);
Text := League.Strings.Empty_Universal_String;
if not Asis.Elements.Is_Nil (Parent) then
Text := Engine.Text.Get_Property (Parent, Engines.Tag_Name);
end if;
Result.Append ("', '");
Result.Append (Text);
Result.Append ("');");
Result.Append ("Object.defineProperties(_result.prototype, _props);");
-- Define null and abstract methods
declare
List : constant Asis.Declaration_List :=
Properties.Tools.Corresponding_Type_Subprograms (Element);
begin
for J in List'Range loop
if Asis.Declarations.Is_Dispatching_Operation (List (J))
and then (Asis.Elements.Has_Abstract (List (J))
or else Is_Null_Procedure (List (J)))
then
Result.Append ("_result.prototype.");
Result.Append
(Engine.Text.Get_Property
(Asis.Declarations.Names (List (J)) (1),
Engines.Method_Name));
if Is_Null_Procedure (List (J)) then
declare
Params : constant Asis.Parameter_Specification_List :=
Asis.Declarations.Parameter_Profile (List (J));
begin
Result.Append (" = _ec._null_proc({");
for P in Params'Range loop
if Engine.Boolean.Get_Property
(Element => Params (P),
Name => Engines.Has_Simple_Output)
then
Result.Append ("'");
Result.Append
(Engine.Text.Get_Property
(Asis.Declarations.Names (Params (P)) (1), Name));
Result.Append ("':");
Result.Append (Natural'Wide_Wide_Image (J - 1));
Result.Append (",");
end if;
end loop;
Result.Append ("});");
end;
else
Result.Append (" = _ec._abstract;");
end if;
end if;
end loop;
end;
Result.Append ("return _result;");
Result.Append ("})();"); -- End of Wrapper and call it
return Result;
end Code;
----------------
-- Initialize --
----------------
function Initialize
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
pragma Unreferenced (Name);
Decl : constant Asis.Declaration :=
Asis.Elements.Enclosing_Element (Element);
Result : League.Strings.Universal_String;
Text : League.Strings.Universal_String;
begin
if Is_Universal_String (Engine, Element) then
Result.Append ("""""");
return Result;
end if;
Result.Append (" new ");
Text :=
Properties.Expressions.Identifiers.Name_Prefix (Engine, Element, Decl);
Result.Append (Text);
Text := Engine.Text.Get_Property
(Asis.Declarations.Names (Decl) (1),
Engines.Code);
Result.Append (Text);
Result.Append ("()");
return Result;
end Initialize;
-----------------------
-- Is_Null_Procedure --
-----------------------
function Is_Null_Procedure (Decl : Asis.Declaration) return Boolean is
begin
return Asis.Elements.Declaration_Kind (Decl) in
Asis.A_Null_Procedure_Declaration;
end Is_Null_Procedure;
--------------------
-- Is_Simple_Type --
--------------------
function Is_Simple_Type
(Engine : access Engines.Contexts.Context;
Element : Asis.Declaration;
Name : Engines.Boolean_Property) return Boolean
is
pragma Unreferenced (Name);
begin
return Is_Universal_String (Engine, Element);
end Is_Simple_Type;
-------------------------
-- Is_Universal_String --
-------------------------
function Is_Universal_String
(Engine : access Engines.Contexts.Context;
Element : Asis.Declaration) return Boolean
is
Tag : constant League.Strings.Universal_String :=
Engine.Text.Get_Property (Element, Engines.Tag_Name);
begin
return Tag.To_Wide_Wide_String = "universal_string";
end Is_Universal_String;
--------------
-- Tag_Name --
--------------
function Tag_Name
(Engine : access Engines.Contexts.Context;
Element : Asis.Definition;
Name : Engines.Text_Property) return League.Strings.Universal_String
is
pragma Unreferenced (Name);
Decl : Asis.Declaration := Asis.Elements.Enclosing_Element (Element);
Text : League.Strings.Universal_String;
Result : League.Strings.Universal_String;
begin
Result := Engine.Text.Get_Property
(Asis.Declarations.Names (Decl) (1), Engines.Code);
while not Asis.Elements.Is_Nil (Decl)
and then Asis.Elements.Is_Part_Of_Instance (Decl)
loop
Decl := Tools.Enclosing_Declaration (Decl);
if Asis.Elements.Declaration_Kind (Decl) in
Asis.A_Generic_Instantiation
then
Text := Engine.Text.Get_Property
(Asis.Declarations.Names (Decl) (1), Engines.Code);
Text.Append (".");
Result.Prepend (Text);
end if;
end loop;
return Result;
end Tag_Name;
end Properties.Definitions.Tagged_Record_Type;
|
libsrc/_DEVELOPMENT/math/integer/fast/l_fast_mulu_32_16x16.asm | ahjelm/z88dk | 4 | 88121 | <reponame>ahjelm/z88dk
SECTION code_clib
SECTION code_math
PUBLIC l_fast_mulu_32_16x16
EXTERN l_fast_mulu_24_16x8, l0_fast_mulu_24_16x8, l1_fast_mulu_24_16x8
l_fast_mulu_32_16x16:
; unsigned multiplication of two 16-bit
; multiplicands into a 32-bit product
;
; enter : de = 16-bit multiplicand
; hl = 16-bit multiplicand
;
; exit : dehl = 32-bit product
; carry reset
;
; uses : af, bc, de, hl
; try to reduce the multiplication
inc d
dec d
jp z, l1_fast_mulu_24_16x8
inc h
dec h
jp z, l0_fast_mulu_24_16x8
; two full size multiplicands
; de = 16-bit multiplicand DE
; hl = 16-bit multiplicand HL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_IMATH_FAST & $04
ld b,d ; b = D
push hl ; save HL
call l_fast_mulu_24_16x8 ; ahl = HL * E
ELSE
push hl
push de
call l_fast_mulu_24_16x8
pop bc
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ex (sp),hl ; save LSW(HL * E)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_IMATH_FAST & $04
ld e,b ; e = D
ld b,a ; b = MSB(HL * E)
call l_fast_mulu_24_16x8 ; ahl = HL * D
ELSE
ld e,b
push af
call l_fast_mulu_24_16x8
pop bc
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ld c,b
ld b,0 ; bc = MSW(HL * E)
ld d,l
ld e,b ; bc = LSW(HL * D << 8)
ld l,h
ld h,a ; hl = MSW(HL * D << 8)
add hl,bc
ex de,hl ; de = MSW(result)
pop bc ; bc = LSW(HL * E)
add hl,bc ; hl = LSW(result)
ret nc
inc de
or a
ret
; loop code
;
; loop_12:
;
; add hl,hl
; rla
; rl c
;
; jr nc, loop_13
;
; add hl,de
; adc a,b
|
programs/oeis/141/A141387.asm | neoneye/loda | 22 | 87670 | <filename>programs/oeis/141/A141387.asm<gh_stars>10-100
; A141387: Triangle read by rows: T(n,m) = n + 2*m*(n - m) (0 <= m <= n).
; 0,1,1,2,4,2,3,7,7,3,4,10,12,10,4,5,13,17,17,13,5,6,16,22,24,22,16,6,7,19,27,31,31,27,19,7,8,22,32,38,40,38,32,22,8,9,25,37,45,49,49,45,37,25,9,10,28,42,52,58,60,58,52,42,28,10,11,31,47,59,67,71,71,67,59,47,31,11,12,34,52,66,76,82,84,82,76,66,52,34,12,13,37,57,73,85,93,97,97,93
mul $0,2
mov $2,1
lpb $0
sub $0,1
sub $1,$2
add $2,2
dif $2,$1
lpe
div $1,2
mov $0,$1
|
progchain.asm | runer112/Doors_CS_7 | 17 | 99074 | ;-----------------------------------------------------------
; Filename: ProgChain.asm
; Long name: Program chaining for RunProg
; Author: <NAME> aka <NAME>
; Last Update: May 15, 2010
; Routines Included:
; -PushProgChain
; -PopProgChain
; -GetProgChainSize
; -GetProgChainTop
;
;Please consult license.txt for the fair use agreement
;implicitly binding by you continuing to read past this
;point. Close and delete this file if you do not agree
;to the terms of the agreement.
;-----------------------------------------------------------
PushProgChain:
ld hl,ProgChainAppVar
rst 20h
bcall(_chkfindsym)
jr c,PushProgChainCreate
ex de,hl
push hl
ld a,(hl) ;get size byte low
inc hl
ld h,(hl) ;and size byte high
ld l,a
ld de,20
add hl,de ;add one slot size
pop de
ex de,hl ;hl = size byte in prgm, de = new size
ld (hl),e
inc hl
ld (hl),d
inc hl ;at the S byte now
ld a,(hl) ;a = S'
inc (hl) ;S = S' + 1
inc hl
push hl ;save the first A1 byte
ld l,a
ld h,0
add hl,hl ;hl = S'*2
add hl,hl ;hl = S'*4
push hl
add hl,hl ;hl = S'*8
add hl,hl ;hl = S'*16
pop bc
add hl,bc ;hl = S'*20
pop de
add hl,de ;hl = &S + 20S'
push hl
ld de,20
ex de,hl
bcall(_InsertMem)
pop hl
jr PushProgChainFinish
PushProgChainCreate:
ld hl,21 ;one 20-byte entry and one size byte
bcall(_CreateAppVar)
ex de,hl
inc hl
inc hl
ld (hl),1
inc hl
PushProgChainFinish:
push hl
ld (hl),0
push hl
pop de
inc de
ld bc,20-1
ldir ;clean the entry
pop hl
scf
ccf
ret
PopProgChain:
ld hl,ProgChainAppVar
rst 20h
bcall(_chkfindsym)
ret c
inc de
inc de
ld a,(de)
dec a
ld (de),a
jr z,PopProgChainDelete
push de ;update the size!
ex de,hl
dec hl
ld d,(hl)
dec hl
ld e,(hl)
push hl
ld hl,-20
add hl,de
pop de
ex de,hl
ld (hl),e
inc hl
ld (hl),d
pop de
inc de
ld l,a
ld h,0
add hl,hl ;hl = S*2
add hl,hl ;hl = S*4
push hl
add hl,hl ;hl = S*8
add hl,hl ;hl = S*16
pop bc
add hl,bc ;hl = S*20
add hl,de ;hl = &S+1+S*20
ld de,20 ;20 bytes to delete
bcall(_delmem) ;remove that top entry on the stack
ret
PopProgChainDelete:
dec de
dec de
bcall(_delvar)
ret
GetProgChainSize:
bcall(_PushOp1)
ld hl,ProgChainAppVar
rst 20h
bcall(_chkfindsym)
xor a
jr c,GetProgChainSizeFail
inc de
inc de
ld a,(de)
GetProgChainSizeFail: ;carry is preserved
push af
push de
bcall(_PopOp1)
pop de
pop af
ret ;nc is already set
GetProgChainTop:
bcall(_pushop1)
call GetProgChainSize
ret c
or a
ret z
dec a
ld l,a
ld h,0
add hl,hl ;hl = S*2
add hl,hl ;hl = S*4
push hl
add hl,hl ;hl = S*8
add hl,hl ;hl = S*16
pop bc
add hl,bc ;hl = S*20
add hl,de ;hl = &S+S*20
inc hl ;hl = &S+1+S*20
push hl
bcall(_popop1)
pop hl
or a ;clear carry flag
ret
SwapProgChain: ;swaps top two progchain entries
call GetProgChainSize
cp 2
ret c ;don't bother if fewer than 2 entries
call GetProgChainTop
push hl
ld de,-20
add hl,de
pop de
ld b,20
SwapProgChainLoop:
ld c,(hl)
ld a,(de)
ld (hl),a
ld a,c
ld (de),a
inc hl
inc de
djnz SwapProgChainLoop
ret
ProgChainAppVar:
.db 15h,"CHAIN7",0
|
src/intel/tools/tests/gen11/rol.asm | SoftReaper/Mesa-Renoir-deb | 0 | 82503 | rol(16) g3<1>UD g2<0,1,0>UD g2.1<0,1,0>UD { align1 1H };
|
archive/lisp-revised/758.agda | m0davis/oscar | 0 | 13061 | {-
Problem #758
same as problem 757 but rewritten with only expressions of first-order logic
Given premises:
(all A)(all B)((subset A B) <-> (all x)((mem x A) -> (mem x B))) justification = 1.0
(all A)(all B)(some intAB)(IsInt A B intAB) justification = 1.0
(all A)(all B)(all intAB)((IsInt A B intAB) <-> (all x)((mem x intAB) <-> ((mem x A) & (mem x B)))) justification = 1.0
(all A)(all B)((mapsF A B) <-> ((all x)((mem x A) -> (some y)((mem y B) & (F x y))) & (all x)(all y)(all z)(((mem x A) & ((mem y A) & (mem z A))) -> (((F x y) & (F x z)) -> (same y z))))) justification = 1.0
(all A)(all x)(all y)((same x y) -> ((mem x A) -> (mem y A))) justification = 1.0
(all x)(same x x) justification = 1.0
(all x)(all y)((same x y) <-> (same y x)) justification = 1.0
(all x)(all y)(all z)(((same x y) & (same y z)) -> (same x z)) justification = 1.0
(all A)(all B)((equal A B) <-> ((subset A B) & (subset B A))) justification = 1.0
(all A)(all B)(some invFBA)(IsInvF B A invFBA) justification = 1.0
(all A)(all B)(all invFBA)((IsInvF B A invFBA) <-> (all x)((mem x invFBA) <-> ((mem x A) & (some y)((mem y B) & (F x y))))) justification = 1.0
Ultimate epistemic interests:
(all A)(all B)(all X)(all Y)(((mapsF A B) & ((subset X B) & (subset Y B))) -> (some intXY)((IsInt X Y intXY) & (some invFIntXYA)((IsInvF intXY A invFIntXYA) & (some invFXA)((IsInvF X A invFXA) & (some invFYA)((IsInvF Y A invFYA) & (some intInvFXAInvFYA)((IsInt invFXA invFYA intInvFXAInvFYA) & (equal invFIntXYA intInvFXAInvFYA))))))) interest = 1.0
-}
_↔_ : Set → Set → Set
p ↔ q = p → q
postulate
U : Set
subset : U → U → Set
-- subsetMembership : ∀ {A} {B} →
|
src/gen-artifacts-docs-googlecode.adb | My-Colaborations/dynamo | 15 | 24819 | <filename>src/gen-artifacts-docs-googlecode.adb
-----------------------------------------------------------------------
-- gen-artifacts-docs-googlecode -- Artifact for Googlecode documentation format
-- Copyright (C) 2015, 2017 <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.
-----------------------------------------------------------------------
package body Gen.Artifacts.Docs.Googlecode is
-- ------------------------------
-- Get the document name from the file document (ex: <name>.wiki or <name>.md).
-- ------------------------------
overriding
function Get_Document_Name (Formatter : in Document_Formatter;
Document : in File_Document) return String is
pragma Unreferenced (Formatter);
begin
return Ada.Strings.Unbounded.To_String (Document.Name) & ".wiki";
end Get_Document_Name;
-- ------------------------------
-- Start a new document.
-- ------------------------------
overriding
procedure Start_Document (Formatter : in out Document_Formatter;
Document : in File_Document;
File : in Ada.Text_IO.File_Type) is
pragma Unreferenced (Formatter);
begin
Ada.Text_IO.Put_Line (File, "#summary " & Ada.Strings.Unbounded.To_String (Document.Title));
Ada.Text_IO.New_Line (File);
end Start_Document;
-- ------------------------------
-- Write a line in the document.
-- ------------------------------
procedure Write_Line (Formatter : in out Document_Formatter;
File : in Ada.Text_IO.File_Type;
Line : in String) is
begin
if Formatter.Need_Newline then
Ada.Text_IO.New_Line (File);
Formatter.Need_Newline := False;
end if;
Ada.Text_IO.Put_Line (File, Line);
end Write_Line;
-- ------------------------------
-- Write a line in the target document formatting the line if necessary.
-- ------------------------------
overriding
procedure Write_Line (Formatter : in out Document_Formatter;
File : in Ada.Text_IO.File_Type;
Line : in Line_Type) is
begin
case Line.Kind is
when L_LIST =>
Ada.Text_IO.New_Line (File);
Ada.Text_IO.Put (File, Line.Content);
Formatter.Need_Newline := True;
when L_LIST_ITEM =>
Ada.Text_IO.Put (File, Line.Content);
Formatter.Need_Newline := True;
when L_START_CODE =>
Formatter.Write_Line (File, "{{{");
when L_END_CODE =>
Formatter.Write_Line (File, "}}}");
when L_TEXT =>
Formatter.Write_Line (File, Line.Content);
when L_HEADER_1 =>
Formatter.Write_Line (File, "= " & Line.Content & " =");
when L_HEADER_2 =>
Formatter.Write_Line (File, "== " & Line.Content & " ==");
when L_HEADER_3 =>
Formatter.Write_Line (File, "=== " & Line.Content & " ===");
when L_HEADER_4 =>
Formatter.Write_Line (File, "==== " & Line.Content & " ====");
when others =>
null;
end case;
end Write_Line;
-- ------------------------------
-- Finish the document.
-- ------------------------------
overriding
procedure Finish_Document (Formatter : in out Document_Formatter;
Document : in File_Document;
File : in Ada.Text_IO.File_Type;
Source : in String) is
pragma Unreferenced (Formatter);
begin
Ada.Text_IO.New_Line (File);
if Document.Print_Footer then
Ada.Text_IO.Put_Line (File, "----");
Ada.Text_IO.Put_Line (File,
"[https://github.com/stcarrez/dynamo Generated by Dynamo] from _"
& Source & "_");
end if;
end Finish_Document;
end Gen.Artifacts.Docs.Googlecode;
|
VideoRender/ffmpeg/libavcodec/x86/huffyuvencdsp.asm | Becavalier/WasmPlay | 4 | 171111 | ;************************************************************************
;* SIMD-optimized HuffYUV encoding functions
;* Copyright (c) 2000, 2001 <NAME>
;* Copyright (c) 2002-2004 <NAME> <<EMAIL>>
;*
;* MMX optimization by <NAME> <<EMAIL>>
;* Conversion to NASM format by Tiancheng "<NAME> <<EMAIL>>
;*
;* This file is part of FFmpeg.
;*
;* FFmpeg 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.
;*
;* FFmpeg 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 FFmpeg; if not, write to the Free Software
;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "libavutil/x86/x86util.asm"
section .text
; void ff_diff_int16(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
; unsigned mask, int w);
%macro INT16_LOOP 2 ; %1 = a/u (aligned/unaligned), %2 = add/sub
movd m4, maskd
SPLATW m4, m4
add wd, wd
test wq, 2*mmsize - 1
jz %%.tomainloop
push tmpq
%%.wordloop:
sub wq, 2
%ifidn %2, add
mov tmpw, [srcq+wq]
add tmpw, [dstq+wq]
%else
mov tmpw, [src1q+wq]
sub tmpw, [src2q+wq]
%endif
and tmpw, maskw
mov [dstq+wq], tmpw
test wq, 2*mmsize - 1
jnz %%.wordloop
pop tmpq
%%.tomainloop:
%ifidn %2, add
add srcq, wq
%else
add src1q, wq
add src2q, wq
%endif
add dstq, wq
neg wq
jz %%.end
%%.loop:
%ifidn %2, add
mov%1 m0, [srcq+wq]
mov%1 m1, [dstq+wq]
mov%1 m2, [srcq+wq+mmsize]
mov%1 m3, [dstq+wq+mmsize]
%else
mov%1 m0, [src1q+wq]
mov%1 m1, [src2q+wq]
mov%1 m2, [src1q+wq+mmsize]
mov%1 m3, [src2q+wq+mmsize]
%endif
p%2w m0, m1
p%2w m2, m3
pand m0, m4
pand m2, m4
mov%1 [dstq+wq] , m0
mov%1 [dstq+wq+mmsize], m2
add wq, 2*mmsize
jl %%.loop
%%.end:
RET
%endmacro
%if ARCH_X86_32
INIT_MMX mmx
cglobal diff_int16, 5,5,5, dst, src1, src2, mask, w, tmp
INT16_LOOP a, sub
%endif
INIT_XMM sse2
cglobal diff_int16, 5,5,5, dst, src1, src2, mask, w, tmp
test src1q, mmsize-1
jnz .unaligned
test src2q, mmsize-1
jnz .unaligned
test dstq, mmsize-1
jnz .unaligned
INT16_LOOP a, sub
.unaligned:
INT16_LOOP u, sub
INIT_MMX mmxext
cglobal sub_hfyu_median_pred_int16, 7,7,0, dst, src1, src2, mask, w, left, left_top
add wd, wd
movd mm7, maskd
SPLATW mm7, mm7
movq mm0, [src1q]
movq mm2, [src2q]
psllq mm0, 16
psllq mm2, 16
movd mm6, [left_topq]
por mm0, mm6
movd mm6, [leftq]
por mm2, mm6
xor maskq, maskq
.loop:
movq mm1, [src1q + maskq]
movq mm3, [src2q + maskq]
movq mm4, mm2
psubw mm2, mm0
paddw mm2, mm1
pand mm2, mm7
movq mm5, mm4
pmaxsw mm4, mm1
pminsw mm1, mm5
pminsw mm4, mm2
pmaxsw mm4, mm1
psubw mm3, mm4
pand mm3, mm7
movq [dstq + maskq], mm3
add maskq, 8
movq mm0, [src1q + maskq - 2]
movq mm2, [src2q + maskq - 2]
cmp maskq, wq
jb .loop
movzx maskd, word [src1q + wq - 2]
mov [left_topq], maskd
movzx maskd, word [src2q + wq - 2]
mov [leftq], maskd
RET
|
exe/peendsec.asm | DigitalMars/optlink | 28 | 90595 | TITLE PEENDSEC - Copyright (c) SLR Systems 1994
INCLUDE MACROS
if fg_pe
INCLUDE EXES
INCLUDE PE_STRUC
INCLUDE IO_STRUC
INCLUDE SYMBOLS
PUBLIC PE_OUT_END_OF_SECTION
.DATA
EXTERNDEF CURN_SECTION_GINDEX:DWORD,CODEVIEW_SECTION_GINDEX:DWORD,FLAG_0C:DWORD,_ERR_COUNT:DWORD
EXTERNDEF CURN_OUTFILE_GINDEX:DWORD,FIRST_CODE_DATA_OBJECT_GINDEX:DWORD,N_CODE_DATA_OBJECTS:DWORD
EXTERNDEF CURN_C_TIME:DWORD,PE_BASE:DWORD,PE_OBJECT_ALIGN:DWORD,ALIGNMENT:DWORD,PE_NEXT_OBJECT_RVA:DWORD
EXTERNDEF STACK_SIZE:DWORD,HEAP_SIZE:DWORD,FIRST_SECTION_GINDEX:DWORD,FIRST_PEOBJECT_GINDEX:DWORD
EXTERNDEF _tls_used_GINDEX:DWORD
EXTERNDEF PEXEHEADER:PEXE,OUTFILE_GARRAY:STD_PTR_S,PE_OBJECT_GARRAY:STD_PTR_S
EXTERNDEF OUT_FLUSH_SEGMENT:DWORD
.CODE PASS2_TEXT
EXTERNDEF ERR_ABORT:PROC,EO_CV:PROC,MOVE_EAX_TO_EDX_NEXE:PROC,FLUSH_OUTFILE_CLOSE:PROC,PE_OUTPUT_RELOCS:PROC
EXTERNDEF CHANGE_PE_OBJECT:PROC,EO_CV_ROUTINE:PROC,PE_OUTPUT_RESOURCES:PROC,PE_FINISH_DEBUG:PROC
PE_OUT_END_OF_SECTION PROC
;
;END OF A SECTION
;
MOV EAX,CURN_SECTION_GINDEX
MOV ECX,FIRST_SECTION_GINDEX
CMP EAX,ECX
JZ L1$
CMP CODEVIEW_SECTION_GINDEX,EAX
JZ PE_EO_CV
MOV AL,0
JMP ERR_ABORT
L1$:
;
;OUTPUT OTHER SECTIONS, LIKE
; .tls THREAD-LOCAL-STORAGE
; .rsrc RESOURCES
; .reloc RELOCS
; .debug DEBUG SIMPLE HEADER
;
CALL PE_OUTPUT_RESOURCES
CALL PE_OUTPUT_RELOCS ;
MOV EAX,CURN_OUTFILE_GINDEX
CONVERT EAX,EAX,OUTFILE_GARRAY
ASSUME EAX:PTR OUTFILE_STRUCT
DEC [EAX]._OF_SECTIONS ;# OF SECTIONS USING THIS FILE
JNZ L25$
;
;LAST SECTION TO USE THIS FILE, FLUSH AND CLOSE
;
CALL FLUSH_OUTFILE_CLOSE
XOR EAX,EAX
MOV CURN_OUTFILE_GINDEX,EAX
L25$:
RET
PE_OUT_END_OF_SECTION ENDP
PE_EO_CV PROC
;
;
;
;
;DEAL WITH _tls_used
;
CALL HANDLE_TLS
;
CALL EO_CV_ROUTINE
CALL PE_FINISH_DEBUG ;OUTPUT DEBUG HEADER
CALL CHANGE_PE_OBJECT
;
;NOW DO PEXEHEADER
;
MOV EAX,CURN_C_TIME
GETT CL,PE_SUBSYSTEM_DEFINED
MOV PEXEHEADER._PEXE_TIME_DATE,EAX
OR CL,CL
JNZ L1$
MOV PEXEHEADER._PEXE_SUBSYSTEM,PSUB_WIN_CHAR ;LINK386 COMPATIBILITY
L1$:
BITT PE_SUBSYS_VERSION_DEFINED
JNZ L15$
MOV AL,BPTR PEXEHEADER._PEXE_SUBSYSTEM
MOV EDX,3
CMP AL,PSUB_WIN_GUI
MOV ECX,10
JZ L14$
CMP AL,PSUB_WIN_CHAR
JZ L14$
MOV CL,0
CMP AL,PSUB_NATIVE
MOV DL,1
JZ L14$
MOV DL,0
CMP AL,PSUB_UNKNOWN
JZ L14$
CMP AL,PSUB_OS2
JZ L14$
MOV CX,90
CMP AL,PSUB_POSIX
MOV DX,19
JNZ L15$
L14$:
MOV PEXEHEADER._PEXE_SUBSYS_MAJOR,DX
MOV PEXEHEADER._PEXE_SUBSYS_MINOR,CX
L15$:
MOV EAX,818FH
GETT CL,PE_BASE_FIXED
OR CL,CL
JNZ L18$
AND AL,0FEH ;MARK NOT FIXED
L18$:
GETT CL,PE_LARGE_ADDRESS_AWARE
OR CL,CL
JZ L20$
OR AL,20H ;MARK IT LARGE ADDRESS AWARE
L20$:
MOV ECX,FLAG_0C
AND ECX,MASK APPTYPE
JZ L22$
OR AH,20H ;MARK IT A DLL
L22$:
GETT CL,HANDLE_EXE_ERRORFLAG
XOR EBX,EBX
OR CL,CL
JZ L24$
SUB EBX,_ERR_COUNT
JZ L24$
AND EAX,NOT 2
L24$:
MOV PEXEHEADER._PEXE_FLAGS,AX
;
;SCAN OBJECTS LOOKING FOR FIRST CODE, FIRST DATA, AND FIRST UNINIT_DATA
;
MOV EAX,MASK PEL_CODE_OBJECT
CALL SCAN_FOR_OBJECT ;RETURNS RVA IN DX:AX, LENGTH IN CX:BX
MOV PEXEHEADER._PEXE_CODE_SIZE,ECX
MOV PEXEHEADER._PEXE_CODE_BASE,EAX
MOV EAX,MASK PEL_INIT_DATA_OBJECT
CALL SCAN_FOR_OBJECT ;RETURNS RVA IN DX:AX, LENGTH IN CX:BX
MOV PEXEHEADER._PEXE_IDATA_SIZE,ECX
MOV PEXEHEADER._PEXE_DATA_BASE,EAX
MOV EAX,MASK PEL_UNINIT_DATA_OBJECT
CALL SCAN_FOR_OBJECT ;RETURNS RVA IN DX:AX, LENGTH IN CX:BX
MOV PEXEHEADER._PEXE_UDATA_SIZE,ECX
MOV EAX,PE_BASE
MOV PEXEHEADER._PEXE_IMAGE_BASE,EAX
MOV EAX,PE_OBJECT_ALIGN
MOV PEXEHEADER._PEXE_OBJECT_ALIGN,EAX
MOV EAX,ALIGNMENT
MOV PEXEHEADER._PEXE_FILE_ALIGN,EAX
MOV EAX,PE_NEXT_OBJECT_RVA
MOV PEXEHEADER._PEXE_IMAGE_SIZE,EAX
MOV EAX,FLAG_0C
AND EAX,MASK APPTYPE
JNZ L5$
;
;SET COMMIT MINIMUM OF 4K
;
MOV EAX,PEXEHEADER._PEXE_STACK_COMMIT
MOV ECX,4K
CMP EAX,ECX
JA L41$
MOV PEXEHEADER._PEXE_STACK_COMMIT,ECX ;STACK COMMIT MINIMUM IS 8K
L41$:
MOV ECX,100000H ;DEFAULT IS 1 MEG
GETT AL,STACK_SIZE_FLAG
OR AL,AL
JZ L42$
MOV ECX,64K ;IF USER SET IT, MAKE IT AT LEAST 64K
L42$:
CMP STACK_SIZE,64K
JA L43$
MOV STACK_SIZE,ECX ;STACK SIZE MINIMUM IS 64K
L43$:
JMP L51$
L5$:
XOR EAX,EAX
MOV STACK_SIZE,EAX
MOV PEXEHEADER._PEXE_STACK_COMMIT,EAX
L51$:
MOV ECX,STACK_SIZE
MOV EAX,HEAP_SIZE
MOV PEXEHEADER._PEXE_STACK_RESERVE,ECX
TEST EAX,EAX
JZ L52$
CMP EAX,64K
JAE L53$
MOV EAX,64K
JMP L53$
L52$:
MOV EAX,100000H ;DEFAULT IS 1 MEG IF NOT SET
L53$:
MOV PEXEHEADER._PEXE_HEAP_RESERVE,EAX
MOV EAX,PEXEHEADER._PEXE_HEAP_COMMIT
TEST EAX,EAX
JNZ L54$
MOV PEXEHEADER._PEXE_HEAP_COMMIT,4K
L54$:
MOV EAX,OFF PEXEHEADER
MOV ECX,SIZE PEXE
XOR EDX,EDX
CALL MOVE_EAX_TO_EDX_NEXE
;
;NOW SEND OBJECT TABLE TOO...
;
CALL FLUSH_OBJECTS
MOV EAX,CURN_OUTFILE_GINDEX
CONVERT EAX,EAX,OUTFILE_GARRAY
ASSUME EAX:PTR OUTFILE_STRUCT
DEC [EAX]._OF_SECTIONS ;# OF SECTIONS USING THIS FILE
JNZ L25$
;
;LAST SECTION TO USE THIS FILE, FLUSH AND CLOSE
;
CALL FLUSH_OUTFILE_CLOSE
XOR EAX,EAX
MOV CURN_OUTFILE_GINDEX,EAX
L25$:
RET
PE_EO_CV ENDP
FLUSH_OBJECTS PROC NEAR
;
;
;
PUSHM ESI,EBX
MOV EBX,SIZE PEXE
MOV ESI,FIRST_PEOBJECT_GINDEX
TEST ESI,ESI
JZ L5$
L1$:
CONVERT ESI,ESI,PE_OBJECT_GARRAY
ASSUME ESI:PTR PE_IOBJECT_STRUCT
MOV ECX,SIZE PE_OBJECT_STRUCT
MOV EAX,ESI
MOV EDX,EBX
CALL MOVE_EAX_TO_EDX_NEXE
MOV ESI,[ESI]._PEOBJECT_NEXT_GINDEX
ADD EBX,SIZE PE_OBJECT_STRUCT
TEST ESI,ESI
JNZ L1$
L5$:
;
;ALIGN STUFF UP TO
;
POPM EBX,ESI
RET
FLUSH_OBJECTS ENDP
SCAN_FOR_OBJECT PROC NEAR
;
;AX IS MASK TO SEARCH FOR
;
;IF FOUND, CX:BX == SIZE
; DX:AX == RVA
;
MOV ECX,N_CODE_DATA_OBJECTS
MOV EDX,FIRST_CODE_DATA_OBJECT_GINDEX
TEST ECX,ECX
JZ L5$
L1$:
CONVERT EDX,EDX,PE_OBJECT_GARRAY
ASSUME EDX:PTR PE_IOBJECT_STRUCT
TEST [EDX]._PEOBJECT_FLAGS,EAX
JNZ L8$
MOV EDX,[EDX]._PEOBJECT_NEXT_GINDEX
DEC ECX
JNZ L1$
L5$:
XOR EAX,EAX
XOR ECX,ECX
RET
L8$:
MOV ECX,[EDX]._PEOBJECT_VSIZE
MOV EAX,[EDX]._PEOBJECT_RVA
RET
SCAN_FOR_OBJECT ENDP
HANDLE_TLS PROC
;
;
;
MOV ECX,_tls_used_GINDEX
TEST ECX,ECX
JZ L9$
CONVERT ECX,ECX,SYMBOL_GARRAY
ASSUME ECX:PTR SYMBOL_STRUCT
MOV AL,[ECX]._S_NSYM_TYPE
MOV EDX,[ECX]._S_OFFSET
CMP AL,NSYM_RELOC
JNZ L9$
SUB EDX,PE_BASE
MOV PEXEHEADER._PEXE_THREAD_LOCAL_SIZE,18H
MOV PEXEHEADER._PEXE_THREAD_LOCAL_RVA,EDX
L9$:
RET
HANDLE_TLS ENDP
endif
END
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_mpd0.asm | prismotizm/gigaleak | 0 | 96546 | Name: zel_mpd0.asm
Type: file
Size: 194695
Last-Modified: '2016-05-13T04:36:32Z'
SHA-1: 196D1BC56904BF5AADC54E587684171146AD14E2
Description: null
|
patches/vwf_dialogues/vwffontpointers.asm | RPGHacker/SMW-Workspace | 9 | 8943 | ; This table contains the pointers to each font.
; Format:
; dl <fontName>,<fontWidth>
dl Font1,Font1_Width
|
oeis/073/A073531.asm | neoneye/loda-programs | 11 | 9093 | <filename>oeis/073/A073531.asm
; A073531: Number of n-digit positive integers with all digits distinct.
; Submitted by <NAME>(s1)
; 9,81,648,4536,27216,136080,544320,1632960,3265920,3265920
mov $1,1
mov $2,10
lpb $0
sub $0,1
sub $2,1
mul $1,$2
lpe
mov $0,$1
mul $0,9
|
Bast.g4 | DeflatedPickle/Bast | 0 | 7838 | grammar Bast;
options {
language=Python3;
}
/*
Parser Rules
*/
program: code EOF;
code: line+; // (line | block)+;
// block: STRT_BLOCK line* END_BLOCK;
line: COMMENT | simple_stmt;
assignment: ID '=' (ID | NUMBER | BOOLEAN | STRING);
simple_stmt: assignment;
//if_stmt:;
//compound_stmt:;
/*
Lexer Rules
*/
COMMENT: '//' ~[\r\n]*;
// STRT_BLOCK: '{';
// END_BLOCK: '}';
LOWER: [a-z];
UPPER: [A-Z];
SPACE: [ \t\r\n] -> skip;
STRING: ["] ~["\r\n]* ["];
LETTER: LOWER | UPPER;
NUMBER: [0-9]+;
BOOLEAN: 'true' | 'false';
ID: LETTER (LETTER | NUMBER)*;
WS: [ \t\r\n\f]+ -> skip; |
demos/win32/DEMO8/demo8.asm | gbmaster/nasmx | 18 | 22936 | ;// DEMO8.ASM
;//
;// Copyright (C)2005-2011 The NASMX Project
;//
;// This is a fully UNICODE aware, typedefined demo that demonstrates
;// using NASMX typedef system to make your code truly portable between
;// 32 and 64-bit systems using either ASCII or UNICODE
;//
;// Contributors:
;// <NAME>
;// <NAME>
;//
%include '..\..\windemos.inc'
%include '..\..\..\inc\win32\stdwin.inc'
entry demo8
[section .text]
proc WndProc, ptrdiff_t hwnd, dword umsg, size_t wparam, size_t lparam
locals none
switch dword [argv(.umsg)]
case dword WM_CREATE
ButtonCtl szString, 500, 0, 0, 100, 40, [argv(.hwnd)], [wc + WNDCLASSEX.hInstance]
ButtonCtl szString, 500, 100, 0, 100, 40, [argv(.hwnd)], [wc + WNDCLASSEX.hInstance]
StaticCtl szContent, 501, 0, 40, 200, 40, [argv(.hwnd)], [wc + WNDCLASSEX.hInstance]
ComboCtl szContent, 502, 0, 80, 200, 100, [argv(.hwnd)], [wc + WNDCLASSEX.hInstance]
ListBoxCtl szContent, 502, 0, 106, 200, 100, [argv(.hwnd)], [wc + WNDCLASSEX.hInstance]
break
case dword WM_COMMAND
cmp [argv(.wparam)], dword 500
jz near .bleh
break
.bleh:
invoke MessageBox, NULL, szContent, szTitle, MB_OK
break
case dword WM_DESTROY
invoke PostQuitMessage, NULL
break
default
invoke DefWindowProc, [argv(.hwnd)], [argv(.umsg)], [argv(.wparam)], [argv(.lparam)]
endswitch
endproc
proc WinMain, ptrdiff_t hinst, ptrdiff_t hpinst, ptrdiff_t cmdln, dword dwshow
locals none
invoke LoadIcon, NULL, IDI_APPLICATION
mov edx, eax
mov eax, dword [argv(.hinst)]
mov ebx, dword szClass
mov ecx, dword WndProc
mov [wc + WNDCLASSEX.hInstance], eax
mov [wc + WNDCLASSEX.lpszClassName], ebx
mov [wc + WNDCLASSEX.lpfnWndProc], ecx
mov [wc + WNDCLASSEX.hIcon], edx
mov [wc + WNDCLASSEX.hIconSm], edx
invoke RegisterClassEx, wc
StdWindow szClass, szTitle, 100, 120, 212, 232, NULL, [wc + WNDCLASSEX.hInstance]
mov [hWnd], eax
invoke ShowWindow, hWnd, [argv(.dwshow)]
invoke UpdateWindow, hWnd
do
invoke TranslateMessage, message
invoke DispatchMessage, message
invoke GetMessage, message, NULL, NULL, NULL
while eax, !=, 0
mov eax, dword [message + MSG.wParam]
endproc
proc demo8, ptrdiff_t argcount, ptrdiff_t cmdline
locals none
invoke GetModuleHandle, NULL
mov [hInstance], eax
invoke WinMain, hInstance, NULL, NULL, SW_SHOWNORMAL
invoke ExitProcess, NULL
endproc
[section .bss]
hInstance: reserve(ptrdiff_t) 1
hWnd: reserve(ptrdiff_t) 1
[section .data]
szString: declare(NASMX_TCHAR) NASMX_TEXT("Click Me!"), 0x0
szContent: declare(NASMX_TCHAR) NASMX_TEXT("Win32Nasm Demo #8"), 0x0
szTitle: declare(NASMX_TCHAR) NASMX_TEXT("Demo8"), 0x0
szClass: declare(NASMX_TCHAR) NASMX_TEXT("Demo8Class"), 0x0
NASMX_ISTRUC wc, WNDCLASSEX
NASMX_AT cbSize, WNDCLASSEX_size
NASMX_AT style, CS_VREDRAW + CS_HREDRAW
NASMX_AT lpfnWndProc, NULL
NASMX_AT cbClsExtra, NULL
NASMX_AT cbWndExtra, NULL
NASMX_AT hInstance, NULL
NASMX_AT hIcon, NULL
NASMX_AT hCursor, NULL
NASMX_AT hbrBackground, COLOR_BTNFACE + 1
NASMX_AT lpszMenuName, NULL
NASMX_AT lpszClassName, NULL
NASMX_AT hIconSm, NULL
NASMX_IENDSTRUC
NASMX_ISTRUC message, MSG
NASMX_AT hwnd, NULL
NASMX_AT message, NULL
NASMX_AT wParam, NULL
NASMX_AT lParam, NULL
NASMX_AT time, NULL
NASMX_ISTRUC pt, POINT
NASMX_AT x, NULL
NASMX_AT y, NULL
NASMX_IENDSTRUC
NASMX_IENDSTRUC
|
alloy4fun_models/trashltl/models/18/KmR5GZtkSyuNtoFXr.als | Kaixi26/org.alloytools.alloy | 0 | 1422 | <gh_stars>0
open main
pred idKmR5GZtkSyuNtoFXr_prop19 {
always (
Protected in Protected' until Protected in Trash
)
}
pred __repair { idKmR5GZtkSyuNtoFXr_prop19 }
check __repair { idKmR5GZtkSyuNtoFXr_prop19 <=> prop19o } |
programs/oeis/061/A061285.asm | neoneye/loda | 22 | 100436 | <filename>programs/oeis/061/A061285.asm<gh_stars>10-100
; A061285: a(n) = 2^((prime(n) - 1)/2).
; 2,4,8,32,64,256,512,2048,16384,32768,262144,1048576,2097152,8388608,67108864,536870912,1073741824,8589934592,34359738368,68719476736,549755813888,2199023255552,17592186044416,281474976710656
seq $0,168565 ; Let p = prime(n); then a(n) = p + (p-1)/2.
div $0,3
mov $1,2
pow $1,$0
mov $0,$1
|
sources/md/markdown-blocks.adb | reznikmm/markdown | 0 | 14152 | <reponame>reznikmm/markdown
-- SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
----------------------------------------------------------------
with Markdown.List_Items;
with Markdown.Lists;
with Markdown.Visitors;
package body Markdown.Blocks is
type List_Access is access all Markdown.Lists.List'Class;
------------------
-- Append_Child --
------------------
not overriding procedure Append_Child
(Self : in out Container_Block;
Child : not null Block_Access) is
begin
if Self.Last_Child = null then
Child.Next := Child;
else
Child.Next := Self.Last_Child.Next;
Self.Last_Child.Next := Child;
end if;
Self.Last_Child := Child;
end Append_Child;
--------------------
-- Visit_Children --
--------------------
procedure Visit_Children
(Self : Container_Block'Class;
Visitor : in out Markdown.Visitors.Visitor'Class)
is
begin
if Self.Last_Child = null then
return;
end if;
declare
Item : not null Block_Access := Self.Last_Child.Next;
begin
loop
Item.Visit (Visitor);
exit when Item = Self.Last_Child;
Item := Item.Next;
end loop;
end;
end Visit_Children;
---------------------
-- Wrap_List_Items --
---------------------
procedure Wrap_List_Items (Self : in out Container_Block'Class) is
type Visitor is new Markdown.Visitors.Visitor with record
Is_List_Item : Boolean := False;
Is_Ordered : Boolean := False;
Marker : League.Strings.Universal_String;
end record;
overriding procedure List_Item
(Self : in out Visitor;
Value : in out Markdown.List_Items.List_Item);
overriding procedure List_Item
(Self : in out Visitor;
Value : in out Markdown.List_Items.List_Item) is
begin
Self.Is_List_Item := True;
Self.Is_Ordered := Value.Is_Ordered;
Self.Marker := Value.Marker;
end List_Item;
begin
if Self.Last_Child = null then
return;
end if;
declare
List : List_Access;
Last : constant not null Block_Access := Self.Last_Child;
Item : not null Block_Access := Last.Next;
Next : not null Block_Access := Item.Next;
begin
Self.Last_Child := null;
loop
declare
Checker : Visitor;
begin
Item.Visit (Checker);
if Checker.Is_List_Item then
if List = null or else not List.Match (Checker.Marker) then
List := new Markdown.Lists.List;
Self.Append_Child (Block_Access (List));
List.Append_Child (Item);
else
List.Append_Child (Item);
end if;
else
List := null;
Self.Append_Child (Item);
end if;
exit when Item = Last;
Item := Next;
Next := Item.Next;
end;
end loop;
end;
end Wrap_List_Items;
end Markdown.Blocks;
|
II-sem/Microprocessor/Assembly Language Programs/sum.asm | ASHD27/JMI-MCA | 3 | 17587 | .model small
.stack 10h
.data
num db 23
d db 10
sum db 0
.code
mov ax,@data
mov ds,ax
lbl1:
mov al,num
mov ah,0 ;clearing ah R
div d
mov num,al
mov al,ah
add al,sum
mov sum,al
cmp num,0
jne lbl1
mov al,sum
add al,48
mov dl,al
mov ah,02h
int 21h
mov ah,4ch
int 21h
end |
boot/boot.asm | raibu/rabu-os | 0 | 90512 |
[org 0x7c00] ; tell the assembler that our offset is bootsector code
%include "defs.asm"
%macro puts16 1
push bx
mov bx, %1
call print_str16
pop bx
%endmacro
%macro putsn16 1
push bx
mov bx, %1
call print_str16
pop bx
call print_newline16
%endmacro
%macro puthex16 1
push bx
mov bx, %1
call print_hex16
pop bx
%endmacro
%macro disk_read16 6 ;SECS, SEC, CYL, HEAD, DRIVE, BUFPTR
pusha
mov ah, D_READ
mov al, %1
mov cl, %2
mov ch, %3
mov dh, %4
mov dl, %5
mov bx, %6
call disk_operation16
popa
%endmacro
KERNEL_OFFSET equ 0x1000
;mov [BOOT_DRIVE], byte 0x80
mov bp, 0x9000 ; set the stack safely away from us
mov sp, bp
call load_kernel
mov ax, 13h
int 10h
call switch_to_pm
jmp $
[bits 16]
load_kernel:
putsn16 MSG_LOAD_KERNEL
disk_read16 31, 2, 0, 0, 0x0, KERNEL_OFFSET
ret
; remember to include subroutines below the hang
%include "print16.asm"
%include "disk16.asm"
[bits 32]
%macro puts32 1
push ebx
mov ebx, %1
call print_string_pm
pop ebx
%endmacro
BEGIN_PM: ; after the switch we will get here
;puts32 MSG_PROT_MODE
call KERNEL_OFFSET
jmp $
;BOOT_DRIVE db 0 ; It is a good idea to store it in memory because 'dl' may get overwritten
MSG_REAL_MODE db "Started in 16bit Real Mode", 0
MSG_PROT_MODE db "Landed in 32bit Protected Mode", 0
MSG_LOAD_KERNEL db "Loading kernel", 0
%include "gdt32.asm"
%include "switch1632.asm"
%include "print32.asm"
; padding and magic number
times 510-($-$$) db 0
;db 0,0,0,0,0
dw 0xaa55
|
orka/src/orka/interface/orka-inputs-joysticks-chords.ads | onox/orka | 52 | 23937 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2019 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.
package Orka.Inputs.Joysticks.Chords is
pragma Preelaborate;
subtype Chord_Button_Index is Positive range 1 .. 4;
type Button_Index_Array is array (Chord_Button_Index range <>) of Button_Index;
type Chord (<>) is tagged private;
function Create_Chord
(Buttons : Button_Index_Array;
Frames : Positive) return Chord
with Pre => Buttons'Length >= 2;
-- Return a chord for the given button indices, which must be pressed
-- at the same time in one or a few frames
--
-- Because humans are not perfect, they may press some buttons of the
-- chord a few frames after the first one. Therefore, Frames should
-- be a small number, something between 2 and 4.
function Detect_Activation
(Object : in out Chord;
Joystick : Joystick_Input'Class) return Boolean;
-- Return True if all buttons of the chord are currently pressed and
-- have been pressed in the current or last few frames, False otherwise
private
type State_Array is array (Positive range <>) of Boolean_Button_States;
type Chord (Frame_Count, Button_Count : Positive) is tagged record
Buttons : Button_Index_Array (1 .. Button_Count);
States : State_Array (1 .. Frame_Count);
Frame_Index : Positive;
end record;
end Orka.Inputs.Joysticks.Chords;
|
base/Kernel/Native/ix64/_memcpy.asm | sphinxlogic/Singularity-RDK-2.0 | 0 | 99006 | <gh_stars>0
;*******************************************************************************
;memcpy.asm - contains memcpy and memmove routines
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
;Purpose:
; memcpy() copies a source memory buffer to a destination buffer.
; Overlapping buffers are not treated specially, so propogation may occur.
; memmove() copies a source memory buffer to a destination buffer.
; Overlapping buffers are treated specially, to avoid propogation.
;
;*******************************************************************************
.code
include hal.inc
;***
;memcpy - Copy source buffer to destination buffer
;
;Purpose:
; memcpy() copies a source memory buffer to a destination memory buffer.
; This routine does NOT recognize overlapping buffers, and thus can lead
; to propogation.
; For cases where propogation must be avoided, memmove() must be used.
;
; Algorithm:
;
; void * memcpy(void * dst, void * src, size_t count)
; {
; void * ret = dst;
;
; /*
; * copy from lower addresses to higher addresses
; */
; while (count--)
; *dst++ = *src++;
;
; return(ret);
; }
;
;memmove - Copy source buffer to destination buffer
;
;Purpose:
; memmove() copies a source memory buffer to a destination memory buffer.
; This routine recognize overlapping buffers to avoid propogation.
; For cases where propogation is not a problem, memcpy() can be used.
;
; Algorithm:
;
; void * memmove(void * dst, void * src, size_t count)
; {
; void * ret = dst;
;
; if (dst <= src || dst >= (src + count)) {
; /*
; * Non-Overlapping Buffers
; * copy from lower addresses to higher addresses
; */
; while (count--)
; *dst++ = *src++;
; }
; else {
; /*
; * Overlapping Buffers
; * copy from higher addresses to lower addresses
; */
; dst += count - 1;
; src += count - 1;
;
; while (count--)
; *dst-- = *src--;
; }
;
; return(ret);
; }
;
;
;Entry:
; void *dst = pointer to destination buffer
; const void *src = pointer to source buffer
; size_t count = number of bytes to copy
;
;Exit:
; Returns a pointer to the destination buffer in AX/DX:AX
;
;Uses:
; CX, DX
;
;Exceptions:
;*******************************************************************************
% public memcpy
;; memcopy (dst,src,count)
memcpy proc ;;frame
;;PrologPush rbp ; create ebp chain entry
;;SetFramePointer rbp ; set new ebp
;;.endprolog
;;spin: jmp spin
;;mov [esp+8], rcx ; spill dest
push rdi ;U - save rdi
push rsi ;V - save rsi
mov r9,rcx ; save off dst in scratch reg
mov rsi,rdx ;U - rsi = source
mov rdi,rcx ;U - rdi = dest
mov rcx,r8 ;V - rdx = number of bytes to move
cmp r8,2h
jnz hack
;spin: jmp spin
hack:
;
; Check for overlapping buffers:
; If (dst <= src) Or (dst >= src + Count) Then
; Do normal (Upwards) Copy
; Else
; Do Downwards Copy to avoid propagation
;
mov rax,r8 ;V - rax = byte count...
mov rdx,r8 ;U - rdx = byte count...
add rax,rsi ;V - rax = point past source end
cmp rdi,rsi ;U - dst <= src ?
jbe CopyUp ;V - yes, copy toward higher addresses
cmp rdi,rax ;U - dst < (src + count) ?
jb CopyDown ;V - yes, copy toward lower addresses
;
; Copy toward higher addresses.
;
;
; The algorithm for forward moves is to align the destination to a dword
; boundary and so we can move dwords with an aligned destination. This
; occurs in 3 steps.
;
; - move x = ((4 - Dest & 3) & 3) bytes
; - move y = ((L-x) >> 2) dwords
; - move (L - x - y*4) bytes
;
CopyUp:
test rdi,11b ;U - destination dword aligned?
jnz short CopyLeadUp ;V - if we are not dword aligned already, align
shr rcx,2 ;U - shift down to dword count
and rdx,11b ;V - trailing byte count
cmp rcx,8 ;U - test if small enough for unwind copy
jb short CopyUnwindUp ;V - if so, then jump
rep movsd ;N - move all of our dwords
lea r10, TrailUpVec
jmp [rdx*8 + r10] ;N - process trailing bytes
;
; Code to do optimal memory copies for non-dword-aligned destinations.
;
; The following length check is done for two reasons:
;
; 1. to ensure that the actual move length is greater than any possiale
; alignment move, and
;
; 2. to skip the multiple move logic for small moves where it would
; be faster to move the bytes with one instruction.
;
align 8
CopyLeadUp:
mov rax,rdi ;U - get destination offset
mov rdx,11b ;V - prepare for mask
sub rcx,4 ;U - check for really short string - sub for adjust
jb ByteCopyUp ;V - branch to just copy bytes
and rax,11b ;U - get offset within first dword
add rcx,rax ;V - update size after leading bytes copied
lea r10,LeadUpVec
jmp [rax*8-8 + r10] ;N - process leading bytes
align 8
ByteCopyUp:
lea r10, TrailUpVec
jmp [rcx*8+32 + r10] ;N - process just bytes
align 8
CopyUnwindUp:
lea r10,UnwindUpVec
jmp [rcx*8 + r10] ;N - unwind dword copy
align 8
LeadUpVec dq LeadUp1, LeadUp2, LeadUp3
align 8
LeadUp1:
and rdx,rcx ;U - trailing byte count
mov al,[rsi] ;V - get first byte from source
mov [rdi],al ;U - write second byte to destination
mov al,[rsi+1] ;V - get second byte from source
mov [rdi+1],al ;U - write second byte to destination
mov al,[rsi+2] ;V - get third byte from source
shr rcx,2 ;U - shift down to dword count
mov [rdi+2],al ;V - write third byte to destination
add rsi,3 ;U - advance source pointer
add rdi,3 ;V - advance destination pointer
cmp rcx,8 ;U - test if small enough for unwind copy
jb short CopyUnwindUp ;V - if so, then jump
rep movsd ;N - move all of our dwords
;;jmp TrailUpVec[rdx*4] ;N - process trailing bytes
lea r10, TrailUpVec
jmp [rdx*8 + r10] ;N - process trailing bytes
align 8
LeadUp2:
and rdx,rcx ;U - trailing byte count
mov al,[rsi] ;V - get first byte from source
mov [rdi],al ;U - write second byte to destination
mov al,[rsi+1] ;V - get second byte from source
shr rcx,2 ;U - shift down to dword count
mov [rdi+1],al ;V - write second byte to destination
add rsi,2 ;U - advance source pointer
add rdi,2 ;V - advance destination pointer
cmp rcx,8 ;U - test if small enough for unwind copy
jb CopyUnwindUp ;V - if so, then jump
rep movsd ;N - move all of our dwords
;jmp qword ptr TrailUpVec[rdx*4] ;N - process trailing bytes
lea r10, TrailUpVec
jmp [rdx*8 + r10] ;N - process trailing bytes
align 8
LeadUp3:
and rdx,rcx ;U - trailing byte count
mov al,[rsi] ;V - get first byte from source
mov [rdi],al ;U - write second byte to destination
add rsi,1 ;V - advance source pointer
shr rcx,2 ;U - shift down to dword count
add rdi,1 ;V - advance destination pointer
cmp rcx,8 ;U - test if small enough for unwind copy
jb CopyUnwindUp ;V - if so, then jump
rep movsd ;N - move all of our dwords
;jmp qword ptr TrailUpVec[rdx*4] ;N - process trailing bytes
lea r10, TrailUpVec
jmp [rdx*8 + r10] ;N - process trailing bytes
align 8
UnwindUpVec dq UnwindUp0, UnwindUp1, UnwindUp2, UnwindUp3
dq UnwindUp4, UnwindUp5, UnwindUp6, UnwindUp7
UnwindUp7:
mov eax,[rsi+rcx*4-28] ;U - get dword from source
;V - spare
mov [rdi+rcx*4-28],eax ;U - put dword into destination
UnwindUp6:
mov eax,[rsi+rcx*4-24] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4-24],eax ;U - put dword into destination
UnwindUp5:
mov eax,[rsi+rcx*4-20] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4-20],eax ;U - put dword into destination
UnwindUp4:
mov eax,[rsi+rcx*4-16] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4-16],eax ;U - put dword into destination
UnwindUp3:
mov eax,[rsi+rcx*4-12] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4-12],eax ;U - put dword into destination
UnwindUp2:
mov eax,[rsi+rcx*4-8] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4-8],eax ;U - put dword into destination
UnwindUp1:
mov eax,[rsi+rcx*4-4] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4-4],eax ;U - put dword into destination
lea rax,[rcx*4] ;V - compute update for pointer
add rsi,rax ;U - update source pointer
add rdi,rax ;V - update destination pointer
UnwindUp0:
;jmp qword ptr TrailUpVec[rdx*4] ;N - process trailing bytes
lea r10, TrailUpVec
jmp [rdx*8 + r10] ;N - process trailing bytes
;-----------------------------------------------------------------------------
align 8
TrailUpVec dq TrailUp0, TrailUp1, TrailUp2, TrailUp3
align 8
TrailUp0:
mov rax, r9 ;U - return pointer to destination
pop rsi ;V - restore rsi
pop rdi ;U - restore rdi
;V - spare
ret
align 8
TrailUp1:
mov al,[rsi] ;U - get byte from source
;V - spare
mov [rdi],al ;U - put byte in destination
mov rax,r9 ;V - return pointer to destination
pop rsi ;U - restore rsi
pop rdi ;V - restore rdi
ret
align 8
TrailUp2:
mov al,[rsi] ;U - get first byte from source
;V - spare
mov [rdi],al ;U - put first byte into destination
mov al,[rsi+1] ;V - get second byte from source
mov [rdi+1],al ;U - put second byte into destination
mov rax,r9 ;V - return pointer to destination
pop rsi ;U - restore rsi
pop rdi ;V - restore rdi
ret
align 8
TrailUp3:
mov al,[rsi] ;U - get first byte from source
;V - spare
mov [rdi],al ;U - put first byte into destination
mov al,[rsi+1] ;V - get second byte from source
mov [rdi+1],al ;U - put second byte into destination
mov al,[rsi+2] ;V - get third byte from source
mov [rdi+2],al ;U - put third byte into destination
mov rax,r9 ;V - return pointer to destination
pop rsi ;U - restore rsi
pop rdi ;V - restore rdi
ret
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
;
; Copy down to avoid propogation in overlapping buffers.
;
align 8
CopyDown:
lea rsi,[rsi+rcx-4] ;U - point to 4 bytes before src buffer end
lea rdi,[rdi+rcx-4] ;V - point to 4 bytes before dest buffer end
;
; See if the destination start is dword aligned
;
test rdi,11b ;U - test if dword aligned
jnz short CopyLeadDown ;V - if not, jump
shr rcx,2 ;U - shift down to dword count
and rdx,11b ;V - trailing byte count
cmp rcx,8 ;U - test if small enough for unwind copy
jb short CopyUnwindDown ;V - if so, then jump
std ;N - set direction flag
rep movsd ;N - move all of our dwords
cld ;N - clear direction flag back
;jmp qword ptr TrailDownVec[rdx*4] ;N - process trailing bytes
lea r10, TrailDownVec
jmp [rdx*8 + r10] ;N - process trailing bytes
align 8
CopyUnwindDown:
neg rcx ;U - negate dword count for table merging
;V - spare
;jmp qword ptr UnwindDownVec[rcx*4+28] ;N - unwind copy
lea r10,UnwindDownVec
jmp [rcx*8+56 + r10] ;N - unwind copy
align 8
CopyLeadDown:
mov rax,rdi ;U - get destination offset
mov rdx,11b ;V - prepare for mask
cmp rcx,4 ;U - check for really short string
jb short ByteCopyDown ;V - branch to just copy bytes
and rax,11b ;U - get offset within first dword
sub rcx,rax ;U - to update size after lead copied
;jmp qword ptr LeadDownVec[rax*8-8] ;N - process leading bytes
lea r10,LeadDownVec
jmp [rax*8-8 + r10] ;N - process leading bytes
align 8
ByteCopyDown:
;jmp qword ptr TrailDownVec[rcx*8] ;N - process just bytes
lea r10, TrailDownVec
jmp [rcx*8 + r10] ;N - process just bytes
align 8
LeadDownVec dq LeadDown1, LeadDown2, LeadDown3
align 8
LeadDown1:
mov al,[rsi+3] ;U - load first byte
and rdx,rcx ;V - trailing byte count
mov [rdi+3],al ;U - write out first byte
sub rsi,1 ;V - point to last src dword
shr rcx,2 ;U - shift down to dword count
sub rdi,1 ;V - point to last dest dword
cmp rcx,8 ;U - test if small enough for unwind copy
jb CopyUnwindDown ;V - if so, then jump
std ;N - set direction flag
rep movsd ;N - move all of our dwords
cld ;N - clear direction flag
;jmp qword ptr TrailDownVec[rdx*4] ;N - process trailing bytes
lea r10, TrailDownVec
jmp [rdx*8 + r10] ;N - process trailing bytes
align 8
LeadDown2:
mov al,[rsi+3] ;U - load first byte
and rdx,rcx ;V - trailing byte count
mov [rdi+3],al ;U - write out first byte
mov al,[rsi+2] ;V - get second byte from source
shr rcx,2 ;U - shift down to dword count
mov [rdi+2],al ;V - write second byte to destination
sub rsi,2 ;U - point to last src dword
sub rdi,2 ;V - point to last dest dword
cmp rcx,8 ;U - test if small enough for unwind copy
jb CopyUnwindDown ;V - if so, then jump
std ;N - set direction flag
rep movsd ;N - move all of our dwords
cld ;N - clear direction flag
;jmp qword ptr TrailDownVec[rdx*4] ;N - process trailing bytes
lea r10, TrailDownVec
jmp [rdx*8 + r10] ;N - process trailing bytes
align 8
LeadDown3:
mov al,[rsi+3] ;U - load first byte
and rdx,rcx ;V - trailing byte count
mov [rdi+3],al ;U - write out first byte
mov al,[rsi+2] ;V - get second byte from source
mov [rdi+2],al ;U - write second byte to destination
mov al,[rsi+1] ;V - get third byte from source
shr rcx,2 ;U - shift down to dword count
mov [rdi+1],al ;V - write third byte to destination
sub rsi,3 ;U - point to last src dword
sub rdi,3 ;V - point to last dest dword
cmp rcx,8 ;U - test if small enough for unwind copy
jb CopyUnwindDown ;V - if so, then jump
std ;N - set direction flag
rep movsd ;N - move all of our dwords
cld ;N - clear direction flag
;jmp qword ptr TrailDownVec[rdx*4] ;N - process trailing bytes
lea r10, TrailDownVec
jmp [rdx*8 + r10] ;N - process trailing bytes
;------------------------------------------------------------------
align 8
UnwindDownVec dq UnwindDown7, UnwindDown6, UnwindDown5, UnwindDown4
dq UnwindDown3, UnwindDown2, UnwindDown1, UnwindDown0
UnwindDown7:
mov rax,[rsi+rcx*4+28] ;U - get dword from source
;V - spare
mov [rdi+rcx*4+28],rax ;U - put dword into destination
UnwindDown6:
mov rax,[rsi+rcx*4+24] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4+24],rax ;U - put dword into destination
UnwindDown5:
mov rax,[rsi+rcx*4+20] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4+20],rax ;U - put dword into destination
UnwindDown4:
mov rax,[rsi+rcx*4+16] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4+16],rax ;U - put dword into destination
UnwindDown3:
mov rax,[rsi+rcx*4+12] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4+12],rax ;U - put dword into destination
UnwindDown2:
mov rax,[rsi+rcx*4+8] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4+8],rax ;U - put dword into destination
UnwindDown1:
mov rax,[rsi+rcx*4+4] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [rdi+rcx*4+4],rax ;U - put dword into destination
lea rax,[rcx*4] ;V - compute update for pointer
add rsi,rax ;U - update source pointer
add rdi,rax ;V - update destination pointer
UnwindDown0:
;jmp qword ptr TrailDownVec[rdx*4] ;N - process trailing bytes
lea r10, TrailDownVec
jmp [rdx*8 + r10] ;N - process trailing bytes
;-----------------------------------------------------------------------------
align 8
TrailDownVec dq TrailDown0, TrailDown1, TrailDown2, TrailDown3
align 8
TrailDown0:
mov rax,r9 ;U - return pointer to destination
;V - spare
pop rsi ;U - restore rsi
pop rdi ;V - restore rdi
ret
align 8
TrailDown1:
mov al,[rsi+3] ;U - get byte from source
;V - spare
mov [rdi+3],al ;U - put byte in destination
mov rax,r9 ;V - return pointer to destination
pop rsi ;U - restore rsi
pop rdi ;V - restore rdi
ret
align 8
TrailDown2:
mov al,[rsi+3] ;U - get first byte from source
;V - spare
mov [rdi+3],al ;U - put first byte into destination
mov al,[rsi+2] ;V - get second byte from source
mov [rdi+2],al ;U - put second byte into destination
mov rax,r9 ;V - return pointer to destination
pop rsi ;U - restore rsi
pop rdi ;V - restore rdi
ret
align 8
TrailDown3:
mov al,[rsi+3] ;U - get first byte from source
;V - spare
mov [rdi+3],al ;U - put first byte into destination
mov al,[rsi+2] ;V - get second byte from source
mov [rdi+2],al ;U - put second byte into destination
mov al,[rsi+1] ;V - get third byte from source
mov [rdi+1],al ;U - put third byte into destination
mov rax,r9 ;V - return pointer to destination
pop rsi ;U - restore rsi
pop rdi ;V - restore rdi
ret
memcpy endp
memmove proc \
dst:ptr byte, \
src:ptr byte, \
count:DWORD
jmp memcpy
memmove endp
end
|
Application Support/BBEdit/Scripts/Maketags.applescript | bhdicaire/bbeditSetup | 0 | 3935 | <filename>Application Support/BBEdit/Scripts/Maketags.applescript
-- Maketags
--
-- Builds ctags file for currently active project
--
-- Installation:
--
-- Copy script to either location:
-- ~/Library/Application Support/BBEdit/Scripts
-- ~/Dropbox/Application Support/BBEdit/Scripts
--
-- To add a shortcut key:
--
-- Window -> Palettes -> Scripts
-- Select Maketags and click Set Key ...
-- Enter a shortcut key combination (recommend Command + Option + T)
--
-- Author: <NAME> <<EMAIL>>
-- Version: 0.1
--
-- Copyright (c) 2011 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
--
on makeTags()
set theFile to missing value
tell application "BBEdit"
set activeWindow to front window
if (class of activeWindow is project window) then
set projectDocument to project document of activeWindow
if ((count of items of projectDocument) > 0) then
set firstFileItem to item 1 of projectDocument as alias
else
set firstFileItem to file of document of activeWindow as alias
end if
if (on disk of projectDocument) then
set theProjectFile to file of projectDocument as alias
tell application "Finder"
set theProjectDir to container of theProjectFile
set firstFileDir to container of firstFileItem
end tell
if (firstFileDir is equal to theProjectDir) then
-- Use project file
set theFile to theProjectDir as alias
else
-- External project file -> use first item to set context
set theFile to firstFileItem
end if
else
-- BBEdit doesn't provide direct access to the Instaproject root
-- Use the first node from the project list
set theFile to firstFileItem
end if
end if
end tell
if theFile is equal to missing value then
-- No base file found for reference
-- Signal error by beep and end
beep
else
-- Run the maketags script
set thePath to POSIX path of theFile
set cmd to "cd " & thePath & "; /usr/local/bin/bbedit --maketags"
do shell script cmd
end if
end makeTags
makeTags() |
04/mult/Mult.asm | hsinewu/nand2tetris | 0 | 1508 | <reponame>hsinewu/nand2tetris
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by <NAME> Schocken, MIT Press.
// File name: projects/04/Mult.asm
// Multiplies R0 and R1 and stores the result in R2.
// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)
// Put your code here.
// if R0=0
// goto EXIT
// R0--
// R2+=R1
// goto LOOP
@R2
M=0
(LOOP)
@R0
D=M
@EXIT
D; JEQ
@R0
M=M-1
@R1
D=M
@R2
M=M+D
@LOOP
0; JEQ
(EXIT)
@EXIT
0; JEQ |
asm/6502/tools/xex_loader.asm | fcatrin/clc88 | 6 | 6966 | icl '../os/symbols.asm'
block_start = $C8 ; ROS0
block_end = $CA ; ROS2
org BOOTADDR
.proc xex_load
jsr serial_init
next_block:
jsr xex_get_byte
sta block_start
jsr xex_get_byte
sta block_start+1
and block_start
cmp #$ff
beq next_block
jsr xex_get_byte
sta block_end
jsr xex_get_byte
sta block_end+1
next_byte:
jsr xex_get_byte
ldy #0
sta (block_start), y
cpw block_start block_end
beq block_complete
inw block_start
jmp next_byte
block_complete:
cpw #EXECADDR+1 block_end
bne next_block
jsr xex_exec
jmp next_block
.endp
.proc xex_get_byte
jsr serial_get
bpl no_eof
pla
pla
no_eof:
rts
.endp
.proc xex_exec
jmp (EXECADDR)
.endp
icl '../os/serial.asm'
|
original/19 - Tutorial Nineteen.asm | rodoherty1/6502-Examples | 0 | 6906 | ;*******************************************************************************
;* Tutorial Nineteen Output to a device using Kernel Jump Vectors *
;* *
;* Written By <NAME> *
;* Tutorial #19 *
;* Date : 22nd Aug, 2017 *
;* *
;*******************************************************************************
;* *
;*******************************************************************************
;*******************************************************************************
;* Kernel Vector Constants *
;*******************************************************************************
CHROUT = $FFD2
CHKOUT = $FFC9
OPEN = $FFC0
SETLFS = $FFBA
SETNAM = $FFBD
CLRCHN = $FFCC
CLOSE = $FFC3
PRINTSTRING = $AB1E
*=$9000
;jmp PRINTTODEFAULT
;jmp PRINTTOPRINTER
;jmp PRINTTOTAPE
;jmp PRINTTODISK
TESTFILENAME
TEXT "johntest"
BRK
TESTFILENAMEDISK
TEXT "johntest,seq,write"
BRK
TESTTEXT
TEXT "this is to test the output jump vectors"
BRK
PRINTTODEFAULT
ldx #$00
lda #<TESTTEXT
ldy #>TESTTEXT
jsr PRINTSTRING
rts
PRINTTOPRINTER
lda #4 ; Logical File Number
tax ; Device Number (Printer Device #4)
ldy #255 ; Secondary Address
jsr SETLFS
lda #0
ldx #255
ldy #255
jsr SETNAM
jsr OPEN
ldx #4 ; Logical File Number
jsr CHKOUT
jsr PRINTTODEFAULT
;ldx #$00
;lda #<TESTTEXT
;ldy #>TESTTEXT
;jsr PRINTSTRING
jsr CLRCHN
lda #4 ; Logical File Number
jsr CLOSE
rts
PRINTTOTAPE
lda #1 ; Logical File Number
tax ; Device Number (Tape Device #1)
ldy #255 ; Secondary Address
jsr SETLFS
lda #8
ldx #<TESTFILENAME
ldy #>TESTFILENAME
jsr SETNAM
jsr OPEN
ldx #1 ; Logical File Number
jsr CHKOUT
jsr PRINTTODEFAULT
;ldx #$00
;lda #<TESTTEXT
;ldy #>TESTTEXT
;jsr PRINTSTRING
jsr CLRCHN
lda #1 ; Logical File Number
jsr CLOSE
RTS
PRINTTODISK
lda #8 ; Logical File Number
tax ; Device Number (Disk Drive 8)
ldy #2 ; Secondary Address
jsr SETLFS
lda #18
ldx #<TESTFILENAMEDISK
ldy #>TESTFILENAMEDISK
jsr SETNAM
jsr OPEN
ldx #8 ; Logical File Number
jsr CHKOUT
jsr PRINTTODEFAULT
;ldx #$00
;lda #<TESTTEXT
;ldy #>TESTTEXT
;jsr PRINTSTRING
jsr CLRCHN
lda #8 ; Logical File Number
jsr CLOSE
RTS
|
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_1601.asm | ljhsiun2/medusa | 9 | 3838 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x19f5e, %rsi
lea addresses_D_ht+0x5a9e, %rdi
nop
nop
nop
nop
and $15094, %rbp
mov $113, %rcx
rep movsb
nop
nop
nop
add $14691, %rdx
lea addresses_UC_ht+0x1287e, %rdx
nop
and %r9, %r9
movl $0x61626364, (%rdx)
nop
nop
nop
nop
nop
add $62000, %rbp
lea addresses_UC_ht+0x131e, %rsi
nop
nop
nop
nop
nop
cmp $20413, %r11
vmovups (%rsi), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %rdx
nop
nop
inc %r11
lea addresses_normal_ht+0x1de3e, %rdi
nop
nop
and $64867, %rbp
movb $0x61, (%rdi)
nop
nop
and $62294, %r11
lea addresses_D_ht+0x1786a, %rdx
nop
dec %r9
mov (%rdx), %ecx
nop
add %r9, %r9
lea addresses_normal_ht+0xfc62, %rdi
nop
nop
nop
nop
xor $37378, %rdx
movb (%rdi), %cl
nop
nop
nop
nop
nop
and $29649, %rbp
lea addresses_D_ht+0x409e, %rdx
nop
nop
nop
add %rbp, %rbp
mov $0x6162636465666768, %rsi
movq %rsi, (%rdx)
add $36094, %rsi
lea addresses_WC_ht+0x409e, %rsi
lea addresses_D_ht+0x1809e, %rdi
clflush (%rsi)
inc %rbx
mov $108, %rcx
rep movsl
nop
nop
nop
and %rcx, %rcx
lea addresses_D_ht+0xd09e, %rsi
nop
nop
nop
cmp %rbx, %rbx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm4
movups %xmm4, (%rsi)
nop
nop
xor $2100, %rcx
lea addresses_A_ht+0x1cd5e, %r11
clflush (%r11)
cmp %rbp, %rbp
mov (%r11), %r9w
nop
nop
cmp %rsi, %rsi
lea addresses_UC_ht+0x23ee, %rcx
inc %r11
movb $0x61, (%rcx)
nop
nop
and %rbx, %rbx
lea addresses_WC_ht+0x1513c, %rsi
lea addresses_WC_ht+0x12bae, %rdi
nop
nop
nop
nop
nop
sub $21984, %rbp
mov $87, %rcx
rep movsl
nop
nop
cmp $14517, %rdx
lea addresses_UC_ht+0x1b76a, %r9
nop
nop
nop
nop
nop
xor %rdi, %rdi
vmovups (%r9), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $1, %xmm3, %rdx
nop
inc %rdi
lea addresses_UC_ht+0x1649e, %rsi
nop
nop
nop
sub %r11, %r11
vmovups (%rsi), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %rdi
nop
nop
nop
nop
sub %rbp, %rbp
lea addresses_UC_ht+0xc213, %rdx
nop
nop
nop
xor %r11, %r11
mov $0x6162636465666768, %rbx
movq %rbx, %xmm3
vmovups %ymm3, (%rdx)
nop
nop
nop
xor $51376, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r8
push %rbp
push %rcx
push %rdi
// Store
lea addresses_WT+0xfe11, %r12
nop
nop
nop
cmp %rbp, %rbp
mov $0x5152535455565758, %rdi
movq %rdi, %xmm1
vmovups %ymm1, (%r12)
nop
nop
nop
inc %r13
// Faulty Load
lea addresses_A+0x1f89e, %r10
nop
sub %r8, %r8
movb (%r10), %cl
lea oracles, %r8
and $0xff, %rcx
shlq $12, %rcx
mov (%r8,%rcx,1), %rcx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 2, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 1, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'same': True, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
RMonads/RKleisli/Adjunction.agda | jmchapman/Relative-Monads | 21 | 13015 | <filename>RMonads/RKleisli/Adjunction.agda
open import Categories
open import Functors
open import RMonads
module RMonads.RKleisli.Adjunction {a b c d}{C : Cat {a}{b}}{D : Cat {c}{d}}
{J : Fun C D}(M : RMonad J) where
open import Library
open import RMonads.RKleisli M
open import RAdjunctions
open import RMonads.RKleisli.Functors M
open Cat
open Fun
open RMonad M
KlAdj : RAdj J Kl
KlAdj = record{
L = RKlL;
R = RKlR;
left = id;
right = id;
lawa = λ _ → refl;
lawb = λ _ → refl;
natleft = lem;
natright = lem}
where
lem = λ {X}{X'}{Y}{Y'} (f : Hom C X' X) (g : Hom D (OMap J Y) (T Y')) h →
proof
comp D (bind g) (comp D h (HMap J f))
≅⟨ cong (λ h₁ → comp D (bind g) (comp D h₁ (HMap J f))) (sym law2) ⟩
comp D (bind g) (comp D (comp D (bind h) η) (HMap J f))
≅⟨ cong (comp D (bind g)) (ass D) ⟩
comp D (bind g) (comp D (bind h) (comp D η (HMap J f)))
∎
|
Transynther/x86/_processed/NC/_st_zr_4k_sm_/i3-7100_9_0x84_notsx.log_13556_2841.asm | ljhsiun2/medusa | 9 | 246163 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x326e, %r8
clflush (%r8)
nop
nop
nop
nop
nop
add %rdx, %rdx
mov $0x6162636465666768, %rdi
movq %rdi, (%r8)
nop
nop
nop
nop
nop
sub $8835, %r8
lea addresses_UC_ht+0x1326e, %rbp
nop
nop
nop
nop
inc %r10
movb $0x61, (%rbp)
nop
dec %rbx
lea addresses_D_ht+0x14a6e, %r8
nop
nop
nop
nop
cmp $26905, %r9
mov (%r8), %r10d
nop
nop
and %rdx, %rdx
lea addresses_normal_ht+0x18dce, %rbx
nop
nop
nop
nop
nop
xor $13640, %r8
mov $0x6162636465666768, %rdi
movq %rdi, (%rbx)
nop
nop
nop
nop
nop
cmp %r10, %r10
lea addresses_D_ht+0xd66e, %r10
nop
nop
cmp $8750, %rbx
mov (%r10), %r9w
nop
nop
nop
cmp %r10, %r10
lea addresses_A_ht+0x296e, %r8
clflush (%r8)
nop
nop
nop
nop
nop
xor %rdx, %rdx
movb (%r8), %bl
nop
nop
nop
sub $60228, %r10
lea addresses_WC_ht+0x15e6e, %r9
nop
xor $40504, %rdx
movw $0x6162, (%r9)
nop
nop
nop
nop
xor $3870, %r8
lea addresses_WT_ht+0x1d1ee, %r8
nop
nop
nop
nop
nop
cmp %rdi, %rdi
movw $0x6162, (%r8)
nop
dec %r8
lea addresses_WC_ht+0xc7ac, %r10
clflush (%r10)
nop
nop
nop
nop
cmp $39346, %rdi
mov $0x6162636465666768, %r9
movq %r9, (%r10)
nop
nop
nop
dec %rdx
lea addresses_A_ht+0x1a86e, %rdi
nop
nop
nop
and $65439, %r8
vmovups (%rdi), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %r10
nop
add %rbp, %rbp
lea addresses_WT_ht+0x1ccee, %rbx
nop
nop
xor %r9, %r9
mov (%rbx), %r8d
nop
and %r10, %r10
lea addresses_WC_ht+0x1026e, %r10
nop
nop
nop
xor $46171, %rdx
movups (%r10), %xmm1
vpextrq $0, %xmm1, %r8
nop
nop
nop
nop
and %r10, %r10
lea addresses_normal_ht+0x7102, %r8
nop
nop
nop
nop
nop
xor %r9, %r9
movups (%r8), %xmm7
vpextrq $1, %xmm7, %rdi
nop
and %r9, %r9
lea addresses_A_ht+0x14a6e, %rsi
lea addresses_A_ht+0x1790e, %rdi
nop
nop
dec %rdx
mov $126, %rcx
rep movsb
nop
nop
nop
nop
xor %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %r14
push %rcx
push %rdi
// Store
lea addresses_WT+0xa46e, %rcx
add %r14, %r14
mov $0x5152535455565758, %rdi
movq %rdi, %xmm0
vmovups %ymm0, (%rcx)
add $46506, %r14
// Store
lea addresses_normal+0x15d6e, %r13
clflush (%r13)
nop
nop
nop
nop
nop
sub $51571, %r12
mov $0x5152535455565758, %rdi
movq %rdi, %xmm2
vmovups %ymm2, (%r13)
nop
nop
nop
xor $48898, %r13
// Store
lea addresses_UC+0x14a6e, %r10
cmp %r12, %r12
mov $0x5152535455565758, %r11
movq %r11, %xmm4
vmovups %ymm4, (%r10)
nop
nop
add %rcx, %rcx
// Store
mov $0x5ee, %r12
nop
nop
nop
nop
and %rcx, %rcx
movb $0x51, (%r12)
nop
nop
nop
nop
nop
cmp $40473, %r13
// Store
mov $0x5ba0340000000a6e, %rcx
clflush (%rcx)
nop
nop
add %r11, %r11
movw $0x5152, (%rcx)
nop
and %r11, %r11
// Faulty Load
mov $0x5ba0340000000a6e, %r11
sub $55000, %rcx
mov (%r11), %r13d
lea oracles, %r14
and $0xff, %r13
shlq $12, %r13
mov (%r14,%r13,1), %r13
pop %rdi
pop %rcx
pop %r14
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'same': False, 'size': 2, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_P', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_NC', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'00': 3134, '58': 4, '52': 10418}
00 52 52 52 00 00 00 00 00 52 52 52 52 52 52 52 52 52 52 00 52 52 52 00 00 52 00 52 00 52 52 52 52 00 52 00 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 00 00 00 52 00 52 52 52 00 52 00 52 52 52 52 52 00 00 00 52 00 52 52 52 52 00 00 00 52 52 52 52 52 52 52 52 00 52 00 52 52 52 52 00 52 52 00 52 52 52 52 52 00 52 52 52 52 52 00 52 00 00 52 00 52 00 00 00 00 00 52 52 52 52 52 00 52 00 00 52 00 52 00 00 52 00 52 52 00 00 52 00 00 00 52 00 52 52 52 00 52 00 00 52 52 52 00 00 52 00 00 52 00 52 00 00 52 52 52 52 00 00 52 00 52 00 52 52 52 52 00 52 00 00 52 52 52 52 52 00 52 52 00 52 00 52 52 00 52 52 52 00 00 52 52 52 00 00 00 52 52 00 52 00 00 52 52 52 00 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 00 52 52 52 00 52 52 52 52 00 52 52 52 52 00 52 00 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 00 52 00 52 52 52 52 00 52 52 00 52 00 52 00 00 52 52 00 52 52 00 52 00 00 00 00 52 00 00 00 52 52 52 52 52 52 52 00 00 52 52 52 52 00 00 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 00 52 00 52 00 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 00 00 00 52 52 52 52 00 00 52 52 00 00 00 00 52 52 52 00 00 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 00 00 52 52 52 52 52 52 52 52 00 52 52 52 52 00 00 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 00 00 52 52 52 52 52 52 52 52 52 00 00 00 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 00 52 52 52 00 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 00 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 52 00 52 52 52 52 52 52 52 00 52 00 00 52 52 52 52 52 52 52 52 52 00 00 00 52 52 52 52 52 00 52 52 52 00 52 00 00 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 00 52 52 00 00 52 52 52 52 52 00 00 52 52 00 52 52 52 00 52 00 00 00 52 52 52 52 52 00 00 00 00 52 52 00 52 00 00 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 00 00 00 52 52 00 52 52 00 00 52 00 52 52 52 52 00 52 52 52 52 52 52 52 52 00 00 52 00 52 00 52 52 52 52 52 00 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 00 00 00 00 52 00 52 52 52 52 52 52 00 52 52 52 00 00 52 52 52 52 52 52 52 00 00 00 52 00 52 00 52 52 52 52 52 52 00 00 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 00 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 00 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 00 00 00 52 52 00 52 52 52 52 52 00 52 00 52 52 52 52 52 52 00 00 00 00 00 52 52 52 52 52 52 52 52 52 52 00 52 00 52 52 52 52 00 52 52 00 52 52 00 52 52 52 52 52 00 52 00 52 00 52 00 52 52 52 52 52 52 52 00 00 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00
*/
|
Transynther/x86/_processed/US/_ht_zr_un_/i9-9900K_12_0xa0.log_21829_1735.asm | ljhsiun2/medusa | 9 | 93196 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x3df9, %rsi
lea addresses_WT_ht+0x3376, %rdi
nop
nop
add $21363, %r15
mov $3, %rcx
rep movsw
nop
nop
and $40428, %r9
lea addresses_A_ht+0xdde9, %rsi
lea addresses_D_ht+0x1b07, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
inc %r14
mov $60, %rcx
rep movsl
nop
nop
nop
nop
sub %r9, %r9
lea addresses_normal_ht+0xfd0a, %r9
nop
nop
xor %rbp, %rbp
mov (%r9), %r14
add $45461, %r15
lea addresses_normal_ht+0xfeb9, %rsi
lea addresses_D_ht+0x7afb, %rdi
nop
nop
nop
nop
nop
dec %r14
mov $74, %rcx
rep movsl
nop
nop
add $23856, %r14
lea addresses_A_ht+0x136b9, %rbp
nop
nop
nop
inc %rsi
mov $0x6162636465666768, %r9
movq %r9, %xmm7
movups %xmm7, (%rbp)
nop
nop
nop
nop
nop
xor $7298, %rdi
lea addresses_D_ht+0x171b9, %r9
add %r14, %r14
mov $0x6162636465666768, %rbp
movq %rbp, %xmm5
vmovups %ymm5, (%r9)
nop
nop
nop
cmp %rcx, %rcx
lea addresses_D_ht+0xf6b9, %r9
nop
nop
nop
nop
and %r14, %r14
movb (%r9), %cl
nop
nop
xor $53748, %rdi
lea addresses_A_ht+0xf459, %rdi
nop
nop
nop
nop
nop
cmp $36217, %rcx
movw $0x6162, (%rdi)
nop
sub %rcx, %rcx
lea addresses_normal_ht+0x1eb79, %rsi
lea addresses_UC_ht+0x6f39, %rdi
nop
nop
nop
cmp $36637, %r9
mov $91, %rcx
rep movsl
nop
nop
nop
and $50486, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %rdi
push %rdx
// Faulty Load
lea addresses_US+0x136b9, %r10
nop
nop
nop
nop
nop
cmp $22011, %r15
vmovups (%r10), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $0, %xmm2, %rdi
lea oracles, %r15
and $0xff, %rdi
shlq $12, %rdi
mov (%r15,%rdi,1), %rdi
pop %rdx
pop %rdi
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_US', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 0, 'type': 'addresses_WT_ht'}}
{'src': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}}
{'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}}
{'src': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}}
{'src': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}}
{'44': 12811, '00': 57, 'b9': 1, '01': 2, '45': 8955, '1c': 1, 'c6': 2}
44 44 44 44 44 44 44 45 45 44 45 45 44 44 44 45 45 44 45 44 44 45 44 45 45 45 44 45 44 45 44 44 44 45 44 44 44 45 44 45 45 45 44 44 45 44 45 44 44 45 45 44 45 44 45 45 44 45 45 44 45 45 44 44 45 45 45 44 45 45 44 44 44 44 45 45 45 44 44 44 45 44 44 44 44 44 44 45 44 44 44 44 44 44 45 45 45 44 45 44 44 44 44 45 45 44 44 44 45 45 45 45 44 44 44 45 44 44 45 45 45 45 44 44 45 45 44 44 44 44 44 45 44 44 45 44 45 44 44 44 44 44 44 44 44 45 44 44 44 44 44 45 44 44 45 44 45 44 44 44 45 44 44 44 45 45 45 44 45 44 44 45 45 44 44 45 44 45 44 45 44 45 44 45 44 44 45 44 44 44 45 44 45 45 44 44 44 45 44 45 44 45 45 45 45 45 45 44 44 44 45 44 44 44 44 44 45 45 44 44 45 44 44 44 44 45 45 44 44 45 44 44 45 45 45 44 45 45 44 44 44 44 44 45 44 44 44 44 45 45 44 44 44 45 44 44 45 44 44 00 44 44 44 44 44 44 45 44 44 44 45 44 44 45 44 45 45 45 45 44 44 45 44 44 45 44 44 45 45 45 44 45 44 44 44 44 44 44 44 44 45 45 44 44 44 45 45 45 45 45 44 44 45 44 44 44 44 45 45 44 44 44 45 44 45 45 45 45 44 45 45 45 44 45 45 44 44 45 44 44 45 44 45 45 44 44 44 45 45 44 45 44 44 44 44 44 44 44 44 45 44 44 44 45 45 44 44 44 44 44 45 44 45 44 44 44 44 44 44 45 44 44 45 44 44 44 44 45 44 44 44 45 44 44 44 44 44 44 45 45 44 44 44 44 44 45 44 45 45 45 45 44 45 45 44 44 45 44 44 45 45 44 44 45 45 44 44 44 45 44 44 44 44 45 45 44 44 45 44 45 44 44 44 44 44 44 44 44 45 44 45 44 44 44 45 44 44 45 45 45 44 44 44 45 44 44 44 45 45 44 44 45 44 44 45 45 44 45 45 44 44 44 00 45 45 45 45 44 45 44 45 45 44 44 44 45 00 44 44 44 45 45 45 44 44 44 44 44 45 44 44 44 44 44 45 44 44 45 44 45 44 44 45 44 44 44 44 45 44 44 45 45 44 44 45 44 44 44 44 45 45 45 45 44 44 44 44 44 44 44 44 44 45 44 45 44 44 45 45 44 45 44 44 45 45 45 44 44 44 44 44 44 45 45 44 45 45 44 45 45 45 45 44 45 45 44 44 45 45 45 45 44 44 44 45 45 44 44 44 44 44 45 44 45 44 45 45 45 45 44 44 45 44 44 44 45 44 44 44 45 45 45 44 45 45 44 44 44 44 45 44 44 44 44 45 44 44 44 45 45 44 44 45 45 45 44 44 44 44 44 45 44 44 44 45 44 44 44 45 44 44 45 45 45 44 44 45 45 45 45 44 44 44 44 44 44 45 44 44 44 44 45 44 44 45 44 45 44 44 44 45 44 44 45 45 44 44 45 45 45 44 44 44 44 44 44 45 44 45 45 45 44 45 44 44 45 44 45 44 44 44 45 44 45 44 45 44 45 44 45 45 44 45 44 44 45 45 44 45 45 45 44 44 45 45 44 45 44 44 44 44 45 44 45 44 44 44 45 45 44 45 44 45 45 45 45 45 44 44 45 44 44 45 44 45 44 44 44 44 44 44 44 45 44 44 45 44 45 45 45 44 44 45 45 45 44 44 44 44 44 44 44 44 45 44 45 44 45 45 44 45 44 44 45 44 45 45 44 44 45 45 45 45 45 44 45 45 44 44 44 45 45 45 44 44 45 44 45 45 44 44 45 44 44 45 45 45 45 45 44 45 45 44 44 44 45 44 44 44 45 44 44 44 45 45 45 45 44 44 45 44 44 45 44 44 44 45 45 44 45 45 44 44 44 45 45 45 44 45 45 45 44 44 44 44 45 44 45 45 44 44 45 45 44 44 44 45 44 44 45 44 45 44 44 44 45 44 44 44 44 45 44 45 44 45 45 44 45 44 44 45 44 44 45 45 44 44 44 44 45 44 45 44 44 45 44 44 44 44 44 45 44 45 44 45 45 45 44 44 44 44 45 44 45 45 44 44 44 44 45 45 45 44 45 44 44 45 44 45 44 44 44 44 44 45 45 44 44 44 44 44 44 45 44 44 45 45 44 45 45
*/
|
Data/List/Equiv/Id.agda | Lolirofle/stuff-in-agda | 6 | 10210 | <reponame>Lolirofle/stuff-in-agda
module Data.List.Equiv.Id where
import Lvl
open import Functional
open import Function.Names as Names using (_⊜_)
import Function.Equals as Fn
open import Data.Boolean
open import Data.Option
open import Data.Option.Equiv.Id
open import Data.Option.Proofs using ()
open import Data.List
open import Data.List.Equiv
open import Data.List.Functions
open import Logic
open import Logic.Propositional
open import Numeral.Natural
open import Numeral.Natural.Oper
open import Relator.Equals
open import Structure.Function
open import Structure.Function.Domain
import Structure.Function.Names as Names
open import Structure.Operator.Properties
open import Structure.Operator
open import Structure.Relator.Properties
open import Structure.Setoid using (Equiv) renaming (_≡_ to _≡ₛ_)
open import Syntax.Transitivity
open import Type
private variable ℓ ℓₑ ℓₑₗ ℓₑₒ ℓₑ₁ ℓₑ₂ ℓₑₗ₁ ℓₑₗ₂ : Lvl.Level
private variable T A B : Type{ℓ}
private variable n : ℕ
open import Relator.Equals
open import Relator.Equals.Proofs
private variable l l₁ l₂ : List(T)
private variable a b x : T
private variable f : A → B
private variable P : List(T) → Stmt{ℓ}
[⊰]-general-cancellation : ((a ⊰ l₁) ≡ (b ⊰ l₂)) → (a ≡ b) ∧ (l₁ ≡ l₂)
[⊰]-general-cancellation p = [∧]-intro (L p) (R p) where
R : ((a ⊰ l₁) ≡ (b ⊰ l₂)) → (l₁ ≡ l₂)
R p = congruence₁(tail) p
L : ((a ⊰ l₁) ≡ (b ⊰ l₂)) → (a ≡ b)
L {l₁ = ∅} {l₂ = ∅} [≡]-intro = [≡]-intro
L {l₁ = ∅} {l₂ = _ ⊰ _} p with () ← R p
L {l₁ = _ ⊰ _} {l₂ = _ ⊰ _} p = injective(Some) (congruence₁(first) p)
instance
List-Id-extensionality : Extensionality([≡]-equiv {T = List(T)})
Extensionality.generalized-cancellationᵣ List-Id-extensionality = [∧]-elimₗ ∘ [⊰]-general-cancellation
Extensionality.generalized-cancellationₗ List-Id-extensionality = [∧]-elimᵣ ∘ [⊰]-general-cancellation
Extensionality.case-unequality List-Id-extensionality ()
open import Data.List.Proofs
initial-0-length : (initial(0)(l) ≡ ∅)
initial-0-length {l = ∅} = reflexivity(_≡_)
initial-0-length {l = x ⊰ l} = reflexivity(_≡_)
{-# REWRITE initial-0-length #-}
multiply-singleton-repeat : (singleton(l) ++^ n ≡ repeat(l)(n))
multiply-singleton-repeat {l = l} {n = 𝟎} = reflexivity(_≡_)
multiply-singleton-repeat {l = l} {n = 𝐒 n} = congruence₁(l ⊰_) (multiply-singleton-repeat {l = l} {n = n})
module _ {f g : A → B} where
map-function-raw : (f ⊜ g) → (map f ⊜ map g)
map-function-raw p {∅} = reflexivity(_≡_)
map-function-raw p {x ⊰ l} rewrite p{x} = congruence₁(g(x) ⊰_) (map-function-raw p {l})
module _ {f g : A → List(B)} where
concatMap-function-raw : (f ⊜ g) → (concatMap f ⊜ concatMap g)
concatMap-function-raw p {∅} = reflexivity(_≡_)
concatMap-function-raw p {x ⊰ l} rewrite p{x} = congruence₁(g(x) ++_) (concatMap-function-raw p {l})
module _ {ℓ₁ ℓ₂ ℓ₃} {A : Type{ℓ₁}} {B : Type{ℓ₂}} {C : Type{ℓ₃}} {f : B → C}{g : A → B} where
map-preserves-[∘] : (map(f ∘ g) ⊜ (map f ∘ map g))
map-preserves-[∘] {x = ∅} = reflexivity(_≡_)
map-preserves-[∘] {x = x ⊰ l} = congruence₁(f(g(x)) ⊰_) (map-preserves-[∘] {x = l})
map-preserves-id : (map id ⊜ id{T = List(T)})
map-preserves-id {x = ∅} = reflexivity(_≡_)
map-preserves-id {x = x ⊰ l} = congruence₁(x ⊰_) (map-preserves-id {x = l})
{-# REWRITE map-preserves-id #-}
concatMap-[++] : (concatMap f (l₁ ++ l₂) ≡ (concatMap f l₁ ++ concatMap f l₂))
concatMap-[++] {f = f} {∅} {l₂} = reflexivity(_≡_)
concatMap-[++] {f = f} {x ⊰ l₁} {l₂} =
(f(x) ++ concatMap f (l₁ ++ l₂)) 🝖-[ congruence₁(f(x) ++_) (concatMap-[++] {f = f} {l₁} {l₂}) ]
(f(x) ++ (concatMap f l₁ ++ concatMap f l₂)) 🝖-[ associativity(_++_) {x = f(x)}{y = concatMap f l₁}{z = concatMap f l₂} ]-sym
(f(x) ++ concatMap f l₁ ++ concatMap f l₂) 🝖-end
module _ {ℓ₁ ℓ₂ ℓ₃} {A : Type{ℓ₁}} {B : Type{ℓ₂}} {C : Type{ℓ₃}} {f : B → List(C)}{g : A → List(B)} where
concatMap-[∘] : (concatMap(concatMap f ∘ g)) ⊜ (concatMap f ∘ concatMap g)
concatMap-[∘] {∅} = reflexivity(_≡_)
concatMap-[∘] {x ⊰ l} =
(concatMap(concatMap f ∘ g)) (x ⊰ l) 🝖[ _≡_ ]-[]
(concatMap f ∘ g) x ++ concatMap(concatMap f ∘ g) l 🝖-[ congruence₁((concatMap f ∘ g) x ++_) (concatMap-[∘] {l}) ]
(concatMap f ∘ g) x ++ (concatMap f ∘ concatMap g) l 🝖[ _≡_ ]-[]
(concatMap f (g(x))) ++ (concatMap f (concatMap g l)) 🝖-[ concatMap-[++] {f = f}{l₁ = g(x)}{l₂ = concatMap g l} ]-sym
concatMap f (g(x) ++ concatMap g l) 🝖[ _≡_ ]-[]
concatMap f (concatMap g (x ⊰ l)) 🝖[ _≡_ ]-[]
(concatMap f ∘ concatMap g) (x ⊰ l) 🝖-end
concatMap-singleton : (concatMap{A = T} singleton) ⊜ id
concatMap-singleton {x = ∅} = reflexivity(_≡_)
concatMap-singleton {x = x ⊰ l} = congruence₁(x ⊰_) (concatMap-singleton {x = l})
concatMap-concat-map : (concatMap f l ≡ concat(map f l))
concatMap-concat-map {l = ∅} = reflexivity(_≡_)
concatMap-concat-map {f = f}{l = x ⊰ l} =
concatMap f (x ⊰ l) 🝖[ _≡_ ]-[]
f(x) ++ concatMap f l 🝖[ _≡_ ]-[ congruence₂ᵣ(_++_)(f(x)) (concatMap-concat-map {l = l}) ]
f(x) ++ concat(map f l) 🝖[ _≡_ ]-[]
concat(f(x) ⊰ map f l) 🝖[ _≡_ ]-[]
concat(map f (x ⊰ l)) 🝖-end
foldₗ-lastElem-equivalence : (last{T = T} ⊜ foldₗ (const Option.Some) Option.None)
foldₗ-lastElem-equivalence {x = ∅} = reflexivity(_≡_)
foldₗ-lastElem-equivalence {x = x ⊰ ∅} = reflexivity(_≡_)
foldₗ-lastElem-equivalence {x = x ⊰ y ⊰ l} = foldₗ-lastElem-equivalence {x = y ⊰ l}
{-
foldₗ-reverse-equivalence : (reverse{T = T} ⊜ foldₗ (Functional.swap(_⊰_)) ∅)
foldₗ-reverse-equivalence {x = ∅} = reflexivity(_≡_)
foldₗ-reverse-equivalence {x = x ⊰ l} =
reverse (x ⊰ l) 🝖[ _≡_ ]-[]
(postpend x ∘ reverse) l 🝖[ _≡_ ]-[ congruence₁(postpend x) (foldₗ-reverse-equivalence {x = l}) ]
(postpend x ∘ foldₗ (Functional.swap(_⊰_)) ∅) l 🝖[ _≡_ ]-[ {!!} ]
foldₗ (Functional.swap(_⊰_)) (Functional.swap(_⊰_) ∅ x) l 🝖[ _≡_ ]-[]
foldₗ (Functional.swap(_⊰_)) (singleton(x)) l 🝖[ _≡_ ]-[]
foldₗ (Functional.swap(_⊰_)) ∅ (x ⊰ l) 🝖-end
-}
foldᵣ-function : ⦃ equiv : Equiv{ℓₑ}(B) ⦄ → ∀{_▫_ : A → B → B} ⦃ oper : BinaryOperator(_▫_) ⦄ → Function ⦃ equiv-B = equiv ⦄ (foldᵣ(_▫_) a)
foldᵣ-function {a = a} ⦃ equiv ⦄ {_▫_ = _▫_} ⦃ oper ⦄ = intro p where
p : Names.Congruence₁ ⦃ equiv-B = equiv ⦄ (foldᵣ(_▫_) a)
p {∅} {∅} xy = reflexivity(Equiv._≡_ equiv)
p {x₁ ⊰ l₁} {x₂ ⊰ l₂} xy =
foldᵣ(_▫_) a (x₁ ⊰ l₁) 🝖[ Equiv._≡_ equiv ]-[]
x₁ ▫ (foldᵣ(_▫_) a l₁) 🝖[ Equiv._≡_ equiv ]-[ congruence₂(_▫_) ⦃ oper ⦄ ([∧]-elimₗ([⊰]-general-cancellation xy)) (p {l₁} {l₂} ([∧]-elimᵣ([⊰]-general-cancellation xy))) ]
x₂ ▫ (foldᵣ(_▫_) a l₂) 🝖[ Equiv._≡_ equiv ]-[]
foldᵣ(_▫_) a (x₂ ⊰ l₂) 🝖-end
foldᵣ-function₊-raw : ∀{l₁ l₂ : List(A)} ⦃ equiv : Equiv{ℓₑ}(B) ⦄ {_▫₁_ _▫₂_ : A → B → B} ⦃ oper₁ : BinaryOperator(_▫₁_) ⦄ ⦃ oper₂ : BinaryOperator ⦃ [≡]-equiv ⦄ ⦃ equiv ⦄ ⦃ equiv ⦄ (_▫₂_) ⦄ {a₁ a₂ : B} → (∀{x y} → (_≡ₛ_ ⦃ equiv ⦄ (x ▫₁ y) (x ▫₂ y))) → (_≡ₛ_ ⦃ equiv ⦄ a₁ a₂) → (l₁ ≡ l₂) → (foldᵣ(_▫₁_) a₁ l₁ ≡ₛ foldᵣ(_▫₂_) a₂ l₂)
foldᵣ-function₊-raw {l₁ = ∅} {∅} ⦃ equiv ⦄ {_▫₁_} {_▫₂_} ⦃ oper₁ ⦄ ⦃ oper₂ ⦄ {a₁} {a₂} opeq aeq leq = aeq
foldᵣ-function₊-raw {l₁ = x₁ ⊰ l₁} {x₂ ⊰ l₂} ⦃ equiv ⦄ {_▫₁_} {_▫₂_} ⦃ oper₁ ⦄ ⦃ oper₂ ⦄ {a₁} {a₂} opeq aeq leq =
foldᵣ(_▫₁_) a₁ (x₁ ⊰ l₁) 🝖[ Equiv._≡_ equiv ]-[]
x₁ ▫₁ (foldᵣ(_▫₁_) a₁ l₁) 🝖[ Equiv._≡_ equiv ]-[ congruence₂(_▫₁_) ⦃ oper₁ ⦄ ([∧]-elimₗ([⊰]-general-cancellation leq)) (foldᵣ-function₊-raw {l₁ = l₁} {l₂} ⦃ equiv ⦄ {_▫₁_}{_▫₂_} ⦃ oper₁ ⦄ ⦃ oper₂ ⦄ {a₁}{a₂} opeq aeq ([∧]-elimᵣ([⊰]-general-cancellation leq))) ]
x₂ ▫₁ (foldᵣ(_▫₂_) a₂ l₂) 🝖[ Equiv._≡_ equiv ]-[ opeq{x₂}{foldᵣ(_▫₂_) a₂ l₂} ]
x₂ ▫₂ (foldᵣ(_▫₂_) a₂ l₂) 🝖[ Equiv._≡_ equiv ]-[]
foldᵣ(_▫₂_) a₂ (x₂ ⊰ l₂) 🝖[ Equiv._≡_ equiv ]-end
map-binaryOperator : BinaryOperator {A₁ = A → B} ⦃ equiv-A₁ = Fn.[⊜]-equiv ⦃ [≡]-equiv ⦄ ⦄ ⦃ equiv-A₂ = [≡]-equiv ⦄ (map)
map-binaryOperator = intro p where
p : Names.Congruence₂(map)
p {f} {g} {∅} {∅} fg xy = reflexivity(_≡_)
p {f} {g} {x₁ ⊰ l₁} {x₂ ⊰ l₂} fg xy = congruence₂(_⊰_) ba rec where
ba : f(x₁) ≡ g(x₂)
ba =
f(x₁) 🝖[ _≡_ ]-[ Fn._⊜_.proof fg {x₁} ]
g(x₁) 🝖[ _≡_ ]-[ congruence₁(g) ([∧]-elimₗ([⊰]-general-cancellation xy)) ]
g(x₂) 🝖-end
rec : map f(l₁) ≡ map g(l₂)
rec =
map f(l₁) 🝖[ _≡_ ]-[ p fg ([∧]-elimᵣ([⊰]-general-cancellation xy)) ]
map g(l₂) 🝖-end
count-of-[++] : ∀{P} → (count P (l₁ ++ l₂) ≡ count P l₁ + count P l₂)
count-of-[++] {l₁ = ∅} {l₂ = l₂} {P = P} = reflexivity(_≡_)
count-of-[++] {l₁ = x₁ ⊰ l₁} {l₂ = l₂} {P = P} with P(x₁) | count-of-[++] {l₁ = l₁} {l₂ = l₂} {P = P}
... | 𝑇 | p = congruence₁ 𝐒(p)
... | 𝐹 | p = p
-- TODO Is this true?: count-single-equality-equivalence : (∀{P} → count P l₁ ≡ count P l₂) ↔ (∀{x} → (count (x ≡?_) l₁ ≡ count (x ≡?_) l₂))
|
oeis/170/A170785.asm | neoneye/loda-programs | 11 | 170190 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A170785: a(n) = n^9*(n^3 + 1)/2.
; 0,1,2304,275562,8519680,123046875,1093430016,6940820404,34426847232,141408478485,500500000000,1570393162206,4460630114304,11654344810927,28357286711040,64892390625000,140771848093696,291370412553129,578514870358272,1106818803381970,2048256000000000,3678310895716611,6428104950133504,10958212792340892,18261494621798400,29804229736328125,47717193082680576,75051130447242054,116114421772582912,176914645175722455,265730341500000000,393844611705355216,576478344489467904,833967963218693457
mov $2,2
lpb $2
pow $0,3
add $1,4
mul $1,$0
bin $2,2
lpe
div $1,8
mov $0,$1
|
stm32f0/stm32gd-clock-timer.adb | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 1075 | <gh_stars>1-10
package body STM32GD.Clock.Timer is
procedure Init is
begin
null;
end Init;
procedure Delay_us (us : Natural) is
begin
null;
end Delay_us;
procedure Delay_ms (ms : Natural) is
begin
null;
end Delay_ms;
procedure Delay_s (s : Natural) is
begin
null;
end Delay_s;
end STM32GD.Clock.Timer;
|
oeis/167/A167893.asm | neoneye/loda-programs | 11 | 167212 | ; A167893: a(n) = Sum_{k=1..n} Catalan(k)^3.
; Submitted by <NAME>(s2)
; 1,9,134,2878,76966,2376934,81330523,3005537523,117938569451,4856184495787,208008478587443,9208478072445171,419215292661445171,19548493234125829171,930767164551264230296,45133682592532326893296,2224173698690413601132296,111192059034974606204132296,5630742354973777814123891296,288463442067569711290501979296,14933927376621908051730362387296,780556941131606228547071518931296,41155208057117107504668577821056296,2187365718298378009387939310009484520,117116596632897423910919536201787541928
lpb $0
mov $2,$0
sub $0,1
add $2,1
seq $2,33536 ; Cubes of Catalan numbers (A000108).
add $1,$2
lpe
add $1,1
mov $0,$1
|
oeis/181/A181718.asm | neoneye/loda-programs | 11 | 89495 | ; A181718: a(n) = (1/9)*(10^(2*n) + 10^n - 2).
; 0,12,1122,111222,11112222,1111122222,111111222222,11111112222222,1111111122222222,111111111222222222,11111111112222222222,1111111111122222222222,111111111111222222222222,11111111111112222222222222,1111111111111122222222222222,111111111111111222222222222222,11111111111111112222222222222222,1111111111111111122222222222222222,111111111111111111222222222222222222,11111111111111111112222222222222222222,1111111111111111111122222222222222222222,111111111111111111111222222222222222222222
mov $1,10
pow $1,$0
add $1,1
bin $1,2
mul $1,2
div $1,9
mov $0,$1
|
alloy4fun_models/trashltl/models/5/scz9bNScxSvq9Li7o.als | Kaixi26/org.alloytools.alloy | 0 | 5126 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idscz9bNScxSvq9Li7o_prop6 {
all f : File | always (f in Trash implies always f in Trash)
}
pred __repair { idscz9bNScxSvq9Li7o_prop6 }
check __repair { idscz9bNScxSvq9Li7o_prop6 <=> prop6o } |
experiments/test-suite/mutation-based/20/3/nqueens.als | kaiyuanw/AlloyFLCore | 1 | 5116 | pred test58 {
some disj Queen0, Queen1: Queen {
Queen = Queen0 + Queen1
row = Queen0->6 + Queen1->5
col = Queen0->-8 + Queen1->-8
}
}
run test58 for 4 expect 0
pred test12 {
some disj Queen0, Queen1, Queen2, Queen3: Queen {
Queen = Queen0 + Queen1 + Queen2 + Queen3
row = Queen0->0 + Queen1->0 + Queen2->3 + Queen3->3
col = Queen0->1 + Queen1->0 + Queen2->3 + Queen3->0
nothreat[Queen3,Queen2]
}
}
run test12 for 4 expect 0
pred test15 {
some disj Queen0, Queen1, Queen2, Queen3: Queen {
Queen = Queen0 + Queen1 + Queen2 + Queen3
row = Queen0->3 + Queen1->1 + Queen2->2 + Queen3->1
col = Queen0->1 + Queen1->0 + Queen2->1 + Queen3->2
nothreat[Queen3,Queen2]
}
}
run test15 for 4 expect 0
pred test56 {
some disj Queen0, Queen1: Queen {
Queen = Queen0 + Queen1
row = Queen0->1 + Queen1->0
col = Queen0->1 + Queen1->0
valid[]
}
}
run test56 for 4 expect 0
pred test23 {
some disj Queen0, Queen1, Queen2, Queen3: Queen {
Queen = Queen0 + Queen1 + Queen2 + Queen3
row = Queen0->0 + Queen1->1 + Queen2->2 + Queen3->2
col = Queen0->3 + Queen1->2 + Queen2->2 + Queen3->3
nothreat[Queen3,Queen2]
}
}
run test23 for 4 expect 0
pred test42 {
some disj Queen0, Queen1, Queen2, Queen3: Queen {
Queen = Queen0 + Queen1 + Queen2 + Queen3
row = Queen0->1 + Queen1->0 + Queen2->0 + Queen3->3
col = Queen0->1 + Queen1->0 + Queen2->1 + Queen3->3
nothreat[Queen3,Queen2]
}
}
run test42 for 4 expect 1
pred test53 {
some disj Queen0: Queen {
Queen = Queen0
row = Queen0->0
col = Queen0->0
valid[]
}
}
run test53 for 4 expect 1
pred test39 {
some disj Queen0, Queen1, Queen2, Queen3: Queen {
Queen = Queen0 + Queen1 + Queen2 + Queen3
row = Queen0->1 + Queen1->0 + Queen2->3 + Queen3->2
col = Queen0->0 + Queen1->0 + Queen2->3 + Queen3->2
nothreat[Queen3,Queen2]
}
}
run test39 for 4 expect 0
pred test28 {
some disj Queen0, Queen1, Queen2, Queen3: Queen {
Queen = Queen0 + Queen1 + Queen2 + Queen3
row = Queen0->3 + Queen1->2 + Queen2->0 + Queen3->2
col = Queen0->0 + Queen1->0 + Queen2->1 + Queen3->0
nothreat[Queen3,Queen2]
}
}
run test28 for 4 expect 1
pred test51 {
some disj Queen0, Queen1, Queen2, Queen3: Queen {
Queen = Queen0 + Queen1 + Queen2 + Queen3
row = Queen0->2 + Queen1->1 + Queen2->1 + Queen3->0
col = Queen0->1 + Queen1->0 + Queen2->0 + Queen3->3
nothreat[Queen3,Queen2]
}
}
run test51 for 4 expect 1
pred test59 {
some disj Queen0, Queen1, Queen2: Queen {
Queen = Queen0 + Queen1 + Queen2
row = Queen0->0 + Queen1->6 + Queen2->5
col = Queen0->2 + Queen1->-8 + Queen2->-8
}
}
run test59 for 4 expect 0
pred test73 {
some disj Queen0, Queen1: Queen {
Queen = Queen0 + Queen1
row = Queen0->0 + Queen1->0
col = Queen0->1 + Queen1->0
}
}
run test73 for 4 expect 1
pred test19 {
some disj Queen0, Queen1, Queen2, Queen3: Queen {
Queen = Queen0 + Queen1 + Queen2 + Queen3
row = Queen0->0 + Queen1->0 + Queen2->2 + Queen3->1
col = Queen0->0 + Queen1->0 + Queen2->1 + Queen3->3
nothreat[Queen3,Queen2]
}
}
run test19 for 4 expect 1
pred test48 {
some disj Queen0, Queen1, Queen2, Queen3: Queen {
Queen = Queen0 + Queen1 + Queen2 + Queen3
row = Queen0->3 + Queen1->0 + Queen2->2 + Queen3->0
col = Queen0->2 + Queen1->0 + Queen2->3 + Queen3->0
nothreat[Queen3,Queen2]
}
}
run test48 for 4 expect 1
pred test74 {
some disj Queen0: Queen {
Queen = Queen0
row = Queen0->0
col = Queen0->3
}
}
run test74 for 4 expect 0
|
oeis/277/A277392.asm | neoneye/loda-programs | 11 | 93080 | <reponame>neoneye/loda-programs<filename>oeis/277/A277392.asm<gh_stars>10-100
; A277392: a(n) = n!*LaguerreL(n, -3*n).
; Submitted by <NAME>
; 1,4,62,1626,59928,2844120,165100752,11331597942,897635712384,80602042275756,8090067511468800,897561658361441106,109072492644378442752,14407931244544181001216,2055559499598438969956352,314997663481165477898736750,51601245736595962597616222208,8998602469516971841624655255892,1664378894334154183937074210996224,325439208077165071070189571820407114,67074317636984221358062010797424640000,14533389042774225958907712179909234599464,3302679645871328409898211748408564147290112
mov $2,1
mov $3,$0
mov $4,1
lpb $3
mul $1,$3
mul $4,$3
add $1,$4
mul $1,$3
mul $2,3
mul $2,$0
cmp $4,0
add $5,$4
mov $6,$5
cmp $6,0
add $5,$6
div $1,$5
add $2,$1
sub $3,1
div $4,$5
lpe
mov $0,$2
|
oeis/045/A045873.asm | neoneye/loda-programs | 11 | 175787 | ; A045873: a(n) = A006496(n)/2.
; Submitted by <NAME>(s2.)
; 0,1,2,-1,-12,-19,22,139,168,-359,-1558,-1321,5148,16901,8062,-68381,-177072,-12239,860882,1782959,-738492,-10391779,-17091098,17776699,121008888,153134281,-298775878,-1363223161,-1232566932,4350981941,14864798542,7974687379,-58374617952,-156622672799,-21372255838,740368852319,1587598983828,-526646293939,-8991287507018,-15349343544341,14257750446408,105262218614521,139235684997002,-247839723078601,-1191857871142212,-1144517126891419,3670255101928222,13063095838313539,7774916166985968
mov $1,1
lpb $0
sub $0,1
add $1,$2
mul $2,5
sub $1,$2
add $2,$1
lpe
mov $0,$2
|
testdata/test.asm | lwagner94/mycpu | 0 | 245905 | ldi sp, MEMORY_END // Setup stack
ldi r0, 10
subi r0, r0, 1
halt
|
programs/oeis/013/A013966.asm | neoneye/loda | 22 | 87280 | ; A013966: a(n) = sigma_18(n), the sum of the 18th powers of the divisors of n.
; 1,262145,387420490,68719738881,3814697265626,101560344351050,1628413597910450,18014467229220865,150094635684419611,1000003814697527770,5559917313492231482,26623434909949071690,112455406951957393130,426880482624234915250,1477891883850485076740,4722384497336874434561,14063084452067724991010,39346558271492178925595,104127350297911241532842,262145000003883417004506,630880794025129515120500,1457504524145421021848890,3244150909895248285300370,6979173721033689836523850,14551915228370666503906251,29479622655420870822063850,58149737153134695374809780,111904157238675851221206450,210457284365172120330305162,387421967891985410442007300,699053619999045038539170242,1237944761669877611773558785,2154025889952643931949866180,3686567273687293767768316450,6211904899257190242211191700,10314464171672140387955595291,16890053810563300749953435930,27296464243845942411626866090,43567528864476739705547233700,68719738881018018281926486490,107178930967531784356353269522,165382245749717576741263472500,252599333573498060811820806650,382076065983137165665047651642,572565596330486135132510591486,850437940274489861750065493650,1252453015827223091648143056290,1829548515926655588506095554890,2651730845859655100192621292051,3814711817541228370666504168395,5448327069331459529202339794900,7727906201495104167731063287530,10888439761782913818722623349690,15243662846008494719029509778100,21209401372885471271378433637732,29335003395175443970945541539250,40341069074818419171161998732580,55170324809908045483987846692490,75047496554032956760519149093722,101560344352554515318760046727940,136753052840548005895349735207882,183253411214649661627850783089090,244416145721923956664730601834950,324519791603188396660767794135041,428983333404490938721466117549380,564667116921635843540997669756100,740195513856780056217081017732810,966411491407545021909925272459810,1256850535145562939362729142581300,1628419809815776136044452848196500,2102085018129621311776010144838962,2703874895818821719954867256383515,3465863721549107204083472585375570,4427643156170116475096543461869850,5637710128213825518569946676482990,7155604322842878077851424425829802,9053844956548488017229262906786900,11421009854178254930110679578286500,14364405059580771582276370834385762,18014467229225587384501151571700186,22528399603088911564974843249582421,28096420858483619610096227838844690,34946659039493167390823397237402410,43353963430444845231286901250160500,53646409805570264984972392432022260,66217652299624649151514765359264250,81535464232824321792705787711569380,100158948241083514716015565084271930,122749609618842355502421774953773682,150095208250055287894311989005097470,183123913839120769996975997185208500,222937203418560021228504417052685970,270827695996303828362914219349058580,328324295834027397360102461491142050,397214318458322669574579222276689092,479605166159077202593341913528504650,577951262543040979328274795306257090,695137982587879286239994708604709395,834513763604113504518817192432393502
add $0,1
mov $2,$0
lpb $0
mov $3,$2
mov $4,$0
cmp $4,0
add $0,$4
dif $3,$0
cmp $3,$2
cmp $3,0
mul $3,$0
sub $0,1
pow $3,18
add $1,$3
lpe
add $1,1
mov $0,$1
|
testsuite/soap/TN-292/test_292.adb | svn2github/matreshka | 24 | 11830 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Testsuite Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the <NAME>, 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$
------------------------------------------------------------------------------
-- Checks that dispatcher respond by appropriate SOAP Fault when SOAP Message
-- handler wasn't found.
------------------------------------------------------------------------------
with Ada.Wide_Wide_Text_IO;
with League.Strings;
with League.Text_Codecs;
with Web_Services.SOAP.Dispatcher;
with SOAPConf.Reply_Streams;
procedure Test_292 is
use type League.Strings.Universal_String;
Request : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("<?xml version='1.0'?>"
& "<SOAP-ENV:Envelope"
& " xmlns:SOAP-ENV='http://www.w3.org/2003/05/soap-envelope'>"
& "<SOAP-ENV:Body/>"
& "</SOAP-ENV:Envelope>");
Expected_1 : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("<?xml version='1.0'?>"
& "<env:Envelope"
& " xmlns:env='http://www.w3.org/2003/05/soap-envelope'>"
& "<env:Body>"
& "<env:Fault>"
& "<env:Code>"
& "<env:Value>env:Sender</env:Value>"
& "<env:Subcode>"
& "<env:Value xmlns:rpc='http://www.w3.org/2003/05/soap-rpc'>"
& "rpc:ProcedureNotPresent</env:Value>"
& "</env:Subcode>"
& "</env:Code>"
& "<env:Reason>"
& "<env:Text xml:lang='en-US'>Procedure Not Present</env:Text>"
& "</env:Reason>"
& "<env:Detail>SOAP message handler was not found for empty"
& " payload element without SOAP Action</env:Detail>"
& "</env:Fault>"
& "</env:Body>"
& "</env:Envelope>");
Expected_2 : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("<?xml version='1.0'?>"
& "<env:Envelope"
& " xmlns:env='http://www.w3.org/2003/05/soap-envelope'>"
& "<env:Body>"
& "<env:Fault>"
& "<env:Code>"
& "<env:Value>env:Sender</env:Value>"
& "<env:Subcode>"
& "<env:Value xmlns:rpc='http://www.w3.org/2003/05/soap-rpc'>"
& "rpc:ProcedureNotPresent</env:Value>"
& "</env:Subcode>"
& "</env:Code>"
& "<env:Reason>"
& "<env:Text xml:lang='en-US'>Procedure Not Present</env:Text>"
& "</env:Reason>"
& "<env:Detail>SOAP message handler was not found for empty"
& " payload element with 'http://forge.ada-ru.org/test' SOAP"
& " Action</env:Detail>"
& "</env:Fault>"
& "</env:Body>"
& "</env:Envelope>");
Codec : constant League.Text_Codecs.Text_Codec
:= League.Text_Codecs.Codec
(League.Strings.To_Universal_String ("utf-8"));
Reply_Stream : aliased SOAPConf.Reply_Streams.Reply_Stream;
begin
Web_Services.SOAP.Dispatcher.Dispatch
(Codec.Encode (Request).To_Stream_Element_Array,
League.Strings.Empty_Universal_String,
Reply_Stream'Unchecked_Access);
if Codec.Decode (Reply_Stream.Output_Data) /= Expected_1 then
Ada.Wide_Wide_Text_IO.Put_Line (Expected_1.To_Wide_Wide_String);
Ada.Wide_Wide_Text_IO.Put_Line
(Codec.Decode (Reply_Stream.Output_Data).To_Wide_Wide_String);
raise Program_Error;
end if;
Web_Services.SOAP.Dispatcher.Dispatch
(Codec.Encode (Request).To_Stream_Element_Array,
League.Strings.To_Universal_String ("http://forge.ada-ru.org/test"),
Reply_Stream'Unchecked_Access);
if Codec.Decode (Reply_Stream.Output_Data) /= Expected_2 then
Ada.Wide_Wide_Text_IO.Put_Line (Expected_2.To_Wide_Wide_String);
Ada.Wide_Wide_Text_IO.Put_Line
(Codec.Decode (Reply_Stream.Output_Data).To_Wide_Wide_String);
raise Program_Error;
end if;
end Test_292;
|
programs/oeis/122/A122586.asm | neoneye/loda | 22 | 84344 | ; A122586: Leading digit of n expressed in base 3.
; 1,2,1,1,1,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
add $0,1
lpb $0
mov $1,$0
div $0,3
lpe
mov $0,$1
|
base/boot/detect/i386/hwpcia.asm | npocmaka/Windows-Server-2003 | 17 | 86298 | <reponame>npocmaka/Windows-Server-2003
title "PCI bus Support Assembley Code"
;++
;
; Copyright (c) 1989 Microsoft Corporation
;
; Module Name:
;
; hwpcia.asm
;
; Abstract:
;
; Calls the PCI rom function to determine what type of PCI
; support is prsent, if any.
;
; Base code provided by Intel
;
; Author:
;
;--
.386p
.xlist
include hwpci.inc
.list
if DBG
extrn _BlPrint:PROC
endif
_DATA SEGMENT PARA USE16 PUBLIC 'DATA'
if DBG
cr equ 11
PciBIOSSig db 'PCI: Scanning for "PCI "', cr, 0
PciBIOSSigNotFound db 'PCI: BIOS "PCI " not found', cr, 0
PciInt db 'PCI: Calling PCI_BIOS_PRESENT', cr, 0
PciIntFailed db 'PCI: PCI_BIOS_PRESENT returned carry', cr, 0
PciIntAhFailed db 'PCI: PCI_BIOS_PRESENT returned bad AH value', cr, 0
PciIDFailed db 'PCI: PCI_BIOS_PRESENT invalid PCI id', cr, 0
PciInt10IdFailed db 'PCI: PCI10_BIOS_PRESENT invalid PCI id', cr, 0
PciFound db 'PCI BUS FOUND', cr, 0
PciBadRead db 'PCI BAD READ', cr, 0
endif
_DATA ends
_TEXT SEGMENT PARA USE16 PUBLIC 'CODE'
ASSUME CS: _TEXT
;++
;
; BOOLEAN
; HwGetPciSystemData (
; PPCI_SYSTEM_DATA PciSystemData
; )
;
; Routine Description:
;
; This function retrieves the PCI System Data
;
; Arguments:
;
; PciSystemData - Supplies a pointer to the structure which will
; receive the PCI System Data.
;
; Return Value:
;
; True - PCI System Detected and System Data valid
; False - PCI System Not Detected
;
;--
SystemInfoPointer equ [bp + 4]
BiosDateFound equ [bp + 6]
public _HwGetPciSystemData
_HwGetPciSystemData proc
push bp ; The following INT 15H destroies
mov bp, sp ; ALL the general registers.
push si
push di
push bx
;
; Set for no PCI buses present
;
mov bx, SystemInfoPointer
mov byte ptr [bx].NoBuses, 0
;
; Is the BIOS date >= 11/01/92? If so, make the int-1a call
;
push ds
cmp byte ptr [BiosDateFound], 0
jnz gpci00
;
; A valid BIOS date was not found, check for "PCI " in bios code.
;
if DBG
push offset PciBIOSSig
call _BlPrint
add sp, 2
endif
mov bx, 0f000h
mov ds, bx
mov bx, 0fffch
spci05: cmp dword ptr ds:[bx], ' ICP' ; 'PCI ' found at this addr?
je short gpci00 ; found
dec bx ; next location
jnz short spci05 ; loop
jmp spci_notfound ; wrapped, all done - not found
gpci00:
pop ds
if DBG
push offset PciInt
call _BlPrint
add sp, 2
endif
;
; Check for a PCI system. Issue the PCI Present request.
;
mov ax, PCI_BIOS_PRESENT ; Real Mode Presence Request
int PCI_INTERFACE_INT ; Just Do It!
jc gpci10 ; Carry Set => No PCI
cmp ah, 0 ; If PCI Present AH == 0
jne gpci12 ; AH != 0 => No PCI
cmp edx, " ICP" ; "PCI" Backwards (with a trailing space)
jne gpci14 ; PCI Signature in EDX => PCI Exists
;
; Found PCI BIOS Version > 1.0
;
; The only thing left to do is squirrel the data away for the caller
;
mov dx, bx ; Save revision level
mov bx, SystemInfoPointer ; Get caller's Pointer
mov byte ptr [bx].MajorRevision, dh
mov byte ptr [bx].MinorRevision, dl
inc cl ; NoBuses = LastBus+1
if 0
;
; Some PIC BIOS returns very large number of NoBuses. As a work-
; around we mask the value to 16, unless the BIOS also return CH as
; neg cl then we believe it.
;
cmp cl, 16
jbe short @f
neg ch
inc ch
cmp cl, ch
je short @f
mov cl, 16
@@:
endif
mov byte ptr [bx].NoBuses, cl
mov byte ptr [bx].HwMechanism, al
jmp Done ; We're done
if DBG
gpci10: mov ax, offset PciIntFailed
jmp short gpci_oldbios
gpci12: mov ax, offset PciIntAhFailed
jmp short gpci_oldbios
gpci14: mov ax, offset PciIDFailed
gpci_oldbios:
push ax
call _BlPrint
add sp, 2
else
gpci10:
gpci12:
gpci14:
endif
;
; Look for BIOS Version 1.0, This has a different function #
;
mov ax, PCI10_BIOS_PRESENT ; Real Mode Presence Request
int PCI_INTERFACE_INT ; Just Do It!
; Version 1.0 has "PCI " in dx and cx, the Version number in ax, and the
; carry flag cleared. These are all the indications available.
;
cmp dx, "CP" ; "PC" Backwards
jne gpci50 ; PCI Signature not in DX & CX => No PCI
cmp cx, " I" ; "I " Backwards
jne gpci50 ; PCI Signature not in EDX => No PCI
;
; Found PCI BIOS Version 1.0
;
; The only thing left to do is squirrel the data away for the caller
;
mov bx, SystemInfoPointer ; Get caller's Pointer
mov byte ptr [bx].MajorRevision, ah
mov byte ptr [bx].MinorRevision, al
;
; The Version 1.0 BIOS is only on early HW that had couldn't support
; Multi Function devices or multiple bus's. So without reading any
; device data, mark it as such.
;
mov byte ptr [bx].HwMechanism, 2
mov byte ptr [bx].NoBuses, 1
jmp Done
spci_notfound:
pop ds ; restore ds
if DBG
push offset PciBIOSSigNotFound
call _BlPrint
add sp, 2
endif
jmp gpci_exit
if DBG
gpci50: push offset PciInt10IdFailed
jmp Done10
Done: push offset PciFound
Done10: call _BlPrint
add sp, 2
else
; non-debug no prints
gpci50:
Done:
endif
gpci_exit:
pop bx
pop di
pop si
pop bp
ret
_HwGetPciSystemData endp
RouteBuffer equ [bp + 4]
ExclusiveIRQs equ [bp + 8]
public _HwGetPciIrqRoutingOptions
_HwGetPciIrqRoutingOptions proc
push bp
mov bp, sp ; Create 'C' stack frame.
push ebx
push edi
push esi ; Save registers used.
push es
push ds
xor edi, edi
les di, RouteBuffer
mov bx, 0f000h
mov ds, bx
xor ebx, ebx
mov ax, 0B10Eh
int PCI_INTERFACE_INT
pop ds
pop es
mov di, ExclusiveIRQs
mov [di], bx
mov al, ah
pop esi ; Restore registers.
pop edi
pop ebx
pop bp
ret
_HwGetPciIrqRoutingOptions endp
Bus equ [bp + 4]
Device equ [bp + 6]
Function equ [bp + 8]
RegOffset equ [bp + 10]
DataRead equ [bp + 12]
public _HwGetPciConfigurationDword
_HwGetPciConfigurationDword proc
push bp
mov bp, sp ; Create 'C' stack frame.
push ebx
push ecx
push edi
push esi ; Save registers used.
push es
push ds
mov bl, Device
shl bl, 3
or bl, Function
mov bh, Bus
mov di, RegOffset
mov ax, 0B10Ah
int PCI_INTERFACE_INT
jc gbadread ; Carry Set => Read failed
pop ds
pop es
mov di, DataRead
mov [di], ecx
mov al, ah
jmp greaddone
if DBG
gbadread: push offset PciBadRead
call _BlPrint
add sp, 2
mov al, 087h
else
gbadread:
endif
greaddone: pop esi ; Restore registers.
pop edi
pop ecx
pop ebx
pop bp
ret
_HwGetPciConfigurationDword endp
_TEXT ends
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.