max_stars_repo_path
stringlengths 4
261
| max_stars_repo_name
stringlengths 6
106
| max_stars_count
int64 0
38.8k
| id
stringlengths 1
6
| text
stringlengths 7
1.05M
|
---|---|---|---|---|
test/dmat/vulkan-math-dmat4x3-test.adb
|
zrmyers/VulkanAda
| 1 |
28465
|
<reponame>zrmyers/VulkanAda
--------------------------------------------------------------------------------
-- MIT License
--
-- Copyright (c) 2021 <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.
--------------------------------------------------------------------------------
with Ada.Text_IO;
with Ada.Characters.Latin_1;
with Vulkan.Test.Framework;
with Vulkan.Math.GenDMatrix;
with Vulkan.Math.Dmat4x3;
with Vulkan.Math.Dmat2x2;
with Vulkan.Math.Dmat2x4;
with Vulkan.Math.GenDType;
with Vulkan.Math.Dvec4;
with Vulkan.Math.Dvec3;
use Ada.Text_IO;
use Ada.Characters.Latin_1;
use Vulkan.Math.Dmat2x2;
use Vulkan.Math.Dmat4x3;
use Vulkan.Math.Dmat2x4;
use Vulkan.Math.GenDType;
use Vulkan.Math.Dvec4;
use Vulkan.Math.Dvec3;
use Vulkan.Test.Framework;
--------------------------------------------------------------------------------
--< @group Vulkan Math Basic Types
--------------------------------------------------------------------------------
--< @summary
--< This package provides tests for single precision floating point mat4x3.
--------------------------------------------------------------------------------
package body Vulkan.Math.Dmat4x3.Test is
-- Test Mat4x3
procedure Test_Dmat4x3 is
vec1 : Vkm_Dvec4 :=
Make_Dvec4(1.0, 2.0, 3.0, 4.0);
vec2 : Vkm_Dvec3 :=
Make_Dvec3(1.0, 2.0, 3.0);
mat1 : Vkm_Dmat4x3 :=
Make_Dmat4x3;
mat2 : Vkm_Dmat4x3 :=
Make_Dmat4x3(0.0, 1.0, 2.0,
3.0, 4.0, 5.0,
6.0, 7.0, 8.0,
9.0, 10.0, 11.0);
mat3 : Vkm_Dmat4x3 :=
Make_Dmat4x3(vec2, - vec2, 2.0 * vec2, -2.0 * vec2);
mat4 : Vkm_Dmat4x3 :=
Make_Dmat4x3(mat2);
mat5 : Vkm_Dmat2x2 :=
Make_Dmat2x2(5.0);
mat6 : Vkm_Dmat4x3 :=
Make_Dmat4x3(mat5);
mat7 : Vkm_Dmat2x4 :=
Make_Dmat2x4( 1.0, -1.0, 0.5, 1.5,
-1.0, 2.0, 1.0, 1.0);
begin
Put_Line(LF & "Testing Mat4x3 Constructors...");
Put_Line("mat1 " & mat1.Image);
Assert_Dmat4x3_Equals(mat1, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0);
Put_Line("mat2 " & mat2.Image);
Assert_Dmat4x3_Equals(mat2, 0.0, 1.0, 2.0,
3.0, 4.0, 5.0,
6.0, 7.0, 8.0,
9.0, 10.0, 11.0);
Put_Line("mat3 " & mat3.Image);
Assert_Dmat4x3_Equals(mat3, 1.0, 2.0, 3.0,
-1.0, -2.0, -3.0,
2.0, 4.0, 6.0,
-2.0, -4.0, -6.0);
Put_Line("mat4 " & mat4.Image);
Assert_Dmat4x3_Equals(mat4, 0.0, 1.0, 2.0,
3.0, 4.0, 5.0,
6.0, 7.0, 8.0,
9.0, 10.0, 11.0);
Put_Line("mat6 " & mat6.Image);
Assert_Dmat4x3_Equals(mat6, 5.0, 0.0, 0.0,
0.0, 5.0, 0.0,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0);
Put_Line("Testing '=' operator...");
Put_Line(" mat2 != mat3");
Assert_Vkm_Bool_Equals(mat2 = mat3, False);
Put_Line(" mat4 != mat5");
Assert_Vkm_Bool_Equals(mat4 = mat5, False);
Put_Line(" mat4 = mat2");
Assert_Vkm_Bool_Equals(mat4 = mat2, True);
Put_Line(" Testing unary '+/-' operator");
Put_Line(" + mat4 = " & Image(+ mat4));
Assert_Dmat4x3_Equals(+mat4, 0.0, 1.0, 2.0,
3.0, 4.0, 5.0,
6.0, 7.0, 8.0,
9.0, 10.0, 11.0);
Put_Line(" - mat4 = " & Image(- mat4));
Assert_Dmat4x3_Equals(-mat4, 0.0, -1.0, -2.0,
-3.0, -4.0, -5.0,
-6.0, -7.0, -8.0,
-9.0, -10.0, -11.0);
Put_Line("+(- mat4) = " & Image(+(- mat4)));
Assert_Dmat4x3_Equals(+(-mat4), 0.0, -1.0, -2.0,
-3.0, -4.0, -5.0,
-6.0, -7.0, -8.0,
-9.0, -10.0, -11.0);
Put_Line("Testing 'abs' operator...");
Put_Line(" abs(- mat4) = " & Image(abs(-mat4)));
Assert_Dmat4x3_Equals(abs(-mat4), 0.0, 1.0, 2.0,
3.0, 4.0, 5.0,
6.0, 7.0, 8.0,
9.0, 10.0, 11.0);
Put_Line("Testing '+' operator...");
Put_Line(" mat4 + mat3 = " & Image(mat4 + mat3));
Assert_Dmat4x3_Equals(mat4 + mat3, 1.0, 3.0, 5.0,
2.0, 2.0, 2.0,
8.0, 11.0, 14.0,
7.0, 6.0, 5.0);
Put_Line("Testing '-' operator...");
Put_Line(" mat4 - mat3 = " & Image(mat4 -mat3));
Assert_Dmat4x3_Equals(mat4 - mat3, -1.0, -1.0, -1.0,
4.0, 6.0, 8.0,
4.0, 3.0, 2.0,
11.0, 14.0, 17.0);
Put_Line("Testing '*' operator...");
Put_Line(" mat7 * mat4 = " & Image(mat7 * mat4));
Assert_Dmat2x3_Equals(mat7 * mat4, 13.5, 15.5, 17.5,
21.0, 24.0, 27.0);
Put_Line(" mat4 * vec2 = " & Image(mat4 * vec2));
Assert_Dvec4_Equals(mat4 * vec2, 8.0, 26.0, 44.0, 62.0);
Put_Line(" vec1 * mat4 = " & Image(vec1 * mat4));
Assert_Dvec3_Equals(vec1 * mat4, 60.0, 70.0, 80.0);
end Test_Dmat4x3;
end Vulkan.Math.Dmat4x3.Test;
|
libsrc/_DEVELOPMENT/fcntl/z80/drivers/terminal/console_01/output/console_01_output_terminal_char/console_01_output_char_iterm_msg_readline_begin.asm
|
meesokim/z88dk
| 0 |
242096
|
<filename>libsrc/_DEVELOPMENT/fcntl/z80/drivers/terminal/console_01/output/console_01_output_terminal_char/console_01_output_char_iterm_msg_readline_begin.asm<gh_stars>0
SECTION code_fcntl
PUBLIC console_01_output_char_iterm_msg_readline_begin
console_01_output_char_iterm_msg_readline_begin:
; input terminal readline begins
set 7,(ix+7) ; indicates readline in progress
ret
|
EscriptParser.g4
|
polserver/escript-antlr4
| 1 |
3094
|
<reponame>polserver/escript-antlr4<filename>EscriptParser.g4<gh_stars>1-10
parser grammar EscriptParser;
options { tokenVocab=EscriptLexer; }
@header
{
}
@parser::members
{
}
compilationUnit
: topLevelDeclaration* EOF
;
moduleUnit
: moduleDeclarationStatement* EOF
;
moduleDeclarationStatement
: moduleFunctionDeclaration
| constStatement
;
moduleFunctionDeclaration
: IDENTIFIER '(' moduleFunctionParameterList? ')' ';'
;
moduleFunctionParameterList
: moduleFunctionParameter (',' moduleFunctionParameter)*
;
moduleFunctionParameter
: IDENTIFIER (':=' expression)?
;
topLevelDeclaration
: useDeclaration
| includeDeclaration
| programDeclaration
| functionDeclaration
| statement
;
functionDeclaration
: EXPORTED? FUNCTION IDENTIFIER functionParameters block ENDFUNCTION
;
stringIdentifier
: STRING_LITERAL
| IDENTIFIER
;
useDeclaration
: USE stringIdentifier ';'
;
includeDeclaration
: INCLUDE stringIdentifier ';'
;
programDeclaration
: PROGRAM IDENTIFIER programParameters block ENDPROGRAM
;
// Some ignored / to-be-handled things:
// - Labels can only come before DO, WHILE, FOR, FOREACH, REPEAT, and CASE statements.
// - Const expression must be optimizable
// TODO maybe split these all into individual statements?
statement
: ifStatement
| gotoStatement
| returnStatement
| constStatement
| varStatement
| doStatement
| whileStatement
| exitStatement
| breakStatement
| continueStatement
| forStatement
| foreachStatement
| repeatStatement
| caseStatement
| enumStatement
| SEMI
| statementExpression=expression ';'
;
statementLabel
: IDENTIFIER ':'
;
ifStatement
: IF parExpression THEN? block (ELSEIF parExpression block)* (ELSE block)? ENDIF
;
gotoStatement
: GOTO IDENTIFIER ';'
;
returnStatement
: RETURN expression? ';'
;
constStatement
: TOK_CONST variableDeclaration ';'
;
varStatement
: VAR variableDeclarationList ';'
;
doStatement
: statementLabel? DO block DOWHILE parExpression ';'
;
whileStatement
: statementLabel? WHILE parExpression block ENDWHILE
;
exitStatement
: EXIT ';'
;
breakStatement
: BREAK IDENTIFIER? ';'
;
continueStatement
: CONTINUE IDENTIFIER? ';'
;
forStatement
: statementLabel? FOR forGroup ENDFOR
;
foreachIterableExpression
: functionCall
| scopedFunctionCall
| IDENTIFIER
| parExpression
| bareArrayInitializer
| explicitArrayInitializer
;
foreachStatement
: statementLabel? FOREACH IDENTIFIER TOK_IN foreachIterableExpression block ENDFOREACH
;
repeatStatement
: statementLabel? REPEAT block UNTIL expression ';'
;
caseStatement
: statementLabel? CASE '(' expression ')' switchBlockStatementGroup+ ENDCASE
;
enumStatement
: ENUM IDENTIFIER enumList ENDENUM
;
block
: statement*
;
variableDeclarationInitializer
: ':=' expression
| '=' expression { this.notifyErrorListeners("Unexpected token: '='. Did you mean := for assign?\n"); }
| ARRAY
;
enumList
: enumListEntry (',' enumListEntry)* ','?
;
enumListEntry
: IDENTIFIER (':=' expression)?
;
switchBlockStatementGroup
: switchLabel+ block
;
switchLabel
: (integerLiteral | IDENTIFIER | STRING_LITERAL) ':'
| DEFAULT ':'
;
forGroup
: cstyleForStatement
| basicForStatement
;
basicForStatement
: IDENTIFIER ':=' expression TO expression block
;
cstyleForStatement
: '(' expression ';' expression ';' expression ')' block
;
identifierList
: IDENTIFIER (',' identifierList)?
;
variableDeclarationList
: variableDeclaration (',' variableDeclaration)*
;
variableDeclaration
: IDENTIFIER variableDeclarationInitializer?
;
// PARAMETERS
programParameters
: '(' programParameterList? ')'
;
programParameterList
: programParameter (','? programParameter)*
;
programParameter
: UNUSED IDENTIFIER
| IDENTIFIER (':=' expression)?
;
functionParameters
: '(' functionParameterList? ')'
;
functionParameterList
: functionParameter (',' functionParameter)*
;
functionParameter
: BYREF? UNUSED? IDENTIFIER (':=' expression)?
;
// EXPRESSIONS
scopedFunctionCall
: IDENTIFIER '::' functionCall
;
functionReference
: '@' IDENTIFIER
;
expression
: primary
| expression expressionSuffix
| expression postfix=('++' | '--')
| prefix=('+'|'-'|'++'|'--') expression
| prefix=('~'|'!'|'not') expression
| expression bop=('*' | '/' | '%' | '<<' | '>>' | '&') expression
| expression bop=('+' | '-' | '|' | '^') expression
| expression bop='?:' expression
| expression bop='in' expression
| expression bop=('<=' | '>=' | '>' | '<') expression
| expression bop='=' { this.notifyErrorListeners("Deprecated '=' found: did you mean '==' or ':='?\n"); } expression
| expression bop=('==' | '!=' | '<>') expression
| expression bop=('&&' | 'and') expression
| expression bop=('||' | 'or') expression
| <assoc=right> expression bop=('.+' | '.-' | '.?') expression
| <assoc=right> expression
bop=( ':=' | '+=' | '-=' | '*=' | '/=' | '%=')
expression
;
primary
: literal
| parExpression
| functionCall
| scopedFunctionCall
| IDENTIFIER
| functionReference
| explicitArrayInitializer
| explicitStructInitializer
| explicitDictInitializer
| explicitErrorInitializer
| bareArrayInitializer
;
explicitArrayInitializer
: ARRAY arrayInitializer?
;
explicitStructInitializer
: STRUCT structInitializer?
;
explicitDictInitializer
: DICTIONARY dictInitializer?
;
explicitErrorInitializer
: TOK_ERROR structInitializer?
;
bareArrayInitializer
: LBRACE expressionList? RBRACE
| LBRACE expressionList? ',' RBRACE {this.notifyErrorListeners("Expected expression following comma before right-brace in array initializer list");}
;
parExpression
: '(' expression ')'
;
expressionList
: expression (',' expression)*
;
expressionSuffix
: indexingSuffix
| methodCallSuffix
| navigationSuffix
;
indexingSuffix
: LBRACK expressionList RBRACK
;
navigationSuffix
: '.' ( IDENTIFIER | STRING_LITERAL )
;
methodCallSuffix
: '.' IDENTIFIER LPAREN expressionList? RPAREN
;
functionCall
: IDENTIFIER '(' expressionList? ')'
;
structInitializerExpression
: IDENTIFIER (':=' expression)?
| STRING_LITERAL (':=' expression)?
;
structInitializerExpressionList
: structInitializerExpression (',' structInitializerExpression)*
;
structInitializer
: '{' structInitializerExpressionList? '}'
| '{' structInitializerExpressionList? ',' '}' {this.notifyErrorListeners("Expected expression following comma before right-brace in struct initializer list");}
;
dictInitializerExpression
: expression ('->' expression)?
;
dictInitializerExpressionList
: dictInitializerExpression (',' dictInitializerExpression)*
;
dictInitializer
: '{' dictInitializerExpressionList? '}'
| '{' dictInitializerExpressionList? ',' '}' {this.notifyErrorListeners("Expected expression following comma before right-brace in dictionary initializer list");}
;
arrayInitializer
: '{' expressionList? '}'
| '{' expressionList? ',' '}' {this.notifyErrorListeners("Expected expression following comma before right-brace in array initializer list");}
| '(' expressionList? ')'
| '(' expressionList? ',' ')' {this.notifyErrorListeners("Expected expression following comma before right-paren in array initializer list");}
;
// Literals
literal
: integerLiteral
| floatLiteral
| CHAR_LITERAL
| STRING_LITERAL
;
integerLiteral
: DECIMAL_LITERAL
| HEX_LITERAL
| OCT_LITERAL
| BINARY_LITERAL
;
floatLiteral
: FLOAT_LITERAL
| HEX_FLOAT_LITERAL
;
|
vhdl/vhdl.g4
|
augustand/grammars-v4
| 0 |
6037
|
//
// Copyright (C) 2010-2014 <NAME>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
grammar vhdl;
ABS: A B S;
ACCESS : A C C E S S;
ACROSS : A C R O S S;
AFTER : A F T E R;
ALIAS : A L I A S;
ALL : A L L;
AND : A N D;
ARCHITECTURE : A R C H I T E C T U R E;
ARRAY : A R R A Y;
ASSERT : A S S E R T;
ATTRIBUTE : A T T R I B U T E;
BEGIN : B E G I N;
BLOCK : B L O C K;
BODY : B O D Y;
BREAK : B R E A K;
BUFFER : B U F F E R;
BUS : B U S;
CASE : C A S E;
COMPONENT : C O M P O N E N T;
CONFIGURATION : C O N F I G U R A T I O N;
CONSTANT : C O N S T A N T;
DISCONNECT : D I S C O N N E C T;
DOWNTO : D O W N T O;
END : E N D;
ENTITY : E N T I T Y;
ELSE : E L S E;
ELSIF : E L S I F;
EXIT : E X I T;
FILE : F I L E;
FOR : F O R;
FUNCTION : F U N C T I O N;
GENERATE : G E N E R A T E;
GENERIC : G E N E R I C;
GROUP : G R O U P;
GUARDED : G U A R D E D;
IF : I F;
IMPURE : I M P U R E;
IN : I N;
INERTIAL : I N E R T I A L;
INOUT : I N O U T;
IS : I S;
LABEL : L A B E L;
LIBRARY : L I B R A R Y;
LIMIT : L I M I T;
LINKAGE : L I N K A G E;
LITERAL : L I T E R A L;
LOOP : L O O P;
MAP : M A P;
MOD : M O D;
NAND : N A N D;
NATURE : N A T U R E;
NEW : N E W;
NEXT : N E X T;
NOISE : N O I S E;
NOR : N O R;
NOT : N O T;
NULL : N U L L;
OF : O F;
ON : O N;
OPEN : O P E N;
OR : O R;
OTHERS : O T H E R S;
OUT : O U T;
PACKAGE : P A C K A G E;
PORT : P O R T;
POSTPONED : P O S T P O N E D;
PROCESS : P R O C E S S;
PROCEDURE : P R O C E D U R E;
PROCEDURAL : P R O C E D U R A L;
PURE : P U R E;
QUANTITY : Q U A N T I T Y;
RANGE : R A N G E;
REVERSE_RANGE : R E V E R S E '_' R A N G E;
REJECT : R E J E C T;
REM : R E M;
RECORD : R E C O R D;
REFERENCE : R E F E R E N C E;
REGISTER : R E G I S T E R;
REPORT : R E P O R T;
RETURN : R E T U R N;
ROL : R O L;
ROR : R O R;
SELECT : S E L E C T;
SEVERITY : S E V E R I T Y;
SHARED : S H A R E D;
SIGNAL : S I G N A L;
SLA : S L A;
SLL : S L L;
SPECTRUM : S P E C T R U M;
SRA : S R A;
SRL : S R L;
SUBNATURE : S U B N A T U R E;
SUBTYPE : S U B T Y P E;
TERMINAL : T E R M I N A L;
THEN : T H E N;
THROUGH : T H R O U G H;
TO : T O;
TOLERANCE : T O L E R A N C E;
TRANSPORT : T R A N S P O R T;
TYPE : T Y P E;
UNAFFECTED : U N A F F E C T E D;
UNITS : U N I T S;
UNTIL : U N T I L;
USE : U S E;
VARIABLE : V A R I A B L E;
WAIT : W A I T;
WITH : W I T H;
WHEN : W H E N;
WHILE : W H I L E;
XNOR : X N O R;
XOR : X O R;
// case insensitive chars
fragment A:('a'|'A');
fragment B:('b'|'B');
fragment C:('c'|'C');
fragment D:('d'|'D');
fragment E:('e'|'E');
fragment F:('f'|'F');
fragment G:('g'|'G');
fragment H:('h'|'H');
fragment I:('i'|'I');
fragment J:('j'|'J');
fragment K:('k'|'K');
fragment L:('l'|'L');
fragment M:('m'|'M');
fragment N:('n'|'N');
fragment O:('o'|'O');
fragment P:('p'|'P');
fragment Q:('q'|'Q');
fragment R:('r'|'R');
fragment S:('s'|'S');
fragment T:('t'|'T');
fragment U:('u'|'U');
fragment V:('v'|'V');
fragment W:('w'|'W');
fragment X:('x'|'X');
fragment Y:('y'|'Y');
fragment Z:('z'|'Z');
//------------------------------------------Parser----------------------------------------
abstract_literal
: INTEGER
| REAL_LITERAL
| BASE_LITERAL
;
access_type_definition
: ACCESS subtype_indication
;
across_aspect
: identifier_list ( tolerance_aspect )? ( VARASGN expression )? ACROSS
;
actual_designator
: expression
| OPEN
;
actual_parameter_part
: association_list
;
actual_part
: name LPAREN actual_designator RPAREN
| actual_designator
;
adding_operator
: PLUS
| MINUS
| AMPERSAND
;
aggregate
: LPAREN element_association ( COMMA element_association )* RPAREN
;
alias_declaration
: ALIAS alias_designator ( COLON alias_indication )? IS
name ( signature )? SEMI
;
alias_designator
: identifier
| CHARACTER_LITERAL
| STRING_LITERAL
;
alias_indication
: subnature_indication
| subtype_indication
;
allocator
: NEW ( qualified_expression | subtype_indication )
;
architecture_body
: ARCHITECTURE identifier OF identifier IS
architecture_declarative_part
BEGIN
architecture_statement_part
END ( ARCHITECTURE )? ( identifier )? SEMI
;
architecture_declarative_part
: ( block_declarative_item )*
;
architecture_statement
: block_statement
| process_statement
| ( label_colon )? concurrent_procedure_call_statement
| ( label_colon )? concurrent_assertion_statement
| ( label_colon )? ( POSTPONED )? concurrent_signal_assignment_statement
| component_instantiation_statement
| generate_statement
| concurrent_break_statement
| simultaneous_statement
;
architecture_statement_part
: ( architecture_statement )*
;
array_nature_definition
: unconstrained_nature_definition
| constrained_nature_definition
;
array_type_definition
: unconstrained_array_definition
| constrained_array_definition
;
assertion
: ASSERT condition ( REPORT expression )? ( SEVERITY expression )?
;
assertion_statement
: ( label_colon )? assertion SEMI
;
association_element
: ( formal_part ARROW )? actual_part
;
association_list
: association_element ( COMMA association_element )*
;
attribute_declaration
: ATTRIBUTE label_colon name SEMI
;
// Need to add several tokens here, for they are both, VHDLAMS reserved words
// and attribute names.
// (25.2.2004, e.f.)
attribute_designator
: identifier
| RANGE
| REVERSE_RANGE
| ACROSS
| THROUGH
| REFERENCE
| TOLERANCE
;
attribute_specification
: ATTRIBUTE attribute_designator OF entity_specification IS expression SEMI
;
base_unit_declaration
: identifier SEMI
;
binding_indication
: ( USE entity_aspect )? ( generic_map_aspect )? ( port_map_aspect )?
;
block_configuration
: FOR block_specification
( use_clause )*
( configuration_item )*
END FOR SEMI
;
block_declarative_item
: subprogram_declaration
| subprogram_body
| type_declaration
| subtype_declaration
| constant_declaration
| signal_declaration
| variable_declaration
| file_declaration
| alias_declaration
| component_declaration
| attribute_declaration
| attribute_specification
| configuration_specification
| disconnection_specification
| step_limit_specification
| use_clause
| group_template_declaration
| group_declaration
| nature_declaration
| subnature_declaration
| quantity_declaration
| terminal_declaration
;
block_declarative_part
: ( block_declarative_item )*
;
block_header
: ( generic_clause ( generic_map_aspect SEMI )? )?
( port_clause ( port_map_aspect SEMI )? )?
;
block_specification
: identifier ( LPAREN index_specification RPAREN )?
| name
;
block_statement
: label_colon BLOCK ( LPAREN expression RPAREN )? ( IS )?
block_header
block_declarative_part BEGIN
block_statement_part
END BLOCK ( identifier )? SEMI
;
block_statement_part
: ( architecture_statement )*
;
branch_quantity_declaration
: QUANTITY ( across_aspect )?
( through_aspect )? terminal_aspect SEMI
;
break_element
: ( break_selector_clause )? name ARROW expression
;
break_list
: break_element ( COMMA break_element )*
;
break_selector_clause
: FOR name USE
;
break_statement
: ( label_colon )? BREAK ( break_list )? ( WHEN condition )? SEMI
;
case_statement
: ( label_colon )? CASE expression IS
( case_statement_alternative )+
END CASE ( identifier )? SEMI
;
case_statement_alternative
: WHEN choices ARROW sequence_of_statements
;
choice
: identifier
| discrete_range
| simple_expression
| OTHERS
;
choices
: choice ( BAR choice )*
;
component_configuration
: FOR component_specification
( binding_indication SEMI )?
( block_configuration )?
END FOR SEMI
;
component_declaration
: COMPONENT identifier ( IS )?
( generic_clause )?
( port_clause )?
END COMPONENT ( identifier )? SEMI
;
component_instantiation_statement
: label_colon instantiated_unit
( generic_map_aspect )?
( port_map_aspect )? SEMI
;
component_specification
: instantiation_list COLON name
;
composite_nature_definition
: array_nature_definition
| record_nature_definition
;
composite_type_definition
: array_type_definition
| record_type_definition
;
concurrent_assertion_statement
: ( label_colon )? ( POSTPONED )? assertion SEMI
;
concurrent_break_statement
: ( label_colon )? BREAK ( break_list )? ( sensitivity_clause )?
( WHEN condition )? SEMI
;
concurrent_procedure_call_statement
: ( label_colon )? ( POSTPONED )? procedure_call SEMI
;
concurrent_signal_assignment_statement
: ( label_colon )? ( POSTPONED )?
( conditional_signal_assignment | selected_signal_assignment )
;
condition
: expression
;
condition_clause
: UNTIL condition
;
conditional_signal_assignment
: target LE opts conditional_waveforms SEMI
;
conditional_waveforms
: waveform ( WHEN condition (ELSE conditional_waveforms)?)?
;
configuration_declaration
: CONFIGURATION identifier OF name IS
configuration_declarative_part
block_configuration
END ( CONFIGURATION )? ( identifier )? SEMI
;
configuration_declarative_item
: use_clause
| attribute_specification
| group_declaration
;
configuration_declarative_part
: ( configuration_declarative_item )*
;
configuration_item
: block_configuration
| component_configuration
;
configuration_specification
: FOR component_specification binding_indication SEMI
;
constant_declaration
: CONSTANT identifier_list COLON subtype_indication
( VARASGN expression )? SEMI
;
constrained_array_definition
: ARRAY index_constraint OF subtype_indication
;
constrained_nature_definition
: ARRAY index_constraint OF subnature_indication
;
constraint
: range_constraint
| index_constraint
;
context_clause
: ( context_item )*
;
context_item
: library_clause
| use_clause
;
delay_mechanism
: TRANSPORT
| ( REJECT expression )? INERTIAL
;
design_file
: ( design_unit )* EOF
;
design_unit
: context_clause library_unit
;
designator
: identifier
| STRING_LITERAL
;
direction
: TO
| DOWNTO
;
disconnection_specification
: DISCONNECT guarded_signal_specification AFTER expression SEMI
;
discrete_range
: range
| subtype_indication
;
element_association
: ( choices ARROW )? expression
;
element_declaration
: identifier_list COLON element_subtype_definition SEMI
;
element_subnature_definition
: subnature_indication
;
element_subtype_definition
: subtype_indication
;
entity_aspect
: ENTITY name ( LPAREN identifier RPAREN )?
| CONFIGURATION name
| OPEN
;
entity_class
: ENTITY
| ARCHITECTURE
| CONFIGURATION
| PROCEDURE
| FUNCTION
| PACKAGE
| TYPE
| SUBTYPE
| CONSTANT
| SIGNAL
| VARIABLE
| COMPONENT
| LABEL
| LITERAL
| UNITS
| GROUP
| FILE
| NATURE
| SUBNATURE
| QUANTITY
| TERMINAL
;
entity_class_entry
: entity_class ( BOX )?
;
entity_class_entry_list
: entity_class_entry ( COMMA entity_class_entry )*
;
entity_declaration
: ENTITY identifier IS entity_header
entity_declarative_part
( BEGIN entity_statement_part )?
END ( ENTITY )? ( identifier )? SEMI
;
entity_declarative_item
: subprogram_declaration
| subprogram_body
| type_declaration
| subtype_declaration
| constant_declaration
| signal_declaration
| variable_declaration
| file_declaration
| alias_declaration
| attribute_declaration
| attribute_specification
| disconnection_specification
| step_limit_specification
| use_clause
| group_template_declaration
| group_declaration
| nature_declaration
| subnature_declaration
| quantity_declaration
| terminal_declaration
;
entity_declarative_part
: ( entity_declarative_item )*
;
entity_designator
: entity_tag ( signature )?
;
entity_header
: ( generic_clause )?
( port_clause )?
;
entity_name_list
: entity_designator ( COMMA entity_designator )*
| OTHERS
| ALL
;
entity_specification
: entity_name_list COLON entity_class
;
entity_statement
: concurrent_assertion_statement
| process_statement
| concurrent_procedure_call_statement
;
entity_statement_part
: ( entity_statement )*
;
entity_tag
: identifier
| CHARACTER_LITERAL
| STRING_LITERAL
;
enumeration_literal
: identifier
| CHARACTER_LITERAL
;
enumeration_type_definition
: LPAREN enumeration_literal ( COMMA enumeration_literal )* RPAREN
;
exit_statement
: ( label_colon )? EXIT ( identifier )? ( WHEN condition )? SEMI
;
// NOTE that NAND/NOR are in (...)* now (used to be in (...)?).
// (21.1.2004, e.f.)
expression
: relation ( : logical_operator relation )*
;
factor
: primary ( : DOUBLESTAR primary )?
| ABS primary
| NOT primary
;
file_declaration
: FILE identifier_list COLON subtype_indication
( file_open_information )? SEMI
;
file_logical_name
: expression
;
file_open_information
: ( OPEN expression )? IS file_logical_name
;
file_type_definition
: FILE OF subtype_indication
;
formal_parameter_list
: interface_list
;
formal_part
: identifier
| identifier LPAREN explicit_range RPAREN
;
free_quantity_declaration
: QUANTITY identifier_list COLON subtype_indication
( VARASGN expression )? SEMI
;
generate_statement
: label_colon generation_scheme
GENERATE
( ( block_declarative_item )* BEGIN )?
( architecture_statement )*
END GENERATE ( identifier )? SEMI
;
generation_scheme
: FOR parameter_specification
| IF condition
;
generic_clause
: GENERIC LPAREN generic_list RPAREN SEMI
;
generic_list
: interface_constant_declaration (SEMI interface_constant_declaration)*
;
generic_map_aspect
: GENERIC MAP LPAREN association_list RPAREN
;
group_constituent
: name
| CHARACTER_LITERAL
;
group_constituent_list
: group_constituent ( COMMA group_constituent )*
;
group_declaration
: GROUP label_colon name
LPAREN group_constituent_list RPAREN SEMI
;
group_template_declaration
: GROUP identifier IS LPAREN entity_class_entry_list RPAREN SEMI
;
guarded_signal_specification
: signal_list COLON name
;
identifier
: BASIC_IDENTIFIER
| EXTENDED_IDENTIFIER
;
identifier_list
: identifier ( COMMA identifier )*
;
if_statement
: ( label_colon )? IF condition THEN
sequence_of_statements
( ELSIF condition THEN sequence_of_statements )*
( ELSE sequence_of_statements )?
END IF ( identifier )? SEMI
;
index_constraint
: LPAREN discrete_range ( COMMA discrete_range )* RPAREN
;
index_specification
: discrete_range
| expression
;
index_subtype_definition
: name RANGE BOX
;
instantiated_unit
: ( COMPONENT )? name
| ENTITY name ( LPAREN identifier RPAREN )?
| CONFIGURATION name
;
instantiation_list
: identifier ( COMMA identifier )*
| OTHERS
| ALL
;
interface_constant_declaration
: ( CONSTANT )? identifier_list COLON ( IN )? subtype_indication
( VARASGN expression )?
;
interface_declaration
: interface_constant_declaration
| interface_signal_declaration
| interface_variable_declaration
| interface_file_declaration
| interface_terminal_declaration
| interface_quantity_declaration
;
interface_element
: interface_declaration
;
interface_file_declaration
: FILE identifier_list COLON subtype_indication
;
interface_signal_list
: interface_signal_declaration ( SEMI interface_signal_declaration )*
;
interface_port_list
: interface_port_declaration ( SEMI interface_port_declaration )*
;
interface_list
: interface_element ( SEMI interface_element )*
;
interface_quantity_declaration
: QUANTITY identifier_list COLON ( IN | OUT )? subtype_indication
( VARASGN expression )?
;
interface_port_declaration
: identifier_list COLON signal_mode subtype_indication
( BUS )? ( VARASGN expression )?
;
interface_signal_declaration
: SIGNAL identifier_list COLON subtype_indication
( BUS )? ( VARASGN expression )?
;
interface_terminal_declaration
: TERMINAL identifier_list COLON subnature_indication
;
interface_variable_declaration
: ( VARIABLE )? identifier_list COLON
( signal_mode )? subtype_indication ( VARASGN expression )?
;
iteration_scheme
: WHILE condition
| FOR parameter_specification
;
label_colon
: identifier COLON
;
library_clause
: LIBRARY logical_name_list SEMI
;
library_unit
: secondary_unit | primary_unit
;
literal
: NULL
| BIT_STRING_LITERAL
| STRING_LITERAL
| enumeration_literal
| numeric_literal
;
logical_name
: identifier
;
logical_name_list
: logical_name ( COMMA logical_name )*
;
logical_operator
: AND
| OR
| NAND
| NOR
| XOR
| XNOR
;
loop_statement
: ( label_colon )? ( iteration_scheme )?
LOOP
sequence_of_statements
END LOOP ( identifier )? SEMI
;
signal_mode
: IN
| OUT
| INOUT
| BUFFER
| LINKAGE
;
multiplying_operator
: MUL
| DIV
| MOD
| REM
;
// was
// name
// : simple_name
// | operator_symbol
// | selected_name
// | indexed_name
// | slice_name
// | attribute_name
// ;
// changed to avoid left-recursion to name (from selected_name, indexed_name,
// slice_name, and attribute_name, respectively)
// (2.2.2004, e.f.)
name
: selected_name
| name_part ( DOT name_part)*
;
name_part
: selected_name (name_attribute_part | name_function_call_or_indexed_part | name_slice_part)?
;
name_attribute_part
: APOSTROPHE attribute_designator ( expression ( COMMA expression )* )?
;
name_function_call_or_indexed_part
: LPAREN actual_parameter_part? RPAREN
;
name_slice_part
: LPAREN explicit_range ( COMMA explicit_range )* RPAREN
;
selected_name
: identifier (DOT suffix)*
;
nature_declaration
: NATURE identifier IS nature_definition SEMI
;
nature_definition
: scalar_nature_definition
| composite_nature_definition
;
nature_element_declaration
: identifier_list COLON element_subnature_definition
;
next_statement
: ( label_colon )? NEXT ( identifier )? ( WHEN condition )? SEMI
;
numeric_literal
: abstract_literal
| physical_literal
;
object_declaration
: constant_declaration
| signal_declaration
| variable_declaration
| file_declaration
| terminal_declaration
| quantity_declaration
;
opts
: ( GUARDED )? ( delay_mechanism )?
;
package_body
: PACKAGE BODY identifier IS
package_body_declarative_part
END ( PACKAGE BODY )? ( identifier )? SEMI
;
package_body_declarative_item
: subprogram_declaration
| subprogram_body
| type_declaration
| subtype_declaration
| constant_declaration
| variable_declaration
| file_declaration
| alias_declaration
| use_clause
| group_template_declaration
| group_declaration
;
package_body_declarative_part
: ( package_body_declarative_item )*
;
package_declaration
: PACKAGE identifier IS
package_declarative_part
END ( PACKAGE )? ( identifier )? SEMI
;
package_declarative_item
: subprogram_declaration
| type_declaration
| subtype_declaration
| constant_declaration
| signal_declaration
| variable_declaration
| file_declaration
| alias_declaration
| component_declaration
| attribute_declaration
| attribute_specification
| disconnection_specification
| use_clause
| group_template_declaration
| group_declaration
| nature_declaration
| subnature_declaration
| terminal_declaration
;
package_declarative_part
: ( package_declarative_item )*
;
parameter_specification
: identifier IN discrete_range
;
physical_literal
: abstract_literal (: identifier)
;
physical_type_definition
: range_constraint UNITS base_unit_declaration
( secondary_unit_declaration )*
END UNITS ( identifier )?
;
port_clause
: PORT LPAREN port_list RPAREN SEMI
;
port_list
: interface_port_list
;
port_map_aspect
: PORT MAP LPAREN association_list RPAREN
;
primary
: literal
| qualified_expression
| LPAREN expression RPAREN
| allocator
| aggregate
| name
;
primary_unit
: entity_declaration
| configuration_declaration
| package_declaration
;
procedural_declarative_item
: subprogram_declaration
| subprogram_body
| type_declaration
| subtype_declaration
| constant_declaration
| variable_declaration
| alias_declaration
| attribute_declaration
| attribute_specification
| use_clause
| group_template_declaration
| group_declaration
;
procedural_declarative_part
: ( procedural_declarative_item )*
;
procedural_statement_part
: ( sequential_statement )*
;
procedure_call
: selected_name ( LPAREN actual_parameter_part RPAREN )?
;
procedure_call_statement
: ( label_colon )? procedure_call SEMI
;
process_declarative_item
: subprogram_declaration
| subprogram_body
| type_declaration
| subtype_declaration
| constant_declaration
| variable_declaration
| file_declaration
| alias_declaration
| attribute_declaration
| attribute_specification
| use_clause
| group_template_declaration
| group_declaration
;
process_declarative_part
: ( process_declarative_item )*
;
process_statement
: ( label_colon )? ( POSTPONED )? PROCESS
( LPAREN sensitivity_list RPAREN )? ( IS )?
process_declarative_part
BEGIN
process_statement_part
END ( POSTPONED )? PROCESS ( identifier )? SEMI
;
process_statement_part
: ( sequential_statement )*
;
qualified_expression
: subtype_indication APOSTROPHE ( aggregate | LPAREN expression RPAREN )
;
quantity_declaration
: free_quantity_declaration
| branch_quantity_declaration
| source_quantity_declaration
;
quantity_list
: name ( COMMA name )*
| OTHERS
| ALL
;
quantity_specification
: quantity_list COLON name
;
range
: explicit_range
| name
;
explicit_range
: simple_expression direction simple_expression
;
range_constraint
: RANGE range
;
record_nature_definition
: RECORD ( nature_element_declaration )+
END RECORD ( identifier )?
;
record_type_definition
: RECORD ( element_declaration )+
END RECORD ( identifier )?
;
relation
: shift_expression
( : relational_operator shift_expression )?
;
relational_operator
: EQ
| NEQ
| LOWERTHAN
| LE
| GREATERTHAN
| GE
;
report_statement
: ( label_colon )? REPORT expression ( SEVERITY expression )? SEMI
;
return_statement
: ( label_colon )? RETURN ( expression )? SEMI
;
scalar_nature_definition
: name ACROSS name THROUGH name REFERENCE
;
scalar_type_definition
: physical_type_definition
| enumeration_type_definition
| range_constraint
;
secondary_unit
: architecture_body
| package_body
;
secondary_unit_declaration
: identifier EQ physical_literal SEMI
;
selected_signal_assignment
: WITH expression SELECT target LE opts selected_waveforms SEMI
;
selected_waveforms
: waveform WHEN choices ( COMMA waveform WHEN choices )*
;
sensitivity_clause
: ON sensitivity_list
;
sensitivity_list
: name ( COMMA name )*
;
sequence_of_statements
: ( sequential_statement )*
;
sequential_statement
: wait_statement
| assertion_statement
| report_statement
| signal_assignment_statement
| variable_assignment_statement
| if_statement
| case_statement
| loop_statement
| next_statement
| exit_statement
| return_statement
| ( label_colon )? NULL SEMI
| break_statement
| procedure_call_statement
;
shift_expression
: simple_expression
( : shift_operator simple_expression )?
;
shift_operator
: SLL
| SRL
| SLA
| SRA
| ROL
| ROR
;
signal_assignment_statement
: ( label_colon )?
target LE ( delay_mechanism )? waveform SEMI
;
signal_declaration
: SIGNAL identifier_list COLON
subtype_indication ( signal_kind )? ( VARASGN expression )? SEMI
;
signal_kind
: REGISTER
| BUS
;
signal_list
: name ( COMMA name )*
| OTHERS
| ALL
;
signature
: LBRACKET ( name ( COMMA name )* )? ( RETURN name )? RBRACKET
;
// NOTE that sign is applied to first operand only (LRM does not permit
// `a op -b' - use `a op (-b)' instead).
// (3.2.2004, e.f.)
simple_expression
: ( PLUS | MINUS )? term ( : adding_operator term )*
;
simple_simultaneous_statement
: ( label_colon )?
simple_expression ASSIGN simple_expression ( tolerance_aspect )? SEMI
;
simultaneous_alternative
: WHEN choices ARROW simultaneous_statement_part
;
simultaneous_case_statement
: ( label_colon )? CASE expression USE
( simultaneous_alternative )+
END CASE ( identifier )? SEMI
;
simultaneous_if_statement
: ( label_colon )? IF condition USE
simultaneous_statement_part
( ELSIF condition USE simultaneous_statement_part )*
( ELSE simultaneous_statement_part )?
END USE ( identifier )? SEMI
;
simultaneous_procedural_statement
: ( label_colon )? PROCEDURAL ( IS )?
procedural_declarative_part BEGIN
procedural_statement_part
END PROCEDURAL ( identifier )? SEMI
;
simultaneous_statement
: simple_simultaneous_statement
| simultaneous_if_statement
| simultaneous_case_statement
| simultaneous_procedural_statement
| ( label_colon )? NULL SEMI
;
simultaneous_statement_part
: ( simultaneous_statement )*
;
source_aspect
: SPECTRUM simple_expression COMMA simple_expression
| NOISE simple_expression
;
source_quantity_declaration
: QUANTITY identifier_list COLON subtype_indication source_aspect SEMI
;
step_limit_specification
: LIMIT quantity_specification WITH expression SEMI
;
subnature_declaration
: SUBNATURE identifier IS subnature_indication SEMI
;
subnature_indication
: name ( index_constraint )?
( TOLERANCE expression ACROSS expression THROUGH )?
;
subprogram_body
: subprogram_specification IS
subprogram_declarative_part
BEGIN
subprogram_statement_part
END ( subprogram_kind )? ( designator )? SEMI
;
subprogram_declaration
: subprogram_specification SEMI
;
subprogram_declarative_item
: subprogram_declaration
| subprogram_body
| type_declaration
| subtype_declaration
| constant_declaration
| variable_declaration
| file_declaration
| alias_declaration
| attribute_declaration
| attribute_specification
| use_clause
| group_template_declaration
| group_declaration
;
subprogram_declarative_part
: ( subprogram_declarative_item )*
;
subprogram_kind
: PROCEDURE
| FUNCTION
;
subprogram_specification
: procedure_specification
| function_specification
;
procedure_specification
: PROCEDURE designator ( LPAREN formal_parameter_list RPAREN )?
;
function_specification
: ( PURE | IMPURE )? FUNCTION designator
( LPAREN formal_parameter_list RPAREN )? RETURN subtype_indication
;
subprogram_statement_part
: ( sequential_statement )*
;
subtype_declaration
: SUBTYPE identifier IS subtype_indication SEMI
;
// VHDLAMS 1076.1-1999 declares first name as optional. Here, second name
// is made optional to prevent antlr nondeterminism.
// (9.2.2004, e.f.)
subtype_indication
: selected_name ( selected_name )? ( constraint )? ( tolerance_aspect )?
;
suffix
: identifier
| CHARACTER_LITERAL
| STRING_LITERAL
| ALL
;
target
: name
| aggregate
;
term
: factor ( : multiplying_operator factor )*
;
terminal_aspect
: name ( TO name )?
;
terminal_declaration
: TERMINAL identifier_list COLON subnature_indication SEMI
;
through_aspect
: identifier_list ( tolerance_aspect )? ( VARASGN expression )? THROUGH
;
timeout_clause
: FOR expression
;
tolerance_aspect
: TOLERANCE expression
;
type_declaration
: TYPE identifier ( IS type_definition )? SEMI
;
type_definition
: scalar_type_definition
| composite_type_definition
| access_type_definition
| file_type_definition
;
unconstrained_array_definition
: ARRAY LPAREN index_subtype_definition ( COMMA index_subtype_definition )*
RPAREN OF subtype_indication
;
unconstrained_nature_definition
: ARRAY LPAREN index_subtype_definition ( COMMA index_subtype_definition )*
RPAREN OF subnature_indication
;
use_clause
: USE selected_name ( COMMA selected_name )* SEMI
;
variable_assignment_statement
: ( label_colon )? target VARASGN expression SEMI
;
variable_declaration
: ( SHARED )? VARIABLE identifier_list COLON
subtype_indication ( VARASGN expression )? SEMI
;
wait_statement
: ( label_colon )? WAIT ( sensitivity_clause )?
( condition_clause )? ( timeout_clause )? SEMI
;
waveform
: waveform_element ( COMMA waveform_element )*
| UNAFFECTED
;
waveform_element
: expression ( AFTER expression )?
;
//------------------------------------------Lexer-----------------------------------------
BASE_LITERAL
// INTEGER must be checked to be between and including 2 and 16 (included) i.e.
// INTEGER >=2 and INTEGER <=16
// A Based integer (a number without a . such as 3) should not have a negative exponent
// A Based fractional number with a . i.e. 3.0 may have a negative exponent
// These should be checked in the Visitor/Listener whereby an appropriate error message
// should be given
: INTEGER '#' BASED_INTEGER ('.'BASED_INTEGER)? '#' (EXPONENT)?
;
BIT_STRING_LITERAL
: BIT_STRING_LITERAL_BINARY
| BIT_STRING_LITERAL_OCTAL
| BIT_STRING_LITERAL_HEX
;
BIT_STRING_LITERAL_BINARY
: ('b'|'B') '\"' ('1' | '0' | '_')+ '\"'
;
BIT_STRING_LITERAL_OCTAL
: ('o'|'O') '\"' ('7' |'6' |'5' |'4' |'3' |'2' |'1' | '0' | '_')+ '\"'
;
BIT_STRING_LITERAL_HEX
: ('x'|'X') '\"' ( 'f' |'e' |'d' |'c' |'b' |'a' | 'F' |'E' |'D' |'C' |'B' |'A' | '9' | '8' | '7' |'6' |'5' |'4' |'3' |'2' |'1' | '0' | '_')+ '\"'
;
REAL_LITERAL
: INTEGER '.' INTEGER ( EXPONENT )?;
BASIC_IDENTIFIER
: LETTER ( '_' ( LETTER | DIGIT ) | LETTER | DIGIT )*
;
EXTENDED_IDENTIFIER
: '\\' ( 'a'..'z' | '0'..'9' | '&' | '\'' | '(' | ')'
| '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '|'
| ' ' | OTHER_SPECIAL_CHARACTER | '\\'
| '#' | '[' | ']' | '_' )+ '\\'
;
LETTER
: 'a'..'z' | 'A'..'Z'
;
COMMENT
: '--' ( ~'\n' )*
-> skip
;
TAB
: ( '\t' )+ -> skip
;
SPACE
: ( ' ' )+ -> skip
;
NEWLINE
: '\n' -> skip
;
CR
: '\r' -> skip
;
CHARACTER_LITERAL
: APOSTROPHE . APOSTROPHE
;
STRING_LITERAL
: '"' (~('"'|'\n'|'\r') | '""')* '"'
;
OTHER_SPECIAL_CHARACTER
: '!' | '$' | '%' | '@' | '?' | '^' | '`' | '{' | '}' | '~'
| ' ' | 'Ў' | 'ў' | 'Ј' | '¤' | 'Ґ' | '¦' | '§'
| 'Ё' | '©' | 'Є' | '«' | '¬' | '' | '®' | 'Ї'
| '°' | '±' | 'І' | 'і' | 'ґ' | 'µ' | '¶' | '·'
| 'ё' | '№' | 'є' | '»' | 'ј' | 'Ѕ' | 'ѕ' | 'ї'
| 'А' | 'Б' | 'В' | 'Г' | 'Д' | 'Е' | 'Ж' | 'З'
| 'И' | 'Й' | 'К' | 'Л' | 'М' | 'Н' | 'О' | 'П'
| 'Р' | 'С' | 'Т' | 'У' | 'Ф' | 'Х' | 'Ц' | 'Ч'
| 'Ш' | 'Щ' | 'Ъ' | 'Ы' | 'Ь' | 'Э' | 'Ю' | 'Я'
| 'а' | 'б' | 'в' | 'г' | 'д' | 'е' | 'ж' | 'з'
| 'и' | 'й' | 'к' | 'л' | 'м' | 'н' | 'о' | 'п'
| 'р' | 'с' | 'т' | 'у' | 'ф' | 'х' | 'ц' | 'ч'
| 'ш' | 'щ' | 'ъ' | 'ы' | 'ь' | 'э' | 'ю' | 'я'
;
DOUBLESTAR : '**' ;
ASSIGN : '==' ;
LE : '<=' ;
GE : '>=' ;
ARROW : '=>' ;
NEQ : '/=' ;
VARASGN : ':=' ;
BOX : '<>' ;
DBLQUOTE : '\"' ;
SEMI : ';' ;
COMMA : ',' ;
AMPERSAND : '&' ;
LPAREN : '(' ;
RPAREN : ')' ;
LBRACKET : '[' ;
RBRACKET : ']' ;
COLON : ':' ;
MUL : '*' ;
DIV : '/' ;
PLUS : '+' ;
MINUS : '-' ;
LOWERTHAN : '<' ;
GREATERTHAN : '>' ;
EQ : '=' ;
BAR : '|' ;
DOT : '.' ;
BACKSLASH : '\\' ;
EXPONENT
: ('E'|'e') ( '+' | '-' )? INTEGER
;
HEXDIGIT
: ('A'..'F'|'a'..'f')
;
INTEGER
: DIGIT ( '_' | DIGIT )*
;
DIGIT
: '0'..'9'
;
BASED_INTEGER
: EXTENDED_DIGIT ('_' | EXTENDED_DIGIT)*
;
EXTENDED_DIGIT
: (DIGIT | LETTER)
;
APOSTROPHE
: '\''
;
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48.log_21829_1559.asm
|
ljhsiun2/medusa
| 9 |
102205
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x16a4, %rax
nop
add %r12, %r12
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
movups %xmm4, (%rax)
nop
lfence
lea addresses_D_ht+0x62f4, %r15
nop
lfence
movb (%r15), %r13b
nop
nop
nop
nop
cmp $9384, %rax
lea addresses_UC_ht+0x8134, %rsi
nop
nop
nop
nop
dec %rbp
mov $0x6162636465666768, %rax
movq %rax, %xmm0
vmovups %ymm0, (%rsi)
nop
nop
nop
add %r12, %r12
lea addresses_normal_ht+0x8af4, %rax
nop
add %rbp, %rbp
movb $0x61, (%rax)
nop
nop
lfence
lea addresses_UC_ht+0x12af4, %rax
nop
cmp %r15, %r15
mov $0x6162636465666768, %r13
movq %r13, %xmm1
vmovups %ymm1, (%rax)
inc %r15
lea addresses_normal_ht+0x162f4, %rsi
lea addresses_WC_ht+0x62a7, %rdi
nop
nop
nop
nop
nop
dec %r12
mov $24, %rcx
rep movsq
nop
nop
nop
nop
nop
sub %r12, %r12
lea addresses_UC_ht+0x5ef4, %r15
sub %r13, %r13
mov $0x6162636465666768, %rdi
movq %rdi, (%r15)
nop
nop
nop
dec %rcx
lea addresses_A_ht+0xece2, %rdi
nop
nop
nop
nop
cmp %rax, %rax
mov (%rdi), %r13d
add $31862, %rcx
lea addresses_normal_ht+0x10ca8, %rax
nop
nop
nop
nop
xor $4053, %rsi
movw $0x6162, (%rax)
nop
inc %r12
lea addresses_A_ht+0x1c0f4, %rax
nop
nop
add %r15, %r15
vmovups (%rax), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rsi
nop
nop
nop
nop
nop
dec %rdi
lea addresses_WT_ht+0x3034, %rsi
lea addresses_WT_ht+0x1633c, %rdi
nop
nop
nop
nop
add $46026, %rax
mov $112, %rcx
rep movsl
nop
inc %rcx
lea addresses_WT_ht+0x4aaf, %rsi
lea addresses_D_ht+0x12168, %rdi
nop
nop
nop
nop
cmp $61934, %r13
mov $25, %rcx
rep movsb
nop
nop
nop
nop
add %r12, %r12
lea addresses_D_ht+0x1cef4, %rdi
nop
nop
nop
nop
nop
dec %r15
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
vmovups %ymm4, (%rdi)
sub $20529, %rax
lea addresses_WT_ht+0x1e390, %rsi
clflush (%rsi)
nop
sub %rdi, %rdi
movw $0x6162, (%rsi)
nop
nop
nop
nop
dec %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r8
push %r9
push %rbx
push %rcx
push %rdi
// Store
lea addresses_normal+0x1fe34, %r8
clflush (%r8)
nop
add $20795, %rbx
mov $0x5152535455565758, %rdi
movq %rdi, %xmm5
movups %xmm5, (%r8)
nop
nop
nop
nop
cmp $36573, %rcx
// Store
lea addresses_WC+0xf0f4, %r8
nop
nop
cmp %r9, %r9
movw $0x5152, (%r8)
xor %rdi, %rdi
// Faulty Load
lea addresses_US+0x12f4, %r10
clflush (%r10)
nop
nop
add $851, %rbx
mov (%r10), %r11d
lea oracles, %rbx
and $0xff, %r11
shlq $12, %r11
mov (%rbx,%r11,1), %r11
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 5, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 5, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 7, 'size': 1, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 1, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 8, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 9, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
generated/natools-s_expressions-printers-pretty-config-quoted_cmd.ads
|
faelys/natools
| 0 |
11308
|
package Natools.S_Expressions.Printers.Pretty.Config.Quoted_Cmd is
pragma Preelaborate;
function Hash (S : String) return Natural;
end Natools.S_Expressions.Printers.Pretty.Config.Quoted_Cmd;
|
src/main/fragment/mos6502-common/pwsc1_derefidx_vbuyy_lt_0_then_la1.asm
|
jbrandwood/kickc
| 2 |
175500
|
<filename>src/main/fragment/mos6502-common/pwsc1_derefidx_vbuyy_lt_0_then_la1.asm
lda {c1}+1,y
bmi {la1}
|
source/main/imath/int32compare.asm
|
paulscottrobson/6502-basic
| 3 |
17127
|
; *****************************************************************************
; *****************************************************************************
;
; Name: int32compare.asm
; Author: <NAME> (<EMAIL>)
; Date: 21st February 2021
; Reviewed: 7th March 2021
; Purpose: Simple 32 bit compare routines
;
; *****************************************************************************
; *****************************************************************************
.section code
; *****************************************************************************
;
; Compare two ints TOS, return $FF,$00,$01
; (non destructive of values)
;
; *****************************************************************************
MInt32Compare:
lda esInt0,x ; equality check first.
cmp esInt0+1,x
bne MInt32Compare2
lda esInt1,x
cmp esInt1+1,x
bne MInt32Compare2
lda esInt2,x
cmp esInt2+1,x
bne MInt32Compare2
lda esInt3,x
eor esInt3+1,x ; EOR will return 0 if the same.
bne MInt32Compare2
rts
;
; Different so subtract to work out larger
;
MInt32Compare2:
lda esInt0,x ; unsigned 32 bit comparison.
cmp esInt0+1,x
lda esInt1,x
sbc esInt1+1,x
lda esInt2,x
sbc esInt2+1,x
lda esInt3,x
sbc esInt3+1,x
bvc _I32LNoOverflow ; make it signed 32 bit comparison
eor #$80
_I32LNoOverflow
bmi MInt32CLess ; if -ve then return $FF
lda #$01 ; else return $01
rts
;
MInt32CLess:
lda #$FF
rts
.send code
; ************************************************************************************************
;
; Changes and Updates
;
; ************************************************************************************************
;
; Date Notes
; ==== =====
; 07-Mar-21 Pre code read v0.01
;
; ************************************************************************************************
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_147_215.asm
|
ljhsiun2/medusa
| 9 |
241691
|
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x9921, %rbp
nop
nop
nop
nop
cmp %rbx, %rbx
mov (%rbp), %rsi
nop
nop
nop
nop
and %r15, %r15
lea addresses_A_ht+0x19d41, %rdx
clflush (%rdx)
nop
nop
nop
cmp $44640, %r14
movw $0x6162, (%rdx)
nop
nop
nop
add $21561, %r13
lea addresses_D_ht+0x16e81, %r14
nop
nop
nop
sub %rdx, %rdx
mov (%r14), %rbp
xor %r15, %r15
lea addresses_normal_ht+0x1e601, %r14
nop
nop
nop
sub $223, %r15
mov (%r14), %r13d
nop
add $28929, %r15
lea addresses_A_ht+0x17f97, %r15
inc %rbp
mov $0x6162636465666768, %r13
movq %r13, %xmm0
movups %xmm0, (%r15)
add %r14, %r14
lea addresses_A_ht+0x17e81, %rdx
clflush (%rdx)
nop
add $20474, %r15
movl $0x61626364, (%rdx)
nop
inc %rbp
lea addresses_WT_ht+0xe106, %rsi
lea addresses_WC_ht+0xf481, %rdi
sub %r13, %r13
mov $2, %rcx
rep movsw
nop
inc %r14
lea addresses_WC_ht+0x10101, %rsi
lea addresses_WC_ht+0x12123, %rdi
nop
nop
nop
xor $10363, %r13
mov $78, %rcx
rep movsl
nop
xor %r14, %r14
lea addresses_D_ht+0x1ef95, %rsi
lea addresses_UC_ht+0xed91, %rdi
nop
nop
nop
cmp $42142, %rbx
mov $115, %rcx
rep movsq
nop
nop
sub %r15, %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r9
push %rbp
push %rcx
push %rdx
// Store
mov $0x484e7c0000000d01, %r14
nop
nop
nop
nop
cmp %rcx, %rcx
movl $0x51525354, (%r14)
nop
nop
nop
nop
sub %rbp, %rbp
// Store
lea addresses_WC+0x1c477, %r11
nop
nop
nop
nop
and %r10, %r10
movw $0x5152, (%r11)
dec %r9
// Faulty Load
lea addresses_D+0x18a81, %r14
nop
nop
nop
nop
nop
dec %rdx
movb (%r14), %r10b
lea oracles, %r14
and $0xff, %r10
shlq $12, %r10
mov (%r14,%r10,1), %r10
pop %rdx
pop %rcx
pop %rbp
pop %r9
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_D', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_D', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': True}, 'OP': 'REPM'}
{'36': 147}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
twix-header-grammar/XProtLexer.g4
|
davidrigie/twixreader
| 3 |
4558
|
/*
* LEXER RULES
*/
lexer grammar XProtLexer;
/////////////////////////////////////////////////////////
// --------------- DEFAULT MODE -----------------------//
/////////////////////////////////////////////////////////
fragment WS
: [ \t\r\n\u000C]+
;
WHITESPACE : WS -> skip;
fragment NAT : [0-9]+
;
fragment INT : '-'?NAT
;
fragment DOT : '.';
fragment NUMBER : INT('.'NAT+)? ('e' ('+' | '-') NAT)? ;
NUMBER_VALUE : NUMBER;
BOOL : '("true"|"false")'
;
fragment BEGIN_ASCCONV : '### ASCCONV BEGIN' .*? '###' ;
fragment END_ASCCONV : '### ASCCONV END ###';
ASCCONV_STRING : BEGIN_ASCCONV .*? END_ASCCONV;
fragment STRING : '"' (~["]|'""')* '"';
QUOTED_STRING : STRING;
fragment BRACED_CHARS : '{' ~[{}]* '}';
BURN_PROPERTY : ( ('<Default> ' NUMBER)
| ('<Default> ' STRING)
| ('<Precision> ' NUMBER)
| ('<MinSize> ' NUMBER)
| ('<MaxSize> ' NUMBER)
| ('<Comment> ' STRING)
| ('<Visible> ' STRING)
| ('<Tooltip> ' STRING)
| ('<Class> ' STRING)
| ('<Label> ' STRING)
| ('<Unit> ' STRING)
| ('<InFile> ' STRING)
| ('<Dll> ' STRING)
| ('<Repr> ' STRING)
| ('<LimitRange> ' BRACED_CHARS)
| ('<Limit> ' BRACED_CHARS)
)
-> skip
;
BURN_PARAM_CARD_LAYOUT : '<ParamCardLayout' .*? '>' WS
LEFT_BRACE WS
('<Repr>' WS STRING WS)*
('<Control>' WS BRACED_CHARS WS)*
('<Line>' WS BRACED_CHARS WS)*
RIGHT_BRACE
-> skip
;
BURN_DEPENDENCY : ('<Dependency.' | '<ProtocolComposer.') .*? '{' .*? '}' -> skip;
BRA : '<' -> pushMode(BRAKET);
KET : '>';
LEFT_BRACE : '{';
RIGHT_BRACE : '}';
DEFAULT : '<Default>';
ERROR_CHARACTER : .;
/////////////////////////////////////////////////////////
// ---------------INSIDE TAG --- ----------------------//
/////////////////////////////////////////////////////////
mode BRAKET;
PARAM_MAP_TAG_TYPE : 'ParamMap'
| 'Pipe'
| 'PipeService'
| 'ParamFunctor'
;
PARAM_ARRAY_TAG_TYPE : 'ParamArray';
XPROTOCOL : 'XProtocol';
SPECIAL_TAG_TYPE : 'Name'
| 'ID'
| 'Userversion'
;
EVASTRINGTABLE : 'EVAStringTable' -> mode(EVA);
fragment TAGTYPE_CHAR : [a-zA-Z0-9_];
TAG_TYPE : TAGTYPE_CHAR+;
TAG_DOT : '.';
TAG_NAME : QUOTED_STRING;
KET_CLOSE : '>' -> popMode,type(KET);
/////////////////////////////////////////////////////////
// ---------------EVA STRING TABLE --------------------//
/////////////////////////////////////////////////////////
mode EVA;
EVA_WHITESPACE : [ \t\r\n\u000C]+ -> skip;
EVA_LEFT_BRACE : '{' -> type(LEFT_BRACE),pushMode(EVASTRINGTABLE_CONTENTS);
EVA_RIGHT_BRACE : '}' -> type(RIGHT_BRACE),mode(DEFAULT_MODE);
EVA_KET_CLOSE : '>' -> type(KET);
mode EVASTRINGTABLE_CONTENTS;
STRING_TABLE : ~[{}]+ -> popMode;
|
src/generated/event_h.ads
|
csb6/libtcod-ada
| 0 |
10852
|
pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
limited with console_types_h;
with sys_h;
limited with mouse_types_h;
package event_h is
-- BSD 3-Clause License
-- *
-- * Copyright © 2008-2021, Jice and the libtcod contributors.
-- * 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. Neither the name of the copyright holder nor the names of its
-- * contributors may be used to endorse or promote products derived from
-- * this software without specific prior written permission.
-- *
-- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- * POSSIBILITY OF SUCH DAMAGE.
--
type SDL_Event is null record; -- incomplete struct
--*
-- * Parse an SDL_Event into a key event and return the relevant TCOD_event_t.
-- *
-- * Returns TCOD_EVENT_NONE if the event wasn't keyboard related.
-- * \rst
-- * .. versionadded:: 1.11
-- * \endrst
--
--*
-- * Parse an SDL_Event into a mouse event and return the relevant TCOD_event_t.
-- *
-- * Returns TCOD_EVENT_NONE if the event wasn't mouse related.
-- * \rst
-- * .. versionadded:: 1.11
-- * \endrst
--
-- namespace sdl2
-- namespace tcod
--*
-- * Parse an SDL_Event into a key event and return the relevant TCOD_event_t.
-- *
-- * Returns TCOD_EVENT_NONE if the event wasn't keyboard related.
-- * \rst
-- * .. versionadded:: 1.11
-- * \endrst
--
function TCOD_sys_process_key_event (c_in : access constant SDL_Event; c_out : access console_types_h.TCOD_key_t) return sys_h.TCOD_event_t -- sdl2/event.h:75
with Import => True,
Convention => C,
External_Name => "TCOD_sys_process_key_event";
--*
-- * Parse an SDL_Event into a mouse event and return the relevant TCOD_event_t.
-- *
-- * Returns TCOD_EVENT_NONE if the event wasn't mouse related.
-- * \rst
-- * .. versionadded:: 1.11
-- * \endrst
--
function TCOD_sys_process_mouse_event (c_in : access constant SDL_Event; c_out : access mouse_types_h.TCOD_mouse_t) return sys_h.TCOD_event_t -- sdl2/event.h:85
with Import => True,
Convention => C,
External_Name => "TCOD_sys_process_mouse_event";
end event_h;
|
programs/oeis/231/A231686.asm
|
jmorken/loda
| 1 |
7589
|
; A231686: a(n) = Sum_{i=0..n} digsum_9(i)^3, where digsum_9(i) = A053830(i).
; 0,1,9,36,100,225,441,784,1296,1297,1305,1332,1396,1521,1737,2080,2592,3321,3329,3356,3420,3545,3761,4104,4616,5345,6345,6372,6436,6561,6777,7120,7632,8361,9361,10692,10756,10881,11097,11440,11952,12681,13681,15012,16740,16865,17081,17424,17936,18665,19665,20996,22724,24921,25137,25480,25992,26721,27721,29052
mov $2,$0
mov $4,$0
lpb $4
mov $0,$2
sub $4,1
sub $0,$4
mov $3,$0
div $0,9
mod $3,9
add $3,$0
pow $3,3
add $1,$3
lpe
|
regtests/util-processes-tests.ads
|
yrashk/ada-util
| 0 |
1850
|
<reponame>yrashk/ada-util
-----------------------------------------------------------------------
-- util-processes-tests - Test for processes
-- Copyright (C) 2011, 2016, 2018, 2019, 2021 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Tests;
package Util.Processes.Tests is
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite);
type Test is new Util.Tests.Test with null record;
-- Tests when the process is not launched
procedure Test_No_Process (T : in out Test);
-- Test executing a process
procedure Test_Spawn (T : in out Test);
-- Test output pipe redirection: read the process standard output
procedure Test_Output_Pipe (T : in out Test);
-- Test input pipe redirection: write the process standard input
procedure Test_Input_Pipe (T : in out Test);
-- Test error pipe redirection: read the process standard error
procedure Test_Error_Pipe (T : in out Test);
-- Test shell splitting.
procedure Test_Shell_Splitting_Pipe (T : in out Test);
-- Test launching several processes through pipes in several threads.
procedure Test_Multi_Spawn (T : in out Test);
-- Test output file redirection.
procedure Test_Output_Redirect (T : in out Test);
-- Test input file redirection.
procedure Test_Input_Redirect (T : in out Test);
-- Test changing working directory.
procedure Test_Set_Working_Directory (T : in out Test);
-- Test various errors.
procedure Test_Errors (T : in out Test);
-- Test launching and stopping a process.
procedure Test_Stop (T : in out Test);
-- Test various errors (pipe streams).
procedure Test_Pipe_Errors (T : in out Test);
-- Test launching and stopping a process (pipe streams).
procedure Test_Pipe_Stop (T : in out Test);
-- Test the Tools.Execute operation.
procedure Test_Tools_Execute (T : in out Test);
end Util.Processes.Tests;
|
oeis/266/A266613.asm
|
neoneye/loda-programs
| 11 |
19429
|
<reponame>neoneye/loda-programs
; A266613: Decimal representation of the middle column of the "Rule 41" elementary cellular automaton starting with a single ON (black) cell.
; 1,2,5,10,20,41,82,165,330,661,1322,2645,5290,10581,21162,42325,84650,169301,338602,677205,1354410,2708821,5417642,10835285,21670570,43341141,86682282,173364565,346729130,693458261,1386916522,2773833045,5547666090,11095332181,22190664362,44381328725,88762657450,177525314901,355050629802,710101259605,1420202519210,2840405038421,5680810076842,11361620153685,22723240307370,45446480614741,90892961229482,181785922458965,363571844917930,727143689835861,1454287379671722,2908574759343445
mov $1,11
lpb $0
sub $0,1
add $1,10
mov $2,$1
mul $1,2
lpe
mov $0,$2
div $0,12
add $0,1
|
programs/oeis/204/A204437.asm
|
karttu/loda
| 0 |
170128
|
; A204437: Symmetric matrix: f(i,j)=((i+j+1)^2 mod 3), by (constant) antidiagonals.
; 0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1
lpb $0,1
sub $0,1
add $1,$3
trn $1,1
add $2,3
add $2,$1
sub $2,1
sub $0,$2
trn $0,$2
mov $1,3
sub $1,$0
trn $1,2
mov $3,$2
sub $2,$2
add $3,2
trn $0,$3
lpe
|
Palmtree.Math.Core.Implements/vs_build/x86_Debug/pmc_to.asm
|
rougemeilland/Palmtree.Math.Core.Implements
| 0 |
17981
|
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1
TITLE Z:\Sources\Lunor\Repos\rougemeilland\Palmtree.Math.Core.Implements\Palmtree.Math.Core.Implements\pmc_to.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB MSVCRTD
INCLUDELIB OLDNAMES
msvcjmc SEGMENT
__7B7A869E_ctype@h DB 01H
__457DD326_basetsd@h DB 01H
__4384A2D9_corecrt_memcpy_s@h DB 01H
__4E51A221_corecrt_wstring@h DB 01H
__2140C079_string@h DB 01H
__1887E595_winnt@h DB 01H
__9FC7C64B_processthreadsapi@h DB 01H
__FA470AEC_memoryapi@h DB 01H
__F37DAFF1_winerror@h DB 01H
__7A450CCC_winbase@h DB 01H
__B4B40122_winioctl@h DB 01H
__86261D59_stralign@h DB 01H
__7B8DBFC3_pmc_uint_internal@h DB 01H
__6B0481B0_pmc_inline_func@h DB 01H
__83853269_pmc_to@c DB 01H
msvcjmc ENDS
PUBLIC _Initialize_To
PUBLIC _PMC_To_X_I@8
PUBLIC _PMC_To_X_L@8
PUBLIC __JustMyCode_Default
EXTRN _CheckNumber:PROC
EXTRN @__CheckForDebuggerJustMyCode@4:PROC
EXTRN __RTC_CheckEsp:PROC
EXTRN __RTC_InitBase:PROC
EXTRN __RTC_Shutdown:PROC
EXTRN __allshl:PROC
; COMDAT rtc$TMZ
rtc$TMZ SEGMENT
__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown
rtc$TMZ ENDS
; COMDAT rtc$IMZ
rtc$IMZ SEGMENT
__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase
rtc$IMZ ENDS
; Function compile flags: /Odt
; COMDAT __JustMyCode_Default
_TEXT SEGMENT
__JustMyCode_Default PROC ; COMDAT
push ebp
mov ebp, esp
pop ebp
ret 0
__JustMyCode_Default ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_inline_func.h
_TEXT SEGMENT
_value_high$ = 8 ; size = 4
_value_low$ = 12 ; size = 4
__FROMWORDTODWORD PROC
; 177 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __6B0481B0_pmc_inline_func@h
call @__CheckForDebuggerJustMyCode@4
; 178 : return (((_UINT64_T)value_high << 32) | value_low);
xor edx, edx
mov eax, DWORD PTR _value_high$[ebp]
mov cl, 32 ; 00000020H
call __allshl
xor ecx, ecx
or eax, DWORD PTR _value_low$[ebp]
or edx, ecx
; 179 : }
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
__FROMWORDTODWORD ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_to.c
_TEXT SEGMENT
_result$ = -8 ; size = 4
_np$ = -4 ; size = 4
_p$ = 8 ; size = 4
_o$ = 12 ; size = 4
_PMC_To_X_L@8 PROC
; 59 : {
push ebp
mov ebp, esp
sub esp, 8
mov DWORD PTR [ebp-8], -858993460 ; ccccccccH
mov DWORD PTR [ebp-4], -858993460 ; ccccccccH
mov ecx, OFFSET __83853269_pmc_to@c
call @__CheckForDebuggerJustMyCode@4
; 60 : if (sizeof(__UNIT_TYPE) * 2 < sizeof(*o))
xor eax, eax
je SHORT $LN2@PMC_To_X_L
; 61 : {
; 62 : // 32bit未満のCPUは未対応
; 63 : return (PMC_STATUS_NOT_SUPPORTED);
mov eax, -6 ; fffffffaH
jmp $LN1@PMC_To_X_L
$LN2@PMC_To_X_L:
; 64 : }
; 65 : NUMBER_HEADER* np = (NUMBER_HEADER*)p;
mov ecx, DWORD PTR _p$[ebp]
mov DWORD PTR _np$[ebp], ecx
; 66 : PMC_STATUS_CODE result;
; 67 : if ((result = CheckNumber(np)) != PMC_STATUS_OK)
mov edx, DWORD PTR _np$[ebp]
push edx
call _CheckNumber
add esp, 4
mov DWORD PTR _result$[ebp], eax
cmp DWORD PTR _result$[ebp], 0
je SHORT $LN3@PMC_To_X_L
; 68 : return (result);
mov eax, DWORD PTR _result$[ebp]
jmp $LN1@PMC_To_X_L
$LN3@PMC_To_X_L:
; 69 : if (np->UNIT_BIT_COUNT > sizeof(*o) * 8)
mov eax, DWORD PTR _np$[ebp]
cmp DWORD PTR [eax+12], 64 ; 00000040H
jbe SHORT $LN4@PMC_To_X_L
; 70 : return (PMC_STATUS_OVERFLOW);
mov eax, -2 ; fffffffeH
jmp $LN1@PMC_To_X_L
$LN4@PMC_To_X_L:
; 71 : if (np->IS_ZERO)
mov ecx, DWORD PTR _np$[ebp]
mov edx, DWORD PTR [ecx+24]
shr edx, 1
and edx, 1
je SHORT $LN5@PMC_To_X_L
; 72 : {
; 73 : *o = 0;
mov eax, DWORD PTR _o$[ebp]
mov DWORD PTR [eax], 0
mov DWORD PTR [eax+4], 0
; 74 : return (PMC_STATUS_OK);
xor eax, eax
jmp SHORT $LN1@PMC_To_X_L
$LN5@PMC_To_X_L:
; 75 : }
; 76 : if (np->UNIT_BIT_COUNT <= __UNIT_TYPE_BIT_COUNT)
mov ecx, DWORD PTR _np$[ebp]
cmp DWORD PTR [ecx+12], 32 ; 00000020H
ja SHORT $LN6@PMC_To_X_L
; 77 : {
; 78 : // 値が 1 ワードで表現できる場合
; 79 : *o = np->BLOCK[0];
mov edx, 4
imul eax, edx, 0
mov ecx, DWORD PTR _np$[ebp]
mov edx, DWORD PTR [ecx+32]
mov eax, DWORD PTR [edx+eax]
xor ecx, ecx
mov edx, DWORD PTR _o$[ebp]
mov DWORD PTR [edx], eax
mov DWORD PTR [edx+4], ecx
; 80 : return (PMC_STATUS_OK);
xor eax, eax
jmp SHORT $LN1@PMC_To_X_L
; 81 : }
jmp SHORT $LN1@PMC_To_X_L
$LN6@PMC_To_X_L:
; 82 : else if (np->UNIT_BIT_COUNT <= __UNIT_TYPE_BIT_COUNT * 2)
mov eax, DWORD PTR _np$[ebp]
cmp DWORD PTR [eax+12], 64 ; 00000040H
ja SHORT $LN8@PMC_To_X_L
; 83 : {
; 84 : // 値が 2 ワードで表現できる場合
; 85 : *o = _FROMWORDTODWORD((_UINT32_T)np->BLOCK[1], (_UINT32_T)np->BLOCK[0]);
mov ecx, 4
imul edx, ecx, 0
mov eax, DWORD PTR _np$[ebp]
mov ecx, DWORD PTR [eax+32]
mov edx, DWORD PTR [ecx+edx]
push edx
mov eax, 4
shl eax, 0
mov ecx, DWORD PTR _np$[ebp]
mov edx, DWORD PTR [ecx+32]
mov eax, DWORD PTR [edx+eax]
push eax
call __FROMWORDTODWORD
add esp, 8
mov ecx, DWORD PTR _o$[ebp]
mov DWORD PTR [ecx], eax
mov DWORD PTR [ecx+4], edx
; 86 : return (PMC_STATUS_OK);
xor eax, eax
jmp SHORT $LN1@PMC_To_X_L
; 87 : }
jmp SHORT $LN1@PMC_To_X_L
$LN8@PMC_To_X_L:
; 88 : else
; 89 : return (PMC_STATUS_ARGUMENT_ERROR);
or eax, -1
$LN1@PMC_To_X_L:
; 90 : }
add esp, 8
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 8
_PMC_To_X_L@8 ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_to.c
_TEXT SEGMENT
_result$ = -8 ; size = 4
_np$ = -4 ; size = 4
_p$ = 8 ; size = 4
_o$ = 12 ; size = 4
_PMC_To_X_I@8 PROC
; 39 : {
push ebp
mov ebp, esp
sub esp, 8
mov DWORD PTR [ebp-8], -858993460 ; ccccccccH
mov DWORD PTR [ebp-4], -858993460 ; ccccccccH
mov ecx, OFFSET __83853269_pmc_to@c
call @__CheckForDebuggerJustMyCode@4
; 40 : if (sizeof(__UNIT_TYPE) < sizeof(*o))
xor eax, eax
je SHORT $LN2@PMC_To_X_I
; 41 : {
; 42 : // 32bit未満のCPUは未対応
; 43 : return (PMC_STATUS_NOT_SUPPORTED);
mov eax, -6 ; fffffffaH
jmp SHORT $LN1@PMC_To_X_I
$LN2@PMC_To_X_I:
; 44 : }
; 45 : NUMBER_HEADER* np = (NUMBER_HEADER*)p;
mov ecx, DWORD PTR _p$[ebp]
mov DWORD PTR _np$[ebp], ecx
; 46 : PMC_STATUS_CODE result;
; 47 : if ((result = CheckNumber(np)) != PMC_STATUS_OK)
mov edx, DWORD PTR _np$[ebp]
push edx
call _CheckNumber
add esp, 4
mov DWORD PTR _result$[ebp], eax
cmp DWORD PTR _result$[ebp], 0
je SHORT $LN3@PMC_To_X_I
; 48 : return (result);
mov eax, DWORD PTR _result$[ebp]
jmp SHORT $LN1@PMC_To_X_I
$LN3@PMC_To_X_I:
; 49 : if (np->UNIT_BIT_COUNT > sizeof(*o) * 8)
mov eax, DWORD PTR _np$[ebp]
cmp DWORD PTR [eax+12], 32 ; 00000020H
jbe SHORT $LN4@PMC_To_X_I
; 50 : return (PMC_STATUS_OVERFLOW);
mov eax, -2 ; fffffffeH
jmp SHORT $LN1@PMC_To_X_I
$LN4@PMC_To_X_I:
; 51 : if (np->IS_ZERO)
mov ecx, DWORD PTR _np$[ebp]
mov edx, DWORD PTR [ecx+24]
shr edx, 1
and edx, 1
je SHORT $LN5@PMC_To_X_I
; 52 : *o = 0;
mov eax, DWORD PTR _o$[ebp]
mov DWORD PTR [eax], 0
jmp SHORT $LN6@PMC_To_X_I
$LN5@PMC_To_X_I:
; 53 : else
; 54 : *o = (_UINT32_T)np->BLOCK[0];
mov ecx, 4
imul edx, ecx, 0
mov eax, DWORD PTR _np$[ebp]
mov ecx, DWORD PTR [eax+32]
mov eax, DWORD PTR _o$[ebp]
mov ecx, DWORD PTR [edx+ecx]
mov DWORD PTR [eax], ecx
$LN6@PMC_To_X_I:
; 55 : return (PMC_STATUS_OK);
xor eax, eax
$LN1@PMC_To_X_I:
; 56 : }
add esp, 8
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 8
_PMC_To_X_I@8 ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_to.c
_TEXT SEGMENT
_feature$ = 8 ; size = 4
_Initialize_To PROC
; 93 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __83853269_pmc_to@c
call @__CheckForDebuggerJustMyCode@4
; 94 : return (PMC_STATUS_OK);
xor eax, eax
; 95 : }
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
_Initialize_To ENDP
_TEXT ENDS
END
|
Sources/Library/quaternions.adb
|
ForYouEyesOnly/Space-Convoy
| 1 |
16428
|
--
-- Jan & <NAME>, Australia, July 2011
--
with Ada.Numerics.Generic_Elementary_Functions;
package body Quaternions is
package Elementary_Functions is new Ada.Numerics.Generic_Elementary_Functions (Real);
use Elementary_Functions;
--
function "abs" (Quad : Quaternion_Real) return Real is
(Sqrt (Quad.w**2 + Quad.x**2 + Quad.y**2 + Quad.z**2));
function Unit (Quad : Quaternion_Real) return Quaternion_Real is
(Quad / abs (Quad));
function Conj (Quad : Quaternion_Real) return Quaternion_Real is
(w => Quad.w, x => -Quad.x, y => -Quad.y, z => -Quad.z);
function "-" (Quad : Quaternion_Real) return Quaternion_Real is
(w => -Quad.w, x => -Quad.x, y => -Quad.y, z => -Quad.z);
function "+" (Left, Right : Quaternion_Real) return Quaternion_Real is
(w => Left.w + Right.w, x => Left.x + Right.x,
y => Left.y + Right.y, z => Left.z + Right.z);
function "-" (Left, Right : Quaternion_Real) return Quaternion_Real is
(w => Left.w - Right.w, x => Left.x - Right.x,
y => Left.y - Right.y, z => Left.z - Right.z);
function "*" (Left : Quaternion_Real; Right : Real) return Quaternion_Real is
(w => Left.w * Right, x => Left.x * Right,
y => Left.y * Right, z => Left.z * Right);
function "*" (Left : Real; Right : Quaternion_Real) return Quaternion_Real is (Right * Left);
function "/" (Left : Quaternion_Real; Right : Real) return Quaternion_Real is
(w => Left.w / Right, x => Left.x / Right,
y => Left.y / Right, z => Left.z / Right);
function "/" (Left : Real; Right : Quaternion_Real) return Quaternion_Real is (Right / Left);
function "*" (Left, Right : Quaternion_Real) return Quaternion_Real is
(w => Left.w * Right.w - Left.x * Right.x - Left.y * Right.y - Left.z * Right.z,
x => Left.w * Right.x + Left.x * Right.w + Left.y * Right.z - Left.z * Right.y,
y => Left.w * Right.y - Left.x * Right.z + Left.y * Right.w + Left.z * Right.x,
z => Left.w * Right.z + Left.x * Right.y - Left.y * Right.x + Left.z * Right.w);
function "/" (Left, Right : Quaternion_Real) return Quaternion_Real is
(w => Left.w * Right.w + Left.x * Right.x + Left.y * Right.y + Left.z * Right.z,
x => Left.w * Right.x - Left.x * Right.w - Left.y * Right.z + Left.z * Right.y,
y => Left.w * Right.y + Left.x * Right.z - Left.y * Right.w - Left.z * Right.x,
z => Left.w * Right.z - Left.x * Right.y + Left.y * Right.x - Left.z * Right.w);
function Image (Quad : Quaternion_Real) return String is
(Real'Image (Quad.w) & " +" &
Real'Image (Quad.x) & "i +" &
Real'Image (Quad.y) & "j +" &
Real'Image (Quad.z) & "k");
--
end Quaternions;
|
src/test/resources/data/generationtests/tniasm-error.asm
|
cpcitor/mdlz80optimizer
| 0 |
13133
|
; Test case:
%error "ips_cls offset address is too big!"
|
models/tests/test37.als
|
transclosure/Amalgam
| 4 |
2700
|
module tests/test
open util/seqrel[B] as sq
abstract sig B {}
one sig B1,B2,B3,B4,B5 extends B {}
fact { some S1,S2,S3,T1,T2,T3,T4:SeqIdx->B | {
isSeq[S1] isSeq[S2] isSeq[S3]
isSeq[T1] isSeq[T2] isSeq[T3] isSeq[T4]
#S1=1
#S2=2
#rest[S3]=2
#elems[S3]=2
#butlast[S3]=2
first[S3] != last[S1]
hasDups[S3]
lastIdx[S1] != lastIdx[S3]
afterLastIdx[S1] in inds[S3]
some idxOf[S3, B2]
no lastIdxOf[S3, B3]
some indsOf[S3, B2]
S3=S2.add[B5]
T1=S1.insert[firstIdx,B1]
T2=T1.delete[firstIdx]
T3=T1.append[T2]
T4=T3.subseq[sq/next[firstIdx],sq/next[sq/next[firstIdx]]]
}}
run {} for 3 int, 3 SeqIdx, exactly 5 B expect 1
|
src/eedata.asm
|
staskevich/UMR2
| 27 |
506
|
; UMR2
; copyright <NAME>, 2017
; <EMAIL>
;
; This work is licensed under a Creative Commons Attribution 4.0 International License.
; http://creativecommons.org/licenses/by/4.0/
;
; eedata.asm
;
; Data eeprom initial values
;
list p=16F1939
#include <p16f1939.inc>
; =================================
;
; EEPROM initial values
;
; =================================
eedata code 0xF000
; Version
data 0x00
; Checksum
data 0x31
data 0x87
; Channel
data 0x00
; First Note
data 0x00
; Last Note
data 0x00
; Setup Count
data 0x00
; Reserved (248 bytes)
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
data 0x00
end
|
source/adam-comment.adb
|
charlie5/aIDE
| 3 |
1565
|
<filename>source/adam-comment.adb
with
AdaM.Factory;
package body AdaM.Comment
is
-- Storage Pool
--
record_Version : constant := 1;
max_Comments : constant := 5_000;
package Pool is new AdaM.Factory.Pools (".adam-store",
"comments",
max_Comments,
record_Version,
Comment.item,
Comment.view);
-- Forge
--
procedure define (Self : in out Item)
is
begin
null;
end define;
procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
function new_Comment return View
is
new_View : constant Comment.view := Pool.new_Item;
begin
define (Comment.item (new_View.all));
return new_View;
end new_Comment;
procedure free (Self : in out Comment.view)
is
begin
destruct (Comment.item (Self.all));
Pool.free (Self);
end free;
-- Attributes
--
overriding
function Name (Self : in Item) return Identifier
is
pragma Unreferenced (Self);
begin
return "a_Comment";
end Name;
overriding
function Id (Self : access Item) return AdaM.Id
is
begin
return Pool.to_Id (Self);
end Id;
function Lines (Self : in Item) return text_Lines
is
begin
return Self.Lines;
end Lines;
procedure Lines_are (Self : in out Item; Now : in text_Lines)
is
begin
Self.Lines := Now;
end Lines_are;
overriding
function to_Source (Self : in Item) return text_Vectors.Vector
is
the_Source : text_Vectors.Vector;
begin
for i in 1 .. Self.Lines.Length
loop
declare
the_Line : Text renames Self.Lines.Element (Integer (i));
begin
the_Source.append ("-- " & the_Line);
end;
end loop;
return the_Source;
end to_Source;
-- Streams
--
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View)
renames Pool.View_write;
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View)
renames Pool.View_read;
end AdaM.Comment;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_602.asm
|
ljhsiun2/medusa
| 9 |
12158
|
<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_602.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r15
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xcae7, %rdi
nop
nop
and $5699, %r8
movb (%rdi), %r13b
and %rax, %rax
lea addresses_A_ht+0x4648, %r10
nop
nop
nop
nop
and $23361, %r14
mov (%r10), %r15w
nop
nop
xor $59452, %rdi
lea addresses_WT_ht+0x19258, %r15
nop
nop
nop
nop
inc %r13
movups (%r15), %xmm6
vpextrq $1, %xmm6, %r10
nop
nop
nop
nop
xor $16837, %r14
lea addresses_A_ht+0x39fa, %rsi
lea addresses_normal_ht+0x179c8, %rdi
nop
nop
nop
nop
xor %rax, %rax
mov $32, %rcx
rep movsb
nop
cmp %r10, %r10
lea addresses_A_ht+0x3318, %r10
nop
nop
nop
nop
nop
and $44514, %r14
movb (%r10), %r8b
nop
cmp %r8, %r8
lea addresses_UC_ht+0x1a248, %rsi
and %r10, %r10
mov (%rsi), %r15w
sub %rax, %rax
lea addresses_WT_ht+0x1193c, %rsi
lea addresses_normal_ht+0x1df79, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
cmp %r10, %r10
mov $105, %rcx
rep movsb
nop
nop
add $29582, %r8
lea addresses_WC_ht+0x15e88, %r10
clflush (%r10)
nop
and $45864, %rax
movb (%r10), %r13b
nop
nop
nop
nop
nop
sub $58827, %r8
lea addresses_normal_ht+0x17508, %r14
nop
nop
sub $63477, %r8
movb $0x61, (%r14)
nop
nop
nop
nop
xor %rax, %rax
lea addresses_WT_ht+0x4b28, %rsi
lea addresses_normal_ht+0x1cfc8, %rdi
clflush (%rsi)
nop
nop
nop
nop
and %r15, %r15
mov $53, %rcx
rep movsl
nop
nop
nop
nop
nop
add $12545, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r8
push %rcx
push %rdx
push %rsi
// Store
lea addresses_D+0x6f78, %r12
nop
nop
sub %r10, %r10
movw $0x5152, (%r12)
nop
dec %rdx
// Store
lea addresses_WC+0x17542, %r11
clflush (%r11)
nop
nop
nop
nop
add %rdx, %rdx
movl $0x51525354, (%r11)
add $57609, %rcx
// Store
lea addresses_A+0x1a248, %r10
nop
nop
nop
nop
cmp %r12, %r12
movw $0x5152, (%r10)
cmp %rdx, %rdx
// Load
lea addresses_D+0x2068, %r10
nop
nop
nop
sub %r11, %r11
movb (%r10), %cl
nop
nop
add $4740, %r12
// Faulty Load
lea addresses_D+0xf848, %r11
nop
nop
nop
xor $46489, %rsi
movups (%r11), %xmm0
vpextrq $0, %xmm0, %r8
lea oracles, %rdx
and $0xff, %r8
shlq $12, %r8
mov (%rdx,%r8,1), %r8
pop %rsi
pop %rdx
pop %rcx
pop %r8
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}, 'dst': {'same': True, 'congruent': 0, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 3, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
programs/oeis/004/A004760.asm
|
neoneye/loda
| 22 |
247743
|
<gh_stars>10-100
; A004760: List of numbers whose binary expansion does not begin 10.
; 0,1,3,6,7,12,13,14,15,24,25,26,27,28,29,30,31,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226
mov $2,$0
lpb $0
mov $0,$2
sub $0,$1
trn $0,1
add $1,$2
sub $1,$0
lpe
mov $0,$1
|
oeis/055/A055779.asm
|
neoneye/loda-programs
| 11 |
247068
|
; A055779: Number of fat trees on n labeled vertices.
; Submitted by <NAME>
; 1,2,10,89,1156,19897,428002,11067457,334667368,11593751921,452892057454,19699549177585,944416040000044,49480473036710185,2812998429218735986,172475808692526176513,11345688093224067380176,797061449235413571104737,59561550009489127251893590,4717456190161796770946771761,394765592493160399700290015636,34803568687024173685914448094297,3224377474150276176813891751516954,313180196566061686100446602043006273,31823503410989668107475493551420646776,3376483900501134003640117024477080223057
mov $4,$0
add $4,1
lpb $0
sub $0,1
mov $2,$4
sub $2,$1
pow $2,$1
mov $3,$4
bin $3,$1
add $1,1
mul $3,$2
mul $5,$4
add $5,$3
lpe
mov $0,$5
add $0,1
|
test/asm/segclash.asm
|
nigelperks/BasicAssembler
| 0 |
172218
|
; Test clashing segment properties
IDEAL
; defaulting to private
SEGMENT SEG1
ENDS
SEGMENT SEG1 PUBLIC
ENDS
SEGMENT SEG1 STACK
ENDS
SEGMENT SEG1 PRIVATE
ENDS
SEGMENT SEG1
ENDS
; explicitly private
SEGMENT SEG2 PRIVATE
ENDS
SEGMENT SEG2 PUBLIC
ENDS
SEGMENT SEG2 STACK
ENDS
SEGMENT SEG2 PRIVATE
ENDS
SEGMENT SEG2
ENDS
; public
SEGMENT SEG3 PUBLIC
ENDS
SEGMENT SEG3 PRIVATE
ENDS
SEGMENT SEG3 STACK
ENDS
SEGMENT SEG3 PUBLIC
ENDS
SEGMENT SEG3
ENDS
; stack
SEGMENT SEG4 STACK
ENDS
SEGMENT SEG4 PRIVATE
ENDS
SEGMENT SEG4 PUBLIC
ENDS
SEGMENT SEG4 STACK
ENDS
SEGMENT SEG4
ENDS
END
|
applescript/getram.applescript
|
jtraver/dev
| 0 |
588
|
<filename>applescript/getram.applescript
on getRam()
set bytes to system attribute "ram "
return bytes div (2 ^ 20)
end getRam
display dialog "You have " & getRam() & "MB of RAM. Wow!"
|
workers-reporting.adb
|
annexi-strayline/AURA
| 13 |
19459
|
<reponame>annexi-strayline/AURA
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- Core --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2019, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME> (ANNEXI-STRAYLINE) --
-- --
-- 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 copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- 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. --
-- --
------------------------------------------------------------------------------
with Ada.Containers.Synchronized_Queue_Interfaces;
with Ada.Containers.Unbounded_Synchronized_Queues;
package body Workers.Reporting is
------------------
-- Report_Queue --
------------------
package SQI is new Ada.Containers.Synchronized_Queue_Interfaces
(Element_Type => Work_Report);
package USQ is new Ada.Containers.Unbounded_Synchronized_Queues
(Queue_Interfaces => SQI);
Report_Queue: USQ.Queue;
-------------------
-- Submit_Report --
-------------------
procedure Submit_Report (Report: Work_Report) is
begin
Report_Queue.Enqueue (Report);
end Submit_Report;
-----------------------
-- Available_Reports --
-----------------------
function Available_Reports return Count_Type is
(Report_Queue.Current_Use);
---------------------
-- Retrieve_Report --
---------------------
function Retrieve_Report return Work_Report is
begin
return Report: Work_Report do
Report_Queue.Dequeue (Report);
end return;
end Retrieve_Report;
end Workers.Reporting;
|
Cubical/Data/FinData/Base.agda
|
dan-iel-lee/cubical
| 0 |
10846
|
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Data.FinData.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
import Cubical.Data.Empty as ⊥
open import Cubical.Data.Nat using (ℕ; zero; suc)
open import Cubical.Data.Bool.Base
open import Cubical.Relation.Nullary
private
variable
ℓ : Level
A B : Type ℓ
data Fin : ℕ → Type₀ where
zero : {n : ℕ} → Fin (suc n)
suc : {n : ℕ} (i : Fin n) → Fin (suc n)
toℕ : ∀ {n} → Fin n → ℕ
toℕ zero = 0
toℕ (suc i) = suc (toℕ i)
fromℕ : (n : ℕ) → Fin (suc n)
fromℕ zero = zero
fromℕ (suc n) = suc (fromℕ n)
¬Fin0 : ¬ Fin 0
¬Fin0 ()
_==_ : ∀ {n} → Fin n → Fin n → Bool
zero == zero = true
zero == suc _ = false
suc _ == zero = false
suc m == suc n = m == n
predFin : {n : ℕ} → Fin (suc (suc n)) → Fin (suc n)
predFin zero = zero
predFin (suc x) = x
foldrFin : ∀ {n} → (A → B → B) → B → (Fin n → A) → B
foldrFin {n = zero} _ b _ = b
foldrFin {n = suc n} f b l = f (l zero) (foldrFin f b (l ∘ suc))
elim
: ∀(P : ∀{k} → Fin k → Type ℓ)
→ (∀{k} → P {suc k} zero)
→ (∀{k} → {fn : Fin k} → P fn → P (suc fn))
→ {k : ℕ} → (fn : Fin k) → P fn
elim P fz fs {zero} = ⊥.rec ∘ ¬Fin0
elim P fz fs {suc k} zero = fz
elim P fz fs {suc k} (suc fj) = fs (elim P fz fs fj)
rec : ∀{k} → (a0 aS : A) → Fin k → A
rec a0 aS zero = a0
rec a0 aS (suc x) = aS
|
apple/events.applescript
|
quentinguidee/todo-cli
| 4 |
4429
|
<filename>apple/events.applescript
set duration to (read POSIX file "apple/duration") as integer
set event_name to (read POSIX file "apple/name")
set endDate to (current date)
set startDate to endDate - duration
tell application "Calendar"
tell calendar "Work"
make new event with properties {summary:event_name, start date:startDate, end date:endDate}
end tell
end tell
|
test/Compiler/special/ExportTestAgda.agda
|
redfish64/autonomic-agda
| 1 |
3194
|
module ExportTestAgda where
open import Common.Prelude
itWorksText : String
itWorksText = "It works!"
{-# COMPILED_EXPORT itWorksText itWorksText #-}
|
src/agen.adb
|
psyomn/agen
| 1 |
24238
|
-- Copyright 2014-2019 <NAME> (psyomn), <NAME> (entomy)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Directories; use Ada.Directories;
with GNAT.OS_Lib; use GNAT.OS_Lib;
package body Agen is
function Sanitize_Name(Source : String) return String is
subtype Invalid_Chars is Character with Dynamic_Predicate => Invalid_Chars = '-' and Invalid_Chars = '.';
Result : String := Source;
begin
for I in Result'First .. Result'Last loop
if Result(I) in Invalid_Chars then
Result(I) := '_';
end if;
end Loop;
return Result;
end Sanitize_Name;
function Try_Parse(Candidate : String; Result : out Parameter) return Boolean is
Split_Point : Positive := 1;
begin
--First we have to find where the : is
for I in 1 .. Candidate'Length loop
if Candidate(I) = ':' then
Split_Point := I;
end if;
end loop;
--if Split_Point is 1, we know a ':' was either never found, or found at the very beginging. Both of which are incorrect
if Split_Point = 1 then
return False;
end if;
Result := Parameter'(
Name => To_Unbounded_String(Candidate(Candidate'First .. Split_Point - 1)),
Of_Type => To_Unbounded_String(Candidate(Split_Point + 1 .. Candidate'Last)));
return True;
end Try_Parse;
------------
-- Create --
------------
procedure Create_Project(Name : String) is
begin
Put_Line("Creating Project...");
-- Create root directory
Create_Directory(Name);
-- Create obj directory
Create_Directory(Name & Directory_Separator & "obj");
-- Create obj/debug directory
Create_Directory(Name & Directory_Separator & "obj" & Directory_Separator & "debug");
-- Create obj/release directory
Create_Directory(Name & Directory_Separator & "obj" & Directory_Separator & "release");
-- Create src directory
Create_Directory(Name & Directory_Separator & "src");
-- Create bin directory
Create_Directory(Name & Directory_Separator & "bin");
-- Create GPR file
Create_GPR(Name & Directory_Separator & Name);
-- Create empty Main
Create_Program(Name & Directory_Separator & "main");
end Create_Project;
procedure Create_GPR(Name : String) is
File : File_Type;
Sanitized_Name : constant String := Sanitize_Name(Name);
begin
Create(File, Out_File, Name & ".gpr");
Put_Line(File, "--Generated GNAT Project file");
Put_Line(File, "--Example use:");
Put_Line(File, "-- gprbuild -P " & Name & ".gpr -Xmode=debug -p");
Put_Line(FIle, "-- or");
Put_Line(File, "-- gnatmake -P " & Name & ".gpr -Xmode=debug -p");
Put_Line(File, "project " & Sanitized_Name & " is");
New_Line(File);
Put_Line(File, " --Standard configurations");
Put_Line(File, " for Main use (""main.adb"");");
Put_Line(File, " for Source_Dirs use (""src/**"");");
Put_Line(File, " for Exec_Dir use ""bin/"";");
New_Line(File);
Put_Line(File, " --Ignore git scm stuff");
Put_Line(File, " for Ignore_Source_Sub_Dirs use ("".git/"");");
New_Line(File);
Put_Line(File, " for Object_Dir use ""obj/"" & external(""mode"", ""debug"");");
Put_Line(File, " for Object_Dir use ""obj/"" & external(""mode"", ""release"");");
New_Line(File);
Put_Line(File, " package Builder is");
Put_Line(File, " for Executable (""main.adb"") use """ & To_Lower(Sanitized_Name) & """;");
Put_Line(File, " end Builder;");
Put_Line(File, " --To invoke either case, you need to set the -Xmode= flag for gprbuild or gnatmake in the command line. You will also notice the Mode_Type type. This constrains the values of possible valid flags; it is basically an enumeration.");
Put_Line(File, " type Mode_Type is (""debug"", ""release"");");
Put_Line(File, " Mode : Mode_Type := external (""mode"", ""debug"");");
Put_Line(File, " package Compiler is");
Put_Line(File, " --Either debug or release mode");
Put_Line(File, " case Mode is");
Put_Line(File, " when ""debug"" =>");
Put_Line(File, " for Switches (""Ada"") use (""-g"");");
Put_Line(File, " when ""release"" =>");
Put_Line(File, " for Switches (""Ada"") use (""--O2"");");
Put_Line(File, " end case;");
Put_Line(File, " end Compiler;");
New_Line(File);
Put_Line(File, " package Binder is");
Put_Line(File, " end Binder;");
New_Line(File);
Put_Line(File, " package Linker is");
Put_Line(File, " end Linker;");
Put_Line(File, "end " & Sanitized_Name & ";");
Close(File);
end Create_GPR;
procedure Create_Program(Name : String) is
File : File_Type;
Sanitized_Name : constant String := Sanitize_Name(Name);
begin
Create(File, Out_File, Name & ".adb");
Put_Line(File, "procedure " & Sanitized_Name & "is");
Put_Line(File, "begin");
Put_Line(File, " null;");
Put_Line(File, "end " & Sanitized_Name & ";");
Close(File);
end Create_Program;
-----------
-- Print --
-----------
procedure Print_Comment(Message : String) is
begin
Put_Line("--" & Message);
end Print_Comment;
procedure Print_Description_Comment(Message : String) is
begin
Put_Line("--@description " & Message);
end Print_Description_Comment;
procedure Print_Exception_Comment(Name : String; Message : String) is
begin
Put_Line("--@exception " & Name & " " & Message);
end Print_Exception_Comment;
procedure Print_Field_Comment(Name : String; Message : String) is
begin
Put_Line("--@field " & Name & " " & Message);
end Print_Field_Comment;
procedure Print_Param_Comment(Name : String; Message : String) is
begin
Put_Line("--@param " & Name & " " & Message);
end Print_Param_Comment;
procedure Print_Return_Comment(Message : String) is
begin
Put_Line("--@return " & Message);
end Print_Return_Comment;
procedure Print_Summary_Comment(Message : String) is
begin
Put_Line("--@summary " & Message);
end Print_Summary_Comment;
procedure Print_Value_Comment(Name : String; Message : String) is
begin
Put_Line("--@value " & Name & " " & Message);
end Print_Value_Comment;
procedure Print_Procedure(Name : String) is
begin
Print_Procedure(Name, False);
end Print_Procedure;
procedure Print_Procedure(Name : String; Stub_Comments : Boolean) is
Sanitized_Name : constant String := Sanitize_Name(Name);
begin
if Stub_Comments then
Print_Comment("Summary of " & Name);
end if;
Put_Line("procedure " & Sanitized_Name & " is");
Put_Line("begin");
New_Line;
Put_Line("end " & Sanitized_Name & ";");
end Print_Procedure;
procedure Print_Procedure(Name : String; Param : Parameter) is
begin
Print_Procedure(Name, Param, False);
end Print_Procedure;
procedure Print_Procedure(Name : String; Param : Parameter; Stub_Comments : Boolean) is
Sanitized_Name : constant String := Sanitize_Name(Name);
begin
if Stub_Comments then
Print_Comment("Summary of " & Name);
Print_Param_Comment(To_String(Param.Name), "Summary of " & To_String(Param.Name));
end if;
Put_Line("procedure " & Sanitized_Name & "(" & To_String(Param.Name) & " : " & To_String(Param.Of_Type) & ") is");
Put_Line("begin");
New_Line;
Put_Line("end " & Sanitized_Name & ";");
end Print_Procedure;
procedure Print_Procedure(Name : String; Params : Parameter_Array) is
begin
Print_Procedure(Name, Params, False);
end Print_Procedure;
procedure Print_Procedure(Name : String; Params : Parameter_Array; Stub_Comments : Boolean) is
Sanitized_Name : constant String := Sanitize_Name(Name);
begin
if Stub_Comments then
Print_Comment("Summary of " & Name);
for Param of Params loop
Print_Param_Comment(To_String(Param.Name), "Summary of " & To_String(Param.Name));
end loop;
end if;
Put("procedure " & Sanitized_Name & "(");
for I in 1 .. Params'Length - 1 loop
Put(To_String(Params(I).Name) & " : " & To_String(Params(Params'Last).Of_Type) & "; ");
end loop;
Put_Line(To_String(Params(Params'Last).Name) & " : " & To_String(Params(Params'Last).Of_Type) & ") is");
Put_Line("begin");
New_Line;
Put_Line("end " & Sanitized_Name & ";");
end Print_Procedure;
procedure Print_Function(Form : Parameter) is
begin
Print_Function(Form, False);
end Print_Function;
procedure Print_Function(Form : Parameter; Stub_Comments : Boolean) is
begin
Print_Function(To_String(Form.Name), To_String(Form.Of_Type), Stub_Comments);
end Print_Function;
procedure Print_Function(Name : String; Returns : String) is
begin
Print_Function(Name, Returns, False);
end Print_Function;
procedure Print_Function(Name : String; Returns : String; Stub_Comments : Boolean) is
Sanitized_Name : constant String := Sanitize_Name(Name);
begin
if Stub_Comments then
Print_Comment("Summary of " & Name);
Print_Return_Comment("Summary of return value");
end if;
Put_Line("function " & Sanitized_Name & " return " & Returns & " is");
Put_Line("begin");
New_Line;
Put_Line("end " & Sanitized_Name & ";");
end Print_Function;
procedure Print_Function(Form : Parameter; Param : Parameter) is
begin
Print_Function(Form, Param, False);
end Print_Function;
procedure Print_Function(Form : Parameter; Param : Parameter; Stub_Comments : Boolean) is
begin
Print_Function(To_String(Form.Name), To_String(Form.Of_Type), Param, Stub_Comments);
end Print_Function;
procedure Print_Function(Name : String; Returns : String; Param : Parameter) is
begin
Print_Function(Name, Returns, Param, False);
end Print_Function;
procedure Print_Function(Name : String; Returns : String; Param : Parameter; Stub_Comments : Boolean) is
Sanitized_Name : constant String := Sanitize_Name(Name);
begin
if Stub_Comments then
Print_Comment("Summary of " & Name);
Print_Param_Comment(To_String(Param.Name), "Summary of " & To_String(Param.Name));
Print_Return_Comment("Summary of return value");
end if;
Put_Line("function " & Sanitized_Name & "(" & To_String(Param.Name) & " : " & To_String(Param.Of_Type) & ") return " & Returns & " is");
Put_Line("begin");
New_Line;
Put_Line("end " & Sanitized_Name & ";");
end Print_Function;
procedure Print_Function(Form : Parameter; Params : Parameter_Array) is
begin
Print_Function(Form, Params, False);
end Print_Function;
procedure Print_Function(Form : Parameter; Params : Parameter_Array; Stub_Comments : Boolean) is
begin
Print_Function(To_String(Form.Name), To_String(Form.Of_Type), Params, Stub_Comments);
end Print_Function;
procedure Print_Function(Name : String; Returns : String; Params : Parameter_Array) is
begin
Print_Function(Name, Returns, Params, False);
end Print_Function;
procedure Print_Function(Name : String; Returns : String; Params : Parameter_Array; Stub_Comments : Boolean) is
Sanitized_Name : constant String := Sanitize_Name(Name);
begin
if Stub_Comments then
Print_Comment("Summary of " & Name);
for Param of Params loop
Print_Param_Comment(To_String(Param.Name), "Summary of " & To_String(Param.Name));
end loop;
Print_Return_Comment("Summary of return value");
end if;
Put("function " & Sanitized_Name & "(");
-- Iterate through all but the last parameter, which is printed differently
for I in 1 .. Params'Length - 1 loop
Put(To_String(Params(I).Name) & " : " & To_String(Params(Params'Last).Of_Type) & "; ");
end loop;
Put_Line(To_String(Params(Params'Last).Name) & " : " & To_String(Params(Params'Last).Of_Type) & ") return " & Returns & " is");
Put_Line("begin");
New_Line;
Put_Line("end " & Sanitized_Name & ";");
end Print_Function;
end Agen;
|
Build/Interpreters/Ozmoo/asm/disk.asm
|
polluks/Puddle-BuildTools
| 38 |
12533
|
<filename>Build/Interpreters/Ozmoo/asm/disk.asm<gh_stars>10-100
first_unavailable_save_slot_charcode !byte 0
current_disks !byte $ff, $ff, $ff, $ff,$ff, $ff, $ff, $ff
boot_device !byte 0
ask_for_save_device !byte $ff
!ifndef VMEM {
disk_info
!byte 0, 0, 1 ; Interleave, save slots, # of disks
!byte 8, 8, 0, 0, 0, 130, 131, 0
} else {
device_map !byte 0,0,0,0,0,0,0,0
nonstored_pages !byte 0
readblocks_numblocks !byte 0
readblocks_currentblock !byte 0,0 ; 257 = ff 1
readblocks_currentblock_adjusted !byte 0,0 ; 257 = ff 1
readblocks_mempos !byte 0,0 ; $2000 = 00 20
disk_info
!ifdef Z3 {
!fill 71
}
!ifdef Z4 {
!fill 94
}
!ifdef Z5 {
!fill 94
}
!ifdef Z8 {
!fill 120
}
readblocks
; read <n> blocks (each 256 bytes) from disc to memory
; set values in readblocks_* before calling this function
; register: a,x,y
!ifdef TRACE_FLOPPY {
jsr newline
jsr print_following_string
!pet "readblocks (n,zp,c64) ",0
lda readblocks_numblocks
jsr printa
jsr comma
lda readblocks_currentblock + 1
jsr print_byte_as_hex
lda readblocks_currentblock
jsr print_byte_as_hex
jsr comma
lda readblocks_mempos + 1
jsr print_byte_as_hex
lda readblocks_mempos
jsr print_byte_as_hex
jsr newline
}
- jsr readblock ; read block
inc readblocks_mempos + 1 ; update mempos,block for next iteration
inc readblocks_currentblock
bne +
inc readblocks_currentblock + 1
+ dec readblocks_numblocks ; loop
bne -
rts
!if SUPPORT_REU = 1 {
.readblock_from_reu
ldx readblocks_currentblock_adjusted
ldy readblocks_currentblock_adjusted + 1
inx
bne +
iny
+ tya
ldy readblocks_mempos + 1 ; Assuming lowbyte is always 0 (which it should be)
jmp copy_page_from_reu
}
readblock
; read 1 block from floppy
; $mempos (contains address to store in) [in]
; set values in readblocks_* before calling this function
; register a,x,y
!ifdef TRACE_FLOPPY {
jsr print_following_string
!pet "Readblock: ",0
lda readblocks_currentblock + 1
jsr print_byte_as_hex
lda readblocks_currentblock
jsr print_byte_as_hex
}
lda readblocks_currentblock
sec
sbc nonstored_pages
sta readblocks_currentblock_adjusted
sta .blocks_to_go
lda readblocks_currentblock + 1
sbc #0
sta readblocks_currentblock_adjusted + 1
sta .blocks_to_go + 1
!if SUPPORT_REU = 1 {
; Check if game has been cached to REU
bit use_reu
bvs .readblock_from_reu
}
; convert block to track/sector
lda disk_info + 2 ; Number of disks
ldx #0 ; Memory index
ldy #0 ; Disk id
.check_next_disk
txa
clc
adc disk_info + 3,x
sta .next_disk_index ; x-value where next disk starts
; Check if the block we are looking for is on this disk
lda readblocks_currentblock_adjusted
sec
sbc disk_info + 6,x
sta .blocks_to_go_tmp + 1
lda readblocks_currentblock_adjusted + 1
sbc disk_info + 5,x
sta .blocks_to_go_tmp
bcc .right_disk_found ; Found the right disk!
; This is not the right disk. Save # of blocks to go into next disk.
lda .blocks_to_go_tmp
sta .blocks_to_go
lda .blocks_to_go_tmp + 1
sta .blocks_to_go + 1
jmp .next_disk ; Not the right disk, keep looking!
; Found the right disk
.right_disk_found
lda disk_info + 4,x
sta .device
lda disk_info + 7,x
sta .disk_tracks ; # of tracks which have entries
lda #1
sta .track
.check_track
lda disk_info + 8,x
beq .next_track
and #%00111111
sta .sector
lda .blocks_to_go + 1
sec
sbc .sector
sta .blocks_to_go_tmp + 1
lda .blocks_to_go
sbc #0
sta .blocks_to_go_tmp
bcc .right_track_found ; Found the right track
sta .blocks_to_go
lda .blocks_to_go_tmp + 1
sta .blocks_to_go + 1
.next_track
inx
inc .track
dec .disk_tracks
bne .check_track
!ifndef UNSAFE {
; Broken config
lda #ERROR_CONFIG ; Config info must be incorrect if we get here
jmp fatalerror
}
.next_disk
ldx .next_disk_index
iny
!ifdef UNSAFE {
jmp .check_next_disk
} else {
cpy disk_info + 2 ; # of disks
bcs +
jmp .check_next_disk
+ lda #ERROR_OUT_OF_MEMORY ; Meaning request for Z-machine memory > EOF. Bad message?
jmp fatalerror
}
.right_track_found
; Add sectors not used at beginning of track
; .blocks_to_go + 1: logical sector#
; disk_info + 8,x: # of sectors skipped / 2 (2 bits), # of sectors used (6 bits)
sty .temp_y
!ifdef TRACE_FLOPPY {
jsr arrow
lda .track
jsr print_byte_as_hex
jsr comma
lda .blocks_to_go + 1
jsr print_byte_as_hex
}
lda disk_info + 8,x
lsr
lsr
lsr
lsr
lsr
and #%00000110; a now holds # of sectors at start of track not in use
sta .skip_sectors
; Initialize track map. Write 0 for sectors not yet used, $ff for sectors used
lda disk_info + 8,x
and #%00111111
clc
adc .skip_sectors
sta .sector_count
tay
dey
lda #0
- cpy .skip_sectors
bcs +
lda #$ff
+ sta .track_map,y
dey
bpl -
; Find right sector.
; 1. Start at 0
; 2. Find next free sector
; 3. Decrease blocks to go. If < 0, we are done
; 4. Mark sector as used.
; 5. Add interleave, go back to 2
; 1
lda #0
; 2
- tay
lda .track_map,y
beq +
iny
tya
cpy .sector_count
bcc -
lda #0
beq - ; Always branch
; 3
+ dec .blocks_to_go + 1
bmi +
; 4
lda #$ff
sta .track_map,y
; 5
tya
clc
adc disk_info ; #SECTOR_INTERLEAVE
.check_sector_range
cmp .sector_count
bcc -
sbc .sector_count ; c is already set
bcs .check_sector_range ; Always branch
+ sty .sector
!ifdef TRACE_FLOPPY {
jsr comma
tya
jsr print_byte_as_hex
}
; Restore old value of y
ldy .temp_y
jmp .have_set_device_track_sector
.track_map !fill 40 ; Holds a map of the sectors in a single track
.sector_count !byte 0
.skip_sectors !byte 0
.temp_y !byte 0
; convert track/sector to ascii and update drive command
read_track_sector
; input: a: track, x: sector, y: device#, Word at readblocks_mempos holds storage address
sta .track
stx .sector
sty .device
.have_set_device_track_sector
lda .track
jsr convert_byte_to_two_digits
stx .uname_track
sta .uname_track + 1
lda .sector
jsr convert_byte_to_two_digits
stx .uname_sector
sta .uname_sector + 1
!ifdef TRACE_FLOPPY_VERBOSE {
jsr space
jsr dollar
lda readblocks_mempos + 1
jsr print_byte_as_hex
lda readblocks_mempos
jsr print_byte_as_hex
jsr comma
ldx readblocks_currentblock
jsr printx
;jsr comma
;lda #<.uname
;ldy #>.uname
;jsr printstring
jsr newline
}
!ifdef TARGET_C128 {
lda #0
sta allow_2mhz_in_40_col
sta reg_2mhz ;CPU = 1MHz
}
; open the channel file
lda #cname_len
ldx #<.cname
ldy #>.cname
jsr kernal_setnam ; call SETNAM
lda #$02 ; file number 2
ldx .device
tay ; secondary address 2
jsr kernal_setlfs ; call SETLFS
!ifdef TARGET_C128 {
lda #$00
tax
jsr kernal_setbnk
}
jsr kernal_open ; call OPEN
bcs .error ; if carry set, the file could not be opened
; open the command channel
lda #uname_len
ldx #<.uname
ldy #>.uname
jsr kernal_setnam ; call SETNAM
lda #$0F ; file number 15
ldx .device
tay ; secondary address 15
jsr kernal_setlfs ; call SETLFS
!ifdef TARGET_C128 {
lda #$00
tax
jsr kernal_setbnk
}
jsr kernal_open ; call OPEN (open command channel and send U1 command)
bcs .error ; if carry set, the file could not be opened
; check drive error channel here to test for
; FILE NOT FOUND error etc.
ldx #$02 ; filenumber 2
jsr kernal_chkin ; call CHKIN (file 2 now used as input)
lda readblocks_mempos
sta zp_mempos
lda readblocks_mempos+1
sta zp_mempos + 1
ldy #$00
- jsr kernal_readchar ; call CHRIN (get a byte from file)
sta (zp_mempos),Y ; write byte to memory
iny
bne - ; next byte, end when 256 bytes are read
!ifdef TARGET_C128 {
jsr close_io
jmp restore_2mhz
} else {
jmp close_io
}
.error
; accumulator contains BASIC error code
; most likely errors:
; A = $05 (DEVICE NOT PRESENT)
jsr close_io ; even if OPEN failed, the file has to be closed
lda #ERROR_FLOPPY_READ_ERROR
jsr fatalerror
.cname !text "#"
cname_len = * - .cname
.uname !text "U1 2 0 "
.uname_track !text "18 "
.uname_sector !text "00"
!byte 0 ; end of string, so we can print debug messages
uname_len = * - .uname
.track !byte 0
.sector !byte 0
.device !byte 0
.blocks_to_go !byte 0, 0
.blocks_to_go_tmp !byte 0, 0
.next_disk_index !byte 0
.disk_tracks !byte 0
} ; End of !ifdef VMEM
close_io
lda #$0F ; filenumber 15
jsr kernal_close ; call CLOSE
lda #$02 ; filenumber 2
jsr kernal_close ; call CLOSE
jmp kernal_clrchn ; call CLRCHN
!zone disk_messages {
prepare_for_disk_msgs
rts
print_insert_disk_msg
; Parameters: y: memory index to start of info for disk in disk_info
sty .save_y
; ldx .print_row
; ldy #2
; jsr set_cursor
lda #>insert_msg_1
ldx #<insert_msg_1
jsr printstring_raw
ldy .save_y
; Print disk name
lda disk_info + 7,y ; Number of tracks
clc
adc .save_y
tay
- lda disk_info + 8,y
beq .disk_name_done
bmi .special_string
jsr s_printchar
iny
bne - ; Always branch
.special_string
and #%00000111
tax
lda .special_string_low,x
sta .save_x
lda .special_string_high,x
ldx .save_x
jsr printstring_raw
iny
bne - ; Always branch
.disk_name_done
lda #>insert_msg_2
ldx #<insert_msg_2
jsr printstring_raw
ldy .save_y
lda disk_info + 4,y
jsr convert_byte_to_two_digits
cpx #$30
beq +
pha
txa
jsr s_printchar
pla
+ jsr s_printchar
; tax
; cmp #10
; bcc +
; lda #$31
; jsr s_printchar
; txa
; sec
; sbc #10
; + clc
; adc #$30
; jsr s_printchar
lda #>insert_msg_3
ldx #<insert_msg_3
jsr printstring_raw
;jsr kernal_readchar ; this shows the standard kernal prompt (not good)
- jsr kernal_getchar
beq -
; lda .print_row
; clc
; adc #3
; sta .print_row
ldy .save_y
rts
.save_x !byte 0
.save_y !byte 0
.print_row !byte 14
;.device_no !byte 0
.special_string_128
!pet "Boot ",0
.special_string_129
!pet "Story ",0
.special_string_130
!pet "Save ",0
.special_string_131
!pet "disk ",0
.special_string_low !byte <.special_string_128, <.special_string_129, <.special_string_130, <.special_string_131
.special_string_high !byte >.special_string_128, >.special_string_129, >.special_string_130, >.special_string_131
insert_msg_1
!pet 13," Please insert ",0
insert_msg_2
!pet 13," in drive ",0
insert_msg_3
!pet " [ENTER] ",0
}
!ifdef VMEM {
z_ins_restart
; Find right device# for boot disk
ldx disk_info + 3
!ifndef TARGET_MEGA65 {
lda disk_info + 4,x
jsr convert_byte_to_two_digits
stx .device_no
sta .device_no + 1
; cmp #10
; bcc +
; inc .device_no
; sec
; sbc #10
; + ora #$30
; sta .device_no + 1
ldx disk_info + 3
}
; Check if disk is in drive
lda disk_info + 4,x
tay
txa
cmp current_disks - 8,y
beq +
jsr print_insert_disk_msg
+
!if SUPPORT_REU = 1 {
lda use_reu
beq +
; Write the game id as a signature to say that REU is already loaded.
ldx #3
- lda game_id,x
sta reu_filled,x
dex
bpl -
+
}
!ifdef TARGET_MEGA65 {
; reset will autoboot the game again from disk
jmp kernal_reset
}
!ifndef TARGET_MEGA65 {
sei
cld
!ifdef TARGET_C128 {
lda #0
sta c128_mmu_cfg
}
jsr $ff8a ; restor (Fill vector table at $0314-$0333 with default values)
jsr $ff84 ; ioinit (Initialize CIA's, SID, memory config, interrupt timer)
jsr $ff81 ; scinit (Initialize VIC; set nput/output to keyboard/screen)
cli
!ifdef TARGET_C128 {
sta c128_mmu_load_pcra
}
}
; Copy restart code
ldx #.restart_code_end - .restart_code_begin
- lda .restart_code_begin - 1,x
sta .restart_code_address - 1,x
dex
bne -
; Setup key sequence
ldx #0
- lda .restart_keys,x
beq +
sta keyboard_buff,x
inx
bne - ; Always branch
+ stx keyboard_buff_len
lda #147
jsr kernal_printchar
lda #z_exe_mode_exit
jsr set_z_exe_mode
rts
.restart_keys
; !pet "lO",34,":*",34,",08:",131,0
!ifdef TARGET_C128 {
; must select memory under $4000 (basic)
!pet "sY4e3",13,0
.restart_code_address = 4000
} else {
!pet "sY3e4",13,0
.restart_code_address = 30000 ; $7530
}
.restart_code_begin
.restart_code_string_final_pos = .restart_code_string - .restart_code_begin + .restart_code_address
ldx #0
- lda .restart_code_string_final_pos,x
beq +
jsr $ffd2
inx
bne -
+ ; Setup key sequence
!ifdef TARGET_PLUS4_OR_C128 {
lda #19 ; home
sta keyboard_buff
lda #17 ; down
sta keyboard_buff + 1
lda #17 ; down
sta keyboard_buff + 2
lda #13 ; run
sta keyboard_buff + 3
lda #13 ; run
sta keyboard_buff + 4
lda #5
} else {
lda #131 ; run
sta keyboard_buff
lda #1
}
sta keyboard_buff_len
rts
.restart_code_string
!ifdef TARGET_PLUS4_OR_C128 {
!pet 147,17,17,"lO",34,":"
!source "file_name.asm"
!pet 34,","
.device_no
!pet "08",17,17,17,17,17,"rU",19,0
} else { ; Not Plus4 or C128
!pet 147,17,17," ",34,":"
!source "file_name.asm"
!pet 34,","
.device_no
!pet "08",19,0
}
; .restart_code_keys
; !pet 131,0
.restart_code_end
}
z_ins_restore
!ifdef Z3 {
jsr restore_game
beq +
ldx #0
jsr split_window
jmp make_branch_true
+
ldx #0
jsr split_window
jmp make_branch_false
}
!ifdef Z4 {
jsr restore_game
beq +
inx
+ jmp z_store_result
}
!ifdef Z5PLUS {
jsr restore_game
beq +
inx
+ jmp z_store_result
}
z_ins_save
!ifdef Z3 {
jsr save_game
beq +
jmp make_branch_true
+ jmp make_branch_false
}
!ifdef Z4PLUS {
jsr save_game
jmp z_store_result
}
!zone save_restore {
.inputlen !byte 0
.filename !pet "!0" ; 0 is changed to slot number
.inputstring !fill 15 ; filename max 16 chars (fileprefix + 14)
.input_alphanum
; read a string with only alphanumeric characters into .inputstring
; return: x = number of characters read
; .inputstring: null terminated string read (max 20 characters)
; modifies a,x,y
jsr turn_on_cursor
lda #0
sta .inputlen
cli
jsr kernal_clrchn
- jsr kernal_getchar
beq -
cmp #$14 ; delete
bne +
ldx .inputlen
beq -
dec .inputlen
pha
jsr turn_off_cursor
pla
jsr s_printchar
jsr turn_on_cursor
jmp -
+ cmp #$0d ; enter
beq .input_done
cmp #$20
beq .char_is_ok
sec
sbc #$30
cmp #$5B-$30
bcs -
sbc #$09 ;actually -$0a because C=0
cmp #$41-$3a
bcc -
adc #$39 ;actually +$3a because C=1
.char_is_ok
ldx .inputlen
cpx #14
bcs -
sta .inputstring,x
inc .inputlen
jsr s_printchar
jsr update_cursor
jmp -
.input_done
pha
jsr turn_off_cursor
pla
jsr s_printchar ; return
ldx .inputlen
lda #0
sta .inputstring,x
rts
.error
; accumulator contains BASIC error code
; most likely errors:
; A = $05 (DEVICE NOT PRESENT)
sta zp_temp + 1 ; Store error code for printing
jsr close_io ; even if OPEN failed, the file has to be closed
lda #>.disk_error_msg
ldx #<.disk_error_msg
jsr printstring_raw
; Add code to print error code!
lda #0
rts
list_save_files
lda #13
jsr s_printchar
ldx first_unavailable_save_slot_charcode
dex
stx .saveslot_msg + 9
ldx disk_info + 1 ; # of save slots
lda #0
- sta .occupied_slots - 1,x
dex
bne -
; Remember address of row where first entry is printed
lda zp_screenline
sta .base_screen_pos
lda zp_screenline + 1
sta .base_screen_pos + 1
; open the channel file
!ifdef TARGET_C128 {
lda #$00
tax
jsr kernal_setbnk
}
lda #1
ldx #<.dirname
ldy #>.dirname
jsr kernal_setnam ; call SETNAM
lda #2 ; file number 2
ldx disk_info + 4 ; Device# for save disk
+ ldy #0 ; secondary address 2
jsr kernal_setlfs ; call SETLFS
jsr kernal_open ; call OPEN
bcs .error ; if carry set, the file could not be opened
ldx #2 ; filenumber 2
jsr kernal_chkin ; call CHKIN (file 2 now used as input)
; Skip load address and disk title
ldy #32
- jsr kernal_readchar
dey
bne -
.read_next_line
lda #0
sta zp_temp + 1
; Read row pointer
jsr kernal_readchar
sta zp_temp
jsr kernal_readchar
ora zp_temp
beq .end_of_dir
jsr kernal_readchar
jsr kernal_readchar
- jsr kernal_readchar
cmp #0
beq .read_next_line
cmp #$22 ; Charcode for "
bne -
jsr kernal_readchar
cmp #$21 ; charcode for !
bne .not_a_save_file
jsr kernal_readchar
cmp #$30 ; charcode for 0
bcc .not_a_save_file
cmp first_unavailable_save_slot_charcode
; cmp #$3a ; (charcode for 9) + 1
bcs .not_a_save_file
tax
lda .occupied_slots - $30,x
bne .not_a_save_file ; Since there is another save file with the same number, we ignore this file.
!ifdef TARGET_C128 {
lda COLS_40_80
bne +++
}
; Set the first 40 chars of each row to the current text colour
lda s_colour
!ifdef TARGET_PLUS4 {
tay
lda plus4_vic_colours,y
}
ldy #39
- sta (zp_colourline),y
dey
bpl -
+++
txa
sta .occupied_slots - $30,x
jsr s_printchar
lda #58
jsr s_printchar
lda #32
jsr s_printchar
dec zp_temp + 1
- jsr kernal_readchar
.not_a_save_file
cmp #$22 ; Charcode for "
beq .end_of_name
bit zp_temp + 1
bpl - ; Skip printing if not a save file
jsr s_printchar
jmp -
.end_of_name
- jsr kernal_readchar
cmp #0 ; EOL
bne -
bit zp_temp + 1
bpl .read_next_line ; Skip printing if not a save file
lda #13
jsr s_printchar
jmp .read_next_line
.end_of_dir
jsr close_io
; Fill in blanks
ldx #0
- lda .occupied_slots,x
bne +
!ifdef TARGET_C128 {
lda COLS_40_80
bne +++
}
; Set the first 40 chars of each row to the current text colour
lda s_colour
!ifdef TARGET_PLUS4 {
tay
lda plus4_vic_colours,y
}
ldy #39
--- sta (zp_colourline),y
dey
bpl ---
+++
txa
ora #$30
jsr s_printchar
lda #58
jsr s_printchar
lda #13
jsr s_printchar
+ inx
cpx disk_info + 1 ; # of save slots
bcc -
; Sort list
ldx #1
stx .sort_item
- jsr .insertion_sort_item
inc .sort_item
ldx .sort_item
cpx disk_info + 1; # of save slots
bcc -
lda #1 ; Signal success
rts
.insertion_sort_item
; Parameters: x, .sort_item: item (1-9)
stx .current_item
!ifdef TARGET_C128 {
lda COLS_40_80
bne vdc_insertion_sort
}
-- jsr .calc_screen_address
stx zp_temp + 2
sta zp_temp + 3
ldx .current_item
dex
jsr .calc_screen_address
stx zp_temp
sta zp_temp + 1
ldy #0
lda (zp_temp + 2),y
cmp (zp_temp),y
bcs .done_sort
; Swap items
ldy #17
- lda (zp_temp),y
pha
lda (zp_temp + 2),y
sta (zp_temp),y
pla
sta (zp_temp + 2),y
dey
bpl -
dec .current_item
ldx .current_item
bne --
.done_sort
rts
!ifdef TARGET_C128 {
vdc_insertion_sort
jsr .calc_screen_address
stx zp_temp + 2 ; convert from $0400 (VIC-II) to $0000 (VDC)
sec
sbc #$04
sta zp_temp + 3
ldx .current_item
dex
jsr .calc_screen_address
stx zp_temp ; convert from $0400 (VIC-II) to $0000 (VDC)
sec
sbc #$04
sta zp_temp + 1
; read both rows from VCD into temp buffers
lda zp_temp
ldy zp_temp + 1
jsr VDCSetAddress
ldy #0
- jsr VDCReadByte
sta $0400,y
iny
cpy #17
bne -
lda zp_temp + 2
ldy zp_temp + 3
jsr VDCSetAddress
ldy #0
- jsr VDCReadByte
sta $0428,y
iny
cpy #17
bne -
; sort in the buffer
ldy #0
lda $0428,y ; (zp_temp + 2),y
cmp $0400,y ; (zp_temp),y
bcs .done_sort
; Swap items
ldy #17
- lda $0400,y ; (zp_temp),y
pha
lda $0428,y ; (zp_temp + 2),y
sta $0400,y ; (zp_temp),y
pla
sta $0428,y ; (zp_temp + 2),y
dey
bpl -
; copy back from the buffers into VDC
lda zp_temp
ldy zp_temp + 1
jsr VDCSetAddress
ldy #0
- lda $0400,y
jsr VDCWriteByte
iny
cpy #17
bne -
lda zp_temp + 2
ldy zp_temp + 3
jsr VDCSetAddress
ldy #0
- lda $0428,y
jsr VDCWriteByte
iny
cpy #17
bne -
; check next line
dec .current_item
ldx .current_item
beq +
jmp vdc_insertion_sort
+ rts
}
.calc_screen_address
lda .base_screen_pos
ldy .base_screen_pos + 1
stx .counter
clc
- dec .counter
bmi +
adc s_screen_width
tax
tya
adc #0
tay
txa
bcc - ; Always branch
+ tax
tya
rts
.dirname
!pet "$"
.occupied_slots
!fill 10,0
.disk_error_msg
!pet 13,"Disk error #",0
.sort_item
!byte 0
.current_item
!byte 0
.counter
!byte 0
.base_screen_pos
!byte 0,0
.insert_save_disk
ldx disk_info + 4 ; Device# for save disk
lda current_disks - 8,x
sta .last_disk
beq .dont_print_insert_save_disk ; Save disk is already in drive.
jsr prepare_for_disk_msgs
ldy #0
jsr print_insert_disk_msg
ldx disk_info + 4 ; Device# for save disk
lda #0
sta current_disks - 8,x
beq .insert_done ; Always branch
.dont_print_insert_save_disk
jsr wait_a_sec
.insert_done
ldx #0
!ifdef Z5PLUS {
jmp erase_window
} else {
jsr erase_window
ldx window_start_row + 1 ; First line in lower window
ldy #0
jmp set_cursor
}
.insert_story_disk
ldy .last_disk
beq + ; Save disk was in drive before, no need to change
bmi + ; The drive was empty before, no need to change disk now
jsr print_insert_disk_msg
tya
ldx disk_info + 4 ; Device# for save disk
sta current_disks - 8,x
+ ldx #0
jmp erase_window
maybe_ask_for_save_device
lda ask_for_save_device
beq .ok_dont_ask
.ask_again
lda #>.save_device_msg ; high
ldx #<.save_device_msg ; low
jsr printstring_raw
jsr .input_alphanum
cpx #0
beq .ok_dont_ask
cpx #3
bcs .incorrect_device
; One or two digits
cpx #1
bne .two_digits
lda .inputstring
cmp #$38
bcc .incorrect_device
cmp #$3a
bcs .incorrect_device
and #$0f
bne .store_device ; Always jump
.two_digits
lda .inputstring
cmp #$31
bne .incorrect_device
lda .inputstring + 1
cmp #$30
bcc .incorrect_device
cmp #$36
bcs .incorrect_device
and #$0f
adc #10 ; Carry already clear
.store_device
sta disk_info + 4
.ok_dont_ask
lda #0
sta ask_for_save_device
clc ; All OK
rts
.incorrect_device
sec
rts
restore_game
!ifdef TARGET_C128 {
lda #0
sta allow_2mhz_in_40_col
sta reg_2mhz ;CPU = 1MHz
}
jsr maybe_ask_for_save_device
bcs .restore_failed
jsr .insert_save_disk
; List files on disk
jsr list_save_files
beq .restore_failed
; Pick a slot#
lda #>.saveslot_msg_restore ; high
ldx #<.saveslot_msg_restore ; low
jsr printstring_raw
lda #>.saveslot_msg ; high
ldx #<.saveslot_msg ; low
jsr printstring_raw
jsr .input_alphanum
cpx #1
bne .restore_failed
lda .inputstring
cmp first_unavailable_save_slot_charcode
bpl .restore_failed ; not a number (0-9)
tax
lda .occupied_slots - $30,x
beq .restore_failed ; If the slot is unoccupied, fail.
sta .restore_filename + 1
; Print "Restoring..."
lda #>.restore_msg
ldx #<.restore_msg
jsr printstring_raw
jsr .swap_pointers_for_save
; Perform restore
jsr do_restore
bcs .restore_failed ; if carry set, a file error has happened
!ifdef TARGET_C128 {
jsr restore_2mhz
; Copy stack and pointers from bank 1 to bank 0
jsr .copy_stack_and_pointers_to_bank_0
; z_temp + 4 now holds the page# where the zp registers are stored in vmem_cache
lda #(>stack_start) - 1
sta z_temp + 2
lda #($100 - zp_bytes_to_save)
sta z_temp + 1
sta z_temp + 3
ldy #zp_bytes_to_save - 1
- lda (z_temp + 3),y
sta (z_temp + 1),y
dey
bpl -
}
; Swap in z_pc and stack_ptr
jsr .swap_pointers_for_save
!if SUPPORT_REU = 1 {
lda use_reu
bmi .restore_success_dont_insert_story_disk
}
jsr .insert_story_disk
.restore_success_dont_insert_story_disk
; inc zp_pc_l ; Make sure read_byte_at_z_address
!ifdef Z4PLUS {
!ifdef TARGET_C128 {
jsr update_screen_width_in_header
}
}
jsr get_page_at_z_pc
lda #0
ldx #1
rts
.restore_failed
!if SUPPORT_REU = 1 {
lda use_reu
bmi .restore_fail_dont_insert_story_disk
}
jsr .insert_story_disk
; Return failed status
.restore_fail_dont_insert_story_disk
!ifdef TARGET_C128 {
jsr restore_2mhz
}
lda #0
tax
rts
save_game
!ifdef TARGET_C128 {
lda #0
sta allow_2mhz_in_40_col
sta reg_2mhz ;CPU = 1MHz
}
jsr maybe_ask_for_save_device
bcs .restore_failed
jsr .insert_save_disk
; List files on disk
jsr list_save_files
beq .restore_failed
; Pick a slot#
lda #>.saveslot_msg_save ; high
ldx #<.saveslot_msg_save ; low
jsr printstring_raw
lda #>.saveslot_msg ; high
ldx #<.saveslot_msg ; low
jsr printstring_raw
jsr .input_alphanum
cpx #1
bne .restore_failed
lda .inputstring
cmp first_unavailable_save_slot_charcode
bpl .restore_failed ; not a number (0-9)
sta .filename + 1
sta .erase_cmd + 3
; Enter a name
lda #>.savename_msg ; high
ldx #<.savename_msg ; low
jsr printstring_raw
jsr .input_alphanum
cpx #0
beq .restore_failed
; Print "Saving..."
lda #>.save_msg
ldx #<.save_msg
jsr printstring_raw
; Erase old file, if any
!ifdef TARGET_C128 {
lda #$00
tax
jsr kernal_setbnk
}
lda #5
ldx #<.erase_cmd
ldy #>.erase_cmd
jsr kernal_setnam
lda #$0f ; file number 15
ldx disk_info + 4 ; Device# for save disk
tay ; secondary address 15
jsr kernal_setlfs
jsr kernal_open ; open command channel and send delete command)
bcs .restore_failed ; if carry set, the file could not be opened
lda #$0f ; filenumber 15
jsr kernal_close
; Swap in z_pc and stack_ptr
jsr .swap_pointers_for_save
!ifdef TARGET_C128 {
jsr .copy_stack_and_pointers_to_bank_1
}
; Perform save
jsr do_save
bcc +
jmp .restore_failed ; if carry set, a save error has happened
+
!ifdef TARGET_C128 {
jsr restore_2mhz
}
; Swap out z_pc and stack_ptr
jsr .swap_pointers_for_save
!if SUPPORT_REU = 1 {
lda use_reu
bmi .dont_insert_story_disk
}
jsr .insert_story_disk
.dont_insert_story_disk
lda #0
ldx #1
rts
do_restore
!ifdef TARGET_C128 {
lda #$01
ldx #$00
jsr kernal_setbnk
}
lda #3
ldx #<.restore_filename
ldy #>.restore_filename
jsr kernal_setnam
lda #1 ; file number
ldx disk_info + 4 ; Device# for save disk
ldy #1 ; not $01 means: load to address stored in file
jsr kernal_setlfs
lda #$00 ; $00 means: load to memory (not verify)
jsr kernal_load
php ; store c flag so error can be checked by calling routine
lda #1
jsr kernal_close
plp ; restore c flag
rts
do_save
!ifdef TARGET_C128 {
lda #$01
ldx #$00
jsr kernal_setbnk
}
lda .inputlen
clc
adc #2 ; add 2 bytes for prefix
ldx #<.filename
ldy #>.filename
jsr kernal_setnam
lda #1 ; file# 1
ldx disk_info + 4 ; Device# for save disk
tay ; secondary address: 1
jsr kernal_setlfs
!ifdef TARGET_C128 {
lda #<(story_start_bank_1 - stack_size - zp_bytes_to_save)
ldx #>(story_start_bank_1 - stack_size - zp_bytes_to_save)
} else {
lda #<(stack_start - zp_bytes_to_save)
ldx #>(stack_start - zp_bytes_to_save)
}
sta savefile_zp_pointer
stx savefile_zp_pointer + 1
ldx dynmem_size
lda dynmem_size + 1
; ldy #header_static_mem
; jsr read_header_word
clc
!ifdef TARGET_C128 {
adc #>story_start_bank_1
} else {
adc #>story_start
}
tay
lda #savefile_zp_pointer ; start address located in zero page
jsr kernal_save
php ; store c flag so error can be checked by calling routine
lda #1
jsr kernal_close
plp ; restore c flag
rts
.last_disk !byte 0
.saveslot !byte 0
.saveslot_msg_save !pet 13,"Save to",0
.saveslot_msg_restore !pet 13,"Restore from",0
.saveslot_msg !pet " slot (0-9, RETURN=cancel): ",0 ; Will be modified to say highest available slot #
.savename_msg !pet "Comment (RETURN=cancel): ",0
.save_msg !pet 13,"Saving...",13,0
.restore_msg !pet 13,"Restoring...",13,0
.save_device_msg !pet 13,"Device# (8-15, RETURN=default): ",0
.restore_filename !pet "!0*" ; 0 will be changed to selected slot
.erase_cmd !pet "s:!0*" ; 0 will be changed to selected slot
.swap_pointers_for_save
ldx #zp_bytes_to_save - 1
- lda zp_save_start,x
ldy stack_start - zp_bytes_to_save,x
sta stack_start - zp_bytes_to_save,x
sty zp_save_start,x
dex
bpl -
rts
!ifdef TARGET_C128 {
.copy_stack_and_pointers_to_bank_1
; Pick a cache page to use, one that the z_pc_mempointer isn't pointing to
ldy #>vmem_cache_start
ldx #0
txa
cpy z_pc_mempointer + 1
bne +
inx
+ sta vmem_cache_page_index,x ; Mark as unused
txa
clc
adc #>vmem_cache_start
sta z_temp ; vmem_cache page for copying
lda #(>stack_start) - 1
sta z_temp + 1 ; Source page
lda #(>story_start_bank_1) - (>stack_size) - 1
sta z_temp + 2 ; Destination page
lda #(>stack_size) + 1
sta z_temp + 3 ; # of pages to copy
- lda z_temp + 1
ldy z_temp
ldx #0
jsr copy_page_c128 ; Copy a page to vmem_cache
lda z_temp
ldy z_temp + 2
ldx #1
jsr copy_page_c128
inc z_temp + 1
inc z_temp + 2
dec z_temp + 3
bne -
rts
.copy_stack_and_pointers_to_bank_0
; ; Pick a cache page to use, one that the z_pc_mempointer isn't pointing to
ldy #>vmem_cache_start
ldx #0
txa
cpy z_pc_mempointer + 1
bne +
inx
+
sta vmem_cache_page_index,x ; Mark as unused
txa
clc
adc #>vmem_cache_start
sta z_temp + 4 ; vmem_cache page for copying
tay
lda #(>story_start_bank_1) - 1
sta z_temp + 1 ; Source page
lda #(>story_start) - 1
sta z_temp + 2 ; Destination page
lda #(>stack_size) + 1
sta z_temp + 3 ; # of pages to copy
- lda z_temp + 1
ldy z_temp + 4
ldx #1
jsr copy_page_c128 ; Copy a page to vmem_cache
dec z_temp + 3
beq + ; Stop after copying the last page to vmem_cache
lda z_temp + 4
ldy z_temp + 2
ldx #0
jsr copy_page_c128
dec z_temp + 1
dec z_temp + 2
bne - ; Always branch
+ rts
}
wait_a_sec
; Delay ~1.2 s so player can read the last text before screen is cleared
!ifdef TARGET_C128 {
ldx #40 ; How many frames to wait
-- ldy #1
- bit $d011
bmi --
cpy #0
beq -
; This is the beginning of a new frame
dey
dex
bne -
} else {
ldx #0
ldy #5
- jsr kernal_delay_1ms
dex
bne -
dey
bne -
}
rts
}
|
alloy4fun_models/trashltl/models/2/9Y3GZBxXcPZfTxzA7.als
|
Kaixi26/org.alloytools.alloy
| 0 |
1930
|
open main
pred id9Y3GZBxXcPZfTxzA7_prop3 {
always some f:File | f in Trash + Protected
}
pred __repair { id9Y3GZBxXcPZfTxzA7_prop3 }
check __repair { id9Y3GZBxXcPZfTxzA7_prop3 <=> prop3o }
|
oeis/097/A097184.asm
|
neoneye/loda-programs
| 11 |
163689
|
<reponame>neoneye/loda-programs
; A097184: G.f. A(x) satisfies A097182(x*A(x)) = A(x) and so equals the ratio of the g.f.s of any two adjacent diagonals of triangle A097181.
; Submitted by <NAME>
; 1,7,70,805,9982,129766,1742572,23960365,335445110,4763320562,68418604436,992069764322,14499481170860,213349508656940,3157572728122712,46968894330825341,701770538825272742,10526558082379091130,158452400608443161220,2392631249187491734422,36231273201982017692676,550056602248272450425172,8370426555951972071687400,127649004978267574093232850,1950476796067928532144597948,29857298647501367530521153204,457811912595020968801324349128,7030682943423536306591766790180,108127054922996454922066482359320
mov $1,$0
seq $0,97183 ; Main diagonal of triangle A097181, in which the n-th row polynomial R_n(y) is formed from the initial (n+1) terms of g.f. A097182(y)^(n+1), where R_n(1/2) = 8^n for all n>=0.
add $1,1
div $0,$1
|
oeis/062/A062302.asm
|
neoneye/loda-programs
| 11 |
80929
|
; A062302: Number of ways writing n-th prime as a sum of a prime and a nonprime.
; Submitted by <NAME>
; 0,1,0,1,4,3,6,5,8,9,8,11,12,11,14,15,16,15,18,19,18,21,22,23,24,25,24,27,26,29,30,31,32,31,34,33,36,37,38,39,40,39,42,41,44,43,46,47,48,47,50,51,50,53,54,55,56,55,58,59,58,61,62,63,62,65,66,67,68,67,70,71,72,73,74,75,76,77,78,79,80,79,82,81,84,85,86,87,88,87,90,91,92,93,94,95,96,97,96,99
mov $3,$0
trn $0,1
seq $0,74927 ; a(n) such that p(n)*p(n+1)+a(n) is a minimal square.
mov $2,1
div $2,$0
mov $0,$2
add $0,$2
sub $3,$0
mov $0,$3
|
playwav.asm
|
em00k/zxnext-playwavdma
| 0 |
170370
|
<filename>playwav.asm<gh_stars>0
;
; TBBlue / ZX Spectrum Next project
; Copyright (c) 2015 - <NAME> & <NAME>
;
; All rights reserved
;
; Redistribution and use in source and synthezised 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 synthesized 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 author nor the names of other contributors may
; be used to endorse or promote products derived from this software without
; specific prior written permission.
;
; THIS CODE 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 AUTHOR 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.
;
; You are responsible for any legal issues arising from your use of this code.
;
; v1.5 changes <NAME>
;
macro nextreg_a reg
dw $92ed
db reg
endm
macro MUL_DE
dw $30ed
endm
macro getreg reg
ld bc,$243B ; Register Select
ld a,reg ; a = slot already so add $50 for slot regs
out(c),a ;
ld bc,$253B ; reg access
in a,(c)
endm
device zxspectrum48
org 2000h
;port 107=datagear / port 11=MB02+
Z80DMAPORT equ 107
SPECDRUM equ $df
BUFFER_SIZE equ 2048
start1 di
push iy
getreg $7 ; get cpu speed
ld (oldspeed),a ; store for later
getreg $54 ; get cpu speed
ld (oldbank4),a ; store for later
ld a,3
nextreg_a $7 ; turbo
ld a,h:or l:jr nz,.gl
ld hl,emptyline:call print_rst16:jr finish
.gl ld de,filename:ld b,64
.bl ld a,(hl):cp ":":jr z,.dn:or a:jr z,.dn:cp 13:jr z,.dn:bit 7,a:jr nz,.dn
ld (de),a:inc hl:inc de:djnz .bl
.dn xor a:ld (de),a
ld (stack),sp
ld sp,$3ffe
call setdrv ; init the mmc
; check for param
ld hl,filename
ld a,(hl)
inc hl
cp '-'
jr nz,nocommand
ld a,(hl)
cp 's'
inc hl
jr z,foundscaler
jr skipcommand
foundscaler: ; get custom scaler value
; hl scaler address in text
inc hl
call ASCIItoAcc
; now in A
inc hl
push hl
pop ix
ld (scaler),a
ld (sflag),a
jr skipcommand
nocommand:
ld ix,filename ; grab the filename
skipcommand:
call reservebank ; we need a bank @ 8000, get nextzxos give us one
call play ; now jump to main routine
quickexit:
call freebank ; we are done, free the bank
ld sp,(stack) ; stick the stack back to what it was
ld a,(oldbank4)
nextreg_a $54 ; put back orginal bank
finish
ld a,(oldspeed)
nextreg_a $7 ; restore speed
pop iy ; saved to help running from another dotcommand
xor a
ei
ret
oldspeed:
db 0
oldbank4: db 0
print_rst16 ld a,(hl):inc hl:or a:ret z:rst 16:jr print_rst16
play
push de:call fopen:pop de:ret c:ld a,(handle):or a:ret z
ld L, 0 ; 0 = Seek from start of file
ld BC, 0
ld DE, 22 ; skip the 44 bytes from header
call fseek ; mono / stereo
ld ix, BufferWAV
ld bc, 4
; read the data from SD or finish with some error
push bc:call fread:pop de:
ld hl,BufferWAV
ld a,(hl) ; number of channels 1=mono 2=stereo
ld b,a ; save it
ld a,(sflag) : or a : jr nz,dontincreasescaler
inc hl
inc hl
inc hl
ld a,(hl) ; is it 32000 00 7d
; is it 16000 80 3e
cp $70 ; is A >= $7d?
jr nc,skipscaler2 ; yes jump to skipscaler we are at 32000+
;' Hz / 615 = scaler
;13 32000
;26 16000
;39 11025
ld a,13*2 ; might be 16000
ld (scaler),a ;
skipscaler1:
ld a,(hl) ; lets chack
cp $2b ; is A >= $2b?
jr nc,skipscaler2 ;
ld a,13*3 ; 11025
ld (scaler),a
skipscaler2:
ld a,b ; get channels
cp 1
jr nz,dontincreasescaler
ld a,(scaler)
add a,a
ld (scaler),a
dontincreasescaler:
ld L, 0 ; 0 = Seek from start of file
ld BC, 0
ld DE, 44 ;skip the 44 bytes from header
call fseek
; clear the buffer
ld hl, BufferWAV
ld ( HL ),$80
ld de, BufferWAV + 1
ld bc, BUFFER_SIZE
ldir
ld ix, BufferWAV
ld bc, BUFFER_SIZE
call fread
; transfer the DMA "program"
ld hl,DMA
ld b,DMAEND-DMA
ld c,Z80DMAPORT
otir
loop1
; DMA read the bytes non-stop, so we need to make sure to not overwrite the audio data
; now we are testing if the DMA is reading from the first part
ld c,Z80DMAPORT
waitforbuffer1
in a,(c)
bit 2,a
jr z,waitforbuffer1
; the DMA is not reading from the first part, we can fill with the audio data
ld ix, BufferWAV
ld bc, BUFFER_SIZE / 2
; read the data from SD or finish with some error
push bc:call fread:pop de:jp c,ending
ld a,b:cp d:jp nz,ending:ld a,c:cp e:jp nz,ending
; now we are testing if the DMA is reading from the second part
ld c,Z80DMAPORT
waitforbuffer2
in a,(c)
bit 2,a
jr nz,waitforbuffer2
; the DMA is not reading from the second part, we can fill with the audio data
ld ix, BufferWAV + ( BUFFER_SIZE / 2 )
ld bc, BUFFER_SIZE / 2
; read the data from SD or finish with some error
push bc:call fread:pop de:jp c,ending
ld a,b:cp d:jp nz,ending:ld a,c:cp e:jp nz,ending
;check the space key to abort
ld bc,$7ffe
in a,(c)
and 1
jp nz,loop1
ending
ld c,Z80DMAPORT
LD A,#83 ; DISABLE DMA
OUT (c),a
call fclose ; close the file
ret ; return to BASIC
DMA defb #C3 ;R6-RESET DMA
defb #C7 ;R6-RESET PORT A Timing
defb #CA ;R6-SET PORT B Timing same as PORT A
defb #7D ;R0-Transfer mode, A -> B
defw BufferWAV ;R0-Port A, Start address
defw BUFFER_SIZE ;R0-Block length
defb $54 ;R1-Port A address incrementing, variable timing
defb $2 ;R1-Cycle length port B
defb $68 ;R2-Port B address fixed, variable timing
defb $22 ;R2-Cycle length port B 2T with pre-escaler
scaler:
defb 13 ;R2-Port B Pre-escaler
;13 = 32000
;32*2 16000
defb #CD ;R4-Burst mode
defw SPECDRUM ;R4-Port B, Start address
defb #A2 ;R5-Restart on end of block, RDY active LOW
defb #BB ;Read Mask Follows
defb #10 ;Mask - only port A hi byte
defb #CF ;R6-Load
defb #B3 ;R6-Force Ready
defb #87 ;R6-Enable DMA
DMAEND
ASCIItoAcc:
; hl = address of 8 bit ascii string
; a returns 8 bit value of string
;ld hl,data
; check lenght
push hl
ld bc,0
checkloop:
ld a,b : cp 4 : jp z,quickexit : ld a,(hl) : inc hl : inc b : cp 32 : jr nz,checkloop
pop hl : ld a,b : sub 1 : cp 2 : jr z,twodigi : cp 1 : jr z,onedigi
hundreds:
ld a,(hl) : inc hl : cp 0 : ret z
sub $30 : ld d,a : ld e,100 : MUL_DE : ld a,e : push af
jr twodigiskip
twodigi:
ld de,0 : push de
twodigiskip:
ld a,(hl) : inc hl : cp 0 : ret z
sub $30 : ld d,a : ld e,10 : MUL_DE : ld a,e
jr tens
onedigi:
ld de,0 : push de
tens:
ld a,(hl) : inc hl : cp 0 : ret z
sub $30 : add a,e : pop de : add a,d
failedacc: ret
reservebank
ld hl,$0001 ; H=banktype (ZX=0, 1=MMC); L=reason (1=allocate)
exx
ld c,7 ; RAM 7 required for most IDEDOS calls
ld de,$01bd ; IDE_BANK
rst $8:defb $94 ; M_P3DOS
jp nc,anybank
ld a,e
ld (bank),a
nextreg_a $54 ; we will swap out memory with reserved bank
ret
freebank
ld hl,$0003 ; H=banktype (ZX=0, 1=MMC); L=reason (1=allocate)
ld a,(bank)
ld e,a
exx
ld c,7 ; RAM 7 required for most IDEDOS calls
ld de,$01bd ; IDE_BANK
rst $8:defb $94 ; M_P3DOS
ret
anybank ld a,33
nextreg_a $54
ret
setdrv xor a:rst $08:db $89:xor a:ld (handle),a:ret
fopen ld b,$01:db 33
fcreate ld b,$0c:push ix:pop hl:ld a,42:rst $08:db $9a:ld (handle),a:ret
fread push ix:pop hl:db 62
handle db 0:or a:ret z:rst $08:db $9d:ret
fwrite push ix:pop hl:ld a,(handle):or a:ret z:rst $08:db $9e:ret
fclose ld a,(handle):or a:ret z:rst $08:db $9b:ret
fseek ld a,(handle):rst $08:db $9f:ret;
filename ds 64,0
emptyline db ".playwav <file> to play a WAV",13
db ".playwav -s <nr> <file>",13,13
db "Where <nr> is a scale value from",13
db "0-255, omit the <>",13
db " ",13
db "Sample rates supported:",13,13
db "32000hz 8bit stereo / mono PCM",13
db "16000hz 8bit stereo / mono PCM",13
db "11025hz 8bit stereo / mono PCM",13,13
db "Playback rate is auto detected.",13
db "Other rates can be played, use",13
db "the -s option to adjust speed.",13,13
db "v1.7 12/9/2020 emk",13,00
db "original code VTrucco&FBelavenuto, remixed <NAME> 2019/emook"
BufferWAV equ $8000
stack dw 0000
bank db 0
sflag db 0
.last
savebin "h:\dot\playwav",start1,.last-start1
;-------------------------------
|
Cubical/HITs/ListedFiniteSet/Properties.agda
|
dan-iel-lee/cubical
| 0 |
14849
|
<filename>Cubical/HITs/ListedFiniteSet/Properties.agda
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.HITs.ListedFiniteSet.Properties where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Prod using (_×_; _,_)
open import Cubical.HITs.ListedFiniteSet.Base
private
variable
ℓ : Level
A B : Type ℓ
assoc-++ : ∀ (xs : LFSet A) ys zs → xs ++ (ys ++ zs) ≡ (xs ++ ys) ++ zs
assoc-++ [] ys zs = refl
assoc-++ (x ∷ xs) ys zs = cong (x ∷_) (assoc-++ xs ys zs)
assoc-++ (dup x xs i) ys zs j = dup x (assoc-++ xs ys zs j) i
assoc-++ (comm x y xs i) ys zs j = comm x y (assoc-++ xs ys zs j) i
assoc-++ (trunc xs xs' p q i k) ys zs j =
trunc
(assoc-++ xs ys zs j) (assoc-++ xs' ys zs j)
(cong (λ xs → assoc-++ xs ys zs j) p) (cong (λ xs → assoc-++ xs ys zs j) q)
i k
comm-++-[] : ∀ (xs : LFSet A) → xs ++ [] ≡ [] ++ xs
comm-++-[] xs =
PropElim.f
refl
(λ x {xs} ind →
(x ∷ xs) ++ [] ≡⟨ refl ⟩
x ∷ (xs ++ []) ≡⟨ cong (x ∷_) ind ⟩
x ∷ xs ≡⟨ refl ⟩
[] ++ (x ∷ xs) ∎
)
(λ _ → trunc _ _)
xs
comm-++-∷
: ∀ (z : A) xs ys
→ xs ++ (z ∷ ys) ≡ (z ∷ xs) ++ ys
comm-++-∷ z xs ys =
PropElim.f
refl
(λ x {xs} ind →
x ∷ (xs ++ (z ∷ ys)) ≡⟨ cong (x ∷_) ind ⟩
x ∷ z ∷ (xs ++ ys) ≡⟨ comm x z (xs ++ ys) ⟩
z ∷ x ∷ (xs ++ ys) ∎
)
(λ _ → trunc _ _)
xs
comm-++ : (xs ys : LFSet A) → xs ++ ys ≡ ys ++ xs
comm-++ xs ys =
PropElim.f
(comm-++-[] xs)
(λ y {ys} ind →
xs ++ (y ∷ ys) ≡⟨ comm-++-∷ y xs ys ⟩
y ∷ (xs ++ ys) ≡⟨ cong (y ∷_) ind ⟩
y ∷ (ys ++ xs) ≡⟨ refl ⟩
(y ∷ ys) ++ xs ∎
)
(λ _ → trunc _ _)
ys
idem-++ : (xs : LFSet A) → xs ++ xs ≡ xs
idem-++ =
PropElim.f
refl
(λ x {xs} ind →
(x ∷ xs) ++ (x ∷ xs) ≡⟨ refl ⟩
x ∷ (xs ++ (x ∷ xs)) ≡⟨ refl ⟩
x ∷ (xs ++ ((x ∷ []) ++ xs)) ≡⟨ cong (x ∷_) (assoc-++ xs (x ∷ []) xs) ⟩
x ∷ ((xs ++ (x ∷ [])) ++ xs)
≡⟨ cong (λ h → x ∷ (h ++ xs)) (comm-++ xs (x ∷ [])) ⟩
x ∷ x ∷ (xs ++ xs) ≡⟨ cong (λ ys → x ∷ x ∷ ys) ind ⟩
x ∷ x ∷ xs ≡⟨ dup x xs ⟩
x ∷ xs ∎
)
(λ xs → trunc (xs ++ xs) xs)
cart-product : LFSet A → LFSet B → LFSet (A × B)
cart-product [] ys = []
cart-product (x ∷ xs) ys = map (x ,_) ys ++ cart-product xs ys
cart-product (dup x xs i) ys =
( map (x ,_) ys ++ (map (x ,_) ys ++ cart-product xs ys)
≡⟨ assoc-++ (map (x ,_) ys) (map (x ,_) ys) (cart-product xs ys) ⟩
(map (x ,_) ys ++ map (x ,_) ys) ++ cart-product xs ys
≡⟨ cong (_++ cart-product xs ys) (idem-++ (map (x ,_) ys)) ⟩
map (x ,_) ys ++ cart-product xs ys
∎
) i
cart-product (comm x y xs i) ys =
( map (x ,_) ys ++ (map (y ,_) ys ++ cart-product xs ys)
≡⟨ assoc-++ (map (x ,_) ys) (map (y ,_) ys) (cart-product xs ys) ⟩
(map (x ,_) ys ++ map (y ,_) ys) ++ cart-product xs ys
≡⟨ cong (_++ cart-product xs ys) (comm-++ (map (x ,_) ys) (map (y ,_) ys)) ⟩
(map (y ,_) ys ++ map (x ,_) ys) ++ cart-product xs ys
≡⟨ sym (assoc-++ (map (y ,_) ys) (map (x ,_) ys) (cart-product xs ys)) ⟩
map (y ,_) ys ++ (map (x ,_) ys ++ cart-product xs ys)
∎
) i
cart-product (trunc xs xs′ p q i j) ys =
trunc
(cart-product xs ys) (cart-product xs′ ys)
(λ k → cart-product (p k) ys) (λ k → cart-product (q k) ys)
i j
|
sound/sfxasm/4A.asm
|
NatsumiFox/Sonic-3-93-Nov-03
| 7 |
178490
|
<reponame>NatsumiFox/Sonic-3-93-Nov-03<gh_stars>1-10
4A_Header:
sHeaderInit ; Z80 offset is $C41E
sHeaderPatch 4A_Patches
sHeaderTick $01
sHeaderCh $01
sHeaderSFX $80, $C0, 4A_PSG3, $00, $00
4A_PSG3:
sNoisePSG $E7
sVolEnvPSG v0D
dc.b nFs4, $04
4A_Loop1:
dc.b sHold, $0F
saVolPSG $01
sLoop $00, $04, 4A_Loop1
sStop
4A_Patches:
|
Transynther/x86/_processed/AVXALIGN/_st_sm_/i7-7700_9_0x48.log_21829_1147.asm
|
ljhsiun2/medusa
| 9 |
96892
|
<filename>Transynther/x86/_processed/AVXALIGN/_st_sm_/i7-7700_9_0x48.log_21829_1147.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r8
push %rax
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x11f8f, %rdx
nop
nop
nop
nop
nop
cmp $31624, %rsi
mov $0x6162636465666768, %rax
movq %rax, %xmm5
and $0xffffffffffffffc0, %rdx
movntdq %xmm5, (%rdx)
nop
nop
nop
nop
xor %r10, %r10
lea addresses_UC_ht+0x1129f, %rax
nop
nop
nop
sub %rdi, %rdi
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
vmovups %ymm6, (%rax)
nop
nop
nop
nop
nop
xor %rdx, %rdx
lea addresses_WT_ht+0x4e6f, %r14
nop
nop
xor %rdi, %rdi
mov (%r14), %eax
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_A_ht+0x1a98f, %r10
nop
nop
nop
nop
cmp $28593, %r8
mov $0x6162636465666768, %rsi
movq %rsi, (%r10)
nop
nop
nop
xor %rax, %rax
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r8
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r15
push %r8
push %rbx
push %rcx
// Store
lea addresses_UC+0x141df, %rbx
nop
inc %r8
movl $0x51525354, (%rbx)
and %rbx, %rbx
// Store
lea addresses_normal+0xc21f, %rcx
nop
nop
nop
nop
nop
xor %r11, %r11
movw $0x5152, (%rcx)
cmp $5610, %r8
// Load
lea addresses_US+0x822f, %r15
nop
nop
nop
nop
nop
xor %rcx, %rcx
mov (%r15), %bx
nop
nop
cmp $53603, %rcx
// Store
lea addresses_normal+0x1d08f, %rbx
nop
nop
nop
xor %r11, %r11
movw $0x5152, (%rbx)
nop
nop
nop
nop
add $35622, %r15
// Store
lea addresses_PSE+0x50af, %r10
nop
nop
nop
nop
and $57672, %r15
mov $0x5152535455565758, %rcx
movq %rcx, %xmm1
vmovaps %ymm1, (%r10)
nop
nop
nop
nop
nop
and $20904, %rbx
// Store
lea addresses_US+0x1718f, %r12
xor $60639, %rcx
mov $0x5152535455565758, %r8
movq %r8, (%r12)
nop
add %r12, %r12
// Store
lea addresses_WT+0x115df, %r8
nop
nop
nop
nop
nop
add $30178, %r11
movl $0x51525354, (%r8)
nop
nop
nop
nop
nop
inc %r8
// Faulty Load
lea addresses_US+0x1718f, %r11
xor %r10, %r10
mov (%r11), %bx
lea oracles, %r11
and $0xff, %rbx
shlq $12, %rbx
mov (%r11,%rbx,1), %rbx
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': True, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': True, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 4, 'size': 4, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 8, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
lab4/assemblies/int.asm
|
AriaPahlavan/CompArch
| 0 |
175261
|
<gh_stars>0
.ORIG x1200
ADD R6, R6, #-2 ;0x1200
STW R0, R6, #0 ;0x1202
ADD R6, R6, #-2 ;0x1204
STW R1, R6, #0 ;0x1206
LEA R0, TARGET ;0x1208
LDW R0, R0, #0 ;0x120A
LDW R1, R0, #0 ;0x120C R1=MEM[x4000]
ADD R1, R1, #1 ;0x120E
STW R1, R0, #0 ;0x1210
LDW R1, R6, #0 ;0x1212
ADD R6, R6, #2 ;0x1214
LDW R0, R6, #0 ;0x1216
ADD R6, R6, #2 ;0x1218
RTI ;0x121A
TARGET .FILL x4000 ;0x121C
.END
|
awa/plugins/awa-storages/src/awa-storages-servlets.ads
|
twdroeger/ada-awa
| 81 |
8045
|
<gh_stars>10-100
-----------------------------------------------------------------------
-- awa-storages-servlets -- Serve files saved in the storage service
-- Copyright (C) 2012, 2016, 2018, 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Calendar;
with Servlet.Core;
with ASF.Requests;
with ASF.Responses;
-- == Storage Servlet ==
-- The <tt>Storage_Servlet</tt> type is the servlet that allows to retrieve the file
-- content that was uploaded.
package AWA.Storages.Servlets is
type Get_Type is (DEFAULT, AS_CONTENT_DISPOSITION, INVALID);
-- The <b>Storage_Servlet</b> represents the component that will handle
-- an HTTP request received by the server.
type Storage_Servlet is new Servlet.Core.Servlet with private;
-- Called by the servlet container to indicate to a servlet that the servlet
-- is being placed into service.
overriding
procedure Initialize (Server : in out Storage_Servlet;
Context : in Servlet.Core.Servlet_Registry'Class);
-- Called by the server (via the service method) to allow a servlet to handle
-- a GET request.
--
-- Overriding this method to support a GET request also automatically supports
-- an HTTP HEAD request. A HEAD request is a GET request that returns no body
-- in the response, only the request header fields.
--
-- When overriding this method, read the request data, write the response headers,
-- get the response's writer or output stream object, and finally, write the
-- response data. It's best to include content type and encoding.
-- When using a PrintWriter object to return the response, set the content type
-- before accessing the PrintWriter object.
--
-- The servlet container must write the headers before committing the response,
-- because in HTTP the headers must be sent before the response body.
--
-- Where possible, set the Content-Length header (with the
-- Response.Set_Content_Length method), to allow the servlet container
-- to use a persistent connection to return its response to the client,
-- improving performance. The content length is automatically set if the entire
-- response fits inside the response buffer.
--
-- When using HTTP 1.1 chunked encoding (which means that the response has a
-- Transfer-Encoding header), do not set the Content-Length header.
--
-- The GET method should be safe, that is, without any side effects for which
-- users are held responsible. For example, most form queries have no side effects.
-- If a client request is intended to change stored data, the request should use
-- some other HTTP method.
--
-- The GET method should also be idempotent, meaning that it can be safely repeated.
-- Sometimes making a method safe also makes it idempotent. For example, repeating
-- queries is both safe and idempotent, but buying a product online or modifying
-- data is neither safe nor idempotent.
--
-- If the request is incorrectly formatted, Do_Get returns an HTTP "Bad Request"
overriding
procedure Do_Get (Server : in Storage_Servlet;
Request : in out ASF.Requests.Request'Class;
Response : in out ASF.Responses.Response'Class);
-- Load the data content that correspond to the GET request and get the name as well
-- as mime-type and date.
procedure Load (Server : in Storage_Servlet;
Request : in out ASF.Requests.Request'Class;
Name : out Ada.Strings.Unbounded.Unbounded_String;
Mime : out Ada.Strings.Unbounded.Unbounded_String;
Date : out Ada.Calendar.Time;
Data : out ADO.Blob_Ref);
-- Get the expected return mode (content disposition for download or inline).
function Get_Format (Server : in Storage_Servlet;
Request : in ASF.Requests.Request'Class) return Get_Type;
private
type Storage_Servlet is new Servlet.Core.Servlet with null record;
end AWA.Storages.Servlets;
|
audio/sfx/cry1e_1.asm
|
AmateurPanda92/pokemon-rby-dx
| 9 |
6421
|
SFX_Cry1E_1_Ch4:
dutycycle 240
squarenote 6, 15, 2, 1536
squarenote 6, 14, 2, 1600
squarenote 6, 13, 2, 1664
squarenote 6, 14, 2, 1728
squarenote 6, 13, 2, 1792
squarenote 6, 12, 2, 1856
squarenote 6, 11, 2, 1920
squarenote 8, 10, 1, 1984
endchannel
SFX_Cry1E_1_Ch5:
dutycycle 17
squarenote 3, 0, 8, 1
squarenote 6, 12, 2, 1473
squarenote 6, 11, 2, 1538
squarenote 6, 10, 2, 1601
squarenote 6, 11, 2, 1666
squarenote 6, 10, 2, 1730
squarenote 6, 9, 2, 1793
squarenote 6, 10, 2, 1858
squarenote 8, 8, 1, 1921
endchannel
SFX_Cry1E_1_Ch7:
noisenote 6, 0, 8, 1
noisenote 5, 14, 2, 92
noisenote 5, 12, 2, 76
noisenote 5, 13, 2, 60
noisenote 5, 11, 2, 44
noisenote 5, 12, 2, 28
noisenote 5, 10, 2, 27
noisenote 5, 9, 2, 26
noisenote 8, 8, 1, 24
endchannel
|
milestone3/src/main/resources/antlr4/XQuery.g4
|
Easonrust/XQuery-Evaluator
| 0 |
793
|
<filename>milestone3/src/main/resources/antlr4/XQuery.g4
grammar XQuery ;
@header {
package edu.ucsd.CSE232B.parsers;
}
/*Rules*/
ap
: doc '/' rp # ApChildren
| doc '//' rp # ApAll
;
doc
: DOC LPR fname RPR
;
fname
: STRING
;
constant
: STRING
;
rp
: NAME # TagName
| '*' # AllChildren
| '.' # Current
| '..' # Parent
| TXT # Text
| '@' NAME # Attribute
| LPR rp RPR # RpwithP
| rp '/' rp # RpChildren
| rp '//' rp # RpAll
| rp '[' filter ']' # RpFilter
| rp ',' rp # TwoRp
;
filter
: rp # FilterRp
| rp '=' rp # FilterEqual
| rp 'eq' rp # FilterEqual
| rp '==' rp # FilterIs
| rp 'is' rp # FilterIs
| rp '=' constant # FilterConstant
| LPR filter RPR # FilterwithP
| filter 'and' filter # FilterAnd
| filter 'or' filter # FilterOr
| 'not' filter # FilterNot
;
xq
: var # XQVar
| constant # XQStrConst
| ap # XQAp
| LPR xq RPR # XQwithP
| xq '/' rp # XQRp
| xq '//' rp # XQRpAll
| '<' NAME '>' '{' xq '}' '<''/' NAME '>' # XQTag
| xq ',' xq # TwoXQ
| forClause letClause? whereClause? returnClause # XQFLWR
| letClause xq # XQLet
| joinClause # XQJoin
;
var
: '$' NAME
;
forClause
: 'for' (var 'in' xq ',' )* var 'in' xq
;
letClause
:'let' (var ':=' xq ',' )* var ':=' xq
;
whereClause
: 'where' cond
;
returnClause
: 'return' xq
;
joinClause
: 'join' '(' xq ',' xq ',' attr ',' attr')'
;
attr
: '[' NAME ? (',' NAME )* ']'
;
cond
: xq '=' xq # CondEqual
| xq 'eq' xq # CondEqual
| xq '==' xq # CondIs
| xq 'is' xq # CondIs
| 'empty' '(' xq ')' # CondEmpty
| 'some' var 'in' xq (',' var 'in' xq)* 'satisfies' cond # CondSome
| '(' cond ')' # CondWithPar
| cond 'and' cond # CondAnd
| cond 'or' cond # CondOr
| 'not' cond # CondNot
;
/*Tokens*/
STRING
:
'"'
(
ESCAPE
| ~["\\]
)* '"'
| '\''
(
ESCAPE
| ~['\\]
)* '\''
;
ESCAPE
:
'\\'
(
['"\\]
)
;
DOC: D O C | 'document';
fragment D: [dD];
fragment O: [oO];
fragment C: [cC];
LPR: '(';
RPR: ')';
NAME: [a-zA-Z0-9_-]+;
TXT: 'text()';
WS : [ \t\r\n]+ -> skip;
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/英語_PAL/pal_asm/zel_play.asm
|
prismotizm/gigaleak
| 0 |
6599
|
<filename>other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/英語_PAL/pal_asm/zel_play.asm
Name: zel_play.asm
Type: file
Size: 356132
Last-Modified: '2016-05-13T04:25:37Z'
SHA-1: C5BF521676B3C71D20F38DA7636698EAD5C87EF0
Description: null
|
README/DependentlyTyped/Type-checker.agda
|
nad/dependently-typed-syntax
| 5 |
4946
|
<gh_stars>1-10
------------------------------------------------------------------------
-- A type-checker
------------------------------------------------------------------------
import Axiom.Extensionality.Propositional as E
import Level
open import Data.Universe
-- The code makes use of the assumption that propositional equality of
-- functions is extensional.
module README.DependentlyTyped.Type-checker
(Uni₀ : Universe Level.zero Level.zero)
(ext : E.Extensionality Level.zero Level.zero)
where
open import Category.Monad
open import Data.Maybe hiding (_>>=_)
import Data.Maybe.Categorical as Maybe
open import Data.Nat using (ℕ; zero; suc; pred)
open import Data.Product as Prod
open import Function as F hiding (_∋_) renaming (_∘_ to _⊚_)
import README.DependentlyTyped.Equality-checker as EC; open EC Uni₀ ext
import README.DependentlyTyped.NBE as NBE; open NBE Uni₀ ext
import README.DependentlyTyped.NormalForm as NF
open NF Uni₀ hiding (⌊_⌋; no)
import README.DependentlyTyped.Raw-term as RT; open RT Uni₀
import README.DependentlyTyped.Term as Term; open Term Uni₀
import README.DependentlyTyped.Term.Substitution as S; open S Uni₀
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open import Relation.Nullary
import Relation.Nullary.Decidable as Dec
open import Relation.Nullary.Product
open P.≡-Reasoning
open RawMonadZero (Maybe.monadZero {f = Level.zero})
-- Computes a syntactic type for a variable from a matching syntactic
-- context.
type-of-var : ∀ {Γ σ} → Γ ∋ σ → Γ ctxt → Γ ⊢ σ type
type-of-var zero (Γ′ ▻ σ′) = σ′ /⊢t wk
type-of-var (suc x) (Γ′ ▻ σ′) = type-of-var x Γ′ /⊢t wk
-- Infers the type of a variable, if possible.
infer-var : (Γ : Ctxt) (x : ℕ) →
Dec (∃₂ λ σ (x′ : Γ ∋ σ) → position x′ ≡ x)
infer-var ε x = no helper
where
helper : ¬ ∃₂ λ σ (x′ : ε ∋ σ) → position x′ ≡ x
helper (_ , () , _)
infer-var (Γ ▻ σ) zero = yes (σ /̂ ŵk , zero , P.refl)
infer-var (Γ ▻ σ) (suc x) =
Dec.map′ (Prod.map (λ σ → σ /̂ ŵk) (Prod.map suc (P.cong suc)))
helper
(infer-var Γ x)
where
helper : (∃₂ λ τ (x′ : Γ ▻ σ ∋ τ) → position x′ ≡ suc x) →
(∃₂ λ τ (x′ : Γ ∋ τ) → position x′ ≡ x)
helper (._ , zero , ())
helper (._ , suc x′ , eq) = (_ , x′ , P.cong pred eq)
-- Infers the /syntactic/ type of a variable, if possible.
infer-var-syntactic :
∀ {Γ} → Γ ctxt → (x : ℕ) →
Dec (∃ λ σ → Γ ⊢ σ type × ∃ λ (x′ : Γ ∋ σ) → position x′ ≡ x)
infer-var-syntactic {Γ} Γ′ x = Dec.map′
(Prod.map F.id (λ p → type-of-var (proj₁ p) Γ′ , proj₁ p , proj₂ p))
(Prod.map F.id proj₂)
(infer-var Γ x)
mutual
-- Tries to infer a well-typed form of a raw type.
infer-ty :
∀ {Γ} → Γ ctxt → (σ : Raw-ty) →
Maybe (∃₂ λ σ′ (σ″ : Γ ⊢ σ′ type) → ⌊ σ″ ⌋ty ≡ ⌊ σ ⌋raw-ty)
infer-ty Γ′ ⋆ = return (_ , ⋆ , P.refl)
infer-ty Γ′ (el t) =
check Γ′ ⋆ t >>= λ { (t′ , eq) →
return (_ , el t′ , P.cong el eq) }
infer-ty Γ′ (π σ′₁ σ′₂) =
infer-ty Γ′ σ′₁ >>= λ { (_ , σ′₁′ , eq₁) →
infer-ty (Γ′ ▻ σ′₁′) σ′₂ >>= λ { (_ , σ′₂′ , eq₂) →
return (_ , π σ′₁′ σ′₂′ , P.cong₂ π eq₁ eq₂) }}
-- Tries to infer a type for a term. In the case of success a
-- well-typed term is returned.
infer :
∀ {Γ} → Γ ctxt → (t : Raw) →
Maybe (∃ λ σ → Γ ⊢ σ type × ∃ λ (t′ : Γ ⊢ σ) → ⌊ t′ ⌋ ≡ ⌊ t ⌋raw)
infer Γ′ (var x) with infer-var-syntactic Γ′ x
... | yes (_ , σ′ , x′ , eq) = return (_ , σ′ , var x′ , P.cong var eq)
... | no _ = ∅
infer Γ′ (ƛ t) = ∅
infer Γ′ (t₁ · t₂) =
infer Γ′ t₁ >>=
λ { (._ , π σ′₁ σ′₂ , t₁′ , eq₁) →
check Γ′ σ′₁ t₂ >>= λ { (t₂′ , eq₂) →
return (_ , σ′₂ /⊢t sub t₂′ , t₁′ · t₂′ ,
P.cong₂ _·_ eq₁ eq₂) }
; _ → ∅
}
infer Γ′ (t ∶ σ) =
infer-ty Γ′ σ >>= λ { (_ , σ′ , eq) →
check Γ′ σ′ t >>= λ { (t′ , eq) →
return (_ , σ′ , t′ , eq) }}
-- Tries to type-check a term. In the case of success a well-typed
-- term is returned.
check : ∀ {Γ σ} → Γ ctxt → (σ′ : Γ ⊢ σ type) (t : Raw) →
Maybe (∃ λ (t′ : Γ ⊢ σ) → ⌊ t′ ⌋ ≡ ⌊ t ⌋raw)
check Γ′ (π σ′₁ σ′₂) (ƛ t) =
check (Γ′ ▻ σ′₁) σ′₂ t >>= λ { (t′ , eq) →
return (ƛ t′ , P.cong ƛ eq) }
check Γ′ σ′ t =
infer Γ′ t >>= λ { (_ , τ′ , t′ , eq₁) →
τ′ ≟-Type σ′ >>= λ eq₂ →
return (P.subst (_⊢_ _) (≅-Type-⇒-≡ eq₂) t′ , (begin
⌊ P.subst (_⊢_ _) (≅-Type-⇒-≡ eq₂) t′ ⌋ ≡⟨ ⌊⌋-cong $ drop-subst-⊢ F.id (≅-Type-⇒-≡ eq₂) ⟩
⌊ t′ ⌋ ≡⟨ eq₁ ⟩
⌊ t ⌋raw ∎)) }
-- Tries to establish that the given raw term has the given raw type
-- (in the empty context).
infix 4 _∋?_
_∋?_ : (σ : Raw-ty) (t : Raw) →
Maybe (∃₂ λ (σ′ : Type ε) (σ″ : ε ⊢ σ′ type) →
∃ λ (t′ : ε ⊢ σ′) →
⌊ σ″ ⌋ty ≡ ⌊ σ ⌋raw-ty × ⌊ t′ ⌋ ≡ ⌊ t ⌋raw)
σ ∋? t = infer-ty ε σ >>= λ { (σ′ , σ″ , eq₁) →
check ε σ″ t >>= λ { (t′ , eq₂) →
return (σ′ , σ″ , t′ , eq₁ , eq₂) }}
------------------------------------------------------------------------
-- Examples
private
σ₁ : Raw-ty
σ₁ = π ⋆ ⋆
σ₁′ : Type ε
σ₁′ = proj₁ $ from-just $ infer-ty ε σ₁
t₁ : Raw
t₁ = ƛ (var zero)
t₁′ : ε ⊢ σ₁′
t₁′ = proj₁ $ proj₂ $ proj₂ $ from-just $ σ₁ ∋? t₁
t₂ : ε ▻ (⋆ , _) ⊢ (⋆ , _)
t₂ = proj₁ $ proj₂ $ proj₂ $ from-just $ infer (ε ▻ ⋆) (var zero)
t₃ : Raw
t₃ = (ƛ (var zero) ∶ π ⋆ ⋆) · var zero
t₃′ : ε ▻ (⋆ , _) ⊢ (⋆ , _)
t₃′ = proj₁ $ proj₂ $ proj₂ $ from-just $ infer (ε ▻ ⋆) t₃
|
programs/oeis/054/A054487.asm
|
neoneye/loda
| 22 |
28210
|
<filename>programs/oeis/054/A054487.asm
; A054487: a(n) = (3*n+4)*binomial(n+7, 7)/4.
; 1,14,90,390,1320,3762,9438,21450,45045,88660,165308,294372,503880,833340,1337220,2089164,3187041,4758930,6970150,10031450,14208480,19832670,27313650,37153350,49961925,66475656,87576984,114316840,147939440,189909720,241943592,306041208,384523425,480071670,595771410,735159438,902275192,1101716330,1338698790,1619121570,1949636469,2337723036,2791768980,3321156300,3936353400,4649013460,5472079340,6419895300,7508325825,8754881850,10178854686,11801457954,13645977840,15737931990,18105237370,20778387422,23790638853,27178208400,30980479920,35240222160,40003817568,45321502512,51247619280,57840880240,65164644545,73287207774,82282104906,92228427030,103211152200,115321490850,128657246190,143323190010,159431454325,177101939300,196462737900,217650577716,240811280424,266100239340,293682915540,323735353020,356444713377,392009830498,430641785750,472564504170,518015372160,567245877198,620522270082,678126250230,740355674565,807525290520,879967493704,958033110776,1042092208080,1132534926600,1229772343800,1334237362920,1446385630305,1566696481350,1695673915650,1833847601950
lpb $0
mov $2,$0
sub $0,1
seq $2,34265 ; a(n) = binomial(n+6,6)*(6*n+7)/7.
add $1,$2
lpe
add $1,1
mov $0,$1
|
0x12-singly_linked_lists/101-hello_holberton.asm
|
tenmark86/alx-low_level_programming
| 0 |
101906
|
<reponame>tenmark86/alx-low_level_programming
SECTION .data
msg: db "Hello, Holberton", 0
fmt: db "%s", 10, 0
SECTION .text
extern printf
global main
main:
mov esi, msg
mov edi, fmt
mov eax, 0
call printf
mov eax, 0
ret
|
src/main/fragment/mos6502-common/vdum1=_inc_vdum1.asm
|
jbrandwood/kickc
| 2 |
165980
|
<filename>src/main/fragment/mos6502-common/vdum1=_inc_vdum1.asm<gh_stars>1-10
inc {m1}
bne !+
inc {m1}+1
bne !+
inc {m1}+2
bne !+
inc {m1}+3
!:
|
software/hal/boards/common/tools/bounded_image.ads
|
TUM-EI-RCS/StratoX
| 12 |
15563
|
<gh_stars>10-100
with Generic_Bounded_Image;
with Interfaces; use Interfaces;
pragma Elaborate_All (Generic_Bounded_Image);
-- @summary functions to provide a string image of numbers
-- overapproximating the length, otherwise we would need a
-- separate body for each data type. This is tight enough
-- in most cases.
-- Also note that the intrinsic Image functions return with a leading
-- space, which is why
package Bounded_Image with SPARK_Mode is
function Integer_Img is new Generic_Bounded_Image.Image_32 (Integer) with Inline;
function Unsigned_Img is new Generic_Bounded_Image.Image_32 (Unsigned_32) with Inline;
function Natural_Img is new Generic_Bounded_Image.Image_32 (Natural) with Inline;
function Unsigned8_Img is new Generic_Bounded_Image.Image_4 (Unsigned_8) with Inline;
function Integer8_Img is new Generic_Bounded_Image.Image_4 (Integer_8) with Inline;
end Bounded_Image;
|
oeis/117/A117490.asm
|
neoneye/loda-programs
| 11 |
6509
|
<filename>oeis/117/A117490.asm
; A117490: Number of primes between n and n^2 (with n and n^2 excluded).
; Submitted by <NAME>
; 0,1,2,4,6,8,11,14,18,21,25,29,33,38,42,48,54,59,64,70,77,84,90,96,105,113,120,128,136,144,151,161,170,180,189,199,207,216,228,239,250,261,269,281,292,305,314,327,342,352,363,378,393,405,418,429,441,458,470
mov $3,$0
mul $3,$0
add $3,$0
add $0,$3
mov $5,$0
lpb $3
mov $2,$5
seq $2,80339 ; Characteristic function of {1} union {primes}: 1 if n is 1 or a prime, else 0.
sub $3,1
add $4,$2
sub $5,1
lpe
mov $0,$4
|
test/Fail/BuiltinSharpBadType.agda
|
cagix/agda
| 1,989 |
11368
|
<filename>test/Fail/BuiltinSharpBadType.agda
data ⊥ : Set where
postulate
∞ : ∀ {a} → Set a → Set a
♯_ : ∀ {a} {A : Set a} → (A → ⊥) → ∞ A
♭ : ∀ {a} {A : Set a} → ∞ A → A → ⊥
{-# BUILTIN INFINITY ∞ #-}
{-# BUILTIN SHARP ♯_ #-}
{-# BUILTIN FLAT ♭ #-}
-- Issue #5610: with these bad types for sharp and flat, we can prove
-- false. The reason is that ∞ is assumed to be strictly-positive in
-- the positivity checker (even guarding positive). So making ∞ A
-- isomorphic to A → ⊥ will be contradictory to this assumption.
data D : Set where
wrap : ∞ D → D
lam : (D → ⊥) → D
lam f = wrap (♯ f)
app : D → D → ⊥
app (wrap g) d = ♭ g d
delta : D
delta = lam (λ x → app x x)
omega : ⊥
omega = app delta delta
|
Categories/PushOuts.agda
|
jmchapman/Relative-Monads
| 21 |
11520
|
<filename>Categories/PushOuts.agda
module Categories.PushOuts where
open import Library
open import Categories
open Cat
record Square {a}{b}{C : Cat {a}{b}}{X Y Z}(f : Hom C Z X)(g : Hom C Z Y) : Set (a ⊔ b) where
constructor square
field W : Obj C
h : Hom C X W
k : Hom C Y W
scom : comp C h f ≅ comp C k g
record SqMap {a}{b}{C : Cat {a}{b}}{X Y Z : Obj C}{f : Hom C Z X}{g : Hom C Z Y}
(sq sq' : Square {a}{b}{C} f g) : Set (a ⊔ b) where
constructor sqmap
open Square
field sqMor : Hom C (W sq) (W sq')
leftTr : comp C sqMor (h sq) ≅ h sq'
rightTr : comp C sqMor (k sq) ≅ k sq'
open SqMap
record PushOut {a}{b}{C : Cat {a}{b}}{X Y Z}(f : Hom C Z X)(g : Hom C Z Y) : Set (a ⊔ b) where
constructor pushout
field sq : Square {a}{b}{C} f g
uniqPush : (sq' : Square f g) → Σ (SqMap sq sq')
\ u → (u' : SqMap sq sq') → sqMor u ≅ sqMor u'
|
samples/jumptable.asm
|
wilsonpilon/msx-menu
| 0 |
95188
|
; jumptable.asm
; Test of ## operator.
org 100h
bdos equ 5
conin equ 1
pstring equ 9
start jp init
jpfunc macro nfunc
jp function_ ## nfunc
endm
table:
irp func, mess1, mess2, presskey, endline
jpfunc func
endm
print ld c, pstring
jp bdos
init
if 0
rept 3, nfunc
ld a, nfunc
call usefunc
endm
else
rept 3, nfunc, 2, -1
ld a, nfunc
call usefunc
endm
endif
ld a, 3
call usefunc
ld c, 0
call bdos
usefunc
ld b, a
add a, a
add a, b
ld c, a
ld b, 0
ld hl, table
add hl, bc
push hl
ret
function_mess1 proc
local message
ld de, message
call print
ret
message db "Hello, world\r\n$"
endp
function_mess2 proc
local message
ld c, pstring
ld de, message
jp bdos
message db 'Have a nice day', 0Dh, 0Ah, '$'
endp
function_presskey proc
local message
ld c, pstring
ld de, message
call bdos
ld c, conin
call bdos
ret
message db 'Press any key...$'
endp
function_endline proc
local message
ld de, message
jp print
message db 0Dh, 0Ah, '$'
endp
end start
; End of jumptable.asm
|
Benchmarks/JMP Test.asm
|
RyanWangGit/MIPS_CPU
| 60 |
162136
|
# Test j, jal, jr instructions, the total cycles should be 15.
.text
addi $s1,$zero, 1
j jmp_next1
addi $s1,$zero, 1
addi $s2,$zero, 2
addi $s3,$zero, 3
jmp_next1:
j jmp_next2
addi $s1,$zero, 1
addi $s2,$zero, 2
addi $s3,$zero, 3
jmp_next2:
j jmp_next3
addi $s1,$zero, 1
addi $s2,$zero, 2
addi $s3,$zero, 3
jmp_next3:
j jmp_next4
addi $s1,$zero, 1
addi $s2,$zero, 2
addi $s3,$zero, 3
jmp_next4:jal jmp_count
addi $v0,$zero,10 # system call for exit
syscall # done
jmp_count: addi $s0,$zero, 0
addi $s0,$s0, 1
add $a0,$0,$s0
addi $v0,$0,34 # display hex
syscall # we are out of here.
addi $s0,$s0, 2
add $a0,$0,$s0
addi $v0,$0,34 # display hex
syscall # we are out of here.
addi $s0,$s0, 3
add $a0,$0,$s0
addi $v0,$0,34 # display hex
syscall # we are out of here.
addi $s0,$s0, 4
add $a0,$0,$s0
addi $v0,$0,34 # display hex
syscall # we are out of here.
addi $s0,$s0, 5
add $a0,$0,$s0
addi $v0,$0,34 # display hex
syscall # we are out of here.
addi $s0,$s0, 6
add $a0,$0,$s0
addi $v0,$0,34 # display hex
syscall # we are out of here.
addi $s0,$s0, 7
add $a0,$0,$s0
addi $v0,$0,34 # display hex
syscall # we are out of here.
addi $s0,$s0, 8
add $a0,$0,$s0
addi $v0,$0,34 # display hex
addi $v0,$0,34 # display hex
syscall # we are out of here.
jr $31
|
test/Succeed/Issue2056.agda
|
shlevy/agda
| 1,989 |
17014
|
<gh_stars>1000+
data Size : Set where
↑ : Size → Size
↑ ()
data N : Size → Set where
suc : ∀{i} (a : N i) → N (↑ i)
data Val : ∀{i} (t : N i) → Set where
val : ∀{i} (n : N i) → Val (suc n)
record R (j : Size) : Set where
field num : N j
data W {j} (ft : R j) : Set where
immed : (v : Val (R.num ft)) → W ft
postulate
E : ∀{j} (ft : R j) (P : (w : W ft) → Set) → Set
test : ∀ {j} (ft : R j) → Set
test {j} ft = E {j} ft testw
where
testw : ∀ {ft : R _} (w : W ft) → Set
testw (immed (val a)) = test record{ num = a }
-- testw passes without quantification over ft
-- or with _ := j
{- OLD ERROR
Cannot instantiate the metavariable _35 to solution ↑ i since it
contains the variable i which is not in scope of the metavariable
or irrelevant in the metavariable but relevant in the solution
when checking that the pattern val a has type Val (R.num ft₁)
-}
|
examples/hello_world_request_reply/src/primes-replier_main.adb
|
persan/dds-requestreply
| 0 |
5787
|
with Ada.Command_Line;
with Ada.Numerics.Long_Elementary_Functions;
with Ada.Text_IO;
with DDS.DomainParticipant;
with DDS.DomainParticipantFactory;
with Primes.PrimeNumberReplier;
with Primes.PrimeNumberRequest_TypeSupport;
with RTIDDS.Config;
procedure Primes.Replier_Main is
use Ada.Numerics.Long_Elementary_Functions;
use Ada.Text_IO;
use Primes;
use type DDS.DomainParticipant.Ref_Access;
use type DDS.ReturnCode_T;
use type DDS.long;
Factory : constant DDS.DomainParticipantFactory.Ref_Access := DDS.DomainParticipantFactory.Get_Instance;
MAX_WAIT : constant DDS.Duration_T := DDS.To_Duration_T (20.0);
procedure Replier_Shutdown
(Participant : in out DDS.DomainParticipant.Ref_Access;
Replier : in Primes.PrimeNumberReplier.Ref_Access;
Request : in out PrimeNumberRequest_Access) is
pragma Unreferenced (Request);
begin
-- Delete_Data (Request);
Replier.Delete;
Participant.Delete_Contained_Entities;
Factory.Delete_Participant (Participant);
Factory.Finalize_Instance;
end;
procedure Send_Error_Reply (Replier : PrimeNumberReplier.Ref_Access;
Request : PrimeNumberRequest;
Request_Id : DDS.SampleIdentity_T) is
pragma Unreferenced (Request);
Reply : aliased PrimeNumberReply;
begin
Initialize (Reply);
Reply.Status := REPLY_ERROR;
Replier.Send_Reply (Reply, Request_Id);
Finalize (Reply);
end;
procedure Calculate_And_Send_Primes (Replier : PrimeNumberReplier.Ref_Access;
Request : PrimeNumberRequest;
Request_Id : DDS.SampleIdentity_T) is
M, Length : DDS.long;
N : constant DDS.long := Request.N;
Primes_Per_Reply : constant DDS.Natural := Request.Primes_Per_Reply;
Reply : aliased PrimeNumberReply;
type Prime_Type is array (0 .. N) of Integer;
Prime : Prime_Type := (0 => 0, 1 => 0, others => 1);
use DDS.Long_Seq;
begin
Length := 0;
Initialize (Reply);
Set_Maximum (Reply.Primes'Access, Primes_Per_Reply);
Reply.Status := REPLY_IN_PROGRESS;
M := DDS.long (Sqrt (Long_Float (N)));
for I in 2 .. M loop
if Prime (I) /= 0 then
for K in I * I .. N loop
Prime (K) := 0;
end loop;
Append (Reply.Primes'Access, I);
if Length + 1 = Primes_Per_Reply then
Replier.Send_Reply (Reply, Request_Id);
Set_Length (Reply.Primes'Access, 0);
end if;
end if;
end loop;
-- Calculation is done. Send remaining prime numbers
for I in M + 1 .. N loop
if Prime (I) /= 0 then
Length := Get_Length (Reply.Primes'Access);
Append (Reply.Primes'Access, I);
if Length + 1 = Primes_Per_Reply then
Replier.Send_Reply (Reply, Request_Id);
Set_Length (Reply.Primes'Access, 0);
end if;
end if;
end loop;
-- Send the last reply. Indicate that the calculation is complete and
-- send any prime number left in the sequence
Reply.Status := REPLY_COMPLETED;
Replier.Send_Reply (Reply, Request_Id);
end;
procedure Replier_Main (Domain_Id : DDS.DomainId_T) is
Participant : DDS.DomainParticipant.Ref_Access;
Replier : PrimeNumberReplier.Ref_Access;
Request_Id : Dds.SampleIdentity_T;
Request_Info : aliased DDS.SampleInfo;
Request : PrimeNumberRequest_Access := PrimeNumberRequest_TypeSupport.Create_Data;
RetCode : DDS.ReturnCode_T := DDS.RETCODE_OK;
begin
-- /* Create the participant */
Participant := Factory.Create_Participant (Domain_Id);
if Participant = null then
Put_Line (Standard_Error, "create_participant error");
return;
end if;
-- Create the replier with that participant, and a QoS profile
-- * defined in USER_QOS_PROFILES.xml
Replier := PrimeNumberReplier.Create (Participant, Service_Name , Qos_Library_Name, Qos_Profile_Name);
Request := PrimeNumberRequest_TypeSupport.Create_Data;
-- /*
-- * Receive requests and process them
-- */
Retcode := Replier.Receive_Request (Request.all, Request_Info, Timeout => MAX_WAIT);
while Retcode = DDS.RETCODE_OK loop
if Request_Info.Valid_Data then
DDS.Get_Sample_Identity (Request_Info, Request_Id);
-- This constant is defined in Primes.idl */
if Request.N <= 0 or
Request.Primes_Per_Reply <= 0 or
Request.Primes_Per_Reply > PRIME_SEQUENCE_MAX_LENGTH then
Put_Line (Standard_Error, "Cannot process request");
Send_Error_Reply (Replier, Request.all, Request_Id);
else
Put_Line ("Calculating prime numbers below " & Request.N'Img & "... ");
-- This operation could be executed in a separate thread,
-- to process requests in parallel
Calculate_And_Send_Primes (Replier => Replier,
Request => Request.all,
Request_Id => Request_Id);
Put_Line ("DONE");
end if;
end if;
Retcode := Replier.Receive_Request (Request => Request.all,
Info_Seq => Request_Info,
Timeout => MAX_WAIT);
end loop;
if Retcode = DDS.RETCODE_TIMEOUT then
Put_Line ("No request received for " & MAX_WAIT.Sec'Img &
" seconds. Shutting down replier");
else
Put_Line (Standard_Error, "Error in replier " & Retcode'Img);
end if;
Replier_Shutdown (Participant, Replier, Request);
end;
Domain_Id : DDS.DomainId_T := 0;
begin
if Ada.Command_Line.Argument_Count > 0 then
Domain_Id := DDS.DomainId_T'Value (Ada.Command_Line.Argument (1));
end if;
RTIDDS.Config.Logger.Get_Instance.Set_Verbosity (RTIDDS.Config.VERBOSITY_WARNING);
-- Uncomment this to turn on additional logging
-- RTIDDS.Config.Logger.Get_Instance.Set_Verbosity (RTIDDS.Config.VERBOSITY_ERROR);
Put_Line ("PrimeNumberRequester: Sending a request to calculate the " &
"(on domain " & Domain_Id'Img & ")");
Replier_Main (Domain_Id);
end Primes.Replier_Main;
|
47-Automated-Pleasantries.speed.size.asm
|
blueset/7bh-solutions
| 0 |
245506
|
-- 7 Billion Humans --
-- 47: Automated Pleasantries --
-- Size: 3/3 --
-- Speed: 7/8 --
if w != nothing:
listenfor morning
endif
tell e morning
|
programs/oeis/166/A166753.asm
|
neoneye/loda
| 22 |
172298
|
; A166753: Partial sums of A166752.
; 1,2,5,6,17,18,61,62,233,234,917,918,3649,3650,14573,14574,58265,58266,233029,233030,932081,932082,3728285,3728286,14913097,14913098,59652341,59652342,238609313,238609314,954437197,954437198,3817748729,3817748730,15270994853,15270994854,61083979345,61083979346,244335917309,244335917310,977343669161,977343669162,3909374676565,3909374676566,15637498706177,15637498706178,62549994824621,62549994824622,250199979298393,250199979298394,1000799917193477,1000799917193478,4003199668773809,4003199668773810,16012798675095133,16012798675095134,64051194700380425,64051194700380426,256204778801521589,256204778801521590,1024819115206086241,1024819115206086242,4099276460824344845,4099276460824344846,16397105843297379257,16397105843297379258,65588423373189516901,65588423373189516902,262353693492758067473,262353693492758067474,1049414773971032269757,1049414773971032269758,4197659095884129078889,4197659095884129078890,16790636383536516315413,16790636383536516315414,67162545534146065261505,67162545534146065261506,268650182136584261045869,268650182136584261045870,1074600728546337044183321,1074600728546337044183322,4298402914185348176733125,4298402914185348176733126,17193611656741392706932337,17193611656741392706932338,68774446626965570827729181,68774446626965570827729182,275097786507862283310916553,275097786507862283310916554,1100391146031449133243666037,1100391146031449133243666038,4401564584125796532974663969,4401564584125796532974663970,17606258336503186131898655693,17606258336503186131898655694,70425033346012744527594622585,70425033346012744527594622586,281700133384050978110378490149,281700133384050978110378490150
mov $1,$0
add $0,2
add $1,1
lpb $1
add $0,$2
sub $1,1
trn $1,1
mul $2,4
add $2,2
lpe
sub $0,1
|
libsrc/_DEVELOPMENT/math/float/am9511/lam32/z80/asm_hypotf.asm
|
ahjelm/z88dk
| 640 |
19497
|
<reponame>ahjelm/z88dk
; float _hypotf (float left, float right) __z88dk_callee
SECTION code_clib
SECTION code_fp_am9511
PUBLIC asm_hypotf
EXTERN asm_am9511_hypot_callee
; find the hypotenuse of two sccz80 floats
;
; enter : stack = sccz80_float left, ret
; DEHL = sccz80_float right
;
; exit : DEHL = sccz80_float(left+right)
;
; uses : af, bc, de, hl, af', bc', de', hl'
DEFC asm_hypotf = asm_am9511_hypot_callee ; enter stack = IEEE-754 float left
; DEHL = IEEE-754 float right
; return DEHL = IEEE-754 float
|
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xca.log_21829_831.asm
|
ljhsiun2/medusa
| 9 |
86628
|
<filename>Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xca.log_21829_831.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r15
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x11376, %r10
nop
nop
nop
nop
nop
sub %rsi, %rsi
mov (%r10), %rdx
add %rcx, %rcx
lea addresses_WT_ht+0x52ea, %r15
nop
nop
lfence
mov (%r15), %r12d
nop
add $64588, %rsi
lea addresses_D_ht+0xa702, %rdx
clflush (%rdx)
nop
nop
nop
nop
nop
dec %rsi
mov (%rdx), %r12d
nop
nop
nop
nop
nop
cmp $19580, %r15
lea addresses_A_ht+0x12332, %rsi
lea addresses_D_ht+0x10ea, %rdi
nop
nop
nop
xor $18455, %r10
mov $123, %rcx
rep movsq
nop
nop
nop
nop
nop
inc %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r15
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r8
push %r9
push %rax
push %rbx
push %rsi
// Store
lea addresses_WT+0x1f68a, %rbx
nop
nop
nop
xor %r8, %r8
movw $0x5152, (%rbx)
nop
nop
nop
cmp $56680, %rax
// Store
lea addresses_US+0xccea, %r11
nop
nop
nop
nop
nop
add $17531, %rax
movl $0x51525354, (%r11)
nop
nop
nop
nop
nop
add %r11, %r11
// Store
lea addresses_normal+0x6eea, %r9
nop
nop
nop
nop
inc %rax
mov $0x5152535455565758, %r11
movq %r11, %xmm0
vmovups %ymm0, (%r9)
add %rbx, %rbx
// Faulty Load
mov $0x10c36400000002ea, %r9
nop
nop
nop
cmp $61776, %rsi
mov (%r9), %r8w
lea oracles, %r9
and $0xff, %r8
shlq $12, %r8
mov (%r9,%r8,1), %r8
pop %rsi
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 10}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_NC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 9}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
autovectorization-tests/results/msvc19.28.29333-avx512/adjacent_find.asm
|
clayne/toys
| 0 |
167542
|
_v$ = 8 ; size = 4
bool adjacent_find_epi32(std::vector<int,std::allocator<int> > const &) PROC ; adjacent_find_epi32, COMDAT
mov ecx, DWORD PTR _v$[esp-4]
push esi
push edi
mov eax, DWORD PTR [ecx+4]
mov esi, eax
mov edi, DWORD PTR [ecx]
cmp edi, eax
je SHORT $LN31@adjacent_f
lea ecx, DWORD PTR [edi+4]
cmp ecx, eax
je SHORT $LN31@adjacent_f
mov esi, edi
mov edi, DWORD PTR [edi]
npad 4
$LL20@adjacent_f:
mov edx, DWORD PTR [ecx]
cmp edi, edx
je SHORT $LN31@adjacent_f
mov esi, ecx
mov edi, edx
add ecx, 4
cmp ecx, eax
jne SHORT $LL20@adjacent_f
mov esi, eax
$LN31@adjacent_f:
cmp esi, eax
pop edi
setne al
pop esi
ret 0
bool adjacent_find_epi32(std::vector<int,std::allocator<int> > const &) ENDP ; adjacent_find_epi32
_v$ = 8 ; size = 4
bool adjacent_find_epi8(std::vector<signed char,std::allocator<signed char> > const &) PROC ; adjacent_find_epi8, COMDAT
mov ecx, DWORD PTR _v$[esp-4]
push esi
mov eax, DWORD PTR [ecx+4]
mov esi, eax
mov edx, DWORD PTR [ecx]
cmp edx, eax
je SHORT $LN31@adjacent_f
lea ecx, DWORD PTR [edx+1]
cmp ecx, eax
je SHORT $LN31@adjacent_f
push ebx
mov bl, BYTE PTR [edx]
mov esi, edx
npad 4
$LL20@adjacent_f:
mov dl, BYTE PTR [ecx]
cmp bl, dl
je SHORT $LN35@adjacent_f
mov esi, ecx
mov bl, dl
inc ecx
cmp ecx, eax
jne SHORT $LL20@adjacent_f
mov esi, eax
$LN35@adjacent_f:
pop ebx
$LN31@adjacent_f:
cmp esi, eax
pop esi
setne al
ret 0
bool adjacent_find_epi8(std::vector<signed char,std::allocator<signed char> > const &) ENDP ; adjacent_find_epi8
|
RefactorAgdaEngine/ExtractFunction.agda
|
omega12345/RefactorAgda
| 5 |
9787
|
<reponame>omega12345/RefactorAgda
module ExtractFunction where
open import Data.List
open import ParseTree
open import Data.Nat
open import Data.String hiding (_++_)
open import ScopeState using (ScopeState ; ScopeEnv ; replaceID ; liftIO ; getUniqueIdentifier)
open import ScopeParseTree
open import AgdaHelperFunctions
open import Typing
open import Data.Bool
open import MatchUpNames
open import Category.Monad.State
open import Data.Product
open import Data.Maybe
open import Relation.Nullary
open import Data.Unit using (⊤ ; tt)
open import Data.Nat.Show
open import ParseTreeOperations
--TODO: actually, it is okay if the module has no name - in this case we do not need to rename it.
getIDForModule : List ParseTree -> ScopeState Identifier
getIDForModule [] = ScopeState.fail "This module seems to have no name"
getIDForModule (moduleName id range₁ ∷ p) = ScopeState.return id
getIDForModule (x ∷ xs) = getIDForModule xs
record ExtractionEnv : Set where
constructor extEnv
field
stuffBeforeFunc : List ParseTree
stuffAfterFunc : List ParseTree
rightHandSideBuilder : Maybe (Expr -> Expr)
extractedExpr : Maybe Expr
holesPassed : ℕ
functionRebuilder : Maybe (Expr -> ParseTree)
oldFunctionName : Maybe Identifier
ExtractionState : Set -> Set
ExtractionState = StateT ExtractionEnv ScopeState
runExtractionState :
{a : Set} -> ExtractionState a -> ExtractionEnv -> ScopeState a
runExtractionState eMonad e = do
(result , newState) <- eMonad e
return result
where open RawMonadState (StateTMonadState ScopeEnv (SumMonadT IOMonad String))
liftScopeState : {a : Set} -> ScopeState a -> ExtractionState a
liftScopeState action ee = do
a <- action
return (a , ee)
where open RawMonadState (StateTMonadState ScopeEnv (SumMonadT IOMonad String))
open RawMonadState (StateTMonadState ExtractionEnv (StateTMonad ScopeEnv (SumMonadT IOMonad String)))
fail : {a : Set} -> String -> ExtractionState a
fail s = liftScopeState $ ScopeState.fail s
--assuming that start < end
isInside : Range -> ℕ -> ℕ -> Bool
isInside (range lastUnaffected lastAffected) start end
with end ≤? lastUnaffected | lastAffected ≤? suc start
... | no p | no q = true
... | p | q = false
isInIdent : Identifier -> ℕ -> ℕ -> Bool
isInIdent (identifier name isInRange scope declaration {b}{c} {c2}) start end
with isInRange start | isInRange end
... | after | _ = false
... | _ | before = false
... | _ | _ = true
findPartInExpr : Expr -> ℕ -> ℕ -> ExtractionState Bool
findPartInExpr (numLit {value}
{r} {c} {c2}) start end
with isInside r start end
... | true = do
extEnv x y f expr h g n <- get
put $ extEnv x y (just(λ a -> a)) (just $ numLit {value} {r} {c} {c2}) h g n
return true
... | false = return false
findPartInExpr (ident id) start end
with isInIdent id start end
... | false = return false
... | true = do
extEnv x y f expr h g n <- get
put $ extEnv x y (just(λ a -> a)) (just $ ident id) h g n
return true
findPartInExpr (hole {t} {p} {c} {c2}) start end
with isInside p start end
... | true = do
extEnv x y f expr h g n <- get
put $ extEnv x y (just(λ a -> a)) (just $ hole {t} {p} {c} {c2}) h g n
return true
... | false = return false
findPartInExpr (functionApp e e₁ {false} ) start end = do
true <- findPartInExpr e₁ start end
where false -> do
true <- findPartInExpr e start end
where false -> return false
-- here we want to extract some subexpression of e
-- so we rebuild it with rebuilder f and put it in the functionApp
extEnv x y (just f) expr h g n <- get
where _ -> fail "Got no function despite extraction"
put $ extEnv x y (just(λ x -> functionApp (f x) e₁ {false})) expr h g n
return true
extEnv x y (just f) expr h g n <- get
where _ -> fail "Got no function despite extraction"
true <- findPartInExpr e start end
where false -> do -- extract only (part of) e₁
put $ extEnv x y (just (λ a -> functionApp e (f a) {false})) expr h g n
return true
-- at this point we realize we want to extract the entire
-- functionApp
-- Therefore, we need to extract entire e and e₁ regardless of
-- how far into it the selection extends.
--extEnv x y f expr h g n <- get
put $ extEnv x y (just (λ x -> x)) (just $ functionApp e e₁ {false} ) h g n
return true
findPartInExpr (functionApp e e₁ {true} ) start end = do
true <- findPartInExpr e start end
where false -> do
true <- findPartInExpr e₁ start end
where false -> return false
extEnv x y (just f) expr h g n <- get
where _ -> fail "Got no function despite extraction"
put $ extEnv x y (just(λ x -> functionApp e (f x) {true} )) expr h g n
return true
extEnv x y (just f) expr h g n <- get
where _ -> fail "Got no function despite extraction"
namedArgument sign <- return e
where _ -> do
-- e is not a named argument so can be extracted by itself
true <- findPartInExpr e₁ start end
where false -> do
put $ extEnv x y (just (λ a -> functionApp (f e) e₁ {true})) expr h g n
return true
put $ extEnv x y (just (λ x -> x)) (just $ functionApp e e₁ {true}) h g n
return true
put $ extEnv x y (just $ λ x -> x) (just $ functionApp e e₁ {true}) h g n
return true
findPartInExpr (implicit x) start end = do
true <- findPartInExpr x start end
where false -> return false
extEnv x y (just f) expr h g n <- get
where _ -> fail "Extraction failed"
put $ extEnv x y (just(λ a -> implicit $ f a)) expr h g n
return true
findPartInExpr (underscore {p} {c1} {c2}) start end with isInside p start end
... | true = do
extEnv x y f expr h g n <- get
put $ extEnv x y (just(λ a -> a)) (just $ underscore {p} {c1} {c2}) h g n
return true
... | false = return false
findPartInExpr (namedArgument (typeSignature funcName funcType) {b} {bef} {aft}) start end
with isInIdent funcName start end
-- can't extract just the name of a variable
... | true = do
extEnv x y f expr h g n <- get
put $ extEnv x y (just $ λ x -> x)
(just $ namedArgument (typeSignature funcName funcType) {b} {bef} {aft}) h g n
return true
... | false = do
true <- findPartInExpr funcType start end
where false -> return false
extEnv x y (just f) expr h g n <- get
where _ -> fail "No function in state"
put $ extEnv x y (just $ λ x -> namedArgument (typeSignature funcName $ f x) {b} {bef} {aft}) expr h g n
return true
sameNameAndStatus : Identifier -> Identifier -> Bool
sameNameAndStatus (identifier name isInRange scope declaration {inScope1}) (identifier name₁ isInRange₁ scope₁ declaration₁ {inScope2}) = (name == name₁) ∧ (not $ inScope1 xor inScope2)
isIdInExpr : (whatToSearchFor : Identifier) -> (whereToSearch : Expr) -> Bool
isIdInExpr i (ident identifier₁) = sameNameAndStatus i identifier₁
isIdInExpr i (functionApp x x₁) = isIdInExpr i x ∨ isIdInExpr i x₁
isIdInExpr _ _ = false
countHole : ExtractionState ⊤
countHole = do
extEnv b a func exp h g n <- get
put $ extEnv b a func exp (suc h) g n
return tt
mapState : {A B : Set} -> (A -> ExtractionState B) -> List A -> ExtractionState (List B)
mapState f [] = return []
mapState f (x ∷ list) = do
x1 <- f x
xs <- mapState f list
return (x1 ∷ xs)
countHolesInSignature : TypeSignature -> ExtractionState ⊤
countHolesInExpr : Expr -> ExtractionState ⊤
countHolesInExpr hole = countHole
countHolesInExpr (functionApp e e₁) = do
countHolesInExpr e
countHolesInExpr e₁
countHolesInExpr (namedArgument arg) = countHolesInSignature arg
countHolesInExpr _ = return tt
countHolesInSignature (typeSignature funcName funcType) =
countHolesInExpr funcType
countHolesInTree : ParseTree -> ExtractionState ⊤
countHolesInTree (signature signature₁ range₁) = countHolesInSignature signature₁
countHolesInTree (functionDefinition definitionOf params body range₁) = countHolesInExpr body
countHolesInTree (dataStructure dataName parameters indexInfo constructors range₁) = do
mapState countHolesInSignature parameters
mapState countHolesInSignature constructors
countHolesInExpr indexInfo
countHolesInTree _ = return tt
findPartToExtract : List ParseTree -> ℕ -> ℕ -> ExtractionState ⊤
findPartToExtract [] start end = fail "Found nothing that can be extracted"
findPartToExtract (functionDefinition definitionOf params body (range a z) ∷ e)
start end with (suc a) ≤? start | end ≤? z
... | yes p | yes q = do
true <- findPartInExpr body start end
where false -> fail "Command start and end must be in the function body"
extEnv bef aft func exp h g n <- get
put $ extEnv bef e func exp h (just (λ x -> functionDefinition definitionOf params x (range a z))) $ just definitionOf
just ex <- return exp
where nothing -> fail "Didn't get an expression to extract"
mapState countHolesInTree bef
return tt
findPartToExtract (p ∷ ps) start end | yes a | no b = do
extEnv b a func exp h g n <- get
put $ extEnv (b ∷ʳ p) a func exp h g n
findPartToExtract ps start end
... | p | q = fail "Command start and end not fully inside any function"
findPartToExtract (p ∷ ps) start end = do
extEnv b a func exp h g n <- get
put $ extEnv (b ∷ʳ p) a func exp h g n
findPartToExtract ps start end
makeTypeFromTypes : List Expr -> ExtractionState Expr
makeTypeFromTypes [] = fail "Can't make type from nothing"
makeTypeFromTypes (x ∷ []) = return x
makeTypeFromTypes (x ∷ xs) = do
y <- makeTypeFromTypes xs
return $ functionApp x y {true}
makeExprFromExprs : List Expr -> ExtractionState Expr
makeExprFromExprs [] = fail "Can't make expr from nothing"
makeExprFromExprs (x ∷ []) = return x
makeExprFromExprs (x ∷ l) = do
y <- makeExprFromExprs l
return $ functionApp y x {false}
-- List of type signatures is environment. Contains all variables,
-- including not-in-scope. Return list is the new function's environment.
filterEnvironment : Expr -> List TypeSignature -> (extractedExp : Expr) -> ExtractionState (List TypeSignature)
filterEnvironment resultType [] varsUsed = return []
filterEnvironment resultType (typeSignature funcName funcType ∷ environment) extractedExpr = do
filteredEnv <- filterEnvironment resultType environment extractedExpr
let isInExtractedExpr = isIdInExpr funcName extractedExpr
let typesToCheck = Data.List.map (λ { (typeSignature n t) -> t}) filteredEnv
isInTypes <- mapState (findInType funcName) typesToCheck
let isIn = or isInTypes
if isIn ∨ isInExtractedExpr
then return $ (typeSignature funcName funcType) ∷ filteredEnv
else return filteredEnv
where
findInType : Identifier -> Expr -> ExtractionState Bool
findInType id (namedArgument (typeSignature funcName funcType)) = findInType id funcType
findInType id (functionApp t t₁ {true}) = do
one <- findInType id t
two <- findInType id t₁
return $ one ∨ two
findInType id expression = return $ isIdInExpr id expression
bringIdInScope : Identifier -> Identifier
bringIdInScope (identifier name isInRange scope declaration {inScope} {a} {b}) = identifier name isInRange scope declaration {true} {a}{b}
containsIdInSign : TypeSignature -> Identifier -> Bool
containsInType : Expr -> Identifier -> Bool
containsInType (namedArgument arg) i = containsIdInSign arg i
containsInType (functionApp t t₁ {true}) i = containsInType t i ∨ containsInType t₁ i
containsInType expression i = isIdInExpr i expression
containsIdInSign (typeSignature name funcType) id = sameNameAndStatus name id ∨ containsInType funcType id
isInScope : Identifier -> Bool
isInScope (identifier _ _ _ _ {isInScope}) = isInScope
bringExprInScope : Expr -> Expr
bringExprInScope (ident id) = ident $ bringIdInScope id
bringExprInScope (functionApp e e₁ {b} ) = functionApp (bringExprInScope e) (bringExprInScope e₁) {b}
bringExprInScope (implicit e) = implicit $ bringExprInScope e
bringExprInScope x = x
bringInScope : Expr -> Expr
bringSignatureInScope : TypeSignature -> TypeSignature
bringSignatureInScope (typeSignature funcName funcType) =
typeSignature (bringIdInScope funcName) $ bringInScope funcType
bringInScope (namedArgument arg {b} {bef} {aft}) = namedArgument (bringSignatureInScope arg) {b} {bef} {aft}
bringInScope (functionApp t t₁ {true} ) = functionApp (bringInScope t) (bringInScope t₁) {true}
bringInScope expression = bringExprInScope expression
renameNotInScopeExpr : Identifier -> Identifier -> Expr -> Expr
renameNotInScopeExpr (identifier name₁ isInRange₁ scope₁ declaration₁) to (ident (identifier name isInRange scope declaration {false} {b} {a})) with name == name₁
renameNotInScopeExpr (identifier name₁ isInRange₁ scope₁ declaration₁) (identifier name₂ isInRange₂ scope₂ declaration₂) (ident (identifier name isInRange scope declaration {false} {b} {a})) | true = ident $ identifier name₂ isInRange₂ scope₂ declaration₂ {false}{b} {a}
... | false = ident $ identifier name isInRange scope declaration {false} {b} {a}
renameNotInScopeExpr from to (functionApp e e₁ {b} ) =
functionApp (renameNotInScopeExpr from to e) (renameNotInScopeExpr from to e₁) {b}
renameNotInScopeExpr from to (implicit e) = implicit $ renameNotInScopeExpr from to e
renameNotInScopeExpr _ _ x = x
renameNotInScopeOfName : Identifier -> Identifier -> Expr -> Expr
renameNotInScopeSign : Identifier -> Identifier -> TypeSignature -> TypeSignature
renameNotInScopeSign from to (typeSignature funcName funcType) =
typeSignature funcName $ renameNotInScopeOfName from to funcType
renameNotInScopeOfName from to (namedArgument arg {b} {bef} {aft}) = namedArgument (renameNotInScopeSign from to arg) {b} {bef} {aft}
renameNotInScopeOfName from to (functionApp signs signs₁ {true} ) =
functionApp (renameNotInScopeOfName from to signs) (renameNotInScopeOfName from to signs₁) {true}
renameNotInScopeOfName from to expression = renameNotInScopeExpr from to expression
-- returns list of types, which are explicit or implicit named arguments
-- and a list of expressions which is the left-hand side of the new function, i.e. idents.
signatureToType : Expr -> List TypeSignature -> ExtractionState (List Expr × List Expr)
signatureToType result [] = return $ (result ∷ []) , []
signatureToType result (typeSignature funcName funcType ∷ laterSigns) = do
let inScopeType = bringInScope funcType
(restOfSigns , exprs) <- signatureToType result laterSigns
false <- return $ isInScope funcName
where true -> do -- in this case, we plainly don't want to rename anything
let newSign = namedArgument (typeSignature funcName funcType) {true} {[]}{[]}
return $ newSign ∷ restOfSigns , ident funcName ∷ exprs
-- Do we need to rename the current variable?
true <- return $ or $ Data.List.map (λ x -> containsIdInSign x $ bringIdInScope funcName) laterSigns
where false -> do
let newSign = namedArgument (typeSignature funcName funcType) {false} {[]}{[]}
return $ newSign ∷ restOfSigns , exprs
liftScopeState $ liftIO $ output "Need to rename a variable"
newName <- liftScopeState getUniqueIdentifier
let renamedSigns = Data.List.map (renameNotInScopeOfName funcName newName) restOfSigns
return $ namedArgument (typeSignature newName inScopeType) {false} {[]}{[]} ∷ renamedSigns , exprs
placeInRightPlace : Identifier -> (placeOverTypeSignature : Bool) -> ParseTree -> ParseTree -> List ParseTree -> List ParseTree
placeInRightPlace oldFunctionName _ newsign newdef [] = newsign ∷ newdef ∷ []
placeInRightPlace oldFunctionName false newsign newdef (functionDefinition definitionOf params body range₁ ∷ program) with sameId oldFunctionName definitionOf
...| false = functionDefinition definitionOf params body range₁ ∷ placeInRightPlace oldFunctionName false newsign newdef program
... | true = newsign ∷ newdef ∷ functionDefinition definitionOf params body range₁ ∷ program
placeInRightPlace oldFunctionName true newsign newdef (signature (typeSignature funcName funcType) range₁ ∷ program) with sameId oldFunctionName funcName
... | false = signature (typeSignature funcName funcType) range₁ ∷ placeInRightPlace oldFunctionName true newsign newdef program
... | true = newsign ∷ newdef ∷ signature (typeSignature funcName funcType) range₁ ∷ program
placeInRightPlace x y z a (p ∷ program) = p ∷ placeInRightPlace x y z a program
doExtraction : List ParseTree -> ℕ -> ℕ -> String -> ExtractionState (List ParseTree)
doExtraction program startPoint endPoint filename = do
scoped <- liftScopeState $ scopeParseTreeList program
-- TODO: Assuming that the module only has a simple name.
-- Otherwise, need to calculate the right name.
identifier name _ _ declaration <- liftScopeState $ getIDForModule scoped
liftScopeState $ replaceID declaration "RefactorAgdaTemporaryFile"
renamedInputProgram <- liftScopeState $ matchUpNames scoped
findPartToExtract renamedInputProgram startPoint endPoint
extEnv b a (just expBuilder) (just extractedExp) h (just functionBuilder) (just oldFunctionName) <- get
where _ -> fail "An error in doExtraction"
let programWithNewHole = b ++
((functionBuilder $ expBuilder $ hole {""} {range 0 0} {[]} {[]})∷ a)
(resultTypeNewFunc ∷ []) <- liftScopeState $ liftIO $ getTypes
programWithNewHole h
(extractedExp ∷ []) filename
where _ -> fail "Something happened in InteractWithAgda"
environment <- liftScopeState $ liftIO $ getEnvironment programWithNewHole h filename
newFuncName <- liftScopeState $ getUniqueIdentifier
newFuncEnv <- filterEnvironment resultTypeNewFunc environment extractedExp
(newFuncSignParts , newFuncArgNames) <- signatureToType resultTypeNewFunc newFuncEnv
newFuncType <- makeTypeFromTypes $ newFuncSignParts
let newFuncSignature = signature (typeSignature newFuncName newFuncType) (range 0 0)
let newFuncDefinition = functionDefinition newFuncName newFuncArgNames extractedExp (range 0 0)
replacingExpr <- makeExprFromExprs $ reverse $ ident newFuncName ∷ newFuncArgNames
let oldFunction = functionBuilder $ expBuilder $ replacingExpr
let placeBelowTypeSignature = isIdInExpr oldFunctionName extractedExp
let completeCode = placeInRightPlace oldFunctionName (not placeBelowTypeSignature) newFuncSignature newFuncDefinition b ++
(oldFunction ∷ a)
scopeCompleted <- liftScopeState $ scopeParseTreeList completeCode
identifier _ _ _ d <- liftScopeState $ getIDForModule scopeCompleted
liftScopeState $ replaceID d name
liftScopeState $ matchUpNames scopeCompleted
extract : List ParseTree -> ℕ -> ℕ -> String -> ScopeState (List ParseTree)
extract p s e f = runExtractionState (doExtraction p s e f) $ extEnv [] [] nothing nothing 0 nothing nothing
|
oeis/036/A036238.asm
|
neoneye/loda-programs
| 11 |
8089
|
<filename>oeis/036/A036238.asm
; A036238: Triangle of numbers a(r,j) = j*(j+1) mod r+2, r>=1, j=1..r.
; Submitted by <NAME>
; 2,2,2,2,1,2,2,0,0,2,2,6,5,6,2,2,6,4,4,6,2,2,6,3,2,3,6,2,2,6,2,0,0,2,6,2,2,6,1,9,8,9,1,6,2,2,6,0,8,6,6,8,0,6,2,2,6,12,7,4,3,4,7,12,6,2,2,6,12,6,2,0,0,2,6,12,6,2,2,6,12,5,0,12,11,12,0,5,12,6,2,2,6,12,4,14,10,8,8,10
lpb $0
add $1,1
sub $0,$1
lpe
add $0,1
add $1,3
mov $2,1
add $2,$0
mul $2,$0
mod $2,$1
mov $0,$2
|
bin/src/main/resources/antlr/TemplateLexer.g4
|
Yunzlez/kara
| 1 |
6553
|
lexer grammar TemplateLexer;
OPEN_TMP: '${'-> pushMode(TMP);
TMP_ESC: '\\$';
TMP_TEXT: ~'$'+;
mode TMP;
CLOSE_TMP: '}' -> popMode;
fragment ESC : '\\' ([{}"\\/bfnrt] | UNICODE) ; //escapes
fragment UNICODE : 'u' HEX HEX HEX HEX ; //unicode characters
fragment HEX : [0-9a-fA-F] ; // hex characters
DOT:'.';
ID: LETTER+;
LETTER : [a-zA-Z];
NUMBER: DIGIT+;
DIGIT:[0-9];
WS: [ \t\n\r] -> skip; //dump whitespace
|
Day-46/Random_Num_Generate.asm
|
MasumBhai/50-Day-challenge-with-Assembly-Language
| 1 |
18638
|
<reponame>MasumBhai/50-Day-challenge-with-Assembly-Language
; id-201914044 (problem no-05)
.model small
.stack 100h
;include 'emu8086.inc'
.data
n_line db 0ah,0dh,"$"
msg db "have to enter 16 digit binary number",10,13,"$"
var dw ?
.code
main proc
mov ax,@data
mov ds,ax
lea dx,msg
mov ah,9
int 21h
xor dx,dx
call read
mov cx,100
@100Times:
call random
call write
mov ax,var
loop @100Times
@stop:
mov ah,4ch ;terminate
int 21h
main endp
random proc
xor dx,dx
shl ax,1 ; shift lefted once
;now i need to get 14th & 15th bit value
test ax,0010000000000000b ; 14th bit testing
jz @14thBitOne
mov dl,0 ; i'm storing 14th bit value in dl
jmp @chek15th
@14thBitOne:
mov dl,1
@chek15th:
test ax,0100000000000000b ; 15th bit testing
jz @15thBitOne
mov dh,0
jmp @xorOperation
@15thBitOne:
mov dh,1
@xorOperation:
xor dl,dh ; value stored in dl
or al,dl ; replaced 0th bit by the xor of 14th & 15th bit
and ax,1011111111111111b ; cleared 15th bit
mov var,ax
ret
random endp
read proc
xor ax,ax
xor bx,bx
mov cx,16d
mov ah,1
@read:
int 21h
and al,15d ; and with 0F
shl bx,1 ; bx er danpasher 1ta space khali kore dilam
or bl,al ; oi empty space ta fill up kore dilam
loop @read
lea dx,n_line
mov ah,9
int 21h
mov ax,bx ; ax contains now 15 bit number
ret
read endp
write proc
mov bx,ax
mov si,0d
@write:
cmp si,16d
jge @newLine
cmp si,4d
je @space
cmp si,8d
je @space
cmp si,12d
je @space
@continue:
shl bx,1
jnc @zero
mov ah,2
mov dl,31h
int 21h
jmp @increment
@zero:
mov ah,2
mov dl,30h
int 21h
jmp @increment
@space:
mov ah,2
mov dl,32d
int 21h
jmp @continue
@increment:
inc si
jmp @write
@newLine:
lea dx,n_line
mov ah,9
int 21h
ret
write endp
end main
|
oeis/049/A049084.asm
|
neoneye/loda-programs
| 11 |
82416
|
; A049084: a(n) = pi(n) if n is prime, otherwise 0.
; Submitted by <NAME>
; 0,1,2,0,3,0,4,0,0,0,5,0,6,0,0,0,7,0,8,0,0,0,9,0,0,0,0,0,10,0,11,0,0,0,0,0,12,0,0,0,13,0,14,0,0,0,15,0,0,0,0,0,16,0,0,0,0,0,17,0,18,0,0,0,0,0,19,0,0,0,20,0,21,0,0,0,0,0,22,0,0,0,23,0,0,0,0,0,24,0,0,0,0,0,0,0,25,0,0,0
mov $3,$0
mov $5,$0
lpb $3
mov $0,$5
sub $3,1
sub $0,$3
mov $2,$0
seq $2,80339 ; Characteristic function of {1} union {primes}: 1 if n is 1 or a prime, else 0.
add $4,$2
lpe
mul $2,$4
mov $0,$2
|
oeis/337/A337396.asm
|
neoneye/loda-programs
| 11 |
95567
|
<reponame>neoneye/loda-programs
; A337396: Expansion of sqrt((1-8*x+sqrt(1+64*x^2)) / (2 * (1+64*x^2))).
; Submitted by <NAME>(w3)
; 1,-2,-26,76,1222,-3772,-64676,203992,3607622,-11510636,-207302156,666187432,12142184476,-39211413464,-720760216328,2335857124016,43208062233158,-140406756766796,-2609918906614652,8498967890177416,158596941629422132,-517334728427373704,-9684521991498517112,31634559505747597264,593763580548767998748,-1941802446654587863672,-36527811369666770040056,119576678015456154877072,2253679871374187961630328,-7383902419556338600084784,-139395051075922030119435536,457049659050089976726006112
mov $1,1
mov $2,1
mov $3,$0
add $3,$0
mov $4,1
lpb $3
mul $1,$3
mul $2,-1
sub $3,1
mul $1,$3
add $5,$4
div $1,$5
mul $2,4
add $2,$1
sub $3,1
add $4,2
lpe
mov $0,$2
|
programs/oeis/047/A047356.asm
|
karttu/loda
| 1 |
7577
|
; A047356: Numbers that are congruent to {1, 3} mod 7.
; 1,3,8,10,15,17,22,24,29,31,36,38,43,45,50,52,57,59,64,66,71,73,78,80,85,87,92,94,99,101,106,108,113,115,120,122,127,129,134,136,141,143,148,150,155,157,162,164,169
mov $1,$0
mul $1,3
div $1,2
mul $1,14
div $1,6
add $1,1
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/noinline3_pkg.ads
|
best08618/asylo
| 7 |
14586
|
-- { dg-excess-errors "cannot generate code" }
generic
I : Integer;
package Noinline3_Pkg is
function F (A, B : Integer) return Integer;
end Noinline3_Pkg;
|
soundness/HelpDefs.agda
|
frelindb/agsyHOL
| 17 |
11161
|
<reponame>frelindb/agsyHOL<gh_stars>10-100
module HelpDefs where
-- open import Relation.Binary.PropositionalEquality
open import StdLibStuff
open import Syntax
open import FSC
open import STT
open import DerivedProps
m-weak-h : ∀ {n} Γ₁ Γ₂ {t} → {Γ₃ : Ctx n} → Form (Γ₃ ++ Γ₁) t → Form (Γ₃ ++ (Γ₂ r++ Γ₁)) t
m-weak-h {n} Γ₁ ε = λ f → f
m-weak-h {n} Γ₁ (t' ∷ Γ₂) {t} {Γ₃} = λ f → m-weak-h {n} (t' ∷ Γ₁) Γ₂ {t} {Γ₃} (weak-i Γ₃ Γ₁ f)
m-weak2 : ∀ {n Γ₁} Γ₂ → {t : Type n} → Form Γ₁ t → Form (Γ₂ ++ Γ₁) t
m-weak2 {n} {Γ₁} ε f = f
m-weak2 {n} {Γ₁} (t' ∷ Γ₂) f = weak (m-weak2 {n} {Γ₁} Γ₂ f)
hypos-i-h : ∀ {n Γ-t₁ Γ-t₂ Γ-t₃} → FSC-Ctx n Γ-t₁ → Form (Γ-t₃ ++ (Γ-t₂ r++ Γ-t₁)) $o → Form (Γ-t₃ ++ (Γ-t₂ r++ Γ-t₁)) $o
hypos-i-h ε = λ f → f
hypos-i-h {n} {Γ-t₁} {Γ-t₂} {Γ-t₃} (h ∷h Γ) = λ f → hypos-i-h {n} {Γ-t₁} {Γ-t₂} {Γ-t₃} Γ (m-weak-h Γ-t₁ Γ-t₂ {$o} {Γ-t₃} (m-weak2 Γ-t₃ h) => f)
hypos-i-h {n} {.(t ∷ _)} {Γ-t₂} {Γ-t₃} (t ∷ Γ) = hypos-i-h {n} {_} {t ∷ Γ-t₂} {Γ-t₃} Γ
m-weak : ∀ {n Γ₁ Γ₂ t} → Form Γ₁ t → Form (Γ₂ r++ Γ₁) t
m-weak {n} {Γ₁} {Γ₂} {t} = m-weak-h {n} Γ₁ Γ₂ {t} {ε}
hypos-i : ∀ {n Γ-t₁ Γ-t₂} → FSC-Ctx n Γ-t₁ → Form (Γ-t₂ r++ Γ-t₁) $o → Form (Γ-t₂ r++ Γ-t₁) $o
hypos-i {n} {Γ-t₁} {Γ-t₂} = hypos-i-h {n} {Γ-t₁} {Γ-t₂} {ε}
hypos : ∀ {n Γ-t} → FSC-Ctx n Γ-t → Form Γ-t $o → Form Γ-t $o
hypos {n} {Γ-t} = hypos-i {n} {Γ-t} {ε}
-- Props
eq-1-i : ∀ {n} Γ₁ Γ₂ → (t : Type n) (X₁ : Form (t ∷ Γ₁) $o) (X₂ : Form Γ₁ $o) →
X₁ ≡ weak-i {n} {$o} {t} ε Γ₁ X₂ →
m-weak-h Γ₁ Γ₂ {$o} {t ∷ ε} X₁ ≡ weak-i {n} {$o} {t} ε (Γ₂ r++ Γ₁) (m-weak-h Γ₁ Γ₂ {$o} {ε} X₂)
eq-1-i Γ₁ ε t X₁ X₂ = λ h → h
eq-1-i Γ₁ (u ∷ Γ₂) t X₁ X₂ = λ h → eq-1-i (u ∷ Γ₁) Γ₂ t (weak-i {_} {$o} {u} (t ∷ ε) Γ₁ X₁) (weak-i {_} {$o} {u} ε Γ₁ X₂) (trans (cong (weak-i {_} {$o} {u} (t ∷ ε) Γ₁) h) (weak-weak-p-1 Γ₁ t u $o X₂))
eq-1 : ∀ {n} Γ₁ Γ₂ → (t : Type n) (X : Form Γ₁ $o) →
m-weak-h Γ₁ Γ₂ {$o} {t ∷ ε} (weak-i {n} {$o} {t} ε Γ₁ X) ≡ weak-i {n} {$o} {t} ε (Γ₂ r++ Γ₁) (m-weak-h Γ₁ Γ₂ {$o} {ε} X)
eq-1 Γ₁ Γ₂ t X = eq-1-i Γ₁ Γ₂ t (weak-i {_} {$o} {t} ε Γ₁ X) X refl
eq-2-2 : ∀ n → (Γ-t Γ' : Ctx n) → (t : Type n) (X₁ : Form (t ∷ Γ-t) $o) (X₂ : Form Γ-t $o) →
weak-i {n} {$o} {t} ε Γ-t X₂ ≡ X₁ →
(h₂ : t ∷ (Γ' r++ Γ-t) ≡ (Γ' ++ (t ∷ ε)) r++ Γ-t) →
m-weak-h Γ-t (Γ' ++ (t ∷ ε)) {$o} {ε} X₂ ≡
subst (λ z → Form z $o) h₂ (m-weak-h Γ-t Γ' {$o} {t ∷ ε} X₁)
eq-2-2 n Γ-t ε t X₁ X₂ h refl = h
eq-2-2 n Γ-t (u ∷ Γ') t X₁ X₂ h h₂ = eq-2-2 n (u ∷ Γ-t) Γ' t (weak-i {_} {$o} {u} (t ∷ ε) Γ-t X₁) (weak-i {_} {$o} {u} ε Γ-t X₂) (
trans (sym (weak-weak-p-1 Γ-t t u $o X₂)) (cong (weak-i {_} {$o} {u} (t ∷ ε) Γ-t) h))
h₂
eq-2-1 : ∀ n → (Γ-t Γ' : Ctx n) → (t : Type n) (h : Form Γ-t $o) (F : Form (t ∷ (Γ' r++ Γ-t)) $o) →
(Γ'' : Ctx n)
(h₁₁ : Γ'' ≡ (Γ' ++ (t ∷ ε)) r++ Γ-t) →
(h₁₂ : t ∷ (Γ' r++ Γ-t) ≡ Γ'') →
app (app A (app N (m-weak-h Γ-t (Γ' ++ (t ∷ ε)) {$o} {ε} h))) (subst (λ z → Form z $o) h₁₁ (subst (λ z → Form z $o) h₁₂ F)) ≡
subst (λ z → Form z $o) h₁₁ (app (app A (app N (subst (λ z → Form z $o) h₁₂ (m-weak-h Γ-t Γ' {$o} {t ∷ ε} (weak-i ε Γ-t h))))) (subst (λ z → Form z $o) h₁₂ F))
eq-2-1 n Γ-t Γ' t h F .((Γ' ++ (t ∷ ε)) r++ Γ-t) refl h₁₂ = cong (λ z → app (app A (app N z)) (subst (λ z → Form z $o) h₁₂ F)) (eq-2-2 n Γ-t Γ' t (weak-i {_} {$o} {t} ε Γ-t h) h refl h₁₂)
eq-2-i : ∀ {n} Γ-t → (t : Type n) (Γ : FSC-Ctx n Γ-t) (Γ' : Ctx n) (F : Form (t ∷ (Γ' r++ Γ-t)) $o) →
(h₁ : t ∷ (ε ++ (Γ' r++ Γ-t)) ≡ (Γ' ++ (t ∷ ε)) r++ Γ-t) →
hypos-i-h {n} {Γ-t} {Γ' ++ (t ∷ ε)} {ε} Γ (subst (λ z → Form z $o) h₁ F) ≡ subst (λ z → Form z $o) h₁ (hypos-i-h {n} {Γ-t} {Γ'} {t ∷ ε} Γ F)
eq-2-i .ε t ε Γ' F h₁ = refl
eq-2-i .(u ∷ _) t (u ∷ Γ) Γ' F h₁ = eq-2-i _ t Γ (u ∷ Γ') F h₁
eq-2-i Γ-t t (h ∷h Γ) Γ' F h₁ = trans (cong (hypos-i-h {_} {Γ-t} {Γ' ++ (t ∷ ε)} {ε} Γ) (eq-2-1 _ Γ-t Γ' t h F _ h₁ refl)) (eq-2-i Γ-t t Γ Γ' (app (app A (app N (m-weak-h Γ-t Γ' {$o} {t ∷ ε} (weak-i ε Γ-t h)))) F) h₁)
eq-2 : ∀ {n Γ-t} → (t : Type n) (Γ : FSC-Ctx n Γ-t) (F : Form (t ∷ Γ-t) $o) →
hypos-i-h {n} {Γ-t} {t ∷ ε} {ε} Γ F ≡ hypos-i-h {n} {Γ-t} {ε} {t ∷ ε} Γ F
eq-2 {_} {Γ-t} t Γ F = eq-2-i {_} Γ-t t Γ ε F refl
traverse-hypos-i : ∀ {n Γ-t₁ Γ-t₂} → (F G : Form (Γ-t₂ r++ Γ-t₁) $o) (Γ : FSC-Ctx n Γ-t₁) → (⊢ (F => G)) → ⊢ (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ F => hypos-i {n} {Γ-t₁} {Γ-t₂} Γ G)
traverse-hypos-i F G ε h = h
traverse-hypos-i {n} {Γ-t₁} {Γ-t₂} F G (X ∷h Γ) h = traverse-hypos-i {n} {Γ-t₁} {Γ-t₂} (m-weak {n} {Γ-t₁} {Γ-t₂} X => F) (m-weak {n} {Γ-t₁} {Γ-t₂} X => G) Γ (inf-V ax-4-s h)
traverse-hypos-i {n} {.(t ∷ _)} {Γ-t₂} F G (t ∷ Γ) h = traverse-hypos-i {n} {_} {t ∷ Γ-t₂} F G Γ h
traverse-hypos : ∀ {n Γ-t} → (F G : Form Γ-t $o) (Γ : FSC-Ctx n Γ-t) → (⊢ (F => G)) → ⊢ (hypos Γ F => hypos Γ G)
traverse-hypos {n} {Γ-t} = traverse-hypos-i {n} {Γ-t} {ε}
traverse-hypos-pair-I-i : ∀ {n Γ-t₁ Γ-t₂} → (F G : Form (Γ-t₂ r++ Γ-t₁) $o) (Γ : FSC-Ctx n Γ-t₁) → ⊢ (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ F => (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ G => hypos-i {n} {Γ-t₁} {Γ-t₂} Γ (F & G)))
traverse-hypos-pair-I-i F G ε = lemb1 F G
traverse-hypos-pair-I-i {n} {Γ-t₁} {Γ-t₂} F G (x ∷h Γ) = inf-V (inf-V (ax-4-s {_} {_} {(hypos-i {n} {Γ-t₁} {Γ-t₂} Γ (m-weak {n} {Γ-t₁} {Γ-t₂} x => G) => (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ ((m-weak {n} {Γ-t₁} {Γ-t₂} x => F) & (m-weak {n} {Γ-t₁} {Γ-t₂} x => G))))})
(inf-V (ax-4-s {_} {_} {(hypos-i {n} {Γ-t₁} {Γ-t₂} Γ ((m-weak {n} {Γ-t₁} {Γ-t₂} x => F) & (m-weak {n} {Γ-t₁} {Γ-t₂} x => G)))}) (traverse-hypos-i {n} {Γ-t₁} {Γ-t₂} ((m-weak {n} {Γ-t₁} {Γ-t₂} x => F) & (m-weak {n} {Γ-t₁} {Γ-t₂} x => G)) (m-weak {n} {Γ-t₁} {Γ-t₂} x => (F & G)) Γ (lem2 (m-weak {n} {Γ-t₁} {Γ-t₂} x) F G))))
(traverse-hypos-pair-I-i {n} {Γ-t₁} {Γ-t₂} (m-weak {n} {Γ-t₁} {Γ-t₂} x => F) (m-weak {n} {Γ-t₁} {Γ-t₂} x => G) Γ)
traverse-hypos-pair-I-i {n} {.(t ∷ _)} {Γ-t₂} F G (t ∷ Γ) = traverse-hypos-pair-I-i {n} {_} {t ∷ Γ-t₂} F G Γ
traverse-hypos-pair-I : ∀ {n Γ-t} → (F G : Form Γ-t $o) (Γ : FSC-Ctx n Γ-t) → ⊢ (hypos Γ F => (hypos Γ G => hypos Γ (F & G)))
traverse-hypos-pair-I {n} {Γ-t} = traverse-hypos-pair-I-i {n} {Γ-t} {ε}
traverse-hypos-elim-i : ∀ {n Γ-t₁ Γ-t₂} → (F : Form (Γ-t₂ r++ Γ-t₁) $o) (Γ : FSC-Ctx n Γ-t₁) (x : HVar Γ) → ⊢ (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ (m-weak {n} {Γ-t₁} {Γ-t₂} (lookup-hyp Γ x) => F) => hypos-i {n} {Γ-t₁} {Γ-t₂} Γ F)
traverse-hypos-elim-i {n} {Γ-t₁} {Γ-t₂} F .(h ∷h Γ) (zero {._} {h} {Γ}) = traverse-hypos-i {n} {Γ-t₁} {Γ-t₂} (m-weak {n} {Γ-t₁} {Γ-t₂} h => (m-weak {n} {Γ-t₁} {Γ-t₂} h => F)) (m-weak {n} {Γ-t₁} {Γ-t₂} h => F) Γ (lem3 (m-weak {n} {Γ-t₁} {Γ-t₂} h) F)
traverse-hypos-elim-i {n} {Γ-t₁} {Γ-t₂} F .(h ∷h Γ) (succ {._} {h} {Γ} x) = inf-V ax-3-s (inf-V (inf-V (ax-4-s {_} {_} {~ (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ (m-weak {n} {Γ-t₁} {Γ-t₂} (lookup-hyp Γ x) => (m-weak {n} {Γ-t₁} {Γ-t₂} h => F)))}) (inf-V (lem5 (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ (m-weak {n} {Γ-t₁} {Γ-t₂} h => (m-weak {n} {Γ-t₁} {Γ-t₂} (lookup-hyp Γ x) => F))) (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ (m-weak {n} {Γ-t₁} {Γ-t₂} (lookup-hyp Γ x) => (m-weak {n} {Γ-t₁} {Γ-t₂} h => F)))) (traverse-hypos-i {n} {Γ-t₁} {Γ-t₂} (m-weak {n} {Γ-t₁} {Γ-t₂} h => (m-weak {n} {Γ-t₁} {Γ-t₂} (lookup-hyp Γ x) => F)) (m-weak {n} {Γ-t₁} {Γ-t₂} (lookup-hyp Γ x) => (m-weak {n} {Γ-t₁} {Γ-t₂} h => F)) Γ (lem4 (m-weak {n} {Γ-t₁} {Γ-t₂} h) (m-weak {n} {Γ-t₁} {Γ-t₂} (lookup-hyp Γ x)) F)))) (inf-V ax-3-s (traverse-hypos-elim-i {n} {Γ-t₁} {Γ-t₂} (m-weak {n} {Γ-t₁} {Γ-t₂} h => F) Γ x)))
traverse-hypos-elim-i {n} {.(t ∷ _)} {Γ-t₂} F (t ∷ Γ) (skip x) = traverse-hypos-elim-i {n} {_} {t ∷ Γ-t₂} F Γ x
traverse-hypos-elim : ∀ {n Γ-t} → (F : Form Γ-t $o) (Γ : FSC-Ctx n Γ-t) (x : HVar Γ) → ⊢ (hypos Γ (lookup-hyp Γ x => F) => hypos Γ F)
traverse-hypos-elim {n} {Γ-t} = traverse-hypos-elim-i {n} {Γ-t} {ε}
traverse-hypos-use-i : ∀ {n Γ-t₁ Γ-t₂} → (F : Form (Γ-t₂ r++ Γ-t₁) $o) (Γ : FSC-Ctx n Γ-t₁) → ⊢ (F) → ⊢ (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ F)
traverse-hypos-use-i F ε h = h
traverse-hypos-use-i {n} {Γ-t₁} {Γ-t₂} F (X ∷h Γ) h = traverse-hypos-use-i {n} {Γ-t₁} {Γ-t₂} (m-weak {n} {Γ-t₁} {Γ-t₂} X => F) Γ (inf-V ax-3-s (inf-V ax-2-s h))
traverse-hypos-use-i {n} {.(t ∷ _)} {Γ-t₂} F (t ∷ Γ) h = traverse-hypos-use-i {n} {_} {t ∷ Γ-t₂} F Γ h
traverse-hypos-use : ∀ {n Γ-t} → (F : Form Γ-t $o) (Γ : FSC-Ctx n Γ-t) → ⊢ (F) → ⊢ (hypos Γ F)
traverse-hypos-use {n} {Γ-t} = traverse-hypos-use-i {n} {Γ-t} {ε}
traverse-hypos2-i : ∀ {n Γ-t₁ Γ-t₂} → (F G H : Form (Γ-t₂ r++ Γ-t₁) $o) (Γ : FSC-Ctx n Γ-t₁) → (⊢ (F => (G => H))) → ⊢ (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ F => (hypos-i {n} {Γ-t₁} {Γ-t₂}Γ G => hypos-i {n} {Γ-t₁} {Γ-t₂} Γ H))
traverse-hypos2-i F G H ε imp = imp
traverse-hypos2-i {n} {Γ-t₁} {Γ-t₂} F G H (X ∷h Γ) imp = traverse-hypos2-i {n} {Γ-t₁} {Γ-t₂} (m-weak {n} {Γ-t₁} {Γ-t₂} X => F) (m-weak {n} {Γ-t₁} {Γ-t₂} X => G) (m-weak {n} {Γ-t₁} {Γ-t₂} X => H) Γ (inf-V (lem8 (m-weak {n} {Γ-t₁} {Γ-t₂} X) F G H) imp)
traverse-hypos2-i {n} {.(t ∷ _)} {Γ-t₂} F G H (t ∷ Γ) imp = traverse-hypos2-i {n} {_} {t ∷ Γ-t₂} F G H Γ imp
traverse-hypos2 : ∀ {n Γ-t} → (F G H : Form Γ-t $o) (Γ : FSC-Ctx n Γ-t) → (⊢ (F => (G => H))) → ⊢ (hypos Γ F => (hypos Γ G => hypos Γ H))
traverse-hypos2 {n} {Γ-t} = traverse-hypos2-i {n} {Γ-t} {ε}
traverse-hypos3-i : ∀ {n Γ-t₁ Γ-t₂} → (F G H I : Form (Γ-t₂ r++ Γ-t₁) $o) (Γ : FSC-Ctx n Γ-t₁) → (⊢ (F => (G => (H => I)))) → ⊢ (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ F => (hypos-i {n} {Γ-t₁} {Γ-t₂}Γ G => (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ H => hypos-i {n} {Γ-t₁} {Γ-t₂} Γ I)))
traverse-hypos3-i F G H I ε imp = imp
traverse-hypos3-i {n} {Γ-t₁} {Γ-t₂} F G H I (X ∷h Γ) imp = traverse-hypos3-i {n} {Γ-t₁} {Γ-t₂} (m-weak {n} {Γ-t₁} {Γ-t₂} X => F) (m-weak {n} {Γ-t₁} {Γ-t₂} X => G) (m-weak {n} {Γ-t₁} {Γ-t₂} X => H) (m-weak {n} {Γ-t₁} {Γ-t₂} X => I) Γ (inf-V (lem8-3 (m-weak {n} {Γ-t₁} {Γ-t₂} X) F G H I) imp)
traverse-hypos3-i {n} {.(t ∷ _)} {Γ-t₂} F G H I (t ∷ Γ) imp = traverse-hypos3-i {n} {_} {t ∷ Γ-t₂} F G H I Γ imp
traverse-hypos3 : ∀ {n Γ-t} → (F G H I : Form Γ-t $o) (Γ : FSC-Ctx n Γ-t) → (⊢ (F => (G => (H => I)))) → ⊢ (hypos Γ F => (hypos Γ G => (hypos Γ H => hypos Γ I)))
traverse-hypos3 {n} {Γ-t} = traverse-hypos3-i {n} {Γ-t} {ε}
traverse-=>-I-dep-i : ∀ {n Γ-t₁ Γ-t₂} → (t : Type n) (F : Form (t ∷ (Γ-t₂ r++ Γ-t₁)) $o) (Γ : FSC-Ctx n Γ-t₁) →
⊢ (![ t ] hypos-i-h {n} {Γ-t₁} {Γ-t₂} {t ∷ ε} Γ F) →
⊢ (hypos-i {n} {Γ-t₁} {Γ-t₂} Γ (![ t ] F))
traverse-=>-I-dep-i t F ε h = h
traverse-=>-I-dep-i {n} {Γ-t₁} {Γ-t₂} t F (X ∷h Γ) h = inf-V (traverse-hypos-i {n} {Γ-t₁} {Γ-t₂} (![ t ] (weak (m-weak {n} {Γ-t₁} {Γ-t₂} X) => F)) (m-weak {n} {Γ-t₁} {Γ-t₂} X => (![ t ] F)) Γ (ax-6-s {_} {_} {_} {~ (m-weak {n} {Γ-t₁} {Γ-t₂} X)} {F})) (traverse-=>-I-dep-i {n} {Γ-t₁} {Γ-t₂} t (weak (m-weak {n} {Γ-t₁} {Γ-t₂} X) => F) Γ
(subst (λ z → ⊢_ {n} {_r++_ {n} Γ-t₂ Γ-t₁} (app {n} {_>_ {_} t ($o {_})} {$o {_}} {_r++_ {n} Γ-t₂ Γ-t₁} (Π {n} {t} {_r++_ {n} Γ-t₂ Γ-t₁}) (lam {n} {$o {_}} {_r++_ {n} Γ-t₂ Γ-t₁} t ((hypos-i-h {n} {Γ-t₁} {Γ-t₂} {_∷_ {_} t (ε {_})} Γ (_=>_ {_} {_∷_ {_} t (_r++_ {n} Γ-t₂ Γ-t₁)} z F))))))
(eq-1 {n} Γ-t₁ Γ-t₂ t X) h))
traverse-=>-I-dep-i {n} {.(t' ∷ _)} {Γ-t₂} t F (t' ∷ Γ) h = traverse-=>-I-dep-i {n} {_} {t' ∷ Γ-t₂} t F Γ h
traverse-=>-I-dep : ∀ {n Γ-t} → (t : Type n) (F : Form (t ∷ Γ-t) $o) (Γ : FSC-Ctx n Γ-t) →
⊢ (![ t ] hypos (t ∷ Γ) F) → ⊢ (hypos Γ (![ t ] F))
traverse-=>-I-dep {n} {Γ-t} t F Γ h = traverse-=>-I-dep-i {n} {Γ-t} {ε} t F Γ (subst (λ z → ⊢ app Π (lam t (z))) (eq-2 t Γ F) h)
traverse-=>-I-dep'-I2 : ∀ {n Γ-t₁ Γ-t₂} → (t : Type n) (F : Form (t ∷ (Γ-t₂ r++ Γ-t₁)) $o) (G : Form (Γ-t₂ r++ Γ-t₁) $o) (Γ : FSC-Ctx n Γ-t₁) →
(⊢ (F => weak-i ε (Γ-t₂ r++ Γ-t₁) G)) →
⊢ (hypos-i-h {n} {Γ-t₁} {Γ-t₂} {t ∷ ε} Γ F => weak-i ε (Γ-t₂ r++ Γ-t₁) (hypos-i-h {n} {Γ-t₁} {Γ-t₂} {ε} Γ G))
traverse-=>-I-dep'-I2 t F G ε h = h
traverse-=>-I-dep'-I2 {n} {t' ∷ Γ-t₁} {Γ-t₂} t F G (.t' ∷ Γ) h = traverse-=>-I-dep'-I2 {n} {Γ-t₁} {t' ∷ Γ-t₂} t F G Γ h
traverse-=>-I-dep'-I2 {n} {Γ-t₁} {Γ-t₂} t F G (X ∷h Γ) h = traverse-=>-I-dep'-I2 {n} {Γ-t₁} {Γ-t₂} t (m-weak-h Γ-t₁ Γ-t₂ {$o} {t ∷ ε} (weak-i ε Γ-t₁ X) => F) (m-weak-h Γ-t₁ Γ-t₂ {$o} {ε} X => G) Γ (
subst (λ z → ⊢ ((m-weak-h Γ-t₁ Γ-t₂ {$o} {t ∷ ε} (weak-i ε Γ-t₁ X) => F) => (z => weak-i ε (Γ-t₂ r++ Γ-t₁) G))) (eq-1 Γ-t₁ Γ-t₂ t X) (inf-V ax-4-s h))
traverse-=>-I-dep'-I : ∀ {n Γ-t} → (t : Type n) (F : Form (t ∷ Γ-t) $o) (G : Form Γ-t $o) (Γ : FSC-Ctx n Γ-t) →
(⊢ (F => weak-i ε Γ-t G)) →
⊢ (hypos (t ∷ Γ) F => weak-i ε Γ-t (hypos Γ G))
traverse-=>-I-dep'-I {n} {Γ-t} t F G Γ h = subst (λ z → ⊢ (z => weak-i ε Γ-t (hypos Γ G))) (sym (eq-2 t Γ F)) (traverse-=>-I-dep'-I2 {n} {Γ-t} {ε} t F G Γ h)
traverse-=>-I-dep' : ∀ {n Γ-t} → (t : Type n) (F : Form Γ-t (t > $o)) (Γ : FSC-Ctx n Γ-t) →
⊢ hypos (t ∷ Γ) (weak F · $ this {refl}) → ⊢ (hypos Γ (!'[ t ] F))
traverse-=>-I-dep' t F Γ h = extend-context t (inf-V (traverse-=>-I-dep'-I t (weak F · $ this {refl}) (!'[ t ] F) Γ (inf-VI this (occurs-p-2 F) refl)) h)
-- -----------------------------------
traverse-hypos-eq-=>-I-i : ∀ {n Γ-t₁ Γ-t₂} → {t : Type n} → (F : Form (t ∷ (Γ-t₂ r++ Γ-t₁)) $o) (G : Form (Γ-t₂ r++ Γ-t₁) $o) (Γ : FSC-Ctx n Γ-t₁) → (⊢ (F => weak G)) → ⊢ hypos-i-h {n} {Γ-t₁} {Γ-t₂} {t ∷ ε} Γ F → ⊢ hypos-i {n} {Γ-t₁} {Γ-t₂} Γ G
traverse-hypos-eq-=>-I-i {n} {.ε} {Γ-t₂} {t} F G ε = λ z z' → extend-context t (inf-V z z')
traverse-hypos-eq-=>-I-i {n} {Γ-t₁} {Γ-t₂} {t} F G (X ∷h Γ) = λ h → traverse-hypos-eq-=>-I-i {n} {Γ-t₁} {Γ-t₂} {t} (m-weak-h {_} Γ-t₁ Γ-t₂ {_} {t ∷ ε} (m-weak2 (t ∷ ε) X) => F) (m-weak-h {_} Γ-t₁ Γ-t₂ {_} {ε} (m-weak2 ε X) => G) Γ (subst (λ z → ⊢ ((m-weak-h {_} Γ-t₁ Γ-t₂ {_} {t ∷ ε} (m-weak2 (t ∷ ε) X) => F) => (z => weak G))) (eq-1 Γ-t₁ Γ-t₂ t X) (inf-V ax-4-s h))
traverse-hypos-eq-=>-I-i {n} {t₁ ∷ Γ-t₁} {Γ-t₂} {t} F G ((.t₁) ∷ Γ) = traverse-hypos-eq-=>-I-i {n} {Γ-t₁} {t₁ ∷ Γ-t₂} {t} F G Γ
traverse-hypos-eq-=>-I'' : ∀ {n Γ-t} → {t : Type n} (F : Form (t ∷ Γ-t) $o) (G : Form Γ-t $o) (Γ : FSC-Ctx n Γ-t) →
⊢ (F => weak G) →
⊢ hypos (t ∷ Γ) F → ⊢ hypos Γ G
traverse-hypos-eq-=>-I'' {n} {Γ-t} F G Γ = λ h₁ h₂ → traverse-hypos-eq-=>-I-i {n} {Γ-t} {ε} F G Γ h₁ (subst (λ z → ⊢ z) (eq-2 _ Γ F) h₂)
tst3-ε : ∀ {n} → (Γ₁ Γ₂ : Ctx n) (F : Form Γ₁ $o)
(eq : Γ₁ ≡ Γ₂) →
⊢_ {n} {Γ₂} (subst (λ z → Form z $o) eq F) →
⊢_ {n} {Γ₁} F
tst3-ε .Γ₂ Γ₂ F refl p = p -- rewrite eq = p
tst3b : ∀ {n} → {t u : Type n} → (Γ-t₁ Γ-t₂ : Ctx n) (X : Form Γ-t₁ u) →
(eq2 : t ∷ (Γ-t₂ r++ Γ-t₁) ≡ (Γ-t₂ ++ (t ∷ ε)) r++ Γ-t₁) →
m-weak-h Γ-t₁ (Γ-t₂ ++ (t ∷ ε)) {_} {ε} X ≡
subst (λ z → Form z u) eq2 (weak-i ε (Γ-t₂ r++ Γ-t₁) (m-weak-h Γ-t₁ Γ-t₂ {_} {ε} X))
tst3b Γ-t₁ ε X refl = refl
tst3b Γ-t₁ (v ∷ Γ-t₂) X eq2 = tst3b (v ∷ Γ-t₁) Γ-t₂ (weak-i ε Γ-t₁ X) eq2
tst3'-∷h : ∀ {n Γ-t₁ Γ-t₂} → {t : Type n} (F : Form (t ∷ (Γ-t₂ r++ Γ-t₁)) $o) (Γ : FSC-Ctx n Γ-t₁) →
(X : Form Γ-t₁ $o)
(Γ1 : Ctx n)
(eq1 : Γ1 ≡ (Γ-t₂ ++ (t ∷ ε)) r++ Γ-t₁)
(eq2 : t ∷ (Γ-t₂ r++ Γ-t₁) ≡ Γ1)
(p : ⊢ hypos-i-h {n} {Γ-t₁} {Γ-t₂ ++ (t ∷ ε)} {ε} Γ (app (app A (app N (m-weak-h {n} Γ-t₁ (Γ-t₂ ++ (t ∷ ε)) {$o} {ε} X))) (subst (λ z → Form z $o) eq1 (subst (λ z → Form z $o) eq2 F)))) →
⊢ hypos-i-h {n} {Γ-t₁} {Γ-t₂ ++ (t ∷ ε)} {ε} Γ (subst (λ z → Form z $o) eq1 (app (app A (app N (subst (λ z → Form z $o) eq2 (weak-i ε (Γ-t₂ r++ Γ-t₁) (m-weak-h Γ-t₁ Γ-t₂ {$o} {ε} X))))) (subst (λ z → Form z $o) eq2 F)))
tst3'-∷h {n} {Γ-t₁} {Γ-t₂} {t} F Γ X .((Γ-t₂ ++ (t ∷ ε)) r++ Γ-t₁) refl eq2 p = subst (λ z → ⊢ hypos-i-h {n} {Γ-t₁} {Γ-t₂ ++ (t ∷ ε)} {ε} Γ (app (app A (app N z)) (subst (λ z → Form z $o) eq2 F))) (tst3b {n} {t} Γ-t₁ Γ-t₂ X eq2) p
tst3' : ∀ {n Γ-t₁ Γ-t₂} → {t : Type n} (F : Form (t ∷ (Γ-t₂ r++ Γ-t₁)) $o) (Γ : FSC-Ctx n Γ-t₁) →
(eq : t ∷ (Γ-t₂ r++ Γ-t₁) ≡ (Γ-t₂ ++ (t ∷ ε)) r++ Γ-t₁) →
⊢ hypos-i-h {n} {Γ-t₁} {Γ-t₂ ++ (t ∷ ε)} {ε} Γ (subst (λ z → Form z $o) eq F) →
⊢ hypos-i-h {n} {Γ-t₁} {Γ-t₂} {ε} Γ (![ t ] F)
tst3' {n} {ε} {Γ-t₂} {t} F ε eq = λ p → inf-VI-s (tst3-ε {n} (t ∷ (Γ-t₂ r++ ε)) ((Γ-t₂ ++ (t ∷ ε)) r++ ε) F eq p)
tst3' {n} {t' ∷ Γ-t₁} {Γ-t₂} F ((.t') ∷ Γ) eq = tst3' {n} {Γ-t₁} {t' ∷ Γ-t₂} F Γ eq
tst3' {n} {Γ-t₁} {Γ-t₂} {t} F (X ∷h Γ) eq = λ p → inf-V (traverse-hypos-i {n} {Γ-t₁} {Γ-t₂} (![ t ] (weak (~ (m-weak-h Γ-t₁ Γ-t₂ {_} {ε} X)) || F)) (m-weak-h {n} Γ-t₁ Γ-t₂ {$o} {ε} X => ![ t ] F) Γ (inf-V (inf-V ax-4-s ax-6-s) (lem2h2hb _))) (tst3' {n} {Γ-t₁} {Γ-t₂} {t} (weak (~ (m-weak-h Γ-t₁ Γ-t₂ {_} {ε} X)) || F) Γ eq (tst3'-∷h {n} {Γ-t₁} {Γ-t₂} {t} F Γ X (t ∷ (Γ-t₂ r++ Γ-t₁)) eq refl p))
traverse-hypos-eq-=>-I : ∀ {n Γ-t} → {t₁ t₂ : Type n} (F₁ F₂ : Form (t₁ ∷ Γ-t) t₂) (Γ : FSC-Ctx n Γ-t) →
⊢ hypos (t₁ ∷ Γ) (F₁ == F₂) →
⊢ hypos Γ (lam t₁ F₁ == lam t₁ F₂)
traverse-hypos-eq-=>-I {_} {Γ-t} {t₁} {t₂} F₁ F₂ Γ p = inf-V (traverse-hypos (![ t₁ ] (F₁ == F₂)) (lam t₁ F₁ == lam t₁ F₂) Γ ax-10-b-s) (tst3' {_} {Γ-t} {ε} (F₁ == F₂) Γ refl p)
|
test/Succeed/Issue1436-18.agda
|
shlevy/agda
| 1,989 |
396
|
<reponame>shlevy/agda<filename>test/Succeed/Issue1436-18.agda
module _ where
module Test₁ where
module A where
infixl 0 _+_
data D : Set where
• : D
_+_ : D → D → D
module B where
data D : Set where
• : D
_+_ : D → D → D
open A
open B
Foo : A.D
Foo = • + • + •
module Test₂ where
module A where
data D : Set where
• : D
_+_ : D → D → D
module B where
data D : Set where
• : D
_+_ : D → D → D
open A
open B
Foo : A.D
Foo = • + •
module Test₃ where
module A where
data D : Set where
• : D
c : D → D → D
syntax c x y = x + y
module B where
data D : Set where
• : D
c : D → D → D
syntax c x y = x + y
open A
open B
Foo : A.D
Foo = • + •
|
programs/oeis/120/A120178.asm
|
neoneye/loda
| 22 |
15220
|
<gh_stars>10-100
; A120178: a(n)=ceiling( sum_{i=1..n-1} a(i)/6), a(1)=1.
; 1,1,1,1,1,1,1,2,2,2,3,3,4,4,5,6,7,8,9,11,13,15,17,20,23,27,32,37,43,50,59,69,80,93,109,127,148,173,202,235,275,320,374,436,509,594,693,808,943,1100,1283,1497,1747,2038,2377,2774,3236,3775,4404,5138,5995,6994
seq $0,279077 ; Maximum starting value of X such that repeated replacement of X with X-ceiling(X/7) requires n steps to reach 0.
sub $0,2
lpb $0
add $0,2
div $0,7
add $1,$0
add $0,$2
mov $2,$0
lpe
add $1,1
mov $0,$1
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/linker_alias.ads
|
best08618/asylo
| 7 |
24766
|
<reponame>best08618/asylo
-- { dg-do compile }
-- { dg-skip-if "missing alias support" { *-*-darwin* hppa*-*-hpux* } }
package Linker_Alias is
Var : Integer; -- { dg-error "aliased to undefined symbol" }
pragma Export (C, Var, "my_var");
pragma Linker_Alias (Var, "var2");
end Linker_Alias;
|
136/ada/greet_5a.adb
|
notdb/LC-Practice
| 0 |
26969
|
with Ada.Text_IO; use Ada.Text_IO;
procedure Greet_5a is
begin
for I in 1 .. 5 loop
Put_Line ("Hello, World!" & Integer'Image (I)); -- Procedure call
-- ^ Procedure parameter
end loop;
end Greet_5a;
|
Type/Cubical/SubtypeSet.agda
|
Lolirofle/stuff-in-agda
| 6 |
16998
|
{-# OPTIONS --cubical #-}
module Type.Cubical.SubtypeSet where
open import Function.Axioms
open import Functional
open import Logic.Predicate as PTLogic using () renaming ([∃]-intro to intro)
import Lvl
open import Structure.Function.Domain using (intro ; Inverseₗ ; Inverseᵣ)
open import Structure.Relator.Properties
open import Structure.Type.Identity
open import Type.Cubical.Equiv
import Type.Cubical.Logic as Logic
open import Type.Cubical.Path.Equality
open import Type.Cubical.Univalence
open import Type.Cubical
open import Type.Properties.MereProposition
open import Type.Properties.Singleton.Proofs
open import Type
private variable ℓ ℓ₁ ℓ₂ ℓₑ : Lvl.Level
private variable T A B P Q : Type{ℓ}
{-
module _ {P Q : T → Type} ⦃ prop-P : ∀{x} → MereProposition{ℓ}(P(x)) ⦄ ⦃ prop-Q : ∀{x} → MereProposition{ℓ}(Q(x)) ⦄ where
prop-set-extensionalityₗ : (P ≡ Q) ← (∀{x} → P(x) ↔ Q(x))
prop-set-extensionalityₗ pq = functionExtensionalityOn P Q (propositional-extensionalityₗ pq)
-}
--data Prop{ℓ} : Type{Lvl.𝐒(ℓ)} where
-- intro : (T : Type{ℓ}) → ⦃ MereProposition(T) ⦄ → Prop
Prop = \{ℓ} → PTLogic.∃{Obj = Type{ℓ}} (T ↦ MereProposition(T))
⊤ : Prop
⊤ = intro(Logic.⊤) ⦃ prop-top ⦄
⊥ : Prop
⊥ = intro(Logic.⊥) ⦃ prop-bottom ⦄
¬_ : Prop{ℓ} → Prop
¬(intro A) = intro(Logic.¬ A) ⦃ prop-negation ⦄
_⟶_ : Prop{ℓ₁} → Prop{ℓ₂} → Prop
(intro A) ⟶ (intro B) = intro(A → B) ⦃ prop-implication ⦄
_∨_ : Prop{ℓ₁} → Prop{ℓ₂} → Prop
(intro A) ∨ (intro B) = intro(A Logic.∨ B)
_∧_ : Prop{ℓ₁} → Prop{ℓ₂} → Prop
(intro A) ∧ (intro B) = intro(A Logic.∧ B) ⦃ prop-conjunction ⦄
∃ : (T → Prop{ℓ}) → Prop
∃ P = intro(Logic.∃(PTLogic.[∃]-witness ∘ P))
-- ∀ₚ : (T → Prop{ℓ}) → Prop
-- ∀ₚ P = intro(PTLogic.∀ₗ(PTLogic.[∃]-witness ∘ P)) ⦃ {!prop-universal!} ⦄
record SubtypeSet {ℓₑ ℓ} (T : Type{ℓ}) : Type{ℓ Lvl.⊔ Lvl.𝐒(ℓₑ)} where
constructor filter
field _∋_ : T → Prop{ℓₑ}
open SubtypeSet using (_∋_) public
{- TODO: When Structure is generalized to arbitrary logic symbols
import Structure.Sets.Names
open Structure.Sets.Names.From-[∋] (_∋_) public
-}
_∈_ : T → SubtypeSet{ℓ}(T) → Prop
_∈_ = swap(_∋_)
_∉_ : T → SubtypeSet{ℓ}(T) → Prop
_∉_ = (¬_) ∘₂ (_∈_)
_∌_ : SubtypeSet{ℓ}(T) → T → Prop
_∌_ = (¬_) ∘₂ (_∋_)
∅ : SubtypeSet(T)
∅ ∋ _ = ⊥
𝐔 : SubtypeSet(T)
𝐔 ∋ _ = ⊤
∁ : SubtypeSet{ℓ}(T) → SubtypeSet(T)
(∁ A) ∋ x = A ∌ x
_∪_ : SubtypeSet{ℓ₁}(T) → SubtypeSet{ℓ₂}(T) → SubtypeSet(T)
(A ∪ B) ∋ x = (A ∋ x) ∨ (B ∋ x)
_∩_ : SubtypeSet{ℓ₁}(T) → SubtypeSet{ℓ₂}(T) → SubtypeSet(T)
(A ∩ B) ∋ x = (A ∋ x) ∧ (B ∋ x)
_∖_ : SubtypeSet{ℓ₁}(T) → SubtypeSet{ℓ₂}(T) → SubtypeSet(T)
(A ∖ B) ∋ x = (A ∋ x) ∧ (B ∌ x)
unmap : (A → B) → SubtypeSet{ℓ}(B) → SubtypeSet(A)
unmap f(A) ∋ x = A ∋ f(x)
-- map : (A → B) → SubtypeSet{ℓ}(A) → SubtypeSet(B)
-- map f(A) ∋ y = ∃(x ↦ (A ∋ x) ∧ (f(x) ≡ y))
-- TODO: Maybe SubtypeSet should require that the witness is a HSet?
-- ⊶ : (A → B) → SubtypeSet(B)
-- (⊶ f) ∋ y = ∃(x ↦ PTLogic.[∃]-intro (f(x) ≡ y) ⦃ {!!} ⦄)
|
Tasks/Float_to_Int32.asm
|
BenSokol/EECS690-Project2
| 0 |
102555
|
;;*****************************************************************************
;;
;; Float_to_Int32.asm
;;
;; Author: <NAME>
;; Organization: KU/EECS/EECS 690
;; Date: 2017-10-06 (B71006)
;; Version: 1.0
;;
;; Purpose: Copy float bits to int32_t.
;;
;; Notes:
;;
;;*****************************************************************************
;;
;;
;; This subroutine computes a value based on one input arguement.
;; The arguments is assumed to be in CPU registes R0
;; (aka A1).
;; The result is returned in R0.
;;
;; Declare sections and external references
.global Float_to_Int32 ; Declare entry point as a global symbol
;; No constant data
;; No variable allocation
;; Program instructions
.text ; Program section
Float_to_Int32: ; Entry point
;;
;; Save necessary registers
;;
;; Since this subroutine does not use registers other than R0,
;; and we do not call another subroutine, we don't need to save
;; any registers.
;;
;; Allocate local variables on the Stack
;;
;; Since this subroutine does not have local variables,
;; no Stack space need be allocated.
;;
;; This subroutine returns the input argument in R0.
;;
BX LR ; Branch to the program address in the Link Register
.end
|
oeis/216/A216477.asm
|
neoneye/loda-programs
| 11 |
170896
|
; A216477: The sequence of the parts in the partition binary diagram represented as an array.
; Submitted by <NAME>(s3)
; 1,2,1,3,1,4,2,1,5,2,1,6,3,2,1,7,3,2,1,8,4,3,2,1,9,4,3,2,1,10,5,4,3,2,1,11,5,4,3,2,1,12,6,5,4,3,2,1,13,6,5,4,3,2,1,14,7,6,5,4,3,2,1,15,7,6,5,4,3,2,1,16,8,7,6,5,4,3,2,1
lpb $0
add $1,$2
sub $0,$1
cmp $2,0
sub $0,$2
lpe
add $2,$1
add $0,$2
add $0,1
add $1,$2
mod $1,$0
mov $0,$1
add $0,1
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/sso/q9.adb
|
best08618/asylo
| 7 |
15697
|
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/sso/q9.adb
-- { dg-do run }
with Init9; use Init9;
with Ada.Numerics; use Ada.Numerics;
with Text_IO; use Text_IO;
with Dump;
procedure Q9 is
A1 : R1 := My_R1;
B1 : R1 := My_R1;
A2 : R2 := My_R2;
B2 : R2 := My_R2;
begin
Put ("A1 :");
Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "A1 : 18 2d 44 54 fb 21 09 40.*\n" }
Put ("B1 :");
Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "B1 : 18 2d 44 54 fb 21 09 40.*\n" }
Put ("A2 :");
Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "A2 : 40 09 21 fb 54 44 2d 18.*\n" }
Put ("B2 :");
Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "B2 : 40 09 21 fb 54 44 2d 18.*\n" }
if A1.F /= B1.F then
raise Program_Error;
end if;
if A1.F /= Pi then
raise Program_Error;
end if;
if A2.F /= B2.F then
raise Program_Error;
end if;
if A2.F /= Pi then
raise Program_Error;
end if;
end;
|
libsrc/_DEVELOPMENT/arch/zx/globals/z80/_GLOBAL_ZX_DIVMMC_PAGE_OFFSET.asm
|
jpoikela/z88dk
| 640 |
178907
|
<reponame>jpoikela/z88dk<gh_stars>100-1000
SECTION data_arch
PUBLIC _GLOBAL_ZX_DIVMMC_PAGE_OFFSET
_GLOBAL_ZX_DIVMMC_PAGE_OFFSET:
defb 5
|
gfx/tilesets/museum_palette_map.asm
|
AtmaBuster/pokeplat-gen2
| 6 |
245050
|
<filename>gfx/tilesets/museum_palette_map.asm
tilepal 0, GRAY, RED, GRAY, ROOF, ROOF, ROOF, GRAY, GRAY
tilepal 0, BROWN, BROWN, BROWN, GRAY, GRAY, GRAY, GREEN, GREEN
tilepal 0, WATER, GRAY, GRAY, ROOF, ROOF, ROOF, BROWN, BROWN
tilepal 0, BROWN, BROWN, BROWN, GRAY, GRAY, GRAY, GREEN, GREEN
tilepal 0, YELLOW, YELLOW, ROOF, ROOF, ROOF, ROOF, GRAY, GRAY
tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, BROWN, BROWN
tilepal 0, YELLOW, YELLOW, BROWN, BROWN, RED, RED, GRAY, GRAY
tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, BROWN, BROWN
rept 32
db $ff
endr
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ca/ca2009a.ada
|
best08618/asylo
| 7 |
24604
|
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ca/ca2009a.ada
-- CA2009A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT A GENERIC PACKAGE SUBUNIT CAN BE SPECIFIED AND
-- INSTANTIATED.
-- BHS 8/01/84
-- JRK 5/24/85 CHANGED TO .ADA, SEE AI-00323.
WITH REPORT;
USE REPORT;
PROCEDURE CA2009A IS
INT1 : INTEGER := 1;
SUBTYPE STR15 IS STRING (1..15);
SVAR : STR15 := "ABCDEFGHIJKLMNO";
GENERIC
TYPE ITEM IS PRIVATE;
CON1 : IN ITEM;
VAR1 : IN OUT ITEM;
PACKAGE PKG1 IS
END PKG1;
PACKAGE BODY PKG1 IS SEPARATE;
PACKAGE NI_PKG1 IS NEW PKG1 (INTEGER, IDENT_INT(2), INT1);
PACKAGE NS_PKG1 IS NEW PKG1 (STR15, IDENT_STR("REINSTANTIATION"),
SVAR);
BEGIN
TEST ("CA2009A", "SPECIFICATION AND INSTANTIATION " &
"OF GENERIC PACKAGE SUBUNITS");
IF INT1 /= 2 THEN
FAILED ("INCORRECT INSTANTIATION - INTEGER");
END IF;
IF SVAR /= "REINSTANTIATION" THEN
FAILED ("INCORRECT INSTANTIATION - STRING");
END IF;
RESULT;
END CA2009A;
SEPARATE (CA2009A)
PACKAGE BODY PKG1 IS
BEGIN
VAR1 := CON1;
END PKG1;
|
Z80tests/screenfill2.asm
|
ruyrybeyro/QtSpecem
| 7 |
21000
|
; FILL ZX SPECTRUM SCREEN GOING THROUGH EACH VISUAL LINE
;
; SCREEN ADDRESS
;
; H = 0 1 0 Y7 Y6 Y2 Y1 Y0
; L = Y5 Y4 Y3 X4 X3 X2 X1 X0
; pasmo --tapbas screenfill2.asm screenfill2.asm
ORG 50000
LD HL,$4000 ; SCREEN START
LD B,3 ; 3 SECTIONS
Y7_Y6: PUSH BC
LD B,8 ; NEXT LINE - 8 TEXT LINES
Y5_Y3: PUSH BC
LD B,8 ; CHAR SECTION - 8 VERTICAL PIXELS
Y2_Y0: PUSH BC
LD B,31 ; 32 COLUMNS
LD A,255
X4_X0:
LD (HL),A
INC L
CALL W_DELAY
DJNZ X4_X0
LD (HL),A ; FILL THE 32nd COLUMN
; back to column 0
LD A,L
AND $E0
LD L,A
INC H ; NEXT CHAR "LINE"
CALL W_DELAY
POP BC
DJNZ Y2_Y0
DEC H ; ONE TOO MUCH
; Zero Y2-Y0
LD A,H
AND $58
LD H,A
; Add 1 to Y5-Y3
LD A,L
ADD A,$20
LD L,A
POP BC
DJNZ Y5_Y3
; Add one to section (Y7-Y6)
LD A,H
ADD A,$8
LD H,A
POP BC
DJNZ Y7_Y6
; need to return to lower screen
LD A,1 ; lower screen
CALL 5633 ; open channel
CALL $15DE ; WAIT-KEY1
RET
W_DELAY:
PUSH BC
LD B,255
WAIT: DJNZ WAIT
LD B,255
WAIT2: DJNZ WAIT2
POP BC
RET
END 50000
|
src/gnat/rident.ads
|
My-Colaborations/dynamo
| 15 |
16854
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- R I D E N T --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package defines the set of restriction identifiers for use by the
-- compiler and binder. It is in a separate package from Restrict so that
-- it can be used by the binder without dragging in unneeded compiler
-- packages.
-- Note: the actual definitions of the types are in package System.Rident,
-- and this package is merely an instantiation of that package. The point
-- of this level of generic indirection is to allow the compile time use
-- to have the image tables available (this package is not compiled with
-- Discard_Names), while at run-time we do not want those image tables.
-- Rather than have clients instantiate System.Rident directly, we have the
-- single instantiation here at the library level, which means that we only
-- have one copy of the image tables
with System.Rident;
package Rident is new System.Rident;
|
mc-sema/validator/x86_64/tests/ADC64i32.asm
|
randolphwong/mcsema
| 2 |
179888
|
<reponame>randolphwong/mcsema
BITS 64
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=
;TEST_FILE_META_END
; ADC32i32
mov rax, 0x778
;TEST_BEGIN_RECORDING
adc rax, 0x6fffffff
;TEST_END_RECORDING
|
src/stm32-dma.ads
|
damaki/EVB1000
| 0 |
302
|
<gh_stars>0
-- This spec has been automatically generated from STM32F105xx.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with System;
package STM32.DMA is
pragma Preelaborate;
---------------
-- Registers --
---------------
------------------
-- ISR_Register --
------------------
subtype ISR_GIF1_Field is STM32.Bit;
subtype ISR_TCIF1_Field is STM32.Bit;
subtype ISR_HTIF1_Field is STM32.Bit;
subtype ISR_TEIF1_Field is STM32.Bit;
subtype ISR_GIF2_Field is STM32.Bit;
subtype ISR_TCIF2_Field is STM32.Bit;
subtype ISR_HTIF2_Field is STM32.Bit;
subtype ISR_TEIF2_Field is STM32.Bit;
subtype ISR_GIF3_Field is STM32.Bit;
subtype ISR_TCIF3_Field is STM32.Bit;
subtype ISR_HTIF3_Field is STM32.Bit;
subtype ISR_TEIF3_Field is STM32.Bit;
subtype ISR_GIF4_Field is STM32.Bit;
subtype ISR_TCIF4_Field is STM32.Bit;
subtype ISR_HTIF4_Field is STM32.Bit;
subtype ISR_TEIF4_Field is STM32.Bit;
subtype ISR_GIF5_Field is STM32.Bit;
subtype ISR_TCIF5_Field is STM32.Bit;
subtype ISR_HTIF5_Field is STM32.Bit;
subtype ISR_TEIF5_Field is STM32.Bit;
subtype ISR_GIF6_Field is STM32.Bit;
subtype ISR_TCIF6_Field is STM32.Bit;
subtype ISR_HTIF6_Field is STM32.Bit;
subtype ISR_TEIF6_Field is STM32.Bit;
subtype ISR_GIF7_Field is STM32.Bit;
subtype ISR_TCIF7_Field is STM32.Bit;
subtype ISR_HTIF7_Field is STM32.Bit;
subtype ISR_TEIF7_Field is STM32.Bit;
-- DMA interrupt status register (DMA_ISR)
type ISR_Register is record
-- Read-only. Channel 1 Global interrupt flag
GIF1 : ISR_GIF1_Field;
-- Read-only. Channel 1 Transfer Complete flag
TCIF1 : ISR_TCIF1_Field;
-- Read-only. Channel 1 Half Transfer Complete flag
HTIF1 : ISR_HTIF1_Field;
-- Read-only. Channel 1 Transfer Error flag
TEIF1 : ISR_TEIF1_Field;
-- Read-only. Channel 2 Global interrupt flag
GIF2 : ISR_GIF2_Field;
-- Read-only. Channel 2 Transfer Complete flag
TCIF2 : ISR_TCIF2_Field;
-- Read-only. Channel 2 Half Transfer Complete flag
HTIF2 : ISR_HTIF2_Field;
-- Read-only. Channel 2 Transfer Error flag
TEIF2 : ISR_TEIF2_Field;
-- Read-only. Channel 3 Global interrupt flag
GIF3 : ISR_GIF3_Field;
-- Read-only. Channel 3 Transfer Complete flag
TCIF3 : ISR_TCIF3_Field;
-- Read-only. Channel 3 Half Transfer Complete flag
HTIF3 : ISR_HTIF3_Field;
-- Read-only. Channel 3 Transfer Error flag
TEIF3 : ISR_TEIF3_Field;
-- Read-only. Channel 4 Global interrupt flag
GIF4 : ISR_GIF4_Field;
-- Read-only. Channel 4 Transfer Complete flag
TCIF4 : ISR_TCIF4_Field;
-- Read-only. Channel 4 Half Transfer Complete flag
HTIF4 : ISR_HTIF4_Field;
-- Read-only. Channel 4 Transfer Error flag
TEIF4 : ISR_TEIF4_Field;
-- Read-only. Channel 5 Global interrupt flag
GIF5 : ISR_GIF5_Field;
-- Read-only. Channel 5 Transfer Complete flag
TCIF5 : ISR_TCIF5_Field;
-- Read-only. Channel 5 Half Transfer Complete flag
HTIF5 : ISR_HTIF5_Field;
-- Read-only. Channel 5 Transfer Error flag
TEIF5 : ISR_TEIF5_Field;
-- Read-only. Channel 6 Global interrupt flag
GIF6 : ISR_GIF6_Field;
-- Read-only. Channel 6 Transfer Complete flag
TCIF6 : ISR_TCIF6_Field;
-- Read-only. Channel 6 Half Transfer Complete flag
HTIF6 : ISR_HTIF6_Field;
-- Read-only. Channel 6 Transfer Error flag
TEIF6 : ISR_TEIF6_Field;
-- Read-only. Channel 7 Global interrupt flag
GIF7 : ISR_GIF7_Field;
-- Read-only. Channel 7 Transfer Complete flag
TCIF7 : ISR_TCIF7_Field;
-- Read-only. Channel 7 Half Transfer Complete flag
HTIF7 : ISR_HTIF7_Field;
-- Read-only. Channel 7 Transfer Error flag
TEIF7 : ISR_TEIF7_Field;
-- unspecified
Reserved_28_31 : STM32.UInt4;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ISR_Register use record
GIF1 at 0 range 0 .. 0;
TCIF1 at 0 range 1 .. 1;
HTIF1 at 0 range 2 .. 2;
TEIF1 at 0 range 3 .. 3;
GIF2 at 0 range 4 .. 4;
TCIF2 at 0 range 5 .. 5;
HTIF2 at 0 range 6 .. 6;
TEIF2 at 0 range 7 .. 7;
GIF3 at 0 range 8 .. 8;
TCIF3 at 0 range 9 .. 9;
HTIF3 at 0 range 10 .. 10;
TEIF3 at 0 range 11 .. 11;
GIF4 at 0 range 12 .. 12;
TCIF4 at 0 range 13 .. 13;
HTIF4 at 0 range 14 .. 14;
TEIF4 at 0 range 15 .. 15;
GIF5 at 0 range 16 .. 16;
TCIF5 at 0 range 17 .. 17;
HTIF5 at 0 range 18 .. 18;
TEIF5 at 0 range 19 .. 19;
GIF6 at 0 range 20 .. 20;
TCIF6 at 0 range 21 .. 21;
HTIF6 at 0 range 22 .. 22;
TEIF6 at 0 range 23 .. 23;
GIF7 at 0 range 24 .. 24;
TCIF7 at 0 range 25 .. 25;
HTIF7 at 0 range 26 .. 26;
TEIF7 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
-------------------
-- IFCR_Register --
-------------------
subtype IFCR_CGIF1_Field is STM32.Bit;
subtype IFCR_CTCIF1_Field is STM32.Bit;
subtype IFCR_CHTIF1_Field is STM32.Bit;
subtype IFCR_CTEIF1_Field is STM32.Bit;
subtype IFCR_CGIF2_Field is STM32.Bit;
subtype IFCR_CTCIF2_Field is STM32.Bit;
subtype IFCR_CHTIF2_Field is STM32.Bit;
subtype IFCR_CTEIF2_Field is STM32.Bit;
subtype IFCR_CGIF3_Field is STM32.Bit;
subtype IFCR_CTCIF3_Field is STM32.Bit;
subtype IFCR_CHTIF3_Field is STM32.Bit;
subtype IFCR_CTEIF3_Field is STM32.Bit;
subtype IFCR_CGIF4_Field is STM32.Bit;
subtype IFCR_CTCIF4_Field is STM32.Bit;
subtype IFCR_CHTIF4_Field is STM32.Bit;
subtype IFCR_CTEIF4_Field is STM32.Bit;
subtype IFCR_CGIF5_Field is STM32.Bit;
subtype IFCR_CTCIF5_Field is STM32.Bit;
subtype IFCR_CHTIF5_Field is STM32.Bit;
subtype IFCR_CTEIF5_Field is STM32.Bit;
subtype IFCR_CGIF6_Field is STM32.Bit;
subtype IFCR_CTCIF6_Field is STM32.Bit;
subtype IFCR_CHTIF6_Field is STM32.Bit;
subtype IFCR_CTEIF6_Field is STM32.Bit;
subtype IFCR_CGIF7_Field is STM32.Bit;
subtype IFCR_CTCIF7_Field is STM32.Bit;
subtype IFCR_CHTIF7_Field is STM32.Bit;
subtype IFCR_CTEIF7_Field is STM32.Bit;
-- DMA interrupt flag clear register (DMA_IFCR)
type IFCR_Register is record
-- Write-only. Channel 1 Global interrupt clear
CGIF1 : IFCR_CGIF1_Field := 16#0#;
-- Write-only. Channel 1 Transfer Complete clear
CTCIF1 : IFCR_CTCIF1_Field := 16#0#;
-- Write-only. Channel 1 Half Transfer clear
CHTIF1 : IFCR_CHTIF1_Field := 16#0#;
-- Write-only. Channel 1 Transfer Error clear
CTEIF1 : IFCR_CTEIF1_Field := 16#0#;
-- Write-only. Channel 2 Global interrupt clear
CGIF2 : IFCR_CGIF2_Field := 16#0#;
-- Write-only. Channel 2 Transfer Complete clear
CTCIF2 : IFCR_CTCIF2_Field := 16#0#;
-- Write-only. Channel 2 Half Transfer clear
CHTIF2 : IFCR_CHTIF2_Field := 16#0#;
-- Write-only. Channel 2 Transfer Error clear
CTEIF2 : IFCR_CTEIF2_Field := 16#0#;
-- Write-only. Channel 3 Global interrupt clear
CGIF3 : IFCR_CGIF3_Field := 16#0#;
-- Write-only. Channel 3 Transfer Complete clear
CTCIF3 : IFCR_CTCIF3_Field := 16#0#;
-- Write-only. Channel 3 Half Transfer clear
CHTIF3 : IFCR_CHTIF3_Field := 16#0#;
-- Write-only. Channel 3 Transfer Error clear
CTEIF3 : IFCR_CTEIF3_Field := 16#0#;
-- Write-only. Channel 4 Global interrupt clear
CGIF4 : IFCR_CGIF4_Field := 16#0#;
-- Write-only. Channel 4 Transfer Complete clear
CTCIF4 : IFCR_CTCIF4_Field := 16#0#;
-- Write-only. Channel 4 Half Transfer clear
CHTIF4 : IFCR_CHTIF4_Field := 16#0#;
-- Write-only. Channel 4 Transfer Error clear
CTEIF4 : IFCR_CTEIF4_Field := 16#0#;
-- Write-only. Channel 5 Global interrupt clear
CGIF5 : IFCR_CGIF5_Field := 16#0#;
-- Write-only. Channel 5 Transfer Complete clear
CTCIF5 : IFCR_CTCIF5_Field := 16#0#;
-- Write-only. Channel 5 Half Transfer clear
CHTIF5 : IFCR_CHTIF5_Field := 16#0#;
-- Write-only. Channel 5 Transfer Error clear
CTEIF5 : IFCR_CTEIF5_Field := 16#0#;
-- Write-only. Channel 6 Global interrupt clear
CGIF6 : IFCR_CGIF6_Field := 16#0#;
-- Write-only. Channel 6 Transfer Complete clear
CTCIF6 : IFCR_CTCIF6_Field := 16#0#;
-- Write-only. Channel 6 Half Transfer clear
CHTIF6 : IFCR_CHTIF6_Field := 16#0#;
-- Write-only. Channel 6 Transfer Error clear
CTEIF6 : IFCR_CTEIF6_Field := 16#0#;
-- Write-only. Channel 7 Global interrupt clear
CGIF7 : IFCR_CGIF7_Field := 16#0#;
-- Write-only. Channel 7 Transfer Complete clear
CTCIF7 : IFCR_CTCIF7_Field := 16#0#;
-- Write-only. Channel 7 Half Transfer clear
CHTIF7 : IFCR_CHTIF7_Field := 16#0#;
-- Write-only. Channel 7 Transfer Error clear
CTEIF7 : IFCR_CTEIF7_Field := 16#0#;
-- unspecified
Reserved_28_31 : STM32.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IFCR_Register use record
CGIF1 at 0 range 0 .. 0;
CTCIF1 at 0 range 1 .. 1;
CHTIF1 at 0 range 2 .. 2;
CTEIF1 at 0 range 3 .. 3;
CGIF2 at 0 range 4 .. 4;
CTCIF2 at 0 range 5 .. 5;
CHTIF2 at 0 range 6 .. 6;
CTEIF2 at 0 range 7 .. 7;
CGIF3 at 0 range 8 .. 8;
CTCIF3 at 0 range 9 .. 9;
CHTIF3 at 0 range 10 .. 10;
CTEIF3 at 0 range 11 .. 11;
CGIF4 at 0 range 12 .. 12;
CTCIF4 at 0 range 13 .. 13;
CHTIF4 at 0 range 14 .. 14;
CTEIF4 at 0 range 15 .. 15;
CGIF5 at 0 range 16 .. 16;
CTCIF5 at 0 range 17 .. 17;
CHTIF5 at 0 range 18 .. 18;
CTEIF5 at 0 range 19 .. 19;
CGIF6 at 0 range 20 .. 20;
CTCIF6 at 0 range 21 .. 21;
CHTIF6 at 0 range 22 .. 22;
CTEIF6 at 0 range 23 .. 23;
CGIF7 at 0 range 24 .. 24;
CTCIF7 at 0 range 25 .. 25;
CHTIF7 at 0 range 26 .. 26;
CTEIF7 at 0 range 27 .. 27;
Reserved_28_31 at 0 range 28 .. 31;
end record;
------------------
-- CCR_Register --
------------------
subtype CCR1_EN_Field is STM32.Bit;
subtype CCR1_TCIE_Field is STM32.Bit;
subtype CCR1_HTIE_Field is STM32.Bit;
subtype CCR1_TEIE_Field is STM32.Bit;
subtype CCR1_DIR_Field is STM32.Bit;
subtype CCR1_CIRC_Field is STM32.Bit;
subtype CCR1_PINC_Field is STM32.Bit;
subtype CCR1_MINC_Field is STM32.Bit;
subtype CCR1_PSIZE_Field is STM32.UInt2;
subtype CCR1_MSIZE_Field is STM32.UInt2;
subtype CCR1_PL_Field is STM32.UInt2;
subtype CCR1_MEM2MEM_Field is STM32.Bit;
-- DMA channel configuration register (DMA_CCR)
type CCR_Register is record
-- Channel enable
EN : CCR1_EN_Field := 16#0#;
-- Transfer complete interrupt enable
TCIE : CCR1_TCIE_Field := 16#0#;
-- Half Transfer interrupt enable
HTIE : CCR1_HTIE_Field := 16#0#;
-- Transfer error interrupt enable
TEIE : CCR1_TEIE_Field := 16#0#;
-- Data transfer direction
DIR : CCR1_DIR_Field := 16#0#;
-- Circular mode
CIRC : CCR1_CIRC_Field := 16#0#;
-- Peripheral increment mode
PINC : CCR1_PINC_Field := 16#0#;
-- Memory increment mode
MINC : CCR1_MINC_Field := 16#0#;
-- Peripheral size
PSIZE : CCR1_PSIZE_Field := 16#0#;
-- Memory size
MSIZE : CCR1_MSIZE_Field := 16#0#;
-- Channel Priority level
PL : CCR1_PL_Field := 16#0#;
-- Memory to memory mode
MEM2MEM : CCR1_MEM2MEM_Field := 16#0#;
-- unspecified
Reserved_15_31 : STM32.UInt17 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CCR_Register use record
EN at 0 range 0 .. 0;
TCIE at 0 range 1 .. 1;
HTIE at 0 range 2 .. 2;
TEIE at 0 range 3 .. 3;
DIR at 0 range 4 .. 4;
CIRC at 0 range 5 .. 5;
PINC at 0 range 6 .. 6;
MINC at 0 range 7 .. 7;
PSIZE at 0 range 8 .. 9;
MSIZE at 0 range 10 .. 11;
PL at 0 range 12 .. 13;
MEM2MEM at 0 range 14 .. 14;
Reserved_15_31 at 0 range 15 .. 31;
end record;
--------------------
-- CNDTR_Register --
--------------------
subtype CNDTR1_NDT_Field is STM32.Short;
-- DMA channel 1 number of data register
type CNDTR_Register is record
-- Number of data to transfer
NDT : CNDTR1_NDT_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CNDTR_Register use record
NDT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- DMA controller
type DMA_Peripheral is record
-- DMA interrupt status register (DMA_ISR)
ISR : ISR_Register;
-- DMA interrupt flag clear register (DMA_IFCR)
IFCR : IFCR_Register;
-- DMA channel configuration register (DMA_CCR)
CCR1 : CCR_Register;
-- DMA channel 1 number of data register
CNDTR1 : CNDTR_Register;
-- DMA channel 1 peripheral address register
CPAR1 : STM32.Word;
-- DMA channel 1 memory address register
CMAR1 : STM32.Word;
-- DMA channel configuration register (DMA_CCR)
CCR2 : CCR_Register;
-- DMA channel 2 number of data register
CNDTR2 : CNDTR_Register;
-- DMA channel 2 peripheral address register
CPAR2 : STM32.Word;
-- DMA channel 2 memory address register
CMAR2 : STM32.Word;
-- DMA channel configuration register (DMA_CCR)
CCR3 : CCR_Register;
-- DMA channel 3 number of data register
CNDTR3 : CNDTR_Register;
-- DMA channel 3 peripheral address register
CPAR3 : STM32.Word;
-- DMA channel 3 memory address register
CMAR3 : STM32.Word;
-- DMA channel configuration register (DMA_CCR)
CCR4 : CCR_Register;
-- DMA channel 4 number of data register
CNDTR4 : CNDTR_Register;
-- DMA channel 4 peripheral address register
CPAR4 : STM32.Word;
-- DMA channel 4 memory address register
CMAR4 : STM32.Word;
-- DMA channel configuration register (DMA_CCR)
CCR5 : CCR_Register;
-- DMA channel 5 number of data register
CNDTR5 : CNDTR_Register;
-- DMA channel 5 peripheral address register
CPAR5 : STM32.Word;
-- DMA channel 5 memory address register
CMAR5 : STM32.Word;
-- DMA channel configuration register (DMA_CCR)
CCR6 : CCR_Register;
-- DMA channel 6 number of data register
CNDTR6 : CNDTR_Register;
-- DMA channel 6 peripheral address register
CPAR6 : STM32.Word;
-- DMA channel 6 memory address register
CMAR6 : STM32.Word;
-- DMA channel configuration register (DMA_CCR)
CCR7 : CCR_Register;
-- DMA channel 7 number of data register
CNDTR7 : CNDTR_Register;
-- DMA channel 7 peripheral address register
CPAR7 : STM32.Word;
-- DMA channel 7 memory address register
CMAR7 : STM32.Word;
end record
with Volatile;
for DMA_Peripheral use record
ISR at 0 range 0 .. 31;
IFCR at 4 range 0 .. 31;
CCR1 at 8 range 0 .. 31;
CNDTR1 at 12 range 0 .. 31;
CPAR1 at 16 range 0 .. 31;
CMAR1 at 20 range 0 .. 31;
CCR2 at 28 range 0 .. 31;
CNDTR2 at 32 range 0 .. 31;
CPAR2 at 36 range 0 .. 31;
CMAR2 at 40 range 0 .. 31;
CCR3 at 48 range 0 .. 31;
CNDTR3 at 52 range 0 .. 31;
CPAR3 at 56 range 0 .. 31;
CMAR3 at 60 range 0 .. 31;
CCR4 at 68 range 0 .. 31;
CNDTR4 at 72 range 0 .. 31;
CPAR4 at 76 range 0 .. 31;
CMAR4 at 80 range 0 .. 31;
CCR5 at 88 range 0 .. 31;
CNDTR5 at 92 range 0 .. 31;
CPAR5 at 96 range 0 .. 31;
CMAR5 at 100 range 0 .. 31;
CCR6 at 108 range 0 .. 31;
CNDTR6 at 112 range 0 .. 31;
CPAR6 at 116 range 0 .. 31;
CMAR6 at 120 range 0 .. 31;
CCR7 at 128 range 0 .. 31;
CNDTR7 at 132 range 0 .. 31;
CPAR7 at 136 range 0 .. 31;
CMAR7 at 140 range 0 .. 31;
end record;
-- DMA controller
DMA1_Periph : aliased DMA_Peripheral
with Import, Address => DMA1_Base;
-- DMA controller
DMA2_Periph : aliased DMA_Peripheral
with Import, Address => DMA2_Base;
end STM32.DMA;
|
src/tests/bintoasc_suite-base85_tests.adb
|
jhumphry/Ada_BinToAsc
| 0 |
4085
|
<reponame>jhumphry/Ada_BinToAsc<filename>src/tests/bintoasc_suite-base85_tests.adb<gh_stars>0
-- BinToAsc_Suite.Base85_Tests
-- Unit tests for BinToAsc
-- Copyright (c) 2015, <NAME> - see LICENSE file for details
with AUnit.Assertions;
with System.Storage_Elements;
with Ada.Assertions;
with Storage_Array_To_Hex_String;
package body BinToAsc_Suite.Base85_Tests is
use AUnit.Assertions;
use System.Storage_Elements;
use ASCII85;
use type ASCII85.Codec_State;
function SATHS (X : Storage_Array) return String
renames Storage_Array_To_Hex_String;
--------------------
-- Register_Tests --
--------------------
procedure Register_Tests (T: in out Base85_Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Check_Z85_Symmetry'Access,
"Check the Z85 Encoder and Decoder are a symmetrical pair");
Register_Routine (T, Check_Z85_Length'Access,
"Check the Z85 Encoder and Decoder handle variable-length input successfully");
Register_Routine (T, Check_Z85_Test_Vector'Access,
"Check Z85 test vector can be encoded/decoded successfully");
Register_Routine (T, Check_Z85_Test_Vector_By_Char'Access,
"Check Z85 test vector can be encoded/decoded incrementally by byte/char");
Register_Routine (T, Check_Z85_Junk_Rejection'Access,
"Check Z85 rejects junk chars");
Register_Routine (T, Check_Z85_High_Group'Access,
"Check Z85 correctly decodes strings that represent values around 2**32");
Register_Routine (T, Check_Z85_Length_Rejection'Access,
"Check Z85 decoder rejects final character group of length 1");
end Register_Tests;
----------
-- Name --
----------
function Name (T : Base85_Test) return Test_String is
pragma Unreferenced (T);
begin
return Format ("Tests of ASCII85/Base85 codecs");
end Name;
------------
-- Set_Up --
------------
procedure Set_Up (T : in out Base85_Test) is
begin
null;
end Set_Up;
---------------------------
-- Check_Z85_Test_Vector --
---------------------------
procedure Check_Z85_Test_Vector (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
Z85_Test_Vector : constant Storage_Array :=
(16#86#, 16#4F#, 16#D2#, 16#6F#,
16#B5#, 16#59#, 16#F7#, 16#5B#);
Z85_Encoded : constant String := "HelloWorld";
begin
Assert(Z85.To_String(Z85_Test_Vector) = Z85_Encoded,
"Z85 encoder on test vector produced " &
Z85.To_String(Z85_Test_Vector) &
" rather than 'HelloWorld'");
Assert(Z85.To_Bin(Z85_Encoded) = Z85_Test_Vector,
"Z85 decoder on test vector produced " &
SATHS(Z85.To_Bin(Z85_Encoded)) &
" rather than " &
SATHS(Z85_Test_Vector));
end Check_Z85_Test_Vector;
-----------------------------------
-- Check_Z85_Test_Vector_By_Char --
-----------------------------------
procedure Check_Z85_Test_Vector_By_Char (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
Z85_Test_Vector : constant Storage_Array :=
(16#86#, 16#4F#, 16#D2#, 16#6F#,
16#B5#, 16#59#, 16#F7#, 16#5B#);
Z85_Encoded : constant String := "HelloWorld";
begin
declare
Z85_Encoder : Z85.Base85_To_String;
Buffer_String : String(1..15);
Buffer_Index : Integer := 1;
Buffer_Used : Integer := 0;
begin
Z85_Encoder.Reset;
for I of Z85_Test_Vector loop
Z85_Encoder.Process(Input => I,
Output => Buffer_String(Buffer_Index..Buffer_String'Last),
Output_Length => Buffer_Used);
Buffer_Index := Buffer_Index + Buffer_Used;
end loop;
Z85_Encoder.Complete(Output => Buffer_String(Buffer_Index..Buffer_String'Last),
Output_Length => Buffer_Used);
Buffer_Index := Buffer_Index + Buffer_Used;
Assert(Buffer_String(1..Buffer_Index-1) = Z85_Encoded,
"Z85 Encoder on test vector gave the wrong result when used " &
"character-by-character");
end;
declare
Z85_Decoder : Z85.Base85_To_Bin;
Buffer_Bin: Storage_Array(1..12);
Buffer_Index : Storage_Offset := 1;
Buffer_Used : Storage_Offset := 0;
begin
Z85_Decoder.Reset;
for I of Z85_Encoded loop
Z85_Decoder.Process(Input => I,
Output => Buffer_Bin(Buffer_Index..Buffer_Bin'Last),
Output_Length => Buffer_Used);
Buffer_Index := Buffer_Index + Buffer_Used;
end loop;
Z85_Decoder.Complete(Output => Buffer_Bin(Buffer_Index..Buffer_Bin'Last),
Output_Length => Buffer_Used);
Buffer_Index := Buffer_Index + Buffer_Used;
Assert(Buffer_Bin(1..Buffer_Index-1) = Z85_Test_Vector,
"Z85 Decoder on test vector gave the wrong result when used " &
"byte-by-byte");
end;
end Check_Z85_Test_Vector_By_Char;
------------------------------
-- Check_Z85_Junk_Rejection --
------------------------------
procedure Should_Raise_Exception_From_Junk is
Discard : Storage_Array(1..8);
begin
Discard := Z85.To_Bin("Hel\oWorld");
end;
procedure Check_Z85_Junk_Rejection (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
Z85_Decoder : Z85.Base85_To_Bin;
Buffer_Bin: Storage_Array(1..12);
Buffer_Used : Storage_Offset := 0;
begin
Assert_Exception(Should_Raise_Exception_From_Junk'Access,
"Z85 decoder did not reject junk input.");
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "Hel\oWorld",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Failed,
"Z85 decoder failed to reject junk input");
begin
Z85_Decoder.Complete(Output => Buffer_Bin,
Output_Length => Buffer_Used
);
exception
when Ada.Assertions.Assertion_Error =>
null; -- Preconditions (if active) will not allow Completed to be run
-- on a codec with state /= Ready.
end;
Assert(Z85_Decoder.State = Failed,
"Z85 decoder in failed state was reset by the Complete routine");
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "Hel",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Ready,
"Z85 decoder rejecting valid input");
Z85_Decoder.Process(Input => "\oWorld",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Failed,
"Z85 decoder failed to reject junk input when introduced incrementally");
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "Hel",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Ready,
"Z85 decoder rejecting valid input");
Z85_Decoder.Process(Input => '\',
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Failed,
"Z85 decoder failed to reject junk input when introduced incrementally as a character");
end Check_Z85_Junk_Rejection;
--------------------------
-- Check_Z85_High_Group --
--------------------------
procedure Check_Z85_High_Group (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
Z85_Decoder : Z85.Base85_To_Bin;
Buffer_Bin: Storage_Array(1..12);
Buffer_Used : Storage_Offset := 0;
begin
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "@####",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Ready,
"Z85 decoder rejected @#### which is a valid group");
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "%####",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Failed,
"Z85 decoder failed to reject %#### which is a valid group (more than 2**32)");
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "%nSc0",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Ready,
"Z85 decoder rejected @nSb0 which is the highest valid group");
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "%nSc1",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Failed,
"Z85 decoder failed to reject @nSb1 which is the lowest invalid group");
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "%nSc",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Z85_Decoder.Process(Input => '0',
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Ready,
"Z85 decoder rejected @nSb0 which is the highest valid group " &
"when the last character was presented separately");
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "%nSc",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Z85_Decoder.Process(Input => '1',
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Failed,
"Z85 decoder failed to reject @nSb1 which is the lowest invalid group " &
"when the last character was presented separately");
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "%nSb",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Ready,
"Z85 decoder rejected %nSb which could be the start of a valid group");
Z85_Decoder.Complete(Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Complete,
"Z85 decoder rejected %nSb at the end of input which is a valid group");
Assert(Buffer_Used = 3,
"Z85 decoder returned wrong length from %nSb at the end of input " &
"(three FF bytes");
Assert(Buffer_Bin(1..3) = (16#FF#, 16#FF#, 16#FF#),
"Z85 decoder did not correctly decode %nSb at the end of input " &
"(three FF bytes");
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "%nSc",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Ready,
"Z85 decoder rejected %nSc which could be the start of a valid group");
Z85_Decoder.Complete(Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Failed,
"Z85 decoder did not reject %nSc at the end of input which is a invalid group");
end Check_Z85_High_Group;
--------------------------------
-- Check_Z85_Length_Rejection --
--------------------------------
procedure Should_Raise_Exception_From_Length is
Discard : Storage_Array(1..8);
begin
Discard := Z85.To_Bin("HelloW");
end;
procedure Check_Z85_Length_Rejection (T : in out Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
Z85_Decoder : Z85.Base85_To_Bin;
Buffer_Bin: Storage_Array(1..12);
Buffer_Used : Storage_Offset := 0;
begin
Assert_Exception(Should_Raise_Exception_From_Length'Access,
"Z85 decoder did not reject impossible 6-character input.");
Z85_Decoder.Reset;
Z85_Decoder.Process(Input => "HelloW",
Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Ready,
"Z85 decoder rejected 6-character input too early");
Z85_Decoder.Complete(Output => Buffer_Bin,
Output_Length => Buffer_Used
);
Assert(Z85_Decoder.State = Failed,
"Z85 decoder failed to reject an impossible final input of 1 character");
end Check_Z85_Length_Rejection;
end BinToAsc_Suite.Base85_Tests;
|
nasmfunc.asm
|
TakumiHANAUE/os30days
| 0 |
29872
|
<gh_stars>0
; nasmfunc
; TAB=4
BITS 32 ; 32ビットモード用の機械語を作らせる
; オブジェクトファイルのための情報
; このプログラムに含まれる関数名
GLOBAL io_hlt, io_cli, io_sti, io_stihlt
GLOBAL io_in8, io_in16, io_in32
GLOBAL io_out8, io_out16, io_out32
GLOBAL io_load_eflags, io_store_eflags
GLOBAL load_gdtr, load_idtr
GLOBAL load_cr0, store_cr0
GLOBAL asm_inthandler20, asm_inthandler21
GLOBAL asm_inthandler27, asm_inthandler2c
GLOBAL memtest_sub
EXTERN inthandler20, inthandler21
EXTERN inthandler27, inthandler2c
; 以下は実際の関数
SECTION .text
io_hlt: ; void io_hlt(void)
HLT
RET
io_cli: ; void io_cli(void)
CLI
RET
io_sti: ; void io_sti(void)
STI
RET
io_stihlt: ; void io_stihlt(void)
STI
HLT
RET
io_in8: ; int io_in8(int port)
MOV EDX, [ESP+4] ; port
MOV EAX, 0
IN AL, DX
RET
io_in16: ; int io_in16(int port)
MOV EDX, [ESP+4] ; port
MOV EAX, 0
IN AX, DX
RET
io_in32: ; int io_in32(int port)
MOV EDX, [ESP+4] ; port
IN EAX, DX
RET
io_out8: ; void io_out8(int port, int data)
MOV EDX, [ESP+4] ; port
MOV AL, [ESP+8] ; data
OUT DX, AL
RET
io_out16: ; void io_out16(int port, int data)
MOV EDX, [ESP+4] ; port
MOV EAX, [ESP+8] ; data
OUT DX, AX
RET
io_out32: ; void io_out32(int port, int data)
MOV EDX, [ESP+4] ; port
MOV EAX, [ESP+8] ; data
OUT DX, EAX
RET
io_load_eflags: ; int io_load_eflags(void)
PUSHFD ; PUSH EFLAGS の意味
POP EAX
RET
io_store_eflags: ; void io_store_eflags(int eflags)
MOV EAX, [ESP+4]
PUSH EAX
POPFD ; POP EFLAGS の意味
RET
load_gdtr: ; void load_gdtr(int limit, int addr);
MOV AX, [ESP+4] ; limit
MOV [ESP+6], AX
LGDT [ESP+6]
RET
load_idtr: ; void load_idtr(int limit, int addr);
MOV AX, [ESP+4] ; limit
MOV [ESP+6], AX
LIDT [ESP+6]
RET
load_cr0: ; int load_cr0(void);
MOV EAX, CR0
RET
store_cr0: ; void store_cr0(int cr0);
MOV EAX, [ESP+4]
MOV CR0, EAX
RET
asm_inthandler20:
PUSH ES
PUSH DS
PUSHAD
MOV EAX, ESP
PUSH EAX
MOV AX, SS
MOV DS, AX
MOV ES, AX
CALL inthandler20
POP EAX
POPAD
POP DS
POP ES
IRETD
asm_inthandler21:
PUSH ES
PUSH DS
PUSHAD
MOV EAX, ESP
PUSH EAX
MOV AX, SS
MOV DS, AX
MOV ES, AX
CALL inthandler21
POP EAX
POPAD
POP DS
POP ES
IRETD
asm_inthandler27:
PUSH ES
PUSH DS
PUSHAD
MOV EAX, ESP
PUSH EAX
MOV AX, SS
MOV DS, AX
MOV ES, AX
CALL inthandler27
POP EAX
POPAD
POP DS
POP ES
IRETD
asm_inthandler2c:
PUSH ES
PUSH DS
PUSHAD
MOV EAX, ESP
PUSH EAX
MOV AX, SS
MOV DS, AX
MOV ES, AX
CALL inthandler2c
POP EAX
POPAD
POP DS
POP ES
IRETD
memtest_sub: ; unsigned int memtest_sub(unsigned int start, unsigned int end)
PUSH EDI ; (EBX, ESI, EDI も使いたいので)
PUSH ESI
PUSH EBX
MOV ESI, 0xaa55aa55 ; pat0 = 0xaa55aa55;
MOV EDI, 0x55aa55aa ; pat1 = 0x55aa55aa;
MOV EAX, [ESP+12+4] ; i = start
mts_loop:
MOV EBX, EAX
ADD EBX, 0xffc ; p = i + 0xffc;
MOV EDX, [EBX] ; old = *p;
MOV [EBX], ESI ; *p = pat0;
XOR DWORD [EBX], 0xffffffff ; *p ^= 0xffffffff;
CMP EDI, [EBX] ; if (*p != pat1) goto fin;
JNE mts_fin
XOR DWORD [EBX], 0xffffffff ; *p ^= 0xffffffff;
CMP ESI, [EBX] ; if (*p != pat0) goto fin;
JNE mts_fin
MOV [EBX], EDX ; *p = old;
ADD EAX, 0x1000 ; i += 0x1000;
CMP EAX, [ESP+12+8] ; if (i <= end) goto mts_loop;
JBE mts_loop
POP EBX
POP ESI
POP EDI
RET
mts_fin:
MOV [EBX], EDX ; *p = old;
POP EBX
POP ESI
POP EDI
RET
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_550.asm
|
ljhsiun2/medusa
| 9 |
18068
|
<reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %rdi
push %rsi
lea addresses_WT_ht+0x4743, %rdi
nop
nop
nop
nop
add %rsi, %rsi
mov (%rdi), %r13
add %rsi, %rsi
pop %rsi
pop %rdi
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r15
push %rbp
push %rdi
push %rsi
// Store
lea addresses_WC+0x14ab6, %rdi
nop
nop
add %r10, %r10
movb $0x51, (%rdi)
cmp %rdi, %rdi
// Store
lea addresses_RW+0x6ed2, %r15
nop
nop
nop
nop
nop
sub %r12, %r12
mov $0x5152535455565758, %rdi
movq %rdi, %xmm2
vmovups %ymm2, (%r15)
// Exception!!!
nop
nop
nop
nop
mov (0), %rsi
cmp %r13, %r13
// Load
lea addresses_A+0x1d1d6, %rbp
xor %r15, %r15
mov (%rbp), %esi
add %r10, %r10
// Faulty Load
lea addresses_WT+0xdab6, %r12
clflush (%r12)
nop
nop
nop
add $65354, %r15
vmovups (%r12), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %rsi
lea oracles, %r13
and $0xff, %rsi
shlq $12, %rsi
mov (%r13,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rbp
pop %r15
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 9, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
Cats/Category/Fun/Facts.agda
|
alessio-b-zak/cats
| 0 |
2121
|
<reponame>alessio-b-zak/cats
module Cats.Category.Fun.Facts where
open import Cats.Category
open import Cats.Category.Cat using (_≈_)
open import Cats.Category.Fun using (Trans ; Fun ; ≈-intro ; ≈-elim)
open import Cats.Functor using (Functor)
open import Cats.Trans.Iso using (NatIso ; iso ; forth-natural ; back-natural)
open import Level using (_⊔_)
open Functor
open Trans
open Category._≅_
module _ {lo la l≈ lo′ la′ l≈′}
{C : Category lo la l≈}
{D : Category lo′ la′ l≈′}
{F G : Functor C D}
where
private
module C = Category C
module D = Category D
open D.≈-Reasoning
open Category (Fun C D) using (_≅_)
NatIso→≅ : NatIso F G → F ≅ G
NatIso→≅ i = record
{ forth = Forth i
; back = Back i
; back-forth = ≈-intro (back-forth (iso i))
; forth-back = ≈-intro (forth-back (iso i))
}
where
open NatIso
≅→NatIso : F ≅ G → NatIso F G
≅→NatIso i = record
{ iso = λ {c} → record
{ forth = component (forth i) c
; back = component (back i) c
; back-forth = ≈-elim (back-forth i)
; forth-back = ≈-elim (forth-back i)
}
; forth-natural = natural (forth i)
}
≈→≅ : F ≈ G → F ≅ G
≈→≅ eq = NatIso→≅ eq
≅→≈ : F ≅ G → F ≈ G
≅→≈ i = ≅→NatIso i
|
test/Succeed/GeneralizeWithPatternLambda.agda
|
shlevy/agda
| 1,989 |
76
|
<filename>test/Succeed/GeneralizeWithPatternLambda.agda<gh_stars>1000+
open import Agda.Primitive
open import Agda.Builtin.Nat
open import Agda.Builtin.Equality
variable
ℓ : Level
A : Set ℓ
n : Nat
infixr 4 _∷_
data Vec (A : Set) : Nat → Set where
[] : Vec A 0
_∷_ : A → Vec A n → Vec A (suc n)
variable
xs : Vec A n
data T (n : Nat) (f : Nat → Nat) : Set where
it : T n f
appT : ∀ {f} → T n f → Nat
appT {n = n} {f = f} it = f n
length : Vec A n → Nat
length {n = n} _ = n
-- This should not break.
bar : (xs : Vec Nat n) → T n λ { m → m + length xs }
bar xs = it
ys : Vec Nat 5
ys = 1 ∷ 2 ∷ 3 ∷ 4 ∷ 5 ∷ []
-- Check that it doesn't
no-fail : appT (bar ys) ≡ 10
no-fail = refl
|
puzzle_23/src/puzzle_23.adb
|
AdaForge/Advent_of_Code_2020
| 0 |
15025
|
<filename>puzzle_23/src/puzzle_23.adb
procedure Puzzle_23 is
begin
null;
end Puzzle_23;
|
programs/oeis/178/A178977.asm
|
karttu/loda
| 1 |
81009
|
; A178977: (3*n+2)*(3*n+5)/2.
; 5,20,44,77,119,170,230,299,377,464,560,665,779,902,1034,1175,1325,1484,1652,1829,2015,2210,2414,2627,2849,3080,3320,3569,3827,4094,4370,4655,4949,5252,5564,5885,6215,6554,6902,7259,7625,8000,8384,8777,9179,9590,10010,10439,10877,11324,11780,12245,12719,13202,13694,14195,14705,15224,15752,16289,16835,17390,17954,18527,19109,19700,20300,20909,21527,22154,22790,23435,24089,24752,25424,26105,26795,27494,28202,28919,29645,30380,31124,31877,32639,33410,34190,34979,35777,36584,37400,38225,39059,39902,40754,41615,42485,43364,44252,45149,46055,46970,47894,48827,49769,50720,51680,52649,53627,54614,55610,56615,57629,58652,59684,60725,61775,62834,63902,64979,66065,67160,68264,69377,70499,71630,72770,73919,75077,76244,77420,78605,79799,81002,82214,83435,84665,85904,87152,88409,89675,90950,92234,93527,94829,96140,97460,98789,100127,101474,102830,104195,105569,106952,108344,109745,111155,112574,114002,115439,116885,118340,119804,121277,122759,124250,125750,127259,128777,130304,131840,133385,134939,136502,138074,139655,141245,142844,144452,146069,147695,149330,150974,152627,154289,155960,157640,159329,161027,162734,164450,166175,167909,169652,171404,173165,174935,176714,178502,180299,182105,183920,185744,187577,189419,191270,193130,194999,196877,198764,200660,202565,204479,206402,208334,210275,212225,214184,216152,218129,220115,222110,224114,226127,228149,230180,232220,234269,236327,238394,240470,242555,244649,246752,248864,250985,253115,255254,257402,259559,261725,263900,266084,268277,270479,272690,274910,277139,279377,281624
mul $0,3
add $0,4
bin $0,2
sub $0,1
mov $1,$0
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce2401a.ada
|
best08618/asylo
| 7 |
7007
|
-- CE2401A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT READ (WITH AND WITHOUT PARAMETER FROM), WRITE (WITH
-- AND WITHOUT PARAMETER TO), SET_INDEX, INDEX, SIZE AND
-- END_OF_FILE ARE SUPPORTED FOR DIRECT FILES WITH ELEMENT_TYPES
-- STRING, CHARACTER, AND INTEGER.
-- APPLICABILITY CRITERIA:
-- THIS TEST IS ONLY APPLICABLE TO IMPLEMENTATIONS WHICH
-- SUPPORT DIRECT FILES.
-- HISTORY:
-- ABW 08/16/82
-- SPS 09/15/82
-- SPS 11/09/82
-- JBG 02/22/84 CHANGE TO .ADA TEST.
-- EG 05/16/85
-- TBN 11/04/86 REVISED TEST TO OUTPUT A NON_APPLICABLE
-- RESULT WHEN FILES ARE NOT SUPPORTED.
-- DWC 07/31/87 ISOLATED EXCEPTIONS.
WITH REPORT; USE REPORT;
WITH DIRECT_IO;
PROCEDURE CE2401A IS
END_SUBTEST : EXCEPTION;
BEGIN
TEST ("CE2401A" , "CHECK THAT READ, WRITE, SET_INDEX " &
"INDEX, SIZE AND END_OF_FILE ARE " &
"SUPPORTED FOR DIRECT FILES");
DECLARE
SUBTYPE STR_TYPE IS STRING (1..12);
PACKAGE DIR_STR IS NEW DIRECT_IO (STR_TYPE);
USE DIR_STR;
FILE_STR : FILE_TYPE;
BEGIN
BEGIN
CREATE (FILE_STR, INOUT_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR | NAME_ERROR =>
NOT_APPLICABLE ("USE_ERROR | NAME_ERROR RAISED " &
"ON CREATE - STRING");
RAISE END_SUBTEST;
WHEN OTHERS =>
FAILED ("UNEXPECTED ERROR RAISED ON " &
"CREATE - STRING");
RAISE END_SUBTEST;
END;
DECLARE
STR : STR_TYPE := "TEXT OF FILE";
ITEM_STR : STR_TYPE;
ONE_STR : POSITIVE_COUNT := 1;
TWO_STR : POSITIVE_COUNT := 2;
BEGIN
BEGIN
WRITE (FILE_STR,STR);
EXCEPTION
WHEN OTHERS =>
FAILED ("EXCEPTION RAISED ON WRITE FOR " &
"STRING - 1");
END;
BEGIN
WRITE (FILE_STR,STR,TWO_STR);
EXCEPTION
WHEN OTHERS =>
FAILED ("EXCEPTION RAISED ON WRITE FOR " &
"STRING - 2");
END;
BEGIN
IF SIZE (FILE_STR) /= TWO_STR THEN
FAILED ("SIZE FOR TYPE STRING");
END IF;
IF NOT END_OF_FILE (FILE_STR) THEN
FAILED ("WRONG END_OF_FILE VALUE FOR STRING");
END IF;
SET_INDEX (FILE_STR,ONE_STR);
IF INDEX (FILE_STR) /= ONE_STR THEN
FAILED ("WRONG INDEX VALUE FOR STRING");
END IF;
END;
CLOSE (FILE_STR);
BEGIN
OPEN (FILE_STR, IN_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("OPEN FOR IN_FILE MODE " &
"NOT SUPPORTED - 1");
RAISE END_SUBTEST;
END;
BEGIN
READ (FILE_STR,ITEM_STR);
IF ITEM_STR /= STR THEN
FAILED ("INCORRECT STRING VALUE READ - 1");
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("READ WITHOUT FROM FOR STRING");
END;
BEGIN
READ (FILE_STR,ITEM_STR,ONE_STR);
IF ITEM_STR /= STR THEN
FAILED ("INCORRECT STRING VALUE READ - 2");
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("READ WITH FROM FOR STRING");
END;
END;
BEGIN
DELETE (FILE_STR);
EXCEPTION
WHEN USE_ERROR =>
NULL;
END;
EXCEPTION
WHEN END_SUBTEST =>
NULL;
END;
DECLARE
PACKAGE DIR_CHR IS NEW DIRECT_IO (CHARACTER);
USE DIR_CHR;
FILE_CHR : FILE_TYPE;
BEGIN
BEGIN
CREATE (FILE_CHR, INOUT_FILE, LEGAL_FILE_NAME(2));
EXCEPTION
WHEN USE_ERROR | NAME_ERROR =>
NOT_APPLICABLE ("USE_ERROR | NAME_ERROR RAISED " &
"ON CREATE - CHARACTER");
RAISE END_SUBTEST;
WHEN OTHERS =>
FAILED ("UNEXPECTED ERROR RAISED ON " &
"CREATE - CHARACTER");
RAISE END_SUBTEST;
END;
DECLARE
CHR : CHARACTER := 'C';
ITEM_CHR : CHARACTER;
ONE_CHR : POSITIVE_COUNT := 1;
TWO_CHR : POSITIVE_COUNT := 2;
BEGIN
BEGIN
WRITE (FILE_CHR,CHR);
EXCEPTION
WHEN OTHERS =>
FAILED ("EXCEPTION RAISED ON WRITE FOR " &
"CHARACTER - 1");
END;
BEGIN
WRITE (FILE_CHR,CHR,TWO_CHR);
EXCEPTION
WHEN OTHERS =>
FAILED ("EXCEPTION RAISED ON WRITE FOR " &
"CHARACTER - 2");
END;
BEGIN
IF SIZE (FILE_CHR) /= TWO_CHR THEN
FAILED ("SIZE FOR TYPE CHARACTER");
END IF;
IF NOT END_OF_FILE (FILE_CHR) THEN
FAILED ("WRONG END_OF_FILE VALUE FOR TYPE " &
"CHARACTER");
END IF;
SET_INDEX (FILE_CHR,ONE_CHR);
IF INDEX (FILE_CHR) /= ONE_CHR THEN
FAILED ("WRONG INDEX VALUE FOR TYPE " &
"CHARACTER");
END IF;
END;
CLOSE (FILE_CHR);
BEGIN
OPEN (FILE_CHR, IN_FILE, LEGAL_FILE_NAME(2));
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("OPEN FOR IN_FILE MODE " &
"NOT SUPPORTED - 2");
RAISE END_SUBTEST;
END;
BEGIN
READ (FILE_CHR,ITEM_CHR);
IF ITEM_CHR /= CHR THEN
FAILED ("INCORRECT CHR VALUE READ - 1");
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("READ WITHOUT FROM FOR " &
"TYPE CHARACTER");
END;
BEGIN
READ (FILE_CHR,ITEM_CHR,ONE_CHR);
IF ITEM_CHR /= CHR THEN
FAILED ("INCORRECT CHR VALUE READ - 2");
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("READ WITH FROM FOR " &
"TYPE CHARACTER");
END;
END;
BEGIN
DELETE (FILE_CHR);
EXCEPTION
WHEN USE_ERROR =>
NULL;
END;
EXCEPTION
WHEN END_SUBTEST =>
NULL;
END;
DECLARE
PACKAGE DIR_INT IS NEW DIRECT_IO (INTEGER);
USE DIR_INT;
FILE_INT : FILE_TYPE;
BEGIN
BEGIN
CREATE (FILE_INT, INOUT_FILE, LEGAL_FILE_NAME(3));
EXCEPTION
WHEN USE_ERROR | NAME_ERROR =>
NOT_APPLICABLE ("USE_ERROR | NAME_ERROR RAISED " &
"ON CREATE - INTEGER");
RAISE END_SUBTEST;
WHEN OTHERS =>
FAILED ("UNEXPECTED ERROR RAISED ON " &
"CREATE - INTEGER");
RAISE END_SUBTEST;
END;
DECLARE
INT : INTEGER := IDENT_INT (33);
ITEM_INT : INTEGER;
ONE_INT : POSITIVE_COUNT := 1;
TWO_INT : POSITIVE_COUNT := 2;
BEGIN
BEGIN
WRITE (FILE_INT,INT);
EXCEPTION
WHEN OTHERS =>
FAILED ("EXCEPTION RAISED ON WRITE FOR " &
"INTEGER - 1");
END;
BEGIN
WRITE (FILE_INT,INT,TWO_INT);
EXCEPTION
WHEN OTHERS =>
FAILED ("EXCEPTION RAISED ON WRITE FOR " &
"INTEGER - 2");
END;
BEGIN
IF SIZE (FILE_INT) /= TWO_INT THEN
FAILED ("SIZE FOR TYPE INTEGER");
END IF;
IF NOT END_OF_FILE (FILE_INT) THEN
FAILED ("WRONG END_OF_FILE VALUE FOR TYPE " &
"INTEGER");
END IF;
SET_INDEX (FILE_INT, ONE_INT);
IF INDEX (FILE_INT) /= ONE_INT THEN
FAILED ("WRONG INDEX VALUE FOR TYPE INTEGER");
END IF;
END;
CLOSE (FILE_INT);
BEGIN
OPEN (FILE_INT, IN_FILE, LEGAL_FILE_NAME(3));
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("OPEN FOR IN_FILE MODE " &
"NOT SUPPORTED - 3");
RAISE END_SUBTEST;
END;
BEGIN
READ (FILE_INT,ITEM_INT);
IF ITEM_INT /= INT THEN
FAILED ("INCORRECT INT VALUE READ - 1");
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("READ WITHOUT FROM FOR " &
"TYPE INTEGER");
END;
BEGIN
READ (FILE_INT,ITEM_INT,ONE_INT);
IF ITEM_INT /= INT THEN
FAILED ("INCORRECT INT VALUE READ - 2");
END IF;
EXCEPTION
WHEN OTHERS =>
FAILED ("READ WITH FROM FOR " &
"TYPE INTEGER");
END;
END;
BEGIN
DELETE (FILE_INT);
EXCEPTION
WHEN USE_ERROR =>
NULL;
END;
EXCEPTION
WHEN END_SUBTEST =>
NULL;
END;
RESULT;
END CE2401A;
|
src/test/resources/data/potests/test17.asm
|
cpcitor/mdlz80optimizer
| 36 |
24941
|
<gh_stars>10-100
; Test case:
; - ld bc,1 should be optimized to write only c (as b is never used!)
; - ld bc,3 should be optimized
; - ld b,4; ld c,5 should be combined into one
ld bc,1
ld hl,map
ld b,2
add hl,bc
ld (hl),a
ld bc,3 ; <-- this one should be optimized out
ld hl,map
ld b,4 ; <-- these two should be combined into one
ld c,5
add hl,bc
ld (hl),a
end:
jp end
map:
db 0
|
credits_hacks.asm
|
BetaDream-X/Mother3German
| 11 |
99871
|
credits_hacks:
// ==============================================
// These hacks relocate the credits structs to 203FC00.
// ==============================================
.address_check1:
push {r1,lr}
ldr r1,[sp,#0x18]
ldr r0,=#0x801C1F5
cmp r0,r1
pop {r1}
bne +
// Credits
ldr r0,=#0x203FC00
// Copy of the 2519C function
push {r4,r5}
mov r5,r0
mov r1,#0xD8
lsl r1,r1,#1
add r3,r5,r1
ldrb r2,[r3,#0]
mov r4,#2
neg r4,r4
mov r1,r4
and r1,r2
strb r1,[r3,#0]
mov r12,r5
mov r5,#0
-
mov r3,r12
add r3,#0x32
ldrb r1,[r3,#0]
mov r2,r4
and r2,r1
strb r2,[r3,#0]
add r1,r5,#1
lsl r1,r1,#0x10
lsr r5,r1,#0x10
mov r1,#0x36
add r12,r1
cmp r5,#7
bls -
pop {r4,r5,pc}
+
// Non-credits
ldr r0,=#0x201B574
bl $802519C
pop {pc}
// ==============================================
// The following hacks fix the ldrb/strb ranges.
// There are certain lines that were changed that
// are now out of range due to the letter expansion.
// ==============================================
define val1 0x2E
.range_fix1:
push {lr}
add r4,#{val1}
ldrb r1,[r4,#0]
sub r4,#{val1}
mov r0,#1 // clobbered code
pop {pc}
.range_fix2:
push {lr}
add r4,#{val1}
ldrb r1,[r4,#0]
sub r4,#{val1}
mov r0,#2 // clobbered code
pop {pc}
.range_fix3:
push {lr}
add r4,#{val1}
ldrb r0,[r4,#0]
and r0,r7
strb r0,[r4,#0]
sub r4,#{val1}
pop {pc}
// ==============================================
// This hack delimits named characters to 8 letters.
// ==============================================
.name_fix:
push {r0,lr}
mov r2,#0x28
bl check_name
cmp r0,#0
beq +
lsl r2,r0,#1 // need length in bytes, not letters
+
mov r1,r4 // clobbered code
pop {r0,pc}
// ==============================================
// This hack takes care of all the pre-welding workarounds in
// the credits text.
// ==============================================
.preweld1:
push {r0-r4,lr}
// Get the name index & increase it
ldr r0,=#0x203FFF6
ldrb r1,[r0,#0]
mov r3,r1 // back up the ID
add r1,#1
strb r1,[r0,#0] // We increase it right away so that future code is able to tell when credits are rolling
sub r0,r1,#1
// Get the table address
ldr r1,=#0x9FB0000
lsl r0,r0,#3
add r1,r1,r0
// Check the header
ldrh r0,[r1,#0]
cmp r0,#0
beq .custom
// Preweld mode
// Get the tile start
ldrh r0,[r1,#2]
// Get the tile length
ldrh r2,[r1,#4]
// Write values from tile_start to (tile_start + tile_length - 1) at r4
-
strh r0,[r4,#0]
add r4,#2
add r0,#1
sub r2,#1
cmp r2,#0
bne -
// Write the X coord
cmp r3,#0x2C // Item Guy
bne +
ldrh r0,[r1,#6] // absolute position
strh r0,[r5,#0]
pop {r0-r4,pc}
+
ldrh r0,[r5,#0] // center of string
ldrh r2,[r1,#6] // width, in pixels
lsr r2,r2,#1
sub r0,r0,r2 // X = center - (width / 2)
strh r0,[r5,#0]
// Done
pop {r0-r4,pc}
.custom:
// Custom mode
// Check if we already did the FF23 crap
ldrh r0,[r7,#0]
push {r1}
ldr r1,=#0xFF23
cmp r0,r1
pop {r1}
beq +
// Copy the string into the 203FC00 struct
ldr r0,[r1,#4] // get the custom address
add sp,#4
pop {r1-r4}
bl $8001B18 // clobbered code/transfer the string
b .jump1
+
pop {r0-r4}
.jump1:
// Calculate the X coord
mov r1,r5
add r1,#0x2C
mov r0,r4
bl get_string_width
lsl r0,r0,#0x10
lsr r0,r0,#0x11
ldrh r1,[r5,#0]
sub r1,r1,r0
strh r1,[r5,#0] // X = center - (width / 2)
// Done
pop {pc}
|
oeis/047/A047750.asm
|
neoneye/loda-programs
| 11 |
16021
|
<filename>oeis/047/A047750.asm
; A047750: If n mod 2 = 0 then m := n/2 and a(n) = (3*m)!*(5*m+1)/((m+1)!*(2*m+1)!); otherwise m := (n-1)/2, a(n) = 6*(3*m+2)!/(m!*(2*m+3)!).
; Submitted by <NAME>
; 1,2,3,6,11,24,48,110,231,546,1183,2856,6324,15504,34884,86526,197087,493350,1134705,2861430,6633315,16829280,39268320,100134216,234930276,601661144,1418201268,3645533040,8627761528,22249511328
mov $1,$0
add $1,1
div $1,2
mov $2,$0
add $0,$1
bin $0,$2
add $1,$2
add $2,2
bin $1,$2
mul $1,4
sub $0,$1
|
programs/oeis/189/A189894.asm
|
karttu/loda
| 0 |
244623
|
; A189894: Number of isosceles right triangles on a 2nX(n+1) grid
; 4,50,208,582,1308,2556,4528,7460,11620,17310,24864,34650,47068,62552,81568,104616,132228,164970,203440,248270,300124,359700,427728,504972,592228,690326,800128,922530,1058460,1208880,1374784,1557200,1757188,1975842,2214288,2473686,2755228,3060140,3389680,3745140,4127844,4539150,4980448,5453162,5958748,6498696,7074528,7687800,8340100,9033050,9768304,10547550,11372508,12244932,13166608,14139356,15165028,16245510,17382720,18578610,19835164,21154400,22538368,23989152,25508868,27099666,28763728,30503270,32320540,34217820,36197424
mov $11,$0
mov $13,$0
add $13,1
lpb $13,1
clr $0,11
mov $0,$11
sub $13,1
sub $0,$13
mov $8,$0
mov $10,$0
add $10,1
lpb $10,1
clr $0,8
mov $0,$8
sub $10,1
sub $0,$10
mov $5,$0
mov $7,$0
add $7,1
lpb $7,1
mov $0,$5
sub $7,1
sub $0,$7
mul $0,2
mov $2,$0
pow $0,0
div $2,2
mul $2,33
lpb $0,1
sub $0,1
mov $4,2
add $4,$2
add $4,1
div $4,2
add $4,1
mov $3,$4
mul $3,2
lpe
add $6,$3
lpe
add $9,$6
lpe
add $12,$9
lpe
mov $1,$12
|
lab3_test_harness/test/state_data_in/3.asm
|
Zaydax/PipelineProcessor
| 2 |
173481
|
.ORIG x1234
XOR R1, R1, R1
XOR R2, R2, R2
XOR R3, R3, R3
XOR R4, R4, R4
XOR R5, R5, R5
.END
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1395.asm
|
ljhsiun2/medusa
| 9 |
8970
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r14
push %r15
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x13420, %r10
nop
nop
nop
sub %r15, %r15
mov (%r10), %di
and %r14, %r14
lea addresses_D_ht+0x6568, %rsi
lea addresses_WT_ht+0x19564, %rdi
nop
nop
nop
nop
sub $12273, %r15
mov $73, %rcx
rep movsb
and %r15, %r15
lea addresses_normal_ht+0x11904, %r15
nop
nop
nop
nop
xor %rdi, %rdi
mov (%r15), %ecx
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_UC_ht+0x16420, %r14
nop
and $18519, %r11
vmovups (%r14), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %rdi
nop
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_WC_ht+0xa20, %rsi
lea addresses_UC_ht+0x19c20, %rdi
nop
nop
nop
dec %r12
mov $4, %rcx
rep movsl
nop
nop
cmp %rcx, %rcx
lea addresses_normal_ht+0x9b4c, %rsi
lea addresses_normal_ht+0x14420, %rdi
nop
nop
nop
nop
sub %r14, %r14
mov $31, %rcx
rep movsq
nop
nop
nop
nop
cmp $10700, %r12
lea addresses_WC_ht+0x11020, %rsi
lea addresses_WT_ht+0x12e20, %rdi
nop
cmp %r11, %r11
mov $59, %rcx
rep movsl
nop
nop
xor %r15, %r15
lea addresses_D_ht+0x17648, %rsi
lea addresses_D_ht+0x19708, %rdi
nop
nop
sub %r14, %r14
mov $91, %rcx
rep movsw
nop
nop
nop
nop
add $2620, %r11
lea addresses_WC_ht+0x6980, %r10
clflush (%r10)
nop
nop
nop
nop
cmp $40504, %rsi
and $0xffffffffffffffc0, %r10
vmovaps (%r10), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rcx
nop
and $14261, %r10
lea addresses_normal_ht+0x1c020, %r10
nop
sub $16856, %rdi
movb (%r10), %r12b
nop
nop
nop
nop
nop
xor $20288, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r9
push %rax
push %rcx
push %rdi
// Store
lea addresses_UC+0x1420, %r11
sub $23576, %r13
mov $0x5152535455565758, %rdi
movq %rdi, (%r11)
nop
nop
nop
and $36840, %rdi
// Faulty Load
lea addresses_UC+0x1420, %r13
nop
nop
nop
nop
nop
xor $16089, %rcx
vmovups (%r13), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %r11
lea oracles, %r13
and $0xff, %r11
shlq $12, %r11
mov (%r13,%r11,1), %r11
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': True, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': True, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
oeis/136/A136675.asm
|
neoneye/loda-programs
| 11 |
2042
|
<filename>oeis/136/A136675.asm
; A136675: Numerator of Sum_{k=1..n} (-1)^(k+1)/k^3.
; Submitted by <NAME>
; 1,7,197,1549,195353,194353,66879079,533875007,14436577189,14420574181,19209787242911,19197460851911,42198121495296467,6025866788581781,6027847576222613,48209723660000029,236907853607882606477
mov $1,1
lpb $0
mov $2,$0
sub $0,1
add $2,1
pow $2,3
mul $3,$2
mul $3,-1
add $3,$1
mul $1,$2
lpe
sub $1,$3
gcd $3,$1
div $1,$3
mov $0,$1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.