max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
src/fot/FOTC/Program/SortList/CorrectnessProofATP.agda
asr/fotc
11
562
------------------------------------------------------------------------------ -- The program to sort a list is correct ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} -- This module proves the correctness of a program which sorts a list -- by converting it into an ordered tree and then back to a list -- (Burstall, 1969, p. 45). module FOTC.Program.SortList.CorrectnessProofATP where open import FOTC.Base open import FOTC.Data.Nat.List.Type open import FOTC.Program.SortList.PropertiesATP open import FOTC.Program.SortList.Properties.Totality.TreeATP open import FOTC.Program.SortList.SortList ------------------------------------------------------------------------------ -- Main theorem: The sort program generates an ordered list. postulate sortCorrect : ∀ {is} → ListN is → OrdList (sort is) {-# ATP prove sortCorrect flatten-OrdList makeTree-Tree makeTree-OrdTree #-} ------------------------------------------------------------------------------ -- References -- -- <NAME>. (1969). Proving properties of programs by -- structural induction. The Computer Journal 12.1, pp. 41–48.
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_159.asm
ljhsiun2/medusa
9
241070
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1833b, %rsi lea addresses_UC_ht+0x19b80, %rdi cmp $11519, %r12 mov $59, %rcx rep movsb nop nop nop nop dec %rdi lea addresses_A_ht+0x17dbb, %r10 nop nop nop nop nop add $62342, %rsi movw $0x6162, (%r10) nop cmp %rax, %rax lea addresses_WC_ht+0x56bb, %r12 nop nop and %rdi, %rdi mov (%r12), %si nop add %rdi, %rdi lea addresses_UC_ht+0x1daa1, %r10 nop nop nop dec %rbp movb $0x61, (%r10) xor %rcx, %rcx lea addresses_normal_ht+0x11efb, %r10 nop nop inc %rdi mov $0x6162636465666768, %r12 movq %r12, %xmm1 movups %xmm1, (%r10) nop nop and %rbp, %rbp lea addresses_WT_ht+0xc3b, %rsi nop nop nop add %rdi, %rdi mov $0x6162636465666768, %r10 movq %r10, %xmm0 and $0xffffffffffffffc0, %rsi vmovntdq %ymm0, (%rsi) nop add %rax, %rax lea addresses_D_ht+0x7ebb, %rdi inc %r10 movb $0x61, (%rdi) and $44874, %r12 lea addresses_WC_ht+0x13cbb, %rax nop nop sub %rcx, %rcx mov $0x6162636465666768, %rbp movq %rbp, %xmm2 vmovups %ymm2, (%rax) nop nop nop sub %rax, %rax lea addresses_WT_ht+0xc56b, %rsi lea addresses_WT_ht+0xf2b1, %rdi nop nop and %rax, %rax mov $104, %rcx rep movsq nop xor $58381, %rax lea addresses_WT_ht+0x14d73, %rcx nop nop nop cmp $62784, %r10 mov $0x6162636465666768, %r12 movq %r12, %xmm1 and $0xffffffffffffffc0, %rcx movaps %xmm1, (%rcx) nop cmp %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r14 push %rcx push %rdi push %rdx push %rsi // Store lea addresses_A+0x1b893, %r10 nop and %rdx, %rdx mov $0x5152535455565758, %r12 movq %r12, %xmm5 movups %xmm5, (%r10) and %rsi, %rsi // Faulty Load lea addresses_WC+0x56bb, %r14 nop nop nop cmp %rcx, %rcx movb (%r14), %r12b lea oracles, %rdi and $0xff, %r12 shlq $12, %r12 mov (%rdi,%r12,1), %r12 pop %rsi pop %rdx pop %rdi pop %rcx pop %r14 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}} [Faulty Load] {'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 8}} {'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 1}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 9}} {'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 16, 'NT': False, 'same': True, 'congruent': 3}} {'38': 21829} 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 */
hammerspoon/togglevpn.applescript
johnnyt/dotfiles
0
1310
tell application "Viscosity" if the state of the first connection is not "Disconnected" then disconnect the first connection else connect the first connection end if end tell
programs/oeis/169/A169601.asm
neoneye/loda
22
101266
; A169601: a(n) = (10^n-1)^2 + 2. ; 2,83,9803,998003,99980003,9999800003,999998000003,99999980000003,9999999800000003,999999998000000003,99999999980000000003,9999999999800000000003,999999999998000000000003 mov $1,10 pow $1,$0 sub $1,1 pow $1,2 add $1,2 mov $0,$1
models/tests/test65c.als
transclosure/Amalgam
4
2729
<filename>models/tests/test65c.als module tests/test open util/ordering[Time] as tord open util/ordering[unrolls] as uord sig Time { } let dynamic[x] = x one-> Time let dynamicSet[x] = x -> Time let then [a, b, t, t'] { some x:Time | a[t,x] && b[x,t'] } sig unrolls {} let while [cond, body, t, t'] { some time: unrolls ->one Time { first.time = t last.time = t' !cond[t'] all u: unrolls - last | let t1 = u.time, t2 = (u.next).time | (cond[t1] => body[t1,t2] else t1 =t2) } } /* * Defines 2 locations that Farmer, Fox, Chicken, and Grain can be at: Near or Far */ abstract sig Place { } one sig Near, Far extends Place { } /* * The farmer and all his possessions will be represented as Objects. */ abstract sig Object { location: dynamic[Place] } one sig Farmer, Fox, Chicken, Grain extends Object {} /* * Define what eats what when the Farmer' not around. * Fox eats the chicken and the chicken eats the grain. */ pred eats [a, b: Object] { a->b in Fox->Chicken + Chicken->Grain } /* * This represents one move by the farmer; the farmer may bring at most one other object. * Also constrains that the move is only legal if nothing would get eaten as a result. */ pred crossRiver [t, t': Time] { t' = t.next some x:Object | { x.location.t != x.location.t' x!=Farmer => (x.location.t=Farmer.location.t && x.location.t'=Farmer.location.t') all y:Object-Farmer-x | y.location.t = y.location.t' } no p, q: Object | p.eats[q] && p.location.t'=q.location.t' && p.location.t'!=Farmer.location.t' } /* * The loop condition */ let notdone[t] = (Object.location.t != Far) /* * the farmer moves everything to the far side of the river. */ run { some t:Time | Object.location.first=Near && while[notdone, crossRiver, tord/first, t] } for 8 unrolls, 8 Time expect 1
src/compiling/ANTLR/grammar/GeneratedInstantiation.g4
jecassis/VSCode-SystemVerilog
75
943
grammar GeneratedInstantiation; import UDPDeclaration; generate_region : 'generate' ( generate_item )* 'endgenerate'; loop_generate_construct : 'for' '(' genvar_initialization ';' genvar_expression ';' genvar_iteration ')' generate_block ; genvar_initialization : ( 'genvar' )? genvar_identifier '=' constant_expression ; genvar_iteration : genvar_identifier assignment_operator genvar_expression | inc_or_dec_operator genvar_identifier | genvar_identifier inc_or_dec_operator ; conditional_generate_construct : if_generate_construct | case_generate_construct ; if_generate_construct : 'if' '(' constant_expression ')' generate_block ( 'else' generate_block )? ; case_generate_construct : 'case' '(' constant_expression ')' case_generate_item ( case_generate_item )* 'endcase' ; case_generate_item : constant_expression ( ',' constant_expression )* ':' generate_block | 'default' ( ':' )? generate_block ; generate_block : generate_item | ( generate_block_identifier ':' )? 'begin' ( ':' generate_block_identifier )? ( generate_item )* 'end' ( ':' generate_block_identifier )? ; generate_item : module_or_generate_item | interface_or_generate_item | checker_or_generate_item ;
gyak/gyak1-2/factorial.adb
balintsoos/LearnAda
0
21094
<gh_stars>0 with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Text_IO; use Ada.Text_IO; with Mat; -- use Mat; procedure factorial is N : Natural; begin Get( N ); Put( Mat.factorial(N) ); end factorial;
compiler_src/Dart.g4
hericles-koelher/dart-compiler-ANTLR
0
2853
<gh_stars>0 grammar Dart; @parser::header{ import java.util.Stack; } @parser::members{ // Mantém um registro para que seja possivel determinar // quando devemos tratar await e yield como palavras reservadas // ou como identificadores. private Stack<Boolean> awaitAndYieldAreKeywords = new Stack<Boolean>(); {awaitAndYieldAreKeywords.push(false);} void startAsyncFunction(){awaitAndYieldAreKeywords.push(true);} void startNonAsyncFunction(){awaitAndYieldAreKeywords.push(false);} void endFunction(){awaitAndYieldAreKeywords.pop();} boolean areKeywords(int tokenId){ if(tokenId == AWAIT || tokenId == YIELD){ return awaitAndYieldAreKeywords.peek(); } return false; } } start: topLevelDefinition* EOF; // ------------------------------- Grammar Rules ------------------------------- // Chapter 8 - Variables declaredIdentifier: COVARIANT? finalConstVarOrType identifier ; finalConstVarOrType: LATE? FINAL type? | CONST type? | LATE? varOrType ; finalVarOrType: FINAL type? | varOrType ; varOrType: VAR | type ; initializedVariableDeclaration: declaredIdentifier ('=' expression)? (',' initializedIdentifier)* ; initializedIdentifier: identifier ('=' expression)? ; initializedIdentifierList: initializedIdentifier (',' initializedIdentifier)* ; // Chapter 9 - Functions functionSignature: metadata type? identifierNotFUNCTION formalParameterPart ; formalParameterPart: typeParameters? formalParameterList ; functionBody: '=>' {startNonAsyncFunction();} expression {endFunction();} ';' | ASYNC '=>' {startAsyncFunction();} expression {endFunction();} ';' | (ASYNC | ASYNC '*' | SYNC '*') {startAsyncFunction();} block {endFunction();} | {startNonAsyncFunction();} block {endFunction();} ; block: LBRACE statements RBRACE ; // Chapter 9.2 - Formal Parameters formalParameterList: '(' ')' | '(' normalFormalParameters ','? ')' | '(' normalFormalParameters ',' optionalOrNamedFormalParameters ')' | '(' optionalOrNamedFormalParameters ')' ; normalFormalParameters: normalFormalParameter (',' normalFormalParameter)* ; optionalOrNamedFormalParameters: optionalPositionalFormalParameters | namedFormalParameters ; optionalPositionalFormalParameters: '[' defaultFormalParameter (',' defaultFormalParameter)* ','? ']' ; namedFormalParameters: LBRACE defaultNamedParameter (',' defaultNamedParameter)* ','? RBRACE ; // Chapter 9.2.1 - Required Formals // "Simplifiquei" a regra do manual. normalFormalParameter: metadata functionFormalParameter | metadata fieldFormalParameter | metadata simpleFormalParameter ; functionFormalParameter: COVARIANT? type? identifierNotFUNCTION formalParameterPart '?'? ; simpleFormalParameter: declaredIdentifier | COVARIANT? identifier ; fieldFormalParameter: finalConstVarOrType? THIS '.' identifier (formalParameterPart '?'?)? ; defaultFormalParameter: normalFormalParameter ('=' expression)? ; defaultNamedParameter: REQUIRED? normalFormalParameter ((':' | '=') expression)? ; typeWithParameters: typeIdentifier typeParameters? ; // Chapter 10 - Classes // Modifiquei a regra (em relação ao SDK) para que ficasse como a do manual. classDeclaration: metadata ABSTRACT? CLASS typeWithParameters superclass? mixins? interfaces? LBRACE (metadata classMemberDefinition)* RBRACE | metadata ABSTRACT? CLASS mixinApplicationClass ; classMemberDefinition: methodSignature functionBody | declaration ';' ; methodSignature: constructorSignature initializers | factoryConstructorSignature | STATIC? functionSignature | STATIC? getterSignature | STATIC? setterSignature | operatorSignature | constructorSignature ; declaration: EXTERNAL factoryConstructorSignature | EXTERNAL constantConstructorSignature | EXTERNAL constructorSignature | (EXTERNAL STATIC?)? getterSignature | (EXTERNAL STATIC?)? setterSignature | (EXTERNAL STATIC?)? functionSignature | EXTERNAL (STATIC? finalVarOrType | COVARIANT varOrType) identifierList | ABSTRACT (finalVarOrType | COVARIANT varOrType) identifierList | EXTERNAL? operatorSignature | STATIC (FINAL | CONST) type? staticFinalDeclarationList | STATIC LATE FINAL type? initializedIdentifierList | (STATIC | COVARIANT) LATE? varOrType initializedIdentifierList | LATE? (FINAL type? | varOrType) initializedIdentifierList | redirectingFactoryConstructorSignature | constantConstructorSignature (redirection | initializers)? | constructorSignature (redirection | initializers)? ; staticFinalDeclarationList: staticFinalDeclaration (',' staticFinalDeclaration)* ; staticFinalDeclaration: identifier '=' expression ; // Chapter 10.1.1 - Operators operatorSignature: type? OPERATOR operator formalParameterList ; operator: '~' | binaryOperator | '[' ']' | '[' ']' '=' ; binaryOperator: multiplicativeOperator | additiveOperator | shiftOperator | relationalOperator | '==' | bitwiseOperator ; // Chapter 10.2 - Getters getterSignature: type? GET identifier ; // Chapter 10.3 - Setters setterSignature: type? SET identifier formalParameterList ; // Chapter 10.6.1 - Generative Constructors constructorSignature: constructorName formalParameterList ; constructorName: typeIdentifier ('.' identifier)? ; redirection: ':' THIS ('.' identifier)? arguments ; initializers: ':' initializerListEntry (',' initializerListEntry)* ; initializerListEntry: SUPER arguments | SUPER '.' identifier arguments | fieldInitializer | assertion ; fieldInitializer: (THIS '.')? identifier '=' initializerExpression ; initializerExpression: conditionalExpression | cascade ; // Chapter 10.6.2 - Factories factoryConstructorSignature: CONST? FACTORY constructorName formalParameterList ; redirectingFactoryConstructorSignature: CONST? FACTORY constructorName formalParameterList '=' constructorDesignation ; // Chapter 10.6.3 - Constant Constructors constantConstructorSignature: CONST constructorName formalParameterList ; // Chapter 10.8 - Superclasses superclass: EXTENDS typeNotVoidNotFunction ; mixins: WITH typeNotVoidNotFunctionList ; // Chapter 10.9 - Superinterfaces interfaces: IMPLEMENTS typeNotVoidNotFunctionList ; // Chapter 12.1 - Mixin Classes mixinApplicationClass: typeWithParameters '=' mixinApplication ';' ; mixinApplication: typeNotVoidNotFunction mixins interfaces? ; // Chapter 12.2 - Mixin Declaration mixinDeclaration: MIXIN typeIdentifier typeParameters? (ON typeNotVoidNotFunctionList)? interfaces? LBRACE (metadata classMemberDefinition)* RBRACE ; // Chapter 13 - Enums enumType: ENUM typeIdentifier LBRACE enumEntry (',' enumEntry)* (',')? RBRACE ; // Chapter 14 - Generics typeParameter: metadata typeIdentifier (EXTENDS typeNotVoid)? ; typeParameters: '<' typeParameter (',' typeParameter)* '>' ; enumEntry: metadata identifier ; // Chapter 15 - Metadata metadata: ('@' metadatum)* ; metadatum: constructorDesignation arguments | identifier | qualifiedName ; // Chapter 16 - Expressions expression: functionExpression | throwExpression | assignableExpression assignmentOperator expression | conditionalExpression // Essa parte tbm identifica o lado direito de uma atribuição, chamada de funções... | cascade ; expressionWithoutCascade: functionExpressionWithoutCascade | throwExpressionWithoutCascade | assignableExpression assignmentOperator expressionWithoutCascade | conditionalExpression ; expressionList: expression (',' expression)* ; primary: thisExpression | SUPER unconditionalAssignableSelector | constObjectExpression | newExpression | constructorInvocation | functionPrimary | '(' expression ')' | literal | identifier ; // Chapter 16.3 - Constants literal: nullLiteral | booleanLiteral | numericLiteral | stringLiteral | symbolLiteral | setOrMapLiteral | listLiteral ; // Chapter 16.4 - Null nullLiteral: NULL ; // Chapter 16.5 - Numbers numericLiteral: NUMBER | HEX_NUMBER ; // Chapter 16.6 - Booleans booleanLiteral: TRUE | FALSE ; // Chapter 16.7 - Strings stringLiteral: singleLineString+ // | multiLineString+ ; // Chapter 16.8 - Symbols symbolLiteral: '#' (operator | (identifier ('.' identifier)*)) ; // Chapter 16.9 - Lists listLiteral: CONST? typeArguments? '[' elements? ']' ; // Chapter 16.10 - Maps // Maps & Sets são tratados da mesma maneira no SDK :| setOrMapLiteral: CONST? typeArguments? LBRACE elements? RBRACE ; elements: element (',' element)* ','? ; element: expressionElement | mapElement | spreadElement | ifElement | forElement ; expressionElement: expression ; mapElement: expression ':' expression ; spreadElement: ('...' | '...?') expression ; ifElement: IF '(' expression ')' element (ELSE element)? ; forElement: AWAIT? FOR '(' forLoopParts ')' element ; // Chapter 16.12 - Throw throwExpression: THROW expression ; throwExpressionWithoutCascade: THROW expressionWithoutCascade ; // Chapter 16.13 - Function Expressions functionExpression: formalParameterPart functionExpressionBody ; functionExpressionBody: '=>' {startNonAsyncFunction();} expression {endFunction();} | ASYNC {startAsyncFunction();} '=>' expression {endFunction();} ; functionExpressionWithoutCascade: formalParameterPart functionExpressionWithoutCascadeBody ; functionExpressionWithoutCascadeBody: '=>' {startNonAsyncFunction();} expressionWithoutCascade {endFunction();} | ASYNC '=>' {startAsyncFunction();} expressionWithoutCascade {endFunction();} ; // TODO: Qual seria um exemplo de functionPrimary? functionPrimary: formalParameterPart functionPrimaryBody ; functionPrimaryBody: {startNonAsyncFunction();} block {endFunction();} | (ASYNC | ASYNC '*' | SYNC '*') {startAsyncFunction();} block {endFunction();} ; // Chapter 16.14 - This thisExpression: THIS ; // Chapter 16.15.1 - New newExpression: NEW constructorDesignation arguments ; // Chapter 16.15.2 - Const constObjectExpression: CONST constructorDesignation arguments ; // Chapter 16.17.1 - Actual Arguments Lists arguments: '(' argumentList? ')' ; argumentList: namedArgument (',' namedArgument)* | expressionList (',' namedArgument)* ; namedArgument: label expression ; // Chapter 16.21.2 - Cascaded Invocations cascade: cascade '..' cascadeSection | conditionalExpression ('?..' | '..') cascadeSection ; cascadeSection: cascadeSelector cascadeSectionTail ; cascadeSelector: '[' expression ']' | identifier ; cascadeSectionTail: cascadeAssignment | selector* (assignableSelector cascadeAssignment)? ; cascadeAssignment: assignmentOperator expressionWithoutCascade ; // Chapter 16.23 - Assignment assignmentOperator: '=' | compoundAssignmentOperator ; compoundAssignmentOperator: '*=' | '/=' | '~/=' | '%=' | '+=' | '-=' | '<<=' | '>' '>' '>' '=' | '>' '>' '=' | '&=' | '^=' | '|=' | '??=' ; // Chapter 16.24 - Conditional conditionalExpression: ifNullExpression ('?' expressionWithoutCascade ':' expressionWithoutCascade)? ; // Chapter 16.25 - If-null Expressions ifNullExpression: logicalOrExpression ('??' logicalOrExpression)* ; // Chapter 16.26 - Logical Boolean Expressions logicalOrExpression: logicalAndExpression ('||' logicalAndExpression)* ; logicalAndExpression: equalityExpression ('&&' equalityExpression)* ; // Chapter 16.27 - Equality equalityExpression: relationalExpression (equalityOperator relationalExpression)? | SUPER equalityOperator relationalExpression ; equalityOperator: '==' | '!=' ; // Chapter 16.28 - Relational Expressions relationalExpression: bitwiseOrExpression (typeTest | typeCast | relationalOperator bitwiseOrExpression)? | SUPER relationalOperator bitwiseOrExpression ; relationalOperator: GE = '>=' | GT = '>' | LE = '<=' | LT = '<' ; // Chapter 16.29 - Bitwise Expressions bitwiseOrExpression: bitwiseXorExpression ('|' bitwiseXorExpression)* | SUPER ('|' bitwiseXorExpression)+ ; bitwiseXorExpression: bitwiseAndExpression ('^' bitwiseAndExpression)* | SUPER ('^' bitwiseAndExpression)+ ; bitwiseAndExpression: shiftExpression ('&' shiftExpression)* | SUPER ('&' shiftExpression)+ ; bitwiseOperator: '&' | '^' | '|' ; // Chapter 16.30 - Shift shiftExpression: additiveExpression (shiftOperator additiveExpression)* | SUPER (shiftOperator additiveExpression)+ ; shiftOperator: '<<' | '>' '>' '>' | '>' '>' ; // Chapter 16.31 - Additive Expressions additiveExpression: multiplicativeExpression (additiveOperator multiplicativeExpression)* | SUPER (additiveOperator multiplicativeExpression)+ ; additiveOperator: '+' | '-' ; // Chapter 16.32 - Multiplicative Expressions multiplicativeExpression: unaryExpression (multiplicativeOperator unaryExpression)* | SUPER (multiplicativeOperator unaryExpression)+ ; multiplicativeOperator: '*' | '/' | '%' | '~/' ; // Chapter 16.33 - Unary Expressions unaryExpression: prefixOperator unaryExpression | awaitExpression | postfixExpression | (minusOperator | tildeOperator) SUPER | incrementOperator assignableExpression ; prefixOperator: minusOperator | negationOperator | tildeOperator ; minusOperator: '-' ; negationOperator: '!' ; tildeOperator: '~' ; // Chapter 16.34 - Await Expressions awaitExpression: AWAIT unaryExpression ; // Chapter 16.35 - Postfix Expressions // Chamada de função passa especificamente por aqui postfixExpression: assignableExpression postfixOperator | primary selector* ; postfixOperator: incrementOperator ; constructorInvocation: typeName typeArguments '.' identifier arguments ; selector: '!' | assignableSelector | argumentPart ; argumentPart: typeArguments? arguments ; incrementOperator: '++' | '--' ; // Chapter 16.36 - Assignable Expressions assignableExpression: SUPER unconditionalAssignableSelector | primary assignableSelectorPart | identifier ; assignableSelectorPart: selector* assignableSelector ; unconditionalAssignableSelector: '[' expression ']' | '.' identifier ; assignableSelector: unconditionalAssignableSelector | '?.' identifier | '?' '[' expression ']' ; // Chapter 16.37 - Identifier Reference identifierNotFUNCTION: IDENTIFIER | ABSTRACT // Built-in identifier. | AS // Built-in identifier. | COVARIANT // Built-in identifier. | DEFERRED // Built-in identifier. | DYNAMIC // Built-in identifier. | EXPORT // Built-in identifier. | EXTERNAL // Built-in identifier. | FACTORY // Built-in identifier. | GET // Built-in identifier. | IMPLEMENTS // Built-in identifier. | IMPORT // Built-in identifier. | INTERFACE // Built-in identifier. | LATE // Built-in identifier. | LIBRARY // Built-in identifier. | MIXIN // Built-in identifier. | OPERATOR // Built-in identifier. | PART // Built-in identifier. | REQUIRED // Built-in identifier. | SET // Built-in identifier. | STATIC // Built-in identifier. | TYPEDEF // Built-in identifier. | ASYNC // Not a built-in identifier. | HIDE // Not a built-in identifier. | OF // Not a built-in identifier. | ON // Not a built-in identifier. | SHOW // Not a built-in identifier. | SYNC // Not a built-in identifier. | {!areKeywords(getCurrentToken().getType())}? (AWAIT|YIELD) ; identifier: identifierNotFUNCTION | FUNCTION // Built-in identifier that can be used as a type. ; qualifiedName: typeIdentifier '.' identifier | typeIdentifier '.' typeIdentifier '.' identifier ; typeIdentifier: IDENTIFIER | DYNAMIC // Built-in identifier that can be used as a type. | ASYNC // Not a built-in identifier. | HIDE // Not a built-in identifier. | OF // Not a built-in identifier. | ON // Not a built-in identifier. | SHOW // Not a built-in identifier. | SYNC // Not a built-in identifier. | {!areKeywords(getCurrentToken().getType())}? (AWAIT|YIELD) ; // Chapter 16.38 - Type Test typeTest: isOperator typeNotVoid ; isOperator: IS '!'? ; // Chapter 16.39 - Type Cast typeCast: asOperator typeNotVoid ; asOperator: AS ; // Chapter 17 - Statements statements: statement* ; statement: label* nonLabelledStatement ; nonLabelledStatement: block | localVariableDeclaration | forStatement | whileStatement | doStatement | switchStatement | ifStatement | rethrowStatement | tryStatement | breakStatement | continueStatement | returnStatement | localFunctionDeclaration | assertStatement | yieldStatement | yieldEachStatement | expressionStatement ; // Chapter 17.2 - Expression Statements expressionStatement: expression? ';' ; // Chapter 17.3 - Local Variable Declaration localVariableDeclaration: metadata initializedVariableDeclaration ';' ; // Chapter 17.4 - Local Function Declaration localFunctionDeclaration: metadata functionSignature functionBody ; // Chapter 17.5 - If // Aceitando somente if com chaves {} ifStatement: IF '(' expression ')' ifPart=block (ELSE elsePart=block)? ; // Chapter 17.6 - For forStatement: AWAIT? FOR '(' forLoopParts ')' statement ; forLoopParts: metadata declaredIdentifier IN expression | metadata identifier IN expression | forInitializerStatement expression? ';' expressionList? ; // The localVariableDeclaration cannot be CONST, but that can // be enforced in a later phase, and the grammar allows it. forInitializerStatement: localVariableDeclaration | expression? ';' ; // Chapter 17.7 - While whileStatement: WHILE '(' expression ')' block ; // Chapter 17.8 - Do doStatement: DO statement WHILE '(' expression ')' ';' ; // Chapter 17.9 - Switch switchStatement: SWITCH '(' expression ')' LBRACE switchCase* defaultCase? RBRACE ; switchCase: label* CASE expression ':' statements ; defaultCase: label* DEFAULT ':' statements ; // Chapter 17.10 - Rethrow rethrowStatement: RETHROW ';' ; // Chapter 17.11 - Try tryStatement: TRY block (onPart+ finallyPart? | finallyPart) ; onPart: catchPart block | ON typeNotVoid catchPart? block ; catchPart: CATCH '(' identifier (',' identifier)? ')' ; finallyPart: FINALLY block ; // Chapter 17.12 - Return returnStatement: RETURN expression? ';' ; // Chapter 17.13 - Labels label: identifier ':' ; // 17.14 - Break breakStatement: 'break' identifier? ';' ; // 17.13 - Continue continueStatement: 'continue' identifier? ';' ; // 17.16 - Yield and Yield-Each yieldStatement: 'yield' expression ';' ; yieldEachStatement: 'yield*' expression ';' ; // 17.17 Assert assertStatement: assertion ';' ; assertion: 'assert' '(' expression (',' expression )? ','? ')' ; // Chapter 18 - Libraries topLevelDefinition: classDeclaration | mixinDeclaration /*| extensionDeclaration*/ | enumType | typeAlias | EXTERNAL functionSignature ';' | EXTERNAL getterSignature ';' | EXTERNAL setterSignature ';' | EXTERNAL finalVarOrType identifierList ';' | getterSignature functionBody | setterSignature functionBody | functionSignature functionBody | (FINAL | CONST) type? staticFinalDeclarationList ';' | LATE FINAL type? initializedIdentifierList ';' | LATE? varOrType identifier ('=' expression)? (',' initializedIdentifier)* ';' ; // Chapter 18.1 - Imports identifierList: identifier (',' identifier)* ; // Chapter 19.1 - Static Types type: functionType '?'? | typeNotFunction ; typeNotVoid: functionType '?'? | typeNotVoidNotFunction ; typeNotFunction: typeNotVoidNotFunction | VOID ; typeNotVoidNotFunction: typeName typeArguments? '?'? | FUNCTION '?'? ; typeName: typeIdentifier ('.' typeIdentifier)? ; typeArguments: '<' typeList '>' ; typeList: type (',' type)* ; typeNotVoidNotFunctionList: typeNotVoidNotFunction (',' typeNotVoidNotFunction)* ; functionTypeTail: FUNCTION typeParameters? parameterTypeList ; functionTypeTails: functionTypeTail '?'? functionTypeTails | functionTypeTail ; functionType: functionTypeTails | typeNotFunction functionTypeTails ; parameterTypeList: '(' ')' | '(' normalParameterTypes ',' optionalParameterTypes ')' | '(' normalParameterTypes ','? ')' | '(' optionalParameterTypes ')' ; normalParameterTypes: normalParameterType (',' normalParameterType)* ; normalParameterType: typedIdentifier | type ; optionalParameterTypes: optionalPositionalParameterTypes | namedParameterTypes ; optionalPositionalParameterTypes: '[' normalParameterTypes ','? ']' ; namedParameterTypes: LBRACE namedParameterType (',' namedParameterType)* ','? RBRACE ; namedParameterType: REQUIRED? typedIdentifier ; typedIdentifier: type identifier ; constructorDesignation: typeIdentifier | qualifiedName | typeName typeArguments ('.' identifier)? ; //Chapter 19.3 - Type Aliases typeAlias: TYPEDEF typeIdentifier typeParameters? '=' functionType ';' | TYPEDEF functionTypeAlias ; functionTypeAlias: functionPrefix formalParameterPart ';' ; functionPrefix: type identifier | identifier ; singleLineString: RAW_SINGLE_LINE_STRING | SINGLE_LINE_STRING_SQ_BEGIN_END | SINGLE_LINE_STRING_SQ_BEGIN_MID expression (SINGLE_LINE_STRING_SQ_MID_MID expression)* SINGLE_LINE_STRING_SQ_MID_END | SINGLE_LINE_STRING_DQ_BEGIN_END | SINGLE_LINE_STRING_DQ_BEGIN_MID expression (SINGLE_LINE_STRING_DQ_MID_MID expression)* SINGLE_LINE_STRING_DQ_MID_END ; //TODO: VOLTAR COM MULTILINE STRING DEPOIS? //multiLineString // RAW_MULTI_LINE_STRING // | MULTI_LINE_STRING_SQ_BEGIN_END // | MULTI_LINE_STRING_SQ_BEGIN_MID expression (MULTI_LINE_STRING_SQ_MID_MID expression)* MULTI_LINE_STRING_SQ_MID_END // | MULTI_LINE_STRING_DQ_BEGIN_END // | MULTI_LINE_STRING_DQ_BEGIN_MID expression (MULTI_LINE_STRING_DQ_MID_MID expression)* MULTI_LINE_STRING_DQ_MID_END // ; // ------------------------------- Lexer Rules ------------------------------- fragment LETTER: 'a' .. 'z' | 'A' .. 'Z' ; fragment DIGIT: '0' .. '9' ; fragment EXPONENT: ('e' | 'E') ('+' | '-')? DIGIT+ ; fragment HEX_DIGIT: ('a' | 'b' | 'c' | 'd' | 'e' | 'f') | ('A' | 'B' | 'C' | 'D' | 'E' | 'F') | DIGIT ; // Reserved words. ASSERT: 'assert' ; BREAK: 'break' ; CASE: 'case' ; CATCH: 'catch' ; CLASS: 'class' ; CONST: 'const' ; CONTINUE: 'continue' ; DEFAULT: 'default' ; DO: 'do' ; ELSE: 'else' ; ENUM: 'enum' ; EXTENDS: 'extends' ; FALSE: 'false' ; FINAL: 'final' ; FINALLY: 'finally' ; FOR: 'for' ; IF: 'if' ; IN: 'in' ; IS: 'is' ; NEW: 'new' ; NULL: 'null' ; RETHROW: 'rethrow' ; RETURN: 'return' ; SUPER: 'super' ; SWITCH: 'switch' ; THIS: 'this' ; THROW: 'throw' ; TRUE: 'true' ; TRY: 'try' ; VAR: 'var' ; VOID: 'void' ; WHILE: 'while' ; WITH: 'with' ; // Built-in identifiers. ABSTRACT: 'abstract' ; AS: 'as' ; COVARIANT: 'covariant' ; DEFERRED: 'deferred' ; DYNAMIC: 'dynamic' ; EXPORT: 'export' ; EXTENSION: 'extension' ; EXTERNAL: 'external' ; FACTORY: 'factory' ; FUNCTION: 'Function' ; GET: 'get' ; IMPLEMENTS: 'implements' ; IMPORT: 'import' ; INTERFACE: 'interface' ; LATE: 'late' ; LIBRARY: 'library' ; OPERATOR: 'operator' ; MIXIN: 'mixin' ; PART: 'part' ; REQUIRED: 'required' ; SET: 'set' ; STATIC: 'static' ; TYPEDEF: 'typedef' ; // "Contextual keywords". AWAIT: 'await' ; YIELD: 'yield' ; // Other words used in the grammar. ASYNC: 'async' ; HIDE: 'hide' ; OF: 'of' ; ON: 'on' ; SHOW: 'show' ; SYNC: 'sync' ; // Lexical tokens that are not words. NUMBER: DIGIT+ '.' DIGIT+ EXPONENT? | DIGIT+ EXPONENT? | '.' DIGIT+ EXPONENT? ; HEX_NUMBER: '0x' HEX_DIGIT+ | '0X' HEX_DIGIT+ ; RAW_SINGLE_LINE_STRING: 'r' '\'' (~('\'' | '\r' | '\n'))* '\'' | 'r' '"' (~('"' | '\r' | '\n'))* '"' ; //RAW_MULTI_LINE_STRING: // 'r' '"""' (.)*? '"""' // | 'r' '\'\'\'' (.)*? '\'\'\'' // ; LBRACE: '{' ; RBRACE: '}' ; fragment SIMPLE_STRING_INTERPOLATION: '$' IDENTIFIER_NO_DOLLAR ; fragment ESCAPE_SEQUENCE: '\\n' | '\\r' | '\\b' | '\\t' | '\\v' | '\\x' HEX_DIGIT HEX_DIGIT | '\\u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT | '\\u{' HEX_DIGIT_SEQUENCE '}' ; fragment HEX_DIGIT_SEQUENCE: HEX_DIGIT HEX_DIGIT? HEX_DIGIT? HEX_DIGIT? HEX_DIGIT? HEX_DIGIT? ; fragment STRING_CONTENT_COMMON: ~('\\' | '\'' | '"' | '$' | '\r' | '\n') | ESCAPE_SEQUENCE | '\\' ~('n' | 'r' | 'b' | 't' | 'v' | 'x' | 'u' | '\r' | '\n') | SIMPLE_STRING_INTERPOLATION ; fragment STRING_CONTENT_SQ: STRING_CONTENT_COMMON | '"' ; SINGLE_LINE_STRING_SQ_BEGIN_END: '\'' STRING_CONTENT_SQ* '\'' ; SINGLE_LINE_STRING_SQ_BEGIN_MID: '\'' STRING_CONTENT_SQ* '${' ; SINGLE_LINE_STRING_SQ_MID_MID: '}' STRING_CONTENT_SQ* '${' ; SINGLE_LINE_STRING_SQ_MID_END: '}' STRING_CONTENT_SQ* '\'' ; fragment STRING_CONTENT_DQ: STRING_CONTENT_COMMON | '\'' ; SINGLE_LINE_STRING_DQ_BEGIN_END: '"' STRING_CONTENT_DQ* '"' ; SINGLE_LINE_STRING_DQ_BEGIN_MID: '"' STRING_CONTENT_DQ* '${' ; SINGLE_LINE_STRING_DQ_MID_MID: '}' STRING_CONTENT_DQ* '${' ; SINGLE_LINE_STRING_DQ_MID_END: '}' STRING_CONTENT_DQ* '"' ; fragment QUOTES_SQ: | '\'' | '\'\'' ; // Explicação do SDK. // Read string contents, which may be almost anything, but stop when seeing // '\'\'\'' and when seeing '${'. We do this by allowing all other // possibilities including escapes, simple interpolation, and fewer than // three '\''. fragment STRING_CONTENT_TSQ: QUOTES_SQ (STRING_CONTENT_COMMON | '"' | '\r' | '\n' | '\\\r' | '\\\n') ; //MULTI_LINE_STRING_SQ_BEGIN_END: // '\'\'\'' STRING_CONTENT_TSQ* '\'\'\'' // ; //MULTI_LINE_STRING_SQ_BEGIN_MID: // '\'\'\'' STRING_CONTENT_TSQ* QUOTES_SQ '${' // // ; //MULTI_LINE_STRING_SQ_MID_MID: // '}' STRING_CONTENT_TSQ* QUOTES_SQ '${' // // ; //MULTI_LINE_STRING_SQ_MID_END: // '}' STRING_CONTENT_TSQ* '\'\'\'' // ; fragment QUOTES_DQ: | '"' | '""' ; // Explicação do SDK. // Read string contents, which may be almost anything, but stop when seeing // '"""' and when seeing '${'. We do this by allowing all other possibilities // including escapes, simple interpolation, and fewer-than-three '"'. fragment STRING_CONTENT_TDQ: QUOTES_DQ (STRING_CONTENT_COMMON | '\'' | '\r' | '\n' | '\\\r' | '\\\n') ; //MULTI_LINE_STRING_DQ_BEGIN_END: // '"""' STRING_CONTENT_TDQ* '"""' // ; //MULTI_LINE_STRING_DQ_BEGIN_MID: // '"""' STRING_CONTENT_TDQ* QUOTES_DQ '${' // // ; //MULTI_LINE_STRING_DQ_MID_MID: // '}' STRING_CONTENT_TDQ* QUOTES_DQ '${' // // ; //MULTI_LINE_STRING_DQ_MID_END: // '}' STRING_CONTENT_TDQ* '"""' // ; fragment IDENTIFIER_START_NO_DOLLAR: LETTER | '_' ; fragment IDENTIFIER_PART_NO_DOLLAR: IDENTIFIER_START_NO_DOLLAR | DIGIT ; fragment IDENTIFIER_NO_DOLLAR: IDENTIFIER_START_NO_DOLLAR IDENTIFIER_PART_NO_DOLLAR* ; fragment IDENTIFIER_START: IDENTIFIER_START_NO_DOLLAR | '$' ; fragment IDENTIFIER_PART: IDENTIFIER_START | DIGIT ; SCRIPT_TAG: '#!' (~('\r' | '\n'))* NEWLINE ; IDENTIFIER: IDENTIFIER_START IDENTIFIER_PART* ; SINGLE_LINE_COMMENT: '//' (~('\r' | '\n'))* NEWLINE? -> skip ; MULTI_LINE_COMMENT: '/*' (MULTI_LINE_COMMENT | .)*? '*/' -> skip ; fragment NEWLINE: ('\r' | '\n' | '\r\n') ; WS: (' ' | '\t' | '\r' | '\n')+ -> skip ;
test/asm/section-sizeof-startof.asm
michealccc/rgbds
522
80289
<filename>test/asm/section-sizeof-startof.asm SECTION "sect", ROMX[$4567], BANK[$23] ds 42 W = BANK("sect") X = SIZEOF("sect") ; unknown Y = STARTOF("sect") println "sect1: {W} {X} {Y}" SECTION "sect2", ROMX W = BANK("sect") X = SIZEOF("sect") Y = STARTOF("sect") println "sect1: {W} {X} {Y}" PUSHS SECTION FRAGMENT "sect3", ROMX[$4567], BANK[$12] W = BANK("sect2") ; unknown X = SIZEOF("sect2") ; unknown Y = STARTOF("sect2") ; unknown println "sect2: {W} {X} {Y}" POPS W = BANK("sect3") X = SIZEOF("sect3") ; unknown Y = STARTOF("sect3") println "sect3: {W} {X} {Y}"
programs/oeis/151/A151780.asm
neoneye/loda
22
8565
; A151780: 5^{wt(n)-1}. ; 1,1,5,1,5,5,25,1,5,5,25,5,25,25,125,1,5,5,25,5,25,25,125,5,25,25,125,25,125,125,625,1,5,5,25,5,25,25,125,5,25,25,125,25,125,125,625,5,25,25,125,25,125,125,625,25,125,125,625,125,625,625,3125,1,5,5,25,5,25,25,125,5 seq $0,48881 ; a(n) = A000120(n+1) - 1 = wt(n+1) - 1. mov $1,5 pow $1,$0 mov $0,$1
alloy4fun_models/trashltl/models/7/J8gM5Cxvu6MYLN8tX.als
Kaixi26/org.alloytools.alloy
0
2841
<filename>alloy4fun_models/trashltl/models/7/J8gM5Cxvu6MYLN8tX.als open main pred idJ8gM5Cxvu6MYLN8tX_prop8 { all f:File| some f.link implies (eventually f+f.link in Trash) } pred __repair { idJ8gM5Cxvu6MYLN8tX_prop8 } check __repair { idJ8gM5Cxvu6MYLN8tX_prop8 <=> prop8o }
programs/oeis/040/A040710.asm
neoneye/loda
22
95032
<gh_stars>10-100 ; A040710: Continued fraction for sqrt(738). ; 27,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54,6,54 sub $0,1 mod $0,2 mul $0,11 add $0,2 pow $0,2 sub $0,2 div $0,10 mul $0,3 add $0,6
src/iat_info.asm
Shinao/Malicious
82
13280
<filename>src/iat_info.asm push esi ; Keep start section ; IAT Hooking (ExitProcess) mov [DELTA VAKernelIAT], 0 ; Check if valid cmp [DELTA OffsetIAT], 0 je doNotHook ; Get IAT mov edi, ebx ; VA IAT mov [DELTA VAIAT], ebx mov eax, [DELTA OffsetIAT] sub edi, eax mov eax, [DELTA PeFileMap] add edi, eax ; IAT ; Iterate on all IAT Modules iterateIAT: mov edx, edi add edx, 0Ch ; Dll Name mov edx, [edx] ; VA cmp edx, 0 je doNotHook mov eax, [DELTA PeFileMap] add edx, eax mov eax, [DELTA OffsetIAT] sub edx, eax ; Check if we found User32.dll push edx mov ecx, offset sKernel32 add ecx, ebp call stricmp pop edx cmp eax, 0 jne endIterateFunc ; Iterate on all Imported Functions mov edx, edi mov edx, [edx] mov eax, [DELTA PeFileMap] add edx, eax mov eax, [DELTA OffsetIAT] sub edx, eax xor esi, esi iterateFunc: mov ebx, [edx] cmp ebx, 0 je endIterateFunc mov eax, [DELTA PeFileMap] add ebx, eax mov eax, [DELTA OffsetIAT] sub ebx, eax add ebx, 2 ; TODO - WHY !? (Cardinal:Hint) ; Check if we found ExitProcess push edx push ecx mov ecx, offset sExitProcess add ecx, ebp mov edx, ebx call stricmp pop ecx pop edx cmp eax, 0 jne nextIterateFunc ; pusha ; push 0 ; push ebx ; push ebx ; push 0 ; call [DELTA pMessageBox] ; popa ; We found it ! Get VA ; Get Array of VA mov edx, [DELTA VAIAT] add edx, 010h mov [DELTA VAKernelIAT], edx ; Store offset index mov eax, esi mov ecx, 4 mul ecx add edx, eax mov [DELTA OffsetExitProcess], edx ; Get out jmp doNotHook nextIterateFunc: add edx, 4 inc esi jmp iterateFunc endIterateFunc: add edi, sizeof (IMAGE_IMPORT_DESCRIPTOR) mov eax, [DELTA VAIAT] add eax, sizeof (IMAGE_IMPORT_DESCRIPTOR) mov [DELTA VAIAT], eax jmp iterateIAT doNotHook: pop esi
test/Succeed/Issue4020.agda
KDr2/agda
0
12712
<filename>test/Succeed/Issue4020.agda {-# OPTIONS --cubical-compatible --rewriting -v rewriting:50 #-} open import Agda.Primitive using (Level; _⊔_; Setω; lzero; lsuc) module Issue4020 where data _≡_ {ℓ : Level} {A : Set ℓ} (a : A) : A → Set ℓ where refl : a ≡ a {-# BUILTIN REWRITE _≡_ #-} ap : ∀ {a b} {A : Set a} {B : Set b} (f : A → B) {a₁ a₂} → a₁ ≡ a₂ → f a₁ ≡ f a₂ ap f refl = refl ap-const-Set : ∀ {a b} {A : Set a} {a₁ a₂ : A} (p : a₁ ≡ a₂) → ap (\ _ → Set b) p ≡ refl ap-const-Set refl = refl {-# REWRITE ap-const-Set #-} {- /home/jason/bug.agda:18,1-29 ap-const-Set is not a legal rewrite rule, since the following variables are not bound by the left hand side: b when checking the pragma REWRITE ap-const-Set -}
my-plaform/engine/src/main/java/com/cartravel/engine/antlr/Engine.g4
moutainhigh/Huskie
0
6201
grammar Engine; @header{ package com.cartravel.engine.antlr; } //select c1,c2,c3 from tb;select * from tb; statement : (sql ender)* ; sql : ('load'|'LOAD') format '.'? path ('where' | 'WHERE')? expression? booleanExpression* 'as' tableName | ('save'|'SAVE') (overwrite | append | errorIfExists | ignore | update)* tableName 'as' format '.' path ('where' | 'WHERE')? expression? booleanExpression* ('partitionBy' col)? ('coalesce' numPartition)? | ('select'|'SELECT') ~(';')* 'as'? tableName | ('insert'|'INSERT') ~(';')* | ('create'|'CREATE') ~(';')* | ('drop'|'DROP') ~(';')* | ('truncate'|'TRUNCATE') ~(';')* | ('register'|'REGISTER') format '.' path ('where' | 'WHERE')? expression? booleanExpression* | ('show'|'SHOW') ~(';')* | ('describe'|'DESCRIBE') ~(';')* | ('include'|'INCLUDE') format '.' path ('where' | 'WHERE')? expression? booleanExpression* | ('explain'|'EXPLAIN') ~(';')* | SIMPLE_COMMENT ; overwrite : ('overwrite' | 'OVERWRITE') ; append : ('append' | 'APPEND') ; errorIfExists : 'errorIfExists' ; ignore : ('ignore' | 'IGNORE') ; update : ('update' | 'UPDATE') ; booleanExpression : ('and' | 'AND') expression ; expression : identifier '=' STRING ; ender :';' ; //匹配字符串或者字符 format : identifier ; path : quotedIdentifier | identifier ; db :qualifiedName | identifier ; tableName //字符串或者数字或者下划线出现 : identifier ; functionName : identifier ; col : identifier ; key : qualifiedName ; value : qualifiedName | quotedIdentifier | STRING | BLOCK_STRING ; qualifiedName : identifier ('.' identifier)* ; identifier : strictIdentifier ; strictIdentifier : IDENTIFIER //直接左递归 | quotedIdentifier //间接左递归 ; quotedIdentifier : BACKQUOTED_IDENTIFIER ; STRING : '\'' ( ~('\''|'\\') | ('\\' .) )* '\'' | '"' ( ~('"'|'\\') | ('\\' .) )* '"' | BLOCK_STRING ; BLOCK_STRING : '```' ~[+] .*? '```' ; //匹配数字或者字符串 //()https://www.cnblogs.com/zengguowang/p/7779699.html IDENTIFIER : (LETTER | DIGIT | '_')+ ; BACKQUOTED_IDENTIFIER : '`' ( ~'`' | '``' )* '`' ; numPartition : DIGIT+ ; fragment DIGIT : [0-9] ; fragment LETTER : [a-zA-Z] ; SIMPLE_COMMENT : '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN) ; BRACKETED_EMPTY_COMMENT : '/**/' -> channel(HIDDEN) ; BRACKETED_COMMENT : '/*' ~[+] .*? '*/' -> channel(HIDDEN) ; WS : [ \r\n\t]+ -> channel(HIDDEN) ; // Catch-all for anything we can't recognize. // We use this to be able to ignore and recover all the text // when splitting statements with DelimiterLexer UNRECOGNIZED : . ;
src/menu.asm
fjpena/sword-of-ianna-msx2
43
93442
mainmenu: xor a ld (start_delta), a ld (menu_counter), a ld (menu_running), a ld (menu_option), a ld (menu_loops), a ld (menu_timer), a ld (credit_timer), a ld (credit_current), a ld (current_level), a ld (player_available_weapons+1), a ld (player_available_weapons+2), a ld (player_available_weapons+3), a ld (player_level), a ld (player_current_weapon), a ld (player_experience), a ld (rom_offset_weapon), a ld a, ($002b) and $80 ; The highest bit is 1 for PAL, 0 for NTSC jr z, mainmenu_ntsc mainmenu_pal: ld a, 3 ld (menu_delay), a jr mainmenu_language mainmenu_ntsc: ld a, 4 ld (menu_delay), a mainmenu_language: ld a, (language) and a jr z, mainmenu_language_sp ld hl, string_list ld (current_string_list), hl jr mainmenu_language_ok mainmenu_language_sp: ld hl, string_list_es ld (current_string_list), hl mainmenu_language_ok: xor a ld (menu_in_jukebox), a ld hl, blackpal call VDP_SetPalette call menu_load_screen ; copy to page 3 ld a, 3 call copyPage ; Cleanup second page ld a, $00 ld b, 0 ld c, 0 ld d, 0 ld e, 128 ld h, 1 call fillArea ld hl, menu_fondo_letras ld de, $8000 call unpackVRAM ; copy to second buffer ld b, 0 ld c, 0 ld d, 80 ld e, 32 ld h, 0 ld l, 32 ld ix, $0101 call vdpCopy ld hl, tilespal call VDP_SetPalette ld b, 3 ld a, 0 call copyPage_generic ld a, 13 call MUSIC_Load ld hl, menu_ISR call INSTALL_ISR showmenu: ; restore the changing part ld b, 0 ld c, 144 ld d, 256 ld e, 48 ld h, 0 ld l, 144 ld ix, $0100 call vdpCopy ld a, 1 ld (menu_running), a call mainmenu_printoptions showmenu_loop: xor a ld (joystick_state), a ld a, (credit_timer) and a jr nz, showmenu_credit_continue ld a, (credit_current) add a, a ld e, a ld d, 0 ld hl, string_credits add hl, de ld a, (hl) inc hl ld iyl, a ld a, (hl) ld iyh, a ; IY points to the current credit ld bc, 8*256 + 23 call print_string3 ld a, (credit_current) inc a cp 3 jr nz, showmenu_credit_nochange xor a showmenu_credit_nochange: ld (credit_current), a showmenu_credit_continue: ld a, (credit_timer) add a, 4 ld (credit_timer), a showmenu_loop_continue: halt halt halt halt ld a, (joystick_state) bit 1, a ; Down jp z, showmenu_checkscrolldown call showmenu_waitrelease xor a ld (menu_timer), a ld (menu_loops), a ; something pressed, do not go to attract mode ld b, 8 showmenu_scrollup_loop: push bc call scrollup ; and copy to front buffer call mainmenu_composeoptions pop bc djnz showmenu_scrollup_loop ld a, (menu_option) inc a and 3 ld (menu_option), a call mainmenu_printoptions jp showmenu_loop showmenu_checkscrolldown: bit 0, a ; Up jp z, showmenu_checkfire call showmenu_waitrelease xor a ld (menu_timer), a ld (menu_loops), a ; something pressed, do not go to attract mode ld b, 8 showmenu_scrolldown_loop: push bc call scrolldown ; and copy to front buffer call mainmenu_composeoptions pop bc djnz showmenu_scrolldown_loop ld a, (menu_option) dec a and 3 ld (menu_option), a call mainmenu_printoptions jp showmenu_loop showmenu_checkfire: bit 4, a ; Fire jp nz, showmenu_firepressed showmenu_nothingpressed: ; Check if the player has found the jukebox key ld hl, KEY_J call get_keyboard and a jr z, showmenu_nojukebox call jukebox call MUSIC_Stop call init_ISR ; We reset all interrupt stuff to start again jp mainmenu showmenu_nojukebox: ld a, (menu_timer) inc a ld (menu_timer), a ; anytime the timer reaches 0 (around 5 secs) we change the screen jp nz, showmenu_loop ld a, (menu_loops) inc a ld (menu_loops), a ld hl, menu_delay cp (hl) jp z, showmenu_go_attract ; after 3 loops PAL, 4 loops NTSC (1 minute 20 secs, approx) we go to attract mode jp showmenu_loop showmenu_firepressed: call showmenu_waitrelease ; wait until fire is released ld a, (menu_option) and a jr nz, showmenu_fire_check1 ret showmenu_fire_check1: dec a jr nz, showmenu_fire_check2 ; if menu_option is 1, then we are going for password call menu_password ; A == <PASSWORD> : <PASSWORD> cp 255 jr z, showmenu_p_fail cp 253 jr nz, showmenu_p_ok call DECODE_SECRETLEVEL ld iy, string_passwordok jr showmenu_p_print showmenu_p_ok: ; here, set current_level and other stuff call DECODE ld iy, string_passwordok jr showmenu_p_print showmenu_p_fail: ld iy, string_passwordfail call showmenu_p_print jp showmenu showmenu_p_print: push iy call menu_cleancreditsattr pop iy ld bc, 8*256 + 23 call print_string3 showmenu_p_waitfire: call check_firepress jr nc, showmenu_p_waitfire ; fire not pressed showmenu_p_waitnofire: call check_firepress jr c, showmenu_p_waitnofire ; fire not pressed ret showmenu_fire_check2: dec a jr nz, showmenu_fire_check3 ; if menu_option is 2, then we are going for password ld a, (language) xor 1 ld (language), a and a jr z, showmenu_language_sp ld hl, string_list ld (current_string_list), hl jp showmenu showmenu_language_sp: ld hl, string_list_es ld (current_string_list), hl jp showmenu showmenu_fire_check3: ; menu_option is 3, Change music info ld a, (music_state) inc a cp 3 jr z, showmenu_fire_music_fx ld (music_state), a ld hl, string_list ld de, 6 add hl, de push hl ld e, (hl) inc hl ld d, (hl) ld hl, 9 add hl, de ex de, hl pop hl ld (hl), e jr showmenu_fire_music_common showmenu_fire_music_fx: xor a ld (music_state), a ld hl, string_list ld de, 6 add hl, de ld de, string_4_1 showmenu_fire_music_common: ld (hl), e inc hl ld (hl), d ld bc, 7 add hl, bc ld (hl), e inc hl ld (hl), d jp showmenu showmenu_go_attract: ld a, 8 ld (current_level), a ret showmenu_waitrelease: xor a ld (joystick_state), a halt ld a, (joystick_state) and a jr nz, showmenu_waitrelease ret ; Read joysticks, set carry if fire is pressed check_firepress: xor a ld (joystick_state), a halt ld a, (joystick_state) bit 4, a jr z, check_firepress_no scf ret check_firepress_no: xor a ret scrollup: halt halt halt ld d, 0 ld e, 1 ld b, 16 scrollup_loop_up: push de push bc call scroll_line pop bc pop de inc d inc e djnz scrollup_loop_up ld d, 16 ld e, 18 ld b, 14 scrollup_loop_middle: push de push bc call scroll_line pop bc pop de inc d inc e djnz scrollup_loop_middle ld d, 30 ld e, 32 call scroll_line ld d, 31 ld e, 32 call scroll_line ld d, 32 ld e, 33 ld b, 16 scrollup_loop_down: push de push bc call scroll_line pop bc pop de inc d inc e djnz scrollup_loop_down ret scrolldown: halt halt halt ld d, 47 ld e, 46 ld b, 16 scrolldown_loop_down: push de push bc call scroll_line pop bc pop de dec d dec e djnz scrolldown_loop_down ld d, 32 ld e, 30 ld b, 14 scrolldown_loop_middle: push de push bc call scroll_line pop bc pop de dec d dec e djnz scrolldown_loop_middle ld d, 18 ld e, 16 call scroll_line ld d, 17 ld e, 16 call scroll_line ld d, 16 ld e, 15 ld b, 16 scrolldown_loop_up: push de push bc call scroll_line pop bc pop de dec d dec e djnz scrolldown_loop_up ret ; Scroll 64 pixels ; D: destination Y (in pixels) ; E: source Y scroll_line: ld b, 128 ; source X ld c, e ; source Y ld h, 128 ; destination X ld l, d ; destination Y ld d, 64 ; number of pixels in X ld e, 1 ; number of pixels in Y ld ix, $0101 call vdpCopy ret mainmenu_composeoptions: ; re-print the background ld b, 0 ld c, 32 ld d, 80 ld e, 32 ld h, 0 ld l, 0 ld ix, $0101 call vdpCopy ; print current scrolling options on top ld b, 120 ld c, 8 ld d, 80 ld e, 32 ld h, 0 ld l, 0 ld ix, $0101 call vdpCompose ; and copy to front buffer ld b, 0 ld c, 0 ld d, 80 ld e, 32 ld h, 88 ld l, 144 ld ix, $0100 call vdpCopy ret mainmenu_printoptions: ; re-print the background ld b, 0 ld c, 32 ld d, 80 ld e, 32 ld h, 0 ld l, 0 ld ix, $0101 call vdpCopy ; print menu options ld a, (menu_option) add a, a ld e, a ld d, 0 ld ix, (current_string_list) add ix, de ld a, (ix+0) ld iyl, a ld a, (ix+1) ld iyh, a ld bc, $0101 call print_string_double ld a, (menu_option) inc a and 3 add a, a ld e, a ld d, 0 ld ix, (current_string_list) add ix, de ld a, (ix+0) ld iyl, a ld a, (ix+1) ld iyh, a ld bc, $0103 call print_string4 ld a, (menu_option) add a, 3 and 3 add a, a ld e, a ld d, 0 ld ix, (current_string_list) add ix, de ld a, (ix+0) ld iyl, a ld a, (ix+1) ld iyh, a ld bc, $0100 call print_string4 ; and copy to front buffer ld b, 0 ld c, 0 ld d, 80 ld e, 32 ld h, 88 ld l, 144 ld ix, $0100 call vdpCopy ; cleanup the background for scroll ld a, $00 ld b, 120 ld c, 0 ld d, 128 ld e, 48 ld h, 1 call fillArea ; print menu options ld a, (menu_option) add a, a ld e, a ld d, 0 ld ix, (current_string_list) add ix, de ld a, (ix+0) ld iyl, a ld a, (ix+1) ld iyh, a ld bc, $1002 call print_string_double ld a, (menu_option) inc a and 3 add a, a ld e, a ld d, 0 ld ix, (current_string_list) add ix, de ld a, (ix+0) ld iyl, a ld a, (ix+1) ld iyh, a ld bc, $1004 call print_string4 ld a, (menu_option) add a, 2 and 3 add a, a ld e, a ld d, 0 ld ix, (current_string_list) add ix, de ld a, (ix+0) ld iyl, a ld a, (ix+1) ld iyh, a ld bc, $1005 push iy call print_string4 pop iy ld bc, $1000 call print_string4 ld a, (menu_option) add a, 3 and 3 add a, a ld e, a ld d, 0 ld ix, (current_string_list) add ix, de ld a, (ix+0) ld iyl, a ld a, (ix+1) ld iyh, a ld bc, $1001 call print_string4 ret menu_cleancreditsattr: ld bc, 23 ld iy, string_long jp print_string3 menu_ISR: ; get joystick state call get_joystick ld b, a ld a, (joystick_state) or b ld (joystick_state), a ; play music, if needed ld a, (music_playing) and a jr z, menu_isr_wave ; if not playing music, do nothing ld a, ($002b) and $80 ; The highest bit is 1 for PAL, 0 for NTSC jr nz, menu_ISR_PAL menu_ISR_NTSC: ld a, (delay60HZ) dec a ld (delay60HZ), a jr nz, menu_ISR_PAL ; for NTSC, skip 1 out of 6 ints ld a, 6 ld (delay60HZ), a jr menu_ISR_end menu_ISR_PAL: call MUSIC_Play menu_ISR_end menu_isr_wave: ; simply get the joystick state ld a, (menu_running) and a ret z ld a, (menu_counter) inc a and $7 ld (menu_counter), a cp 4 jp z, waveeffect ret waveeffect: ld a, (menu_in_jukebox) and a ret nz ld a, (start_delta) ld (current_delta), a ld bc, $0050 ; X=0, Y=80 ld a, 40 ld (current_y), a waveeffect_yloop: ld a, (current_delta) ; A will serve as counter for Y ld e, a ld d, 0 ld hl, wave_delta add hl, de ld a, (hl) ; A == delta for this line cp 1 jr z, waveeffect_plus1 cp 2 jr z, waveeffect_plus2 cp -1 jr nz, waveeffect_minus2 waveeffect_minus1: push bc ld a, -1 call MoveLine pop bc jr waveeffect_nextline waveeffect_plus1: push bc ld a, 1 call MoveLine pop bc jr waveeffect_nextline waveeffect_plus2: push bc ld a, 2 call MoveLine pop bc jr waveeffect_nextline waveeffect_minus2: push bc ld a, -2 call MoveLine pop bc waveeffect_nextline: ; go to next line inc c ; increment wave counter ld a, (current_delta) inc a and $f ld (current_delta), a ld a, (current_y) dec a jr z, waveeffect_end ld (current_y), a jp waveeffect_yloop waveeffect_end: ld a, (start_delta) inc a and $f ld (start_delta), a ret mainmenu_done: ld a, b dec a ld (current_level), a ret menu_password: call menu_cleancreditsattr ld bc, 2*256+23 ld iy, string_enterpassword call print_string3 ld hl, password_string ld de, password_string+1 ld a, ' ' ld (hl), a ld bc, 9 ldir ld b, 0 ; B is the counter ld hl, password_string readloop: push bc push hl call SCAN_KEYBOARD ; read keyboard in A pop hl pop bc cp 13 ; 13 is ENTER jr z, read_finished cp '0' jr c, readloop ; ignore chars < 0 cp 'g' jr nc, readloop ; ignore chars > F cp '9'+1 jr c, readloop_number ; this is a number cp 'a' jr c, readloop ; less than A, not a number readloop_ok: sub 32 readloop_number: ld (hl), a ; store the new key press ld a, b cp 10 jr z, read_continue ; don't go beyond 10 characters inc hl ld (hl), 0 inc b read_continue: push bc push hl ld bc, 18*256+23 ld iy, password_string call print_string3 pop hl pop bc ld a, b cp 10 jr nz, readloop read_finished: ; Check if the player knows the secret level password ld hl, password_string ld de, secret_pass ld b, 10 secret_loop: ld a, (de) cp (hl) jr nz, read_nosecret inc hl inc de djnz secret_loop secret_found: ld a, 253 ; go to secret level ret read_nosecret: ; convert password string into value ld hl, password_string call TEXT_TO_HEX xor $55 ; supersecret value :) ld (password_value), a call TEXT_TO_HEX xor $55 ; supersecret value :) ld (password_value+1), a call TEXT_TO_HEX xor $55 ; supersecret value :) ld (password_value+2), a call TEXT_TO_HEX xor $55 ; supersecret value :) ld (password_value+3), a call TEXT_TO_HEX ld (password_value+4), a ; the checksum is not XOR-ed ; check if checksum is valid call password_checksum ld b, a ld a, (password_value+4) cp b jr z, is_password_valid ; jr nz, menu_password_invalid ; check if resulting values are valid ; call is_password_valid ; and a ; jr nz, menu_password_invalid ;menu_password_valid: ; xor a ; ret menu_password_invalid: ; ld a, 255 ; ret password_invalid: ld a, 255 ret is_password_valid: ; save player level ld a, (player_level) ld (save_level), a ld a, (password_value) ; current level and $0f ; low nibble is current level cp 8 jr nc, password_invalid ; level cannot be > 7 ld (player_level), a ld a, (password_value) ; high nibble is available_weapons and $80 ; at least the basic sword must be there jr z, password_invalid ld a, (password_value+1); player_level cp 8 jr nc, password_invalid ; player level cannot be > 7 call get_player_max_exp ; get max experience for saved level in A ld hl, password_value+2 cp (hl) ; compare with the experience jr c, password_invalid ; if the saved value is > the max experience for this level, fail! ld a, (password_value+3); player_current_weapon, it has to be one of the available_weapons ld hl, weapon_masks ld e, a ld d, 0 add hl, de ld b, (hl) ; B contains the mask ld a, (password_value) ; high nibble is available_weapons and b ld a, (save_level) ld (player_level), a ; restore value jr z, password_invalid ; the weapon is not available, so the password is not valid xor a ret DECODE_SECRETLEVEL: ld a, 2 ld (player_level), a ld a, 9 ld (current_level), a ld iy, player_available_weapons ld (iy+0), 1 ld (iy+1), 1 ld (iy+2), 1 ld (iy+3), 0 ; all weapons are available, except Blade xor a ld (player_experience), a ld (player_current_weapon), a ret ; Convert text into hex value ; INPUT: ; - HL: pointer to char ; OUTPUT: ; - A: value TEXT_TO_HEX: ld e, 0 call TH_CONV rla rla rla rla ;Set it in bits 7-4 ld e,a ;Store first digit in E TH_CONV: ld a,(hl) inc hl sub 48 cp 10 jr c,noletter sub 7 noletter: or e ret ; Run a quick checksum of the 4 initial values in password_value ; OUTPUT: ; - A: checksum password_checksum: xor a ld hl, password_value ld b, 4 password_checksum_loop add a, (hl) inc hl djnz password_checksum_loop ret string_enterpassword: db "ENTER PASSWORD:",0 string_passwordok: db " PASSWORD OK",0 string_passwordfail: db "INVALID PASSWORD",0 string_presskey: db "PRESS KEY FOR ",0 string_credits: dw string_code, string_art, string_music string_code: db " CODE: UTOPIAN ",0 string_art: db "ART: PAGANTIPACO",0 string_music: db " SOUND: MCALBY ",0 string_long: db " ",0 string_1: db " PLAY ",0 string_1_es: db " JUGAR ",0 string_2: db "PASSWORD",0 string_3: db "ENGLISH ",0 string_3_es: db "ESPA$OL ",0 string_4_1: db "MUSIC/FX",0 string_4_2: db " MUSIC ",0 string_4_3: db " FX ",0 weapon_masks: db $80, $40, $20, $10 secret_pass: db '<PASSWORD>' wave_delta: db 2, 2, 1, 1, -1, -1, -2, -2, -2, -2, -1, -1, 1, 1, 2, 2 keys_jump: dw KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8 ,KEY_9 menu_fondo_letras: INCBIN "menu_fondo_letras.SR5.plet1" menu_font: INCBIN "menu_font.SR5.plet1" jukebox_1: db " THE SWORD OF IANNA OST ",0 jukebox_2: db " BY MCALBY ",0 jukebox_3: db " --------- ",0 jukebox_4: db " ",0 jukebox_5: db " A: MENU B: INTRO ",0 jukebox_6: db " C: LEVEL 1 D: LEVEL 2 ",0 jukebox_7: db " E: LEVEL 3 F: LEVEL 4 ",0 jukebox_8: db " G: LEVEL 5 H: LEVEL 6 ",0 jukebox_9: db " I: LEVEL 7 J: LEVEL 8 ",0 jukebox_a: db " ",0 jukebox_b: db " PRESS X TO GO BACK TO THE MENU ",0 jukebox: call cls_primary ld a, 1 ld (menu_in_jukebox), a ld iy, jukebox_1 ld de, 33 ld bc, $0006 ld a, 11 jukebox_print_loop: push af push bc push de push iy call print_string3 pop iy pop de pop bc pop af add iy, de inc c dec a jr nz, jukebox_print_loop jukebox_wait_loop: ld hl, KEY_A call get_keyboard and a jr nz, jukebox_play_a ld hl, KEY_B call get_keyboard and a jr nz, jukebox_play_b ld hl, KEY_C call get_keyboard and a jr nz, jukebox_play_c ld hl, KEY_D call get_keyboard and a jr nz, jukebox_play_d ld hl, KEY_E call get_keyboard and a jr nz, jukebox_play_e ld hl, KEY_F call get_keyboard and a jr nz, jukebox_play_f ld hl, KEY_G call get_keyboard and a jr nz, jukebox_play_g ld hl, KEY_H call get_keyboard and a jr nz, jukebox_play_h ld hl, KEY_I call get_keyboard and a jr nz, jukebox_play_i ld hl, KEY_J call get_keyboard and a jr nz, jukebox_play_j ld hl, KEY_X call get_keyboard and a ret nz jr jukebox_wait_loop jukebox_play_a: ld hl, KEY_A call get_keyboard and a jr nz, jukebox_play_a ld a, 13 jr jukebox_play_common jukebox_play_b: ld hl, KEY_B call get_keyboard and a jr nz, jukebox_play_b ld a, 12 jr jukebox_play_common jukebox_play_c: ld hl, KEY_C call get_keyboard and a jr nz, jukebox_play_c xor a jr jukebox_play_common jukebox_play_d: ld hl, KEY_D call get_keyboard and a jr nz, jukebox_play_d ld a, 1 jr jukebox_play_common jukebox_play_e: ld hl, KEY_E call get_keyboard and a jr nz, jukebox_play_e ld a, 2 jr jukebox_play_common jukebox_play_f: ld hl, KEY_F call get_keyboard and a jr nz, jukebox_play_f ld a, 3 jr jukebox_play_common jukebox_play_g: ld hl, KEY_G call get_keyboard and a jr nz, jukebox_play_g ld a, 4 jr jukebox_play_common jukebox_play_h: ld hl, KEY_H call get_keyboard and a jr nz, jukebox_play_h ld a, 5 jr jukebox_play_common jukebox_play_i: ld hl, KEY_I call get_keyboard and a jr nz, jukebox_play_i ld a, 6 jr jukebox_play_common jukebox_play_j: ld hl, KEY_J call get_keyboard and a jr nz, jukebox_play_j ld a, 7 jr jukebox_play_common jukebox_play_common: push af call MUSIC_Stop pop af call MUSIC_Load jp jukebox_wait_loop ; Routine to clear screen cls_primary: call fadeMSX2 ld a, $11 ld bc, 0 ld d, 256 ld e, 192 ld h, 0 call fillArea ld hl, tilespal call VDP_SetPalette ret
examples/AIM5/PolyDep/Tools.agda
shlevy/agda
1,989
4377
<reponame>shlevy/agda module Tools where import PolyDepPrelude -- import Sigma -- import And open PolyDepPrelude using(Datoid; Bool; true; false; _&&_; Nat; True; Taut; unit) liftAnd : (a : Bool)(b : Bool)(ta : True a)(tb : True b) -> True (a && b) liftAnd (true) (true) ta tb = unit liftAnd (true) (false) ta () -- empty liftAnd (false) _ () _ -- empty {- sigmaCond (D:Datoid) (B:D.Elem -> Set) (C:Set) (ifTrue:(b:D.Elem) -> B b -> B b -> C) (ifFalse:C) (x:Sigma D.Elem B) (y:Sigma D.Elem B) : C = case x of { (si a pa) -> case y of { (si b pb) -> let caseOn (e:Bool)(cast:True e -> B a -> B b) : C = case e of { (false) -> ifFalse; (true) -> ifTrue b (cast tt@_ pa) pb;} in caseOn (D.eq a b) (D.subst B);};} -- trueAnd = \a b -> (LogicBool.spec_and a b).snd trueAnd (a:Bool)(b:Bool)(p:And (True a) (True b)) : True (a && b) = case p of { (Pair a' b') -> case a of { (true) -> case b of { (true) -> tt@_; (false) -> b';}; (false) -> a';};} splitAnd (a:Bool)(b:Bool)(p:True (_&&_ a b)) : Times (True a) (True b) = case a of { (true) -> case b of { (true) -> struct { fst = tt@_; snd = tt@_;}; (false) -> case p of { };}; (false) -> case p of { };} trueSigma (D:Set)(f:D -> Bool)(s:Sigma D (\(d:D) -> True (f d))) : True (f (si1 D (\(d:D) -> True (f d)) s)) = case s of { (si a b) -> b;} Maybe (A:Set) : Set = data Nothing | Just (a:A) mapMaybe (|A,|B:Set)(f:A -> B)(x:Maybe A) : Maybe B = case x of { (Nothing) -> Nothing@_; (Just a) -> Just@_ (f a);} maybe (|A,|B:Set)(e:B)(f:A -> B) : Maybe A -> B = \x -> case x of { (Nothing) -> e; (Just a) -> f a;} open SET use List, Absurd, Unit, Either, mapEither, Times, mapTimes, id, uncur, elimEither elimList (|A:Set) (C:List A -> Type) (n:C nil@_) (c:(a:A) -> (as:List A) -> C as -> C (con@_ a as)) (as:List A) : C as = case as of { (nil) -> n; (con x xs) -> c x xs (elimList C n c xs);} -- Common generalization of sum and product of a list of sets -- (represented as a decoding function f and a list of codes) O (A:Set)(E:Set)(Op:Set -> Set -> Set)(f:A -> Set) : List A -> Set = elimList (\as -> Set) E (\a -> \as -> Op (f a)) -- The corresponding map function! (Takes a nullary and a binary -- functor as arguments.) mapO (|A,|E:Set) (|Op:Set -> Set -> Set) (mapE:E -> E) (mapOp:(A1,B1,A2,B2:Set) |-> (f1:A1 -> B1) -> (f2:A2 -> B2) -> Op A1 A2 -> Op B1 B2) (X:A -> Set) (Y:A -> Set) (f:(a:A) -> X a -> Y a) : (as:List A) -> O A E Op X as -> O A E Op Y as = elimList (\(as:List A) -> O A E Op X as -> O A E Op Y as) mapE (\a -> \as -> mapOp (f a)) mapAbsurd : Absurd -> Absurd = id eqAbsurd : Absurd -> Absurd -> Bool = \h -> \h' -> case h of { } -- the name of OPlus and OTimes indicate the symbols they should be -- shown as in algebra: a big ring (a big "O") with the operator + -- or x in -- Disjoint sum over a list of codes OPlus (A:Set) : (A -> Set) -> List A -> Set = O A Absurd Either -- corresponding map function mapOPlus (|A:Set)(X:A -> Set)(Y:A -> Set)(f:(a:A) -> X a -> Y a) : (as:List A) -> OPlus A X as -> OPlus A Y as = mapO id mapEither X Y f -- Cartesian product over a list of codes OTimes (A:Set) : (A -> Set) -> List A -> Set = O A Unit Times -- corresponding map mapOTimes (|A:Set)(X:A -> Set)(Y:A -> Set)(f:(a:A) -> X a -> Y a) : (as:List A) -> OTimes A X as -> OTimes A Y as = mapO id mapTimes X Y f sizeOPlus (|A:Set) (f:A -> Set) (n:(a:A) -> f a -> Nat) (as:List A) (t:OPlus A f as) : Nat = case as of { (nil) -> case t of { }; (con a as) -> case t of { (inl x) -> n a x; (inr y) -> sizeOPlus f n as y;};} triv (x:Absurd) : Set = case x of { } trivT (x:Absurd) : Type = case x of { } sizeOTimes (|A:Set) (f:A -> Set) (z:Nat) (n:(a:A) -> f a -> Nat) (as:List A) (t:OTimes A f as) : Nat = case as of { (nil) -> case t of { (tt) -> z;}; (con a as) -> uncur (+) (mapTimes (n a) (sizeOTimes f z n as) t);} eqUnit (x:Unit)(y:Unit) : Bool = true@_ eqTimes (|A1,|A2,|B1,|B2:Set) (eq1:A1 -> B1 -> Bool) (eq2:A2 -> B2 -> Bool) : Times A1 A2 -> Times B1 B2 -> Bool = \x -> \y -> _&&_ (eq1 x.fst y.fst) (eq2 x.snd y.snd) EqFam (A:Set)(f:A -> Set)(g:A -> Set) : Set = (a:A) -> f a -> g a -> Bool eqOTimes (A:Set)(f:A -> Set)(g:A -> Set)(eq:EqFam A f g) : EqFam (List A) (OTimes A f) (OTimes A g) = elimList (\as -> (OTimes A f as -> OTimes A g as -> Bool)) eqUnit (\a -> \as -> eqTimes (eq a)) eqEither (|A1,|A2,|B1,|B2:Set) (eq1:A1 -> B1 -> Bool) (eq2:A2 -> B2 -> Bool) : Either A1 A2 -> Either B1 B2 -> Bool = \x -> \y -> case x of { (inl x') -> case y of { (inl x0) -> eq1 x' x0; (inr y') -> false@_;}; (inr y') -> case y of { (inl x') -> false@_; (inr y0) -> eq2 y' y0;};} eqOPlus (A:Set)(f:A -> Set)(g:A -> Set)(eq:EqFam A f g) : EqFam (List A) (OPlus A f) (OPlus A g) = elimList (\(as:List A) -> OPlus A f as -> OPlus A g as -> Bool) eqAbsurd (\a -> \as -> eqEither (eq a)) Fam (I:Set)(X:I -> Set) : Type = (i:I) -> X i -> Set eitherSet (A:Set)(B:Set)(f:A -> Set)(g:B -> Set)(x:Either A B) : Set = case x of { (inl x') -> f x'; (inr y) -> g y;} famOPlus (A:Set)(G:A -> Set) : Fam A G -> Fam (List A) (OPlus A G) = \(f:Fam A G) -> elimList (\(as:List A) -> OPlus A G as -> Set) triv (\(a:A) -> \(as:List A) -> eitherSet (G a) (OPlus A G as) (f a)) bothSet (A:Set)(B:Set)(f:A -> Set)(g:B -> Set)(x:Times A B) : Set = Times (f x.fst) (g x.snd) famOTimes (A:Set)(G:A -> Set) : Fam A G -> Fam (List A) (OTimes A G) = \(f:Fam A G) -> elimList (\(as:List A) -> OTimes A G as -> Set) (\(u:OTimes A G nil@_) -> Unit) (\(a:A) -> \(as:List A) -> bothSet (G a) (OTimes A G as) (f a)) FAM (I:Set)(X:I -> Set)(Y:(i:I) -> X i -> Set) : Type = (i:I) -> (x:X i) -> Y i x eitherFAM (A:Set) (A2:Set) (G:A -> Set) (G2:A2 -> Set) (H:Fam A G) (H2:Fam A2 G2) (a:A) (a2:A2) (f:(x:G a) -> H a x) (f2:(x2:G2 a2) -> H2 a2 x2) (x:Either (G a) (G2 a2)) : eitherSet (G a) (G2 a2) (H a) (H2 a2) x = case x of { (inl y) -> f y; (inr y2) -> f2 y2;} FAMOPlus (A:Set)(G:A -> Set)(H:Fam A G) : FAM A G H -> FAM (List A) (OPlus A G) (famOPlus A G H) = \(f:FAM A G H) -> elimList (\(as:List A) -> (x:OPlus A G as) -> famOPlus A G H as x) (\(x:OPlus A G nil@_) -> whenZero (famOPlus A G H nil@_ x) x) (\(a:A) -> \(as:List A) -> eitherFAM A (List A) G (OPlus A G) H (famOPlus A G H) a as (f a)) bothFAM (A:Set) (A2:Set) (G:A -> Set) (G2:A2 -> Set) (H:Fam A G) (H2:Fam A2 G2) (a:A) (a2:A2) (f:(x:G a) -> H a x) (f2:(x2:G2 a2) -> H2 a2 x2) (x:Times (G a) (G2 a2)) : bothSet (G a) (G2 a2) (H a) (H2 a2) x = struct { fst = f x.fst; snd = f2 x.snd;} FAMOTimes (A:Set)(G:A -> Set)(H:Fam A G) : FAM A G H -> FAM (List A) (OTimes A G) (famOTimes A G H) = \(f:FAM A G H) -> elimList (\(as:List A) -> (x:OTimes A G as) -> famOTimes A G H as x) (\(x:OTimes A G nil@_) -> x) (\(a:A) -> \(as:List A) -> bothFAM A (List A) G (OTimes A G) H (famOTimes A G H) a as (f a)) -} {- Size (A:Set) : Type = A -> Nat size_OPlus (A:Set) (f:A -> Set) (size_f:(a:A) -> f a -> Nat) (as:List A) : OPlus f as -> Nat = \(x:OPlus f as) -> ? size_OPlus (A:Set) (f:A -> Set) (size_f:(a:A) -> Size (f a)) (as:List A) : Size (OPlus f as) = \(x:OPlus f as) -> -} {- Alfa unfoldgoals off brief on hidetypeannots off wide nd hiding on var "mapMaybe" hide 2 var "sigmaCond" hide 3 var "maybe" hide 2 var "O" hide 1 var "OTimes" hide 1 var "OPlus" hide 1 var "mapOPlus" hide 3 var "id" hide 1 var "mapOTimes" hide 3 var "mapO" hide 3 var "mapOp" hide 4 var "uncur" hide 3 var "mapTimes" hide 4 var "sizeOTimes" hide 2 var "sizeOPlus" hide 2 var "eqTimes" hide 4 var "OTimesEq" hide 3 var "elimList" hide 1 var "eqOTimes" hide 3 var "eqEither" hide 4 var "eqOPlus" hide 3 var "eitherSet" hide 2 var "bothSet" hide 2 var "famOPlus" hide 2 var "famOTimes" hide 2 var "helper4" hide 4 var "eitherFAM" hide 4 var "FAMOTimes" hide 3 var "FAMOPlus" hide 3 #-}
Library/GrObj/UI/uiConvertControl.asm
steakknife/pcgeos
504
10842
<filename>Library/GrObj/UI/uiConvertControl.asm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: uiConvertControl.asm AUTHOR: <NAME> REVISION HISTORY: Name Date Description ---- ---- ----------- jon 24 feb 1992 Initial version. DESCRIPTION: Code for the GrObjConvertControlClass $Id: uiConvertControl.asm,v 1.1 97/04/04 18:06:15 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjUIControllerCode segment resource COMMENT @---------------------------------------------------------------------- MESSAGE: GrObjConvertControlGetInfo -- MSG_GEN_CONTROL_GET_INFO for GrObjConvertControlClass DESCRIPTION: Return group PASS: *ds:si - instance data es - segment of GrObjConvertControlClass ax - The message cx:dx - GenControlBuildInfo structure to fill in RETURN: none DESTROYED: bx, si, di, ds, es (message handler) REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 10/31/91 Initial version ------------------------------------------------------------------------------@ GrObjConvertControlGetInfo method dynamic GrObjConvertControlClass, MSG_GEN_CONTROL_GET_INFO mov si, offset GOCC_dupInfo call CopyDupInfoCommon ret GrObjConvertControlGetInfo endm GOCC_dupInfo GenControlBuildInfo < mask GCBF_SUSPEND_ON_APPLY, ; GCBI_flags GOCC_IniFileKey, ; GCBI_initFileKey GOCC_gcnList, ; GCBI_gcnList length GOCC_gcnList, ; GCBI_gcnCount GOCC_notifyList, ; GCBI_notificationList length GOCC_notifyList, ; GCBI_notificationCount GOCCName, ; GCBI_controllerName handle GrObjConvertControlUI, ; GCBI_dupBlock GOCC_childList, ; GCBI_childList length GOCC_childList, ; GCBI_childCount GOCC_featuresList, ; GCBI_featuresList length GOCC_featuresList, ; GCBI_featuresCount GOCC_DEFAULT_FEATURES, ; GCBI_features handle GrObjConvertToolControlUI, ; GCBI_dupBlock GOCC_toolList, ; GCBI_childList length GOCC_toolList, ; GCBI_childCount GOCC_toolFeaturesList, ; GCBI_featuresList length GOCC_toolFeaturesList, ; GCBI_featuresCount GOCC_DEFAULT_TOOLBOX_FEATURES, ; GCBI_features GOCC_helpContext> ; GCBI_helpContext if FULL_EXECUTE_IN_PLACE GrObjControlInfoXIP segment resource endif GOCC_helpContext char "dbGrObjConvert", 0 GOCC_IniFileKey char "GrObjConvert", 0 GOCC_gcnList GCNListType \ <MANUFACTURER_ID_GEOWORKS, \ GAGCNLT_APP_TARGET_NOTIFY_GROBJ_BODY_SELECTION_STATE_CHANGE> GOCC_notifyList NotificationType \ <MANUFACTURER_ID_GEOWORKS, GWNT_GROBJ_BODY_SELECTION_STATE_CHANGE> ;--- GOCC_childList GenControlChildInfo \ <offset GrObjConvertToBitmapTrigger, mask GOCCF_CONVERT_TO_BITMAP, mask GCCF_IS_DIRECTLY_A_FEATURE>, <offset GrObjConvertToGraphicTrigger, mask GOCCF_CONVERT_TO_GRAPHIC, mask GCCF_IS_DIRECTLY_A_FEATURE>, <offset GrObjConvertFromGraphicTrigger, mask GOCCF_CONVERT_FROM_GRAPHIC, mask GCCF_IS_DIRECTLY_A_FEATURE> GOCC_featuresList GenControlFeaturesInfo \ <offset GrObjConvertFromGraphicTrigger, ConvertFromGraphicName, 0>, <offset GrObjConvertToGraphicTrigger, ConvertToGraphicName, 0>, <offset GrObjConvertToBitmapTrigger, ConvertToBitmapName, 0> GOCC_toolList GenControlChildInfo \ <offset GrObjConvertToBitmapTool, mask GOCCF_CONVERT_TO_BITMAP, mask GCCF_IS_DIRECTLY_A_FEATURE>, <offset GrObjConvertToGraphicTool, mask GOCCF_CONVERT_TO_GRAPHIC, mask GCCF_IS_DIRECTLY_A_FEATURE>, <offset GrObjConvertFromGraphicTool, mask GOCCF_CONVERT_FROM_GRAPHIC, mask GCCF_IS_DIRECTLY_A_FEATURE> GOCC_toolFeaturesList GenControlFeaturesInfo \ <offset GrObjConvertFromGraphicTool, ConvertFromGraphicName, 0>, <offset GrObjConvertToGraphicTool, ConvertToGraphicName, 0>, <offset GrObjConvertToBitmapTool, ConvertToBitmapName, 0> if FULL_EXECUTE_IN_PLACE GrObjControlInfoXIP ends endif COMMENT @---------------------------------------------------------------------- MESSAGE: GrObjConvertControlUpdateUI -- MSG_GEN_CONTROL_UPDATE_UI for GrObjConvertControlClass DESCRIPTION: Handle notification of type change PASS: *ds:si - instance data es - segment of GrObjConvertControlClass ax - MSG_GEN_CONTROL_UPDATE_UI RETURN: nothing DESTROYED: ax REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jon 11 feb 1992 Initial version ------------------------------------------------------------------------------@ GrObjConvertControlUpdateUI method dynamic GrObjConvertControlClass, MSG_GEN_CONTROL_UPDATE_UI uses cx .enter mov cx, 1 mov ax, mask GOCCF_CONVERT_TO_BITMAP mov si, offset GrObjConvertToBitmapTrigger call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet mov si, offset GrObjConvertToBitmapTool call GrObjControlUpdateToolBasedOnNumSelectedAndToolboxFeatureSet mov ax, mask GOCCF_CONVERT_TO_GRAPHIC mov si, offset GrObjConvertToGraphicTrigger call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet mov si, offset GrObjConvertToGraphicTool call GrObjControlUpdateToolBasedOnNumSelectedAndToolboxFeatureSet mov cx, mask GSSF_UNGROUPABLE mov ax, mask GOCCF_CONVERT_FROM_GRAPHIC mov si, offset GrObjConvertFromGraphicTrigger call GrObjControlUpdateUIBasedOnSelectionFlagsAndFeatureSet mov si, offset GrObjConvertFromGraphicTool call GrObjControlUpdateToolBasedOnSelectionFlagsAndToolboxFeatureSet .leave ret GrObjConvertControlUpdateUI endm GrObjUIControllerCode ends GrObjUIControllerActionCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjConvertControlConvertToBitmap %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: GrObjConvertControl method for MSG_GOCC_CONVERT_TO_BITMAP Called by: Pass: *ds:si = GrObjConvertControl object ds:di = GrObjConvertControl instance Return: nothing Destroyed: ax, bx, di Comments: Revision History: Name Date Description ---- ------------ ----------- jon Feb 24, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjConvertControlConvertToBitmap method dynamic GrObjConvertControlClass, MSG_GOCC_CONVERT_TO_BITMAP .enter mov ax, MSG_GB_CONVERT_SELECTED_GROBJS_TO_BITMAP call GrObjControlOutputActionRegsToBody .leave ret GrObjConvertControlConvertToBitmap endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjConvertControlConvertToGraphic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: GrObjConvertControl method for MSG_GOCC_CONVERT_TO_GRAPHIC Called by: Pass: *ds:si = GrObjConvertControl object ds:di = GrObjConvertControl instance Return: nothing Destroyed: ax, bx, di Comments: Revision History: Name Date Description ---- ------------ ----------- jon Feb 24, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjConvertControlConvertToGraphic method dynamic GrObjConvertControlClass, MSG_GOCC_CONVERT_TO_GRAPHIC .enter mov ax, MSG_GB_GROUP_SELECTED_GROBJS call GrObjControlOutputActionRegsToBody .leave ret GrObjConvertControlConvertToGraphic endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GrObjConvertControlConvertFromGraphic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Description: GrObjConvertControl method for MSG_GOCC_CONVERT_FROM_GRAPHIC Called by: Pass: *ds:si = GrObjConvertControl object ds:di = GrObjConvertControl instance Return: nothing Destroyed: ax, bx, di Comments: Revision History: Name Date Description ---- ------------ ----------- jon Feb 24, 1992 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GrObjConvertControlConvertFromGraphic method dynamic GrObjConvertControlClass, MSG_GOCC_CONVERT_FROM_GRAPHIC .enter mov ax, MSG_GB_UNGROUP_SELECTED_GROUPS call GrObjControlOutputActionRegsToBody .leave ret GrObjConvertControlConvertFromGraphic endm GrObjUIControllerActionCode ends
tests/data_unsized/9.asm
NullMember/customasm
414
179489
<filename>tests/data_unsized/9.asm #d x, 0x56, x ; = 0x1234561234 #d x, 0x56, x ; = 0x1234561234 x = 0x1234
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_401.asm
ljhsiun2/medusa
9
15224
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r14 push %r8 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0x835, %r10 cmp $30020, %rsi movb $0x61, (%r10) nop nop nop sub $22953, %r14 lea addresses_A_ht+0x16800, %r12 nop nop nop nop nop and $40848, %r8 movb $0x61, (%r12) nop nop nop nop sub $57569, %rdi lea addresses_UC_ht+0x95d8, %rsi lea addresses_WT_ht+0x12cd8, %rdi nop inc %rax mov $101, %rcx rep movsb nop nop sub %r8, %r8 lea addresses_WC_ht+0x2480, %rcx clflush (%rcx) nop add $31925, %r10 movw $0x6162, (%rcx) nop nop nop nop sub %r12, %r12 lea addresses_WC_ht+0xbb58, %rsi lea addresses_normal_ht+0xee18, %rdi nop nop and $36208, %r12 mov $69, %rcx rep movsb nop nop nop nop nop cmp %rcx, %rcx lea addresses_WT_ht+0x1bb3e, %rsi lea addresses_D_ht+0x5558, %rdi nop nop dec %r14 mov $91, %rcx rep movsw nop nop nop cmp $60654, %rax pop %rsi pop %rdi pop %rcx pop %rax pop %r8 pop %r14 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %rbp push %rcx push %rdx push %rsi // Store mov $0x46a, %rbp nop nop inc %r12 movb $0x51, (%rbp) nop nop nop and %rbp, %rbp // Load mov $0x5cc4240000000558, %rcx add %rsi, %rsi mov (%rcx), %r12w nop nop nop nop nop add %rbp, %rbp // Store lea addresses_A+0x19158, %rbp nop sub $43750, %rcx mov $0x5152535455565758, %r12 movq %r12, %xmm5 vmovups %ymm5, (%rbp) nop add $27402, %rdx // Store lea addresses_A+0x1e428, %r12 xor $54427, %rdx mov $0x5152535455565758, %r11 movq %r11, %xmm6 movups %xmm6, (%r12) nop nop nop nop nop cmp %r14, %r14 // Store mov $0xd58, %r12 nop nop nop nop nop and %r14, %r14 movb $0x51, (%r12) nop nop nop nop nop cmp $54057, %rdx // Store mov $0x576c540000000178, %rcx cmp %rsi, %rsi mov $0x5152535455565758, %r11 movq %r11, %xmm0 movups %xmm0, (%rcx) nop nop nop nop nop sub %rdx, %rdx // Store lea addresses_UC+0x1558, %r12 nop nop xor %rdx, %rdx mov $0x5152535455565758, %r14 movq %r14, %xmm6 vmovups %ymm6, (%r12) nop nop nop cmp $7815, %rcx // Faulty Load lea addresses_UC+0x1558, %r12 nop nop cmp $7050, %rsi vmovups (%r12), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %rdx lea oracles, %rcx and $0xff, %rdx shlq $12, %rdx mov (%rcx,%rdx,1), %rdx pop %rsi pop %rdx pop %rcx pop %rbp pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': True, 'congruent': 1, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 10, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': 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 */
programs/oeis/269/A269496.asm
karttu/loda
0
170286
; A269496: Number of length-5 0..n arrays with no repeated value differing from the previous repeated value by one. ; 24,215,964,3021,7616,16579,32460,58649,99496,160431,248084,370405,536784,758171,1047196,1418289,1887800,2474119,3197796,4081661,5150944,6433395,7959404,9762121,11877576,14344799,17205940,20506389,24294896,28623691,33548604,39129185,45428824,52514871,60458756,69336109,79226880,90215459,102390796,115846521,130681064,146997775,164905044,184516421,205950736,229332219,254790620,282461329,312485496,345010151,380188324,418179165,459148064,503266771,550713516,601673129,656337160,714903999,777578996,844574581,916110384,992413355,1073717884,1160265921,1252307096,1350098839,1453906500,1564003469,1680671296,1804199811,1934887244,2073040345,2218974504,2373013871,2535491476,2706749349,2887138640,3077019739,3276762396,3486745841,3707358904,3939000135,4182077924,4437010621,4704226656,4984164659,5277273580,5584012809,5904852296,6240272671,6590765364,6956832725,7338988144,7737756171,8153672636,8587284769,9039151320,9509842679,9999940996,10510040301,11040746624,11592678115,12166465164,12762750521,13382189416,14025449679,14693211860,15386169349,16105028496,16850508731,17623342684,18424276305,19254068984,20113493671,21003336996,21924399389,22877495200,23863452819,24883114796,25937337961,27026993544,28152967295,29316159604,30517485621,31757875376,33038273899,34359641340,35722953089,37129199896,38579387991,40074539204,41615691085,43203897024,44840226371,46525764556,48261613209,50048890280,51888730159,53782283796,55730718821,57735219664,59796987675,61917241244,64097215921,66338164536,68641357319,71008082020,73439644029,75937366496,78502590451,81136674924,83840997065,86616952264,89465954271,92389435316,95388846229,98465656560,101621354699,104857447996,108175462881,111576944984,115063459255,118636590084,122297941421,126049136896,129891819939,133827653900,137858322169,141985528296,146210996111,150536469844,154963714245,159494514704,164130677371,168874029276,173726418449,178689714040,183765806439,188956607396,194264050141,199690089504,205236702035,210905886124,216699662121,222620072456,228669181759,234849076980,241161867509,247609685296,254194684971,260919043964,267784962625,274794664344,281950395671,289254426436,296709049869,304316582720,312079365379,319999761996,328080160601,336322973224,344730636015,353305609364,362050378021,370967451216,380059362779,389328671260,398777960049,408409837496,418226937031 mov $5,$0 add $0,4 mul $0,2 mov $1,3 mov $2,3 mov $4,2 lpb $0,1 add $2,$0 sub $0,1 add $1,$2 sub $1,$4 mov $2,$1 mul $1,2 mov $4,$1 lpe sub $2,1 add $4,$2 mov $1,$4 sub $1,95 mov $3,15 mov $6,$5 lpb $3,1 add $1,$6 sub $3,1 lpe mov $8,$5 lpb $8,1 add $7,$6 sub $8,1 lpe mov $3,68 mov $6,$7 lpb $3,1 add $1,$6 sub $3,1 lpe mov $7,0 mov $8,$5 lpb $8,1 add $7,$6 sub $8,1 lpe mov $3,40 mov $6,$7 lpb $3,1 add $1,$6 sub $3,1 lpe mov $7,0 mov $8,$5 lpb $8,1 add $7,$6 sub $8,1 lpe mov $3,10 mov $6,$7 lpb $3,1 add $1,$6 sub $3,1 lpe mov $7,0 mov $8,$5 lpb $8,1 add $7,$6 sub $8,1 lpe mov $3,1 mov $6,$7 lpb $3,1 add $1,$6 sub $3,1 lpe
Cubical/HITs/FreeAbGroup/Base.agda
thomas-lamiaux/cubical
1
13026
<reponame>thomas-lamiaux/cubical {-# OPTIONS --safe #-} module Cubical.HITs.FreeAbGroup.Base where open import Cubical.Foundations.Prelude open import Cubical.Foundations.HLevels open import Cubical.Foundations.Function infixl 7 _·_ infix 20 _⁻¹ private variable ℓ ℓ' : Level A : Type ℓ data FreeAbGroup (A : Type ℓ) : Type ℓ where ⟦_⟧ : A → FreeAbGroup A ε : FreeAbGroup A _·_ : FreeAbGroup A → FreeAbGroup A → FreeAbGroup A _⁻¹ : FreeAbGroup A → FreeAbGroup A assoc : ∀ x y z → x · (y · z) ≡ (x · y) · z comm : ∀ x y → x · y ≡ y · x identityᵣ : ∀ x → x · ε ≡ x invᵣ : ∀ x → x · x ⁻¹ ≡ ε trunc : isSet (FreeAbGroup A) module Elim {B : FreeAbGroup A → Type ℓ'} (⟦_⟧* : (x : A) → B ⟦ x ⟧) (ε* : B ε) (_·*_ : ∀ {x y} → B x → B y → B (x · y)) (_⁻¹* : ∀ {x} → B x → B (x ⁻¹)) (assoc* : ∀ {x y z} → (xs : B x) (ys : B y) (zs : B z) → PathP (λ i → B (assoc x y z i)) (xs ·* (ys ·* zs)) ((xs ·* ys) ·* zs)) (comm* : ∀ {x y} → (xs : B x) (ys : B y) → PathP (λ i → B (comm x y i)) (xs ·* ys) (ys ·* xs)) (identityᵣ* : ∀ {x} → (xs : B x) → PathP (λ i → B (identityᵣ x i)) (xs ·* ε*) xs) (invᵣ* : ∀ {x} → (xs : B x) → PathP (λ i → B (invᵣ x i)) (xs ·* (xs ⁻¹*)) ε*) (trunc* : ∀ xs → isSet (B xs)) where f : (xs : FreeAbGroup A) → B xs f ⟦ x ⟧ = ⟦ x ⟧* f ε = ε* f (xs · ys) = f xs ·* f ys f (xs ⁻¹) = f xs ⁻¹* f (assoc xs ys zs i) = assoc* (f xs) (f ys) (f zs) i f (comm xs ys i) = comm* (f xs) (f ys) i f (identityᵣ xs i) = identityᵣ* (f xs) i f (invᵣ xs i) = invᵣ* (f xs) i f (trunc xs ys p q i j) = isOfHLevel→isOfHLevelDep 2 trunc* (f xs) (f ys) (cong f p) (cong f q) (trunc xs ys p q) i j module ElimProp {B : FreeAbGroup A → Type ℓ'} (BProp : {xs : FreeAbGroup A} → isProp (B xs)) (⟦_⟧* : (x : A) → B ⟦ x ⟧) (ε* : B ε) (_·*_ : ∀ {x y} → B x → B y → B (x · y)) (_⁻¹* : ∀ {x} → B x → B (x ⁻¹)) where f : (xs : FreeAbGroup A) → B xs f = Elim.f ⟦_⟧* ε* _·*_ _⁻¹* (λ {x y z} xs ys zs → toPathP (BProp (transport (λ i → B (assoc x y z i)) (xs ·* (ys ·* zs))) ((xs ·* ys) ·* zs))) (λ {x y} xs ys → toPathP (BProp (transport (λ i → B (comm x y i)) (xs ·* ys)) (ys ·* xs))) (λ {x} xs → toPathP (BProp (transport (λ i → B (identityᵣ x i)) (xs ·* ε*)) xs)) (λ {x} xs → toPathP (BProp (transport (λ i → B (invᵣ x i)) (xs ·* (xs ⁻¹*))) ε*)) (λ _ → (isProp→isSet BProp)) module Rec {B : Type ℓ'} (BType : isSet B) (⟦_⟧* : (x : A) → B) (ε* : B) (_·*_ : B → B → B) (_⁻¹* : B → B) (assoc* : (x y z : B) → x ·* (y ·* z) ≡ (x ·* y) ·* z) (comm* : (x y : B) → x ·* y ≡ y ·* x) (identityᵣ* : (x : B) → x ·* ε* ≡ x) (invᵣ* : (x : B) → x ·* (x ⁻¹*) ≡ ε*) where f : FreeAbGroup A → B f = Elim.f ⟦_⟧* ε* _·*_ _⁻¹* assoc* comm* identityᵣ* invᵣ* (const BType)
libsrc/math/genmath/log10.asm
andydansby/z88dk-mk2
1
86940
<filename>libsrc/math/genmath/log10.asm ; Small C+ Math Library XLIB log10 LIB log LIB fmul ; .LOG10 CALL LOG LD BC,$7F5E ; 1/ln(10) LD IX,$5BD8 LD DE,$A938 JP FMUL
alloy4fun_models/trashltl/models/19/BoQk22mS65fbgdb95.als
Kaixi26/org.alloytools.alloy
0
1854
<filename>alloy4fun_models/trashltl/models/19/BoQk22mS65fbgdb95.als<gh_stars>0 open main pred idBoQk22mS65fbgdb95_prop20 { always all t: File | t not in Protected since t in Protected } pred __repair { idBoQk22mS65fbgdb95_prop20 } check __repair { idBoQk22mS65fbgdb95_prop20 <=> prop20o }
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1074.asm
ljhsiun2/medusa
9
87544
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x13f2e, %rdx nop nop nop dec %r13 movb $0x61, (%rdx) and $13881, %r13 lea addresses_UC_ht+0x1bebe, %rsi lea addresses_WT_ht+0x1172e, %rdi nop nop nop sub $12011, %rdx mov $26, %rcx rep movsq nop nop cmp $22753, %rdi lea addresses_UC_ht+0x852e, %rsi lea addresses_UC_ht+0x1b57e, %rdi cmp $116, %r11 mov $62, %rcx rep movsb nop nop nop and $14440, %r13 lea addresses_A_ht+0x1492e, %r11 nop nop xor %rdi, %rdi movw $0x6162, (%r11) nop nop nop nop nop cmp $50911, %rsi lea addresses_normal_ht+0x1dcc6, %rsi lea addresses_normal_ht+0xd802, %rdi nop dec %rbx mov $31, %rcx rep movsq nop nop dec %rbx lea addresses_UC_ht+0x10eae, %rsi lea addresses_D_ht+0x163de, %rdi clflush (%rdi) add $62052, %rdx mov $10, %rcx rep movsw cmp $6965, %r13 lea addresses_D_ht+0x14f2e, %r11 xor $48489, %rdx mov $0x6162636465666768, %rsi movq %rsi, %xmm1 and $0xffffffffffffffc0, %r11 vmovaps %ymm1, (%r11) inc %r11 lea addresses_WT_ht+0x18b2e, %rdi nop nop nop nop add %r11, %r11 movb $0x61, (%rdi) nop nop add $61578, %rdx lea addresses_D_ht+0x2c2e, %rdx nop nop inc %rsi mov (%rdx), %r11w nop nop add $45105, %rcx lea addresses_WC_ht+0x1ed2e, %rsi lea addresses_D_ht+0xdd2e, %rdi nop nop cmp %rbx, %rbx mov $25, %rcx rep movsl nop nop nop lfence lea addresses_A_ht+0x3ccc, %rsi lea addresses_A_ht+0x13a70, %rdi nop nop nop nop sub $27385, %r10 mov $11, %rcx rep movsw nop nop nop nop nop dec %rbx lea addresses_normal_ht+0x32e, %rsi lea addresses_WC_ht+0x1ddee, %rdi nop nop nop and %rdx, %rdx mov $48, %rcx rep movsq nop sub $50649, %rsi lea addresses_WC_ht+0x1822e, %rsi lea addresses_D_ht+0xf72e, %rdi nop nop nop and $48837, %r11 mov $10, %rcx rep movsb nop nop nop sub %r13, %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r15 push %rcx push %rdi push %rdx push %rsi // Store lea addresses_A+0x38ae, %r15 and $38441, %rsi mov $0x5152535455565758, %rdx movq %rdx, %xmm5 vmovups %ymm5, (%r15) nop nop and $24066, %r15 // REPMOV lea addresses_WT+0x552e, %rsi lea addresses_normal+0x18e2e, %rdi nop nop nop nop xor $39815, %r12 mov $5, %rcx rep movsb nop nop nop nop nop cmp %r15, %r15 // Faulty Load lea addresses_WT+0x552e, %rdi nop nop cmp %rdx, %rdx vmovups (%rdi), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $0, %xmm1, %r15 lea oracles, %r12 and $0xff, %r15 shlq $12, %r15 mov (%r12,%r15,1), %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %r15 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A', 'congruent': 7}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 7, 'type': 'addresses_normal'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 0, 'type': 'addresses_WT'}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 1, 'type': 'addresses_A_ht', 'congruent': 9}, 'OP': 'STOR'} {'dst': {'same': True, 'congruent': 9, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}} {'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_UC_ht'}} {'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_A_ht', 'congruent': 8}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}} {'dst': {'same': True, 'congruent': 2, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_UC_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 9}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 8}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D_ht', 'congruent': 6}} {'dst': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}} {'dst': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}} {'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}} {'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}} {'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 */
source/amf/mof/amf-internals-amf_uri_stores.ads
svn2github/matreshka
24
28071
<filename>source/amf/mof/amf-internals-amf_uri_stores.ads ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Containers.Hashed_Maps; with League.Holders; with League.Strings.Hash; with AMF.CMOF.Associations; with AMF.CMOF.Classes; with AMF.CMOF.Data_Types; with AMF.CMOF.Packages.Collections; with AMF.Elements; with AMF.Factories; with AMF.Internals.AMF_URI_Extents; with AMF.Links; with AMF.URI_Stores; package AMF.Internals.AMF_URI_Stores is package String_Factory_Maps is new Ada.Containers.Hashed_Maps (League.Strings.Universal_String, AMF.Factories.Factory_Access, League.Strings.Hash, League.Strings."=", AMF.Factories."="); type AMF_URI_Store is limited new AMF.Internals.AMF_URI_Extents.AMF_URI_Extent and AMF.URI_Stores.URI_Store with record Factories : String_Factory_Maps.Map; end record; ---------------------------- -- Factory's operations -- ---------------------------- overriding function Create (Self : not null access AMF_URI_Store; Meta_Class : not null access AMF.CMOF.Classes.CMOF_Class'Class) return not null AMF.Elements.Element_Access; -- Creates an element that is an instance of the metaClass. -- Object::metaClass == metaClass and metaClass.isInstance(object) == true. -- -- All properties of the element are considered unset. The values are the -- same as if object.unset(property) was invoked for every property. -- -- Returns null if the creation cannot be performed. Classes with abstract -- = true always return null. -- -- The created element’s metaClass == metaClass. -- -- Exception: NullPointerException if class is null. -- -- Exception: IllegalArgumentException if class is not a member of the -- package returned by getPackage(). -- -- Constraints -- -- The following conditions on metaClass: Class and all its Properties must -- be satisfied before the metaClass: Class can be instantiated. If these -- requirements are not met, create() throws exceptions as described above. -- -- [1] Meta object must be set. -- -- [2] Name must be 1 or more characters. -- -- [3] Property type must be set. -- -- [4] Property: 0 <= LowerBound <= UpperBound required. -- -- [5] Property: 1 <= UpperBound required. -- -- [6] Enforcement of read-only properties is optional in EMOF. -- -- [8] Properties of type Class cannot have defaults. -- -- [9] Multivalued properties cannot have defaults. -- -- [10] Property: Container end must not have upperBound >1, a property can -- only be contained in one container. -- -- [11] Property: Only one end may be composite. -- -- [12] Property: Bidirectional opposite ends must reference each other. -- -- [13] Property and DataType: Default value must match type. Items 3-13 -- apply to all Properties of the Class. -- -- These conditions also apply to all superclasses of the class being -- instantiated. overriding function Create_Link (Self : not null access AMF_URI_Store; Association : not null access AMF.CMOF.Associations.CMOF_Association'Class; First_Element : not null AMF.Elements.Element_Access; Second_Element : not null AMF.Elements.Element_Access) return not null AMF.Links.Link_Access; -- This creates a Link from 2 supplied Elements that is an instance of the -- supplied Association. The firstElement is associated with the first end -- (the properties comprising the association ends are ordered) and must -- conform to its type. And correspondingly for the secondElement. overriding function Create_From_String (Self : not null access AMF_URI_Store; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Image : League.Strings.Universal_String) return League.Holders.Holder; -- Creates an Object initialized from the value of the String. Returns null -- if the creation cannot be performed. -- -- The format of the String is defined by the XML Schema SimpleType -- corresponding to that datatype. -- -- Exception: NullPointerException if datatype is null. -- -- Exception: IllegalArgumentException if datatype is not a member of the -- package returned by getPackage(). overriding function Convert_To_String (Self : not null access AMF_URI_Store; Data_Type : not null access AMF.CMOF.Data_Types.CMOF_Data_Type'Class; Value : League.Holders.Holder) return League.Strings.Universal_String; -- Creates a String representation of the object. Returns null if the -- creation cannot be performed. The format of the String is defined by the -- XML Schema SimpleType corresponding to that dataType. -- -- Exception: IllegalArgumentException if datatype is not a member of the -- package returned by getPackage() or the supplied object is not a valid -- instance of that datatype. overriding function Get_Package (Self : not null access constant AMF_URI_Store) return AMF.CMOF.Packages.Collections.Set_Of_CMOF_Package; -- Returns the package this is a factory for. -------------------------- -- Store's operations -- -------------------------- overriding function Get_Factory (Self : not null access AMF_URI_Store; Metamodel_URI : League.Strings.Universal_String) return AMF.Factories.Factory_Access; -- Returns factory for the specified URI of metamodel. overriding function Get_Id (Self : not null access AMF_URI_Store; Element : not null AMF.Elements.Element_Access) return League.Strings.Universal_String; -- Returns identifier of the element inside the extent. overriding procedure Set_Id (Self : not null access AMF_URI_Store; Element : not null AMF.Elements.Element_Access; Id : League.Strings.Universal_String); -- Sets identifier of the element inside the extent. end AMF.Internals.AMF_URI_Stores;
src/test/resources/data/generationtests/glass-macro.asm
cpcitor/mdlz80optimizer
36
90572
<reponame>cpcitor/mdlz80optimizer<filename>src/test/resources/data/generationtests/glass-macro.asm<gh_stars>10-100 org 100H RAM_PAGE0: ds 3F00H RAM_PAGE1: ds 4000H TPA_PAGE0: equ RAM_PAGE0 TPA_PAGE1: equ RAM_PAGE1 RAM: equ RAM_PAGE1 Application: MACRO frame: dw 0 image: dw 0 altImage: dw 0 ENDM SECTION TPA_PAGE0 ld ix,Application_instance push ix loop: jr loop ENDS SECTION RAM Application_instance: Application ENDS
programs/oeis/080/A080799.asm
neoneye/loda
22
85430
; A080799: Number of divide by 2 and add 1 operations required to reach ...,7,8,4,2,1 when started at n. ; 6,5,8,7,7,6,10,9,9,8,9,8,8,7,12,11,11,10,11,10,10,9,11,10,10,9,10,9,9,8,14,13,13,12,13,12,12,11,13,12,12,11,12,11,11,10,13,12,12,11,12,11,11,10,12,11,11,10,11,10,10,9,16,15,15,14,15,14,14,13,15,14,14,13,14,13,13 mov $2,$0 add $0,6 lpb $0 div $0,2 add $1,$0 add $0,2 lpe sub $1,$2 add $1,1 mov $0,$1
maa.g4
juaristi/jmaa
0
3473
/* Grammar file for the MAA language. */ grammar maa; assignment_closure: assignment_closure ';' | assignment_closure EOF | assignment_closure ';' assignment_closure | assignment_closure ';' assignment_closure EOF | VAR '=' '{' selector_closure '}' {System.out.println("Entered variable: " + $VAR.text);} | VAR '=' '{' '}' {System.out.println("Entered empty variable: " + $VAR.text);} ; selector_closure : selector_closure ';' | selector_closure ';' selector_closure | SEL '{' selector_closure '}' {System.out.println("Entered selector: " + $SEL.text);} | SEL '{' '}' {System.out.println("Entered empty selector: " + $SEL.text);} ; VAR : [a-zA-Z0-9_]+ ; SEL : '"' [a-zA-Z0-9\-\._\t ]* '"' ; NL : [\r\n]+ -> skip ; WS : [ \t]+ -> channel(HIDDEN) ;
programs/oeis/132/A132731.asm
neoneye/loda
22
175080
; A132731: Triangle T(n,k) = 2 * binomial(n,k) - 2 with T(n,0) = T(n,n) = 1, read by rows. ; 1,1,1,1,2,1,1,4,4,1,1,6,10,6,1,1,8,18,18,8,1,1,10,28,38,28,10,1,1,12,40,68,68,40,12,1,1,14,54,110,138,110,54,14,1,1,16,70,166,250,250,166,70,16,1,1,18,88,238,418,502,418,238,88,18,1,1,20,108,328,658,922,922,658,328,108,20,1,1,22,130,438,988,1582,1846,1582,988,438,130,22,1,1,24,154,570,1428,2572,3430,3430,2572 seq $0,28326 ; Twice Pascal's triangle A007318: T(n,k) = 2*C(n,k). trn $0,3 add $0,1
src/rejuvenation-node_locations.adb
TNO/Rejuvenation-Ada
1
11662
<filename>src/rejuvenation-node_locations.adb with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Langkit_Support.Text; use Langkit_Support.Text; package body Rejuvenation.Node_Locations is -- We postulate that a ghost node is not surrounded by trivia. -- A ghost node has a range from X to X-1, -- where X is the start position of the next token. -- The Text corresponding to a ghost node is, of couse, the empty string. -- See also https://gt3-prod-2.adacore.com/#/tickets/UA12-003 function Node_Start_Offset (Node : Ada_Node'Class) return Positive with Pre => not Is_Ghost (Node); function Node_Start_Offset (Node : Ada_Node'Class) return Positive is begin return Raw_Data (Node.Token_Start).Source_First; end Node_Start_Offset; function Line_Start_Offset (Node : Ada_Node'Class) return Positive with Pre => not Is_Ghost (Node); function Line_Start_Offset (Node : Ada_Node'Class) return Positive is function Line_Start_Offset (Token : Token_Reference; Offset : Integer) return Integer; -- In Ada comment is ended by a line feed -- So a token cannot be preceeded by a comment on the same line function Line_Start_Offset (Token : Token_Reference; Offset : Integer) return Integer is begin if Token /= No_Token and then Kind (Data (Token)) = Ada_Whitespace then declare Token_Text : constant String := Encode (Text (Token), Node.Unit.Get_Charset); Pos : constant Natural := Index (Token_Text, (1 => ASCII.LF), Going => Backward); begin if Pos = 0 then return Line_Start_Offset (Previous (Token), Offset - Token_Text'Length); else return Raw_Data (Token).Source_First + Pos + 1 - Token_Text'First; end if; end; else return Offset; end if; end Line_Start_Offset; begin return Line_Start_Offset (Previous (Node.Token_Start), Node_Start_Offset (Node)); end Line_Start_Offset; function Trivia_Start_Offset (Node : Ada_Node'Class) return Positive with Pre => not Is_Ghost (Node); function Trivia_Start_Offset (Node : Ada_Node'Class) return Positive is function Trivia_Start_Offset (Token : Token_Reference; Nr : Integer) return Integer; function Trivia_Start_Offset (Token : Token_Reference; Nr : Integer) return Integer is begin if Token /= No_Token and then Kind (Data (Token)) in Ada_Whitespace | Ada_Comment then return Trivia_Start_Offset (Previous (Token), Raw_Data (Token).Source_First); else return Nr; end if; end Trivia_Start_Offset; begin return Trivia_Start_Offset (Previous (Node.Token_Start), Node_Start_Offset (Node)); end Trivia_Start_Offset; function Start_Offset (Node : Ada_Node'Class; Before : Node_Location := No_Trivia) return Positive is begin if Is_Ghost (Node) then return Raw_Data (Node.Token_Start).Source_First; else case Before is when No_Trivia => return Node_Start_Offset (Node); when Trivia_On_Same_Line => return Line_Start_Offset (Node); when All_Trivia => return Trivia_Start_Offset (Node); end case; end if; end Start_Offset; function Node_End_Offset (Node : Ada_Node'Class) return Natural with Pre => not Is_Ghost (Node); function Node_End_Offset (Node : Ada_Node'Class) return Natural is begin return Raw_Data (Node.Token_End).Source_Last; end Node_End_Offset; function Line_End_Offset (Node : Ada_Node'Class) return Natural with Pre => not Is_Ghost (Node); function Line_End_Offset (Node : Ada_Node'Class) return Natural is function Line_End_Offset (Token : Token_Reference; Offset : Integer) return Integer; function Line_End_Offset (Token : Token_Reference; Offset : Integer) return Integer is begin if Token /= No_Token and then Kind (Data (Token)) in Ada_Whitespace | Ada_Comment then declare Token_Text : constant String := Encode (Text (Token), Node.Unit.Get_Charset); Pos : constant Natural := Index (Token_Text, (1 => ASCII.LF)); begin if Pos = 0 then return Line_End_Offset (Next (Token), Offset + Token_Text'Length); else return Raw_Data (Token).Source_First + Pos - Token_Text'First; end if; end; else return Offset; end if; end Line_End_Offset; begin return Line_End_Offset (Next (Node.Token_End), Node_End_Offset (Node)); end Line_End_Offset; function Trivia_End_Offset (Node : Ada_Node'Class) return Natural with Pre => not Is_Ghost (Node); function Trivia_End_Offset (Node : Ada_Node'Class) return Natural is function Trivia_End_Offset (Token : Token_Reference; Nr : Natural) return Natural; function Trivia_End_Offset (Token : Token_Reference; Nr : Natural) return Natural is begin if Token /= No_Token and then Kind (Data (Token)) in Ada_Whitespace | Ada_Comment then return Trivia_End_Offset (Next (Token), Raw_Data (Token).Source_Last); else return Nr; end if; end Trivia_End_Offset; begin return Trivia_End_Offset (Next (Node.Token_End), Node_End_Offset (Node)); end Trivia_End_Offset; function End_Offset (Node : Ada_Node'Class; After : Node_Location := No_Trivia) return Natural is begin if Is_Ghost (Node) then return Raw_Data (Node.Token_Start).Source_First - 1; else case After is when No_Trivia => return Node_End_Offset (Node); when Trivia_On_Same_Line => return Line_End_Offset (Node); when All_Trivia => return Trivia_End_Offset (Node); end case; end if; end End_Offset; end Rejuvenation.Node_Locations;
codec/decoder/core/asm/mb_copy.asm
TechSmith/openh264
1
92485
;*! ;* \copy ;* Copyright (c) 2009-2013, Cisco Systems ;* All rights reserved. ;* ;* Redistribution and use in source and binary forms, with or without ;* modification, are permitted provided that the following conditions ;* are met: ;* ;* * Redistributions of source code must retain the above copyright ;* notice, this list of conditions and the following disclaimer. ;* ;* * Redistributions in binary form must reproduce the above copyright ;* notice, this list of conditions and the following disclaimer in ;* the documentation and/or other materials provided with the ;* distribution. ;* ;* 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. ;* ;* ;* mb_copy.asm ;* ;* Abstract ;* mb_copy and mb_copy1 ;* ;* History ;* 15/09/2009 Created ;* 12/28/2009 Modified with larger throughput ;* 12/29/2011 Tuned WelsCopy16x16NotAligned_sse2, added UpdateMbMv_sse2 WelsCopy16x8NotAligned_sse2, ;* WelsCopy16x8_mmx, WelsCopy8x16_mmx etc; ;* ;* ;*********************************************************************************************/ %include "asm_inc.asm" BITS 32 ;******************************************************************************* ; Macros and other preprocessor constants ;******************************************************************************* ;******************************************************************************* ; Local Data (Read Only) ;******************************************************************************* ;SECTION .rodata data align=16 ;******************************************************************************* ; Various memory constants (trigonometric values or rounding values) ;******************************************************************************* ALIGN 16 ;******************************************************************************* ; Code ;******************************************************************************* SECTION .text WELS_EXTERN PixelAvgWidthEq4_mmx WELS_EXTERN PixelAvgWidthEq8_mmx WELS_EXTERN PixelAvgWidthEq16_sse2 WELS_EXTERN McCopyWidthEq4_mmx WELS_EXTERN McCopyWidthEq8_mmx WELS_EXTERN McCopyWidthEq16_sse2 ALIGN 16 ;******************************************************************************* ; void_t PixelAvgWidthEq4_mmx( uint8_t *pDst, int iDstStride, ; uint8_t *pSrcA, int iSrcAStride, ; uint8_t *pSrcB, int iSrcBStride, ; int iHeight ); ;******************************************************************************* PixelAvgWidthEq4_mmx: push esi push edi push ebp push ebx mov edi, [esp+20] ; pDst mov eax, [esp+24] ; iDstStride mov esi, [esp+28] ; pSrcA mov ecx, [esp+32] ; iSrcAStride mov ebp, [esp+36] ; pSrcB mov edx, [esp+40] ; iSrcBStride mov ebx, [esp+44] ; iHeight ALIGN 4 .height_loop: movd mm0, [ebp] pavgb mm0, [esi] movd [edi], mm0 dec ebx lea edi, [edi+eax] lea esi, [esi+ecx] lea ebp, [ebp+edx] jne .height_loop WELSEMMS pop ebx pop ebp pop edi pop esi ret ALIGN 16 ;******************************************************************************* ; void_t PixelAvgWidthEq8_mmx( uint8_t *pDst, int iDstStride, ; uint8_t *pSrcA, int iSrcAStride, ; uint8_t *pSrcB, int iSrcBStride, ; int iHeight ); ;******************************************************************************* PixelAvgWidthEq8_mmx: push esi push edi push ebp push ebx mov edi, [esp+20] ; pDst mov eax, [esp+24] ; iDstStride mov esi, [esp+28] ; pSrcA mov ecx, [esp+32] ; iSrcAStride mov ebp, [esp+36] ; pSrcB mov edx, [esp+40] ; iSrcBStride mov ebx, [esp+44] ; iHeight ALIGN 4 .height_loop: movq mm0, [esi] pavgb mm0, [ebp] movq [edi], mm0 movq mm0, [esi+ecx] pavgb mm0, [ebp+edx] movq [edi+eax], mm0 lea esi, [esi+2*ecx] lea ebp, [ebp+2*edx] lea edi, [edi+2*eax] sub ebx, 2 jnz .height_loop WELSEMMS pop ebx pop ebp pop edi pop esi ret ALIGN 16 ;******************************************************************************* ; void_t PixelAvgWidthEq16_sse2( uint8_t *pDst, int iDstStride, ; uint8_t *pSrcA, int iSrcAStride, ; uint8_t *pSrcB, int iSrcBStride, ; int iHeight ); ;******************************************************************************* PixelAvgWidthEq16_sse2: push esi push edi push ebp push ebx mov edi, [esp+20] ; pDst mov eax, [esp+24] ; iDstStride mov esi, [esp+28] ; pSrcA mov ecx, [esp+32] ; iSrcAStride mov ebp, [esp+36] ; pSrcB mov edx, [esp+40] ; iSrcBStride mov ebx, [esp+44] ; iHeight ALIGN 4 .height_loop: movdqu xmm0, [esi] pavgb xmm0, [ebp] movdqu [edi], xmm0 movdqu xmm0, [esi+ecx] pavgb xmm0, [ebp+edx] movdqu [edi+eax], xmm0 movdqu xmm0, [esi+2*ecx] pavgb xmm0, [ebp+2*edx] movdqu [edi+2*eax], xmm0 lea esi, [esi+2*ecx] lea ebp, [ebp+2*edx] lea edi, [edi+2*eax] movdqu xmm0, [esi+ecx] pavgb xmm0, [ebp+edx] movdqu [edi+eax], xmm0 lea esi, [esi+2*ecx] lea ebp, [ebp+2*edx] lea edi, [edi+2*eax] sub ebx, 4 jne .height_loop WELSEMMS pop ebx pop ebp pop edi pop esi ret ALIGN 16 ;******************************************************************************* ; void_t McCopyWidthEq4_mmx( uint8_t *pSrc, int iSrcStride, ; uint8_t *pDst, int iDstStride, int iHeight ) ;******************************************************************************* McCopyWidthEq4_mmx: push esi push edi push ebx mov esi, [esp+16] mov eax, [esp+20] mov edi, [esp+24] mov ecx, [esp+28] mov edx, [esp+32] ALIGN 4 .height_loop: mov ebx, [esi] mov [edi], ebx add esi, eax add edi, ecx dec edx jnz .height_loop WELSEMMS pop ebx pop edi pop esi ret ALIGN 16 ;******************************************************************************* ; void_t McCopyWidthEq8_mmx( uint8_t *pSrc, int iSrcStride, ; uint8_t *pDst, int iDstStride, int iHeight ) ;******************************************************************************* McCopyWidthEq8_mmx: push esi push edi mov esi, [esp+12] mov eax, [esp+16] mov edi, [esp+20] mov ecx, [esp+24] mov edx, [esp+28] ALIGN 4 .height_loop: movq mm0, [esi] movq [edi], mm0 add esi, eax add edi, ecx dec edx jnz .height_loop WELSEMMS pop edi pop esi ret ALIGN 16 ;******************************************************************************* ; void_t McCopyWidthEq16_sse2( uint8_t *pSrc, int iSrcStride, uint8_t *pDst, int iDstStride, int iHeight ) ;******************************************************************************* ;read unaligned memory %macro SSE_READ_UNA 2 movq %1, [%2] movhps %1, [%2+8] %endmacro ;write unaligned memory %macro SSE_WRITE_UNA 2 movq [%1], %2 movhps [%1+8], %2 %endmacro McCopyWidthEq16_sse2: push esi push edi mov esi, [esp+12] ; pSrc mov eax, [esp+16] ; iSrcStride mov edi, [esp+20] ; pDst mov edx, [esp+24] ; iDstStride mov ecx, [esp+28] ; iHeight ALIGN 4 .height_loop: SSE_READ_UNA xmm0, esi SSE_READ_UNA xmm1, esi+eax SSE_WRITE_UNA edi, xmm0 SSE_WRITE_UNA edi+edx, xmm1 sub ecx, 2 lea esi, [esi+eax*2] lea edi, [edi+edx*2] jnz .height_loop pop edi pop esi ret
programs/oeis/212/A212804.asm
neoneye/loda
22
1005
; A212804: Expansion of (1 - x)/(1 - x - x^2). ; 1,0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,165580141,267914296,433494437,701408733,1134903170,1836311903,2971215073,4807526976,7778742049,12586269025,20365011074,32951280099,53316291173,86267571272,139583862445,225851433717,365435296162,591286729879,956722026041,1548008755920,2504730781961,4052739537881,6557470319842,10610209857723,17167680177565,27777890035288,44945570212853,72723460248141,117669030460994,190392490709135,308061521170129,498454011879264,806515533049393,1304969544928657,2111485077978050,3416454622906707,5527939700884757,8944394323791464,14472334024676221,23416728348467685,37889062373143906,61305790721611591,99194853094755497,160500643816367088,259695496911122585,420196140727489673,679891637638612258,1100087778366101931,1779979416004714189,2880067194370816120,4660046610375530309,7540113804746346429,12200160415121876738,19740274219868223167,31940434634990099905,51680708854858323072,83621143489848422977,135301852344706746049 mov $1,1 lpb $0 sub $0,1 mov $3,$1 mov $1,$2 add $2,$3 lpe mov $0,$1
alloy4fun_models/trashltl/models/15/YXBnQi99CZHGCwMzg.als
Kaixi26/org.alloytools.alloy
0
4719
open main pred idYXBnQi99CZHGCwMzg_prop16 { always historically Protected = Protected' } pred __repair { idYXBnQi99CZHGCwMzg_prop16 } check __repair { idYXBnQi99CZHGCwMzg_prop16 <=> prop16o }
src/adacar-entrada_salida.adb
Asier98/AdaCar
0
24204
with AdaCar.Parametros; package body AdaCar.Entrada_Salida is ----------------------- -- Entrada_Salida_PO -- ----------------------- protected Entrada_Salida_PO with Priority => Parametros.Techo_Entrada_Salida_PO is procedure Init_System; function Lectura_Digital(Canal: Canal_DI) return Estado_Digital; procedure Salida_Digital(Canal: Canal_DO; Valor: Estado_Digital); procedure Comienza_Analogico (Canal : Canal_AI); function Lectura_Analogico (Canal : Canal_AI) return Unidades_AI; end Entrada_Salida_PO; ----------------- -- Init_System -- ----------------- procedure Init_System is begin Entrada_Salida_PO.Init_System; end Init_System; --------------------- -- Lectura_Digital -- --------------------- function Lectura_Digital (Canal : Canal_DI) return Estado_Digital is begin return Entrada_Salida_PO.Lectura_Digital(Canal); end Lectura_Digital; -------------------- -- Salida_Digital -- -------------------- procedure Salida_Digital (Canal : Canal_DO; Valor : Estado_Digital) is begin Entrada_Salida_PO.Salida_Digital(Canal,Valor); end Salida_Digital; ------------------------- -- Configura_Analogico -- ------------------------- procedure Comienza_Analogico (Canal : Canal_AI) is begin Entrada_Salida_PO.Comienza_Analogico(Canal); end Comienza_Analogico; ----------------------- -- Lectura_Analogico -- ----------------------- function Lectura_Analogico (Canal : Canal_AI) return Unidades_AI is begin return Entrada_Salida_PO.Lectura_Analogico(Canal); end Lectura_Analogico; ----------------------- -- Entrada_Salida_PO -- ----------------------- protected body Entrada_Salida_PO is procedure Init_System is begin Digital.Configure_Pin(Pin_D2,Input); Digital.Configure_Pin(Pin_D3,Input); Digital.Configure_Pin(Pin_D4,Input); Digital.Configure_Pin(Pin_D5,Input); Digital.Configure_Pin(Pin_D6,Input); Digital.Configure_Pin(Pin_D7,Input); Digital.Configure_Pin(Pin_D8,Output); Digital.Configure_Pin(Pin_D9,Output); Digital.Configure_Pin(Pin_D10,Output); Digital.Configure_Pin(Pin_D11,Output); Digital.Configure_Pin(Pin_D12,Output); Digital.Configure_Pin(Pin_D13,Output); Digital.Set_Signal(Pin_D8,LOW); Digital.Set_Signal(Pin_D9,LOW); Digital.Set_Signal(Pin_D10,LOW); Digital.Set_Signal(Pin_D11,LOW); Digital.Set_Signal(Pin_D12,LOW); Digital.Set_Signal(Pin_D13,LOW); Analog.Configure_Pin(Pin_A0); Analog.Configure_Pin(Pin_A1); Analog.Configure_Pin(Pin_A2); end Init_System; function Lectura_Digital(Canal: Canal_DI) return Estado_Digital is Valor: Signal_Mode; begin Valor:= Digital.Read_Signal(Canal); case Valor is when LOW => return Estado_Digital'(0); when HIGH => return Estado_Digital'(1); end case; end Lectura_Digital; procedure Salida_Digital(Canal: Canal_DO; Valor: Estado_Digital) is begin case Valor is when 0 => Digital.Set_Signal(Canal,LOW); when 1 => Digital.Set_Signal(Canal,HIGH); end case; end Salida_Digital; procedure Comienza_Analogico (Canal : Canal_AI) is begin Analog.Start_Adquisition(Canal); end Comienza_Analogico; function Lectura_Analogico (Canal : Canal_AI) return Unidades_AI is begin return Unidades_AI(Analog.Get_Value(Canal)); end Lectura_Analogico; end Entrada_Salida_PO; end AdaCar.Entrada_Salida;
VMultiplayer/Assembly.asm
MedAnisBenSalah/VMultiplayer
1
161400
<filename>VMultiplayer/Assembly.asm IFDEF RAX ; 64 bit assembly section .DATA .CODE GetCaller PROC mov RAX, [RSP+RCX] ret GetCaller ENDP GetTEB PROC MOV RAX, gs:[58h] MOV RAX, [RAX + RCX * 8] ret GetTEB ENDP SHUFPS_55 PROC SHUFPS XMM0, XMM1, 85 ret SHUFPS_55 ENDP SHUFPS_AA PROC SHUFPS XMM0, XMM1, 170 ret SHUFPS_AA ENDP SHUFPS_FF PROC SHUFPS XMM0, XMM1, 255 ret SHUFPS_FF ENDP ENDIF END
programs/oeis/084/A084100.asm
neoneye/loda
22
29447
; A084100: Expansion of (1+x-x^2-x^3)/(1+x^2). ; 1,1,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,2,-2 div $0,2 add $0,2 mov $1,-1 pow $1,$0 mul $1,2 dif $1,$0 mov $0,$1
u7-common/patch-eop-getItemZ.asm
JohnGlassmyer/UltimaHacks
68
179025
<filename>u7-common/patch-eop-getItemZ.asm [bits 16] startPatch EXE_LENGTH, eop-getItemZ startBlockAt addr_eop_getItemZ push bp mov bp, sp ; bp-based stack frame: %assign arg_ibo 0x04 %assign ____callerIp 0x02 %assign ____callerBp 0x00 %assign var_zAndStuff -0x02 add sp, var_zAndStuff push esi push edi lea ax, [bp+arg_ibo] push ax push ss lea ax, [bp+var_zAndStuff] push ax callFromOverlay getItemZAndStuff add sp, 6 movzx ax, [bp+var_zAndStuff] and ax, 0xF0 shr ax, 4 pop edi pop esi mov sp, bp pop bp retn endBlockAt off_eop_getItemZ_end endPatch
Data/Num/Sandbox/Binary.agda
banacorn/numeral
1
6416
module Data.Num.Binary where -- open import Data.Product using (_×_; Σ; _,_) open import Data.List open import Data.Unit open import Data.Empty -- open import Data.Nat renaming (_+_ to _⊹_) -- -- data Bin : Set where -- [] : Bin -- 0- : Bin → Bin -- 1- : Bin → Bin -- -- carry : Bin → Bin -- carry [] = 1- [] -- carry (0- xs) = 1- xs -- carry (1- xs) = 0- (carry xs) -- -- _+_ : Bin → Bin → Bin -- [] + ys = ys -- xs + [] = xs -- 0- xs + 0- ys = 0- (xs + ys) -- 0- xs + 1- ys = 1- (xs + ys) -- 1- xs + 0- ys = 1- (xs + ys) -- 1- xs + 1- ys = 0- (carry (xs + ys)) -- -- data Desc : Set₁ where -- arg : (A : Set) -- a bag of tags to choose constructors with -- → (A → Desc) -- given a tag, return the description of the constructor it corresponds to -- → Desc -- rec : Desc → Desc -- recursive subnode -- ret : Desc -- stop -- -- -- the "decoder", "interpreter" -- -- ⟦_⟧ : Desc → Set → Set -- -- ⟦ arg A D ⟧ R = Σ A (λ a → ⟦ D a ⟧ R) -- -- ⟦ rec D ⟧ R = R × ⟦ D ⟧ R -- -- ⟦ ret ⟧ R = ⊤ -- data BinF : Set where -- arg : (ℕ → BinF) → BinF -- rec : BinF → BinF -- ret : BinF -- -- ⟦_⟧ : BinF → Set → Set -- ⟦_⟧ (arg F) X = Σ ℕ (λ n → ⟦ F n ⟧ X) -- ⟦_⟧ (rec F) X = X × ⟦ F ⟧ X -- ⟦_⟧ ret X = ⊤ -- -- data μ (F : BinF) : Set where -- ⟨_⟩ : ⟦ F ⟧ (μ F) → μ F -- -- Bin : Set -- Bin = μ (arg {! λ !}) -- -- data Digit : Set where -- [0] : Digit -- [1] : Digit -- -- Binary : Set -- Binary = List Digit -- -- _⊕_ : Digit → Digit → Digit -- [0] ⊕ [0] = [0] -- [0] ⊕ [1] = [1] -- [1] ⊕ [0] = [1] -- [1] ⊕ [1] = [0] -- -- _⊚_ : Digit → Digit → Digit -- [1] ⊚ [1] = [1] -- _ ⊚ _ = [0] -- -- carry : Digit → Binary → Binary -- carry [0] ys = ys -- carry [1] [] = [1] ∷ [] -- carry [1] ([0] ∷ ys) = [1] ∷ ys -- carry [1] ([1] ∷ ys) = [0] ∷ carry [1] ys -- -- _+_ : Binary → Binary → Binary -- [] + ys = ys -- xs + [] = xs -- (x ∷ xs) + (y ∷ ys) = x ⊕ y ∷ carry (x ⊚ y) (xs + ys) -- -- _≈_ : Binary → Binary → Set -- [] ≈ [] = ⊤ -- [] ≈ (y ∷ ys) = ⊥ -- (x ∷ xs) ≈ [] = ⊥ -- ([0] ∷ xs) ≈ ([0] ∷ ys) = xs ≈ ys -- ([0] ∷ xs) ≈ ([1] ∷ ys) = ⊥ -- ([1] ∷ xs) ≈ ([0] ∷ ys) = ⊥ -- ([1] ∷ xs) ≈ ([1] ∷ ys) = xs ≈ ys data Bin : Set where ∙ : Bin [0]_ : Bin → Bin [1]_ : Bin → Bin two : Bin two = [1] [0] ∙ 1+ : Bin → Bin 1+ ∙ = [1] ∙ 1+ ([0] x) = [1] x 1+ ([1] x) = [0] 1+ x _+_ : Bin → Bin → Bin ∙ + ys = ys xs + ∙ = xs ([0] xs) + ([0] ys) = [0] (xs + ys) ([0] xs) + ([1] ys) = [1] (xs + ys) ([1] xs) + ([0] ys) = [1] (xs + ys) ([1] xs) + ([1] ys) = [0] (1+ (xs + ys))
src/static/antlr4/grammars/Template.g4
jlenoble/ecmascript-parser
0
1154
<reponame>jlenoble/ecmascript-parser /* Source: ECMAScript® 2018 Language Specification - Annex A-1 and A-2 */ lexer grammar Template; // TemplateHead:: // ` TemplateCharacters[opt] ${ TemplateHead : '`' TemplateCharacter*? '${' ; // TemplateMiddle:: // } TemplateCharacters[opt] ${ TemplateMiddle : '}' TemplateCharacter*? '${' ; // TemplateTail:: // } TemplateCharacters[opt] ` TemplateTail : '}' TemplateCharacter*? '`' ; // NoSubstitutionTemplate:: // ` TemplateCharacters[opt] ` NoSubstitutionTemplate : '`' TemplateCharacter*? '`' ; // TemplateCharacters:: // TemplateCharacter TemplateCharacters[opt] // TemplateCharacter:: // $ [lookahead ≠ {] // \ EscapeSequence // LineContinuation // LineTerminatorSequence // SourceCharacter but not one of ` or \ or $ or LineTerminator fragment TemplateCharacter : ('$'|'\\' EscapeSequence|LineContinuation|LineTerminatorSequence |~[`\\$\n\r\u2028\u2029]) ;
alloy4fun_models/trainstlt/models/1/CYLKy4ExqbErg4ozc.als
Kaixi26/org.alloytools.alloy
0
3200
open main pred idCYLKy4ExqbErg4ozc_prop2 { eventually(all t:Track | eventually t.signal = Green) } pred __repair { idCYLKy4ExqbErg4ozc_prop2 } check __repair { idCYLKy4ExqbErg4ozc_prop2 <=> prop2o }
arch/ARM/Nordic/svd/nrf52/nrf_svd-twim.ads
rocher/Ada_Drivers_Library
192
6366
-- Copyright (c) 2010 - 2018, Nordic Semiconductor ASA -- -- 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, except as embedded into a Nordic -- Semiconductor ASA integrated circuit in a product or a software update for -- such product, 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 Nordic Semiconductor ASA nor the names of its -- contributors may be used to endorse or promote products derived from this -- software without specific prior written permission. -- -- 4. This software, with or without modification, must only be used with a -- Nordic Semiconductor ASA integrated circuit. -- -- 5. Any software provided in binary form under this license must not be reverse -- engineered, decompiled, modified and/or disassembled. -- -- THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS -- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -- OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE -- DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- This spec has been automatically generated from nrf52.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package NRF_SVD.TWIM is pragma Preelaborate; --------------- -- Registers -- --------------- -- Shortcut between LASTTX event and STARTRX task type SHORTS_LASTTX_STARTRX_Field is (-- Disable shortcut Disabled, -- Enable shortcut Enabled) with Size => 1; for SHORTS_LASTTX_STARTRX_Field use (Disabled => 0, Enabled => 1); -- Shortcut between LASTTX event and SUSPEND task type SHORTS_LASTTX_SUSPEND_Field is (-- Disable shortcut Disabled, -- Enable shortcut Enabled) with Size => 1; for SHORTS_LASTTX_SUSPEND_Field use (Disabled => 0, Enabled => 1); -- Shortcut between LASTTX event and STOP task type SHORTS_LASTTX_STOP_Field is (-- Disable shortcut Disabled, -- Enable shortcut Enabled) with Size => 1; for SHORTS_LASTTX_STOP_Field use (Disabled => 0, Enabled => 1); -- Shortcut between LASTRX event and STARTTX task type SHORTS_LASTRX_STARTTX_Field is (-- Disable shortcut Disabled, -- Enable shortcut Enabled) with Size => 1; for SHORTS_LASTRX_STARTTX_Field use (Disabled => 0, Enabled => 1); -- Shortcut between LASTRX event and STOP task type SHORTS_LASTRX_STOP_Field is (-- Disable shortcut Disabled, -- Enable shortcut Enabled) with Size => 1; for SHORTS_LASTRX_STOP_Field use (Disabled => 0, Enabled => 1); -- Shortcut register type SHORTS_Register is record -- unspecified Reserved_0_6 : HAL.UInt7 := 16#0#; -- Shortcut between LASTTX event and STARTRX task LASTTX_STARTRX : SHORTS_LASTTX_STARTRX_Field := NRF_SVD.TWIM.Disabled; -- Shortcut between LASTTX event and SUSPEND task LASTTX_SUSPEND : SHORTS_LASTTX_SUSPEND_Field := NRF_SVD.TWIM.Disabled; -- Shortcut between LASTTX event and STOP task LASTTX_STOP : SHORTS_LASTTX_STOP_Field := NRF_SVD.TWIM.Disabled; -- Shortcut between LASTRX event and STARTTX task LASTRX_STARTTX : SHORTS_LASTRX_STARTTX_Field := NRF_SVD.TWIM.Disabled; -- unspecified Reserved_11_11 : HAL.Bit := 16#0#; -- Shortcut between LASTRX event and STOP task LASTRX_STOP : SHORTS_LASTRX_STOP_Field := NRF_SVD.TWIM.Disabled; -- unspecified Reserved_13_31 : HAL.UInt19 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SHORTS_Register use record Reserved_0_6 at 0 range 0 .. 6; LASTTX_STARTRX at 0 range 7 .. 7; LASTTX_SUSPEND at 0 range 8 .. 8; LASTTX_STOP at 0 range 9 .. 9; LASTRX_STARTTX at 0 range 10 .. 10; Reserved_11_11 at 0 range 11 .. 11; LASTRX_STOP at 0 range 12 .. 12; Reserved_13_31 at 0 range 13 .. 31; end record; -- Enable or disable interrupt for STOPPED event type INTEN_STOPPED_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_STOPPED_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for ERROR event type INTEN_ERROR_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_ERROR_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for SUSPENDED event type INTEN_SUSPENDED_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_SUSPENDED_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for RXSTARTED event type INTEN_RXSTARTED_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_RXSTARTED_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for TXSTARTED event type INTEN_TXSTARTED_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_TXSTARTED_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for LASTRX event type INTEN_LASTRX_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_LASTRX_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt for LASTTX event type INTEN_LASTTX_Field is (-- Disable Disabled, -- Enable Enabled) with Size => 1; for INTEN_LASTTX_Field use (Disabled => 0, Enabled => 1); -- Enable or disable interrupt type INTEN_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- Enable or disable interrupt for STOPPED event STOPPED : INTEN_STOPPED_Field := NRF_SVD.TWIM.Disabled; -- unspecified Reserved_2_8 : HAL.UInt7 := 16#0#; -- Enable or disable interrupt for ERROR event ERROR : INTEN_ERROR_Field := NRF_SVD.TWIM.Disabled; -- unspecified Reserved_10_17 : HAL.UInt8 := 16#0#; -- Enable or disable interrupt for SUSPENDED event SUSPENDED : INTEN_SUSPENDED_Field := NRF_SVD.TWIM.Disabled; -- Enable or disable interrupt for RXSTARTED event RXSTARTED : INTEN_RXSTARTED_Field := NRF_SVD.TWIM.Disabled; -- Enable or disable interrupt for TXSTARTED event TXSTARTED : INTEN_TXSTARTED_Field := NRF_SVD.TWIM.Disabled; -- unspecified Reserved_21_22 : HAL.UInt2 := 16#0#; -- Enable or disable interrupt for LASTRX event LASTRX : INTEN_LASTRX_Field := NRF_SVD.TWIM.Disabled; -- Enable or disable interrupt for LASTTX event LASTTX : INTEN_LASTTX_Field := NRF_SVD.TWIM.Disabled; -- unspecified Reserved_25_31 : HAL.UInt7 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for INTEN_Register use record Reserved_0_0 at 0 range 0 .. 0; STOPPED at 0 range 1 .. 1; Reserved_2_8 at 0 range 2 .. 8; ERROR at 0 range 9 .. 9; Reserved_10_17 at 0 range 10 .. 17; SUSPENDED at 0 range 18 .. 18; RXSTARTED at 0 range 19 .. 19; TXSTARTED at 0 range 20 .. 20; Reserved_21_22 at 0 range 21 .. 22; LASTRX at 0 range 23 .. 23; LASTTX at 0 range 24 .. 24; Reserved_25_31 at 0 range 25 .. 31; end record; -- Write '1' to Enable interrupt for STOPPED event type INTENSET_STOPPED_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_STOPPED_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for STOPPED event type INTENSET_STOPPED_Field_1 is (-- Reset value for the field Intenset_Stopped_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_STOPPED_Field_1 use (Intenset_Stopped_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for ERROR event type INTENSET_ERROR_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_ERROR_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for ERROR event type INTENSET_ERROR_Field_1 is (-- Reset value for the field Intenset_Error_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_ERROR_Field_1 use (Intenset_Error_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for SUSPENDED event type INTENSET_SUSPENDED_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_SUSPENDED_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for SUSPENDED event type INTENSET_SUSPENDED_Field_1 is (-- Reset value for the field Intenset_Suspended_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_SUSPENDED_Field_1 use (Intenset_Suspended_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for RXSTARTED event type INTENSET_RXSTARTED_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_RXSTARTED_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for RXSTARTED event type INTENSET_RXSTARTED_Field_1 is (-- Reset value for the field Intenset_Rxstarted_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_RXSTARTED_Field_1 use (Intenset_Rxstarted_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for TXSTARTED event type INTENSET_TXSTARTED_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_TXSTARTED_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for TXSTARTED event type INTENSET_TXSTARTED_Field_1 is (-- Reset value for the field Intenset_Txstarted_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_TXSTARTED_Field_1 use (Intenset_Txstarted_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for LASTRX event type INTENSET_LASTRX_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_LASTRX_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for LASTRX event type INTENSET_LASTRX_Field_1 is (-- Reset value for the field Intenset_Lastrx_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_LASTRX_Field_1 use (Intenset_Lastrx_Field_Reset => 0, Set => 1); -- Write '1' to Enable interrupt for LASTTX event type INTENSET_LASTTX_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENSET_LASTTX_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Enable interrupt for LASTTX event type INTENSET_LASTTX_Field_1 is (-- Reset value for the field Intenset_Lasttx_Field_Reset, -- Enable Set) with Size => 1; for INTENSET_LASTTX_Field_1 use (Intenset_Lasttx_Field_Reset => 0, Set => 1); -- Enable interrupt type INTENSET_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- Write '1' to Enable interrupt for STOPPED event STOPPED : INTENSET_STOPPED_Field_1 := Intenset_Stopped_Field_Reset; -- unspecified Reserved_2_8 : HAL.UInt7 := 16#0#; -- Write '1' to Enable interrupt for ERROR event ERROR : INTENSET_ERROR_Field_1 := Intenset_Error_Field_Reset; -- unspecified Reserved_10_17 : HAL.UInt8 := 16#0#; -- Write '1' to Enable interrupt for SUSPENDED event SUSPENDED : INTENSET_SUSPENDED_Field_1 := Intenset_Suspended_Field_Reset; -- Write '1' to Enable interrupt for RXSTARTED event RXSTARTED : INTENSET_RXSTARTED_Field_1 := Intenset_Rxstarted_Field_Reset; -- Write '1' to Enable interrupt for TXSTARTED event TXSTARTED : INTENSET_TXSTARTED_Field_1 := Intenset_Txstarted_Field_Reset; -- unspecified Reserved_21_22 : HAL.UInt2 := 16#0#; -- Write '1' to Enable interrupt for LASTRX event LASTRX : INTENSET_LASTRX_Field_1 := Intenset_Lastrx_Field_Reset; -- Write '1' to Enable interrupt for LASTTX event LASTTX : INTENSET_LASTTX_Field_1 := Intenset_Lasttx_Field_Reset; -- unspecified Reserved_25_31 : HAL.UInt7 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for INTENSET_Register use record Reserved_0_0 at 0 range 0 .. 0; STOPPED at 0 range 1 .. 1; Reserved_2_8 at 0 range 2 .. 8; ERROR at 0 range 9 .. 9; Reserved_10_17 at 0 range 10 .. 17; SUSPENDED at 0 range 18 .. 18; RXSTARTED at 0 range 19 .. 19; TXSTARTED at 0 range 20 .. 20; Reserved_21_22 at 0 range 21 .. 22; LASTRX at 0 range 23 .. 23; LASTTX at 0 range 24 .. 24; Reserved_25_31 at 0 range 25 .. 31; end record; -- Write '1' to Disable interrupt for STOPPED event type INTENCLR_STOPPED_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_STOPPED_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for STOPPED event type INTENCLR_STOPPED_Field_1 is (-- Reset value for the field Intenclr_Stopped_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_STOPPED_Field_1 use (Intenclr_Stopped_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for ERROR event type INTENCLR_ERROR_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_ERROR_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for ERROR event type INTENCLR_ERROR_Field_1 is (-- Reset value for the field Intenclr_Error_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_ERROR_Field_1 use (Intenclr_Error_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for SUSPENDED event type INTENCLR_SUSPENDED_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_SUSPENDED_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for SUSPENDED event type INTENCLR_SUSPENDED_Field_1 is (-- Reset value for the field Intenclr_Suspended_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_SUSPENDED_Field_1 use (Intenclr_Suspended_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for RXSTARTED event type INTENCLR_RXSTARTED_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_RXSTARTED_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for RXSTARTED event type INTENCLR_RXSTARTED_Field_1 is (-- Reset value for the field Intenclr_Rxstarted_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_RXSTARTED_Field_1 use (Intenclr_Rxstarted_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for TXSTARTED event type INTENCLR_TXSTARTED_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_TXSTARTED_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for TXSTARTED event type INTENCLR_TXSTARTED_Field_1 is (-- Reset value for the field Intenclr_Txstarted_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_TXSTARTED_Field_1 use (Intenclr_Txstarted_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for LASTRX event type INTENCLR_LASTRX_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_LASTRX_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for LASTRX event type INTENCLR_LASTRX_Field_1 is (-- Reset value for the field Intenclr_Lastrx_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_LASTRX_Field_1 use (Intenclr_Lastrx_Field_Reset => 0, Clear => 1); -- Write '1' to Disable interrupt for LASTTX event type INTENCLR_LASTTX_Field is (-- Read: Disabled Disabled, -- Read: Enabled Enabled) with Size => 1; for INTENCLR_LASTTX_Field use (Disabled => 0, Enabled => 1); -- Write '1' to Disable interrupt for LASTTX event type INTENCLR_LASTTX_Field_1 is (-- Reset value for the field Intenclr_Lasttx_Field_Reset, -- Disable Clear) with Size => 1; for INTENCLR_LASTTX_Field_1 use (Intenclr_Lasttx_Field_Reset => 0, Clear => 1); -- Disable interrupt type INTENCLR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; -- Write '1' to Disable interrupt for STOPPED event STOPPED : INTENCLR_STOPPED_Field_1 := Intenclr_Stopped_Field_Reset; -- unspecified Reserved_2_8 : HAL.UInt7 := 16#0#; -- Write '1' to Disable interrupt for ERROR event ERROR : INTENCLR_ERROR_Field_1 := Intenclr_Error_Field_Reset; -- unspecified Reserved_10_17 : HAL.UInt8 := 16#0#; -- Write '1' to Disable interrupt for SUSPENDED event SUSPENDED : INTENCLR_SUSPENDED_Field_1 := Intenclr_Suspended_Field_Reset; -- Write '1' to Disable interrupt for RXSTARTED event RXSTARTED : INTENCLR_RXSTARTED_Field_1 := Intenclr_Rxstarted_Field_Reset; -- Write '1' to Disable interrupt for TXSTARTED event TXSTARTED : INTENCLR_TXSTARTED_Field_1 := Intenclr_Txstarted_Field_Reset; -- unspecified Reserved_21_22 : HAL.UInt2 := 16#0#; -- Write '1' to Disable interrupt for LASTRX event LASTRX : INTENCLR_LASTRX_Field_1 := Intenclr_Lastrx_Field_Reset; -- Write '1' to Disable interrupt for LASTTX event LASTTX : INTENCLR_LASTTX_Field_1 := Intenclr_Lasttx_Field_Reset; -- unspecified Reserved_25_31 : HAL.UInt7 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for INTENCLR_Register use record Reserved_0_0 at 0 range 0 .. 0; STOPPED at 0 range 1 .. 1; Reserved_2_8 at 0 range 2 .. 8; ERROR at 0 range 9 .. 9; Reserved_10_17 at 0 range 10 .. 17; SUSPENDED at 0 range 18 .. 18; RXSTARTED at 0 range 19 .. 19; TXSTARTED at 0 range 20 .. 20; Reserved_21_22 at 0 range 21 .. 22; LASTRX at 0 range 23 .. 23; LASTTX at 0 range 24 .. 24; Reserved_25_31 at 0 range 25 .. 31; end record; -- Overrun error type ERRORSRC_OVERRUN_Field is (-- Error did not occur Notreceived, -- Error occurred Received) with Size => 1; for ERRORSRC_OVERRUN_Field use (Notreceived => 0, Received => 1); -- NACK received after sending the address (write '1' to clear) type ERRORSRC_ANACK_Field is (-- Error did not occur Notreceived, -- Error occurred Received) with Size => 1; for ERRORSRC_ANACK_Field use (Notreceived => 0, Received => 1); -- NACK received after sending a data byte (write '1' to clear) type ERRORSRC_DNACK_Field is (-- Error did not occur Notreceived, -- Error occurred Received) with Size => 1; for ERRORSRC_DNACK_Field use (Notreceived => 0, Received => 1); -- Error source type ERRORSRC_Register is record -- Overrun error OVERRUN : ERRORSRC_OVERRUN_Field := NRF_SVD.TWIM.Notreceived; -- NACK received after sending the address (write '1' to clear) ANACK : ERRORSRC_ANACK_Field := NRF_SVD.TWIM.Notreceived; -- NACK received after sending a data byte (write '1' to clear) DNACK : ERRORSRC_DNACK_Field := NRF_SVD.TWIM.Notreceived; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ERRORSRC_Register use record OVERRUN at 0 range 0 .. 0; ANACK at 0 range 1 .. 1; DNACK at 0 range 2 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- Enable or disable TWIM type ENABLE_ENABLE_Field is (-- Disable TWIM Disabled, -- Enable TWIM Enabled) with Size => 4; for ENABLE_ENABLE_Field use (Disabled => 0, Enabled => 6); -- Enable TWIM type ENABLE_Register is record -- Enable or disable TWIM ENABLE : ENABLE_ENABLE_Field := NRF_SVD.TWIM.Disabled; -- unspecified Reserved_4_31 : HAL.UInt28 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ENABLE_Register use record ENABLE at 0 range 0 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; ----------------------------------- -- TWIM_PSEL cluster's Registers -- ----------------------------------- subtype SCL_PSEL_PIN_Field is HAL.UInt5; -- Connection type SCL_CONNECT_Field is (-- Connect Connected, -- Disconnect Disconnected) with Size => 1; for SCL_CONNECT_Field use (Connected => 0, Disconnected => 1); -- Pin select for SCL signal type SCL_PSEL_Register is record -- Pin number PIN : SCL_PSEL_PIN_Field := 16#1F#; -- unspecified Reserved_5_30 : HAL.UInt26 := 16#3FFFFFF#; -- Connection CONNECT : SCL_CONNECT_Field := NRF_SVD.TWIM.Disconnected; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SCL_PSEL_Register use record PIN at 0 range 0 .. 4; Reserved_5_30 at 0 range 5 .. 30; CONNECT at 0 range 31 .. 31; end record; subtype SDA_PSEL_PIN_Field is HAL.UInt5; -- Connection type SDA_CONNECT_Field is (-- Connect Connected, -- Disconnect Disconnected) with Size => 1; for SDA_CONNECT_Field use (Connected => 0, Disconnected => 1); -- Pin select for SDA signal type SDA_PSEL_Register is record -- Pin number PIN : SDA_PSEL_PIN_Field := 16#1F#; -- unspecified Reserved_5_30 : HAL.UInt26 := 16#3FFFFFF#; -- Connection CONNECT : SDA_CONNECT_Field := NRF_SVD.TWIM.Disconnected; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for SDA_PSEL_Register use record PIN at 0 range 0 .. 4; Reserved_5_30 at 0 range 5 .. 30; CONNECT at 0 range 31 .. 31; end record; -- Unspecified type TWIM_PSEL_Cluster is record -- Pin select for SCL signal SCL : aliased SCL_PSEL_Register; -- Pin select for SDA signal SDA : aliased SDA_PSEL_Register; end record with Size => 64; for TWIM_PSEL_Cluster use record SCL at 16#0# range 0 .. 31; SDA at 16#4# range 0 .. 31; end record; ---------------------------------- -- TWIM_RXD cluster's Registers -- ---------------------------------- subtype MAXCNT_RXD_MAXCNT_Field is HAL.UInt8; -- Maximum number of bytes in receive buffer type MAXCNT_RXD_Register is record -- Maximum number of bytes in receive buffer MAXCNT : MAXCNT_RXD_MAXCNT_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MAXCNT_RXD_Register use record MAXCNT at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype AMOUNT_RXD_AMOUNT_Field is HAL.UInt8; -- Number of bytes transferred in the last transaction type AMOUNT_RXD_Register is record -- Read-only. Number of bytes transferred in the last transaction. In -- case of NACK error, includes the NACK'ed byte. AMOUNT : AMOUNT_RXD_AMOUNT_Field; -- unspecified Reserved_8_31 : HAL.UInt24; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AMOUNT_RXD_Register use record AMOUNT at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- List type type LIST_LIST_Field is (-- Disable EasyDMA list Disabled, -- Use array list Arraylist) with Size => 3; for LIST_LIST_Field use (Disabled => 0, Arraylist => 1); -- EasyDMA list type type LIST_RXD_Register is record -- List type LIST : LIST_LIST_Field := NRF_SVD.TWIM.Disabled; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for LIST_RXD_Register use record LIST at 0 range 0 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- RXD EasyDMA channel type TWIM_RXD_Cluster is record -- Data pointer PTR : aliased HAL.UInt32; -- Maximum number of bytes in receive buffer MAXCNT : aliased MAXCNT_RXD_Register; -- Number of bytes transferred in the last transaction AMOUNT : aliased AMOUNT_RXD_Register; -- EasyDMA list type LIST : aliased LIST_RXD_Register; end record with Size => 128; for TWIM_RXD_Cluster use record PTR at 16#0# range 0 .. 31; MAXCNT at 16#4# range 0 .. 31; AMOUNT at 16#8# range 0 .. 31; LIST at 16#C# range 0 .. 31; end record; ---------------------------------- -- TWIM_TXD cluster's Registers -- ---------------------------------- subtype MAXCNT_TXD_MAXCNT_Field is HAL.UInt8; -- Maximum number of bytes in transmit buffer type MAXCNT_TXD_Register is record -- Maximum number of bytes in transmit buffer MAXCNT : MAXCNT_TXD_MAXCNT_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for MAXCNT_TXD_Register use record MAXCNT at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype AMOUNT_TXD_AMOUNT_Field is HAL.UInt8; -- Number of bytes transferred in the last transaction type AMOUNT_TXD_Register is record -- Read-only. Number of bytes transferred in the last transaction. In -- case of NACK error, includes the NACK'ed byte. AMOUNT : AMOUNT_TXD_AMOUNT_Field; -- unspecified Reserved_8_31 : HAL.UInt24; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for AMOUNT_TXD_Register use record AMOUNT at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; -- EasyDMA list type type LIST_TXD_Register is record -- List type LIST : LIST_LIST_Field := NRF_SVD.TWIM.Disabled; -- unspecified Reserved_3_31 : HAL.UInt29 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for LIST_TXD_Register use record LIST at 0 range 0 .. 2; Reserved_3_31 at 0 range 3 .. 31; end record; -- TXD EasyDMA channel type TWIM_TXD_Cluster is record -- Data pointer PTR : aliased HAL.UInt32; -- Maximum number of bytes in transmit buffer MAXCNT : aliased MAXCNT_TXD_Register; -- Number of bytes transferred in the last transaction AMOUNT : aliased AMOUNT_TXD_Register; -- EasyDMA list type LIST : aliased LIST_TXD_Register; end record with Size => 128; for TWIM_TXD_Cluster use record PTR at 16#0# range 0 .. 31; MAXCNT at 16#4# range 0 .. 31; AMOUNT at 16#8# range 0 .. 31; LIST at 16#C# range 0 .. 31; end record; subtype ADDRESS_ADDRESS_Field is HAL.UInt7; -- Address used in the TWI transfer type ADDRESS_Register is record -- Address used in the TWI transfer ADDRESS : ADDRESS_ADDRESS_Field := 16#0#; -- unspecified Reserved_7_31 : HAL.UInt25 := 16#0#; end record with Volatile_Full_Access, Object_Size => 32, Bit_Order => System.Low_Order_First; for ADDRESS_Register use record ADDRESS at 0 range 0 .. 6; Reserved_7_31 at 0 range 7 .. 31; end record; ----------------------------------- -- TWIM_PSEL cluster's Registers -- ----------------------------------- ---------------------------------- -- TWIM_RXD cluster's Registers -- ---------------------------------- ---------------------------------- -- TWIM_TXD cluster's Registers -- ---------------------------------- ----------------- -- Peripherals -- ----------------- -- I2C compatible Two-Wire Master Interface with EasyDMA 0 type TWIM_Peripheral is record -- Start TWI receive sequence TASKS_STARTRX : aliased HAL.UInt32; -- Start TWI transmit sequence TASKS_STARTTX : aliased HAL.UInt32; -- Stop TWI transaction. Must be issued while the TWI master is not -- suspended. TASKS_STOP : aliased HAL.UInt32; -- Suspend TWI transaction TASKS_SUSPEND : aliased HAL.UInt32; -- Resume TWI transaction TASKS_RESUME : aliased HAL.UInt32; -- TWI stopped EVENTS_STOPPED : aliased HAL.UInt32; -- TWI error EVENTS_ERROR : aliased HAL.UInt32; -- Last byte has been sent out after the SUSPEND task has been issued, -- TWI traffic is now suspended. EVENTS_SUSPENDED : aliased HAL.UInt32; -- Receive sequence started EVENTS_RXSTARTED : aliased HAL.UInt32; -- Transmit sequence started EVENTS_TXSTARTED : aliased HAL.UInt32; -- Byte boundary, starting to receive the last byte EVENTS_LASTRX : aliased HAL.UInt32; -- Byte boundary, starting to transmit the last byte EVENTS_LASTTX : aliased HAL.UInt32; -- Shortcut register SHORTS : aliased SHORTS_Register; -- Enable or disable interrupt INTEN : aliased INTEN_Register; -- Enable interrupt INTENSET : aliased INTENSET_Register; -- Disable interrupt INTENCLR : aliased INTENCLR_Register; -- Error source ERRORSRC : aliased ERRORSRC_Register; -- Enable TWIM ENABLE : aliased ENABLE_Register; -- Unspecified PSEL : aliased TWIM_PSEL_Cluster; -- TWI frequency FREQUENCY : aliased HAL.UInt32; -- RXD EasyDMA channel RXD : aliased TWIM_RXD_Cluster; -- TXD EasyDMA channel TXD : aliased TWIM_TXD_Cluster; -- Address used in the TWI transfer ADDRESS : aliased ADDRESS_Register; end record with Volatile; for TWIM_Peripheral use record TASKS_STARTRX at 16#0# range 0 .. 31; TASKS_STARTTX at 16#8# range 0 .. 31; TASKS_STOP at 16#14# range 0 .. 31; TASKS_SUSPEND at 16#1C# range 0 .. 31; TASKS_RESUME at 16#20# range 0 .. 31; EVENTS_STOPPED at 16#104# range 0 .. 31; EVENTS_ERROR at 16#124# range 0 .. 31; EVENTS_SUSPENDED at 16#148# range 0 .. 31; EVENTS_RXSTARTED at 16#14C# range 0 .. 31; EVENTS_TXSTARTED at 16#150# range 0 .. 31; EVENTS_LASTRX at 16#15C# range 0 .. 31; EVENTS_LASTTX at 16#160# range 0 .. 31; SHORTS at 16#200# range 0 .. 31; INTEN at 16#300# range 0 .. 31; INTENSET at 16#304# range 0 .. 31; INTENCLR at 16#308# range 0 .. 31; ERRORSRC at 16#4C4# range 0 .. 31; ENABLE at 16#500# range 0 .. 31; PSEL at 16#508# range 0 .. 63; FREQUENCY at 16#524# range 0 .. 31; RXD at 16#534# range 0 .. 127; TXD at 16#544# range 0 .. 127; ADDRESS at 16#588# range 0 .. 31; end record; -- I2C compatible Two-Wire Master Interface with EasyDMA 0 TWIM0_Periph : aliased TWIM_Peripheral with Import, Address => TWIM0_Base; -- I2C compatible Two-Wire Master Interface with EasyDMA 1 TWIM1_Periph : aliased TWIM_Peripheral with Import, Address => TWIM1_Base; end NRF_SVD.TWIM;
oeis/138/A138418.asm
neoneye/loda-programs
11
9733
<filename>oeis/138/A138418.asm ; A138418: a(n) = ((n-th prime)^4-(n-th prime)^2)/2. ; Submitted by <NAME> ; 6,36,300,1176,7260,14196,41616,64980,139656,353220,461280,936396,1412040,1708476,2438736,3943836,6056940,6921060,10073316,12703320,14196456,19471920,23725716,31367160,44259936,52025100,56270136,65534076,70573140,81517296,130064256,147241380,176128296,186640860,246431100,259931400,303774276,352942596,388884216,447857556,513296820,536625180,665413440,693725376,753049836,784099800,991037460,1236461856,1327593156,1375003020,1473620616,1631375760,1686672240,1984531500,2181202176,2392140696 seq $0,40 ; The prime numbers. pow $0,2 mov $1,$0 pow $1,2 sub $1,$0 mov $0,$1 div $0,2
programs/oeis/140/A140280.asm
jmorken/loda
1
20574
<gh_stars>1-10 ; A140280: Product of digits of values in Pascal's triangle, by rows. ; 1,1,1,1,2,1,1,3,3,1,1,4,6,4,1,1,5,0,0,5,1,1,6,5,0,5,6,1,1,7,2,15,15,2,7,1,1,8,16,30,0,30,16,8,1,1,9,18,32,12,12,32,18,9,1,1,0,20,0,0,20,0,0,20,0,1,1,1,25,30,0,48,48,0,30,25,1,1 cal $0,7318 ; Pascal's triangle read by rows: C(n,k) = binomial(n,k) = n!/(k!*(n-k)!), 0 <= k <= n. cal $0,7954 ; Product of decimal digits of n. mov $1,$0
oeis/160/A160221.asm
neoneye/loda-programs
11
167196
; A160221: Numerator of Hermite(n, 23/28). ; Submitted by <NAME> ; 1,23,137,-14881,-503375,11755783,1256998009,1261352591,-3420191427103,-82620004548745,10166175250198249,557692448585640127,-31009621361385126767,-3336606569458709073049,81283079360068297324505,20180807678470966231356527,-13785930032369364946889279,-126891102150114395596846590761,-2826625911716921650721401432247,830331220801717977364757311467935,40150327868907145933962416031138161,-5586339230100604586058561753192432697,-459003301309157530807725529091755293383 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 mul $2,23 mul $3,-196 mul $3,$0 mul $3,2 lpe mov $0,$1
test/Fail/Issue4065.agda
cruhland/agda
1,989
3767
<filename>test/Fail/Issue4065.agda -- Andreas, 2019-09-10, issue #4065, reported by nad -- If the set of filtered unsolved constraints is empty, Agda -- should print at least something like "Unsolved constraints" postulate A : Set record R (F : A → Set) : Set where module M (r : (F : A → Set) → R F) where module T (F : _) = R (r (λ ℓ → F ℓ)) -- WAS (master after 2.6.0): -- <no error> when checking the module application ... -- Expected: -- Unsolved constraints when checking the module application ...
src/Examples.agda
peterthiemann/definitional-session
9
8856
module Examples where open import Data.List hiding (reverse) open import Data.List.All open import Data.Nat open import Typing open import Syntax ex1 : Expr [] TUnit ex1 = letbind [] (new [] (delay send!)) (letpair (left []) (here []) (letbind (rght (left [])) (fork (wait (here []))) (close (there UUnit (here []))))) ex1dual : Expr [] TUnit ex1dual = letbind [] (new [] (delay send!)) (letpair (left []) (here []) (letbind (left (rght [])) (fork (close (here []))) (wait (there UUnit (here []))))) -- sending and receiving ex2 : Expr [] TUnit ex2 = letbind [] (new [] (delay (Typing.send TInt (delay send!)))) (letpair (left []) (here []) (letbind (left (rght [])) (fork (letbind (rght []) (nat [] 42) (letbind (left (left [])) (Expr.send (rght (left [])) (here []) (here [])) (letbind (left []) (close (here [])) (var (here [])))))) (letbind (rght (left [])) (Expr.recv (here [])) (letpair (left (rght [])) (here []) (letbind (left (left (rght []))) (wait (here (UInt ∷ []))) (var (here (UUnit ∷ [])))))))) -- higher order sending and receiving ex3 : Expr [] TUnit ex3 = letbind [] (new [] (delay (Typing.send (TChan send!) (delay send!)))) (letbind (rght []) (new [] (delay send!)) (letpair (left (rght [])) (here []) (letpair (rght (rght (left []))) (here []) (letbind (left (rght (left (left [])))) (fork (letbind (left (left (rght []))) (Expr.send (left (rght [])) (here []) (here [])) (letbind (left (rght [])) (close (here [])) (wait (there UUnit (here [])))))) (letbind (left (left [])) (Expr.recv (there UUnit (here []))) (letpair (left []) (here []) (letbind (left (rght [])) (wait (here [])) (letbind (left (left [])) (close (there UUnit (here []))) (var (here [])))))))))) -- branching ex4 : Expr [] TUnit ex4 = letbind [] (new [] (delay (sintern (delay send!) (delay send?)))) (letpair (left []) (here []) (letbind (left (rght [])) (fork (letbind (left []) (select Left (here [])) (close (here [])))) (branch (left (left [])) (there UUnit (here [])) (wait (here [])) (close (here []))))) -- simple lambda: (λx.x)() ex5 : Expr [] TUnit ex5 = letbind [] (llambda [] [] (var (here []))) (letbind (rght []) (unit []) (app (rght (left [])) (here []) (here []))) -- lambda app: (λfx.fx) (λx.x)() ex6 : Expr [] TUnit ex6 = letbind [] (llambda [] [] (llambda (left []) [] (app (rght (left [])) (here []) (here [])))) (letbind (rght []) (llambda [] [] (var (here []))) (letbind (rght (rght [])) (unit []) (letbind (rght (left (left []))) (app (rght (left [])) (here []) (here [])) (app (left (rght [])) (here []) (here [])))))
Tejas-Simulator/PIN/pin-2.14/source/tools/ToolUnitTests/segmented_ea_verifier_win1_ia32.asm
markoshorro/tejas_knl
17
12528
<gh_stars>10-100 PUBLIC TestSegmentedEA .686 .model flat, c COMMENT // use of segment register is not an ERROR ASSUME NOTHING .code TestSegmentedEA PROC mov eax, 18 mov ecx, 2 mov edx, DWORD PTR fs:[5] mov DWORD PTR fs:[5], edx mov edx, DWORD PTR fs:[eax] mov DWORD PTR fs:[eax], edx mov edx, DWORD PTR fs:[eax+5] mov DWORD PTR fs:[eax+5], edx mov edx, DWORD PTR fs:[ecx*2] mov DWORD PTR fs:[ecx*2], edx mov edx, DWORD PTR fs:[ecx*2+5] mov DWORD PTR fs:[ecx*2+5], edx mov edx, DWORD PTR fs:[eax+ecx] mov DWORD PTR fs:[eax+ecx], edx mov edx, DWORD PTR fs:[eax+ecx*2+5] mov DWORD PTR fs:[eax+ecx*2+5], edx ret TestSegmentedEA ENDP end
bb-runtimes/arm/stm32/stm32f0xx/s-stm32.ads
JCGobbi/Nucleo-STM32G474RE
0
28729
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- Copyright (C) 2012-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This file provides register definitions for the STM32F0xx (ARM Cortex M0) -- family of microcontrollers from ST Microelectronics. with Interfaces.STM32; package System.STM32 is pragma No_Elaboration_Code_All; pragma Preelaborate (System.STM32); subtype Frequency is Interfaces.STM32.UInt32; type RCC_System_Clocks is record SYSCLK : Frequency; HCLK : Frequency; PCLK : Frequency; TIMCLK : Frequency; end record; function System_Clocks return RCC_System_Clocks; -- MODER constants subtype GPIO_MODER_Values is Interfaces.STM32.UInt2; Mode_IN : constant GPIO_MODER_Values := 0; Mode_OUT : constant GPIO_MODER_Values := 1; Mode_AF : constant GPIO_MODER_Values := 2; Mode_AN : constant GPIO_MODER_Values := 3; -- OTYPER constants subtype GPIO_OTYPER_Values is Interfaces.STM32.Bit; Push_Pull : constant GPIO_OTYPER_Values := 0; Open_Drain : constant GPIO_OTYPER_Values := 1; -- OSPEEDR constants subtype GPIO_OSPEEDR_Values is Interfaces.STM32.UInt2; Speed_2MHz : constant GPIO_OSPEEDR_Values := 0; -- Low speed Speed_25MHz : constant GPIO_OSPEEDR_Values := 1; -- Medium speed Speed_50MHz : constant GPIO_OSPEEDR_Values := 2; -- Fast speed Speed_100MHz : constant GPIO_OSPEEDR_Values := 3; -- High speed -- PUPDR constants subtype GPIO_PUPDR_Values is Interfaces.STM32.UInt2; No_Pull : constant GPIO_PUPDR_Values := 0; Pull_Up : constant GPIO_PUPDR_Values := 1; Pull_Down : constant GPIO_PUPDR_Values := 2; type MCU_ID_Register is record DEV_ID : Interfaces.STM32.UInt12; Reserved : Interfaces.STM32.UInt4; REV_ID : Interfaces.STM32.UInt16; end record with Pack, Size => 32; -- RCC constants -- Note that the STM32F03x and STM32F05x devices are limited -- to HSI/2 and HSE clock sources. HSI and HIS48 are not allowed. type PLL_Source is (PLL_SRC_HSI_2, -- HSI/2 PLL_SRC_HSI_PREDIV, -- HSI/PREDIV (only on STM32F04x/F07x/F09x) PLL_SRC_HSE_PREDIV, -- HSE/PREDIV PLL_SRC_HSI48_PREDIV) -- HSI48/PREDIV (only on STM32F04x/F07x/F09x) with Size => 2; type SYSCLK_Source is (SYSCLK_SRC_HSI, SYSCLK_SRC_HSE, SYSCLK_SRC_PLL, SYSCLK_SRC_HSI48) with Size => 2; subtype PREDIV_Range is Integer range 1 .. 16; type AHB_Prescaler_Enum is (DIV2, DIV4, DIV8, DIV16, DIV64, DIV128, DIV256, DIV512) with Size => 3; type AHB_Prescaler is record Enabled : Boolean := False; Value : AHB_Prescaler_Enum := AHB_Prescaler_Enum'First; end record with Size => 4; for AHB_Prescaler use record Enabled at 0 range 3 .. 3; Value at 0 range 0 .. 2; end record; AHBPRE_DIV1 : constant AHB_Prescaler := (Enabled => False, Value => DIV2); type APB_Prescaler_Enum is (DIV2, DIV4, DIV8, DIV16) with Size => 2; type APB_Prescaler is record Enabled : Boolean; Value : APB_Prescaler_Enum; end record with Size => 3; for APB_Prescaler use record Enabled at 0 range 2 .. 2; Value at 0 range 0 .. 1; end record; APBPRE_DIV1 : constant APB_Prescaler := (Enabled => False, Value => DIV2); type I2S_Clock_Selection is (I2SSEL_PLL, I2SSEL_CKIN) with Size => 1; type MCO_Clock_Selection is (MCO_None, MCO_HSI14, MCO_LSI, MCO_LSE, MCO_SYSCLK, MCO_HSI, MCO_HSE, MCO_PLL, MCO_HSI48) with Size => 4; type MCO_Prescaler is (MCOPRE_DIV1, MCOPRE_DIV2, MCOPRE_DIV4, MCOPRE_DIV8, MCOPRE_DIV16, MCOPRE_DIV32, MCOPRE_DIV64, MCOPRE_DIV128) with Size => 3; -- Constants for RCC CR register subtype PLLMUL_Range is Integer range 2 .. 16; subtype HSECLK_Range is Integer range 4_000_000 .. 32_000_000; subtype PLLOUT_Range is Integer range 16_000_000 .. 48_000_000; subtype SYSCLK_Range is Integer range 1 .. 48_000_000; subtype HCLK_Range is Integer range 1 .. 48_000_000; subtype PCLK_Range is Integer range 1 .. 48_000_000; -- These internal low and high speed clocks are fixed (do not modify) HSICLK : constant := 8_000_000; HSI48CLK : constant := 48_000_000; -- HSI48 only present on F05X/07x/F09x LSICLK : constant := 32_000; MCU_ID : MCU_ID_Register with Volatile, Address => System'To_Address (16#E004_2000#); -- Only 32-bits access supported (read-only) DEV_ID_STM32F03x : constant := 16#444#; DEV_ID_STM32F04x : constant := 16#445#; DEV_ID_STM32F05x : constant := 16#440#; DEV_ID_STM32F07x : constant := 16#448#; DEV_ID_STM32F09x : constant := 16#442#; end System.STM32;
alloy4fun_models/trashltl/models/4/pYtRf28vutcxSCanA.als
Kaixi26/org.alloytools.alloy
0
454
<filename>alloy4fun_models/trashltl/models/4/pYtRf28vutcxSCanA.als<gh_stars>0 open main pred idpYtRf28vutcxSCanA_prop5 { eventually (no Trash - File) } pred __repair { idpYtRf28vutcxSCanA_prop5 } check __repair { idpYtRf28vutcxSCanA_prop5 <=> prop5o }
data/jpred4/jp_batch_1613899824__URLWml6/jp_batch_1613899824__URLWml6.als
jonriege/predict-protein-structure
0
1193
<reponame>jonriege/predict-protein-structure SILENT_MODE BLOCK_FILE jp_batch_1613899824__URLWml6.concise.blc MAX_NSEQ 122 MAX_INPUT_LEN 124 OUTPUT_FILE jp_batch_1613899824__URLWml6.concise.ps PORTRAIT POINTSIZE 8 IDENT_WIDTH 12 X_OFFSET 2 Y_OFFSET 2 DEFINE_FONT 0 Helvetica DEFAULT DEFINE_FONT 1 Helvetica REL 0.75 DEFINE_FONT 7 Helvetica REL 0.6 DEFINE_FONT 3 Helvetica-Bold DEFAULT DEFINE_FONT 4 Times-Bold DEFAULT DEFINE_FONT 5 Helvetica-BoldOblique DEFAULT # DEFINE_COLOUR 3 1 0.62 0.67 # Turquiose DEFINE_COLOUR 4 1 1 0 # Yellow DEFINE_COLOUR 5 1 0 0 # Red DEFINE_COLOUR 7 1 0 1 # Purple DEFINE_COLOUR 8 0 0 1 # Blue DEFINE_COLOUR 9 0 1 0 # Green DEFINE_COLOUR 10 0.41 0.64 1.00 # Pale blue DEFINE_COLOUR 11 0.41 0.82 0.67 # Pale green DEFINE_COLOUR 50 0.69 0.18 0.37 # Pink (helix) DEFINE_COLOUR 51 1.00 0.89 0.00 # Gold (strand) NUMBER_INT 10 SETUP # # Highlight specific residues. # Avoid highlighting Lupas 'C' predictions by # limiting the highlighting to the alignments Scol_CHARS C 1 1 207 111 4 Ccol_CHARS H ALL 5 Ccol_CHARS P ALL 8 SURROUND_CHARS LIV ALL # # Replace known structure types with whitespace SUB_CHARS 1 112 207 121 H SPACE SUB_CHARS 1 112 207 121 E SPACE SUB_CHARS 1 112 207 121 - SPACE STRAND 3 115 4 COLOUR_TEXT_REGION 3 115 4 115 51 STRAND 12 115 14 COLOUR_TEXT_REGION 12 115 14 115 51 STRAND 20 115 23 COLOUR_TEXT_REGION 20 115 23 115 51 STRAND 37 115 50 COLOUR_TEXT_REGION 37 115 50 115 51 STRAND 64 115 69 COLOUR_TEXT_REGION 64 115 69 115 51 STRAND 90 115 100 COLOUR_TEXT_REGION 90 115 100 115 51 STRAND 109 115 114 COLOUR_TEXT_REGION 109 115 114 115 51 STRAND 145 115 148 COLOUR_TEXT_REGION 145 115 148 115 51 STRAND 154 115 157 COLOUR_TEXT_REGION 154 115 157 115 51 STRAND 172 115 178 COLOUR_TEXT_REGION 172 115 178 115 51 STRAND 185 115 198 COLOUR_TEXT_REGION 185 115 198 115 51 HELIX 77 115 84 COLOUR_TEXT_REGION 77 115 84 115 50 HELIX 126 115 130 COLOUR_TEXT_REGION 126 115 130 115 50 STRAND 2 120 7 COLOUR_TEXT_REGION 2 120 7 120 51 STRAND 20 120 23 COLOUR_TEXT_REGION 20 120 23 120 51 STRAND 37 120 50 COLOUR_TEXT_REGION 37 120 50 120 51 STRAND 60 120 69 COLOUR_TEXT_REGION 60 120 69 120 51 STRAND 90 120 100 COLOUR_TEXT_REGION 90 120 100 120 51 STRAND 109 120 114 COLOUR_TEXT_REGION 109 120 114 120 51 STRAND 145 120 148 COLOUR_TEXT_REGION 145 120 148 120 51 STRAND 154 120 157 COLOUR_TEXT_REGION 154 120 157 120 51 STRAND 172 120 177 COLOUR_TEXT_REGION 172 120 177 120 51 STRAND 186 120 197 COLOUR_TEXT_REGION 186 120 197 120 51 HELIX 78 120 83 COLOUR_TEXT_REGION 78 120 83 120 50 HELIX 126 120 130 COLOUR_TEXT_REGION 126 120 130 120 50 STRAND 12 121 15 COLOUR_TEXT_REGION 12 121 15 121 51 STRAND 19 121 24 COLOUR_TEXT_REGION 19 121 24 121 51 STRAND 37 121 50 COLOUR_TEXT_REGION 37 121 50 121 51 STRAND 65 121 69 COLOUR_TEXT_REGION 65 121 69 121 51 STRAND 90 121 101 COLOUR_TEXT_REGION 90 121 101 121 51 STRAND 109 121 114 COLOUR_TEXT_REGION 109 121 114 121 51 STRAND 145 121 148 COLOUR_TEXT_REGION 145 121 148 121 51 STRAND 154 121 156 COLOUR_TEXT_REGION 154 121 156 121 51 STRAND 172 121 178 COLOUR_TEXT_REGION 172 121 178 121 51 STRAND 185 121 198 COLOUR_TEXT_REGION 185 121 198 121 51 HELIX 77 121 85 COLOUR_TEXT_REGION 77 121 85 121 50 HELIX 126 121 130 COLOUR_TEXT_REGION 126 121 130 121 50
src/main/antlr4/com/user00/javastringexternalize/PropertiesLexer.g4
my2iu/JavaStringExternalize
0
2052
lexer grammar PropertiesLexer; CRLF: ENDL -> channel(HIDDEN); WS: Whitespace+ -> channel(HIDDEN); COMMENT: ('#' | '!') ~[\r\n]* -> channel(HIDDEN); KEY: ('\\=' | '\\:' | '\\ ' | ~[ #!\t\f\r\n]) ( '\\=' | '\\:' | '\\ ' | ~[= \t\f\r\n])* -> mode(EQUALS_MODE); mode EQUALS_MODE; WS_EQUALS: WS -> type(WS),channel(HIDDEN); CRLF_EQUALS: CRLF -> type(CRLF),channel(HIDDEN),mode(DEFAULT_MODE); EQUALS: ('=' | ':') -> mode(VALUE_MODE); mode VALUE_MODE; WS_VALUE: WS -> type(WS),channel(HIDDEN); CRLF_VALUE: CRLF -> type(CRLF),channel(HIDDEN),mode(DEFAULT_MODE); VALUE: ('\\' ENDL Whitespace* | ~[ \t\f\r\n]) ('\\' ENDL | ~[\r\n])* -> mode(DEFAULT_MODE); fragment Whitespace : [ \t\f]; fragment ENDL : '\r\n' | '\r' | '\n';
data/jpred4/jp_batch_1613899824__3PAzy94/jp_batch_1613899824__3PAzy94.als
jonriege/predict-protein-structure
0
5161
<gh_stars>0 SILENT_MODE BLOCK_FILE jp_batch_1613899824__3PAzy94.concise.blc MAX_NSEQ 857 MAX_INPUT_LEN 859 OUTPUT_FILE jp_batch_1613899824__3PAzy94.concise.ps PORTRAIT POINTSIZE 8 IDENT_WIDTH 12 X_OFFSET 2 Y_OFFSET 2 DEFINE_FONT 0 Helvetica DEFAULT DEFINE_FONT 1 Helvetica REL 0.75 DEFINE_FONT 7 Helvetica REL 0.6 DEFINE_FONT 3 Helvetica-Bold DEFAULT DEFINE_FONT 4 Times-Bold DEFAULT DEFINE_FONT 5 Helvetica-BoldOblique DEFAULT # DEFINE_COLOUR 3 1 0.62 0.67 # Turquiose DEFINE_COLOUR 4 1 1 0 # Yellow DEFINE_COLOUR 5 1 0 0 # Red DEFINE_COLOUR 7 1 0 1 # Purple DEFINE_COLOUR 8 0 0 1 # Blue DEFINE_COLOUR 9 0 1 0 # Green DEFINE_COLOUR 10 0.41 0.64 1.00 # Pale blue DEFINE_COLOUR 11 0.41 0.82 0.67 # Pale green DEFINE_COLOUR 50 0.69 0.18 0.37 # Pink (helix) DEFINE_COLOUR 51 1.00 0.89 0.00 # Gold (strand) NUMBER_INT 10 SETUP # # Highlight specific residues. # Avoid highlighting Lupas 'C' predictions by # limiting the highlighting to the alignments Scol_CHARS C 1 1 374 846 4 Ccol_CHARS H ALL 5 Ccol_CHARS P ALL 8 SURROUND_CHARS LIV ALL # # Replace known structure types with whitespace SUB_CHARS 1 847 374 856 H SPACE SUB_CHARS 1 847 374 856 E SPACE SUB_CHARS 1 847 374 856 - SPACE STRAND 9 850 15 COLOUR_TEXT_REGION 9 850 15 850 51 STRAND 21 850 26 COLOUR_TEXT_REGION 21 850 26 850 51 STRAND 36 850 44 COLOUR_TEXT_REGION 36 850 44 850 51 STRAND 51 850 54 COLOUR_TEXT_REGION 51 850 54 850 51 STRAND 70 850 76 COLOUR_TEXT_REGION 70 850 76 850 51 STRAND 84 850 92 COLOUR_TEXT_REGION 84 850 92 850 51 STRAND 147 850 152 COLOUR_TEXT_REGION 147 850 152 850 51 STRAND 180 850 186 COLOUR_TEXT_REGION 180 850 186 850 51 STRAND 194 850 199 COLOUR_TEXT_REGION 194 850 199 850 51 STRAND 218 850 223 COLOUR_TEXT_REGION 218 850 223 850 51 STRAND 239 850 241 COLOUR_TEXT_REGION 239 850 241 850 51 STRAND 263 850 268 COLOUR_TEXT_REGION 263 850 268 850 51 STRAND 287 850 293 COLOUR_TEXT_REGION 287 850 293 850 51 STRAND 313 850 319 COLOUR_TEXT_REGION 313 850 319 850 51 STRAND 348 850 349 COLOUR_TEXT_REGION 348 850 349 850 51 STRAND 368 850 372 COLOUR_TEXT_REGION 368 850 372 850 51 HELIX 7 850 8 COLOUR_TEXT_REGION 7 850 8 850 50 HELIX 166 850 172 COLOUR_TEXT_REGION 166 850 172 850 50 HELIX 202 850 214 COLOUR_TEXT_REGION 202 850 214 850 50 HELIX 226 850 235 COLOUR_TEXT_REGION 226 850 235 850 50 HELIX 249 850 257 COLOUR_TEXT_REGION 249 850 257 850 50 HELIX 273 850 282 COLOUR_TEXT_REGION 273 850 282 850 50 HELIX 305 850 312 COLOUR_TEXT_REGION 305 850 312 850 50 HELIX 327 850 337 COLOUR_TEXT_REGION 327 850 337 850 50 HELIX 354 850 363 COLOUR_TEXT_REGION 354 850 363 850 50 STRAND 8 855 15 COLOUR_TEXT_REGION 8 855 15 855 51 STRAND 21 855 26 COLOUR_TEXT_REGION 21 855 26 855 51 STRAND 36 855 43 COLOUR_TEXT_REGION 36 855 43 855 51 STRAND 51 855 54 COLOUR_TEXT_REGION 51 855 54 855 51 STRAND 70 855 76 COLOUR_TEXT_REGION 70 855 76 855 51 STRAND 88 855 91 COLOUR_TEXT_REGION 88 855 91 855 51 STRAND 146 855 152 COLOUR_TEXT_REGION 146 855 152 855 51 STRAND 158 855 159 COLOUR_TEXT_REGION 158 855 159 855 51 STRAND 181 855 181 COLOUR_TEXT_REGION 181 855 181 855 51 STRAND 194 855 199 COLOUR_TEXT_REGION 194 855 199 855 51 STRAND 218 855 223 COLOUR_TEXT_REGION 218 855 223 855 51 STRAND 239 855 241 COLOUR_TEXT_REGION 239 855 241 855 51 STRAND 263 855 270 COLOUR_TEXT_REGION 263 855 270 855 51 STRAND 287 855 293 COLOUR_TEXT_REGION 287 855 293 855 51 STRAND 311 855 320 COLOUR_TEXT_REGION 311 855 320 855 51 STRAND 349 855 350 COLOUR_TEXT_REGION 349 855 350 855 51 STRAND 368 855 373 COLOUR_TEXT_REGION 368 855 373 855 51 HELIX 179 855 180 COLOUR_TEXT_REGION 179 855 180 855 50 HELIX 182 855 185 COLOUR_TEXT_REGION 182 855 185 855 50 HELIX 202 855 214 COLOUR_TEXT_REGION 202 855 214 855 50 HELIX 226 855 235 COLOUR_TEXT_REGION 226 855 235 855 50 HELIX 249 855 256 COLOUR_TEXT_REGION 249 855 256 855 50 HELIX 272 855 283 COLOUR_TEXT_REGION 272 855 283 855 50 HELIX 307 855 310 COLOUR_TEXT_REGION 307 855 310 855 50 HELIX 327 855 337 COLOUR_TEXT_REGION 327 855 337 855 50 HELIX 353 855 363 COLOUR_TEXT_REGION 353 855 363 855 50 STRAND 15 856 15 COLOUR_TEXT_REGION 15 856 15 856 51 STRAND 21 856 26 COLOUR_TEXT_REGION 21 856 26 856 51 STRAND 36 856 44 COLOUR_TEXT_REGION 36 856 44 856 51 STRAND 51 856 54 COLOUR_TEXT_REGION 51 856 54 856 51 STRAND 70 856 76 COLOUR_TEXT_REGION 70 856 76 856 51 STRAND 83 856 94 COLOUR_TEXT_REGION 83 856 94 856 51 STRAND 101 856 101 COLOUR_TEXT_REGION 101 856 101 856 51 STRAND 128 856 131 COLOUR_TEXT_REGION 128 856 131 856 51 STRAND 150 856 151 COLOUR_TEXT_REGION 150 856 151 856 51 STRAND 180 856 187 COLOUR_TEXT_REGION 180 856 187 856 51 STRAND 194 856 199 COLOUR_TEXT_REGION 194 856 199 856 51 STRAND 218 856 222 COLOUR_TEXT_REGION 218 856 222 856 51 STRAND 239 856 242 COLOUR_TEXT_REGION 239 856 242 856 51 STRAND 263 856 267 COLOUR_TEXT_REGION 263 856 267 856 51 STRAND 281 856 282 COLOUR_TEXT_REGION 281 856 282 856 51 STRAND 287 856 293 COLOUR_TEXT_REGION 287 856 293 856 51 STRAND 315 856 319 COLOUR_TEXT_REGION 315 856 319 856 51 STRAND 347 856 349 COLOUR_TEXT_REGION 347 856 349 856 51 STRAND 369 856 372 COLOUR_TEXT_REGION 369 856 372 856 51 HELIX 7 856 14 COLOUR_TEXT_REGION 7 856 14 856 50 HELIX 148 856 149 COLOUR_TEXT_REGION 148 856 149 856 50 HELIX 166 856 173 COLOUR_TEXT_REGION 166 856 173 856 50 HELIX 203 856 214 COLOUR_TEXT_REGION 203 856 214 856 50 HELIX 226 856 235 COLOUR_TEXT_REGION 226 856 235 856 50 HELIX 249 856 257 COLOUR_TEXT_REGION 249 856 257 856 50 HELIX 275 856 280 COLOUR_TEXT_REGION 275 856 280 856 50 HELIX 305 856 314 COLOUR_TEXT_REGION 305 856 314 856 50 HELIX 328 856 337 COLOUR_TEXT_REGION 328 856 337 856 50 HELIX 355 856 364 COLOUR_TEXT_REGION 355 856 364 856 50
models/hol/sygus/multiple_functions/constant.als
johnwickerson/alloystar
2
190
<gh_stars>1-10 module multfun_constant open ../synth_ast one sig X, Y extends IntVar {} one sig Lit0, Lit1 extends IntLit {} fact { IntLit<:val = Lit0->0 + Lit1->1 } -------------------------------------------------------------------------------- -- Specification -- (https://github.com/rishabhs/sygus-comp14/blob/master/benchmarks/multiple-functions/constant.sl) -------------------------------------------------------------------------------- pred synth[root: Node] { Y !in (root.*binRels) X in (root.*binRels) all envI: IntVar -> one Int { some eval: IntNode->Int + BoolNode->Bit when { envI in eval && semantics[eval] }{ some eval2: IntNode->Int + BoolNode->Bit when { (envI ++ (X->envI[Y])) in eval2 semantics[eval2] }{ eval[root] = eval2[root] } } } } -------------------------------------------------------------------------------- -- Commands -------------------------------------------------------------------------------- run synth for 0 but 4 Int, exactly 1 BvSub, exactly 1 BvAdd
gsm-dtmf-robot/contoller.asm
AravinthPanch/various-hardware-projects
10
14997
<filename>gsm-dtmf-robot/contoller.asm $MOD51 RELAY1 BIT P0.1 RELAY2 BIT P0.2 RELAY3 BIT P0.3 RELAY4 BIT P0.4 KEY EQU P1 STD BIT P1.4 ORG 00H MOV SP,#08H MOV KEY,#0FFH MOV P0,#00H START: JNB STD ,$ CALL KEY_READ CALL ACTION CALL DEBOUNCE JMP START KEY_READ: MOV A,KEY ANL A,#0FH MOV R1,A RET ;---------------------- ACTION: MOV A,R1 CJNE A,#02,J1 SETB RELAY1 SETB RELAY3 CALL DELAY CLR RELAY1 CLR RELAY3 JMP J20 J1: CJNE A,#08,J2 SETB RELAY2 SETB RELAY4 CALL DELAY CLR RELAY2 CLR RELAY4 JMP J20 J2: CJNE A,#04,J3 SETB RELAY2 CALL DELAY1 CLR RELAY2 JMP J20 J3: CJNE A,#06,J20 SETB RELAY4 CALL DELAY1 CLR RELAY4 JMP J20 J20: RET ;------------------------ DELAY: MOV R3,#7 J21: MOV R4,#02H J30: MOV R5,#14H J40: MOV R6,#0FFH DJNZ R6,$ DJNZ R5,J40 DJNZ R4,J30 DJNZ R3,J21 RET ;................................ DELAY1: MOV R3,#2 J211: MOV R4,#02H J30A: MOV R5,#15H J40A: MOV R6,#0FFH DJNZ R6,$ DJNZ R5,J40A DJNZ R4,J30A DJNZ R3,J211 RET ;................................ DEBOUNCE: MOV R6,#80H J81: NOP MOV R5,#0FFH DJNZ R5,$ DJNZ R6,J81 RET ;------------------------ END
programs/oeis/082/A082644.asm
karttu/loda
1
179098
<gh_stars>1-10 ; A082644: a(n) = floor(n*(n-1/2)/2). ; 0,0,1,3,7,11,16,22,30,38,47,57,69,81,94,108,124,140,157,175,195,215,236,258,282,306,331,357,385,413,442,472,504,536,569,603,639,675,712,750,790,830,871,913,957,1001,1046,1092,1140,1188,1237,1287,1339,1391,1444,1498 mul $0,2 bin $0,2 div $0,4 mov $1,$0
tests/z80/op_00_3F.asm
cizo2000/sjasmplus
220
99536
OUTPUT "op_00_3F.bin" nop ld bc,$4444 ld (bc),a inc bc inc b dec b ld b,$44 rlca ex af,af' add hl,bc ld a,(bc) dec bc inc c dec c ld c,$44 rrca djnz $+2+$44 ld de,$4444 ld (de),a inc de inc d dec d ld d,$44 rla jr $+2+$44 add hl,de ld a,(de) dec de inc e dec e ld e,$44 rra jr nz,$+2+$44 ld hl,$4444 ld ($4444),hl inc hl inc h dec h ld h,$44 daa jr z,$+2+$44 add hl,hl ld hl,($4444) dec hl inc l dec l ld l,$44 cpl jr nc,$+2+$44 ld sp,$4444 ld ($4444),a inc sp inc (hl) dec (hl) ld (hl),$44 scf jr c,$+2+$44 add hl,sp ld a,($4444) dec sp inc a dec a ld a,$44 ccf
3-mid/opengl/source/lean/buffer/opengl-buffer.ads
charlie5/lace
20
7333
private with GL.lean, ada.unchecked_Conversion; package openGL.Buffer -- -- Models a buffer object. -- is -------------- --- Core Types -- subtype a_Name is GL.GLuint; -- An openGL vertex buffer 'Name', which is a natural integer. type a_Kind is (array_Buffer, element_array_Buffer); type Usage is (stream_Draw, static_Draw, dynamic_Draw); ----------------- -- Buffer Object -- type Object is abstract tagged limited private; type View is access all Object'Class; procedure destroy (Self : in out Object'Class); procedure free (Self : in out View); -------------- -- Attributes -- function Name (Self : in Object) return Buffer.a_Name; function Kind (Self : in Object) return Buffer.a_Kind is abstract; function Length (Self : in Object) return Positive; -------------- -- Operations -- procedure enable (Self : in Object'Class); ----------------------------------------------- -- Derived 'array' and 'element array' Classes -- type array_Object is new Object with private; type element_array_Object is new Object with private; -- -- Refer to child packages, for specific buffers: -- -- - gl.Buffer.vertex -- - gl.Buffer.texture_coords -- - gl.Buffer.normals -- - gl.Buffer.indices -- -- (TODO: pixel pack/unpack buffers) ---------- -- Errors -- no_platform_Support : exception; -- -- Raised by buffer 'Map' functions when OS platform does not -- support GL Buffer objects. private use GL.lean; -- Buffer Kinds -- for a_Kind use (array_Buffer => GL_ARRAY_BUFFER, element_array_Buffer => GL_ELEMENT_ARRAY_BUFFER); for a_Kind'Size use gl.GLenum'Size; function to_GL_Enum is new ada.unchecked_Conversion (a_Kind, gl.GLenum); -- Usage -- for Usage use (stream_Draw => GL_STREAM_DRAW, static_Draw => GL_STATIC_DRAW, dynamic_Draw => GL_DYNAMIC_DRAW); for Usage'Size use GL.GLenum'Size; function to_GL_Enum is new ada.unchecked_Conversion (Usage, gl.GLenum); ---------- -- Object -- type Object is abstract tagged limited record Name : aliased Buffer.a_Name := 0; Length : Positive; end record; overriding function Kind (Self : in array_Object) return Buffer.a_Kind; overriding function Kind (Self : in element_array_Object) return Buffer.a_Kind; type array_Object is new Object with null record; type element_array_Object is new Object with null record; -- Support -- procedure verify_Name (Self : in out Object'Class); end openGL.Buffer;
programs/oeis/133/A133081.asm
jmorken/loda
1
166038
<gh_stars>1-10 ; A133081: An interpolation operator, companion to A133080. ; 1,1,0,0,1,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1 cal $0,127701 ; Infinite lower triangular matrix with (1, 2, 3,...) in the main diagonal, (1, 1, 1,...) in the subdiagonal and the rest zeros. mod $0,2 mov $1,$0
Ejemplos/mikroBasic/Led_bluetooth/Led_bluetooth.asm
DAFRELECTRONICS/ThunderBolt-Nova
0
93609
_main: ;Led_bluetooth.mbas,8 :: org 0x1000 ;Led_bluetooth.mbas,11 :: ANSELH.3 = 0 BCF ANSELH+0, 3 ;Led_bluetooth.mbas,12 :: TRISB.5 = 1 BSF TRISB+0, 5 ;Led_bluetooth.mbas,13 :: TRISB.7 = 0 BCF TRISB+0, 7 ;Led_bluetooth.mbas,14 :: TRISB.4 = 1 BSF TRISB+0, 4 ;Led_bluetooth.mbas,16 :: UART1_Init(9600) BSF BAUDCON+0, 3, 0 MOVLW 4 MOVWF SPBRGH+0 MOVLW 225 MOVWF SPBRG+0 BSF TXSTA+0, 2, 0 CALL _UART1_Init+0, 0 ;Led_bluetooth.mbas,18 :: UART1_Write_Text("Ejemplo bluetooth") MOVLW 69 MOVWF ?LocalText_main+0 MOVLW 106 MOVWF ?LocalText_main+1 MOVLW 101 MOVWF ?LocalText_main+2 MOVLW 109 MOVWF ?LocalText_main+3 MOVLW 112 MOVWF ?LocalText_main+4 MOVLW 108 MOVWF ?LocalText_main+5 MOVLW 111 MOVWF ?LocalText_main+6 MOVLW 32 MOVWF ?LocalText_main+7 MOVLW 98 MOVWF ?LocalText_main+8 MOVLW 108 MOVWF ?LocalText_main+9 MOVLW 117 MOVWF ?LocalText_main+10 MOVLW 101 MOVWF ?LocalText_main+11 MOVLW 116 MOVWF ?LocalText_main+12 MOVLW 111 MOVWF ?LocalText_main+13 MOVLW 111 MOVWF ?LocalText_main+14 MOVLW 116 MOVWF ?LocalText_main+15 MOVLW 104 MOVWF ?LocalText_main+16 CLRF ?LocalText_main+17 MOVLW ?LocalText_main+0 MOVWF FARG_UART1_Write_Text_uart_text+0 MOVLW hi_addr(?LocalText_main+0) MOVWF FARG_UART1_Write_Text_uart_text+1 CALL _UART1_Write_Text+0, 0 ;Led_bluetooth.mbas,19 :: UART1_Write(10) MOVLW 10 MOVWF FARG_UART1_Write_data_+0 CALL _UART1_Write+0, 0 ;Led_bluetooth.mbas,20 :: UART1_Write(13) MOVLW 13 MOVWF FARG_UART1_Write_data_+0 CALL _UART1_Write+0, 0 ;Led_bluetooth.mbas,22 :: loop: L__main_loop: ;Led_bluetooth.mbas,23 :: if PORTA.3 = 0 then BTFSC PORTA+0, 3 GOTO L__main3 ;Led_bluetooth.mbas,24 :: UART1_Write_Text("Hola") MOVLW 72 MOVWF ?LocalText_main+0 MOVLW 111 MOVWF ?LocalText_main+1 MOVLW 108 MOVWF ?LocalText_main+2 MOVLW 97 MOVWF ?LocalText_main+3 CLRF ?LocalText_main+4 MOVLW ?LocalText_main+0 MOVWF FARG_UART1_Write_Text_uart_text+0 MOVLW hi_addr(?LocalText_main+0) MOVWF FARG_UART1_Write_Text_uart_text+1 CALL _UART1_Write_Text+0, 0 ;Led_bluetooth.mbas,25 :: UART1_Write(10) MOVLW 10 MOVWF FARG_UART1_Write_data_+0 CALL _UART1_Write+0, 0 ;Led_bluetooth.mbas,26 :: UART1_Write(13) MOVLW 13 MOVWF FARG_UART1_Write_data_+0 CALL _UART1_Write+0, 0 ;Led_bluetooth.mbas,27 :: while(PORTA.3 = 0) L__main6: BTFSS PORTA+0, 3 GOTO L__main6 ;Led_bluetooth.mbas,28 :: wend L__main3: ;Led_bluetooth.mbas,31 :: if (UART1_Data_Ready() <> 0) then CALL _UART1_Data_Ready+0, 0 MOVF R0, 0 XORLW 0 BTFSC STATUS+0, 2 GOTO L__main11 ;Led_bluetooth.mbas,32 :: recibido = UART1_Read() CALL _UART1_Read+0, 0 MOVF R0, 0 MOVWF _recibido+0 ;Led_bluetooth.mbas,33 :: uart1_write(recibido) MOVF R0, 0 MOVWF FARG_UART1_Write_data_+0 CALL _UART1_Write+0, 0 L__main11: ;Led_bluetooth.mbas,37 :: goto loop GOTO L__main_loop L_end_main: GOTO $+0 ; end of _main
gcc-gcc-7_3_0-release/gcc/ada/s-traceb-mastop.adb
best08618/asylo
7
30657
<filename>gcc-gcc-7_3_0-release/gcc/ada/s-traceb-mastop.adb ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . T R A C E B A C K -- -- -- -- B o d y -- -- -- -- Copyright (C) 1999-2015, AdaCore -- -- -- -- 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 version uses System.Machine_State_Operations routines with System.Machine_State_Operations; package body System.Traceback is use System.Machine_State_Operations; procedure Call_Chain (Traceback : System.Address; Max_Len : Natural; Len : out Natural; Exclude_Min : System.Address := System.Null_Address; Exclude_Max : System.Address := System.Null_Address; Skip_Frames : Natural := 1); -- Same as the exported version, but takes Traceback as an Address ---------------- -- Call_Chain -- ---------------- procedure Call_Chain (Traceback : System.Address; Max_Len : Natural; Len : out Natural; Exclude_Min : System.Address := System.Null_Address; Exclude_Max : System.Address := System.Null_Address; Skip_Frames : Natural := 1) is type Tracebacks_Array is array (1 .. Max_Len) of Code_Loc; pragma Suppress_Initialization (Tracebacks_Array); M : Machine_State; Code : Code_Loc; Trace : Tracebacks_Array; for Trace'Address use Traceback; N_Skips : Natural := 0; begin M := Allocate_Machine_State; Set_Machine_State (M); -- Skip the requested number of frames loop Code := Get_Code_Loc (M); exit when Code = Null_Address or else N_Skips = Skip_Frames; Pop_Frame (M); N_Skips := N_Skips + 1; end loop; -- Now, record the frames outside the exclusion bounds, updating -- the Len output value along the way. Len := 0; loop Code := Get_Code_Loc (M); exit when Code = Null_Address or else Len = Max_Len; if Code < Exclude_Min or else Code > Exclude_Max then Len := Len + 1; Trace (Len) := Code; end if; Pop_Frame (M); end loop; Free_Machine_State (M); end Call_Chain; procedure Call_Chain (Traceback : in out System.Traceback_Entries.Tracebacks_Array; Max_Len : Natural; Len : out Natural; Exclude_Min : System.Address := System.Null_Address; Exclude_Max : System.Address := System.Null_Address; Skip_Frames : Natural := 1) is begin Call_Chain (Traceback'Address, Max_Len, Len, Exclude_Min, Exclude_Max, -- Skip one extra frame to skip the other Call_Chain entry as well Skip_Frames => Skip_Frames + 1); end Call_Chain; ------------------ -- C_Call_Chain -- ------------------ function C_Call_Chain (Traceback : System.Address; Max_Len : Natural) return Natural is Val : Natural; begin Call_Chain (Traceback, Max_Len, Val); return Val; end C_Call_Chain; end System.Traceback;
3-mid/physics/interface/source/physics-shape.adb
charlie5/lace
20
20243
with ada.unchecked_Deallocation; package body physics.Shape is procedure free (Self : in out View) is procedure deallocate is new ada.unchecked_Deallocation (Item'Class, View); begin if Self /= null then Self.destruct; end if; deallocate (Self); end free; end physics.Shape;
2004-summer/mp1/mp1.asm
ece291/machine-problems
3
11344
; MP1 - Gradebook ; Your Name ; Today's Date ; ; <NAME>, Summer 2004 ; University of Illinois, Urbana-Champaign ; Dept. of Electrical and Computer Engineering ; ; Version 1.0 BITS 16 ;====== SECTION 1: Define constants ======================================= CR EQU 0Dh LF EQU 0Ah NUMSTUDENTS EQU 30 NUMRANGES EQU 5 ;====== SECTION 2: Declare external routines ============================== ; Declare external library routines EXTERN dspmsg, mp1xit EXTERN libCalculateScores, libCalculateRanges, libConstructStarString, libDisplayHistogram ; Declare local routines GLOBAL CalculateScores, CalculateRanges, ConstructStarString, DisplayHistogram ; Make program variables global GLOBAL Grades, IntroString, EnterString, StarString, RangeStrings, RangeCount ;====== SECTION 3: Define stack segment =================================== SEGMENT stkseg STACK ; *** STACK SEGMENT *** resb 64*8 stacktop: resb 0 ; work around NASM bug ;====== SECTION 4: Define code segment ==================================== SEGMENT code ; *** CODE SEGMENT *** ;====== SECTION 5: Declare variables for main procedure =================== ; These are the grades obtained by 30 sample students in ECE 291. ; Each row corresponds to one student. The grades are listed as ; follows: ; ; HW0,HW1,HW2,HW3,HW4,HW5,HW6,MP0,MP1,MP2,MP3,MP4,EX1,EX2,FINAL,PROJECT,TOTAL ; ; Note that the total is initially 0,0 as you need to reserve a word for the ; total (2 bytes), and you will need to calculate the total in your program. Grades db 20,20,20,20,20,61,20,30,53,71,84,80, 97,116,122,122,0,0 db 20,20,20,20,20,61,20,30,60,60,84,90,120, 84,112,112,0,0 db 20,20,20,20,20,20, 0,30,64,70,85,70, 73,104,134,134,0,0 db 20,20,20,20,20,20,20,30,64,74,81,90, 91,106,120, 99,0,0 db 20,20,20,15,20,20, 0,30,65,74,85,90, 85,109,143,154,0,0 db 20,20,10, 0, 0, 5,20,30,40,35,65,60, 70, 62, 96,100,0,0 db 20,20,20,20,20,73, 0,30,48,70,80,70, 73, 45,129,123,0,0 db 20,20,17,20,20,20,20,30,65,80,85,90,110,105,139,128,0,0 db 14,18,18,16,13,20, 5,30,50,70,80,84,119,103,124,103,0,0 db 20,20,20,20,20,20,20,30,55,73,85,80, 59, 66,115,120,0,0 db 20,20,20,17,16,20, 2,30,50,70,80,90, 92, 99,115,130,0,0 db 20,20,20,20,20,20,20,30,65,80,85,90,101,102,113,134,0,0 db 20,20,20,20,20,20, 7,30,55,75,85,90, 78, 84,124,145,0,0 db 20,10,20,20,20,20,20,30,49,72,80,80, 77, 89,134,114,0,0 db 20,20,20,20,20,20,20,20,62,72,60,90, 90, 97,132,133,0,0 db 20,20,20,20,19, 0, 0,20,54,74,70,70, 74,101,121, 80,0,0 db 16,19,18,17,16,15, 0,20,50,71,81,80,104, 75,125,126,0,0 db 20,20,20,20,20,20,20,30,55,75,84, 0,112,107,136,155,0,0 db 20,20,20,11,20,12, 0,30,49,44,79,90,106,103,101,119,0,0 db 20,20,20,20,20,20,20,20,20,40,40,70, 84,117,110,115,0,0 db 20,20,20,20,20,20,20,20,46,75,82,70,106, 96,122,153,0,0 db 20,18, 7, 0,20,20,20,20,46,70,78,30,118,108,132,131,0,0 db 20,20,20, 0,20,20, 0,30,55,75,85,90,101,108,141,151,0,0 db 20,20,20,20,20,73,20, 0,47,73,81,90, 67, 79,131,128,0,0 db 20,20,20,20,20,20,20,30,52,72,80,90, 94, 86,146,111,0,0 db 20,20,20,20,20,20,20,20,55,70,81,90, 46, 99,129,134,0,0 db 20,20,20,20,20,20,20,20,51,71,81,70,108,104,131,120,0,0 db 20,20,20,20,63,52,10,30,55,70,80,60,104, 86,114,121,0,0 db 20, 0, 0,20,20,20, 9,20,48,70,79,55, 81,119,109,107,0,0 db 20,20,20,20,20,20,20,30,20,40,40,50,120,100,150,160,0,0 IntroString db CR,LF,'ECE 291 Summer 2004',CR,LF,'MP1 - Gradebook',CR,LF,CR,LF,'$' ; Mimics hitting the enter key EnterString db CR,LF,'$' ; String used to hold one bar of the histogram. The string will contain up to ; 30 stars (*) followed by a dollar sign to terminate the string StarString times 31 db 0 ; Strings to define the grade ranges RangeStrings db ' (A) 900-1000 ','$' db ' (B) 800-899 ','$' db ' (C) 700-799 ','$' db ' (D) 600-699 ','$' db ' (F) < 600 ','$' ; Array holding the number of scores that fall into each of the ranges above. ; The number of A grades is stored in the first cell of the array, and so on... RangeCount times 5 db 0 ;====== SECTION 6: Program initialization ================================= ..start: mov ax, cs ; Initialize Default Segment register mov ds, ax mov ax, stkseg ; Initialize Stack Segment register mov ss, ax mov sp, stacktop ; Initialize Stack Pointer register ;====== SECTION 7: Main procedure ========================================= MAIN: mov dx, IntroString call dspmsg call CalculateScores call CalculateRanges call DisplayHistogram call mp1xit ;====== SECTION 8: Your subroutines ======================================= ;-------------------------------------------------------------- ;-- Replace library calls with your code! -- ;-- [Save all reg values that you modify] -- ;-- Do not forget to add function headers -- ;-------------------------------------------------------------- ;-------------------------------------------------------------- ;-- CalculateScores() -- ;-------------------------------------------------------------- CalculateScores call libCalculateScores ret ;-------------------------------------------------------------- ;-- CalculateRanges() -- ;-------------------------------------------------------------- CalculateRanges call libCalculateRanges ret ;-------------------------------------------------------------- ;-- ConstructStarString() -- ;-------------------------------------------------------------- ConstructStarString call libConstructStarString ret ;-------------------------------------------------------------- ;-- DisplayHistogram() -- ;-------------------------------------------------------------- DisplayHistogram call libDisplayHistogram ret
src/natools-web-simple_pages.ads
faelys/natools-web
1
309
<gh_stars>1-10 ------------------------------------------------------------------------------ -- Copyright (c) 2014-2019, <NAME> -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.Web.Simple_Pages provides a simple implementation of Sites.Page -- -- and Tags.Visible, representing a single page in a usual blog-style -- -- static site. -- ------------------------------------------------------------------------------ with Ada.Calendar; with Natools.S_Expressions.Atom_Refs; with Natools.S_Expressions.Lockable; with Natools.Web.Sites; with Natools.Web.Tags; private with Natools.References; private with Natools.S_Expressions.Caches; private with Natools.Storage_Pools; private with Natools.Web.Containers; private with Natools.Web.Comments; private with Natools.Web.String_Tables; package Natools.Web.Simple_Pages is type Page_Template is private; procedure Set_Comments (Object : in out Page_Template; Expression : in out S_Expressions.Lockable.Descriptor'Class); procedure Set_Comment_Path_Prefix (Object : in out Page_Template; Prefix : in S_Expressions.Atom); procedure Set_Comment_Path_Suffix (Object : in out Page_Template; Suffix : in S_Expressions.Atom); procedure Set_Elements (Object : in out Page_Template; Expression : in out S_Expressions.Lockable.Descriptor'Class); procedure Set_Component (Object : in out Page_Template; Name : in S_Expressions.Atom; Arguments : in out S_Expressions.Lockable.Descriptor'Class; Known_Component : out Boolean); procedure Update (Object : in out Page_Template; Expression : in out S_Expressions.Lockable.Descriptor'Class); Default_Template : constant Page_Template; type Page_Ref is new Tags.Visible and Sites.Page with private; function Create (File_Path, Web_Path : in S_Expressions.Atom_Refs.Immutable_Reference; Template : in Page_Template := Default_Template; Name : in S_Expressions.Atom := S_Expressions.Null_Atom) return Page_Ref; function Create (Expression : in out S_Expressions.Lockable.Descriptor'Class; Template : in Page_Template := Default_Template; Name : in S_Expressions.Atom := S_Expressions.Null_Atom) return Page_Ref; procedure Get_Lifetime (Page : in Page_Ref; Publication : out Ada.Calendar.Time; Has_Publication : out Boolean; Expiration : out Ada.Calendar.Time; Has_Expiration : out Boolean); function Get_Tags (Page : Page_Ref) return Tags.Tag_List; procedure Register (Page : in Page_Ref; Builder : in out Sites.Site_Builder; Path : in S_Expressions.Atom); overriding procedure Render (Exchange : in out Sites.Exchange; Object : in Page_Ref; Expression : in out S_Expressions.Lockable.Descriptor'Class); overriding procedure Respond (Object : in out Page_Ref; Exchange : in out Sites.Exchange; Extra_Path : in S_Expressions.Atom); type Loader is new Sites.Page_Loader with private; overriding procedure Load (Object : in out Loader; Builder : in out Sites.Site_Builder; Path : in S_Expressions.Atom); function Create (File : in S_Expressions.Atom) return Sites.Page_Loader'Class; procedure Register_Loader (Site : in out Sites.Site); private type Page_Template is record Comments : Containers.Optional_Expression; Comment_Path_Prefix : S_Expressions.Atom_Refs.Immutable_Reference; Comment_Path_Suffix : S_Expressions.Atom_Refs.Immutable_Reference; Elements : Containers.Expression_Maps.Constant_Map; Name : S_Expressions.Atom_Refs.Immutable_Reference; end record; Default_Template : constant Page_Template := (others => <>); type Page_Data is new Tags.Visible with record Self : Tags.Visible_Access; File_Path : S_Expressions.Atom_Refs.Immutable_Reference; Web_Path : S_Expressions.Atom_Refs.Immutable_Reference; Elements : Containers.Expression_Maps.Constant_Map; Tags : Web.Tags.Tag_List; Dates : Containers.Date_Maps.Constant_Map; Comment_List : Comments.Comment_List; Maps : String_Tables.String_Table_Map; end record; not overriding procedure Get_Element (Data : in Page_Data; Name : in S_Expressions.Atom; Element : out S_Expressions.Caches.Cursor; Found : out Boolean); overriding procedure Render (Exchange : in out Sites.Exchange; Object : in Page_Data; Expression : in out S_Expressions.Lockable.Descriptor'Class); package Data_Refs is new References (Page_Data, Storage_Pools.Access_In_Default_Pool'Storage_Pool, Storage_Pools.Access_In_Default_Pool'Storage_Pool); type Page_Ref is new Tags.Visible and Sites.Page with record Ref : Data_Refs.Reference; end record; function Get_Tags (Page : Page_Ref) return Tags.Tag_List is (Page.Ref.Query.Data.Tags); type Loader is new Sites.Page_Loader with record File_Path : S_Expressions.Atom_Refs.Immutable_Reference; end record; end Natools.Web.Simple_Pages;
oeis/019/A019561.asm
neoneye/loda-programs
11
96798
; A019561: Coordination sequence for C_5 lattice. ; 1,50,450,1970,5890,14002,28610,52530,89090,142130,216002,315570,446210,613810,824770,1086002,1404930,1789490,2248130,2789810,3424002,4160690,5010370,5984050,7093250,8350002,9766850,11356850,13133570,15111090,17304002,19727410,22396930,25328690,28539330,32046002,35866370,40018610,44521410,49393970,54656002,60327730,66429890,72983730,80011010,87534002,95575490,104158770,113307650,123046450,133400002,144393650,156053250,168405170,181476290,195294002,209886210,225281330,241508290,258596530 mul $0,2 pow $0,2 mov $2,4 mul $2,$0 add $0,5 mul $0,$2 add $0,6 mov $1,9 trn $1,$0 gcd $1,$0 sub $1,3 div $1,3 add $1,1 mov $0,$1
test/asm/relative.asm
renatocf/MAC0242-PROJECT
1
98877
JMP 3 PUSH Nao PRN PUSH Sim PRN JMP -5
oeis/067/A067804.asm
neoneye/loda-programs
11
241896
<gh_stars>10-100 ; A067804: Triangle read by rows: T(n,k) is the number of walks (each step +-1) of length 2n which have a cumulative value of 0 last at step 2k. ; Submitted by <NAME> ; 1,2,2,6,4,6,20,12,12,20,70,40,36,40,70,252,140,120,120,140,252,924,504,420,400,420,504,924,3432,1848,1512,1400,1400,1512,1848,3432,12870,6864,5544,5040,4900,5040,5544,6864,12870,48620,25740,20592,18480,17640,17640,18480,20592,25740,48620,184756,97240,77220,68640,64680,63504,64680,68640,77220,97240,184756,705432,369512,291720,257400,240240,232848,232848,240240,257400,291720,369512,705432,2704156,1410864,1108536,972400,900900,864864,853776,864864,900900,972400,1108536,1410864,2704156,10400600 lpb $0 add $1,1 sub $0,$1 mov $2,$1 sub $2,$0 lpe mov $1,$0 mul $1,2 bin $1,$0 mov $0,2 mul $0,$2 bin $0,$2 mul $1,$0 mov $0,$1
Assembly Files/Basic Test Files/Larson_Scanner.asm
bgmichelsen/6502-Computer
0
103943
START: LDA #$FF ; Store 255 in the DDRB register in the 65C22 STA $B402 LDA #00 ; Clear the accumulator CLC FORWARD: ADC #$01 ; Count up in the accumulator STA $B400 ; Display the contents of the accumulator using PORTB JSR DELAY ; Delay for a bit CMP #$FF ; Compare with 255 BNE FORWARD ; Continue until 255 is reached SEC BACKWARD: SBC #$01 ; Count down in the accumulator STA $B400 ; Display the contents of the accumulator using PORTB JSR DELAY ; Delay for a bit CMP #$00 ; Compare with 0 BNE BACKWARD ; Continue until 0 is reached CLC JMP FORWARD ; Repeat ;;;; A delay loop that pauses the program execution for a certain amount of time ;;;; DELAY: LDX #$00 LDY #$00 LOOP1: INY ; Count up in Y register LOOP2: INX ; Count up in X register CPX #$01 ; Cycle iterations X BNE LOOP2 CPY #$01 ; Cycle iterations Y BNE LOOP1 END: RTS ; End subroutine
test/Fail/UnknownImplicitInstance.agda
shlevy/agda
1,989
6818
<filename>test/Fail/UnknownImplicitInstance.agda module UnknownImplicitInstance where ⟨⟩ : {A : Set} {{a : A}} → A ⟨⟩ {{a}} = a postulate B : Set instance b : B f : {A : Set₁} {{a : A}} → A x : Set x = f
third_party/antlr_grammars_v4/mdx/mdx.g4
mikhan808/rsyntaxtextarea-antlr4-extension
2
1416
grammar mdx; mdx_statement : (select_statement) EOF ; select_statement : (WITH formula_specification)? SELECT axis_specification_list? FROM cube_specification (WHERE slicer_specification)? cell_props? ; formula_specification : single_formula_specification + ; single_formula_specification : member_specification | set_specification ; set_specification : SET set_name AS (QUOTE expression QUOTE | expression) ; member_specification : MEMBER member_name AS ((QUOTE value_expression QUOTE | value_expression) COMMA member_property_def_list?) ; axis_specification_list : axis_specification (COMMA axis_specification)* ; member_property_def_list : member_property_definition (COMMA member_property_definition)* ; member_name : compound_id ; member_property_definition : identifier EQ value_expression ; set_name : compound_id ; compound_id : identifier (DOT identifier)* ; axis_specification : (NON EMPTY)? expression dim_props? ON axis_name ; axis_name : identifier ; dim_props : DIMENSION? PROPERTIES property_list ; property_list : property (COMMA property)* ; property : compound_id ; cube_specification : cube_name ; cube_name : compound_id ; slicer_specification : expression ; cell_props : CELL? PROPERTIES cell_property_list ; cell_property_list : cell_property (COMMA cell_property)* ; cell_property : mandatory_cell_property | provider_specific_cell_property ; mandatory_cell_property : CELL_ORDINAL | VALUE | FORMATTED_VALUE ; provider_specific_cell_property : identifier ; expression : value_expression (COLON value_expression)* ; value_expression : term5 (value_xor_expression | value_or_expression)* ; value_xor_expression : XOR term5 ; value_or_expression : OR term5 ; term5 : term4 (AND term4)* ; term4 : NOT term4 | term3 ; term3 : term2 (comp_op term2)* ; term2 : term ((CONCAT | PLUS | MINUS) term)* ; term : factor ((SOLIDUS | ASTERISK) factor)* ; factor : MINUS value_expression_primary | PLUS value_expression_primary | value_expression_primary ; function_ : identifier LPAREN (exp_list)? RPAREN ; value_expression_primary : value_expression_primary0 (DOT (unquoted_identifier | quoted_identifier | amp_quoted_identifier | function_))* ; value_expression_primary0 : function_ | (LPAREN exp_list RPAREN) | (LBRACE (exp_list)? RBRACE) | case_expression | STRING | NUMBER | identifier ; exp_list : expression (COMMA expression)* ; case_expression : CASE (value_expression)? (when_list)? (ELSE value_expression)? END ; when_list : when_clause (when_clause)* ; when_clause : WHEN value_expression THEN value_expression ; comp_op : EQ | NE | LT | GT | LE | GE ; identifier : (unquoted_identifier | quoted_identifier) ; unquoted_identifier : keyword | ID ; amp_quoted_identifier : AMP_QUOTED_ID ; quoted_identifier : QUOTED_ID ; keyword : DIMENSION | PROPERTIES ; QUOTE : '\'' ; ASTERISK : '*' ; COLON : ':' ; SEMICOLON : ';' ; COMMA : ',' ; CONCAT : '||' ; DOT : '.' ; EQ : '=' ; GE : '>=' ; GT : '>' ; LBRACE : '{' ; LE : '<=' ; LPAREN : '(' ; LT : '<' ; MINUS : '-' ; NE : '<>' ; PLUS : '+' ; RBRACE : '}' ; RPAREN : ')' ; SOLIDUS : '/' ; AND : 'AND' ; AS : 'AS' ; CASE : 'CASE' ; CELL : 'CELL' ; CELL_ORDINAL : 'CELL_ORDINAL' ; CREATE : 'CREATE' ; DIMENSION : 'DIMENSION' ; ELSE : 'ELSE' ; EMPTY : 'EMPTY' ; END : 'END' ; FORMATTED_VALUE : 'FORMATTED_VALUE' ; FROM : 'FROM' ; GLOBAL : 'GLOBAL' ; MEMBER : 'MEMBER' ; NON : 'NON' ; NOT : 'NOT' ; ON : 'ON' ; OR : 'OR' ; PROPERTIES : 'PROPERTIES' ; SELECT : 'SELECT' ; SESSION : 'SESSION' ; SET : 'SET' ; THEN : 'THEN' ; VALUE : 'VALUE' ; WHEN : 'WHEN' ; WHERE : 'WHERE' ; XOR : 'XOR' ; WITH : 'WITH' ; NUMBER : ('0' .. '9') + ; F : '0' .. '9' + '.' '0' .. '9'* ; ID : ('a' .. 'z' | 'A' .. 'Z' | '_' | '$') ('a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' | '$')* ; AMP_QUOTED_ID : '[&' (ID ((' ' | '\t') + ID)* | NUMBER) ']' ; QUOTED_ID : ('[' (ID ((' ' | '\t') + ID)* | NUMBER) ']') ; STRING : '"' (~ '"')* '"' | '\'' (~ '\'')* '\'' ; WS : (' ' | '\t' | '\r' | '\f' | '\n') + -> skip ;
core/words/screenwrite.asm
paulscottrobson/nextForth
2
100684
; ; Word: screen! ; Dictionary: (a c - ) ; Date: 4th February 2018 ; Macro: No ; Notes: ; pop ix ex de,hl pop de ld a,e call IO_WriteCharacter pop de jp (ix)
libsrc/fcntl/nc100/remove.asm
jpoikela/z88dk
640
29025
<reponame>jpoikela/z88dk SECTION code_clib PUBLIC remove PUBLIC _remove .remove ._remove call 0xB893 ld hl, 0 ret c dec hl ret
code/6502/basic/drivers/output_lcd_12864.asm
visrealm/hbc-56
65
2887
; Troy's HBC-56 - BASIC - Output (128x64 Graphics LCD) ; ; Copyright (c) 2021 <NAME> ; ; This code is licensed under the MIT license ; ; https://github.com/visrealm/hbc-56 ; TILE_OFFSET = HBC56_USER_ZP_START + 3 !align 255, 0 c64FontData: !bin "lcd/fonts/c64-font-ascii.bin" onVsync: lda HBC56_TICKS beq .doCursor cmp #30 beq .doCursor rts .doCursor: lda HBC56_TICKS beq + lda #' ' jmp ++ + lda #$ff ++ sty HBC56_TMP_Y ldy TILE_OFFSET sta TILEMAP_DEFAULT_BUFFER_ADDRESS, y ldy HBC56_TMP_Y jsr tilemapRenderToLcd rts ; ----------------------------------------------------------------------------- ; hbc56SetupDisplay - Setup the display (LCD) ; ----------------------------------------------------------------------------- hbc56SetupDisplay: sei jsr lcdInit jsr lcdClear jsr lcdGraphicsMode +tilemapCreateDefault (TILEMAP_SIZE_X_16 | TILEMAP_SIZE_Y_8), c64FontData lda #0 sta TILE_OFFSET !ifdef tmsInit { +hbc56SetVsyncCallback onVsync +tmsEnableInterrupts } rts ; ----------------------------------------------------------------------------- ; hbc56Out - EhBASIC output subroutine (for HBC-56 LCD) ; ----------------------------------------------------------------------------- ; Inputs: A - ASCII character (or code) to output ; Outputs: A - must be maintained ; ----------------------------------------------------------------------------- hbc56Out: sei ; disable interrupts during output stx SAVE_X sty SAVE_Y sta SAVE_A cmp #ASCII_RETURN beq .newline cmp #ASCII_BACKSPACE beq .backspace cmp #ASCII_BELL ; bell (end of buffer) beq .bellOut cmp #ASCII_CR ; omit these beq .endOut ; regular character ldy TILE_OFFSET sta TILEMAP_DEFAULT_BUFFER_ADDRESS, y inc TILE_OFFSET jsr checkTileOffset .endOut: ; just render this row lda TILE_OFFSET lsr lsr lsr lsr tay jsr tilemapRenderRowToLcd ldx SAVE_X ldy SAVE_Y lda SAVE_A cli rts .bellOut jsr hbc56Bell jmp .endOut .newline lda #' ' ldy TILE_OFFSET sta TILEMAP_DEFAULT_BUFFER_ADDRESS, y ; just render this row lda TILE_OFFSET lsr lsr lsr lsr tay jsr tilemapRenderToLcd lda TILE_OFFSET clc adc #16 and #$F0 sta TILE_OFFSET jsr checkTileOffset jmp .endOut .backspace lda #' ' ldy TILE_OFFSET sta TILEMAP_DEFAULT_BUFFER_ADDRESS, y dec TILE_OFFSET ldy TILE_OFFSET lda #' ' sta TILEMAP_DEFAULT_BUFFER_ADDRESS, y jmp .endOut rts checkTileOffset: lda TILE_OFFSET cmp #128 bcc .offsetOk ; scroll ldx #0 ldy #16 - lda TILEMAP_DEFAULT_BUFFER_ADDRESS, y sta TILEMAP_DEFAULT_BUFFER_ADDRESS, x inx iny cpy #128 bne - lda #128-16 sta TILE_OFFSET ; clear the last row +memset TILEMAP_DEFAULT_BUFFER_ADDRESS + 128 - 16, ' ', 16 jsr tilemapRenderToLcd .offsetOk rts
src/Numeric/Nat/GCD.agda
lclem/agda-prelude
0
17121
<filename>src/Numeric/Nat/GCD.agda module Numeric.Nat.GCD where open import Prelude open import Control.WellFounded open import Numeric.Nat.Properties open import Numeric.Nat.DivMod open import Numeric.Nat.Divide open import Numeric.Nat.Divide.Properties open import Tactic.Nat --- GCD --- record IsGCD (d a b : Nat) : Set where no-eta-equality constructor is-gcd field d|a : d Divides a d|b : d Divides b g : ∀ k → k Divides a → k Divides b → k Divides d record GCD (a b : Nat) : Set where no-eta-equality constructor gcd-res field d : Nat isGCD : IsGCD d a b open GCD public using () renaming (d to get-gcd) -- Projections -- is-gcd-factor₁ : ∀ {a b d} → IsGCD d a b → Nat is-gcd-factor₁ g = get-factor (IsGCD.d|a g) is-gcd-factor₂ : ∀ {a b d} → IsGCD d a b → Nat is-gcd-factor₂ g = get-factor (IsGCD.d|b g) gcd-factor₁ : ∀ {a b} → GCD a b → Nat gcd-factor₁ g = is-gcd-factor₁ (GCD.isGCD g) gcd-factor₂ : ∀ {a b} → GCD a b → Nat gcd-factor₂ g = is-gcd-factor₂ (GCD.isGCD g) -- Euclid's algorithm -- isGCD-step : ∀ {d r₀ r₁ r₂} q → q * r₁ + r₂ ≡ r₀ → IsGCD d r₁ r₂ → IsGCD d r₀ r₁ isGCD-step q refl (is-gcd d|r₁ d|r₂ g) = is-gcd (divides-add (divides-mul-r q d|r₁) d|r₂) d|r₁ (λ k k|r₀ k|r₁ → g k k|r₁ (divides-sub-l k|r₀ (divides-mul-r q k|r₁))) private gcd-step : ∀ {a b} q {r} → q * suc b + r ≡ a → GCD (suc b) r → GCD a (suc b) gcd-step q eq (gcd-res d p) = gcd-res d (isGCD-step q eq p) gcd-cert-acc : ∀ a b → Acc _<_ b → GCD a b gcd-cert-acc a zero _ = gcd-res a (is-gcd (factor 1 auto) (factor! 0) (λ k k|a _ → k|a)) gcd-cert-acc a (suc b) (acc wf) = case a divmod suc b of λ { (qr q r lt eq) → gcd-step q eq (gcd-cert-acc (suc b) r (wf r lt)) } eraseIsGCD : ∀ {d a b} → IsGCD d a b → IsGCD d a b eraseIsGCD (is-gcd d|a d|b g) = is-gcd (fast-divides d|a) (fast-divides d|b) λ k k|a k|b → fast-divides (g k k|a k|b) eraseGCD : ∀ {a b} → GCD a b → GCD a b eraseGCD (gcd-res d p) = gcd-res d (eraseIsGCD p) gcd : ∀ a b → GCD a b gcd 0 b = gcd-res b (is-gcd (factor! 0) divides-refl (λ _ _ k|b → k|b)) gcd 1 b = gcd-res 1 (is-gcd divides-refl (factor b auto) (λ _ k|1 _ → k|1)) gcd a b = eraseGCD (gcd-cert-acc a b (wfNat b)) gcd! : Nat → Nat → Nat gcd! a b = get-gcd (gcd a b) Coprime : Nat → Nat → Set Coprime a b = gcd! a b ≡ 1
data/pokemon/base_stats/stantler.asm
AtmaBuster/pokeplat-gen2
6
94883
db 0 ; species ID placeholder db 73, 95, 62, 85, 85, 65 ; hp atk def spd sat sdf db NORMAL, NORMAL ; type db 45 ; catch rate db 165 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F50 ; gender ratio db 20 ; step cycles to hatch INCBIN "gfx/pokemon/stantler/front.dimensions" db GROWTH_SLOW ; growth rate dn EGG_GROUND, EGG_GROUND ; egg groups db 70 ; happiness ; tm/hm learnset tmhm CALM_MIND, ROAR, TOXIC, HIDDEN_POWER, SUNNY_DAY, LIGHT_SCREEN, PROTECT, RAIN_DANCE, FRUSTRATION, SOLARBEAM, IRON_TAIL, THUNDERBOLT, THUNDER, EARTHQUAKE, RETURN, PSYCHIC_M, SHADOW_BALL, DOUBLE_TEAM, REFLECT, SHOCK_WAVE, FACADE, SECRET_POWER, REST, ATTRACT, THIEF, SKILL_SWAP, ENERGY_BALL, CHARGE_BEAM, ENDURE, GIGA_IMPACT, FLASH, THUNDER_WAVE, PSYCH_UP, CAPTIVATE, SLEEP_TALK, NATURAL_GIFT, DREAM_EATER, SWAGGER, SUBSTITUTE, TRICK_ROOM, BOUNCE, LAST_RESORT, MUD_SLAP, SIGNAL_BEAM, SNORE, SPITE, SUCKER_PUNCH, SWIFT, UPROAR, ZEN_HEADBUTT ; end
test/Succeed/NatEquals.agda
cruhland/agda
1,989
6829
-- Andreas, 2013-10-21 -- There was a bug in Rules/Builtin such that NATEQUALS' equations -- would be checked at type Nat instead of Bool. -- This bug surfaced only because of today's refactoring in Conversion, -- because then I got a strange unsolved constraint true == true : Nat. module NatEquals where import Common.Level data Bool : Set where true false : Bool {-# BUILTIN BOOL Bool #-} {-# BUILTIN TRUE true #-} {-# BUILTIN FALSE false #-} data Nat : Set where zero : Nat suc : Nat -> Nat {-# BUILTIN NATURAL Nat #-} infix 40 _=?=_ _=?=_ : Nat -> Nat -> Bool zero =?= zero = true zero =?= suc _ = false suc _ =?= zero = false suc n =?= suc m = n =?= m {-# BUILTIN NATEQUALS _=?=_ #-}
include/game-gtimer.ads
Holt59/Ada-SDL
0
6203
-------------------------------------------- -- -- -- PACKAGE GAME - PARTIE ADA -- -- -- -- GAME-GTIMER.ADS -- -- -- -- Gestion des timers -- -- -- -- Créateur : <NAME> -- -- Adresse : <EMAIL> -- -- -- -- Dernière modification : 14 / 06 / 2011 -- -- -- -------------------------------------------- package Game.Gtimer is Max_Time : constant := 2**32 - 1 ; type Time is range 0 .. Max_Time ; -- Retourne le temps (en milliseconde) depuis l'initialisation function Get_Tick return Time; -- Mets le programme en pose pendant 'time' milliseconde procedure Wait (MS : in Time); end Game.Gtimer;
source/numerics/a-ngrear.ads
ytomino/drake
33
27327
pragma License (Unrestricted); generic type Real is digits <>; package Ada.Numerics.Generic_Real_Arrays is pragma Pure; -- Types type Real_Vector is array (Integer range <>) of Real'Base; for Real_Vector'Alignment use Standard'Maximum_Alignment; type Real_Matrix is array (Integer range <>, Integer range <>) of Real'Base; for Real_Matrix'Alignment use Standard'Maximum_Alignment; -- Subprograms for Real_Vector types -- Real_Vector arithmetic operations function "+" (Right : Real_Vector) return Real_Vector; function "-" (Right : Real_Vector) return Real_Vector; function "abs" (Right : Real_Vector) return Real_Vector; function "+" (Left, Right : Real_Vector) return Real_Vector; function "-" (Left, Right : Real_Vector) return Real_Vector; function "*" (Left, Right : Real_Vector) return Real'Base; function "abs" (Right : Real_Vector) return Real'Base; -- Real_Vector scaling operations function "*" (Left : Real'Base; Right : Real_Vector) return Real_Vector; function "*" (Left : Real_Vector; Right : Real'Base) return Real_Vector; function "/" (Left : Real_Vector; Right : Real'Base) return Real_Vector; -- Other Real_Vector operations function Unit_Vector ( Index : Integer; Order : Positive; First : Integer := 1) return Real_Vector; -- Subprograms for Real_Matrix types -- Real_Matrix arithmetic operations function "+" (Right : Real_Matrix) return Real_Matrix; function "-" (Right : Real_Matrix) return Real_Matrix; function "abs" (Right : Real_Matrix) return Real_Matrix; function Transpose (X : Real_Matrix) return Real_Matrix; function "+" (Left, Right : Real_Matrix) return Real_Matrix; function "-" (Left, Right : Real_Matrix) return Real_Matrix; function "*" (Left, Right : Real_Matrix) return Real_Matrix; function "*" (Left, Right : Real_Vector) return Real_Matrix; function "*" (Left : Real_Vector; Right : Real_Matrix) return Real_Vector; function "*" (Left : Real_Matrix; Right : Real_Vector) return Real_Vector; -- Real_Matrix scaling operations function "*" (Left : Real'Base; Right : Real_Matrix) return Real_Matrix; function "*" (Left : Real_Matrix; Right : Real'Base) return Real_Matrix; function "/" (Left : Real_Matrix; Right : Real'Base) return Real_Matrix; -- Real_Matrix inversion and related operations function Solve (A : Real_Matrix; X : Real_Vector) return Real_Vector; function Solve (A, X : Real_Matrix) return Real_Matrix; function Inverse (A : Real_Matrix) return Real_Matrix; function Determinant (A : Real_Matrix) return Real'Base; -- Eigenvalues and vectors of a real symmetric matrix function Eigenvalues (A : Real_Matrix) return Real_Vector; procedure Eigensystem ( A : Real_Matrix; Values : out Real_Vector; Vectors : out Real_Matrix); -- Other Real_Matrix operations function Unit_Matrix (Order : Positive; First_1, First_2 : Integer := 1) return Real_Matrix; end Ada.Numerics.Generic_Real_Arrays;
day-07-ada/day_07.adb
AlexViaColl/aoc-2021
0
23263
<reponame>AlexViaColl/aoc-2021<filename>day-07-ada/day_07.adb<gh_stars>0 with Ada.Command_Line; with Ada.Containers.Vectors; with Ada.Containers; with Ada.Direct_IO; with Ada.Directories; with Ada.Strings.Fixed; with Ada.Text_IO; procedure Day_07 is package Integer_Vectors is new Ada.Containers.Vectors(Index_Type => Natural, Element_Type => Integer); use Integer_Vectors; function Read_File(File_Path: String) return String is File_Size : Natural := Natural(Ada.Directories.Size(File_Path)); subtype File_String is String (1 .. File_Size); package File_String_IO is new Ada.Direct_IO(File_String); File : File_String_IO.File_Type; Contents : File_String; begin File_String_IO.Open(File, Mode => File_String_IO.In_File, Name => File_Path); File_String_IO.Read(File, Item => Contents); File_String_IO.Close(File); -- Ada.Text_IO.Put(Contents); return Contents; end Read_File; function Get_Positions(Contents: String) return Vector is Start: Natural; Idx: Natural; Cnt: Natural; V: Vector; begin Cnt := Ada.Strings.Fixed.Count(Source => Contents, Pattern => ","); Idx := 0; Start := 1; for I in 1 .. Cnt loop Idx := Ada.Strings.Fixed.Index(Source => Contents, Pattern => ",", From => Idx + 1); V.Append(Integer'Value(Contents(Start..Idx - 1))); Start := Idx + 1; end loop; V.Append(Integer'Value(Contents(Start..Contents'Last))); return V; end Get_Positions; function Total(Value: Integer) return Integer is begin if Value <= 1 then return Value; else return Value + Total(Value - 1); end if; end Total; procedure Part1(File_Path: String) is Contents: String := Read_File(File_Path); Median: Natural; Fuel: Natural; V: Vector; package Integer_Vectors_Sorting is new Integer_Vectors.Generic_Sorting; use Integer_Vectors_Sorting; begin V := Get_Positions(Contents); Sort(V); Median := V(Natural(V.Length) / 2); Fuel := 0; for E of V loop Fuel := Fuel + abs(E - Median); end loop; Ada.Text_IO.Put_Line("Part 1: " & Integer'Image(Fuel)); end Part1; procedure Part2(File_Path: String) is Contents: String := Read_File(File_Path); Min: Natural; Max: Natural; Fuel: Natural; Min_Fuel: Natural; V: Vector; package Integer_Vectors_Sorting is new Integer_Vectors.Generic_Sorting; use Integer_Vectors_Sorting; begin V := Get_Positions(Contents); Sort(V); Min := V.First_Element; Max := V.Last_Element; Min_Fuel := 99999999; for I in Min .. Max loop Fuel := 0; for Pos of V loop Fuel := Fuel + Total(abs(Pos - I)); end loop; if Fuel < Min_Fuel then Min_Fuel := Fuel; end if; end loop; Ada.Text_IO.Put_Line("Part 2: " & Integer'Image(Min_Fuel)); end Part2; begin for I in 1..Ada.Command_Line.Argument_Count loop Part1(Ada.Command_Line.Argument(I)); Part2(Ada.Command_Line.Argument(I)); end loop; end Day_07;
oeis/087/A087432.asm
neoneye/loda-programs
11
20692
<reponame>neoneye/loda-programs ; A087432: Expansion of 1+x*(1-x-4*x^2)/((1+x)*(1-2*x)*(1-3*x)). ; Submitted by <NAME>(s1.) ; 1,1,3,7,19,51,143,407,1179,3451,10183,30207,89939,268451,802623,2402407,7196299,21567051,64657463,193885007,581480259,1744091251,5231574703,15693326007,47077181819,141225953051,423666674343,1270977653407,3812888220979,11438575184451,34315546596383,102946281875207,308838129797739,926512957737451,2779536009900823,8338602303079407,25015795455992099,75047363461484051,225142044571467663,675426042088434007,2026277943013364059,6078833462536216251,18236499654600896903,54709497497787187007 mov $1,3 pow $1,$0 add $0,1 mov $2,2 pow $2,$0 add $1,$2 mov $0,$1 sub $0,3 div $0,6 add $0,1
samples/t86.asm
wilsonpilon/msx-menu
0
102400
<gh_stars>0 ld a,(hl) ld a,a ld a,b ld a,c ld a,d ld a,e ld a,h ld a,l
waittest.asm
Ghazal-S/Project2
0
163749
_waittest: file format elf32-i386 Disassembly of section .text: 00000000 <main>: printf(1, "wTime: %d rTime: %d \n",wTime,rTime); } int main(void) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 51 push %ecx e: 83 ec 04 sub $0x4,%esp waittest(); 11: e8 6a 00 00 00 call 80 <waittest> exit(); 16: e8 17 03 00 00 call 332 <exit> 1b: 66 90 xchg %ax,%ax 1d: 66 90 xchg %ax,%ax 1f: 90 nop 00000020 <foo>: { 20: 55 push %ebp 21: 89 e5 mov %esp,%ebp 23: 53 push %ebx for (i=0;i<100;i++) 24: 31 db xor %ebx,%ebx { 26: 83 ec 04 sub $0x4,%esp 29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi printf(2, "wait test %d\n",i); 30: 83 ec 04 sub $0x4,%esp 33: 53 push %ebx 34: 68 e8 07 00 00 push $0x7e8 for (i=0;i<100;i++) 39: 83 c3 01 add $0x1,%ebx printf(2, "wait test %d\n",i); 3c: 6a 02 push $0x2 3e: e8 4d 04 00 00 call 490 <printf> for (i=0;i<100;i++) 43: 83 c4 10 add $0x10,%esp 46: 83 fb 64 cmp $0x64,%ebx 49: 75 e5 jne 30 <foo+0x10> sleep(20); 4b: 83 ec 0c sub $0xc,%esp for (i=0;i<100;i++) 4e: 31 db xor %ebx,%ebx sleep(20); 50: 6a 14 push $0x14 52: e8 83 03 00 00 call 3da <sleep> 57: 83 c4 10 add $0x10,%esp 5a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi printf(2, "wait test %d\n",i); 60: 83 ec 04 sub $0x4,%esp 63: 53 push %ebx 64: 68 e8 07 00 00 push $0x7e8 for (i=0;i<100;i++) 69: 83 c3 01 add $0x1,%ebx printf(2, "wait test %d\n",i); 6c: 6a 02 push $0x2 6e: e8 1d 04 00 00 call 490 <printf> for (i=0;i<100;i++) 73: 83 c4 10 add $0x10,%esp 76: 83 fb 64 cmp $0x64,%ebx 79: 75 e5 jne 60 <foo+0x40> } 7b: 8b 5d fc mov -0x4(%ebp),%ebx 7e: c9 leave 7f: c3 ret 00000080 <waittest>: { 80: 55 push %ebp 81: 89 e5 mov %esp,%ebp 83: 83 ec 20 sub $0x20,%esp printf(1, "wait test\n"); 86: 68 f6 07 00 00 push $0x7f6 8b: 6a 01 push $0x1 8d: e8 fe 03 00 00 call 490 <printf> pid = fork(); 92: e8 93 02 00 00 call 32a <fork> if(pid == 0) 97: 83 c4 10 add $0x10,%esp 9a: 85 c0 test %eax,%eax 9c: 74 35 je d3 <waittest+0x53> getPerformanceData(&wTime,&rTime); 9e: 8d 45 f4 lea -0xc(%ebp),%eax a1: 83 ec 08 sub $0x8,%esp a4: 50 push %eax a5: 8d 45 f0 lea -0x10(%ebp),%eax a8: 50 push %eax a9: e8 94 02 00 00 call 342 <getPerformanceData> printf(1, "hi \n"); ae: 58 pop %eax af: 5a pop %edx b0: 68 01 08 00 00 push $0x801 b5: 6a 01 push $0x1 b7: e8 d4 03 00 00 call 490 <printf> printf(1, "wTime: %d rTime: %d \n",wTime,rTime); bc: ff 75 f4 pushl -0xc(%ebp) bf: ff 75 f0 pushl -0x10(%ebp) c2: 68 06 08 00 00 push $0x806 c7: 6a 01 push $0x1 c9: e8 c2 03 00 00 call 490 <printf> } ce: 83 c4 20 add $0x20,%esp d1: c9 leave d2: c3 ret foo(); d3: e8 48 ff ff ff call 20 <foo> exit(); d8: e8 55 02 00 00 call 332 <exit> dd: 66 90 xchg %ax,%ax df: 90 nop 000000e0 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { e0: 55 push %ebp e1: 89 e5 mov %esp,%ebp e3: 53 push %ebx e4: 8b 45 08 mov 0x8(%ebp),%eax e7: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) ea: 89 c2 mov %eax,%edx ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi f0: 83 c1 01 add $0x1,%ecx f3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx f7: 83 c2 01 add $0x1,%edx fa: 84 db test %bl,%bl fc: 88 5a ff mov %bl,-0x1(%edx) ff: 75 ef jne f0 <strcpy+0x10> ; return os; } 101: 5b pop %ebx 102: 5d pop %ebp 103: c3 ret 104: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 10a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000110 <strcmp>: int strcmp(const char *p, const char *q) { 110: 55 push %ebp 111: 89 e5 mov %esp,%ebp 113: 53 push %ebx 114: 8b 55 08 mov 0x8(%ebp),%edx 117: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 11a: 0f b6 02 movzbl (%edx),%eax 11d: 0f b6 19 movzbl (%ecx),%ebx 120: 84 c0 test %al,%al 122: 75 1c jne 140 <strcmp+0x30> 124: eb 2a jmp 150 <strcmp+0x40> 126: 8d 76 00 lea 0x0(%esi),%esi 129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 130: 83 c2 01 add $0x1,%edx while(*p && *p == *q) 133: 0f b6 02 movzbl (%edx),%eax p++, q++; 136: 83 c1 01 add $0x1,%ecx 139: 0f b6 19 movzbl (%ecx),%ebx while(*p && *p == *q) 13c: 84 c0 test %al,%al 13e: 74 10 je 150 <strcmp+0x40> 140: 38 d8 cmp %bl,%al 142: 74 ec je 130 <strcmp+0x20> return (uchar)*p - (uchar)*q; 144: 29 d8 sub %ebx,%eax } 146: 5b pop %ebx 147: 5d pop %ebp 148: c3 ret 149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 150: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 152: 29 d8 sub %ebx,%eax } 154: 5b pop %ebx 155: 5d pop %ebp 156: c3 ret 157: 89 f6 mov %esi,%esi 159: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000160 <strlen>: uint strlen(const char *s) { 160: 55 push %ebp 161: 89 e5 mov %esp,%ebp 163: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 166: 80 39 00 cmpb $0x0,(%ecx) 169: 74 15 je 180 <strlen+0x20> 16b: 31 d2 xor %edx,%edx 16d: 8d 76 00 lea 0x0(%esi),%esi 170: 83 c2 01 add $0x1,%edx 173: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 177: 89 d0 mov %edx,%eax 179: 75 f5 jne 170 <strlen+0x10> ; return n; } 17b: 5d pop %ebp 17c: c3 ret 17d: 8d 76 00 lea 0x0(%esi),%esi for(n = 0; s[n]; n++) 180: 31 c0 xor %eax,%eax } 182: 5d pop %ebp 183: c3 ret 184: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 18a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000190 <memset>: void* memset(void *dst, int c, uint n) { 190: 55 push %ebp 191: 89 e5 mov %esp,%ebp 193: 57 push %edi 194: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 197: 8b 4d 10 mov 0x10(%ebp),%ecx 19a: 8b 45 0c mov 0xc(%ebp),%eax 19d: 89 d7 mov %edx,%edi 19f: fc cld 1a0: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 1a2: 89 d0 mov %edx,%eax 1a4: 5f pop %edi 1a5: 5d pop %ebp 1a6: c3 ret 1a7: 89 f6 mov %esi,%esi 1a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001b0 <strchr>: char* strchr(const char *s, char c) { 1b0: 55 push %ebp 1b1: 89 e5 mov %esp,%ebp 1b3: 53 push %ebx 1b4: 8b 45 08 mov 0x8(%ebp),%eax 1b7: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 1ba: 0f b6 10 movzbl (%eax),%edx 1bd: 84 d2 test %dl,%dl 1bf: 74 1d je 1de <strchr+0x2e> if(*s == c) 1c1: 38 d3 cmp %dl,%bl 1c3: 89 d9 mov %ebx,%ecx 1c5: 75 0d jne 1d4 <strchr+0x24> 1c7: eb 17 jmp 1e0 <strchr+0x30> 1c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1d0: 38 ca cmp %cl,%dl 1d2: 74 0c je 1e0 <strchr+0x30> for(; *s; s++) 1d4: 83 c0 01 add $0x1,%eax 1d7: 0f b6 10 movzbl (%eax),%edx 1da: 84 d2 test %dl,%dl 1dc: 75 f2 jne 1d0 <strchr+0x20> return (char*)s; return 0; 1de: 31 c0 xor %eax,%eax } 1e0: 5b pop %ebx 1e1: 5d pop %ebp 1e2: c3 ret 1e3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001f0 <gets>: char* gets(char *buf, int max) { 1f0: 55 push %ebp 1f1: 89 e5 mov %esp,%ebp 1f3: 57 push %edi 1f4: 56 push %esi 1f5: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 1f6: 31 f6 xor %esi,%esi 1f8: 89 f3 mov %esi,%ebx { 1fa: 83 ec 1c sub $0x1c,%esp 1fd: 8b 7d 08 mov 0x8(%ebp),%edi for(i=0; i+1 < max; ){ 200: eb 2f jmp 231 <gets+0x41> 202: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cc = read(0, &c, 1); 208: 8d 45 e7 lea -0x19(%ebp),%eax 20b: 83 ec 04 sub $0x4,%esp 20e: 6a 01 push $0x1 210: 50 push %eax 211: 6a 00 push $0x0 213: e8 42 01 00 00 call 35a <read> if(cc < 1) 218: 83 c4 10 add $0x10,%esp 21b: 85 c0 test %eax,%eax 21d: 7e 1c jle 23b <gets+0x4b> break; buf[i++] = c; 21f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 223: 83 c7 01 add $0x1,%edi 226: 88 47 ff mov %al,-0x1(%edi) if(c == '\n' || c == '\r') 229: 3c 0a cmp $0xa,%al 22b: 74 23 je 250 <gets+0x60> 22d: 3c 0d cmp $0xd,%al 22f: 74 1f je 250 <gets+0x60> for(i=0; i+1 < max; ){ 231: 83 c3 01 add $0x1,%ebx 234: 3b 5d 0c cmp 0xc(%ebp),%ebx 237: 89 fe mov %edi,%esi 239: 7c cd jl 208 <gets+0x18> 23b: 89 f3 mov %esi,%ebx break; } buf[i] = '\0'; return buf; } 23d: 8b 45 08 mov 0x8(%ebp),%eax buf[i] = '\0'; 240: c6 03 00 movb $0x0,(%ebx) } 243: 8d 65 f4 lea -0xc(%ebp),%esp 246: 5b pop %ebx 247: 5e pop %esi 248: 5f pop %edi 249: 5d pop %ebp 24a: c3 ret 24b: 90 nop 24c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 250: 8b 75 08 mov 0x8(%ebp),%esi 253: 8b 45 08 mov 0x8(%ebp),%eax 256: 01 de add %ebx,%esi 258: 89 f3 mov %esi,%ebx buf[i] = '\0'; 25a: c6 03 00 movb $0x0,(%ebx) } 25d: 8d 65 f4 lea -0xc(%ebp),%esp 260: 5b pop %ebx 261: 5e pop %esi 262: 5f pop %edi 263: 5d pop %ebp 264: c3 ret 265: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 269: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000270 <stat>: int stat(const char *n, struct stat *st) { 270: 55 push %ebp 271: 89 e5 mov %esp,%ebp 273: 56 push %esi 274: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 275: 83 ec 08 sub $0x8,%esp 278: 6a 00 push $0x0 27a: ff 75 08 pushl 0x8(%ebp) 27d: e8 00 01 00 00 call 382 <open> if(fd < 0) 282: 83 c4 10 add $0x10,%esp 285: 85 c0 test %eax,%eax 287: 78 27 js 2b0 <stat+0x40> return -1; r = fstat(fd, st); 289: 83 ec 08 sub $0x8,%esp 28c: ff 75 0c pushl 0xc(%ebp) 28f: 89 c3 mov %eax,%ebx 291: 50 push %eax 292: e8 03 01 00 00 call 39a <fstat> close(fd); 297: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); 29a: 89 c6 mov %eax,%esi close(fd); 29c: e8 c9 00 00 00 call 36a <close> return r; 2a1: 83 c4 10 add $0x10,%esp } 2a4: 8d 65 f8 lea -0x8(%ebp),%esp 2a7: 89 f0 mov %esi,%eax 2a9: 5b pop %ebx 2aa: 5e pop %esi 2ab: 5d pop %ebp 2ac: c3 ret 2ad: 8d 76 00 lea 0x0(%esi),%esi return -1; 2b0: be ff ff ff ff mov $0xffffffff,%esi 2b5: eb ed jmp 2a4 <stat+0x34> 2b7: 89 f6 mov %esi,%esi 2b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000002c0 <atoi>: int atoi(const char *s) { 2c0: 55 push %ebp 2c1: 89 e5 mov %esp,%ebp 2c3: 53 push %ebx 2c4: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 2c7: 0f be 11 movsbl (%ecx),%edx 2ca: 8d 42 d0 lea -0x30(%edx),%eax 2cd: 3c 09 cmp $0x9,%al n = 0; 2cf: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 2d4: 77 1f ja 2f5 <atoi+0x35> 2d6: 8d 76 00 lea 0x0(%esi),%esi 2d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 2e0: 8d 04 80 lea (%eax,%eax,4),%eax 2e3: 83 c1 01 add $0x1,%ecx 2e6: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax while('0' <= *s && *s <= '9') 2ea: 0f be 11 movsbl (%ecx),%edx 2ed: 8d 5a d0 lea -0x30(%edx),%ebx 2f0: 80 fb 09 cmp $0x9,%bl 2f3: 76 eb jbe 2e0 <atoi+0x20> return n; } 2f5: 5b pop %ebx 2f6: 5d pop %ebp 2f7: c3 ret 2f8: 90 nop 2f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000300 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 300: 55 push %ebp 301: 89 e5 mov %esp,%ebp 303: 56 push %esi 304: 53 push %ebx 305: 8b 5d 10 mov 0x10(%ebp),%ebx 308: 8b 45 08 mov 0x8(%ebp),%eax 30b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 30e: 85 db test %ebx,%ebx 310: 7e 14 jle 326 <memmove+0x26> 312: 31 d2 xor %edx,%edx 314: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 318: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 31c: 88 0c 10 mov %cl,(%eax,%edx,1) 31f: 83 c2 01 add $0x1,%edx while(n-- > 0) 322: 39 d3 cmp %edx,%ebx 324: 75 f2 jne 318 <memmove+0x18> return vdst; } 326: 5b pop %ebx 327: 5e pop %esi 328: 5d pop %ebp 329: c3 ret 0000032a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 32a: b8 01 00 00 00 mov $0x1,%eax 32f: cd 40 int $0x40 331: c3 ret 00000332 <exit>: SYSCALL(exit) 332: b8 02 00 00 00 mov $0x2,%eax 337: cd 40 int $0x40 339: c3 ret 0000033a <wait>: SYSCALL(wait) 33a: b8 03 00 00 00 mov $0x3,%eax 33f: cd 40 int $0x40 341: c3 ret 00000342 <getPerformanceData>: SYSCALL(getPerformanceData) // calculates process run time and wait time 342: b8 16 00 00 00 mov $0x16,%eax 347: cd 40 int $0x40 349: c3 ret 0000034a <nice>: SYSCALL(nice) 34a: b8 17 00 00 00 mov $0x17,%eax 34f: cd 40 int $0x40 351: c3 ret 00000352 <pipe>: SYSCALL(pipe) 352: b8 04 00 00 00 mov $0x4,%eax 357: cd 40 int $0x40 359: c3 ret 0000035a <read>: SYSCALL(read) 35a: b8 05 00 00 00 mov $0x5,%eax 35f: cd 40 int $0x40 361: c3 ret 00000362 <write>: SYSCALL(write) 362: b8 10 00 00 00 mov $0x10,%eax 367: cd 40 int $0x40 369: c3 ret 0000036a <close>: SYSCALL(close) 36a: b8 15 00 00 00 mov $0x15,%eax 36f: cd 40 int $0x40 371: c3 ret 00000372 <kill>: SYSCALL(kill) 372: b8 06 00 00 00 mov $0x6,%eax 377: cd 40 int $0x40 379: c3 ret 0000037a <exec>: SYSCALL(exec) 37a: b8 07 00 00 00 mov $0x7,%eax 37f: cd 40 int $0x40 381: c3 ret 00000382 <open>: SYSCALL(open) 382: b8 0f 00 00 00 mov $0xf,%eax 387: cd 40 int $0x40 389: c3 ret 0000038a <mknod>: SYSCALL(mknod) 38a: b8 11 00 00 00 mov $0x11,%eax 38f: cd 40 int $0x40 391: c3 ret 00000392 <unlink>: SYSCALL(unlink) 392: b8 12 00 00 00 mov $0x12,%eax 397: cd 40 int $0x40 399: c3 ret 0000039a <fstat>: SYSCALL(fstat) 39a: b8 08 00 00 00 mov $0x8,%eax 39f: cd 40 int $0x40 3a1: c3 ret 000003a2 <link>: SYSCALL(link) 3a2: b8 13 00 00 00 mov $0x13,%eax 3a7: cd 40 int $0x40 3a9: c3 ret 000003aa <mkdir>: SYSCALL(mkdir) 3aa: b8 14 00 00 00 mov $0x14,%eax 3af: cd 40 int $0x40 3b1: c3 ret 000003b2 <chdir>: SYSCALL(chdir) 3b2: b8 09 00 00 00 mov $0x9,%eax 3b7: cd 40 int $0x40 3b9: c3 ret 000003ba <dup>: SYSCALL(dup) 3ba: b8 0a 00 00 00 mov $0xa,%eax 3bf: cd 40 int $0x40 3c1: c3 ret 000003c2 <getpid>: SYSCALL(getpid) 3c2: b8 0b 00 00 00 mov $0xb,%eax 3c7: cd 40 int $0x40 3c9: c3 ret 000003ca <getppid>: SYSCALL(getppid) 3ca: b8 18 00 00 00 mov $0x18,%eax 3cf: cd 40 int $0x40 3d1: c3 ret 000003d2 <sbrk>: SYSCALL(sbrk) 3d2: b8 0c 00 00 00 mov $0xc,%eax 3d7: cd 40 int $0x40 3d9: c3 ret 000003da <sleep>: SYSCALL(sleep) 3da: b8 0d 00 00 00 mov $0xd,%eax 3df: cd 40 int $0x40 3e1: c3 ret 000003e2 <uptime>: SYSCALL(uptime) 3e2: b8 0e 00 00 00 mov $0xe,%eax 3e7: cd 40 int $0x40 3e9: c3 ret 3ea: 66 90 xchg %ax,%ax 3ec: 66 90 xchg %ax,%ax 3ee: 66 90 xchg %ax,%ax 000003f0 <printint>: 3f0: 55 push %ebp 3f1: 89 e5 mov %esp,%ebp 3f3: 57 push %edi 3f4: 56 push %esi 3f5: 53 push %ebx 3f6: 83 ec 3c sub $0x3c,%esp 3f9: 85 d2 test %edx,%edx 3fb: 89 45 c0 mov %eax,-0x40(%ebp) 3fe: 89 d0 mov %edx,%eax 400: 79 76 jns 478 <printint+0x88> 402: f6 45 08 01 testb $0x1,0x8(%ebp) 406: 74 70 je 478 <printint+0x88> 408: f7 d8 neg %eax 40a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) 411: 31 f6 xor %esi,%esi 413: 8d 5d d7 lea -0x29(%ebp),%ebx 416: eb 0a jmp 422 <printint+0x32> 418: 90 nop 419: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 420: 89 fe mov %edi,%esi 422: 31 d2 xor %edx,%edx 424: 8d 7e 01 lea 0x1(%esi),%edi 427: f7 f1 div %ecx 429: 0f b6 92 24 08 00 00 movzbl 0x824(%edx),%edx 430: 85 c0 test %eax,%eax 432: 88 14 3b mov %dl,(%ebx,%edi,1) 435: 75 e9 jne 420 <printint+0x30> 437: 8b 45 c4 mov -0x3c(%ebp),%eax 43a: 85 c0 test %eax,%eax 43c: 74 08 je 446 <printint+0x56> 43e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1) 443: 8d 7e 02 lea 0x2(%esi),%edi 446: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi 44a: 8b 7d c0 mov -0x40(%ebp),%edi 44d: 8d 76 00 lea 0x0(%esi),%esi 450: 0f b6 06 movzbl (%esi),%eax 453: 83 ec 04 sub $0x4,%esp 456: 83 ee 01 sub $0x1,%esi 459: 6a 01 push $0x1 45b: 53 push %ebx 45c: 57 push %edi 45d: 88 45 d7 mov %al,-0x29(%ebp) 460: e8 fd fe ff ff call 362 <write> 465: 83 c4 10 add $0x10,%esp 468: 39 de cmp %ebx,%esi 46a: 75 e4 jne 450 <printint+0x60> 46c: 8d 65 f4 lea -0xc(%ebp),%esp 46f: 5b pop %ebx 470: 5e pop %esi 471: 5f pop %edi 472: 5d pop %ebp 473: c3 ret 474: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 478: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 47f: eb 90 jmp 411 <printint+0x21> 481: eb 0d jmp 490 <printf> 483: 90 nop 484: 90 nop 485: 90 nop 486: 90 nop 487: 90 nop 488: 90 nop 489: 90 nop 48a: 90 nop 48b: 90 nop 48c: 90 nop 48d: 90 nop 48e: 90 nop 48f: 90 nop 00000490 <printf>: 490: 55 push %ebp 491: 89 e5 mov %esp,%ebp 493: 57 push %edi 494: 56 push %esi 495: 53 push %ebx 496: 83 ec 2c sub $0x2c,%esp 499: 8b 75 0c mov 0xc(%ebp),%esi 49c: 0f b6 1e movzbl (%esi),%ebx 49f: 84 db test %bl,%bl 4a1: 0f 84 b3 00 00 00 je 55a <printf+0xca> 4a7: 8d 45 10 lea 0x10(%ebp),%eax 4aa: 83 c6 01 add $0x1,%esi 4ad: 31 ff xor %edi,%edi 4af: 89 45 d4 mov %eax,-0x2c(%ebp) 4b2: eb 2f jmp 4e3 <printf+0x53> 4b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 4b8: 83 f8 25 cmp $0x25,%eax 4bb: 0f 84 a7 00 00 00 je 568 <printf+0xd8> 4c1: 8d 45 e2 lea -0x1e(%ebp),%eax 4c4: 83 ec 04 sub $0x4,%esp 4c7: 88 5d e2 mov %bl,-0x1e(%ebp) 4ca: 6a 01 push $0x1 4cc: 50 push %eax 4cd: ff 75 08 pushl 0x8(%ebp) 4d0: e8 8d fe ff ff call 362 <write> 4d5: 83 c4 10 add $0x10,%esp 4d8: 83 c6 01 add $0x1,%esi 4db: 0f b6 5e ff movzbl -0x1(%esi),%ebx 4df: 84 db test %bl,%bl 4e1: 74 77 je 55a <printf+0xca> 4e3: 85 ff test %edi,%edi 4e5: 0f be cb movsbl %bl,%ecx 4e8: 0f b6 c3 movzbl %bl,%eax 4eb: 74 cb je 4b8 <printf+0x28> 4ed: 83 ff 25 cmp $0x25,%edi 4f0: 75 e6 jne 4d8 <printf+0x48> 4f2: 83 f8 64 cmp $0x64,%eax 4f5: 0f 84 05 01 00 00 je 600 <printf+0x170> 4fb: 81 e1 f7 00 00 00 and $0xf7,%ecx 501: 83 f9 70 cmp $0x70,%ecx 504: 74 72 je 578 <printf+0xe8> 506: 83 f8 73 cmp $0x73,%eax 509: 0f 84 99 00 00 00 je 5a8 <printf+0x118> 50f: 83 f8 63 cmp $0x63,%eax 512: 0f 84 08 01 00 00 je 620 <printf+0x190> 518: 83 f8 25 cmp $0x25,%eax 51b: 0f 84 ef 00 00 00 je 610 <printf+0x180> 521: 8d 45 e7 lea -0x19(%ebp),%eax 524: 83 ec 04 sub $0x4,%esp 527: c6 45 e7 25 movb $0x25,-0x19(%ebp) 52b: 6a 01 push $0x1 52d: 50 push %eax 52e: ff 75 08 pushl 0x8(%ebp) 531: e8 2c fe ff ff call 362 <write> 536: 83 c4 0c add $0xc,%esp 539: 8d 45 e6 lea -0x1a(%ebp),%eax 53c: 88 5d e6 mov %bl,-0x1a(%ebp) 53f: 6a 01 push $0x1 541: 50 push %eax 542: ff 75 08 pushl 0x8(%ebp) 545: 83 c6 01 add $0x1,%esi 548: 31 ff xor %edi,%edi 54a: e8 13 fe ff ff call 362 <write> 54f: 0f b6 5e ff movzbl -0x1(%esi),%ebx 553: 83 c4 10 add $0x10,%esp 556: 84 db test %bl,%bl 558: 75 89 jne 4e3 <printf+0x53> 55a: 8d 65 f4 lea -0xc(%ebp),%esp 55d: 5b pop %ebx 55e: 5e pop %esi 55f: 5f pop %edi 560: 5d pop %ebp 561: c3 ret 562: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 568: bf 25 00 00 00 mov $0x25,%edi 56d: e9 66 ff ff ff jmp 4d8 <printf+0x48> 572: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 578: 83 ec 0c sub $0xc,%esp 57b: b9 10 00 00 00 mov $0x10,%ecx 580: 6a 00 push $0x0 582: 8b 7d d4 mov -0x2c(%ebp),%edi 585: 8b 45 08 mov 0x8(%ebp),%eax 588: 8b 17 mov (%edi),%edx 58a: e8 61 fe ff ff call 3f0 <printint> 58f: 89 f8 mov %edi,%eax 591: 83 c4 10 add $0x10,%esp 594: 31 ff xor %edi,%edi 596: 83 c0 04 add $0x4,%eax 599: 89 45 d4 mov %eax,-0x2c(%ebp) 59c: e9 37 ff ff ff jmp 4d8 <printf+0x48> 5a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 5a8: 8b 45 d4 mov -0x2c(%ebp),%eax 5ab: 8b 08 mov (%eax),%ecx 5ad: 83 c0 04 add $0x4,%eax 5b0: 89 45 d4 mov %eax,-0x2c(%ebp) 5b3: 85 c9 test %ecx,%ecx 5b5: 0f 84 8e 00 00 00 je 649 <printf+0x1b9> 5bb: 0f b6 01 movzbl (%ecx),%eax 5be: 31 ff xor %edi,%edi 5c0: 89 cb mov %ecx,%ebx 5c2: 84 c0 test %al,%al 5c4: 0f 84 0e ff ff ff je 4d8 <printf+0x48> 5ca: 89 75 d0 mov %esi,-0x30(%ebp) 5cd: 89 de mov %ebx,%esi 5cf: 8b 5d 08 mov 0x8(%ebp),%ebx 5d2: 8d 7d e3 lea -0x1d(%ebp),%edi 5d5: 8d 76 00 lea 0x0(%esi),%esi 5d8: 83 ec 04 sub $0x4,%esp 5db: 83 c6 01 add $0x1,%esi 5de: 88 45 e3 mov %al,-0x1d(%ebp) 5e1: 6a 01 push $0x1 5e3: 57 push %edi 5e4: 53 push %ebx 5e5: e8 78 fd ff ff call 362 <write> 5ea: 0f b6 06 movzbl (%esi),%eax 5ed: 83 c4 10 add $0x10,%esp 5f0: 84 c0 test %al,%al 5f2: 75 e4 jne 5d8 <printf+0x148> 5f4: 8b 75 d0 mov -0x30(%ebp),%esi 5f7: 31 ff xor %edi,%edi 5f9: e9 da fe ff ff jmp 4d8 <printf+0x48> 5fe: 66 90 xchg %ax,%ax 600: 83 ec 0c sub $0xc,%esp 603: b9 0a 00 00 00 mov $0xa,%ecx 608: 6a 01 push $0x1 60a: e9 73 ff ff ff jmp 582 <printf+0xf2> 60f: 90 nop 610: 83 ec 04 sub $0x4,%esp 613: 88 5d e5 mov %bl,-0x1b(%ebp) 616: 8d 45 e5 lea -0x1b(%ebp),%eax 619: 6a 01 push $0x1 61b: e9 21 ff ff ff jmp 541 <printf+0xb1> 620: 8b 7d d4 mov -0x2c(%ebp),%edi 623: 83 ec 04 sub $0x4,%esp 626: 8b 07 mov (%edi),%eax 628: 6a 01 push $0x1 62a: 83 c7 04 add $0x4,%edi 62d: 88 45 e4 mov %al,-0x1c(%ebp) 630: 8d 45 e4 lea -0x1c(%ebp),%eax 633: 50 push %eax 634: ff 75 08 pushl 0x8(%ebp) 637: e8 26 fd ff ff call 362 <write> 63c: 89 7d d4 mov %edi,-0x2c(%ebp) 63f: 83 c4 10 add $0x10,%esp 642: 31 ff xor %edi,%edi 644: e9 8f fe ff ff jmp 4d8 <printf+0x48> 649: bb 1c 08 00 00 mov $0x81c,%ebx 64e: b8 28 00 00 00 mov $0x28,%eax 653: e9 72 ff ff ff jmp 5ca <printf+0x13a> 658: 66 90 xchg %ax,%ax 65a: 66 90 xchg %ax,%ax 65c: 66 90 xchg %ax,%ax 65e: 66 90 xchg %ax,%ax 00000660 <free>: static Header base; static Header *freep; void free(void *ap) { 660: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 661: a1 10 0b 00 00 mov 0xb10,%eax { 666: 89 e5 mov %esp,%ebp 668: 57 push %edi 669: 56 push %esi 66a: 53 push %ebx 66b: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header*)ap - 1; 66e: 8d 4b f8 lea -0x8(%ebx),%ecx 671: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 678: 39 c8 cmp %ecx,%eax 67a: 8b 10 mov (%eax),%edx 67c: 73 32 jae 6b0 <free+0x50> 67e: 39 d1 cmp %edx,%ecx 680: 72 04 jb 686 <free+0x26> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 682: 39 d0 cmp %edx,%eax 684: 72 32 jb 6b8 <free+0x58> break; if(bp + bp->s.size == p->s.ptr){ 686: 8b 73 fc mov -0x4(%ebx),%esi 689: 8d 3c f1 lea (%ecx,%esi,8),%edi 68c: 39 fa cmp %edi,%edx 68e: 74 30 je 6c0 <free+0x60> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 690: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 693: 8b 50 04 mov 0x4(%eax),%edx 696: 8d 34 d0 lea (%eax,%edx,8),%esi 699: 39 f1 cmp %esi,%ecx 69b: 74 3a je 6d7 <free+0x77> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 69d: 89 08 mov %ecx,(%eax) freep = p; 69f: a3 10 0b 00 00 mov %eax,0xb10 } 6a4: 5b pop %ebx 6a5: 5e pop %esi 6a6: 5f pop %edi 6a7: 5d pop %ebp 6a8: c3 ret 6a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 6b0: 39 d0 cmp %edx,%eax 6b2: 72 04 jb 6b8 <free+0x58> 6b4: 39 d1 cmp %edx,%ecx 6b6: 72 ce jb 686 <free+0x26> { 6b8: 89 d0 mov %edx,%eax 6ba: eb bc jmp 678 <free+0x18> 6bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp->s.size += p->s.ptr->s.size; 6c0: 03 72 04 add 0x4(%edx),%esi 6c3: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 6c6: 8b 10 mov (%eax),%edx 6c8: 8b 12 mov (%edx),%edx 6ca: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 6cd: 8b 50 04 mov 0x4(%eax),%edx 6d0: 8d 34 d0 lea (%eax,%edx,8),%esi 6d3: 39 f1 cmp %esi,%ecx 6d5: 75 c6 jne 69d <free+0x3d> p->s.size += bp->s.size; 6d7: 03 53 fc add -0x4(%ebx),%edx freep = p; 6da: a3 10 0b 00 00 mov %eax,0xb10 p->s.size += bp->s.size; 6df: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 6e2: 8b 53 f8 mov -0x8(%ebx),%edx 6e5: 89 10 mov %edx,(%eax) } 6e7: 5b pop %ebx 6e8: 5e pop %esi 6e9: 5f pop %edi 6ea: 5d pop %ebp 6eb: c3 ret 6ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000006f0 <malloc>: return freep; } void* malloc(uint nbytes) { 6f0: 55 push %ebp 6f1: 89 e5 mov %esp,%ebp 6f3: 57 push %edi 6f4: 56 push %esi 6f5: 53 push %ebx 6f6: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 6f9: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 6fc: 8b 15 10 0b 00 00 mov 0xb10,%edx nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 702: 8d 78 07 lea 0x7(%eax),%edi 705: c1 ef 03 shr $0x3,%edi 708: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 70b: 85 d2 test %edx,%edx 70d: 0f 84 9d 00 00 00 je 7b0 <malloc+0xc0> 713: 8b 02 mov (%edx),%eax 715: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 718: 39 cf cmp %ecx,%edi 71a: 76 6c jbe 788 <malloc+0x98> 71c: 81 ff 00 10 00 00 cmp $0x1000,%edi 722: bb 00 10 00 00 mov $0x1000,%ebx 727: 0f 43 df cmovae %edi,%ebx p = sbrk(nu * sizeof(Header)); 72a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi 731: eb 0e jmp 741 <malloc+0x51> 733: 90 nop 734: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 738: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 73a: 8b 48 04 mov 0x4(%eax),%ecx 73d: 39 f9 cmp %edi,%ecx 73f: 73 47 jae 788 <malloc+0x98> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 741: 39 05 10 0b 00 00 cmp %eax,0xb10 747: 89 c2 mov %eax,%edx 749: 75 ed jne 738 <malloc+0x48> p = sbrk(nu * sizeof(Header)); 74b: 83 ec 0c sub $0xc,%esp 74e: 56 push %esi 74f: e8 7e fc ff ff call 3d2 <sbrk> if(p == (char*)-1) 754: 83 c4 10 add $0x10,%esp 757: 83 f8 ff cmp $0xffffffff,%eax 75a: 74 1c je 778 <malloc+0x88> hp->s.size = nu; 75c: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 75f: 83 ec 0c sub $0xc,%esp 762: 83 c0 08 add $0x8,%eax 765: 50 push %eax 766: e8 f5 fe ff ff call 660 <free> return freep; 76b: 8b 15 10 0b 00 00 mov 0xb10,%edx if((p = morecore(nunits)) == 0) 771: 83 c4 10 add $0x10,%esp 774: 85 d2 test %edx,%edx 776: 75 c0 jne 738 <malloc+0x48> return 0; } } 778: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 77b: 31 c0 xor %eax,%eax } 77d: 5b pop %ebx 77e: 5e pop %esi 77f: 5f pop %edi 780: 5d pop %ebp 781: c3 ret 782: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(p->s.size == nunits) 788: 39 cf cmp %ecx,%edi 78a: 74 54 je 7e0 <malloc+0xf0> p->s.size -= nunits; 78c: 29 f9 sub %edi,%ecx 78e: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 791: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 794: 89 78 04 mov %edi,0x4(%eax) freep = prevp; 797: 89 15 10 0b 00 00 mov %edx,0xb10 } 79d: 8d 65 f4 lea -0xc(%ebp),%esp return (void*)(p + 1); 7a0: 83 c0 08 add $0x8,%eax } 7a3: 5b pop %ebx 7a4: 5e pop %esi 7a5: 5f pop %edi 7a6: 5d pop %ebp 7a7: c3 ret 7a8: 90 nop 7a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; 7b0: c7 05 10 0b 00 00 14 movl $0xb14,0xb10 7b7: 0b 00 00 7ba: c7 05 14 0b 00 00 14 movl $0xb14,0xb14 7c1: 0b 00 00 base.s.size = 0; 7c4: b8 14 0b 00 00 mov $0xb14,%eax 7c9: c7 05 18 0b 00 00 00 movl $0x0,0xb18 7d0: 00 00 00 7d3: e9 44 ff ff ff jmp 71c <malloc+0x2c> 7d8: 90 nop 7d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi prevp->s.ptr = p->s.ptr; 7e0: 8b 08 mov (%eax),%ecx 7e2: 89 0a mov %ecx,(%edx) 7e4: eb b1 jmp 797 <malloc+0xa7>
src/kernel.asm
anders-14/osdev
0
100789
org 0x1000 jmp main ; Include files %include "./include/print_string.asm" %include "./include/print_hex.asm" main: mov ah, 0x00 ; Argument for int 10, set video mode mov al, 0x03 ; Set screen to 80x25 16bit color int 0x10 mov ah, 0x0b ; Argument for int 10, set color pallete mov bh, 0x00 ; Select background color mov bl, 0x01 ; Set background color blue int 0x10 mov si, welcome_message call print_string echo_loop: xor ax, ax ; Make ax = 0, faster than moving 0 into ax int 0x16 ; Get ready for keyboard input, ascii into al, scancode into ah cmp al, "Q" ; Halt on Q je halt mov ah, 0x0E int 0x10 ; Print char typed cmp al, 13 ; Compare typed char to CR jne .not_newline ; If not CR -> skip mov al, 10 ; Else print LF int 0x10 .not_newline jmp echo_loop halt: mov si, halt_string call print_string hlt welcome_message: db "Welcome to Anders OS",13,10,0 halt_string: db 13,10,"Halting the os...",0 ; Sector padding times 512-($-$$) db 0
oeis/158/A158368.asm
neoneye/loda-programs
11
176187
; A158368: 529n + 1. ; 530,1059,1588,2117,2646,3175,3704,4233,4762,5291,5820,6349,6878,7407,7936,8465,8994,9523,10052,10581,11110,11639,12168,12697,13226,13755,14284,14813,15342,15871,16400,16929,17458,17987,18516,19045,19574,20103,20632,21161,21690,22219,22748,23277,23806,24335,24864,25393,25922,26451,26980,27509,28038,28567,29096,29625,30154,30683,31212,31741,32270,32799,33328,33857,34386,34915,35444,35973,36502,37031,37560,38089,38618,39147,39676,40205,40734,41263,41792,42321,42850,43379,43908,44437,44966,45495 mul $0,529 add $0,530
oeis/313/A313611.asm
neoneye/loda-programs
11
27220
; A313611: Coordination sequence Gal.6.337.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings. ; Submitted by <NAME> ; 1,5,10,14,20,24,29,34,38,44,48,53,58,63,68,72,78,82,87,92,96,102,106,111,116,121,126,130,136,140,145,150,154,160,164,169,174,179,184,188,194,198,203,208,212,218,222,227,232,237 mov $5,$0 mov $7,2 lpb $7 mov $3,0 sub $7,1 add $0,$7 sub $0,1 mov $6,$0 pow $0,2 add $0,$6 lpb $0 mul $0,58 add $0,22 mov $3,$0 mov $0,$6 lpe mov $2,$7 mov $4,$3 div $4,24 add $4,1 mov $6,$4 lpb $2 mov $1,$6 mov $2,0 lpe lpe lpb $5 sub $1,$6 mov $5,0 lpe mov $0,$1
Maximum-Of-3-Numbers.asm
abdalmoez/applications-on-gnusim-8085
0
81690
<filename>Maximum-Of-3-Numbers.asm LHLD C050 XCHG LHLD C052 MVI C,00 DAD D JNC AHEAD INR C AHEAD: SHLD C054 MOV A,C STA C056 HLT ORG 0 # DB 45H,A6H,23H,9BH
oeis/061/A061107.asm
neoneye/loda-programs
11
98602
; A061107: a(0) = 0, a(1) = 1, a(n) is the concatenation of a(n-2) and a(n-1) for n > 1. ; Submitted by <NAME> ; 0,1,10,101,10110,10110101,1011010110110,101101011011010110101,1011010110110101101011011010110110,1011010110110101101011011010110110101101011011010110101,10110101101101011010110110101101101011010110110101101011011010110110101101011011010110110,101101011011010110101101101011011010110101101101011010110110101101101011010110110101101101011010110110101101011011010110110101101011011010110101 seq $0,5203 ; Fibonacci numbers (or rabbit sequence) converted to decimal. mul $0,2 seq $0,7088 ; The binary numbers (or binary words, or binary vectors, or binary expansion of n): numbers written in base 2. div $0,10
alloy4fun_models/trashltl/models/7/hrj9dQR5QJxdt347z.als
Kaixi26/org.alloytools.alloy
0
5207
open main pred idhrj9dQR5QJxdt347z_prop8 { eventually File.link in Trash } pred __repair { idhrj9dQR5QJxdt347z_prop8 } check __repair { idhrj9dQR5QJxdt347z_prop8 <=> prop8o }
alloy4fun_models/trashltl/models/5/pNBcmyfQsu8t3ufKt.als
Kaixi26/org.alloytools.alloy
0
1623
<gh_stars>0 open main pred idpNBcmyfQsu8t3ufKt_prop6 { always ((some File) implies (always File in File')) } pred __repair { idpNBcmyfQsu8t3ufKt_prop6 } check __repair { idpNBcmyfQsu8t3ufKt_prop6 <=> prop6o }
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2101.asm
ljhsiun2/medusa
9
177046
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r13 push %r14 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0x681d, %r13 nop xor $6688, %rax mov (%r13), %di nop nop sub %r14, %r14 lea addresses_UC_ht+0x1ce73, %rdi nop add %r11, %r11 mov (%rdi), %r12 sub %r12, %r12 lea addresses_WT_ht+0x17f1d, %r13 nop nop nop nop cmp %r12, %r12 mov $0x6162636465666768, %rax movq %rax, (%r13) nop sub $46272, %rax lea addresses_WC_ht+0x381d, %rsi lea addresses_WT_ht+0x401d, %rdi nop nop nop nop nop dec %rax mov $59, %rcx rep movsw nop nop add $12188, %r11 lea addresses_WT_ht+0xdaa1, %rsi lea addresses_UC_ht+0x401d, %rdi clflush (%rsi) nop nop nop cmp %rax, %rax mov $49, %rcx rep movsb nop nop nop sub %rsi, %rsi lea addresses_WT_ht+0xe11d, %rsi lea addresses_normal_ht+0x1211d, %rdi nop nop nop nop inc %r11 mov $54, %rcx rep movsb nop mfence lea addresses_A_ht+0x20fd, %rsi lea addresses_UC_ht+0x18cfd, %rdi xor $58689, %r11 mov $69, %rcx rep movsb sub $13710, %r11 lea addresses_A_ht+0x19c1d, %rcx clflush (%rcx) nop add %r13, %r13 movl $0x61626364, (%rcx) nop and %rcx, %rcx lea addresses_normal_ht+0x15d5d, %r11 nop add %r14, %r14 mov (%r11), %esi nop nop add %rax, %rax lea addresses_WC_ht+0xcd1d, %r13 clflush (%r13) nop nop nop sub %r12, %r12 mov $0x6162636465666768, %r14 movq %r14, %xmm2 and $0xffffffffffffffc0, %r13 vmovaps %ymm2, (%r13) nop nop nop nop cmp %r11, %r11 lea addresses_UC_ht+0x1281d, %r13 nop nop inc %rdi movups (%r13), %xmm3 vpextrq $0, %xmm3, %rsi nop nop nop xor $36663, %rax lea addresses_A_ht+0x10d1d, %rdi nop nop nop nop nop cmp $45257, %r11 mov (%rdi), %r14 nop nop add $39919, %r13 lea addresses_A_ht+0xc6d4, %rsi lea addresses_WT_ht+0x2c91, %rdi nop and $63962, %r12 mov $49, %rcx rep movsb nop nop add %rsi, %rsi lea addresses_WC_ht+0x1ac9d, %rsi lea addresses_D_ht+0x62bd, %rdi nop add %rax, %rax mov $66, %rcx rep movsl nop nop nop nop nop sub %rcx, %rcx lea addresses_A_ht+0x132dd, %r12 nop cmp %r13, %r13 vmovups (%r12), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $1, %xmm6, %rax nop nop nop nop inc %r14 pop %rsi pop %rdi pop %rcx pop %rax pop %r14 pop %r13 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r8 push %rax push %rbx push %rsi // Store lea addresses_RW+0x1bc1d, %r12 nop nop nop nop dec %r8 mov $0x5152535455565758, %rax movq %rax, (%r12) nop xor $24248, %r8 // Store lea addresses_US+0x535d, %r13 nop nop nop nop nop xor %rax, %rax movl $0x51525354, (%r13) inc %r10 // Faulty Load lea addresses_PSE+0x1a81d, %rax nop nop nop add $43142, %rsi mov (%rax), %r10 lea oracles, %rax and $0xff, %r10 shlq $12, %r10 mov (%rax,%r10,1), %r10 pop %rsi pop %rbx pop %rax pop %r8 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': True, 'congruent': 5, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': True, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 6, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': True, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': True, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
sets/nat/core.agda
HoTT/M-types
27
14897
module sets.nat.core where open import level open import decidable open import equality.core open import function.core open import function.isomorphism.core open import sets.empty infixr 8 _^_ infixl 7 _*_ infixl 6 _+_ data ℕ : Set where zero : ℕ suc : ℕ → ℕ {-# BUILTIN NATURAL ℕ #-} pred : ℕ → ℕ pred zero = zero pred (suc n) = n _+_ : ℕ → ℕ → ℕ zero + n = n suc m + n = suc (m + n) _*_ : ℕ → ℕ → ℕ 0 * n = zero suc m * n = n + m * n _^_ : ℕ → ℕ → ℕ n ^ 0 = 1 n ^ (suc m) = n * (n ^ m) suc-inj : injective suc suc-inj = ap pred _≟_ : (a b : ℕ) → Dec (a ≡ b) zero ≟ zero = yes refl zero ≟ suc _ = no (λ ()) suc _ ≟ zero = no (λ ()) suc a ≟ suc b with a ≟ b suc a ≟ suc b | yes a≡b = yes $ ap suc a≡b suc a ≟ suc b | no ¬a≡b = no $ (λ sa≡sb → ¬a≡b (ap pred sa≡sb))
src/test/resources/framework_specifications/TestRunResultCommonLexer.g4
google/polymorphicDSL
3
1670
lexer grammar TestRunResultCommonLexer ; import GherkinCommonLexer ; tokens {END} THEN_THE_TEST_RUN_RESULTS_HAVE_N_TESTS_START : GHERKIN_STEP_KEYWORD 'the test run results ' ('have ' | 'has ') ; FAILING_TESTS_END : ' failing test' 's'? END ; PASSING_TESTS_END : ' passing test' 's'? END ; INTEGER_VALUE : [0-9]+ ;
FormalAnalyzer/models/apps/HumidityTrendSample.als
Mohannadcse/IoTCOM_BehavioralRuleExtractor
0
3790
module app_HumidityTrendSample open IoTBottomUp as base open cap_relativeHumidityMeasurement one sig app_HumidityTrendSample extends IoTApp { state : one cap_state, humidity : one cap_relativeHumidityMeasurement, } { rules = r } one sig cap_state extends Capability {} { attributes = cap_state_attr } abstract sig cap_state_attr extends Attribute {} one sig cap_state_attr_mode extends cap_state_attr {} { values = cap_state_attr_mode_val } abstract sig cap_state_attr_mode_val extends AttrValue {} one sig cap_state_attr_mode_val_newModeUp extends cap_state_attr_mode_val {} one sig cap_state_attr_mode_val_newModeDown extends cap_state_attr_mode_val {} one sig cap_state_attr_humidityThresholdActivated extends cap_state_attr {} { values = cap_state_attr_humidityThresholdActivated_val } abstract sig cap_state_attr_humidityThresholdActivated_val extends AttrValue {} one sig cap_state_attr_humidityThresholdActivated_val_false extends cap_state_attr_humidityThresholdActivated_val {} one sig cap_state_attr_humidityThresholdActivated_val_true extends cap_state_attr_humidityThresholdActivated_val {} one sig cap_state_attr_currentTrend extends cap_state_attr {} { values = cap_state_attr_currentTrend_val } abstract sig cap_state_attr_currentTrend_val extends AttrValue {} one sig cap_state_attr_currentTrend_val_UP extends cap_state_attr_currentTrend_val {} one sig cap_state_attr_currentTrend_val_DOWN extends cap_state_attr_currentTrend_val {} one sig cap_state_attr_currentTrend_val_NONE extends cap_state_attr_currentTrend_val {} one sig cap_state_attr_currentTrendPts extends cap_state_attr {} { values = cap_state_attr_currentTrendPts_val } abstract sig cap_state_attr_currentTrendPts_val extends AttrValue {} one sig cap_state_attr_currentTrendPts_val_ extends cap_state_attr_currentTrendPts_val {} one sig cap_state_attr_currentTrendPts_val_0 extends cap_state_attr_currentTrendPts_val {} one sig cap_state_attr_lastHumidity extends cap_state_attr {} { values = cap_state_attr_lastHumidity_val } abstract sig cap_state_attr_lastHumidity_val extends AttrValue {} one sig cap_state_attr_lastHumidity_val_0 extends cap_state_attr_lastHumidity_val {} // application rules base class abstract sig r extends Rule {} one sig r0 extends r {}{ triggers = r0_trig conditions = r0_cond commands = r0_comm } abstract sig r0_trig extends Trigger {} one sig r0_trig0 extends r0_trig {} { capabilities = app_HumidityTrendSample.humidity attribute = cap_relativeHumidityMeasurement_attr_humidity no value } abstract sig r0_cond extends Condition {} one sig r0_cond0 extends r0_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrendPts value = cap_state_attr_currentTrendPts_val//_lte_(0_-_settings.humidity2) } /* one sig r0_cond1 extends r0_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrendPts value = cap_state_attr_currentTrendPts_val_lt_settings.humidity1 } */ one sig r0_cond2 extends r0_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_humidityThresholdActivated value = cap_state_attr_humidityThresholdActivated_val_false } one sig r0_cond3 extends r0_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrend value = cap_state_attr_currentTrend_val - cap_state_attr_currentTrend_val_NONE } one sig r0_cond4 extends r0_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrend value = cap_state_attr_currentTrend_val - cap_state_attr_currentTrend_val_UP } abstract sig r0_comm extends Command {} one sig r0_comm0 extends r0_comm {} { capability = app_HumidityTrendSample.state attribute = cap_state_attr_lastHumidity value = cap_state_attr_lastHumidity_val//_not_null } one sig r1 extends r {}{ triggers = r1_trig conditions = r1_cond commands = r1_comm } abstract sig r1_trig extends Trigger {} one sig r1_trig0 extends r1_trig {} { capabilities = app_HumidityTrendSample.humidity attribute = cap_relativeHumidityMeasurement_attr_humidity no value } abstract sig r1_cond extends Condition {} one sig r1_cond0 extends r1_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrendPts value = cap_state_attr_currentTrendPts_val//_gte_settings.humidity1 } one sig r1_cond1 extends r1_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrend value = cap_state_attr_currentTrend_val_NONE } one sig r1_cond2 extends r1_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrend value = cap_state_attr_currentTrend_val_UP } one sig r1_cond3 extends r1_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_humidityThresholdActivated value = cap_state_attr_humidityThresholdActivated_val_true } abstract sig r1_comm extends Command {} one sig r1_comm0 extends r1_comm {} { capability = app_HumidityTrendSample.state attribute = cap_state_attr_lastHumidity value = cap_state_attr_lastHumidity_val//_not_null } one sig r2 extends r {}{ triggers = r2_trig conditions = r2_cond commands = r2_comm } abstract sig r2_trig extends Trigger {} one sig r2_trig0 extends r2_trig {} { capabilities = app_HumidityTrendSample.humidity attribute = cap_relativeHumidityMeasurement_attr_humidity no value } abstract sig r2_cond extends Condition {} one sig r2_cond0 extends r2_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrendPts value = cap_state_attr_currentTrendPts_val//_gte_settings.humidity1 } one sig r2_cond1 extends r2_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrend value = cap_state_attr_currentTrend_val_NONE } one sig r2_cond2 extends r2_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrend value = cap_state_attr_currentTrend_val_UP } one sig r2_cond3 extends r2_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_humidityThresholdActivated value = cap_state_attr_humidityThresholdActivated_val_true } abstract sig r2_comm extends Command {} one sig r2_comm0 extends r2_comm {} { capability = app_HumidityTrendSample.state attribute = cap_state_attr_humidityThresholdActivated value = cap_state_attr_humidityThresholdActivated_val_true } one sig r3 extends r {}{ triggers = r3_trig conditions = r3_cond commands = r3_comm } abstract sig r3_trig extends Trigger {} one sig r3_trig0 extends r3_trig {} { capabilities = app_HumidityTrendSample.humidity attribute = cap_relativeHumidityMeasurement_attr_humidity no value } abstract sig r3_cond extends Condition {} one sig r3_cond0 extends r3_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrendPts value = cap_state_attr_currentTrendPts_val//_lte_(0_-_settings.humidity2) } /* one sig r3_cond1 extends r3_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrendPts value = cap_state_attr_currentTrendPts_val_lt_settings.humidity1 } */ one sig r3_cond2 extends r3_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_humidityThresholdActivated value = cap_state_attr_humidityThresholdActivated_val_false } one sig r3_cond3 extends r3_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrend value = cap_state_attr_currentTrend_val - cap_state_attr_currentTrend_val_NONE } one sig r3_cond4 extends r3_cond {} { capabilities = app_HumidityTrendSample.state attribute = cap_state_attr_currentTrend value = cap_state_attr_currentTrend_val - cap_state_attr_currentTrend_val_UP } abstract sig r3_comm extends Command {} one sig r3_comm0 extends r3_comm {} { capability = app_HumidityTrendSample.state attribute = cap_state_attr_humidityThresholdActivated value = cap_state_attr_humidityThresholdActivated_val_false }
original version (1984)/asm/map08-init.asm
fa8ntomas/bclk-samples
0
27843
; Map 08 Init ; Fires Map8Init: lda #$06 sta Fire1X lda #$1B sta Fire2X lda #$05 sta Fire1Y sta Fire2Y lda #$FF sta ENDPT lda #$F2 sta ENDPT+1 rts
llvm-gcc-4.2-2.9/gcc/ada/sem_util.adb
vidkidz/crossbridge
1
7827
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ U T I L -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Casing; use Casing; with Checks; use Checks; with Debug; use Debug; with Errout; use Errout; with Elists; use Elists; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Fname; use Fname; with Freeze; use Freeze; with Lib; use Lib; with Lib.Xref; use Lib.Xref; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Output; use Output; with Opt; use Opt; with Restrict; use Restrict; with Rident; use Rident; with Rtsfind; use Rtsfind; with Scans; use Scans; with Scn; use Scn; with Sem; use Sem; with Sem_Ch8; use Sem_Ch8; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Type; use Sem_Type; with Sinfo; use Sinfo; with Sinput; use Sinput; with Snames; use Snames; with Stand; use Stand; with Style; with Stringt; use Stringt; with Targparm; use Targparm; with Tbuild; use Tbuild; with Ttypes; use Ttypes; with Uname; use Uname; package body Sem_Util is ----------------------- -- Local Subprograms -- ----------------------- function Build_Component_Subtype (C : List_Id; Loc : Source_Ptr; T : Entity_Id) return Node_Id; -- This function builds the subtype for Build_Actual_Subtype_Of_Component -- and Build_Discriminal_Subtype_Of_Component. C is a list of constraints, -- Loc is the source location, T is the original subtype. function Is_Fully_Initialized_Variant (Typ : Entity_Id) return Boolean; -- Subsidiary to Is_Fully_Initialized_Type. For an unconstrained type -- with discriminants whose default values are static, examine only the -- components in the selected variant to determine whether all of them -- have a default. function Has_Null_Extension (T : Entity_Id) return Boolean; -- T is a derived tagged type. Check whether the type extension is null. -- If the parent type is fully initialized, T can be treated as such. -------------------------------- -- Add_Access_Type_To_Process -- -------------------------------- procedure Add_Access_Type_To_Process (E : Entity_Id; A : Entity_Id) is L : Elist_Id; begin Ensure_Freeze_Node (E); L := Access_Types_To_Process (Freeze_Node (E)); if No (L) then L := New_Elmt_List; Set_Access_Types_To_Process (Freeze_Node (E), L); end if; Append_Elmt (A, L); end Add_Access_Type_To_Process; ----------------------- -- Alignment_In_Bits -- ----------------------- function Alignment_In_Bits (E : Entity_Id) return Uint is begin return Alignment (E) * System_Storage_Unit; end Alignment_In_Bits; ----------------------------------------- -- Apply_Compile_Time_Constraint_Error -- ----------------------------------------- procedure Apply_Compile_Time_Constraint_Error (N : Node_Id; Msg : String; Reason : RT_Exception_Code; Ent : Entity_Id := Empty; Typ : Entity_Id := Empty; Loc : Source_Ptr := No_Location; Rep : Boolean := True; Warn : Boolean := False) is Stat : constant Boolean := Is_Static_Expression (N); Rtyp : Entity_Id; begin if No (Typ) then Rtyp := Etype (N); else Rtyp := Typ; end if; Discard_Node (Compile_Time_Constraint_Error (N, Msg, Ent, Loc, Warn => Warn)); if not Rep then return; end if; -- Now we replace the node by an N_Raise_Constraint_Error node -- This does not need reanalyzing, so set it as analyzed now. Rewrite (N, Make_Raise_Constraint_Error (Sloc (N), Reason => Reason)); Set_Analyzed (N, True); Set_Etype (N, Rtyp); Set_Raises_Constraint_Error (N); -- If the original expression was marked as static, the result is -- still marked as static, but the Raises_Constraint_Error flag is -- always set so that further static evaluation is not attempted. if Stat then Set_Is_Static_Expression (N); end if; end Apply_Compile_Time_Constraint_Error; -------------------------- -- Build_Actual_Subtype -- -------------------------- function Build_Actual_Subtype (T : Entity_Id; N : Node_Or_Entity_Id) return Node_Id is Obj : Node_Id; Loc : constant Source_Ptr := Sloc (N); Constraints : List_Id; Decl : Node_Id; Discr : Entity_Id; Hi : Node_Id; Lo : Node_Id; Subt : Entity_Id; Disc_Type : Entity_Id; begin if Nkind (N) = N_Defining_Identifier then Obj := New_Reference_To (N, Loc); else Obj := N; end if; if Is_Array_Type (T) then Constraints := New_List; for J in 1 .. Number_Dimensions (T) loop -- Build an array subtype declaration with the nominal -- subtype and the bounds of the actual. Add the declaration -- in front of the local declarations for the subprogram, for -- analysis before any reference to the formal in the body. Lo := Make_Attribute_Reference (Loc, Prefix => Duplicate_Subexpr_No_Checks (Obj, Name_Req => True), Attribute_Name => Name_First, Expressions => New_List ( Make_Integer_Literal (Loc, J))); Hi := Make_Attribute_Reference (Loc, Prefix => Duplicate_Subexpr_No_Checks (Obj, Name_Req => True), Attribute_Name => Name_Last, Expressions => New_List ( Make_Integer_Literal (Loc, J))); Append (Make_Range (Loc, Lo, Hi), Constraints); end loop; -- If the type has unknown discriminants there is no constrained -- subtype to build. This is never called for a formal or for a -- lhs, so returning the type is ok ??? elsif Has_Unknown_Discriminants (T) then return T; else Constraints := New_List; if Is_Private_Type (T) and then No (Full_View (T)) then -- Type is a generic derived type. Inherit discriminants from -- Parent type. Disc_Type := Etype (Base_Type (T)); else Disc_Type := T; end if; Discr := First_Discriminant (Disc_Type); while Present (Discr) loop Append_To (Constraints, Make_Selected_Component (Loc, Prefix => Duplicate_Subexpr_No_Checks (Obj), Selector_Name => New_Occurrence_Of (Discr, Loc))); Next_Discriminant (Discr); end loop; end if; Subt := Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('S')); Set_Is_Internal (Subt); Decl := Make_Subtype_Declaration (Loc, Defining_Identifier => Subt, Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => New_Reference_To (T, Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => Constraints))); Mark_Rewrite_Insertion (Decl); return Decl; end Build_Actual_Subtype; --------------------------------------- -- Build_Actual_Subtype_Of_Component -- --------------------------------------- function Build_Actual_Subtype_Of_Component (T : Entity_Id; N : Node_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (N); P : constant Node_Id := Prefix (N); D : Elmt_Id; Id : Node_Id; Indx_Type : Entity_Id; Deaccessed_T : Entity_Id; -- This is either a copy of T, or if T is an access type, then it is -- the directly designated type of this access type. function Build_Actual_Array_Constraint return List_Id; -- If one or more of the bounds of the component depends on -- discriminants, build actual constraint using the discriminants -- of the prefix. function Build_Actual_Record_Constraint return List_Id; -- Similar to previous one, for discriminated components constrained -- by the discriminant of the enclosing object. ----------------------------------- -- Build_Actual_Array_Constraint -- ----------------------------------- function Build_Actual_Array_Constraint return List_Id is Constraints : constant List_Id := New_List; Indx : Node_Id; Hi : Node_Id; Lo : Node_Id; Old_Hi : Node_Id; Old_Lo : Node_Id; begin Indx := First_Index (Deaccessed_T); while Present (Indx) loop Old_Lo := Type_Low_Bound (Etype (Indx)); Old_Hi := Type_High_Bound (Etype (Indx)); if Denotes_Discriminant (Old_Lo) then Lo := Make_Selected_Component (Loc, Prefix => New_Copy_Tree (P), Selector_Name => New_Occurrence_Of (Entity (Old_Lo), Loc)); else Lo := New_Copy_Tree (Old_Lo); -- The new bound will be reanalyzed in the enclosing -- declaration. For literal bounds that come from a type -- declaration, the type of the context must be imposed, so -- insure that analysis will take place. For non-universal -- types this is not strictly necessary. Set_Analyzed (Lo, False); end if; if Denotes_Discriminant (Old_Hi) then Hi := Make_Selected_Component (Loc, Prefix => New_Copy_Tree (P), Selector_Name => New_Occurrence_Of (Entity (Old_Hi), Loc)); else Hi := New_Copy_Tree (Old_Hi); Set_Analyzed (Hi, False); end if; Append (Make_Range (Loc, Lo, Hi), Constraints); Next_Index (Indx); end loop; return Constraints; end Build_Actual_Array_Constraint; ------------------------------------ -- Build_Actual_Record_Constraint -- ------------------------------------ function Build_Actual_Record_Constraint return List_Id is Constraints : constant List_Id := New_List; D : Elmt_Id; D_Val : Node_Id; begin D := First_Elmt (Discriminant_Constraint (Deaccessed_T)); while Present (D) loop if Denotes_Discriminant (Node (D)) then D_Val := Make_Selected_Component (Loc, Prefix => New_Copy_Tree (P), Selector_Name => New_Occurrence_Of (Entity (Node (D)), Loc)); else D_Val := New_Copy_Tree (Node (D)); end if; Append (D_Val, Constraints); Next_Elmt (D); end loop; return Constraints; end Build_Actual_Record_Constraint; -- Start of processing for Build_Actual_Subtype_Of_Component begin if In_Default_Expression then return Empty; elsif Nkind (N) = N_Explicit_Dereference then if Is_Composite_Type (T) and then not Is_Constrained (T) and then not (Is_Class_Wide_Type (T) and then Is_Constrained (Root_Type (T))) and then not Has_Unknown_Discriminants (T) then -- If the type of the dereference is already constrained, it -- is an actual subtype. if Is_Array_Type (Etype (N)) and then Is_Constrained (Etype (N)) then return Empty; else Remove_Side_Effects (P); return Build_Actual_Subtype (T, N); end if; else return Empty; end if; end if; if Ekind (T) = E_Access_Subtype then Deaccessed_T := Designated_Type (T); else Deaccessed_T := T; end if; if Ekind (Deaccessed_T) = E_Array_Subtype then Id := First_Index (Deaccessed_T); while Present (Id) loop Indx_Type := Underlying_Type (Etype (Id)); if Denotes_Discriminant (Type_Low_Bound (Indx_Type)) or else Denotes_Discriminant (Type_High_Bound (Indx_Type)) then Remove_Side_Effects (P); return Build_Component_Subtype ( Build_Actual_Array_Constraint, Loc, Base_Type (T)); end if; Next_Index (Id); end loop; elsif Is_Composite_Type (Deaccessed_T) and then Has_Discriminants (Deaccessed_T) and then not Has_Unknown_Discriminants (Deaccessed_T) then D := First_Elmt (Discriminant_Constraint (Deaccessed_T)); while Present (D) loop if Denotes_Discriminant (Node (D)) then Remove_Side_Effects (P); return Build_Component_Subtype ( Build_Actual_Record_Constraint, Loc, Base_Type (T)); end if; Next_Elmt (D); end loop; end if; -- If none of the above, the actual and nominal subtypes are the same return Empty; end Build_Actual_Subtype_Of_Component; ----------------------------- -- Build_Component_Subtype -- ----------------------------- function Build_Component_Subtype (C : List_Id; Loc : Source_Ptr; T : Entity_Id) return Node_Id is Subt : Entity_Id; Decl : Node_Id; begin -- Unchecked_Union components do not require component subtypes if Is_Unchecked_Union (T) then return Empty; end if; Subt := Make_Defining_Identifier (Loc, Chars => New_Internal_Name ('S')); Set_Is_Internal (Subt); Decl := Make_Subtype_Declaration (Loc, Defining_Identifier => Subt, Subtype_Indication => Make_Subtype_Indication (Loc, Subtype_Mark => New_Reference_To (Base_Type (T), Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => C))); Mark_Rewrite_Insertion (Decl); return Decl; end Build_Component_Subtype; -------------------------------------------- -- Build_Discriminal_Subtype_Of_Component -- -------------------------------------------- function Build_Discriminal_Subtype_Of_Component (T : Entity_Id) return Node_Id is Loc : constant Source_Ptr := Sloc (T); D : Elmt_Id; Id : Node_Id; function Build_Discriminal_Array_Constraint return List_Id; -- If one or more of the bounds of the component depends on -- discriminants, build actual constraint using the discriminants -- of the prefix. function Build_Discriminal_Record_Constraint return List_Id; -- Similar to previous one, for discriminated components constrained -- by the discriminant of the enclosing object. ---------------------------------------- -- Build_Discriminal_Array_Constraint -- ---------------------------------------- function Build_Discriminal_Array_Constraint return List_Id is Constraints : constant List_Id := New_List; Indx : Node_Id; Hi : Node_Id; Lo : Node_Id; Old_Hi : Node_Id; Old_Lo : Node_Id; begin Indx := First_Index (T); while Present (Indx) loop Old_Lo := Type_Low_Bound (Etype (Indx)); Old_Hi := Type_High_Bound (Etype (Indx)); if Denotes_Discriminant (Old_Lo) then Lo := New_Occurrence_Of (Discriminal (Entity (Old_Lo)), Loc); else Lo := New_Copy_Tree (Old_Lo); end if; if Denotes_Discriminant (Old_Hi) then Hi := New_Occurrence_Of (Discriminal (Entity (Old_Hi)), Loc); else Hi := New_Copy_Tree (Old_Hi); end if; Append (Make_Range (Loc, Lo, Hi), Constraints); Next_Index (Indx); end loop; return Constraints; end Build_Discriminal_Array_Constraint; ----------------------------------------- -- Build_Discriminal_Record_Constraint -- ----------------------------------------- function Build_Discriminal_Record_Constraint return List_Id is Constraints : constant List_Id := New_List; D : Elmt_Id; D_Val : Node_Id; begin D := First_Elmt (Discriminant_Constraint (T)); while Present (D) loop if Denotes_Discriminant (Node (D)) then D_Val := New_Occurrence_Of (Discriminal (Entity (Node (D))), Loc); else D_Val := New_Copy_Tree (Node (D)); end if; Append (D_Val, Constraints); Next_Elmt (D); end loop; return Constraints; end Build_Discriminal_Record_Constraint; -- Start of processing for Build_Discriminal_Subtype_Of_Component begin if Ekind (T) = E_Array_Subtype then Id := First_Index (T); while Present (Id) loop if Denotes_Discriminant (Type_Low_Bound (Etype (Id))) or else Denotes_Discriminant (Type_High_Bound (Etype (Id))) then return Build_Component_Subtype (Build_Discriminal_Array_Constraint, Loc, T); end if; Next_Index (Id); end loop; elsif Ekind (T) = E_Record_Subtype and then Has_Discriminants (T) and then not Has_Unknown_Discriminants (T) then D := First_Elmt (Discriminant_Constraint (T)); while Present (D) loop if Denotes_Discriminant (Node (D)) then return Build_Component_Subtype (Build_Discriminal_Record_Constraint, Loc, T); end if; Next_Elmt (D); end loop; end if; -- If none of the above, the actual and nominal subtypes are the same return Empty; end Build_Discriminal_Subtype_Of_Component; ------------------------------ -- Build_Elaboration_Entity -- ------------------------------ procedure Build_Elaboration_Entity (N : Node_Id; Spec_Id : Entity_Id) is Loc : constant Source_Ptr := Sloc (N); Unum : constant Unit_Number_Type := Get_Source_Unit (Loc); Decl : Node_Id; P : Natural; Elab_Ent : Entity_Id; begin -- Ignore if already constructed if Present (Elaboration_Entity (Spec_Id)) then return; end if; -- Construct name of elaboration entity as xxx_E, where xxx -- is the unit name with dots replaced by double underscore. -- We have to manually construct this name, since it will -- be elaborated in the outer scope, and thus will not have -- the unit name automatically prepended. Get_Name_String (Unit_Name (Unum)); -- Replace the %s by _E Name_Buffer (Name_Len - 1 .. Name_Len) := "_E"; -- Replace dots by double underscore P := 2; while P < Name_Len - 2 loop if Name_Buffer (P) = '.' then Name_Buffer (P + 2 .. Name_Len + 1) := Name_Buffer (P + 1 .. Name_Len); Name_Len := Name_Len + 1; Name_Buffer (P) := '_'; Name_Buffer (P + 1) := '_'; P := P + 3; else P := P + 1; end if; end loop; -- Create elaboration flag Elab_Ent := Make_Defining_Identifier (Loc, Chars => Name_Find); Set_Elaboration_Entity (Spec_Id, Elab_Ent); if No (Declarations (Aux_Decls_Node (N))) then Set_Declarations (Aux_Decls_Node (N), New_List); end if; Decl := Make_Object_Declaration (Loc, Defining_Identifier => Elab_Ent, Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc), Expression => New_Occurrence_Of (Standard_False, Loc)); Append_To (Declarations (Aux_Decls_Node (N)), Decl); Analyze (Decl); -- Reset True_Constant indication, since we will indeed -- assign a value to the variable in the binder main. Set_Is_True_Constant (Elab_Ent, False); Set_Current_Value (Elab_Ent, Empty); -- We do not want any further qualification of the name (if we did -- not do this, we would pick up the name of the generic package -- in the case of a library level generic instantiation). Set_Has_Qualified_Name (Elab_Ent); Set_Has_Fully_Qualified_Name (Elab_Ent); end Build_Elaboration_Entity; ----------------------------------- -- Cannot_Raise_Constraint_Error -- ----------------------------------- function Cannot_Raise_Constraint_Error (Expr : Node_Id) return Boolean is begin if Compile_Time_Known_Value (Expr) then return True; elsif Do_Range_Check (Expr) then return False; elsif Raises_Constraint_Error (Expr) then return False; else case Nkind (Expr) is when N_Identifier => return True; when N_Expanded_Name => return True; when N_Selected_Component => return not Do_Discriminant_Check (Expr); when N_Attribute_Reference => if Do_Overflow_Check (Expr) then return False; elsif No (Expressions (Expr)) then return True; else declare N : Node_Id := First (Expressions (Expr)); begin while Present (N) loop if Cannot_Raise_Constraint_Error (N) then Next (N); else return False; end if; end loop; return True; end; end if; when N_Type_Conversion => if Do_Overflow_Check (Expr) or else Do_Length_Check (Expr) or else Do_Tag_Check (Expr) then return False; else return Cannot_Raise_Constraint_Error (Expression (Expr)); end if; when N_Unchecked_Type_Conversion => return Cannot_Raise_Constraint_Error (Expression (Expr)); when N_Unary_Op => if Do_Overflow_Check (Expr) then return False; else return Cannot_Raise_Constraint_Error (Right_Opnd (Expr)); end if; when N_Op_Divide | N_Op_Mod | N_Op_Rem => if Do_Division_Check (Expr) or else Do_Overflow_Check (Expr) then return False; else return Cannot_Raise_Constraint_Error (Left_Opnd (Expr)) and then Cannot_Raise_Constraint_Error (Right_Opnd (Expr)); end if; when N_Op_Add | N_Op_And | N_Op_Concat | N_Op_Eq | N_Op_Expon | N_Op_Ge | N_Op_Gt | N_Op_Le | N_Op_Lt | N_Op_Multiply | N_Op_Ne | N_Op_Or | N_Op_Rotate_Left | N_Op_Rotate_Right | N_Op_Shift_Left | N_Op_Shift_Right | N_Op_Shift_Right_Arithmetic | N_Op_Subtract | N_Op_Xor => if Do_Overflow_Check (Expr) then return False; else return Cannot_Raise_Constraint_Error (Left_Opnd (Expr)) and then Cannot_Raise_Constraint_Error (Right_Opnd (Expr)); end if; when others => return False; end case; end if; end Cannot_Raise_Constraint_Error; -------------------------- -- Check_Fully_Declared -- -------------------------- procedure Check_Fully_Declared (T : Entity_Id; N : Node_Id) is begin if Ekind (T) = E_Incomplete_Type then -- Ada 2005 (AI-50217): If the type is available through a limited -- with_clause, verify that its full view has been analyzed. if From_With_Type (T) and then Present (Non_Limited_View (T)) and then Ekind (Non_Limited_View (T)) /= E_Incomplete_Type then -- The non-limited view is fully declared null; else Error_Msg_NE ("premature usage of incomplete}", N, First_Subtype (T)); end if; elsif Has_Private_Component (T) and then not Is_Generic_Type (Root_Type (T)) and then not In_Default_Expression then -- Special case: if T is the anonymous type created for a single -- task or protected object, use the name of the source object. if Is_Concurrent_Type (T) and then not Comes_From_Source (T) and then Nkind (N) = N_Object_Declaration then Error_Msg_NE ("type of& has incomplete component", N, Defining_Identifier (N)); else Error_Msg_NE ("premature usage of incomplete}", N, First_Subtype (T)); end if; end if; end Check_Fully_Declared; ----------------------- -- Check_Obsolescent -- ----------------------- procedure Check_Obsolescent (Nam : Entity_Id; N : Node_Id) is W : Node_Id; begin -- Note that we always allow obsolescent references in the compiler -- itself and the run time, since we assume that we know what we are -- doing in such cases. For example the calls in Ada.Characters.Handling -- to its own obsolescent subprograms are just fine. if Is_Obsolescent (Nam) and then not GNAT_Mode then Check_Restriction (No_Obsolescent_Features, N); if Warn_On_Obsolescent_Feature then if Is_Package_Or_Generic_Package (Nam) then Error_Msg_NE ("with of obsolescent package&?", N, Nam); else Error_Msg_NE ("call to obsolescent subprogram&?", N, Nam); end if; -- Output additional warning if present W := Obsolescent_Warning (Nam); if Present (W) then Name_Buffer (1) := '|'; Name_Buffer (2) := '?'; Name_Len := 2; -- Add characters to message, and output message for J in 1 .. String_Length (Strval (W)) loop Add_Char_To_Name_Buffer ('''); Add_Char_To_Name_Buffer (Get_Character (Get_String_Char (Strval (W), J))); end loop; Error_Msg_N (Name_Buffer (1 .. Name_Len), N); end if; end if; end if; end Check_Obsolescent; ------------------------------------------ -- Check_Potentially_Blocking_Operation -- ------------------------------------------ procedure Check_Potentially_Blocking_Operation (N : Node_Id) is S : Entity_Id; begin -- N is one of the potentially blocking operations listed in 9.5.1(8). -- When pragma Detect_Blocking is active, the run time will raise -- Program_Error. Here we only issue a warning, since we generally -- support the use of potentially blocking operations in the absence -- of the pragma. -- Indirect blocking through a subprogram call cannot be diagnosed -- statically without interprocedural analysis, so we do not attempt -- to do it here. S := Scope (Current_Scope); while Present (S) and then S /= Standard_Standard loop if Is_Protected_Type (S) then Error_Msg_N ("potentially blocking operation in protected operation?", N); return; end if; S := Scope (S); end loop; end Check_Potentially_Blocking_Operation; --------------- -- Check_VMS -- --------------- procedure Check_VMS (Construct : Node_Id) is begin if not OpenVMS_On_Target then Error_Msg_N ("this construct is allowed only in Open'V'M'S", Construct); end if; end Check_VMS; ---------------------------------- -- Collect_Primitive_Operations -- ---------------------------------- function Collect_Primitive_Operations (T : Entity_Id) return Elist_Id is B_Type : constant Entity_Id := Base_Type (T); B_Decl : constant Node_Id := Original_Node (Parent (B_Type)); B_Scope : Entity_Id := Scope (B_Type); Op_List : Elist_Id; Formal : Entity_Id; Is_Prim : Boolean; Formal_Derived : Boolean := False; Id : Entity_Id; begin -- For tagged types, the primitive operations are collected as they -- are declared, and held in an explicit list which is simply returned. if Is_Tagged_Type (B_Type) then return Primitive_Operations (B_Type); -- An untagged generic type that is a derived type inherits the -- primitive operations of its parent type. Other formal types only -- have predefined operators, which are not explicitly represented. elsif Is_Generic_Type (B_Type) then if Nkind (B_Decl) = N_Formal_Type_Declaration and then Nkind (Formal_Type_Definition (B_Decl)) = N_Formal_Derived_Type_Definition then Formal_Derived := True; else return New_Elmt_List; end if; end if; Op_List := New_Elmt_List; if B_Scope = Standard_Standard then if B_Type = Standard_String then Append_Elmt (Standard_Op_Concat, Op_List); elsif B_Type = Standard_Wide_String then Append_Elmt (Standard_Op_Concatw, Op_List); else null; end if; elsif (Is_Package_Or_Generic_Package (B_Scope) and then Nkind (Parent (Declaration_Node (First_Subtype (T)))) /= N_Package_Body) or else Is_Derived_Type (B_Type) then -- The primitive operations appear after the base type, except -- if the derivation happens within the private part of B_Scope -- and the type is a private type, in which case both the type -- and some primitive operations may appear before the base -- type, and the list of candidates starts after the type. if In_Open_Scopes (B_Scope) and then Scope (T) = B_Scope and then In_Private_Part (B_Scope) then Id := Next_Entity (T); else Id := Next_Entity (B_Type); end if; while Present (Id) loop -- Note that generic formal subprograms are not -- considered to be primitive operations and thus -- are never inherited. if Is_Overloadable (Id) and then Nkind (Parent (Parent (Id))) not in N_Formal_Subprogram_Declaration then Is_Prim := False; if Base_Type (Etype (Id)) = B_Type then Is_Prim := True; else Formal := First_Formal (Id); while Present (Formal) loop if Base_Type (Etype (Formal)) = B_Type then Is_Prim := True; exit; elsif Ekind (Etype (Formal)) = E_Anonymous_Access_Type and then Base_Type (Designated_Type (Etype (Formal))) = B_Type then Is_Prim := True; exit; end if; Next_Formal (Formal); end loop; end if; -- For a formal derived type, the only primitives are the -- ones inherited from the parent type. Operations appearing -- in the package declaration are not primitive for it. if Is_Prim and then (not Formal_Derived or else Present (Alias (Id))) then Append_Elmt (Id, Op_List); end if; end if; Next_Entity (Id); -- For a type declared in System, some of its operations -- may appear in the target-specific extension to System. if No (Id) and then Chars (B_Scope) = Name_System and then Scope (B_Scope) = Standard_Standard and then Present_System_Aux then B_Scope := System_Aux_Id; Id := First_Entity (System_Aux_Id); end if; end loop; end if; return Op_List; end Collect_Primitive_Operations; ----------------------------------- -- Compile_Time_Constraint_Error -- ----------------------------------- function Compile_Time_Constraint_Error (N : Node_Id; Msg : String; Ent : Entity_Id := Empty; Loc : Source_Ptr := No_Location; Warn : Boolean := False) return Node_Id is Msgc : String (1 .. Msg'Length + 2); Msgl : Natural; Wmsg : Boolean; P : Node_Id; OldP : Node_Id; Msgs : Boolean; Eloc : Source_Ptr; begin -- A static constraint error in an instance body is not a fatal error. -- we choose to inhibit the message altogether, because there is no -- obvious node (for now) on which to post it. On the other hand the -- offending node must be replaced with a constraint_error in any case. -- No messages are generated if we already posted an error on this node if not Error_Posted (N) then if Loc /= No_Location then Eloc := Loc; else Eloc := Sloc (N); end if; -- Make all such messages unconditional Msgc (1 .. Msg'Length) := Msg; Msgc (Msg'Length + 1) := '!'; Msgl := Msg'Length + 1; -- Message is a warning, even in Ada 95 case -- LLVM local if Msg (Msg'Last) = '?' then Wmsg := True; -- In Ada 83, all messages are warnings. In the private part and -- the body of an instance, constraint_checks are only warnings. -- We also make this a warning if the Warn parameter is set. elsif Warn or else (Ada_Version = Ada_83 and then Comes_From_Source (N)) then Msgl := Msgl + 1; Msgc (Msgl) := '?'; Wmsg := True; elsif In_Instance_Not_Visible then Msgl := Msgl + 1; Msgc (Msgl) := '?'; Wmsg := True; -- Otherwise we have a real error message (Ada 95 static case) else Wmsg := False; end if; -- Should we generate a warning? The answer is not quite yes. The -- very annoying exception occurs in the case of a short circuit -- operator where the left operand is static and decisive. Climb -- parents to see if that is the case we have here. Conditional -- expressions with decisive conditions are a similar situation. Msgs := True; P := N; loop OldP := P; P := Parent (P); -- And then with False as left operand if Nkind (P) = N_And_Then and then Compile_Time_Known_Value (Left_Opnd (P)) and then Is_False (Expr_Value (Left_Opnd (P))) then Msgs := False; exit; -- OR ELSE with True as left operand elsif Nkind (P) = N_Or_Else and then Compile_Time_Known_Value (Left_Opnd (P)) and then Is_True (Expr_Value (Left_Opnd (P))) then Msgs := False; exit; -- Conditional expression elsif Nkind (P) = N_Conditional_Expression then declare Cond : constant Node_Id := First (Expressions (P)); Texp : constant Node_Id := Next (Cond); Fexp : constant Node_Id := Next (Texp); begin if Compile_Time_Known_Value (Cond) then -- Condition is True and we are in the right operand if Is_True (Expr_Value (Cond)) and then OldP = Fexp then Msgs := False; exit; -- Condition is False and we are in the left operand elsif Is_False (Expr_Value (Cond)) and then OldP = Texp then Msgs := False; exit; end if; end if; end; -- Special case for component association in aggregates, where -- we want to keep climbing up to the parent aggregate. elsif Nkind (P) = N_Component_Association and then Nkind (Parent (P)) = N_Aggregate then null; -- Keep going if within subexpression else exit when Nkind (P) not in N_Subexpr; end if; end loop; if Msgs then if Present (Ent) then Error_Msg_NEL (Msgc (1 .. Msgl), N, Ent, Eloc); else Error_Msg_NEL (Msgc (1 .. Msgl), N, Etype (N), Eloc); end if; if Wmsg then if Inside_Init_Proc then Error_Msg_NEL ("\?& will be raised for objects of this type", N, Standard_Constraint_Error, Eloc); else Error_Msg_NEL ("\?& will be raised at run time", N, Standard_Constraint_Error, Eloc); end if; else Error_Msg_NEL ("\static expression raises&!", N, Standard_Constraint_Error, Eloc); end if; end if; end if; return N; end Compile_Time_Constraint_Error; ----------------------- -- Conditional_Delay -- ----------------------- procedure Conditional_Delay (New_Ent, Old_Ent : Entity_Id) is begin if Has_Delayed_Freeze (Old_Ent) and then not Is_Frozen (Old_Ent) then Set_Has_Delayed_Freeze (New_Ent); end if; end Conditional_Delay; -------------------- -- Current_Entity -- -------------------- -- The currently visible definition for a given identifier is the -- one most chained at the start of the visibility chain, i.e. the -- one that is referenced by the Node_Id value of the name of the -- given identifier. function Current_Entity (N : Node_Id) return Entity_Id is begin return Get_Name_Entity_Id (Chars (N)); end Current_Entity; ----------------------------- -- Current_Entity_In_Scope -- ----------------------------- function Current_Entity_In_Scope (N : Node_Id) return Entity_Id is E : Entity_Id; CS : constant Entity_Id := Current_Scope; Transient_Case : constant Boolean := Scope_Is_Transient; begin E := Get_Name_Entity_Id (Chars (N)); while Present (E) and then Scope (E) /= CS and then (not Transient_Case or else Scope (E) /= Scope (CS)) loop E := Homonym (E); end loop; return E; end Current_Entity_In_Scope; ------------------- -- Current_Scope -- ------------------- function Current_Scope return Entity_Id is begin if Scope_Stack.Last = -1 then return Standard_Standard; else declare C : constant Entity_Id := Scope_Stack.Table (Scope_Stack.Last).Entity; begin if Present (C) then return C; else return Standard_Standard; end if; end; end if; end Current_Scope; ------------------------ -- Current_Subprogram -- ------------------------ function Current_Subprogram return Entity_Id is Scop : constant Entity_Id := Current_Scope; begin if Is_Subprogram (Scop) or else Is_Generic_Subprogram (Scop) then return Scop; else return Enclosing_Subprogram (Scop); end if; end Current_Subprogram; --------------------- -- Defining_Entity -- --------------------- function Defining_Entity (N : Node_Id) return Entity_Id is K : constant Node_Kind := Nkind (N); Err : Entity_Id := Empty; begin case K is when N_Subprogram_Declaration | N_Abstract_Subprogram_Declaration | N_Subprogram_Body | N_Package_Declaration | N_Subprogram_Renaming_Declaration | N_Subprogram_Body_Stub | N_Generic_Subprogram_Declaration | N_Generic_Package_Declaration | N_Formal_Subprogram_Declaration => return Defining_Entity (Specification (N)); when N_Component_Declaration | N_Defining_Program_Unit_Name | N_Discriminant_Specification | N_Entry_Body | N_Entry_Declaration | N_Entry_Index_Specification | N_Exception_Declaration | N_Exception_Renaming_Declaration | N_Formal_Object_Declaration | N_Formal_Package_Declaration | N_Formal_Type_Declaration | N_Full_Type_Declaration | N_Implicit_Label_Declaration | N_Incomplete_Type_Declaration | N_Loop_Parameter_Specification | N_Number_Declaration | N_Object_Declaration | N_Object_Renaming_Declaration | N_Package_Body_Stub | N_Parameter_Specification | N_Private_Extension_Declaration | N_Private_Type_Declaration | N_Protected_Body | N_Protected_Body_Stub | N_Protected_Type_Declaration | N_Single_Protected_Declaration | N_Single_Task_Declaration | N_Subtype_Declaration | N_Task_Body | N_Task_Body_Stub | N_Task_Type_Declaration => return Defining_Identifier (N); when N_Subunit => return Defining_Entity (Proper_Body (N)); when N_Function_Instantiation | N_Function_Specification | N_Generic_Function_Renaming_Declaration | N_Generic_Package_Renaming_Declaration | N_Generic_Procedure_Renaming_Declaration | N_Package_Body | N_Package_Instantiation | N_Package_Renaming_Declaration | N_Package_Specification | N_Procedure_Instantiation | N_Procedure_Specification => declare Nam : constant Node_Id := Defining_Unit_Name (N); begin if Nkind (Nam) in N_Entity then return Nam; -- For Error, make up a name and attach to declaration -- so we can continue semantic analysis elsif Nam = Error then Err := Make_Defining_Identifier (Sloc (N), Chars => New_Internal_Name ('T')); Set_Defining_Unit_Name (N, Err); return Err; -- If not an entity, get defining identifier else return Defining_Identifier (Nam); end if; end; when N_Block_Statement => return Entity (Identifier (N)); when others => raise Program_Error; end case; end Defining_Entity; -------------------------- -- Denotes_Discriminant -- -------------------------- function Denotes_Discriminant (N : Node_Id; Check_Protected : Boolean := False) return Boolean is E : Entity_Id; begin if not Is_Entity_Name (N) or else No (Entity (N)) then return False; else E := Entity (N); end if; -- If we are checking for a protected type, the discriminant may have -- been rewritten as the corresponding discriminal of the original type -- or of the corresponding concurrent record, depending on whether we -- are in the spec or body of the protected type. return Ekind (E) = E_Discriminant or else (Check_Protected and then Ekind (E) = E_In_Parameter and then Present (Discriminal_Link (E)) and then (Is_Protected_Type (Scope (Discriminal_Link (E))) or else Is_Concurrent_Record_Type (Scope (Discriminal_Link (E))))); end Denotes_Discriminant; ----------------------------- -- Depends_On_Discriminant -- ----------------------------- function Depends_On_Discriminant (N : Node_Id) return Boolean is L : Node_Id; H : Node_Id; begin Get_Index_Bounds (N, L, H); return Denotes_Discriminant (L) or else Denotes_Discriminant (H); end Depends_On_Discriminant; ------------------------- -- Designate_Same_Unit -- ------------------------- function Designate_Same_Unit (Name1 : Node_Id; Name2 : Node_Id) return Boolean is K1 : constant Node_Kind := Nkind (Name1); K2 : constant Node_Kind := Nkind (Name2); function Prefix_Node (N : Node_Id) return Node_Id; -- Returns the parent unit name node of a defining program unit name -- or the prefix if N is a selected component or an expanded name. function Select_Node (N : Node_Id) return Node_Id; -- Returns the defining identifier node of a defining program unit -- name or the selector node if N is a selected component or an -- expanded name. ----------------- -- Prefix_Node -- ----------------- function Prefix_Node (N : Node_Id) return Node_Id is begin if Nkind (N) = N_Defining_Program_Unit_Name then return Name (N); else return Prefix (N); end if; end Prefix_Node; ----------------- -- Select_Node -- ----------------- function Select_Node (N : Node_Id) return Node_Id is begin if Nkind (N) = N_Defining_Program_Unit_Name then return Defining_Identifier (N); else return Selector_Name (N); end if; end Select_Node; -- Start of processing for Designate_Next_Unit begin if (K1 = N_Identifier or else K1 = N_Defining_Identifier) and then (K2 = N_Identifier or else K2 = N_Defining_Identifier) then return Chars (Name1) = Chars (Name2); elsif (K1 = N_Expanded_Name or else K1 = N_Selected_Component or else K1 = N_Defining_Program_Unit_Name) and then (K2 = N_Expanded_Name or else K2 = N_Selected_Component or else K2 = N_Defining_Program_Unit_Name) then return (Chars (Select_Node (Name1)) = Chars (Select_Node (Name2))) and then Designate_Same_Unit (Prefix_Node (Name1), Prefix_Node (Name2)); else return False; end if; end Designate_Same_Unit; ---------------------------- -- Enclosing_Generic_Body -- ---------------------------- function Enclosing_Generic_Body (N : Node_Id) return Node_Id is P : Node_Id; Decl : Node_Id; Spec : Node_Id; begin P := Parent (N); while Present (P) loop if Nkind (P) = N_Package_Body or else Nkind (P) = N_Subprogram_Body then Spec := Corresponding_Spec (P); if Present (Spec) then Decl := Unit_Declaration_Node (Spec); if Nkind (Decl) = N_Generic_Package_Declaration or else Nkind (Decl) = N_Generic_Subprogram_Declaration then return P; end if; end if; end if; P := Parent (P); end loop; return Empty; end Enclosing_Generic_Body; ---------------------------- -- Enclosing_Generic_Unit -- ---------------------------- function Enclosing_Generic_Unit (N : Node_Id) return Node_Id is P : Node_Id; Decl : Node_Id; Spec : Node_Id; begin P := Parent (N); while Present (P) loop if Nkind (P) = N_Generic_Package_Declaration or else Nkind (P) = N_Generic_Subprogram_Declaration then return P; elsif Nkind (P) = N_Package_Body or else Nkind (P) = N_Subprogram_Body then Spec := Corresponding_Spec (P); if Present (Spec) then Decl := Unit_Declaration_Node (Spec); if Nkind (Decl) = N_Generic_Package_Declaration or else Nkind (Decl) = N_Generic_Subprogram_Declaration then return Decl; end if; end if; end if; P := Parent (P); end loop; return Empty; end Enclosing_Generic_Unit; ------------------------------- -- Enclosing_Lib_Unit_Entity -- ------------------------------- function Enclosing_Lib_Unit_Entity return Entity_Id is Unit_Entity : Entity_Id := Current_Scope; begin -- Look for enclosing library unit entity by following scope links. -- Equivalent to, but faster than indexing through the scope stack. while (Present (Scope (Unit_Entity)) and then Scope (Unit_Entity) /= Standard_Standard) and not Is_Child_Unit (Unit_Entity) loop Unit_Entity := Scope (Unit_Entity); end loop; return Unit_Entity; end Enclosing_Lib_Unit_Entity; ----------------------------- -- Enclosing_Lib_Unit_Node -- ----------------------------- function Enclosing_Lib_Unit_Node (N : Node_Id) return Node_Id is Current_Node : Node_Id := N; begin while Present (Current_Node) and then Nkind (Current_Node) /= N_Compilation_Unit loop Current_Node := Parent (Current_Node); end loop; if Nkind (Current_Node) /= N_Compilation_Unit then return Empty; end if; return Current_Node; end Enclosing_Lib_Unit_Node; -------------------------- -- Enclosing_Subprogram -- -------------------------- function Enclosing_Subprogram (E : Entity_Id) return Entity_Id is Dynamic_Scope : constant Entity_Id := Enclosing_Dynamic_Scope (E); begin if Dynamic_Scope = Standard_Standard then return Empty; elsif Ekind (Dynamic_Scope) = E_Subprogram_Body then return Corresponding_Spec (Parent (Parent (Dynamic_Scope))); elsif Ekind (Dynamic_Scope) = E_Block then return Enclosing_Subprogram (Dynamic_Scope); elsif Ekind (Dynamic_Scope) = E_Task_Type then return Get_Task_Body_Procedure (Dynamic_Scope); elsif Convention (Dynamic_Scope) = Convention_Protected then return Protected_Body_Subprogram (Dynamic_Scope); else return Dynamic_Scope; end if; end Enclosing_Subprogram; ------------------------ -- Ensure_Freeze_Node -- ------------------------ procedure Ensure_Freeze_Node (E : Entity_Id) is FN : Node_Id; begin if No (Freeze_Node (E)) then FN := Make_Freeze_Entity (Sloc (E)); Set_Has_Delayed_Freeze (E); Set_Freeze_Node (E, FN); Set_Access_Types_To_Process (FN, No_Elist); Set_TSS_Elist (FN, No_Elist); Set_Entity (FN, E); end if; end Ensure_Freeze_Node; ---------------- -- Enter_Name -- ---------------- procedure Enter_Name (Def_Id : Entity_Id) is C : constant Entity_Id := Current_Entity (Def_Id); E : constant Entity_Id := Current_Entity_In_Scope (Def_Id); S : constant Entity_Id := Current_Scope; function Is_Private_Component_Renaming (N : Node_Id) return Boolean; -- Recognize a renaming declaration that is introduced for private -- components of a protected type. We treat these as weak declarations -- so that they are overridden by entities with the same name that -- come from source, such as formals or local variables of a given -- protected declaration. ----------------------------------- -- Is_Private_Component_Renaming -- ----------------------------------- function Is_Private_Component_Renaming (N : Node_Id) return Boolean is begin return not Comes_From_Source (N) and then not Comes_From_Source (Current_Scope) and then Nkind (N) = N_Object_Renaming_Declaration; end Is_Private_Component_Renaming; -- Start of processing for Enter_Name begin Generate_Definition (Def_Id); -- Add new name to current scope declarations. Check for duplicate -- declaration, which may or may not be a genuine error. if Present (E) then -- Case of previous entity entered because of a missing declaration -- or else a bad subtype indication. Best is to use the new entity, -- and make the previous one invisible. if Etype (E) = Any_Type then Set_Is_Immediately_Visible (E, False); -- Case of renaming declaration constructed for package instances. -- if there is an explicit declaration with the same identifier, -- the renaming is not immediately visible any longer, but remains -- visible through selected component notation. elsif Nkind (Parent (E)) = N_Package_Renaming_Declaration and then not Comes_From_Source (E) then Set_Is_Immediately_Visible (E, False); -- The new entity may be the package renaming, which has the same -- same name as a generic formal which has been seen already. elsif Nkind (Parent (Def_Id)) = N_Package_Renaming_Declaration and then not Comes_From_Source (Def_Id) then Set_Is_Immediately_Visible (E, False); -- For a fat pointer corresponding to a remote access to subprogram, -- we use the same identifier as the RAS type, so that the proper -- name appears in the stub. This type is only retrieved through -- the RAS type and never by visibility, and is not added to the -- visibility list (see below). elsif Nkind (Parent (Def_Id)) = N_Full_Type_Declaration and then Present (Corresponding_Remote_Type (Def_Id)) then null; -- A controller component for a type extension overrides the -- inherited component. elsif Chars (E) = Name_uController then null; -- Case of an implicit operation or derived literal. The new entity -- hides the implicit one, which is removed from all visibility, -- i.e. the entity list of its scope, and homonym chain of its name. elsif (Is_Overloadable (E) and then Is_Inherited_Operation (E)) or else Is_Internal (E) then declare Prev : Entity_Id; Prev_Vis : Entity_Id; Decl : constant Node_Id := Parent (E); begin -- If E is an implicit declaration, it cannot be the first -- entity in the scope. Prev := First_Entity (Current_Scope); while Present (Prev) and then Next_Entity (Prev) /= E loop Next_Entity (Prev); end loop; if No (Prev) then -- If E is not on the entity chain of the current scope, -- it is an implicit declaration in the generic formal -- part of a generic subprogram. When analyzing the body, -- the generic formals are visible but not on the entity -- chain of the subprogram. The new entity will become -- the visible one in the body. pragma Assert (Nkind (Parent (Decl)) = N_Generic_Subprogram_Declaration); null; else Set_Next_Entity (Prev, Next_Entity (E)); if No (Next_Entity (Prev)) then Set_Last_Entity (Current_Scope, Prev); end if; if E = Current_Entity (E) then Prev_Vis := Empty; else Prev_Vis := Current_Entity (E); while Homonym (Prev_Vis) /= E loop Prev_Vis := Homonym (Prev_Vis); end loop; end if; if Present (Prev_Vis) then -- Skip E in the visibility chain Set_Homonym (Prev_Vis, Homonym (E)); else Set_Name_Entity_Id (Chars (E), Homonym (E)); end if; end if; end; -- This section of code could use a comment ??? elsif Present (Etype (E)) and then Is_Concurrent_Type (Etype (E)) and then E = Def_Id then return; elsif Is_Private_Component_Renaming (Parent (Def_Id)) then return; -- In the body or private part of an instance, a type extension -- may introduce a component with the same name as that of an -- actual. The legality rule is not enforced, but the semantics -- of the full type with two components of the same name are not -- clear at this point ??? elsif In_Instance_Not_Visible then null; -- When compiling a package body, some child units may have become -- visible. They cannot conflict with local entities that hide them. elsif Is_Child_Unit (E) and then In_Open_Scopes (Scope (E)) and then not Is_Immediately_Visible (E) then null; -- Conversely, with front-end inlining we may compile the parent -- body first, and a child unit subsequently. The context is now -- the parent spec, and body entities are not visible. elsif Is_Child_Unit (Def_Id) and then Is_Package_Body_Entity (E) and then not In_Package_Body (Current_Scope) then null; -- Case of genuine duplicate declaration else Error_Msg_Sloc := Sloc (E); -- If the previous declaration is an incomplete type declaration -- this may be an attempt to complete it with a private type. -- The following avoids confusing cascaded errors. if Nkind (Parent (E)) = N_Incomplete_Type_Declaration and then Nkind (Parent (Def_Id)) = N_Private_Type_Declaration then Error_Msg_N ("incomplete type cannot be completed" & " with a private declaration", Parent (Def_Id)); Set_Is_Immediately_Visible (E, False); Set_Full_View (E, Def_Id); elsif Ekind (E) = E_Discriminant and then Present (Scope (Def_Id)) and then Scope (Def_Id) /= Current_Scope then -- An inherited component of a record conflicts with -- a new discriminant. The discriminant is inserted first -- in the scope, but the error should be posted on it, not -- on the component. Error_Msg_Sloc := Sloc (Def_Id); Error_Msg_N ("& conflicts with declaration#", E); return; -- If the name of the unit appears in its own context clause, -- a dummy package with the name has already been created, and -- the error emitted. Try to continue quietly. elsif Error_Posted (E) and then Sloc (E) = No_Location and then Nkind (Parent (E)) = N_Package_Specification and then Current_Scope = Standard_Standard then Set_Scope (Def_Id, Current_Scope); return; else Error_Msg_N ("& conflicts with declaration#", Def_Id); -- Avoid cascaded messages with duplicate components in -- derived types. if Ekind (E) = E_Component or else Ekind (E) = E_Discriminant then return; end if; end if; if Nkind (Parent (Parent (Def_Id))) = N_Generic_Subprogram_Declaration and then Def_Id = Defining_Entity (Specification (Parent (Parent (Def_Id)))) then Error_Msg_N ("\generic units cannot be overloaded", Def_Id); end if; -- If entity is in standard, then we are in trouble, because -- it means that we have a library package with a duplicated -- name. That's hard to recover from, so abort! if S = Standard_Standard then raise Unrecoverable_Error; -- Otherwise we continue with the declaration. Having two -- identical declarations should not cause us too much trouble! else null; end if; end if; end if; -- If we fall through, declaration is OK , or OK enough to continue -- If Def_Id is a discriminant or a record component we are in the -- midst of inheriting components in a derived record definition. -- Preserve their Ekind and Etype. if Ekind (Def_Id) = E_Discriminant or else Ekind (Def_Id) = E_Component then null; -- If a type is already set, leave it alone (happens whey a type -- declaration is reanalyzed following a call to the optimizer) elsif Present (Etype (Def_Id)) then null; -- Otherwise, the kind E_Void insures that premature uses of the entity -- will be detected. Any_Type insures that no cascaded errors will occur else Set_Ekind (Def_Id, E_Void); Set_Etype (Def_Id, Any_Type); end if; -- Inherited discriminants and components in derived record types are -- immediately visible. Itypes are not. if Ekind (Def_Id) = E_Discriminant or else Ekind (Def_Id) = E_Component or else (No (Corresponding_Remote_Type (Def_Id)) and then not Is_Itype (Def_Id)) then Set_Is_Immediately_Visible (Def_Id); Set_Current_Entity (Def_Id); end if; Set_Homonym (Def_Id, C); Append_Entity (Def_Id, S); Set_Public_Status (Def_Id); -- Warn if new entity hides an old one if Warn_On_Hiding and then Present (C) and then Length_Of_Name (Chars (C)) /= 1 and then Comes_From_Source (C) and then Comes_From_Source (Def_Id) and then In_Extended_Main_Source_Unit (Def_Id) then Error_Msg_Sloc := Sloc (C); Error_Msg_N ("declaration hides &#?", Def_Id); end if; end Enter_Name; -------------------------- -- Explain_Limited_Type -- -------------------------- procedure Explain_Limited_Type (T : Entity_Id; N : Node_Id) is C : Entity_Id; begin -- For array, component type must be limited if Is_Array_Type (T) then Error_Msg_Node_2 := T; Error_Msg_NE ("component type& of type& is limited", N, Component_Type (T)); Explain_Limited_Type (Component_Type (T), N); elsif Is_Record_Type (T) then -- No need for extra messages if explicit limited record if Is_Limited_Record (Base_Type (T)) then return; end if; -- Otherwise find a limited component. Check only components that -- come from source, or inherited components that appear in the -- source of the ancestor. C := First_Component (T); while Present (C) loop if Is_Limited_Type (Etype (C)) and then (Comes_From_Source (C) or else (Present (Original_Record_Component (C)) and then Comes_From_Source (Original_Record_Component (C)))) then Error_Msg_Node_2 := T; Error_Msg_NE ("\component& of type& has limited type", N, C); Explain_Limited_Type (Etype (C), N); return; end if; Next_Component (C); end loop; -- The type may be declared explicitly limited, even if no component -- of it is limited, in which case we fall out of the loop. return; end if; end Explain_Limited_Type; ------------------------------------- -- Find_Corresponding_Discriminant -- ------------------------------------- function Find_Corresponding_Discriminant (Id : Node_Id; Typ : Entity_Id) return Entity_Id is Par_Disc : Entity_Id; Old_Disc : Entity_Id; New_Disc : Entity_Id; begin Par_Disc := Original_Record_Component (Original_Discriminant (Id)); -- The original type may currently be private, and the discriminant -- only appear on its full view. if Is_Private_Type (Scope (Par_Disc)) and then not Has_Discriminants (Scope (Par_Disc)) and then Present (Full_View (Scope (Par_Disc))) then Old_Disc := First_Discriminant (Full_View (Scope (Par_Disc))); else Old_Disc := First_Discriminant (Scope (Par_Disc)); end if; if Is_Class_Wide_Type (Typ) then New_Disc := First_Discriminant (Root_Type (Typ)); else New_Disc := First_Discriminant (Typ); end if; while Present (Old_Disc) and then Present (New_Disc) loop if Old_Disc = Par_Disc then return New_Disc; else Next_Discriminant (Old_Disc); Next_Discriminant (New_Disc); end if; end loop; -- Should always find it raise Program_Error; end Find_Corresponding_Discriminant; ----------------------------- -- Find_Static_Alternative -- ----------------------------- function Find_Static_Alternative (N : Node_Id) return Node_Id is Expr : constant Node_Id := Expression (N); Val : constant Uint := Expr_Value (Expr); Alt : Node_Id; Choice : Node_Id; begin Alt := First (Alternatives (N)); Search : loop if Nkind (Alt) /= N_Pragma then Choice := First (Discrete_Choices (Alt)); while Present (Choice) loop -- Others choice, always matches if Nkind (Choice) = N_Others_Choice then exit Search; -- Range, check if value is in the range elsif Nkind (Choice) = N_Range then exit Search when Val >= Expr_Value (Low_Bound (Choice)) and then Val <= Expr_Value (High_Bound (Choice)); -- Choice is a subtype name. Note that we know it must -- be a static subtype, since otherwise it would have -- been diagnosed as illegal. elsif Is_Entity_Name (Choice) and then Is_Type (Entity (Choice)) then exit Search when Is_In_Range (Expr, Etype (Choice)); -- Choice is a subtype indication elsif Nkind (Choice) = N_Subtype_Indication then declare C : constant Node_Id := Constraint (Choice); R : constant Node_Id := Range_Expression (C); begin exit Search when Val >= Expr_Value (Low_Bound (R)) and then Val <= Expr_Value (High_Bound (R)); end; -- Choice is a simple expression else exit Search when Val = Expr_Value (Choice); end if; Next (Choice); end loop; end if; Next (Alt); pragma Assert (Present (Alt)); end loop Search; -- The above loop *must* terminate by finding a match, since -- we know the case statement is valid, and the value of the -- expression is known at compile time. When we fall out of -- the loop, Alt points to the alternative that we know will -- be selected at run time. return Alt; end Find_Static_Alternative; ------------------ -- First_Actual -- ------------------ function First_Actual (Node : Node_Id) return Node_Id is N : Node_Id; begin if No (Parameter_Associations (Node)) then return Empty; end if; N := First (Parameter_Associations (Node)); if Nkind (N) = N_Parameter_Association then return First_Named_Actual (Node); else return N; end if; end First_Actual; ------------------------- -- Full_Qualified_Name -- ------------------------- function Full_Qualified_Name (E : Entity_Id) return String_Id is Res : String_Id; pragma Warnings (Off, Res); function Internal_Full_Qualified_Name (E : Entity_Id) return String_Id; -- Compute recursively the qualified name without NUL at the end ---------------------------------- -- Internal_Full_Qualified_Name -- ---------------------------------- function Internal_Full_Qualified_Name (E : Entity_Id) return String_Id is Ent : Entity_Id := E; Parent_Name : String_Id := No_String; begin -- Deals properly with child units if Nkind (Ent) = N_Defining_Program_Unit_Name then Ent := Defining_Identifier (Ent); end if; -- Compute qualification recursively (only "Standard" has no scope) if Present (Scope (Scope (Ent))) then Parent_Name := Internal_Full_Qualified_Name (Scope (Ent)); end if; -- Every entity should have a name except some expanded blocks -- don't bother about those. if Chars (Ent) = No_Name then return Parent_Name; end if; -- Add a period between Name and qualification if Parent_Name /= No_String then Start_String (Parent_Name); Store_String_Char (Get_Char_Code ('.')); else Start_String; end if; -- Generates the entity name in upper case Get_Decoded_Name_String (Chars (Ent)); Set_All_Upper_Case; Store_String_Chars (Name_Buffer (1 .. Name_Len)); return End_String; end Internal_Full_Qualified_Name; -- Start of processing for Full_Qualified_Name begin Res := Internal_Full_Qualified_Name (E); Store_String_Char (Get_Char_Code (ASCII.nul)); return End_String; end Full_Qualified_Name; ----------------------- -- Gather_Components -- ----------------------- procedure Gather_Components (Typ : Entity_Id; Comp_List : Node_Id; Governed_By : List_Id; Into : Elist_Id; Report_Errors : out Boolean) is Assoc : Node_Id; Variant : Node_Id; Discrete_Choice : Node_Id; Comp_Item : Node_Id; Discrim : Entity_Id; Discrim_Name : Node_Id; Discrim_Value : Node_Id; begin Report_Errors := False; if No (Comp_List) or else Null_Present (Comp_List) then return; elsif Present (Component_Items (Comp_List)) then Comp_Item := First (Component_Items (Comp_List)); else Comp_Item := Empty; end if; while Present (Comp_Item) loop -- Skip the tag of a tagged record, the interface tags, as well -- as all items that are not user components (anonymous types, -- rep clauses, Parent field, controller field). if Nkind (Comp_Item) = N_Component_Declaration then declare Comp : constant Entity_Id := Defining_Identifier (Comp_Item); begin if not Is_Tag (Comp) and then Chars (Comp) /= Name_uParent and then Chars (Comp) /= Name_uController then Append_Elmt (Comp, Into); end if; end; end if; Next (Comp_Item); end loop; if No (Variant_Part (Comp_List)) then return; else Discrim_Name := Name (Variant_Part (Comp_List)); Variant := First_Non_Pragma (Variants (Variant_Part (Comp_List))); end if; -- Look for the discriminant that governs this variant part. -- The discriminant *must* be in the Governed_By List Assoc := First (Governed_By); Find_Constraint : loop Discrim := First (Choices (Assoc)); exit Find_Constraint when Chars (Discrim_Name) = Chars (Discrim) or else (Present (Corresponding_Discriminant (Entity (Discrim))) and then Chars (Corresponding_Discriminant (Entity (Discrim))) = Chars (Discrim_Name)) or else Chars (Original_Record_Component (Entity (Discrim))) = Chars (Discrim_Name); if No (Next (Assoc)) then if not Is_Constrained (Typ) and then Is_Derived_Type (Typ) and then Present (Stored_Constraint (Typ)) then -- If the type is a tagged type with inherited discriminants, -- use the stored constraint on the parent in order to find -- the values of discriminants that are otherwise hidden by an -- explicit constraint. Renamed discriminants are handled in -- the code above. -- If several parent discriminants are renamed by a single -- discriminant of the derived type, the call to obtain the -- Corresponding_Discriminant field only retrieves the last -- of them. We recover the constraint on the others from the -- Stored_Constraint as well. declare D : Entity_Id; C : Elmt_Id; begin D := First_Discriminant (Etype (Typ)); C := First_Elmt (Stored_Constraint (Typ)); while Present (D) and then Present (C) loop if Chars (Discrim_Name) = Chars (D) then if Is_Entity_Name (Node (C)) and then Entity (Node (C)) = Entity (Discrim) then -- D is renamed by Discrim, whose value is -- given in Assoc. null; else Assoc := Make_Component_Association (Sloc (Typ), New_List (New_Occurrence_Of (D, Sloc (Typ))), Duplicate_Subexpr_No_Checks (Node (C))); end if; exit Find_Constraint; end if; D := Next_Discriminant (D); Next_Elmt (C); end loop; end; end if; end if; if No (Next (Assoc)) then Error_Msg_NE (" missing value for discriminant&", First (Governed_By), Discrim_Name); Report_Errors := True; return; end if; Next (Assoc); end loop Find_Constraint; Discrim_Value := Expression (Assoc); if not Is_OK_Static_Expression (Discrim_Value) then Error_Msg_FE ("value for discriminant & must be static!", Discrim_Value, Discrim); Why_Not_Static (Discrim_Value); Report_Errors := True; return; end if; Search_For_Discriminant_Value : declare Low : Node_Id; High : Node_Id; UI_High : Uint; UI_Low : Uint; UI_Discrim_Value : constant Uint := Expr_Value (Discrim_Value); begin Find_Discrete_Value : while Present (Variant) loop Discrete_Choice := First (Discrete_Choices (Variant)); while Present (Discrete_Choice) loop exit Find_Discrete_Value when Nkind (Discrete_Choice) = N_Others_Choice; Get_Index_Bounds (Discrete_Choice, Low, High); UI_Low := Expr_Value (Low); UI_High := Expr_Value (High); exit Find_Discrete_Value when UI_Low <= UI_Discrim_Value and then UI_High >= UI_Discrim_Value; Next (Discrete_Choice); end loop; Next_Non_Pragma (Variant); end loop Find_Discrete_Value; end Search_For_Discriminant_Value; if No (Variant) then Error_Msg_NE ("value of discriminant & is out of range", Discrim_Value, Discrim); Report_Errors := True; return; end if; -- If we have found the corresponding choice, recursively add its -- components to the Into list. Gather_Components (Empty, Component_List (Variant), Governed_By, Into, Report_Errors); end Gather_Components; ------------------------ -- Get_Actual_Subtype -- ------------------------ function Get_Actual_Subtype (N : Node_Id) return Entity_Id is Typ : constant Entity_Id := Etype (N); Utyp : Entity_Id := Underlying_Type (Typ); Decl : Node_Id; Atyp : Entity_Id; begin if No (Utyp) then Utyp := Typ; end if; -- If what we have is an identifier that references a subprogram -- formal, or a variable or constant object, then we get the actual -- subtype from the referenced entity if one has been built. if Nkind (N) = N_Identifier and then (Is_Formal (Entity (N)) or else Ekind (Entity (N)) = E_Constant or else Ekind (Entity (N)) = E_Variable) and then Present (Actual_Subtype (Entity (N))) then return Actual_Subtype (Entity (N)); -- Actual subtype of unchecked union is always itself. We never need -- the "real" actual subtype. If we did, we couldn't get it anyway -- because the discriminant is not available. The restrictions on -- Unchecked_Union are designed to make sure that this is OK. elsif Is_Unchecked_Union (Base_Type (Utyp)) then return Typ; -- Here for the unconstrained case, we must find actual subtype -- No actual subtype is available, so we must build it on the fly. -- Checking the type, not the underlying type, for constrainedness -- seems to be necessary. Maybe all the tests should be on the type??? elsif (not Is_Constrained (Typ)) and then (Is_Array_Type (Utyp) or else (Is_Record_Type (Utyp) and then Has_Discriminants (Utyp))) and then not Has_Unknown_Discriminants (Utyp) and then not (Ekind (Utyp) = E_String_Literal_Subtype) then -- Nothing to do if in default expression if In_Default_Expression then return Typ; elsif Is_Private_Type (Typ) and then not Has_Discriminants (Typ) then -- If the type has no discriminants, there is no subtype to -- build, even if the underlying type is discriminated. return Typ; -- Else build the actual subtype else Decl := Build_Actual_Subtype (Typ, N); Atyp := Defining_Identifier (Decl); -- If Build_Actual_Subtype generated a new declaration then use it if Atyp /= Typ then -- The actual subtype is an Itype, so analyze the declaration, -- but do not attach it to the tree, to get the type defined. Set_Parent (Decl, N); Set_Is_Itype (Atyp); Analyze (Decl, Suppress => All_Checks); Set_Associated_Node_For_Itype (Atyp, N); Set_Has_Delayed_Freeze (Atyp, False); -- We need to freeze the actual subtype immediately. This is -- needed, because otherwise this Itype will not get frozen -- at all, and it is always safe to freeze on creation because -- any associated types must be frozen at this point. Freeze_Itype (Atyp, N); return Atyp; -- Otherwise we did not build a declaration, so return original else return Typ; end if; end if; -- For all remaining cases, the actual subtype is the same as -- the nominal type. else return Typ; end if; end Get_Actual_Subtype; ------------------------------------- -- Get_Actual_Subtype_If_Available -- ------------------------------------- function Get_Actual_Subtype_If_Available (N : Node_Id) return Entity_Id is Typ : constant Entity_Id := Etype (N); begin -- If what we have is an identifier that references a subprogram -- formal, or a variable or constant object, then we get the actual -- subtype from the referenced entity if one has been built. if Nkind (N) = N_Identifier and then (Is_Formal (Entity (N)) or else Ekind (Entity (N)) = E_Constant or else Ekind (Entity (N)) = E_Variable) and then Present (Actual_Subtype (Entity (N))) then return Actual_Subtype (Entity (N)); -- Otherwise the Etype of N is returned unchanged else return Typ; end if; end Get_Actual_Subtype_If_Available; ------------------------------- -- Get_Default_External_Name -- ------------------------------- function Get_Default_External_Name (E : Node_Or_Entity_Id) return Node_Id is begin Get_Decoded_Name_String (Chars (E)); if Opt.External_Name_Imp_Casing = Uppercase then Set_Casing (All_Upper_Case); else Set_Casing (All_Lower_Case); end if; return Make_String_Literal (Sloc (E), Strval => String_From_Name_Buffer); end Get_Default_External_Name; --------------------------- -- Get_Enum_Lit_From_Pos -- --------------------------- function Get_Enum_Lit_From_Pos (T : Entity_Id; Pos : Uint; Loc : Source_Ptr) return Node_Id is Lit : Node_Id; begin -- In the case where the literal is of type Character, Wide_Character -- or Wide_Wide_Character or of a type derived from them, there needs -- to be some special handling since there is no explicit chain of -- literals to search. Instead, an N_Character_Literal node is created -- with the appropriate Char_Code and Chars fields. if Root_Type (T) = Standard_Character or else Root_Type (T) = Standard_Wide_Character or else Root_Type (T) = Standard_Wide_Wide_Character then Set_Character_Literal_Name (UI_To_CC (Pos)); return Make_Character_Literal (Loc, Chars => Name_Find, Char_Literal_Value => Pos); -- For all other cases, we have a complete table of literals, and -- we simply iterate through the chain of literal until the one -- with the desired position value is found. -- else Lit := First_Literal (Base_Type (T)); for J in 1 .. UI_To_Int (Pos) loop Next_Literal (Lit); end loop; return New_Occurrence_Of (Lit, Loc); end if; end Get_Enum_Lit_From_Pos; ------------------------ -- Get_Generic_Entity -- ------------------------ function Get_Generic_Entity (N : Node_Id) return Entity_Id is Ent : constant Entity_Id := Entity (Name (N)); begin if Present (Renamed_Object (Ent)) then return Renamed_Object (Ent); else return Ent; end if; end Get_Generic_Entity; ---------------------- -- Get_Index_Bounds -- ---------------------- procedure Get_Index_Bounds (N : Node_Id; L, H : out Node_Id) is Kind : constant Node_Kind := Nkind (N); R : Node_Id; begin if Kind = N_Range then L := Low_Bound (N); H := High_Bound (N); elsif Kind = N_Subtype_Indication then R := Range_Expression (Constraint (N)); if R = Error then L := Error; H := Error; return; else L := Low_Bound (Range_Expression (Constraint (N))); H := High_Bound (Range_Expression (Constraint (N))); end if; elsif Is_Entity_Name (N) and then Is_Type (Entity (N)) then if Error_Posted (Scalar_Range (Entity (N))) then L := Error; H := Error; elsif Nkind (Scalar_Range (Entity (N))) = N_Subtype_Indication then Get_Index_Bounds (Scalar_Range (Entity (N)), L, H); else L := Low_Bound (Scalar_Range (Entity (N))); H := High_Bound (Scalar_Range (Entity (N))); end if; else -- N is an expression, indicating a range with one value L := N; H := N; end if; end Get_Index_Bounds; ---------------------------------- -- Get_Library_Unit_Name_string -- ---------------------------------- procedure Get_Library_Unit_Name_String (Decl_Node : Node_Id) is Unit_Name_Id : constant Unit_Name_Type := Get_Unit_Name (Decl_Node); begin Get_Unit_Name_String (Unit_Name_Id); -- Remove seven last character (" (spec)" or " (body)") Name_Len := Name_Len - 7; pragma Assert (Name_Buffer (Name_Len + 1) = ' '); end Get_Library_Unit_Name_String; ------------------------ -- Get_Name_Entity_Id -- ------------------------ function Get_Name_Entity_Id (Id : Name_Id) return Entity_Id is begin return Entity_Id (Get_Name_Table_Info (Id)); end Get_Name_Entity_Id; --------------------------- -- Get_Referenced_Object -- --------------------------- function Get_Referenced_Object (N : Node_Id) return Node_Id is R : Node_Id := N; begin while Is_Entity_Name (R) and then Present (Renamed_Object (Entity (R))) loop R := Renamed_Object (Entity (R)); end loop; return R; end Get_Referenced_Object; ------------------------- -- Get_Subprogram_Body -- ------------------------- function Get_Subprogram_Body (E : Entity_Id) return Node_Id is Decl : Node_Id; begin Decl := Unit_Declaration_Node (E); if Nkind (Decl) = N_Subprogram_Body then return Decl; -- The below comment is bad, because it is possible for -- Nkind (Decl) to be an N_Subprogram_Body_Stub ??? else -- Nkind (Decl) = N_Subprogram_Declaration if Present (Corresponding_Body (Decl)) then return Unit_Declaration_Node (Corresponding_Body (Decl)); -- Imported subprogram case else return Empty; end if; end if; end Get_Subprogram_Body; ----------------------------- -- Get_Task_Body_Procedure -- ----------------------------- function Get_Task_Body_Procedure (E : Entity_Id) return Node_Id is begin -- Note: A task type may be the completion of a private type with -- discriminants. when performing elaboration checks on a task -- declaration, the current view of the type may be the private one, -- and the procedure that holds the body of the task is held in its -- underlying type. return Task_Body_Procedure (Underlying_Type (Root_Type (E))); end Get_Task_Body_Procedure; ----------------------- -- Has_Access_Values -- ----------------------- function Has_Access_Values (T : Entity_Id) return Boolean is Typ : constant Entity_Id := Underlying_Type (T); begin -- Case of a private type which is not completed yet. This can only -- happen in the case of a generic format type appearing directly, or -- as a component of the type to which this function is being applied -- at the top level. Return False in this case, since we certainly do -- not know that the type contains access types. if No (Typ) then return False; elsif Is_Access_Type (Typ) then return True; elsif Is_Array_Type (Typ) then return Has_Access_Values (Component_Type (Typ)); elsif Is_Record_Type (Typ) then declare Comp : Entity_Id; begin Comp := First_Entity (Typ); while Present (Comp) loop if (Ekind (Comp) = E_Component or else Ekind (Comp) = E_Discriminant) and then Has_Access_Values (Etype (Comp)) then return True; end if; Next_Entity (Comp); end loop; end; return False; else return False; end if; end Has_Access_Values; ---------------------- -- Has_Declarations -- ---------------------- function Has_Declarations (N : Node_Id) return Boolean is K : constant Node_Kind := Nkind (N); begin return K = N_Accept_Statement or else K = N_Block_Statement or else K = N_Compilation_Unit_Aux or else K = N_Entry_Body or else K = N_Package_Body or else K = N_Protected_Body or else K = N_Subprogram_Body or else K = N_Task_Body or else K = N_Package_Specification; end Has_Declarations; ------------------------------------------- -- Has_Discriminant_Dependent_Constraint -- ------------------------------------------- function Has_Discriminant_Dependent_Constraint (Comp : Entity_Id) return Boolean is Comp_Decl : constant Node_Id := Parent (Comp); Subt_Indic : constant Node_Id := Subtype_Indication (Component_Definition (Comp_Decl)); Constr : Node_Id; Assn : Node_Id; begin if Nkind (Subt_Indic) = N_Subtype_Indication then Constr := Constraint (Subt_Indic); if Nkind (Constr) = N_Index_Or_Discriminant_Constraint then Assn := First (Constraints (Constr)); while Present (Assn) loop case Nkind (Assn) is when N_Subtype_Indication | N_Range | N_Identifier => if Depends_On_Discriminant (Assn) then return True; end if; when N_Discriminant_Association => if Depends_On_Discriminant (Expression (Assn)) then return True; end if; when others => null; end case; Next (Assn); end loop; end if; end if; return False; end Has_Discriminant_Dependent_Constraint; -------------------- -- Has_Infinities -- -------------------- function Has_Infinities (E : Entity_Id) return Boolean is begin return Is_Floating_Point_Type (E) and then Nkind (Scalar_Range (E)) = N_Range and then Includes_Infinities (Scalar_Range (E)); end Has_Infinities; ------------------------ -- Has_Null_Extension -- ------------------------ function Has_Null_Extension (T : Entity_Id) return Boolean is B : constant Entity_Id := Base_Type (T); Comps : Node_Id; Ext : Node_Id; begin if Nkind (Parent (B)) = N_Full_Type_Declaration and then Present (Record_Extension_Part (Type_Definition (Parent (B)))) then Ext := Record_Extension_Part (Type_Definition (Parent (B))); if Present (Ext) then if Null_Present (Ext) then return True; else Comps := Component_List (Ext); -- The null component list is rewritten during analysis to -- include the parent component. Any other component indicates -- that the extension was not originally null. return Null_Present (Comps) or else No (Next (First (Component_Items (Comps)))); end if; else return False; end if; else return False; end if; end Has_Null_Extension; --------------------------- -- Has_Private_Component -- --------------------------- function Has_Private_Component (Type_Id : Entity_Id) return Boolean is Btype : Entity_Id := Base_Type (Type_Id); Component : Entity_Id; begin if Error_Posted (Type_Id) or else Error_Posted (Btype) then return False; end if; if Is_Class_Wide_Type (Btype) then Btype := Root_Type (Btype); end if; if Is_Private_Type (Btype) then declare UT : constant Entity_Id := Underlying_Type (Btype); begin if No (UT) then if No (Full_View (Btype)) then return not Is_Generic_Type (Btype) and then not Is_Generic_Type (Root_Type (Btype)); else return not Is_Generic_Type (Root_Type (Full_View (Btype))); end if; else return not Is_Frozen (UT) and then Has_Private_Component (UT); end if; end; elsif Is_Array_Type (Btype) then return Has_Private_Component (Component_Type (Btype)); elsif Is_Record_Type (Btype) then Component := First_Component (Btype); while Present (Component) loop if Has_Private_Component (Etype (Component)) then return True; end if; Next_Component (Component); end loop; return False; elsif Is_Protected_Type (Btype) and then Present (Corresponding_Record_Type (Btype)) then return Has_Private_Component (Corresponding_Record_Type (Btype)); else return False; end if; end Has_Private_Component; ---------------- -- Has_Stream -- ---------------- function Has_Stream (T : Entity_Id) return Boolean is E : Entity_Id; begin if No (T) then return False; elsif Is_RTE (Root_Type (T), RE_Root_Stream_Type) then return True; elsif Is_Array_Type (T) then return Has_Stream (Component_Type (T)); elsif Is_Record_Type (T) then E := First_Component (T); while Present (E) loop if Has_Stream (Etype (E)) then return True; else Next_Component (E); end if; end loop; return False; elsif Is_Private_Type (T) then return Has_Stream (Underlying_Type (T)); else return False; end if; end Has_Stream; -------------------------- -- Has_Tagged_Component -- -------------------------- function Has_Tagged_Component (Typ : Entity_Id) return Boolean is Comp : Entity_Id; begin if Is_Private_Type (Typ) and then Present (Underlying_Type (Typ)) then return Has_Tagged_Component (Underlying_Type (Typ)); elsif Is_Array_Type (Typ) then return Has_Tagged_Component (Component_Type (Typ)); elsif Is_Tagged_Type (Typ) then return True; elsif Is_Record_Type (Typ) then Comp := First_Component (Typ); while Present (Comp) loop if Has_Tagged_Component (Etype (Comp)) then return True; end if; Comp := Next_Component (Typ); end loop; return False; else return False; end if; end Has_Tagged_Component; ----------------- -- In_Instance -- ----------------- function In_Instance return Boolean is S : Entity_Id := Current_Scope; begin while Present (S) and then S /= Standard_Standard loop if (Ekind (S) = E_Function or else Ekind (S) = E_Package or else Ekind (S) = E_Procedure) and then Is_Generic_Instance (S) then return True; end if; S := Scope (S); end loop; return False; end In_Instance; ---------------------- -- In_Instance_Body -- ---------------------- function In_Instance_Body return Boolean is S : Entity_Id := Current_Scope; begin while Present (S) and then S /= Standard_Standard loop if (Ekind (S) = E_Function or else Ekind (S) = E_Procedure) and then Is_Generic_Instance (S) then return True; elsif Ekind (S) = E_Package and then In_Package_Body (S) and then Is_Generic_Instance (S) then return True; end if; S := Scope (S); end loop; return False; end In_Instance_Body; ----------------------------- -- In_Instance_Not_Visible -- ----------------------------- function In_Instance_Not_Visible return Boolean is S : Entity_Id := Current_Scope; begin while Present (S) and then S /= Standard_Standard loop if (Ekind (S) = E_Function or else Ekind (S) = E_Procedure) and then Is_Generic_Instance (S) then return True; elsif Ekind (S) = E_Package and then (In_Package_Body (S) or else In_Private_Part (S)) and then Is_Generic_Instance (S) then return True; end if; S := Scope (S); end loop; return False; end In_Instance_Not_Visible; ------------------------------ -- In_Instance_Visible_Part -- ------------------------------ function In_Instance_Visible_Part return Boolean is S : Entity_Id := Current_Scope; begin while Present (S) and then S /= Standard_Standard loop if Ekind (S) = E_Package and then Is_Generic_Instance (S) and then not In_Package_Body (S) and then not In_Private_Part (S) then return True; end if; S := Scope (S); end loop; return False; end In_Instance_Visible_Part; ---------------------- -- In_Packiage_Body -- ---------------------- function In_Package_Body return Boolean is S : Entity_Id := Current_Scope; begin while Present (S) and then S /= Standard_Standard loop if Ekind (S) = E_Package and then In_Package_Body (S) then return True; else S := Scope (S); end if; end loop; return False; end In_Package_Body; -------------------------------------- -- In_Subprogram_Or_Concurrent_Unit -- -------------------------------------- function In_Subprogram_Or_Concurrent_Unit return Boolean is E : Entity_Id; K : Entity_Kind; begin -- Use scope chain to check successively outer scopes E := Current_Scope; loop K := Ekind (E); if K in Subprogram_Kind or else K in Concurrent_Kind or else K in Generic_Subprogram_Kind then return True; elsif E = Standard_Standard then return False; end if; E := Scope (E); end loop; end In_Subprogram_Or_Concurrent_Unit; --------------------- -- In_Visible_Part -- --------------------- function In_Visible_Part (Scope_Id : Entity_Id) return Boolean is begin return Is_Package_Or_Generic_Package (Scope_Id) and then In_Open_Scopes (Scope_Id) and then not In_Package_Body (Scope_Id) and then not In_Private_Part (Scope_Id); end In_Visible_Part; --------------------------------- -- Insert_Explicit_Dereference -- --------------------------------- procedure Insert_Explicit_Dereference (N : Node_Id) is New_Prefix : constant Node_Id := Relocate_Node (N); Ent : Entity_Id := Empty; Pref : Node_Id; I : Interp_Index; It : Interp; T : Entity_Id; begin Save_Interps (N, New_Prefix); Rewrite (N, Make_Explicit_Dereference (Sloc (N), Prefix => New_Prefix)); Set_Etype (N, Designated_Type (Etype (New_Prefix))); if Is_Overloaded (New_Prefix) then -- The deference is also overloaded, and its interpretations are the -- designated types of the interpretations of the original node. Set_Etype (N, Any_Type); Get_First_Interp (New_Prefix, I, It); while Present (It.Nam) loop T := It.Typ; if Is_Access_Type (T) then Add_One_Interp (N, Designated_Type (T), Designated_Type (T)); end if; Get_Next_Interp (I, It); end loop; End_Interp_List; else -- Prefix is unambiguous: mark the original prefix (which might -- Come_From_Source) as a reference, since the new (relocated) one -- won't be taken into account. if Is_Entity_Name (New_Prefix) then Ent := Entity (New_Prefix); -- For a retrieval of a subcomponent of some composite object, -- retrieve the ultimate entity if there is one. elsif Nkind (New_Prefix) = N_Selected_Component or else Nkind (New_Prefix) = N_Indexed_Component then Pref := Prefix (New_Prefix); while Present (Pref) and then (Nkind (Pref) = N_Selected_Component or else Nkind (Pref) = N_Indexed_Component) loop Pref := Prefix (Pref); end loop; if Present (Pref) and then Is_Entity_Name (Pref) then Ent := Entity (Pref); end if; end if; if Present (Ent) then Generate_Reference (Ent, New_Prefix); end if; end if; end Insert_Explicit_Dereference; ------------------- -- Is_AAMP_Float -- ------------------- function Is_AAMP_Float (E : Entity_Id) return Boolean is begin pragma Assert (Is_Type (E)); return AAMP_On_Target and then Is_Floating_Point_Type (E) and then E = Base_Type (E); end Is_AAMP_Float; ------------------------- -- Is_Actual_Parameter -- ------------------------- function Is_Actual_Parameter (N : Node_Id) return Boolean is PK : constant Node_Kind := Nkind (Parent (N)); begin case PK is when N_Parameter_Association => return N = Explicit_Actual_Parameter (Parent (N)); when N_Function_Call | N_Procedure_Call_Statement => return Is_List_Member (N) and then List_Containing (N) = Parameter_Associations (Parent (N)); when others => return False; end case; end Is_Actual_Parameter; --------------------- -- Is_Aliased_View -- --------------------- function Is_Aliased_View (Obj : Node_Id) return Boolean is E : Entity_Id; begin if Is_Entity_Name (Obj) then E := Entity (Obj); return (Is_Object (E) and then (Is_Aliased (E) or else (Present (Renamed_Object (E)) and then Is_Aliased_View (Renamed_Object (E))))) or else ((Is_Formal (E) or else Ekind (E) = E_Generic_In_Out_Parameter or else Ekind (E) = E_Generic_In_Parameter) and then Is_Tagged_Type (Etype (E))) or else ((Ekind (E) = E_Task_Type or else Ekind (E) = E_Protected_Type) and then In_Open_Scopes (E)) -- Current instance of type or else (Is_Type (E) and then E = Current_Scope) or else (Is_Incomplete_Or_Private_Type (E) and then Full_View (E) = Current_Scope); elsif Nkind (Obj) = N_Selected_Component then return Is_Aliased (Entity (Selector_Name (Obj))); elsif Nkind (Obj) = N_Indexed_Component then return Has_Aliased_Components (Etype (Prefix (Obj))) or else (Is_Access_Type (Etype (Prefix (Obj))) and then Has_Aliased_Components (Designated_Type (Etype (Prefix (Obj))))); elsif Nkind (Obj) = N_Unchecked_Type_Conversion or else Nkind (Obj) = N_Type_Conversion then return Is_Tagged_Type (Etype (Obj)) and then Is_Aliased_View (Expression (Obj)); elsif Nkind (Obj) = N_Explicit_Dereference then return Nkind (Original_Node (Obj)) /= N_Function_Call; else return False; end if; end Is_Aliased_View; ------------------------- -- Is_Ancestor_Package -- ------------------------- function Is_Ancestor_Package (E1 : Entity_Id; E2 : Entity_Id) return Boolean is Par : Entity_Id; begin Par := E2; while Present (Par) and then Par /= Standard_Standard loop if Par = E1 then return True; end if; Par := Scope (Par); end loop; return False; end Is_Ancestor_Package; ---------------------- -- Is_Atomic_Object -- ---------------------- function Is_Atomic_Object (N : Node_Id) return Boolean is function Object_Has_Atomic_Components (N : Node_Id) return Boolean; -- Determines if given object has atomic components function Is_Atomic_Prefix (N : Node_Id) return Boolean; -- If prefix is an implicit dereference, examine designated type function Is_Atomic_Prefix (N : Node_Id) return Boolean is begin if Is_Access_Type (Etype (N)) then return Has_Atomic_Components (Designated_Type (Etype (N))); else return Object_Has_Atomic_Components (N); end if; end Is_Atomic_Prefix; function Object_Has_Atomic_Components (N : Node_Id) return Boolean is begin if Has_Atomic_Components (Etype (N)) or else Is_Atomic (Etype (N)) then return True; elsif Is_Entity_Name (N) and then (Has_Atomic_Components (Entity (N)) or else Is_Atomic (Entity (N))) then return True; elsif Nkind (N) = N_Indexed_Component or else Nkind (N) = N_Selected_Component then return Is_Atomic_Prefix (Prefix (N)); else return False; end if; end Object_Has_Atomic_Components; -- Start of processing for Is_Atomic_Object begin if Is_Atomic (Etype (N)) or else (Is_Entity_Name (N) and then Is_Atomic (Entity (N))) then return True; elsif Nkind (N) = N_Indexed_Component or else Nkind (N) = N_Selected_Component then return Is_Atomic_Prefix (Prefix (N)); else return False; end if; end Is_Atomic_Object; -------------------------------------- -- Is_Controlling_Limited_Procedure -- -------------------------------------- function Is_Controlling_Limited_Procedure (Proc_Nam : Entity_Id) return Boolean is Param_Typ : Entity_Id := Empty; begin if Ekind (Proc_Nam) = E_Procedure and then Present (Parameter_Specifications (Parent (Proc_Nam))) then Param_Typ := Etype (Parameter_Type (First ( Parameter_Specifications (Parent (Proc_Nam))))); -- In this case where an Itype was created, the procedure call has been -- rewritten. elsif Present (Associated_Node_For_Itype (Proc_Nam)) and then Present (Original_Node (Associated_Node_For_Itype (Proc_Nam))) and then Present (Parameter_Associations (Associated_Node_For_Itype (Proc_Nam))) then Param_Typ := Etype (First (Parameter_Associations (Associated_Node_For_Itype (Proc_Nam)))); end if; if Present (Param_Typ) then return Is_Interface (Param_Typ) and then Is_Limited_Record (Param_Typ); end if; return False; end Is_Controlling_Limited_Procedure; ---------------------------------------------- -- Is_Dependent_Component_Of_Mutable_Object -- ---------------------------------------------- function Is_Dependent_Component_Of_Mutable_Object (Object : Node_Id) return Boolean is P : Node_Id; Prefix_Type : Entity_Id; P_Aliased : Boolean := False; Comp : Entity_Id; function Is_Declared_Within_Variant (Comp : Entity_Id) return Boolean; -- Returns True if and only if Comp is declared within a variant part -------------------------------- -- Is_Declared_Within_Variant -- -------------------------------- function Is_Declared_Within_Variant (Comp : Entity_Id) return Boolean is Comp_Decl : constant Node_Id := Parent (Comp); Comp_List : constant Node_Id := Parent (Comp_Decl); begin return Nkind (Parent (Comp_List)) = N_Variant; end Is_Declared_Within_Variant; -- Start of processing for Is_Dependent_Component_Of_Mutable_Object begin if Is_Variable (Object) then if Nkind (Object) = N_Selected_Component then P := Prefix (Object); Prefix_Type := Etype (P); if Is_Entity_Name (P) then if Ekind (Entity (P)) = E_Generic_In_Out_Parameter then Prefix_Type := Base_Type (Prefix_Type); end if; if Is_Aliased (Entity (P)) then P_Aliased := True; end if; -- A discriminant check on a selected component may be -- expanded into a dereference when removing side-effects. -- Recover the original node and its type, which may be -- unconstrained. elsif Nkind (P) = N_Explicit_Dereference and then not (Comes_From_Source (P)) then P := Original_Node (P); Prefix_Type := Etype (P); else -- Check for prefix being an aliased component ??? null; end if; -- A heap object is constrained by its initial value -- Ada 2005 AI-363:if the designated type is a type with a -- constrained partial view, the resulting heap object is not -- constrained, and a renaming of the component is now unsafe. if Is_Access_Type (Prefix_Type) and then not Has_Constrained_Partial_View (Designated_Type (Prefix_Type)) then return False; elsif Nkind (P) = N_Explicit_Dereference and then not Has_Constrained_Partial_View (Prefix_Type) then return False; end if; Comp := Original_Record_Component (Entity (Selector_Name (Object))); -- As per AI-0017, the renaming is illegal in a generic body, -- even if the subtype is indefinite. if not Is_Constrained (Prefix_Type) and then (not Is_Indefinite_Subtype (Prefix_Type) or else (Is_Generic_Type (Prefix_Type) and then Ekind (Current_Scope) = E_Generic_Package and then In_Package_Body (Current_Scope))) and then (Is_Declared_Within_Variant (Comp) or else Has_Discriminant_Dependent_Constraint (Comp)) and then not P_Aliased then return True; else return Is_Dependent_Component_Of_Mutable_Object (Prefix (Object)); end if; elsif Nkind (Object) = N_Indexed_Component or else Nkind (Object) = N_Slice then return Is_Dependent_Component_Of_Mutable_Object (Prefix (Object)); -- A type conversion that Is_Variable is a view conversion: -- go back to the denoted object. elsif Nkind (Object) = N_Type_Conversion then return Is_Dependent_Component_Of_Mutable_Object (Expression (Object)); end if; end if; return False; end Is_Dependent_Component_Of_Mutable_Object; --------------------- -- Is_Dereferenced -- --------------------- function Is_Dereferenced (N : Node_Id) return Boolean is P : constant Node_Id := Parent (N); begin return (Nkind (P) = N_Selected_Component or else Nkind (P) = N_Explicit_Dereference or else Nkind (P) = N_Indexed_Component or else Nkind (P) = N_Slice) and then Prefix (P) = N; end Is_Dereferenced; ---------------------- -- Is_Descendent_Of -- ---------------------- function Is_Descendent_Of (T1 : Entity_Id; T2 : Entity_Id) return Boolean is T : Entity_Id; Etyp : Entity_Id; begin pragma Assert (Nkind (T1) in N_Entity); pragma Assert (Nkind (T2) in N_Entity); T := Base_Type (T1); -- Immediate return if the types match if T = T2 then return True; -- Comment needed here ??? elsif Ekind (T) = E_Class_Wide_Type then return Etype (T) = T2; -- All other cases else loop Etyp := Etype (T); -- Done if we found the type we are looking for if Etyp = T2 then return True; -- Done if no more derivations to check elsif T = T1 or else T = Etyp then return False; -- Following test catches error cases resulting from prev errors elsif No (Etyp) then return False; elsif Is_Private_Type (T) and then Etyp = Full_View (T) then return False; elsif Is_Private_Type (Etyp) and then Full_View (Etyp) = T then return False; end if; T := Base_Type (Etyp); end loop; end if; -- LLVM local deleted unreachable line end Is_Descendent_Of; ------------------------------ -- Is_Descendent_Of_Address -- ------------------------------ function Is_Descendent_Of_Address (T1 : Entity_Id) return Boolean is begin -- If Address has not been loaded, answer must be False if not RTU_Loaded (System) then return False; -- Otherwise we can get the entity we are interested in without -- causing an unwanted dependency on System, and do the test. else return Is_Descendent_Of (T1, Base_Type (RTE (RE_Address))); end if; end Is_Descendent_Of_Address; -------------- -- Is_False -- -------------- function Is_False (U : Uint) return Boolean is begin return (U = 0); end Is_False; --------------------------- -- Is_Fixed_Model_Number -- --------------------------- function Is_Fixed_Model_Number (U : Ureal; T : Entity_Id) return Boolean is S : constant Ureal := Small_Value (T); M : Urealp.Save_Mark; R : Boolean; begin M := Urealp.Mark; R := (U = UR_Trunc (U / S) * S); Urealp.Release (M); return R; end Is_Fixed_Model_Number; ------------------------------- -- Is_Fully_Initialized_Type -- ------------------------------- function Is_Fully_Initialized_Type (Typ : Entity_Id) return Boolean is begin if Is_Scalar_Type (Typ) then return False; elsif Is_Access_Type (Typ) then return True; elsif Is_Array_Type (Typ) then if Is_Fully_Initialized_Type (Component_Type (Typ)) then return True; end if; -- An interesting case, if we have a constrained type one of whose -- bounds is known to be null, then there are no elements to be -- initialized, so all the elements are initialized! if Is_Constrained (Typ) then declare Indx : Node_Id; Indx_Typ : Entity_Id; Lbd, Hbd : Node_Id; begin Indx := First_Index (Typ); while Present (Indx) loop if Etype (Indx) = Any_Type then return False; -- If index is a range, use directly elsif Nkind (Indx) = N_Range then Lbd := Low_Bound (Indx); Hbd := High_Bound (Indx); else Indx_Typ := Etype (Indx); if Is_Private_Type (Indx_Typ) then Indx_Typ := Full_View (Indx_Typ); end if; if No (Indx_Typ) then return False; else Lbd := Type_Low_Bound (Indx_Typ); Hbd := Type_High_Bound (Indx_Typ); end if; end if; if Compile_Time_Known_Value (Lbd) and then Compile_Time_Known_Value (Hbd) then if Expr_Value (Hbd) < Expr_Value (Lbd) then return True; end if; end if; Next_Index (Indx); end loop; end; end if; -- If no null indexes, then type is not fully initialized return False; -- Record types elsif Is_Record_Type (Typ) then if Has_Discriminants (Typ) and then Present (Discriminant_Default_Value (First_Discriminant (Typ))) and then Is_Fully_Initialized_Variant (Typ) then return True; end if; -- Controlled records are considered to be fully initialized if -- there is a user defined Initialize routine. This may not be -- entirely correct, but as the spec notes, we are guessing here -- what is best from the point of view of issuing warnings. if Is_Controlled (Typ) then declare Utyp : constant Entity_Id := Underlying_Type (Typ); begin if Present (Utyp) then declare Init : constant Entity_Id := (Find_Prim_Op (Underlying_Type (Typ), Name_Initialize)); begin if Present (Init) and then Comes_From_Source (Init) and then not Is_Predefined_File_Name (File_Name (Get_Source_File_Index (Sloc (Init)))) then return True; elsif Has_Null_Extension (Typ) and then Is_Fully_Initialized_Type (Etype (Base_Type (Typ))) then return True; end if; end; end if; end; end if; -- Otherwise see if all record components are initialized declare Ent : Entity_Id; begin Ent := First_Entity (Typ); while Present (Ent) loop if Chars (Ent) = Name_uController then null; elsif Ekind (Ent) = E_Component and then (No (Parent (Ent)) or else No (Expression (Parent (Ent)))) and then not Is_Fully_Initialized_Type (Etype (Ent)) then return False; end if; Next_Entity (Ent); end loop; end; -- No uninitialized components, so type is fully initialized. -- Note that this catches the case of no components as well. return True; elsif Is_Concurrent_Type (Typ) then return True; elsif Is_Private_Type (Typ) then declare U : constant Entity_Id := Underlying_Type (Typ); begin if No (U) then return False; else return Is_Fully_Initialized_Type (U); end if; end; else return False; end if; end Is_Fully_Initialized_Type; ---------------------------------- -- Is_Fully_Initialized_Variant -- ---------------------------------- function Is_Fully_Initialized_Variant (Typ : Entity_Id) return Boolean is Loc : constant Source_Ptr := Sloc (Typ); Constraints : constant List_Id := New_List; Components : constant Elist_Id := New_Elmt_List; Comp_Elmt : Elmt_Id; Comp_Id : Node_Id; Comp_List : Node_Id; Discr : Entity_Id; Discr_Val : Node_Id; Report_Errors : Boolean; begin if Serious_Errors_Detected > 0 then return False; end if; if Is_Record_Type (Typ) and then Nkind (Parent (Typ)) = N_Full_Type_Declaration and then Nkind (Type_Definition (Parent (Typ))) = N_Record_Definition then Comp_List := Component_List (Type_Definition (Parent (Typ))); Discr := First_Discriminant (Typ); while Present (Discr) loop if Nkind (Parent (Discr)) = N_Discriminant_Specification then Discr_Val := Expression (Parent (Discr)); if Present (Discr_Val) and then Is_OK_Static_Expression (Discr_Val) then Append_To (Constraints, Make_Component_Association (Loc, Choices => New_List (New_Occurrence_Of (Discr, Loc)), Expression => New_Copy (Discr_Val))); else return False; end if; else return False; end if; Next_Discriminant (Discr); end loop; Gather_Components (Typ => Typ, Comp_List => Comp_List, Governed_By => Constraints, Into => Components, Report_Errors => Report_Errors); -- Check that each component present is fully initialized Comp_Elmt := First_Elmt (Components); while Present (Comp_Elmt) loop Comp_Id := Node (Comp_Elmt); if Ekind (Comp_Id) = E_Component and then (No (Parent (Comp_Id)) or else No (Expression (Parent (Comp_Id)))) and then not Is_Fully_Initialized_Type (Etype (Comp_Id)) then return False; end if; Next_Elmt (Comp_Elmt); end loop; return True; elsif Is_Private_Type (Typ) then declare U : constant Entity_Id := Underlying_Type (Typ); begin if No (U) then return False; else return Is_Fully_Initialized_Variant (U); end if; end; else return False; end if; end Is_Fully_Initialized_Variant; ---------------------------- -- Is_Inherited_Operation -- ---------------------------- function Is_Inherited_Operation (E : Entity_Id) return Boolean is Kind : constant Node_Kind := Nkind (Parent (E)); begin pragma Assert (Is_Overloadable (E)); return Kind = N_Full_Type_Declaration or else Kind = N_Private_Extension_Declaration or else Kind = N_Subtype_Declaration or else (Ekind (E) = E_Enumeration_Literal and then Is_Derived_Type (Etype (E))); end Is_Inherited_Operation; ----------------------------- -- Is_Library_Level_Entity -- ----------------------------- function Is_Library_Level_Entity (E : Entity_Id) return Boolean is begin -- The following is a small optimization, and it also handles -- properly discriminals, which in task bodies might appear in -- expressions before the corresponding procedure has been -- created, and which therefore do not have an assigned scope. if Ekind (E) in Formal_Kind then return False; end if; -- Normal test is simply that the enclosing dynamic scope is Standard return Enclosing_Dynamic_Scope (E) = Standard_Standard; end Is_Library_Level_Entity; --------------------------------- -- Is_Local_Variable_Reference -- --------------------------------- function Is_Local_Variable_Reference (Expr : Node_Id) return Boolean is begin if not Is_Entity_Name (Expr) then return False; else declare Ent : constant Entity_Id := Entity (Expr); Sub : constant Entity_Id := Enclosing_Subprogram (Ent); begin if Ekind (Ent) /= E_Variable and then Ekind (Ent) /= E_In_Out_Parameter then return False; else return Present (Sub) and then Sub = Current_Subprogram; end if; end; end if; end Is_Local_Variable_Reference; --------------- -- Is_Lvalue -- --------------- function Is_Lvalue (N : Node_Id) return Boolean is P : constant Node_Id := Parent (N); begin case Nkind (P) is -- Test left side of assignment when N_Assignment_Statement => return N = Name (P); -- Test prefix of component or attribute when N_Attribute_Reference | N_Expanded_Name | N_Explicit_Dereference | N_Indexed_Component | N_Reference | N_Selected_Component | N_Slice => return N = Prefix (P); -- Test subprogram parameter (we really should check the -- parameter mode, but it is not worth the trouble) when N_Function_Call | N_Procedure_Call_Statement | N_Accept_Statement | N_Parameter_Association => return True; -- Test for appearing in a conversion that itself appears -- in an lvalue context, since this should be an lvalue. when N_Type_Conversion => return Is_Lvalue (P); -- Test for appearence in object renaming declaration when N_Object_Renaming_Declaration => return True; -- All other references are definitely not Lvalues when others => return False; end case; end Is_Lvalue; ------------------------- -- Is_Object_Reference -- ------------------------- function Is_Object_Reference (N : Node_Id) return Boolean is begin if Is_Entity_Name (N) then return Is_Object (Entity (N)); else case Nkind (N) is when N_Indexed_Component | N_Slice => return Is_Object_Reference (Prefix (N)) or else Is_Access_Type (Etype (Prefix (N))); -- In Ada95, a function call is a constant object; a procedure -- call is not. when N_Function_Call => return Etype (N) /= Standard_Void_Type; -- A reference to the stream attribute Input is a function call when N_Attribute_Reference => return Attribute_Name (N) = Name_Input; when N_Selected_Component => return Is_Object_Reference (Selector_Name (N)) and then (Is_Object_Reference (Prefix (N)) or else Is_Access_Type (Etype (Prefix (N)))); when N_Explicit_Dereference => return True; -- A view conversion of a tagged object is an object reference when N_Type_Conversion => return Is_Tagged_Type (Etype (Subtype_Mark (N))) and then Is_Tagged_Type (Etype (Expression (N))) and then Is_Object_Reference (Expression (N)); -- An unchecked type conversion is considered to be an object if -- the operand is an object (this construction arises only as a -- result of expansion activities). when N_Unchecked_Type_Conversion => return True; when others => return False; end case; end if; end Is_Object_Reference; ----------------------------------- -- Is_OK_Variable_For_Out_Formal -- ----------------------------------- function Is_OK_Variable_For_Out_Formal (AV : Node_Id) return Boolean is begin Note_Possible_Modification (AV); -- We must reject parenthesized variable names. The check for -- Comes_From_Source is present because there are currently -- cases where the compiler violates this rule (e.g. passing -- a task object to its controlled Initialize routine). if Paren_Count (AV) > 0 and then Comes_From_Source (AV) then return False; -- A variable is always allowed elsif Is_Variable (AV) then return True; -- Unchecked conversions are allowed only if they come from the -- generated code, which sometimes uses unchecked conversions for out -- parameters in cases where code generation is unaffected. We tell -- source unchecked conversions by seeing if they are rewrites of an -- original Unchecked_Conversion function call, or of an explicit -- conversion of a function call. elsif Nkind (AV) = N_Unchecked_Type_Conversion then if Nkind (Original_Node (AV)) = N_Function_Call then return False; elsif Comes_From_Source (AV) and then Nkind (Original_Node (Expression (AV))) = N_Function_Call then return False; elsif Nkind (Original_Node (AV)) = N_Type_Conversion then return Is_OK_Variable_For_Out_Formal (Expression (AV)); else return True; end if; -- Normal type conversions are allowed if argument is a variable elsif Nkind (AV) = N_Type_Conversion then if Is_Variable (Expression (AV)) and then Paren_Count (Expression (AV)) = 0 then Note_Possible_Modification (Expression (AV)); return True; -- We also allow a non-parenthesized expression that raises -- constraint error if it rewrites what used to be a variable elsif Raises_Constraint_Error (Expression (AV)) and then Paren_Count (Expression (AV)) = 0 and then Is_Variable (Original_Node (Expression (AV))) then return True; -- Type conversion of something other than a variable else return False; end if; -- If this node is rewritten, then test the original form, if that is -- OK, then we consider the rewritten node OK (for example, if the -- original node is a conversion, then Is_Variable will not be true -- but we still want to allow the conversion if it converts a variable). elsif Original_Node (AV) /= AV then return Is_OK_Variable_For_Out_Formal (Original_Node (AV)); -- All other non-variables are rejected else return False; end if; end Is_OK_Variable_For_Out_Formal; ----------------------------------- -- Is_Partially_Initialized_Type -- ----------------------------------- function Is_Partially_Initialized_Type (Typ : Entity_Id) return Boolean is begin if Is_Scalar_Type (Typ) then return False; elsif Is_Access_Type (Typ) then return True; elsif Is_Array_Type (Typ) then -- If component type is partially initialized, so is array type if Is_Partially_Initialized_Type (Component_Type (Typ)) then return True; -- Otherwise we are only partially initialized if we are fully -- initialized (this is the empty array case, no point in us -- duplicating that code here). else return Is_Fully_Initialized_Type (Typ); end if; elsif Is_Record_Type (Typ) then -- A discriminated type is always partially initialized if Has_Discriminants (Typ) then return True; -- A tagged type is always partially initialized elsif Is_Tagged_Type (Typ) then return True; -- Case of non-discriminated record else declare Ent : Entity_Id; Component_Present : Boolean := False; -- Set True if at least one component is present. If no -- components are present, then record type is fully -- initialized (another odd case, like the null array). begin -- Loop through components Ent := First_Entity (Typ); while Present (Ent) loop if Ekind (Ent) = E_Component then Component_Present := True; -- If a component has an initialization expression then -- the enclosing record type is partially initialized if Present (Parent (Ent)) and then Present (Expression (Parent (Ent))) then return True; -- If a component is of a type which is itself partially -- initialized, then the enclosing record type is also. elsif Is_Partially_Initialized_Type (Etype (Ent)) then return True; end if; end if; Next_Entity (Ent); end loop; -- No initialized components found. If we found any components -- they were all uninitialized so the result is false. if Component_Present then return False; -- But if we found no components, then all the components are -- initialized so we consider the type to be initialized. else return True; end if; end; end if; -- Concurrent types are always fully initialized elsif Is_Concurrent_Type (Typ) then return True; -- For a private type, go to underlying type. If there is no underlying -- type then just assume this partially initialized. Not clear if this -- can happen in a non-error case, but no harm in testing for this. elsif Is_Private_Type (Typ) then declare U : constant Entity_Id := Underlying_Type (Typ); begin if No (U) then return True; else return Is_Partially_Initialized_Type (U); end if; end; -- For any other type (are there any?) assume partially initialized else return True; end if; end Is_Partially_Initialized_Type; ------------------------------------ -- Is_Potentially_Persistent_Type -- ------------------------------------ function Is_Potentially_Persistent_Type (T : Entity_Id) return Boolean is Comp : Entity_Id; Indx : Node_Id; begin -- For private type, test corrresponding full type if Is_Private_Type (T) then return Is_Potentially_Persistent_Type (Full_View (T)); -- Scalar types are potentially persistent elsif Is_Scalar_Type (T) then return True; -- Record type is potentially persistent if not tagged and the types of -- all it components are potentially persistent, and no component has -- an initialization expression. elsif Is_Record_Type (T) and then not Is_Tagged_Type (T) and then not Is_Partially_Initialized_Type (T) then Comp := First_Component (T); while Present (Comp) loop if not Is_Potentially_Persistent_Type (Etype (Comp)) then return False; else Next_Entity (Comp); end if; end loop; return True; -- Array type is potentially persistent if its component type is -- potentially persistent and if all its constraints are static. elsif Is_Array_Type (T) then if not Is_Potentially_Persistent_Type (Component_Type (T)) then return False; end if; Indx := First_Index (T); while Present (Indx) loop if not Is_OK_Static_Subtype (Etype (Indx)) then return False; else Next_Index (Indx); end if; end loop; return True; -- All other types are not potentially persistent else return False; end if; end Is_Potentially_Persistent_Type; ----------------------------- -- Is_RCI_Pkg_Spec_Or_Body -- ----------------------------- function Is_RCI_Pkg_Spec_Or_Body (Cunit : Node_Id) return Boolean is function Is_RCI_Pkg_Decl_Cunit (Cunit : Node_Id) return Boolean; -- Return True if the unit of Cunit is an RCI package declaration --------------------------- -- Is_RCI_Pkg_Decl_Cunit -- --------------------------- function Is_RCI_Pkg_Decl_Cunit (Cunit : Node_Id) return Boolean is The_Unit : constant Node_Id := Unit (Cunit); begin if Nkind (The_Unit) /= N_Package_Declaration then return False; end if; return Is_Remote_Call_Interface (Defining_Entity (The_Unit)); end Is_RCI_Pkg_Decl_Cunit; -- Start of processing for Is_RCI_Pkg_Spec_Or_Body begin return Is_RCI_Pkg_Decl_Cunit (Cunit) or else (Nkind (Unit (Cunit)) = N_Package_Body and then Is_RCI_Pkg_Decl_Cunit (Library_Unit (Cunit))); end Is_RCI_Pkg_Spec_Or_Body; ----------------------------------------- -- Is_Remote_Access_To_Class_Wide_Type -- ----------------------------------------- function Is_Remote_Access_To_Class_Wide_Type (E : Entity_Id) return Boolean is D : Entity_Id; function Comes_From_Limited_Private_Type_Declaration (E : Entity_Id) return Boolean; -- Check that the type is declared by a limited type declaration, -- or else is derived from a Remote_Type ancestor through private -- extensions. ------------------------------------------------- -- Comes_From_Limited_Private_Type_Declaration -- ------------------------------------------------- function Comes_From_Limited_Private_Type_Declaration (E : Entity_Id) return Boolean is N : constant Node_Id := Declaration_Node (E); begin if Nkind (N) = N_Private_Type_Declaration and then Limited_Present (N) then return True; end if; if Nkind (N) = N_Private_Extension_Declaration then return Comes_From_Limited_Private_Type_Declaration (Etype (E)) or else (Is_Remote_Types (Etype (E)) and then Is_Limited_Record (Etype (E)) and then Has_Private_Declaration (Etype (E))); end if; return False; end Comes_From_Limited_Private_Type_Declaration; -- Start of processing for Is_Remote_Access_To_Class_Wide_Type begin if not (Is_Remote_Call_Interface (E) or else Is_Remote_Types (E)) or else Ekind (E) /= E_General_Access_Type then return False; end if; D := Designated_Type (E); if Ekind (D) /= E_Class_Wide_Type then return False; end if; return Comes_From_Limited_Private_Type_Declaration (Defining_Identifier (Parent (D))); end Is_Remote_Access_To_Class_Wide_Type; ----------------------------------------- -- Is_Remote_Access_To_Subprogram_Type -- ----------------------------------------- function Is_Remote_Access_To_Subprogram_Type (E : Entity_Id) return Boolean is begin return (Ekind (E) = E_Access_Subprogram_Type or else (Ekind (E) = E_Record_Type and then Present (Corresponding_Remote_Type (E)))) and then (Is_Remote_Call_Interface (E) or else Is_Remote_Types (E)); end Is_Remote_Access_To_Subprogram_Type; -------------------- -- Is_Remote_Call -- -------------------- function Is_Remote_Call (N : Node_Id) return Boolean is begin if Nkind (N) /= N_Procedure_Call_Statement and then Nkind (N) /= N_Function_Call then -- An entry call cannot be remote return False; elsif Nkind (Name (N)) in N_Has_Entity and then Is_Remote_Call_Interface (Entity (Name (N))) then -- A subprogram declared in the spec of a RCI package is remote return True; elsif Nkind (Name (N)) = N_Explicit_Dereference and then Is_Remote_Access_To_Subprogram_Type (Etype (Prefix (Name (N)))) then -- The dereference of a RAS is a remote call return True; elsif Present (Controlling_Argument (N)) and then Is_Remote_Access_To_Class_Wide_Type (Etype (Controlling_Argument (N))) then -- Any primitive operation call with a controlling argument of -- a RACW type is a remote call. return True; end if; -- All other calls are local calls return False; end Is_Remote_Call; ---------------------- -- Is_Renamed_Entry -- ---------------------- function Is_Renamed_Entry (Proc_Nam : Entity_Id) return Boolean is Orig_Node : Node_Id := Empty; Subp_Decl : Node_Id := Parent (Parent (Proc_Nam)); function Is_Entry (Nam : Node_Id) return Boolean; -- Determine whether Nam is an entry. Traverse selectors -- if there are nested selected components. -------------- -- Is_Entry -- -------------- function Is_Entry (Nam : Node_Id) return Boolean is begin if Nkind (Nam) = N_Selected_Component then return Is_Entry (Selector_Name (Nam)); end if; return Ekind (Entity (Nam)) = E_Entry; end Is_Entry; -- Start of processing for Is_Renamed_Entry begin if Present (Alias (Proc_Nam)) then Subp_Decl := Parent (Parent (Alias (Proc_Nam))); end if; -- Look for a rewritten subprogram renaming declaration if Nkind (Subp_Decl) = N_Subprogram_Declaration and then Present (Original_Node (Subp_Decl)) then Orig_Node := Original_Node (Subp_Decl); end if; -- The rewritten subprogram is actually an entry if Present (Orig_Node) and then Nkind (Orig_Node) = N_Subprogram_Renaming_Declaration and then Is_Entry (Name (Orig_Node)) then return True; end if; return False; end Is_Renamed_Entry; ---------------------- -- Is_Selector_Name -- ---------------------- function Is_Selector_Name (N : Node_Id) return Boolean is begin if not Is_List_Member (N) then declare P : constant Node_Id := Parent (N); K : constant Node_Kind := Nkind (P); begin return (K = N_Expanded_Name or else K = N_Generic_Association or else K = N_Parameter_Association or else K = N_Selected_Component) and then Selector_Name (P) = N; end; else declare L : constant List_Id := List_Containing (N); P : constant Node_Id := Parent (L); begin return (Nkind (P) = N_Discriminant_Association and then Selector_Names (P) = L) or else (Nkind (P) = N_Component_Association and then Choices (P) = L); end; end if; end Is_Selector_Name; ------------------ -- Is_Statement -- ------------------ function Is_Statement (N : Node_Id) return Boolean is begin return Nkind (N) in N_Statement_Other_Than_Procedure_Call or else Nkind (N) = N_Procedure_Call_Statement; end Is_Statement; ----------------- -- Is_Transfer -- ----------------- function Is_Transfer (N : Node_Id) return Boolean is Kind : constant Node_Kind := Nkind (N); begin if Kind = N_Return_Statement or else Kind = N_Goto_Statement or else Kind = N_Raise_Statement or else Kind = N_Requeue_Statement then return True; elsif (Kind = N_Exit_Statement or else Kind in N_Raise_xxx_Error) and then No (Condition (N)) then return True; elsif Kind = N_Procedure_Call_Statement and then Is_Entity_Name (Name (N)) and then Present (Entity (Name (N))) and then No_Return (Entity (Name (N))) then return True; elsif Nkind (Original_Node (N)) = N_Raise_Statement then return True; else return False; end if; end Is_Transfer; ------------- -- Is_True -- ------------- function Is_True (U : Uint) return Boolean is begin return (U /= 0); end Is_True; ----------------- -- Is_Variable -- ----------------- function Is_Variable (N : Node_Id) return Boolean is Orig_Node : constant Node_Id := Original_Node (N); -- We do the test on the original node, since this is basically a -- test of syntactic categories, so it must not be disturbed by -- whatever rewriting might have occurred. For example, an aggregate, -- which is certainly NOT a variable, could be turned into a variable -- by expansion. function In_Protected_Function (E : Entity_Id) return Boolean; -- Within a protected function, the private components of the -- enclosing protected type are constants. A function nested within -- a (protected) procedure is not itself protected. function Is_Variable_Prefix (P : Node_Id) return Boolean; -- Prefixes can involve implicit dereferences, in which case we -- must test for the case of a reference of a constant access -- type, which can never be a variable. --------------------------- -- In_Protected_Function -- --------------------------- function In_Protected_Function (E : Entity_Id) return Boolean is Prot : constant Entity_Id := Scope (E); S : Entity_Id; begin if not Is_Protected_Type (Prot) then return False; else S := Current_Scope; while Present (S) and then S /= Prot loop if Ekind (S) = E_Function and then Scope (S) = Prot then return True; end if; S := Scope (S); end loop; return False; end if; end In_Protected_Function; ------------------------ -- Is_Variable_Prefix -- ------------------------ function Is_Variable_Prefix (P : Node_Id) return Boolean is begin if Is_Access_Type (Etype (P)) then return not Is_Access_Constant (Root_Type (Etype (P))); -- For the case of an indexed component whose prefix has a packed -- array type, the prefix has been rewritten into a type conversion. -- Determine variable-ness from the converted expression. elsif Nkind (P) = N_Type_Conversion and then not Comes_From_Source (P) and then Is_Array_Type (Etype (P)) and then Is_Packed (Etype (P)) then return Is_Variable (Expression (P)); else return Is_Variable (P); end if; end Is_Variable_Prefix; -- Start of processing for Is_Variable begin -- Definitely OK if Assignment_OK is set. Since this is something that -- only gets set for expanded nodes, the test is on N, not Orig_Node. if Nkind (N) in N_Subexpr and then Assignment_OK (N) then return True; -- Normally we go to the original node, but there is one exception -- where we use the rewritten node, namely when it is an explicit -- dereference. The generated code may rewrite a prefix which is an -- access type with an explicit dereference. The dereference is a -- variable, even though the original node may not be (since it could -- be a constant of the access type). elsif Nkind (N) = N_Explicit_Dereference and then Nkind (Orig_Node) /= N_Explicit_Dereference and then Is_Access_Type (Etype (Orig_Node)) then return Is_Variable_Prefix (Original_Node (Prefix (N))); -- A function call is never a variable elsif Nkind (N) = N_Function_Call then return False; -- All remaining checks use the original node elsif Is_Entity_Name (Orig_Node) then declare E : constant Entity_Id := Entity (Orig_Node); K : constant Entity_Kind := Ekind (E); begin return (K = E_Variable and then Nkind (Parent (E)) /= N_Exception_Handler) or else (K = E_Component and then not In_Protected_Function (E)) or else K = E_Out_Parameter or else K = E_In_Out_Parameter or else K = E_Generic_In_Out_Parameter -- Current instance of type: or else (Is_Type (E) and then In_Open_Scopes (E)) or else (Is_Incomplete_Or_Private_Type (E) and then In_Open_Scopes (Full_View (E))); end; else case Nkind (Orig_Node) is when N_Indexed_Component | N_Slice => return Is_Variable_Prefix (Prefix (Orig_Node)); when N_Selected_Component => return Is_Variable_Prefix (Prefix (Orig_Node)) and then Is_Variable (Selector_Name (Orig_Node)); -- For an explicit dereference, the type of the prefix cannot -- be an access to constant or an access to subprogram. when N_Explicit_Dereference => declare Typ : constant Entity_Id := Etype (Prefix (Orig_Node)); begin return Is_Access_Type (Typ) and then not Is_Access_Constant (Root_Type (Typ)) and then Ekind (Typ) /= E_Access_Subprogram_Type; end; -- The type conversion is the case where we do not deal with the -- context dependent special case of an actual parameter. Thus -- the type conversion is only considered a variable for the -- purposes of this routine if the target type is tagged. However, -- a type conversion is considered to be a variable if it does not -- come from source (this deals for example with the conversions -- of expressions to their actual subtypes). when N_Type_Conversion => return Is_Variable (Expression (Orig_Node)) and then (not Comes_From_Source (Orig_Node) or else (Is_Tagged_Type (Etype (Subtype_Mark (Orig_Node))) and then Is_Tagged_Type (Etype (Expression (Orig_Node))))); -- GNAT allows an unchecked type conversion as a variable. This -- only affects the generation of internal expanded code, since -- calls to instantiations of Unchecked_Conversion are never -- considered variables (since they are function calls). -- This is also true for expression actions. when N_Unchecked_Type_Conversion => return Is_Variable (Expression (Orig_Node)); when others => return False; end case; end if; end Is_Variable; ------------------------ -- Is_Volatile_Object -- ------------------------ function Is_Volatile_Object (N : Node_Id) return Boolean is function Object_Has_Volatile_Components (N : Node_Id) return Boolean; -- Determines if given object has volatile components function Is_Volatile_Prefix (N : Node_Id) return Boolean; -- If prefix is an implicit dereference, examine designated type ------------------------ -- Is_Volatile_Prefix -- ------------------------ function Is_Volatile_Prefix (N : Node_Id) return Boolean is Typ : constant Entity_Id := Etype (N); begin if Is_Access_Type (Typ) then declare Dtyp : constant Entity_Id := Designated_Type (Typ); begin return Is_Volatile (Dtyp) or else Has_Volatile_Components (Dtyp); end; else return Object_Has_Volatile_Components (N); end if; end Is_Volatile_Prefix; ------------------------------------ -- Object_Has_Volatile_Components -- ------------------------------------ function Object_Has_Volatile_Components (N : Node_Id) return Boolean is Typ : constant Entity_Id := Etype (N); begin if Is_Volatile (Typ) or else Has_Volatile_Components (Typ) then return True; elsif Is_Entity_Name (N) and then (Has_Volatile_Components (Entity (N)) or else Is_Volatile (Entity (N))) then return True; elsif Nkind (N) = N_Indexed_Component or else Nkind (N) = N_Selected_Component then return Is_Volatile_Prefix (Prefix (N)); else return False; end if; end Object_Has_Volatile_Components; -- Start of processing for Is_Volatile_Object begin if Is_Volatile (Etype (N)) or else (Is_Entity_Name (N) and then Is_Volatile (Entity (N))) then return True; elsif Nkind (N) = N_Indexed_Component or else Nkind (N) = N_Selected_Component then return Is_Volatile_Prefix (Prefix (N)); else return False; end if; end Is_Volatile_Object; ------------------------- -- Kill_Current_Values -- ------------------------- procedure Kill_Current_Values (Ent : Entity_Id) is begin if Is_Object (Ent) then Kill_Checks (Ent); Set_Current_Value (Ent, Empty); if not Can_Never_Be_Null (Ent) then Set_Is_Known_Non_Null (Ent, False); end if; Set_Is_Known_Null (Ent, False); end if; end Kill_Current_Values; procedure Kill_Current_Values is S : Entity_Id; procedure Kill_Current_Values_For_Entity_Chain (E : Entity_Id); -- Clear current value for entity E and all entities chained to E ------------------------------------------ -- Kill_Current_Values_For_Entity_Chain -- ------------------------------------------ procedure Kill_Current_Values_For_Entity_Chain (E : Entity_Id) is Ent : Entity_Id; begin Ent := E; while Present (Ent) loop Kill_Current_Values (Ent); Next_Entity (Ent); end loop; end Kill_Current_Values_For_Entity_Chain; -- Start of processing for Kill_Current_Values begin -- Kill all saved checks, a special case of killing saved values Kill_All_Checks; -- Loop through relevant scopes, which includes the current scope and -- any parent scopes if the current scope is a block or a package. S := Current_Scope; Scope_Loop : loop -- Clear current values of all entities in current scope Kill_Current_Values_For_Entity_Chain (First_Entity (S)); -- If scope is a package, also clear current values of all -- private entities in the scope. if Ekind (S) = E_Package or else Ekind (S) = E_Generic_Package or else Is_Concurrent_Type (S) then Kill_Current_Values_For_Entity_Chain (First_Private_Entity (S)); end if; -- If this is a block or nested package, deal with parent if Ekind (S) = E_Block or else (Ekind (S) = E_Package and then not Is_Library_Level_Entity (S)) then S := Scope (S); else exit Scope_Loop; end if; end loop Scope_Loop; end Kill_Current_Values; -------------------------- -- Kill_Size_Check_Code -- -------------------------- procedure Kill_Size_Check_Code (E : Entity_Id) is begin if (Ekind (E) = E_Constant or else Ekind (E) = E_Variable) and then Present (Size_Check_Code (E)) then Remove (Size_Check_Code (E)); Set_Size_Check_Code (E, Empty); end if; end Kill_Size_Check_Code; ------------------------- -- New_External_Entity -- ------------------------- function New_External_Entity (Kind : Entity_Kind; Scope_Id : Entity_Id; Sloc_Value : Source_Ptr; Related_Id : Entity_Id; Suffix : Character; Suffix_Index : Nat := 0; Prefix : Character := ' ') return Entity_Id is N : constant Entity_Id := Make_Defining_Identifier (Sloc_Value, New_External_Name (Chars (Related_Id), Suffix, Suffix_Index, Prefix)); begin Set_Ekind (N, Kind); Set_Is_Internal (N, True); Append_Entity (N, Scope_Id); Set_Public_Status (N); if Kind in Type_Kind then Init_Size_Align (N); end if; return N; end New_External_Entity; ------------------------- -- New_Internal_Entity -- ------------------------- function New_Internal_Entity (Kind : Entity_Kind; Scope_Id : Entity_Id; Sloc_Value : Source_Ptr; Id_Char : Character) return Entity_Id is N : constant Entity_Id := Make_Defining_Identifier (Sloc_Value, New_Internal_Name (Id_Char)); begin Set_Ekind (N, Kind); Set_Is_Internal (N, True); Append_Entity (N, Scope_Id); if Kind in Type_Kind then Init_Size_Align (N); end if; return N; end New_Internal_Entity; ----------------- -- Next_Actual -- ----------------- function Next_Actual (Actual_Id : Node_Id) return Node_Id is N : Node_Id; begin -- If we are pointing at a positional parameter, it is a member of -- a node list (the list of parameters), and the next parameter -- is the next node on the list, unless we hit a parameter -- association, in which case we shift to using the chain whose -- head is the First_Named_Actual in the parent, and then is -- threaded using the Next_Named_Actual of the Parameter_Association. -- All this fiddling is because the original node list is in the -- textual call order, and what we need is the declaration order. if Is_List_Member (Actual_Id) then N := Next (Actual_Id); if Nkind (N) = N_Parameter_Association then return First_Named_Actual (Parent (Actual_Id)); else return N; end if; else return Next_Named_Actual (Parent (Actual_Id)); end if; end Next_Actual; procedure Next_Actual (Actual_Id : in out Node_Id) is begin Actual_Id := Next_Actual (Actual_Id); end Next_Actual; ----------------------- -- Normalize_Actuals -- ----------------------- -- Chain actuals according to formals of subprogram. If there are no named -- associations, the chain is simply the list of Parameter Associations, -- since the order is the same as the declaration order. If there are named -- associations, then the First_Named_Actual field in the N_Function_Call -- or N_Procedure_Call_Statement node points to the Parameter_Association -- node for the parameter that comes first in declaration order. The -- remaining named parameters are then chained in declaration order using -- Next_Named_Actual. -- This routine also verifies that the number of actuals is compatible with -- the number and default values of formals, but performs no type checking -- (type checking is done by the caller). -- If the matching succeeds, Success is set to True and the caller proceeds -- with type-checking. If the match is unsuccessful, then Success is set to -- False, and the caller attempts a different interpretation, if there is -- one. -- If the flag Report is on, the call is not overloaded, and a failure to -- match can be reported here, rather than in the caller. procedure Normalize_Actuals (N : Node_Id; S : Entity_Id; Report : Boolean; Success : out Boolean) is Actuals : constant List_Id := Parameter_Associations (N); Actual : Node_Id := Empty; Formal : Entity_Id; Last : Node_Id := Empty; First_Named : Node_Id := Empty; Found : Boolean; Formals_To_Match : Integer := 0; Actuals_To_Match : Integer := 0; procedure Chain (A : Node_Id); -- Add named actual at the proper place in the list, using the -- Next_Named_Actual link. function Reporting return Boolean; -- Determines if an error is to be reported. To report an error, we -- need Report to be True, and also we do not report errors caused -- by calls to init procs that occur within other init procs. Such -- errors must always be cascaded errors, since if all the types are -- declared correctly, the compiler will certainly build decent calls! ----------- -- Chain -- ----------- procedure Chain (A : Node_Id) is begin if No (Last) then -- Call node points to first actual in list Set_First_Named_Actual (N, Explicit_Actual_Parameter (A)); else Set_Next_Named_Actual (Last, Explicit_Actual_Parameter (A)); end if; Last := A; Set_Next_Named_Actual (Last, Empty); end Chain; --------------- -- Reporting -- --------------- function Reporting return Boolean is begin if not Report then return False; elsif not Within_Init_Proc then return True; elsif Is_Init_Proc (Entity (Name (N))) then return False; else return True; end if; end Reporting; -- Start of processing for Normalize_Actuals begin if Is_Access_Type (S) then -- The name in the call is a function call that returns an access -- to subprogram. The designated type has the list of formals. Formal := First_Formal (Designated_Type (S)); else Formal := First_Formal (S); end if; while Present (Formal) loop Formals_To_Match := Formals_To_Match + 1; Next_Formal (Formal); end loop; -- Find if there is a named association, and verify that no positional -- associations appear after named ones. if Present (Actuals) then Actual := First (Actuals); end if; while Present (Actual) and then Nkind (Actual) /= N_Parameter_Association loop Actuals_To_Match := Actuals_To_Match + 1; Next (Actual); end loop; if No (Actual) and Actuals_To_Match = Formals_To_Match then -- Most common case: positional notation, no defaults Success := True; return; elsif Actuals_To_Match > Formals_To_Match then -- Too many actuals: will not work if Reporting then if Is_Entity_Name (Name (N)) then Error_Msg_N ("too many arguments in call to&", Name (N)); else Error_Msg_N ("too many arguments in call", N); end if; end if; Success := False; return; end if; First_Named := Actual; while Present (Actual) loop if Nkind (Actual) /= N_Parameter_Association then Error_Msg_N ("positional parameters not allowed after named ones", Actual); Success := False; return; else Actuals_To_Match := Actuals_To_Match + 1; end if; Next (Actual); end loop; if Present (Actuals) then Actual := First (Actuals); end if; Formal := First_Formal (S); while Present (Formal) loop -- Match the formals in order. If the corresponding actual -- is positional, nothing to do. Else scan the list of named -- actuals to find the one with the right name. if Present (Actual) and then Nkind (Actual) /= N_Parameter_Association then Next (Actual); Actuals_To_Match := Actuals_To_Match - 1; Formals_To_Match := Formals_To_Match - 1; else -- For named parameters, search the list of actuals to find -- one that matches the next formal name. Actual := First_Named; Found := False; while Present (Actual) loop if Chars (Selector_Name (Actual)) = Chars (Formal) then Found := True; Chain (Actual); Actuals_To_Match := Actuals_To_Match - 1; Formals_To_Match := Formals_To_Match - 1; exit; end if; Next (Actual); end loop; if not Found then if Ekind (Formal) /= E_In_Parameter or else No (Default_Value (Formal)) then if Reporting then if (Comes_From_Source (S) or else Sloc (S) = Standard_Location) and then Is_Overloadable (S) then if No (Actuals) and then (Nkind (Parent (N)) = N_Procedure_Call_Statement or else (Nkind (Parent (N)) = N_Function_Call or else Nkind (Parent (N)) = N_Parameter_Association)) and then Ekind (S) /= E_Function then Set_Etype (N, Etype (S)); else Error_Msg_Name_1 := Chars (S); Error_Msg_Sloc := Sloc (S); Error_Msg_NE ("missing argument for parameter & " & "in call to % declared #", N, Formal); end if; elsif Is_Overloadable (S) then Error_Msg_Name_1 := Chars (S); -- Point to type derivation that generated the -- operation. Error_Msg_Sloc := Sloc (Parent (S)); Error_Msg_NE ("missing argument for parameter & " & "in call to % (inherited) #", N, Formal); else Error_Msg_NE ("missing argument for parameter &", N, Formal); end if; end if; Success := False; return; else Formals_To_Match := Formals_To_Match - 1; end if; end if; end if; Next_Formal (Formal); end loop; if Formals_To_Match = 0 and then Actuals_To_Match = 0 then Success := True; return; else if Reporting then -- Find some superfluous named actual that did not get -- attached to the list of associations. Actual := First (Actuals); while Present (Actual) loop if Nkind (Actual) = N_Parameter_Association and then Actual /= Last and then No (Next_Named_Actual (Actual)) then Error_Msg_N ("unmatched actual & in call", Selector_Name (Actual)); exit; end if; Next (Actual); end loop; end if; Success := False; return; end if; end Normalize_Actuals; -------------------------------- -- Note_Possible_Modification -- -------------------------------- procedure Note_Possible_Modification (N : Node_Id) is Modification_Comes_From_Source : constant Boolean := Comes_From_Source (Parent (N)); Ent : Entity_Id; Exp : Node_Id; begin -- Loop to find referenced entity, if there is one Exp := N; loop <<Continue>> Ent := Empty; if Is_Entity_Name (Exp) then Ent := Entity (Exp); -- If the entity is missing, it is an undeclared identifier, -- and there is nothing to annotate. if No (Ent) then return; end if; elsif Nkind (Exp) = N_Explicit_Dereference then declare P : constant Node_Id := Prefix (Exp); begin if Nkind (P) = N_Selected_Component and then Present ( Entry_Formal (Entity (Selector_Name (P)))) then -- Case of a reference to an entry formal Ent := Entry_Formal (Entity (Selector_Name (P))); elsif Nkind (P) = N_Identifier and then Nkind (Parent (Entity (P))) = N_Object_Declaration and then Present (Expression (Parent (Entity (P)))) and then Nkind (Expression (Parent (Entity (P)))) = N_Reference then -- Case of a reference to a value on which -- side effects have been removed. Exp := Prefix (Expression (Parent (Entity (P)))); goto Continue; else return; end if; end; elsif Nkind (Exp) = N_Type_Conversion or else Nkind (Exp) = N_Unchecked_Type_Conversion then Exp := Expression (Exp); goto Continue; elsif Nkind (Exp) = N_Slice or else Nkind (Exp) = N_Indexed_Component or else Nkind (Exp) = N_Selected_Component then Exp := Prefix (Exp); goto Continue; else return; end if; -- Now look for entity being referenced if Present (Ent) then if Is_Object (Ent) then if Comes_From_Source (Exp) or else Modification_Comes_From_Source then Set_Never_Set_In_Source (Ent, False); end if; Set_Is_True_Constant (Ent, False); Set_Current_Value (Ent, Empty); Set_Is_Known_Null (Ent, False); if not Can_Never_Be_Null (Ent) then Set_Is_Known_Non_Null (Ent, False); end if; -- Follow renaming chain if (Ekind (Ent) = E_Variable or else Ekind (Ent) = E_Constant) and then Present (Renamed_Object (Ent)) then Exp := Renamed_Object (Ent); goto Continue; end if; -- Generate a reference only if the assignment comes from -- source. This excludes, for example, calls to a dispatching -- assignment operation when the left-hand side is tagged. if Modification_Comes_From_Source then Generate_Reference (Ent, Exp, 'm'); end if; end if; Kill_Checks (Ent); return; end if; end loop; end Note_Possible_Modification; ------------------------- -- Object_Access_Level -- ------------------------- function Object_Access_Level (Obj : Node_Id) return Uint is E : Entity_Id; -- Returns the static accessibility level of the view denoted -- by Obj. Note that the value returned is the result of a -- call to Scope_Depth. Only scope depths associated with -- dynamic scopes can actually be returned. Since only -- relative levels matter for accessibility checking, the fact -- that the distance between successive levels of accessibility -- is not always one is immaterial (invariant: if level(E2) is -- deeper than level(E1), then Scope_Depth(E1) < Scope_Depth(E2)). begin if Is_Entity_Name (Obj) then E := Entity (Obj); -- If E is a type then it denotes a current instance. -- For this case we add one to the normal accessibility -- level of the type to ensure that current instances -- are treated as always being deeper than than the level -- of any visible named access type (see 3.10.2(21)). if Is_Type (E) then return Type_Access_Level (E) + 1; elsif Present (Renamed_Object (E)) then return Object_Access_Level (Renamed_Object (E)); -- Similarly, if E is a component of the current instance of a -- protected type, any instance of it is assumed to be at a deeper -- level than the type. For a protected object (whose type is an -- anonymous protected type) its components are at the same level -- as the type itself. elsif not Is_Overloadable (E) and then Ekind (Scope (E)) = E_Protected_Type and then Comes_From_Source (Scope (E)) then return Type_Access_Level (Scope (E)) + 1; else return Scope_Depth (Enclosing_Dynamic_Scope (E)); end if; elsif Nkind (Obj) = N_Selected_Component then if Is_Access_Type (Etype (Prefix (Obj))) then return Type_Access_Level (Etype (Prefix (Obj))); else return Object_Access_Level (Prefix (Obj)); end if; elsif Nkind (Obj) = N_Indexed_Component then if Is_Access_Type (Etype (Prefix (Obj))) then return Type_Access_Level (Etype (Prefix (Obj))); else return Object_Access_Level (Prefix (Obj)); end if; elsif Nkind (Obj) = N_Explicit_Dereference then -- If the prefix is a selected access discriminant then -- we make a recursive call on the prefix, which will -- in turn check the level of the prefix object of -- the selected discriminant. if Nkind (Prefix (Obj)) = N_Selected_Component and then Ekind (Etype (Prefix (Obj))) = E_Anonymous_Access_Type and then Ekind (Entity (Selector_Name (Prefix (Obj)))) = E_Discriminant then return Object_Access_Level (Prefix (Obj)); else return Type_Access_Level (Etype (Prefix (Obj))); end if; elsif Nkind (Obj) = N_Type_Conversion or else Nkind (Obj) = N_Unchecked_Type_Conversion then return Object_Access_Level (Expression (Obj)); -- Function results are objects, so we get either the access level -- of the function or, in the case of an indirect call, the level of -- of the access-to-subprogram type. elsif Nkind (Obj) = N_Function_Call then if Is_Entity_Name (Name (Obj)) then return Subprogram_Access_Level (Entity (Name (Obj))); else return Type_Access_Level (Etype (Prefix (Name (Obj)))); end if; -- For convenience we handle qualified expressions, even though -- they aren't technically object names. elsif Nkind (Obj) = N_Qualified_Expression then return Object_Access_Level (Expression (Obj)); -- Otherwise return the scope level of Standard. -- (If there are cases that fall through -- to this point they will be treated as -- having global accessibility for now. ???) else return Scope_Depth (Standard_Standard); end if; end Object_Access_Level; ----------------------- -- Private_Component -- ----------------------- function Private_Component (Type_Id : Entity_Id) return Entity_Id is Ancestor : constant Entity_Id := Base_Type (Type_Id); function Trace_Components (T : Entity_Id; Check : Boolean) return Entity_Id; -- Recursive function that does the work, and checks against circular -- definition for each subcomponent type. ---------------------- -- Trace_Components -- ---------------------- function Trace_Components (T : Entity_Id; Check : Boolean) return Entity_Id is Btype : constant Entity_Id := Base_Type (T); Component : Entity_Id; P : Entity_Id; Candidate : Entity_Id := Empty; begin if Check and then Btype = Ancestor then Error_Msg_N ("circular type definition", Type_Id); return Any_Type; end if; if Is_Private_Type (Btype) and then not Is_Generic_Type (Btype) then if Present (Full_View (Btype)) and then Is_Record_Type (Full_View (Btype)) and then not Is_Frozen (Btype) then -- To indicate that the ancestor depends on a private type, -- the current Btype is sufficient. However, to check for -- circular definition we must recurse on the full view. Candidate := Trace_Components (Full_View (Btype), True); if Candidate = Any_Type then return Any_Type; else return Btype; end if; else return Btype; end if; elsif Is_Array_Type (Btype) then return Trace_Components (Component_Type (Btype), True); elsif Is_Record_Type (Btype) then Component := First_Entity (Btype); while Present (Component) loop -- Skip anonymous types generated by constrained components if not Is_Type (Component) then P := Trace_Components (Etype (Component), True); if Present (P) then if P = Any_Type then return P; else Candidate := P; end if; end if; end if; Next_Entity (Component); end loop; return Candidate; else return Empty; end if; end Trace_Components; -- Start of processing for Private_Component begin return Trace_Components (Type_Id, False); end Private_Component; ----------------------- -- Process_End_Label -- ----------------------- procedure Process_End_Label (N : Node_Id; Typ : Character; Ent : Entity_Id) is Loc : Source_Ptr; Nam : Node_Id; Label_Ref : Boolean; -- Set True if reference to end label itself is required Endl : Node_Id; -- Gets set to the operator symbol or identifier that references -- the entity Ent. For the child unit case, this is the identifier -- from the designator. For other cases, this is simply Endl. procedure Generate_Parent_Ref (N : Node_Id); -- N is an identifier node that appears as a parent unit reference -- in the case where Ent is a child unit. This procedure generates -- an appropriate cross-reference entry. ------------------------- -- Generate_Parent_Ref -- ------------------------- procedure Generate_Parent_Ref (N : Node_Id) is Parent_Ent : Entity_Id; begin -- Search up scope stack. The reason we do this is that normal -- visibility analysis would not work for two reasons. First in -- some subunit cases, the entry for the parent unit may not be -- visible, and in any case there can be a local entity that -- hides the scope entity. Parent_Ent := Current_Scope; while Present (Parent_Ent) loop if Chars (Parent_Ent) = Chars (N) then -- Generate the reference. We do NOT consider this as a -- reference for unreferenced symbol purposes, but we do -- force a cross-reference even if the end line does not -- come from source (the caller already generated the -- appropriate Typ for this situation). Generate_Reference (Parent_Ent, N, 'r', Set_Ref => False, Force => True); Style.Check_Identifier (N, Parent_Ent); return; end if; Parent_Ent := Scope (Parent_Ent); end loop; -- Fall through means entity was not found -- that's odd, but -- the appropriate thing is simply to ignore and not generate -- any cross-reference for this entry. return; end Generate_Parent_Ref; -- Start of processing for Process_End_Label begin -- If no node, ignore. This happens in some error situations, -- and also for some internally generated structures where no -- end label references are required in any case. if No (N) then return; end if; -- Nothing to do if no End_Label, happens for internally generated -- constructs where we don't want an end label reference anyway. -- Also nothing to do if Endl is a string literal, which means -- there was some prior error (bad operator symbol) Endl := End_Label (N); if No (Endl) or else Nkind (Endl) = N_String_Literal then return; end if; -- Reference node is not in extended main source unit if not In_Extended_Main_Source_Unit (N) then -- Generally we do not collect references except for the -- extended main source unit. The one exception is the 'e' -- entry for a package spec, where it is useful for a client -- to have the ending information to define scopes. if Typ /= 'e' then return; else Label_Ref := False; -- For this case, we can ignore any parent references, -- but we need the package name itself for the 'e' entry. if Nkind (Endl) = N_Designator then Endl := Identifier (Endl); end if; end if; -- Reference is in extended main source unit else Label_Ref := True; -- For designator, generate references for the parent entries if Nkind (Endl) = N_Designator then -- Generate references for the prefix if the END line comes -- from source (otherwise we do not need these references) if Comes_From_Source (Endl) then Nam := Name (Endl); while Nkind (Nam) = N_Selected_Component loop Generate_Parent_Ref (Selector_Name (Nam)); Nam := Prefix (Nam); end loop; Generate_Parent_Ref (Nam); end if; Endl := Identifier (Endl); end if; end if; -- If the end label is not for the given entity, then either we have -- some previous error, or this is a generic instantiation for which -- we do not need to make a cross-reference in this case anyway. In -- either case we simply ignore the call. if Chars (Ent) /= Chars (Endl) then return; end if; -- If label was really there, then generate a normal reference -- and then adjust the location in the end label to point past -- the name (which should almost always be the semicolon). Loc := Sloc (Endl); if Comes_From_Source (Endl) then -- If a label reference is required, then do the style check -- and generate an l-type cross-reference entry for the label if Label_Ref then if Style_Check then Style.Check_Identifier (Endl, Ent); end if; Generate_Reference (Ent, Endl, 'l', Set_Ref => False); end if; -- Set the location to point past the label (normally this will -- mean the semicolon immediately following the label). This is -- done for the sake of the 'e' or 't' entry generated below. Get_Decoded_Name_String (Chars (Endl)); Set_Sloc (Endl, Sloc (Endl) + Source_Ptr (Name_Len)); end if; -- Now generate the e/t reference Generate_Reference (Ent, Endl, Typ, Set_Ref => False, Force => True); -- Restore Sloc, in case modified above, since we have an identifier -- and the normal Sloc should be left set in the tree. Set_Sloc (Endl, Loc); end Process_End_Label; ------------------ -- Real_Convert -- ------------------ -- We do the conversion to get the value of the real string by using -- the scanner, see Sinput for details on use of the internal source -- buffer for scanning internal strings. function Real_Convert (S : String) return Node_Id is Save_Src : constant Source_Buffer_Ptr := Source; Negative : Boolean; begin Source := Internal_Source_Ptr; Scan_Ptr := 1; for J in S'Range loop Source (Source_Ptr (J)) := S (J); end loop; Source (S'Length + 1) := EOF; if Source (Scan_Ptr) = '-' then Negative := True; Scan_Ptr := Scan_Ptr + 1; else Negative := False; end if; Scan; if Negative then Set_Realval (Token_Node, UR_Negate (Realval (Token_Node))); end if; Source := Save_Src; return Token_Node; end Real_Convert; --------------------- -- Rep_To_Pos_Flag -- --------------------- function Rep_To_Pos_Flag (E : Entity_Id; Loc : Source_Ptr) return Node_Id is begin return New_Occurrence_Of (Boolean_Literals (not Range_Checks_Suppressed (E)), Loc); end Rep_To_Pos_Flag; -------------------- -- Require_Entity -- -------------------- procedure Require_Entity (N : Node_Id) is begin if Is_Entity_Name (N) and then No (Entity (N)) then if Total_Errors_Detected /= 0 then Set_Entity (N, Any_Id); else raise Program_Error; end if; end if; end Require_Entity; ------------------------------ -- Requires_Transient_Scope -- ------------------------------ -- A transient scope is required when variable-sized temporaries are -- allocated in the primary or secondary stack, or when finalization -- actions must be generated before the next instruction. function Requires_Transient_Scope (Id : Entity_Id) return Boolean is Typ : constant Entity_Id := Underlying_Type (Id); -- Start of processing for Requires_Transient_Scope begin -- This is a private type which is not completed yet. This can only -- happen in a default expression (of a formal parameter or of a -- record component). Do not expand transient scope in this case if No (Typ) then return False; -- Do not expand transient scope for non-existent procedure return elsif Typ = Standard_Void_Type then return False; -- Elementary types do not require a transient scope elsif Is_Elementary_Type (Typ) then return False; -- Generally, indefinite subtypes require a transient scope, since the -- back end cannot generate temporaries, since this is not a valid type -- for declaring an object. It might be possible to relax this in the -- future, e.g. by declaring the maximum possible space for the type. elsif Is_Indefinite_Subtype (Typ) then return True; -- Functions returning tagged types may dispatch on result so their -- returned value is allocated on the secondary stack. Controlled -- type temporaries need finalization. elsif Is_Tagged_Type (Typ) or else Has_Controlled_Component (Typ) then return True; -- Record type elsif Is_Record_Type (Typ) then -- In GCC 2, discriminated records always require a transient -- scope because the back end otherwise tries to allocate a -- variable length temporary for the particular variant. if Opt.GCC_Version = 2 and then Has_Discriminants (Typ) then return True; -- For GCC 3, or for a non-discriminated record in GCC 2, we are -- OK if none of the component types requires a transient scope. -- Note that we already know that this is a definite type (i.e. -- has discriminant defaults if it is a discriminated record). else declare Comp : Entity_Id; begin Comp := First_Entity (Typ); while Present (Comp) loop if Ekind (Comp) = E_Component and then Requires_Transient_Scope (Etype (Comp)) then return True; else Next_Entity (Comp); end if; end loop; end; return False; end if; -- String literal types never require transient scope elsif Ekind (Typ) = E_String_Literal_Subtype then return False; -- Array type. Note that we already know that this is a constrained -- array, since unconstrained arrays will fail the indefinite test. elsif Is_Array_Type (Typ) then -- If component type requires a transient scope, the array does too if Requires_Transient_Scope (Component_Type (Typ)) then return True; -- Otherwise, we only need a transient scope if the size is not -- known at compile time. else return not Size_Known_At_Compile_Time (Typ); end if; -- All other cases do not require a transient scope else return False; end if; end Requires_Transient_Scope; -------------------------- -- Reset_Analyzed_Flags -- -------------------------- procedure Reset_Analyzed_Flags (N : Node_Id) is function Clear_Analyzed (N : Node_Id) return Traverse_Result; -- Function used to reset Analyzed flags in tree. Note that we do -- not reset Analyzed flags in entities, since there is no need to -- renalalyze entities, and indeed, it is wrong to do so, since it -- can result in generating auxiliary stuff more than once. -------------------- -- Clear_Analyzed -- -------------------- function Clear_Analyzed (N : Node_Id) return Traverse_Result is begin if not Has_Extension (N) then Set_Analyzed (N, False); end if; return OK; end Clear_Analyzed; function Reset_Analyzed is new Traverse_Func (Clear_Analyzed); Discard : Traverse_Result; pragma Warnings (Off, Discard); -- Start of processing for Reset_Analyzed_Flags begin Discard := Reset_Analyzed (N); end Reset_Analyzed_Flags; --------------------------- -- Safe_To_Capture_Value -- --------------------------- function Safe_To_Capture_Value (N : Node_Id; Ent : Entity_Id) return Boolean is begin -- The only entities for which we track constant values are variables, -- out parameters and in out parameters, so check if we have this case. if Ekind (Ent) /= E_Variable and then Ekind (Ent) /= E_Out_Parameter and then Ekind (Ent) /= E_In_Out_Parameter then return False; end if; -- Skip volatile and aliased variables, since funny things might -- be going on in these cases which we cannot necessarily track. -- Also skip any variable for which an address clause is given. -- Should we have a flag Has_Address_Clause ??? if Treat_As_Volatile (Ent) or else Is_Aliased (Ent) or else Present (Address_Clause (Ent)) then return False; end if; -- OK, all above conditions are met. We also require that the scope -- of the reference be the same as the scope of the entity, not -- counting packages and blocks. declare E_Scope : constant Entity_Id := Scope (Ent); R_Scope : Entity_Id; begin R_Scope := Current_Scope; while R_Scope /= Standard_Standard loop exit when R_Scope = E_Scope; if Ekind (R_Scope) /= E_Package and then Ekind (R_Scope) /= E_Block then return False; else R_Scope := Scope (R_Scope); end if; end loop; end; -- We also require that the reference does not appear in a context -- where it is not sure to be executed (i.e. a conditional context -- or an exception handler). declare Desc : Node_Id; P : Node_Id; begin Desc := N; P := Parent (N); while Present (P) loop if Nkind (P) = N_If_Statement or else Nkind (P) = N_Case_Statement or else (Nkind (P) = N_And_Then and then Desc = Right_Opnd (P)) or else (Nkind (P) = N_Or_Else and then Desc = Right_Opnd (P)) or else Nkind (P) = N_Exception_Handler or else Nkind (P) = N_Selective_Accept or else Nkind (P) = N_Conditional_Entry_Call or else Nkind (P) = N_Timed_Entry_Call or else Nkind (P) = N_Asynchronous_Select then return False; else Desc := P; P := Parent (P); end if; end loop; end; -- OK, looks safe to set value return True; end Safe_To_Capture_Value; --------------- -- Same_Name -- --------------- function Same_Name (N1, N2 : Node_Id) return Boolean is K1 : constant Node_Kind := Nkind (N1); K2 : constant Node_Kind := Nkind (N2); begin if (K1 = N_Identifier or else K1 = N_Defining_Identifier) and then (K2 = N_Identifier or else K2 = N_Defining_Identifier) then return Chars (N1) = Chars (N2); elsif (K1 = N_Selected_Component or else K1 = N_Expanded_Name) and then (K2 = N_Selected_Component or else K2 = N_Expanded_Name) then return Same_Name (Selector_Name (N1), Selector_Name (N2)) and then Same_Name (Prefix (N1), Prefix (N2)); else return False; end if; end Same_Name; --------------- -- Same_Type -- --------------- function Same_Type (T1, T2 : Entity_Id) return Boolean is begin if T1 = T2 then return True; elsif not Is_Constrained (T1) and then not Is_Constrained (T2) and then Base_Type (T1) = Base_Type (T2) then return True; -- For now don't bother with case of identical constraints, to be -- fiddled with later on perhaps (this is only used for optimization -- purposes, so it is not critical to do a best possible job) else return False; end if; end Same_Type; ------------------------ -- Scope_Is_Transient -- ------------------------ function Scope_Is_Transient return Boolean is begin return Scope_Stack.Table (Scope_Stack.Last).Is_Transient; end Scope_Is_Transient; ------------------ -- Scope_Within -- ------------------ function Scope_Within (Scope1, Scope2 : Entity_Id) return Boolean is Scop : Entity_Id; begin Scop := Scope1; while Scop /= Standard_Standard loop Scop := Scope (Scop); if Scop = Scope2 then return True; end if; end loop; return False; end Scope_Within; -------------------------- -- Scope_Within_Or_Same -- -------------------------- function Scope_Within_Or_Same (Scope1, Scope2 : Entity_Id) return Boolean is Scop : Entity_Id; begin Scop := Scope1; while Scop /= Standard_Standard loop if Scop = Scope2 then return True; else Scop := Scope (Scop); end if; end loop; return False; end Scope_Within_Or_Same; ------------------------ -- Set_Current_Entity -- ------------------------ -- The given entity is to be set as the currently visible definition -- of its associated name (i.e. the Node_Id associated with its name). -- All we have to do is to get the name from the identifier, and -- then set the associated Node_Id to point to the given entity. procedure Set_Current_Entity (E : Entity_Id) is begin Set_Name_Entity_Id (Chars (E), E); end Set_Current_Entity; --------------------------------- -- Set_Entity_With_Style_Check -- --------------------------------- procedure Set_Entity_With_Style_Check (N : Node_Id; Val : Entity_Id) is Val_Actual : Entity_Id; Nod : Node_Id; begin Set_Entity (N, Val); if Style_Check and then not Suppress_Style_Checks (Val) and then not In_Instance then if Nkind (N) = N_Identifier then Nod := N; elsif Nkind (N) = N_Expanded_Name then Nod := Selector_Name (N); else return; end if; -- A special situation arises for derived operations, where we want -- to do the check against the parent (since the Sloc of the derived -- operation points to the derived type declaration itself). Val_Actual := Val; while not Comes_From_Source (Val_Actual) and then Nkind (Val_Actual) in N_Entity and then (Ekind (Val_Actual) = E_Enumeration_Literal or else Is_Subprogram (Val_Actual) or else Is_Generic_Subprogram (Val_Actual)) and then Present (Alias (Val_Actual)) loop Val_Actual := Alias (Val_Actual); end loop; -- Renaming declarations for generic actuals do not come from source, -- and have a different name from that of the entity they rename, so -- there is no style check to perform here. if Chars (Nod) = Chars (Val_Actual) then Style.Check_Identifier (Nod, Val_Actual); end if; end if; Set_Entity (N, Val); end Set_Entity_With_Style_Check; ------------------------ -- Set_Name_Entity_Id -- ------------------------ procedure Set_Name_Entity_Id (Id : Name_Id; Val : Entity_Id) is begin Set_Name_Table_Info (Id, Int (Val)); end Set_Name_Entity_Id; --------------------- -- Set_Next_Actual -- --------------------- procedure Set_Next_Actual (Ass1_Id : Node_Id; Ass2_Id : Node_Id) is begin if Nkind (Parent (Ass1_Id)) = N_Parameter_Association then Set_First_Named_Actual (Parent (Ass1_Id), Ass2_Id); end if; end Set_Next_Actual; ----------------------- -- Set_Public_Status -- ----------------------- procedure Set_Public_Status (Id : Entity_Id) is S : constant Entity_Id := Current_Scope; begin -- Everything in the scope of Standard is public if S = Standard_Standard then Set_Is_Public (Id); -- Entity is definitely not public if enclosing scope is not public elsif not Is_Public (S) then return; -- An object declaration that occurs in a handled sequence of statements -- is the declaration for a temporary object generated by the expander. -- It never needs to be made public and furthermore, making it public -- can cause back end problems if it is of variable size. elsif Nkind (Parent (Id)) = N_Object_Declaration and then Nkind (Parent (Parent (Id))) = N_Handled_Sequence_Of_Statements then return; -- Entities in public packages or records are public elsif Ekind (S) = E_Package or Is_Record_Type (S) then Set_Is_Public (Id); -- The bounds of an entry family declaration can generate object -- declarations that are visible to the back-end, e.g. in the -- the declaration of a composite type that contains tasks. elsif Is_Concurrent_Type (S) and then not Has_Completion (S) and then Nkind (Parent (Id)) = N_Object_Declaration then Set_Is_Public (Id); end if; end Set_Public_Status; ---------------------------- -- Set_Scope_Is_Transient -- ---------------------------- procedure Set_Scope_Is_Transient (V : Boolean := True) is begin Scope_Stack.Table (Scope_Stack.Last).Is_Transient := V; end Set_Scope_Is_Transient; ------------------- -- Set_Size_Info -- ------------------- procedure Set_Size_Info (T1, T2 : Entity_Id) is begin -- We copy Esize, but not RM_Size, since in general RM_Size is -- subtype specific and does not get inherited by all subtypes. Set_Esize (T1, Esize (T2)); Set_Has_Biased_Representation (T1, Has_Biased_Representation (T2)); if Is_Discrete_Or_Fixed_Point_Type (T1) and then Is_Discrete_Or_Fixed_Point_Type (T2) then Set_Is_Unsigned_Type (T1, Is_Unsigned_Type (T2)); end if; Set_Alignment (T1, Alignment (T2)); end Set_Size_Info; -------------------- -- Static_Integer -- -------------------- function Static_Integer (N : Node_Id) return Uint is begin Analyze_And_Resolve (N, Any_Integer); if N = Error or else Error_Posted (N) or else Etype (N) = Any_Type then return No_Uint; end if; if Is_Static_Expression (N) then if not Raises_Constraint_Error (N) then return Expr_Value (N); else return No_Uint; end if; elsif Etype (N) = Any_Type then return No_Uint; else Flag_Non_Static_Expr ("static integer expression required here", N); return No_Uint; end if; end Static_Integer; -------------------------- -- Statically_Different -- -------------------------- function Statically_Different (E1, E2 : Node_Id) return Boolean is R1 : constant Node_Id := Get_Referenced_Object (E1); R2 : constant Node_Id := Get_Referenced_Object (E2); begin return Is_Entity_Name (R1) and then Is_Entity_Name (R2) and then Entity (R1) /= Entity (R2) and then not Is_Formal (Entity (R1)) and then not Is_Formal (Entity (R2)); end Statically_Different; ----------------------------- -- Subprogram_Access_Level -- ----------------------------- function Subprogram_Access_Level (Subp : Entity_Id) return Uint is begin if Present (Alias (Subp)) then return Subprogram_Access_Level (Alias (Subp)); else return Scope_Depth (Enclosing_Dynamic_Scope (Subp)); end if; end Subprogram_Access_Level; ----------------- -- Trace_Scope -- ----------------- procedure Trace_Scope (N : Node_Id; E : Entity_Id; Msg : String) is begin if Debug_Flag_W then for J in 0 .. Scope_Stack.Last loop Write_Str (" "); end loop; Write_Str (Msg); Write_Name (Chars (E)); Write_Str (" line "); Write_Int (Int (Get_Logical_Line_Number (Sloc (N)))); Write_Eol; end if; end Trace_Scope; ----------------------- -- Transfer_Entities -- ----------------------- procedure Transfer_Entities (From : Entity_Id; To : Entity_Id) is Ent : Entity_Id := First_Entity (From); begin if No (Ent) then return; end if; if (Last_Entity (To)) = Empty then Set_First_Entity (To, Ent); else Set_Next_Entity (Last_Entity (To), Ent); end if; Set_Last_Entity (To, Last_Entity (From)); while Present (Ent) loop Set_Scope (Ent, To); if not Is_Public (Ent) then Set_Public_Status (Ent); if Is_Public (Ent) and then Ekind (Ent) = E_Record_Subtype then -- The components of the propagated Itype must be public -- as well. declare Comp : Entity_Id; begin Comp := First_Entity (Ent); while Present (Comp) loop Set_Is_Public (Comp); Next_Entity (Comp); end loop; end; end if; end if; Next_Entity (Ent); end loop; Set_First_Entity (From, Empty); Set_Last_Entity (From, Empty); end Transfer_Entities; ----------------------- -- Type_Access_Level -- ----------------------- function Type_Access_Level (Typ : Entity_Id) return Uint is Btyp : Entity_Id; begin -- If the type is an anonymous access type we treat it as being -- declared at the library level to ensure that names such as -- X.all'access don't fail static accessibility checks. -- Ada 2005 (AI-230): In case of anonymous access types that are -- component_definition or discriminants of a nonlimited type, -- the level is the same as that of the enclosing component type. Btyp := Base_Type (Typ); if Ekind (Btyp) in Access_Kind then if Ekind (Btyp) = E_Anonymous_Access_Type and then not Is_Local_Anonymous_Access (Typ) -- Ada 2005 (AI-230) then return Scope_Depth (Standard_Standard); end if; Btyp := Root_Type (Btyp); -- The accessibility level of anonymous acccess types associated with -- discriminants is that of the current instance of the type, and -- that's deeper than the type itself (AARM 3.10.2 (12.3.21)). if Ekind (Typ) = E_Anonymous_Access_Type and then Present (Associated_Node_For_Itype (Typ)) and then Nkind (Associated_Node_For_Itype (Typ)) = N_Discriminant_Specification then return Scope_Depth (Enclosing_Dynamic_Scope (Btyp)) + 1; end if; end if; return Scope_Depth (Enclosing_Dynamic_Scope (Btyp)); end Type_Access_Level; -------------------------- -- Unit_Declaration_Node -- -------------------------- function Unit_Declaration_Node (Unit_Id : Entity_Id) return Node_Id is N : Node_Id := Parent (Unit_Id); begin -- Predefined operators do not have a full function declaration if Ekind (Unit_Id) = E_Operator then return N; end if; while Nkind (N) /= N_Abstract_Subprogram_Declaration and then Nkind (N) /= N_Formal_Package_Declaration and then Nkind (N) /= N_Function_Instantiation and then Nkind (N) /= N_Generic_Package_Declaration and then Nkind (N) /= N_Generic_Subprogram_Declaration and then Nkind (N) /= N_Package_Declaration and then Nkind (N) /= N_Package_Body and then Nkind (N) /= N_Package_Instantiation and then Nkind (N) /= N_Package_Renaming_Declaration and then Nkind (N) /= N_Procedure_Instantiation and then Nkind (N) /= N_Protected_Body and then Nkind (N) /= N_Subprogram_Declaration and then Nkind (N) /= N_Subprogram_Body and then Nkind (N) /= N_Subprogram_Body_Stub and then Nkind (N) /= N_Subprogram_Renaming_Declaration and then Nkind (N) /= N_Task_Body and then Nkind (N) /= N_Task_Type_Declaration and then Nkind (N) not in N_Formal_Subprogram_Declaration and then Nkind (N) not in N_Generic_Renaming_Declaration loop N := Parent (N); pragma Assert (Present (N)); end loop; return N; end Unit_Declaration_Node; ------------------------------ -- Universal_Interpretation -- ------------------------------ function Universal_Interpretation (Opnd : Node_Id) return Entity_Id is Index : Interp_Index; It : Interp; begin -- The argument may be a formal parameter of an operator or subprogram -- with multiple interpretations, or else an expression for an actual. if Nkind (Opnd) = N_Defining_Identifier or else not Is_Overloaded (Opnd) then if Etype (Opnd) = Universal_Integer or else Etype (Opnd) = Universal_Real then return Etype (Opnd); else return Empty; end if; else Get_First_Interp (Opnd, Index, It); while Present (It.Typ) loop if It.Typ = Universal_Integer or else It.Typ = Universal_Real then return It.Typ; end if; Get_Next_Interp (Index, It); end loop; return Empty; end if; end Universal_Interpretation; ---------------------- -- Within_Init_Proc -- ---------------------- function Within_Init_Proc return Boolean is S : Entity_Id; begin S := Current_Scope; while not Is_Overloadable (S) loop if S = Standard_Standard then return False; else S := Scope (S); end if; end loop; return Is_Init_Proc (S); end Within_Init_Proc; ---------------- -- Wrong_Type -- ---------------- procedure Wrong_Type (Expr : Node_Id; Expected_Type : Entity_Id) is Found_Type : constant Entity_Id := First_Subtype (Etype (Expr)); Expec_Type : constant Entity_Id := First_Subtype (Expected_Type); function Has_One_Matching_Field return Boolean; -- Determines if Expec_Type is a record type with a single component or -- discriminant whose type matches the found type or is one dimensional -- array whose component type matches the found type. ---------------------------- -- Has_One_Matching_Field -- ---------------------------- function Has_One_Matching_Field return Boolean is E : Entity_Id; begin if Is_Array_Type (Expec_Type) and then Number_Dimensions (Expec_Type) = 1 and then Covers (Etype (Component_Type (Expec_Type)), Found_Type) then return True; elsif not Is_Record_Type (Expec_Type) then return False; else E := First_Entity (Expec_Type); loop if No (E) then return False; elsif (Ekind (E) /= E_Discriminant and then Ekind (E) /= E_Component) or else (Chars (E) = Name_uTag or else Chars (E) = Name_uParent) then Next_Entity (E); else exit; end if; end loop; if not Covers (Etype (E), Found_Type) then return False; elsif Present (Next_Entity (E)) then return False; else return True; end if; end if; end Has_One_Matching_Field; -- Start of processing for Wrong_Type begin -- Don't output message if either type is Any_Type, or if a message -- has already been posted for this node. We need to do the latter -- check explicitly (it is ordinarily done in Errout), because we -- are using ! to force the output of the error messages. if Expec_Type = Any_Type or else Found_Type = Any_Type or else Error_Posted (Expr) then return; -- In an instance, there is an ongoing problem with completion of -- type derived from private types. Their structure is what Gigi -- expects, but the Etype is the parent type rather than the -- derived private type itself. Do not flag error in this case. The -- private completion is an entity without a parent, like an Itype. -- Similarly, full and partial views may be incorrect in the instance. -- There is no simple way to insure that it is consistent ??? elsif In_Instance then if Etype (Etype (Expr)) = Etype (Expected_Type) and then (Has_Private_Declaration (Expected_Type) or else Has_Private_Declaration (Etype (Expr))) and then No (Parent (Expected_Type)) then return; end if; end if; -- An interesting special check. If the expression is parenthesized -- and its type corresponds to the type of the sole component of the -- expected record type, or to the component type of the expected one -- dimensional array type, then assume we have a bad aggregate attempt. if Nkind (Expr) in N_Subexpr and then Paren_Count (Expr) /= 0 and then Has_One_Matching_Field then Error_Msg_N ("positional aggregate cannot have one component", Expr); -- Another special check, if we are looking for a pool-specific access -- type and we found an E_Access_Attribute_Type, then we have the case -- of an Access attribute being used in a context which needs a pool- -- specific type, which is never allowed. The one extra check we make -- is that the expected designated type covers the Found_Type. elsif Is_Access_Type (Expec_Type) and then Ekind (Found_Type) = E_Access_Attribute_Type and then Ekind (Base_Type (Expec_Type)) /= E_General_Access_Type and then Ekind (Base_Type (Expec_Type)) /= E_Anonymous_Access_Type and then Covers (Designated_Type (Expec_Type), Designated_Type (Found_Type)) then Error_Msg_N ("result must be general access type!", Expr); Error_Msg_NE ("add ALL to }!", Expr, Expec_Type); -- If the expected type is an anonymous access type, as for access -- parameters and discriminants, the error is on the designated types. elsif Ekind (Expec_Type) = E_Anonymous_Access_Type then if Comes_From_Source (Expec_Type) then Error_Msg_NE ("expected}!", Expr, Expec_Type); else Error_Msg_NE ("expected an access type with designated}", Expr, Designated_Type (Expec_Type)); end if; if Is_Access_Type (Found_Type) and then not Comes_From_Source (Found_Type) then Error_Msg_NE ("found an access type with designated}!", Expr, Designated_Type (Found_Type)); else if From_With_Type (Found_Type) then Error_Msg_NE ("found incomplete}!", Expr, Found_Type); Error_Msg_NE ("\possibly missing with_clause on&", Expr, Scope (Found_Type)); else Error_Msg_NE ("found}!", Expr, Found_Type); end if; end if; -- Normal case of one type found, some other type expected else -- If the names of the two types are the same, see if some -- number of levels of qualification will help. Don't try -- more than three levels, and if we get to standard, it's -- no use (and probably represents an error in the compiler) -- Also do not bother with internal scope names. declare Expec_Scope : Entity_Id; Found_Scope : Entity_Id; begin Expec_Scope := Expec_Type; Found_Scope := Found_Type; for Levels in Int range 0 .. 3 loop if Chars (Expec_Scope) /= Chars (Found_Scope) then Error_Msg_Qual_Level := Levels; exit; end if; Expec_Scope := Scope (Expec_Scope); Found_Scope := Scope (Found_Scope); exit when Expec_Scope = Standard_Standard or else Found_Scope = Standard_Standard or else not Comes_From_Source (Expec_Scope) or else not Comes_From_Source (Found_Scope); end loop; end; if Is_Record_Type (Expec_Type) and then Present (Corresponding_Remote_Type (Expec_Type)) then Error_Msg_NE ("expected}!", Expr, Corresponding_Remote_Type (Expec_Type)); else Error_Msg_NE ("expected}!", Expr, Expec_Type); end if; if Is_Entity_Name (Expr) and then Is_Package_Or_Generic_Package (Entity (Expr)) then Error_Msg_N ("found package name!", Expr); elsif Is_Entity_Name (Expr) and then (Ekind (Entity (Expr)) = E_Procedure or else Ekind (Entity (Expr)) = E_Generic_Procedure) then if Ekind (Expec_Type) = E_Access_Subprogram_Type then Error_Msg_N ("found procedure name, possibly missing Access attribute!", Expr); else Error_Msg_N ("found procedure name instead of function!", Expr); end if; elsif Nkind (Expr) = N_Function_Call and then Ekind (Expec_Type) = E_Access_Subprogram_Type and then Etype (Designated_Type (Expec_Type)) = Etype (Expr) and then No (Parameter_Associations (Expr)) then Error_Msg_N ("found function name, possibly missing Access attribute!", Expr); -- Catch common error: a prefix or infix operator which is not -- directly visible because the type isn't. elsif Nkind (Expr) in N_Op and then Is_Overloaded (Expr) and then not Is_Immediately_Visible (Expec_Type) and then not Is_Potentially_Use_Visible (Expec_Type) and then not In_Use (Expec_Type) and then Has_Compatible_Type (Right_Opnd (Expr), Expec_Type) then Error_Msg_N ("operator of the type is not directly visible!", Expr); elsif Ekind (Found_Type) = E_Void and then Present (Parent (Found_Type)) and then Nkind (Parent (Found_Type)) = N_Full_Type_Declaration then Error_Msg_NE ("found premature usage of}!", Expr, Found_Type); else Error_Msg_NE ("found}!", Expr, Found_Type); end if; Error_Msg_Qual_Level := 0; end if; end Wrong_Type; end Sem_Util;
x86/nasm.asm
doczkal/OwO
101
169531
%ifdef MSVC ; MSVC puts underscores before its symbols in C %define main _main %define puts _puts %endif global main extern puts section .text main: push message call puts pop eax xor eax, eax retn section .data message: db " *Notices Bulge*", 10 db "__ ___ _ _ _ _ _", 10 db "\ \ / / |__ __ _| |_ ( ) ___ | |_| |__ (_) ___", 10 db " \ \ /\ / /| '_ \ / _\`| __|// / __| | __| '_ \| |/ __|", 10 db " \ V V / | | | | (_| | |_ \__ \ | |_| | | | |\__ \", 10 db " \_/\_/ |_| |_|\__,_|\__| |___/ \___|_| |_|_|/___/", 0
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_1388.asm
ljhsiun2/medusa
9
14892
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r15 push %r9 push %rax push %rbp push %rbx // Store lea addresses_PSE+0xe9e2, %r12 nop nop nop nop sub %rax, %rax mov $0x5152535455565758, %r9 movq %r9, (%r12) nop nop nop nop nop inc %r10 // Store lea addresses_normal+0x1a0f6, %rbp nop nop nop nop cmp $79, %r10 movl $0x51525354, (%rbp) sub %rbp, %rbp // Store lea addresses_RW+0x15ce2, %rbp nop nop nop cmp $29614, %r9 movb $0x51, (%rbp) nop add %rbx, %rbx // Load mov $0x3e2, %r12 nop nop nop nop nop xor %r15, %r15 mov (%r12), %ax nop nop nop add %r15, %r15 // Load lea addresses_WT+0x75c2, %r9 nop nop nop nop nop and %rax, %rax mov (%r9), %bx nop nop sub %r9, %r9 // Faulty Load lea addresses_WT+0x157e2, %rax nop nop nop add %r15, %r15 mov (%rax), %r10w lea oracles, %rbx and $0xff, %r10 shlq $12, %r10 mov (%rbx,%r10,1), %r10 pop %rbx pop %rbp pop %rax pop %r9 pop %r15 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': True, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 8}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_RW', 'AVXalign': False, 'size': 1}} {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_P', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'} <gen_prepare_buffer> {'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 */
data/special_warps.asm
AmateurPanda92/pokemon-rby-dx
9
26165
<reponame>AmateurPanda92/pokemon-rby-dx<gh_stars>1-10 ; Format: (size 2 bytes) ; 00: target map ID ; 01: which dungeon warp in the source map was used DungeonWarpList: db SEAFOAM_ISLANDS_B1F,$01 db SEAFOAM_ISLANDS_B1F,$02 db SEAFOAM_ISLANDS_B2F,$01 db SEAFOAM_ISLANDS_B2F,$02 db SEAFOAM_ISLANDS_B3F,$01 db SEAFOAM_ISLANDS_B3F,$02 db SEAFOAM_ISLANDS_B4F,$01 db SEAFOAM_ISLANDS_B4F,$02 db VICTORY_ROAD_2F,$02 db POKEMON_MANSION_1F,$01 db POKEMON_MANSION_1F,$02 db POKEMON_MANSION_2F,$03 db $FF DungeonWarpData: FLYWARP_DATA SEAFOAM_ISLANDS_B1F_WIDTH,7,18 FLYWARP_DATA SEAFOAM_ISLANDS_B1F_WIDTH,7,23 FLYWARP_DATA SEAFOAM_ISLANDS_B2F_WIDTH,7,19 FLYWARP_DATA SEAFOAM_ISLANDS_B2F_WIDTH,7,22 FLYWARP_DATA SEAFOAM_ISLANDS_B3F_WIDTH,7,18 FLYWARP_DATA SEAFOAM_ISLANDS_B3F_WIDTH,7,19 FLYWARP_DATA SEAFOAM_ISLANDS_B4F_WIDTH,14,4 FLYWARP_DATA SEAFOAM_ISLANDS_B4F_WIDTH,14,5 FLYWARP_DATA VICTORY_ROAD_2F_WIDTH,16,22 FLYWARP_DATA POKEMON_MANSION_1F_WIDTH,14,16 FLYWARP_DATA POKEMON_MANSION_1F_WIDTH,14,16 FLYWARP_DATA POKEMON_MANSION_2F_WIDTH,14,18 ;Format: ; db Map_id ; FLYWARP_DATA [Map Width][Y-pos][X-pos] ; db Tileset_id FirstMapSpec: db REDS_HOUSE_2F FLYWARP_DATA REDS_HOUSE_2F_WIDTH,6,3 db REDS_HOUSE_2 TradeCenterSpec1: db TRADE_CENTER FLYWARP_DATA TRADE_CENTER_WIDTH,4,3 db CLUB TradeCenterSpec2: db TRADE_CENTER FLYWARP_DATA TRADE_CENTER_WIDTH,4,6 db CLUB ColosseumSpec1: db COLOSSEUM FLYWARP_DATA COLOSSEUM_WIDTH,4,3 db CLUB ColosseumSpec2: db COLOSSEUM FLYWARP_DATA COLOSSEUM_WIDTH,4,6 db CLUB FlyWarpDataPtr: db PALLET_TOWN, 0 dw PalletTownFlyWarp db VIRIDIAN_CITY, 0 dw ViridianCityFlyWarp db PEWTER_CITY, 0 dw PewterCityFlyWarp db CERULEAN_CITY, 0 dw CeruleanCityFlyWarp db LAVENDER_TOWN, 0 dw LavenderTownFlyWarp db VERMILION_CITY, 0 dw VermilionCityFlyWarp db CELADON_CITY, 0 dw CeladonCityFlyWarp db FUCHSIA_CITY, 0 dw FuchsiaCityFlyWarp db CINNABAR_ISLAND, 0 dw CinnabarIslandFlyWarp db INDIGO_PLATEAU, 0 dw IndigoPlateauFlyWarp db SAFFRON_CITY, 0 dw SaffronCityFlyWarp db ROUTE_4, 0 dw Route4FlyWarp db ROUTE_10, 0 dw Route10FlyWarp ; Original Format: ; [Event Displacement][Y-block][X-block][Y-sub_block][X-sub_block] ; Macro Format: ; FLYWARP_DATA [Map Width][Y-pos][X-pos] PalletTownFlyWarp: FLYWARP_DATA PALLET_TOWN_WIDTH, 6, 5 ViridianCityFlyWarp: FLYWARP_DATA VIRIDIAN_CITY_WIDTH, 26, 23 PewterCityFlyWarp: FLYWARP_DATA PEWTER_CITY_WIDTH, 26, 13 CeruleanCityFlyWarp: FLYWARP_DATA CERULEAN_CITY_WIDTH, 18, 19 LavenderTownFlyWarp: FLYWARP_DATA LAVENDER_TOWN_WIDTH, 6, 3 VermilionCityFlyWarp: FLYWARP_DATA VERMILION_CITY_WIDTH, 4, 11 CeladonCityFlyWarp: FLYWARP_DATA CELADON_CITY_WIDTH, 10, 41 FuchsiaCityFlyWarp: FLYWARP_DATA FUCHSIA_CITY_WIDTH, 28, 19 CinnabarIslandFlyWarp: FLYWARP_DATA CINNABAR_ISLAND_WIDTH, 12, 11 IndigoPlateauFlyWarp: FLYWARP_DATA INDIGO_PLATEAU_WIDTH, 6, 9 SaffronCityFlyWarp: FLYWARP_DATA SAFFRON_CITY_WIDTH, 30, 9 Route4FlyWarp: FLYWARP_DATA ROUTE_4_WIDTH, 6, 11 Route10FlyWarp: FLYWARP_DATA ROUTE_10_WIDTH, 20, 11
codes/low-level/ch02/strlen.asm
zhoujiagen/learning-system-programming
0
10772
%include "../lib/syscall.inc" section .data test_string: db "abcdef", 0 section .text global _start strlen: xor rax, rax ; rax with hold string length .loop: cmp byte [rdi+rax], 0 je .end inc rax jmp .loop .end: ret _start: ; syscall arguments: rax, rdi, rsi, rdx, r10, r8, r9 ; syscall changes: rcx, r11 mov rdi, test_string call strlen mov rdi, rax mov rax, NR_EXIT syscall
Structure/Sets/ZFC/Classical.agda
Lolirofle/stuff-in-agda
6
13688
open import Type open import Structure.Relator open import Structure.Setoid renaming (_≡_ to _≡ₑ_) module Structure.Sets.ZFC.Classical {ℓₛ ℓₗ ℓₑ} {S : Type{ℓₛ}} ⦃ equiv : Equiv{ℓₑ}(S) ⦄ (_∈_ : S → S → Type{ℓₗ}) ⦃ [∈]-binaryRelator : BinaryRelator(_∈_) ⦄ where open import Data.Either as Either using () open import Functional open import Logic.Classical open import Logic.Predicate open import Logic.Propositional open import Logic.Propositional.Theorems import Lvl open import Structure.Operator open import Structure.Relator.Proofs open import Structure.Relator.Properties import Structure.Sets.Names open Structure.Sets.Names.From-[∈] (_∈_) open Structure.Sets.Names.Relations (_∈_) open import Structure.Sets.ZFC(_∈_) ⦃ [∈]-binaryRelator ⦄ open import Syntax.Function open import Syntax.Implication open import Syntax.Transitivity private variable ℓ : Lvl.Level private variable T A B : Type{ℓ} private variable x : S module _ ⦃ zfc : ZFC ⦄ where open ZFC(zfc) -- ZFC implies excluded middle. -- Note that this only requires the following set related axioms: -- • Set extensionality (Not really neccessary if every equality is replaced with set equality instead). -- • Axiom of choice (TODO: Is this really neccessary? The proof only uses the choice function on finite sets? Further investigation on choice functions for finite sets would clear this up). -- • Choice functions are functions. -- • Restricted set comprehension. -- • Existence of at least two different sets (In this proof, ∅ and {∅} (𝑇 and 𝐹) is used). -- • Existence of a set containing the two different sets, and the existence of all subsets of this set. -- Also called: Diaconescu's theorem, Goodman–Myhill theorem. excluded-middle-by-choice : ∀{P : Type{ℓ}} → Classical(P) excluded-middle-by-choice{P = P} = intro $ᵢₙₛₜ let instance pos-rel : UnaryRelator(x ↦ P ∨ (x ≡ 𝑇)) pos-rel = [∨]-unaryRelator ⦃ rel-Q = binary-unaryRelatorᵣ ⦄ instance neg-rel : UnaryRelator(x ↦ P ∨ (x ≡ 𝐹)) neg-rel = [∨]-unaryRelator ⦃ rel-Q = binary-unaryRelatorᵣ ⦄ pos = filter (x ↦ P ∨ (x ≡ 𝑇)) BoolSet neg = filter (x ↦ P ∨ (x ≡ 𝐹)) BoolSet -- The contents of pos by definition. A subset of BoolSet which is equal to BoolSet when P, {𝑇} otherwise. pos-containment : (x ∈ pos) ↔ (x ∈ BoolSet) ∧ (P ∨ (x ≡ 𝑇)) pos-containment = restricted-comprehension -- The contents of neg by definition. A subset of BoolSet which is equal to BoolSet when P, {𝐹} otherwise. neg-containment : (x ∈ neg) ↔ (x ∈ BoolSet) ∧ (P ∨ (x ≡ 𝐹)) neg-containment = restricted-comprehension -- pos is non-empty because it should at least contain 𝑇 from filtering BoolSet. instance ne-pos : NonEmpty(pos) ne-pos = [↔]-to-[←] (nonEmpty-filter) ([∃]-intro 𝑇 ⦃ [∧]-intro 𝑇-in-BoolSet ([∨]-introᵣ (\{_} → [↔]-reflexivity)) ⦄) -- neg is non-empty because it should at least contain 𝐹 from filtering BoolSet. instance ne-neg : NonEmpty(neg) ne-neg = [↔]-to-[←] (nonEmpty-filter) ([∃]-intro 𝐹 ⦃ [∧]-intro 𝐹-in-BoolSet ([∨]-introᵣ (\{_} → [↔]-reflexivity)) ⦄) -- Chooses an element in respective sets pos and neg. pos-choose = choose (pair pos neg) pos neg-choose = choose (pair pos neg) neg -- By definition of pos, either P holds or pos-choose have to be 𝑇. pos-choice : P ∨ (pos-choose ≡ 𝑇) pos-choice = [∧]-elimᵣ ([↔]-to-[→] pos-containment (choice {pair pos neg} {pos} ⦃ ne-pos ⦄ ⦃ pair-contains-left ⦄)) -- By definition of neg, either P holds or neg-choose have to be 𝐹. neg-choice : P ∨ (neg-choose ≡ 𝐹) neg-choice = [∧]-elimᵣ ([↔]-to-[→] neg-containment (choice {pair pos neg} {neg} ⦃ ne-neg ⦄ ⦃ pair-contains-right ⦄)) in • ( -- Contrapositive of the argument below states that if pos-choose and neg-choose is inequal, then (¬ P) (_⇒ -- When P holds, both pos and neg is BoolSet, so they are equal. The pos-choose and neg-choose is the choice function applied to the equal sets pos and neg respectively, and because choose is a function (it respects equality, specifically set equality), pos-choose and neg-choose is also equal. P ⇒-[ (\p {x} → [↔]-transitivity (pos-containment {x}) ([↔]-transitivity ([∧]-mapᵣ-[↔] ([↔]-intro (const([∨]-introₗ p)) (const([∨]-introₗ p)))) ([↔]-symmetry (neg-containment {x})))) ] (pos ≡ neg) ⇒-[ [↔]-to-[←] set-extensionality ] (pos ≡ₑ neg) ⇒-[ congruence₂(choose) (reflexivity(_≡ₑ_)) ] (pos-choose ≡ₑ neg-choose) ⇒-end ) ⇒ (P → (pos-choose ≡ₑ neg-choose)) ⇒-[ contrapositiveᵣ ] ((¬ P) ← (pos-choose ≢ neg-choose)) ⇒-end ) • ( -- The case other than P is that pos and neg only contains 𝑇 and 𝐹 respectively. This forces pos-choose and neg-choose to be 𝑇 and 𝐹 respectively, which means that they are inequal. • pos-choice • neg-choice ⇒₂-[ [∧]-intro ] (P ∨ (pos-choose ≡ 𝑇)) ∧ (P ∨ (neg-choose ≡ 𝐹)) ⇒-[ [↔]-to-[←] [∨][∧]-distributivityₗ ] P ∨ ((pos-choose ≡ 𝑇) ∧ (neg-choose ≡ 𝐹)) ⇒-[ Either.mapRight (\{([∧]-intro p0 n1) → [≡][≢]-semitransitivityᵣ([≡][≢]-semitransitivityₗ ([↔]-to-[←] set-extensionality p0) zero-one-ineq) (symmetry(_≡ₑ_) ([↔]-to-[←] set-extensionality n1))}) ] P ∨ (pos-choose ≢ neg-choose) ⇒-end ) ⇒₂-[ Either.mapRight ] (P ∨ (¬ P)) ⇒-end