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 |
|---|---|---|---|---|
programs/oeis/098/A098848.asm | karttu/loda | 1 | 173497 | ; A098848: a(n) = n*(n + 14).
; 0,15,32,51,72,95,120,147,176,207,240,275,312,351,392,435,480,527,576,627,680,735,792,851,912,975,1040,1107,1176,1247,1320,1395,1472,1551,1632,1715,1800,1887,1976,2067,2160,2255,2352,2451,2552,2655,2760,2867,2976,3087,3200,3315,3432,3551,3672,3795,3920,4047,4176,4307,4440,4575,4712,4851,4992,5135,5280,5427,5576,5727,5880,6035,6192,6351,6512,6675,6840,7007,7176,7347,7520,7695,7872,8051,8232,8415,8600,8787,8976,9167,9360,9555,9752,9951,10152,10355,10560,10767,10976,11187,11400,11615,11832,12051,12272,12495,12720,12947,13176,13407,13640,13875,14112,14351,14592,14835,15080,15327,15576,15827,16080,16335,16592,16851,17112,17375,17640,17907,18176,18447,18720,18995,19272,19551,19832,20115,20400,20687,20976,21267,21560,21855,22152,22451,22752,23055,23360,23667,23976,24287,24600,24915,25232,25551,25872,26195,26520,26847,27176,27507,27840,28175,28512,28851,29192,29535,29880,30227,30576,30927,31280,31635,31992,32351,32712,33075,33440,33807,34176,34547,34920,35295,35672,36051,36432,36815,37200,37587,37976,38367,38760,39155,39552,39951,40352,40755,41160,41567,41976,42387,42800,43215,43632,44051,44472,44895,45320,45747,46176,46607,47040,47475,47912,48351,48792,49235,49680,50127,50576,51027,51480,51935,52392,52851,53312,53775,54240,54707,55176,55647,56120,56595,57072,57551,58032,58515,59000,59487,59976,60467,60960,61455,61952,62451,62952,63455,63960,64467,64976,65487
mov $1,$0
add $0,14
mul $1,$0
|
src/main/antlr4/io/alef/llvm/LLVM.g4 | snefru/io.alef.llvm | 4 | 7654 | <gh_stars>1-10
grammar LLVM;
module : entity*;
alignment : 'align' IntegerLiteral;
AtomicOrdering : 'unordered'
| 'monotonic'
| 'acquire'
| 'release'
| 'acq_rel'
| 'seq_cst'
;
argument : type parameterAttribute* MetadataIdentifier //todo review
| type parameterAttribute* value
;
argumentList : argument(',' argument)*;
basicBlock : (Label)? (statement)+
| Label
;
clause : 'catch' typedValue
| 'filter' typedValue
;
comdat : 'comdat' ( '(' ComdatIdentifier ')' )?;
entity : 'define' functionHeader functionBody //todo functionMetadata
| 'declare' functionHeader
| 'module' 'asm' String
| 'target' 'triple' '=' String
| 'target' 'datalayout' '=' String
| 'deplibs' '=' '[' ']'
| 'deplibs' '=' '[' String (',' String)* ']'
| LocalIdentifier '=' 'type' type
| GlobalIdentifier '=' Linkage?
Visibility?
DllStorageClass?
('thread_local' ('(' ThreadLocalStorage ')')?)?
UnamedAddress?
addressSpace?
'externally_initialized'?
GlobalType
type
value?
(',' section)?
(',' comdat)?
(',' alignment)?
| GlobalIdentifier '=' Linkage?
Visibility?
DllStorageClass?
('thread_local' ('(' ThreadLocalStorage ')')?)?
UnamedAddress?
'alias'
typedValue
| ComdatIdentifier '=' 'comdat' SelectionKind
| MetadataIdentifier '=' 'distinct'? metadata
| 'attributes' AttributeGroupID '=' '{' functionAttribute* '}'
;
metadata : MetadataIdentifier
| '!'String
| value
| typedValue
| '!''{' (metadata (',' metadata)*)? '}'
;
addressSpace : 'addrspace' '(' IntegerLiteral ')';
functionAttribute : AttributeGroupID ('{' functionAttribute* '}')?
| 'alignstack' IntegerLiteral
| 'alignstack' '=' IntegerLiteral //attribute group format
| 'align' IntegerLiteral
| 'align' '=' IntegerLiteral //attribute group format
| String '=' String
| 'alwaysinline'
| 'builtin'
| 'cold'
| 'convergent'
| 'inaccessiblememonly'
| 'inaccessiblemem_or_argmemonly'
| 'inlinehint'
| 'jumptable'
| 'minsize'
| 'naked'
| 'nobuiltin'
| 'noduplicate'
| 'noimplicitfloat'
| 'noinline'
| 'nonlazybind'
| 'noredzone'
| 'noreturn'
| 'norecurse'
| 'nounwind'
| 'optnone'
| 'optsize'
| 'readnone'
| 'readonly'
| 'argmemonly' //not in c++
| 'returns_twice'
| 'ssp'
| 'sspreq'
| 'sspstrong'
| 'safestack'
| 'sanitize_address'
| 'sanitize_thread'
| 'sanitize_memory'
| 'uwtable'
| 'thunk' //not in c++
| String
;
functionHeader : Linkage?
Visibility?
DllStorageClass?
CallingConvention?
returnAttribute*
type
GlobalIdentifier
'(' parameterList? ')'
UnamedAddress?
functionAttribute*
section?
comdat?
alignment?
('gc' String)?
('prefix' typedValue)?
('prologue' typedValue)?
('personality' typedValue)?
(MetadataIdentifier MetadataIdentifier)*
;
functionBody : '{' basicBlock+ '}'; //todo useListOrderDirective*
GlobalType : 'global'
| 'constant'
;
instruction : 'ret' typedValue
| 'ret' 'void'
| 'br' typedValue
| 'br' typedValue ',' typedValue ',' typedValue
| 'switch' typedValue ',' typedValue '[' (typedValue',' typedValue)* ']'
| 'indirectbr' typedValue ',' '[' typedValue (',' typedValue)* ']'
| 'invoke'
CallingConvention?
returnAttribute*
type
GlobalIdentifier
'(' argumentList? ')'
functionAttribute*
('[' operandBundle (',' operandBundle)* ']')?
'to' typedValue
'unwind' typedValue
| 'resume' typedValue
| 'cleanupret' 'from' value 'unwind' 'to' 'caller'
| 'cleanupret' 'from' value 'unwind' typedValue
| 'catchret' 'from' value 'to' typedValue
| 'catchswitch' 'within' value '[' typedValue (',' typedValue)* ']' 'unwind' 'to' 'caller'
| 'catchswitch' 'within' value '[' typedValue (',' typedValue)* ']' 'unwind' typedValue
| 'catchpad' 'within' value '[' (typedValue (',' typedValue)*)? ']'
| 'cleanuppad' 'within' value '[' (typedValue (',' typedValue)*)? ']'
| 'add' 'nuw'? 'nsw'? type value ',' value
| 'sub' 'nuw'? 'nsw'? type value ',' value
| 'mul' 'nuw'? 'nsw'? type value ',' value
| 'shl' 'nuw'? 'nsw'? type value ',' value
| 'fadd' FastMathsFlag* type value ',' value
| 'fsub' FastMathsFlag* type value ',' value
| 'fmul' FastMathsFlag* type value ',' value
| 'fdiv' FastMathsFlag* type value ',' value
| 'frem' FastMathsFlag* type value ',' value
| 'sdiv' 'exact'? type value ',' value
| 'udiv' 'exact'? type value ',' value
| 'lshr' 'exact'? type value ',' value
| 'ashr' 'exact'? type value ',' value
| 'urem' type value ',' value
| 'srem' type value ',' value
| 'and' type value ',' value
| 'or' type value ',' value
| 'xor' type value ',' value
| 'icmp' intPredicate type value ',' value
| 'fcmp' FastMathsFlag* fpPredicate type value ',' value
| 'trunc' typedValue 'to' type
| 'zext' typedValue 'to' type
| 'sext' typedValue 'to' type
| 'sext' typedValue 'to' type
| 'fptrunc' typedValue 'to' type
| 'fpext' typedValue 'to' type
| 'bitcast' typedValue 'to' type
| 'addrspacecast' typedValue 'to' type
| 'uitofp' typedValue 'to' type
| 'sitofp' typedValue 'to' type
| 'fptoui' typedValue 'to' type
| 'fptosi' typedValue 'to' type
| 'inttoptr' typedValue 'to' type
| 'ptrtoint' typedValue 'to' type
| 'select' typedValue ',' typedValue ','typedValue
| 'va_arg' typedValue ',' type
| 'extractelement' typedValue ',' typedValue
| 'insertelement' typedValue ',' typedValue ',' typedValue
| 'shufflevector' typedValue ',' typedValue ',' typedValue
| 'phi' type '[' value ',' value ']' (',' '[' value ',' value ']')*
| 'landingpad' type 'cleanup' clause*
| 'landingpad' type clause+
| ('tail'| 'musttail'|'notail')? 'call' FastMathsFlag* CallingConvention? returnAttribute* type value '(' argumentList? ')' functionAttribute* operandBundle*
| 'alloca' 'inalloca'? type (',' typedValue)? (',' 'align' IntegerLiteral)?
| 'load' 'volatile'? type ',' typedValue (',' 'align' IntegerLiteral)?
| 'load' 'atomic' 'volatile'? type ',' typedValue 'singlethread'? AtomicOrdering (',' 'align' IntegerLiteral)?
| 'store' 'volatile'? typedValue ',' typedValue (',' 'align' IntegerLiteral)?
| 'store' 'atomic' 'volatile'? typedValue ',' typedValue 'singlethread'? AtomicOrdering (',' 'align' IntegerLiteral)?
| 'cmpxchg' Weak? 'volatile'? typedValue ',' typedValue ',' typedValue 'singlethread'? AtomicOrdering AtomicOrdering
| 'atomicrmw' 'volatile'? operation typedValue ',' typedValue 'singlethread'? AtomicOrdering
| 'fence' 'singlethread'? AtomicOrdering
| 'getelementptr' 'inbounds'? type ',' typedValue (',' typedValue)*
| 'extractvalue' typedValue (',' index)+
| 'insertvalue' typedValue ',' typedValue(',' index)+
| 'unreachable'
;
//nameValue : Identifier ':' value
//nameValue | Identifier ':' MetadataIdentifier;
operation : 'xchg'
| 'add'
| 'sub'
| 'and'
| 'nand'
| 'or'
| 'xor'
| 'max'
| 'min'
| 'umax'
| 'umin'
;
operandBundle : String '(' typedValue (',' typedValue) * ')';
parameter : type parameterAttribute* LocalIdentifier?
| '...' //must be last
;
parameterAttribute : 'align' IntegerLiteral
| 'byval'
| 'dereferenceable' '(' IntegerLiteral ')'
| 'dereferenceable_or_null' '(' IntegerLiteral ')'
| 'inalloca'
| 'inreg'
| 'nest'
| 'noalias'
| 'nocapture'
| 'nonnull'
| 'readnone'
| 'readonly'
| 'returned'
| 'signext'
| 'sret'
| 'zeroext'
| String
;
parameterList : parameter (',' parameter)*;
returnAttribute : String
| 'dereferenceable_or_null' '(' IntegerLiteral ')'
| 'dereferenceable' '(' IntegerLiteral ')'
| 'align' IntegerLiteral
| 'inreg'
| 'noalias'
| 'nonnull'
| 'signext'
| 'zeroext'
;
section : 'section' String;
SelectionKind : 'any'
| 'exactmatch'
| 'largest'
| 'noduplicates'
| 'samesize'
;
statement : (LocalIdentifier '=')? instruction (',' MetadataIdentifier metadata)*;
type : IntegerType
| 'half'
| 'float'
| 'double'
| 'fp128'
| 'x86_fp80'
| 'ppc_fp128'
| 'x86_mmx'
| type 'addrspace' '(' IntegerLiteral ')' '*'
| type '*'
| '<' IntegerLiteral 'x' type '>'
| 'label'
| 'token'
| 'metadata'
| '[' IntegerLiteral 'x' type ']'
| '{' (type (',' type)*)? '}'
| '<' ('{' type (',' type)* '}')? '>'
| 'opaque'
| 'void'
| type '(' (type ',')* (type|'...')? ')'
| LocalIdentifier
;
typedValue : type value;
value : GlobalIdentifier
| LocalIdentifier
| FloatLiteral
| IntegerLiteral
| CharArrayLiteral
| 'true'
| 'false'
| 'null'
| 'undef'
| 'zeroinitializer'
| 'none'
| '{' typedValue (',' typedValue)* '}'
| '<' typedValue (',' typedValue)* '>'
| '[' typedValue (',' typedValue)* ']'
| 'asm' 'sideeffect'? 'alignstack'? 'inteldialect'? String ',' String
| 'blockaddress' '(' GlobalIdentifier ',' LocalIdentifier ')'
// http://llvm.org/docs/LangRef.html#constant-expressions
| 'trunc' '(' typedValue 'to' type ')'
| 'zext' '(' typedValue 'to' type ')'
| 'sext' '(' typedValue 'to' type ')'
| 'fptrunc' '(' typedValue 'to' type ')'
| 'fpext' '(' typedValue 'to' type ')'
| 'bitcast' '(' typedValue 'to' type ')'
| 'addrspacecast' '(' typedValue 'to' type ')'
| 'uitofp' '(' typedValue 'to' type ')'
| 'sitofp' '(' typedValue 'to' type ')'
| 'fptoui' '(' typedValue 'to' type ')'
| 'inttoptr' '(' typedValue 'to' type ')'
| 'ptrtoint' '(' typedValue 'to' type ')'
| 'insertvalue' '(' value ',' value (',' index )+ ')'
| 'icmp' intPredicate '(' typedValue ',' typedValue ')'
| 'fcmp' fpPredicate '(' typedValue ',' typedValue ')'
| 'fadd' '(' typedValue ',' typedValue ')'
| 'fsub' '(' typedValue ',' typedValue ')'
| 'add' 'nuw'? 'nsw'? '(' typedValue ',' typedValue ')'
| 'sub' 'nuw'? 'nsw'? '(' typedValue ',' typedValue ')'
| 'mul' 'nuw'? 'nsw'? '(' typedValue ',' typedValue ')'
| 'shl' 'nuw'? 'nsw'? '(' typedValue ',' typedValue ')'
| 'fmul' '(' typedValue ',' typedValue ')'
| 'udiv' '(' typedValue ',' typedValue ')'
| 'sdiv' '(' typedValue ',' typedValue ')'
| 'fdiv' '(' typedValue ',' typedValue ')'
| 'urem' '(' typedValue ',' typedValue ')'
| 'srem' '(' typedValue ',' typedValue ')'
| 'frem' '(' typedValue ',' typedValue ')'
| 'lshl' '(' typedValue ',' typedValue ')'
| 'ashr' '(' typedValue ',' typedValue ')'
| 'and' '(' typedValue ',' typedValue ')'
| 'or' '(' typedValue ',' typedValue ')'
| 'xor' '(' typedValue ',' typedValue ')'
| 'getelementptr' 'inbounds'? '(' type ',' typedValue (',' typedValue)* ')'
| 'shufflevector' '(' typedValue ',' typedValue ',' typedValue ')'
| 'insertelement' '(' typedValue ',' typedValue ',' typedValue ')'
| 'extractelement' '(' typedValue ',' typedValue ')'
| 'select' '(' typedValue ',' typedValue ','typedValue ')'
;
index : IntegerLiteral
| MetadataIdentifier
;
AttributeGroupID : '#' Digit+;
UnamedAddress : 'unnamed_addr';
CallingConvention : 'ccc'
| 'fastcc'
| 'coldcc'
| 'x86_stdcallcc'
| 'x86_fastcallcc'
| 'x86_thiscallcc'
| 'x86_vectorcallcc'
| 'arm_apcscc'
| 'arm_aapcscc'
| 'arm_aapcs_vfpcc'
| 'msp430_intrcc'
| 'ptx_kernel'
| 'ptx_device'
| 'spir_kernel'
| 'spir_func'
| 'intel_ocl_bicc'
| 'x86_64_sysvcc'
| 'x86_64_win64cc'
| 'webkit_jscc'
| 'anyregcc'
| 'preserve_mostcc'
| 'preserve_allcc'
| 'ghccc'
| 'x86_intrcc'
| 'hhvmcc'
| 'hhvm_ccc'
| 'cxx_fast_tlscc'
| 'cc' Digit+
;
IntegerType : 'i'Digit+;
Linkage : 'private'
| 'internal'
| 'weak_odr'
| Weak
| 'linkonce'
| 'linkonce_odr'
| 'available_externally'
| 'appending'
| 'common'
| 'extern_weak'
| 'external'
;
DllStorageClass : 'dllimport'
| 'dllexport'
;
Visibility : 'default'
| 'hidden'
| 'protected'
;
String : '"'(~'"')*'"';
ThreadLocalStorage : 'localdynamic'
| 'initialexec'
| 'localexec'
;
fpPredicate : 'oeq'
| 'one'
| 'olt'
| 'ogt'
| 'ole'
| 'oge'
| 'ord'
| 'uno'
| 'ueq'
| 'une'
| 'ult'
| 'ugt'
| 'ule'
| 'uge'
| 'true'
| 'false'
;
intPredicate : 'eq'
| 'ne'
| 'ugt'
| 'uge'
| 'ult'
| 'ule'
| 'sgt'
| 'sge'
| 'slt'
| 'sle'
;
CharArrayLiteral : 'c'String;
FloatLiteral : HexFPLiteral
| HexFP80Literal
| HexFP128Literal
| HexPPC128Literal
| HexHalfLiteral
| DecimalFPLiteral
;
IntegerLiteral : [+-]?Digit+; //todo review - usage implies -ve numbers are allowed in contexts where they are not valid
Label : Identifier ':';
LocalIdentifier : '%'Identifier
| '%'Digit+
| '%'String
;
MetadataIdentifier : '!'Identifier
| '!'Digit+
;
ComdatIdentifier : '$'[-a-zA-Z$._][-a-zA-Z$._0-9]*;
fragment Digit : [0-9];
FastMathsFlag : 'fast'
| 'nnan'
| 'ninf'
| 'nsz'
| 'arcp'
;
GlobalIdentifier : '@'[-a-zA-Z$._][-a-zA-Z$._0-9]*
| '@'[0-9]+
| '@'String
;
Weak : 'weak';
fragment
Identifier : [-a-zA-Z$._][-a-zA-Z$._0-9]*;
fragment
DecimalFPLiteral : [-+]?Digit+[.]Digit*([eE][-+]?Digit+)?;
fragment
HexFPLiteral : '0x'[0-9A-Fa-f]+;
fragment
HexFP80Literal : '0xK'[0-9A-Fa-f]+;
fragment
HexFP128Literal : '0xL'[0-9A-Fa-f]+;
fragment
HexPPC128Literal : '0xM'[0-9A-Fa-f]+;
fragment
HexHalfLiteral : '0xH'[0-9A-Fa-f]+;
WS : [ \t\n\r] + -> skip;
COMMENT : ';' ~[\r\n]* -> skip;
|
oeis/049/A049509.asm | neoneye/loda-programs | 11 | 173103 | <gh_stars>10-100
; A049509: Numbers k such that prime(k) == 7 (mod 10).
; Submitted by <NAME>
; 4,7,12,15,19,25,28,31,33,37,39,45,49,55,59,63,66,68,69,73,78,88,91,93,101,102,106,107,111,113,118,123,129,134,138,139,144,148,151,154,155,159,161,163,165,168,181,184,187,195,199,203,206,211,214,217,219,225
add $0,1
seq $0,45380 ; Primes congruent to 2 mod 5.
sub $0,2
seq $0,230980 ; Number of primes <= n, starting at n=0.
add $0,1
|
programs/oeis/060/A060150.asm | neoneye/loda | 22 | 179272 | <reponame>neoneye/loda
; A060150: a(0) = 1; for n > 0, binomial(2n-1, n-1)^2.
; 1,1,9,100,1225,15876,213444,2944656,41409225,590976100,8533694884,124408576656,1828114918084,27043120090000,402335398890000,6015361252737600,90324408810638025,1361429497505672100,20589520178326522500,312321918272897610000,4750416376930772648100,72430384849166701328400,1106808112281894469059600,16947345386546966350440000,259976985825571171306402500,3994910354990056846762703376,61483797830349928156389298704,947643281785750058662812291136,14625616976540275140076567248400,226010128688605726183632661070400,3496627813177940145978779080826944,54155888003476026152703587761735936,839627810491391983594064608696601289
sub $1,$0
bin $1,$0
pow $1,2
mov $0,$1
|
libsrc/_DEVELOPMENT/inttypes/z80/asm_imaxabs.asm | jpoikela/z88dk | 640 | 84184 | <filename>libsrc/_DEVELOPMENT/inttypes/z80/asm_imaxabs.asm
; intmax_t imaxabs(intmax_t j)
SECTION code_clib
SECTION code_inttypes
PUBLIC asm_imaxabs
IFDEF __SDCC
EXTERN asm_llabs
defc asm_imaxabs = asm_llabs
ELSE
EXTERN asm_labs
defc asm_imaxabs = asm_labs
ENDIF
|
libsrc/_DEVELOPMENT/adt/p_forward_list/c/sccz80/p_forward_list_pop_back.asm | jpoikela/z88dk | 640 | 796 | <reponame>jpoikela/z88dk
; void *p_forward_list_pop_back(p_forward_list_t *list)
SECTION code_clib
SECTION code_adt_p_forward_list
PUBLIC p_forward_list_pop_back
EXTERN asm_p_forward_list_pop_back
defc p_forward_list_pop_back = asm_p_forward_list_pop_back
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _p_forward_list_pop_back
defc _p_forward_list_pop_back = p_forward_list_pop_back
ENDIF
|
Lista2/Lista2/Parte2/Programa16.asm | GustavoLR548/ACII-GLR | 1 | 104523 | <filename>Lista2/Lista2/Parte2/Programa16.asm
.data
array: .space 400 #Declarando o array de 400 bits( com tamanho 100 )
.text
main:
addi $t0, $zero, 0 # t0 = i ; i = 0
addi $t1, $zero, 1300
while: # while ( i < 400 ) {
bgt $t0,400, exit
sub $t1,$t1,13
sw $t1,array($t0) # array[i] = t1
addi $t0,$t0,4
j while
exit: # }
add $t0,$zero, 0 # int i
add $t1, $zero, -4
blt $t0, 400, bubblesort1 # for (int i = 0; i < n; i++)
bubblesort1:
add $t1,$t1,4 # j++
blt $t1, 396, bubblesort2 # for (int j = 0; j < n-1; j++)
bubblesort2:
add $t3,$t1,4 # t3 = j + 1
lw $s1,array($t1) # resgatando o conteudo de "array(j)"
lw $s2,array($t3) # resgatando o conteudo de "array(j+1)"
bgt $s1,$s2,swap # if (arr[j] > arr[j+1])
bubblesort3:
blt $t1, 396, bubblesort1 # conferindo se t1 ja percorreu o array in
add $t0,$t0,4 # i++
add $t1,$zero,-4 # resetando j
blt $t0,400, bubblesort1 # conferindo se t0 ja percorreu o array inteiro
j fim
swap:
#trocando o conteudo em array[j] e array[j+1]
sw $s2,array($t1)
sw $s1,array($t3)
j bubblesort3
fim:
#fim do programa
|
qxl/qxl2.asm | olifink/smsqe | 0 | 82862 | <filename>qxl/qxl2.asm
; QXL2.ASM Simple QXL Loader / Support Program
; 2004.01.01 v. 1.01 added code to support configured drives (BC)
; 2005.01.10 v. 1.02 needs at least a 286
; 2005.10.01 v. 1.03 needs at least a 386 (BC)
.386
OPTION SEGMENT:USE16
INCLUDE QXL.INC
DGROUP GROUP _data,stack,_bss
_text SEGMENT DWORD PUBLIC 'CODE'
start:
pushf
mov ax,3002h
push ax
popf
pushf
pop bx
popf
cmp bx,ax ; 386+?
jz min386 ; ... yes
push cs
pop ds
ASSUME ds:_text
mov dx, OFFSET max286
mov ah,09h ; Display String
int 21h
jmp ex_exit
max286:
db '386+ required','$'
min386:
mov bx,es
mov ax,DGROUP
mov es,ax
ASSUME es:DGROUP
mov es:psp,bx ; save PSP
mov ax,ss
mov bx,es
mov cx,es
sub ax,bx
shl ax,4
cli
add sp,ax
ASSUME ss:DGROUP
mov ss,cx
sti
cld ; only ever use post inc addressing
mov es:qxl_code,sp ; ... base of code
call qxl_cmd ; process command line (sets DS)
ASSUME ds:DGROUP
mov si,qxl_code ; ... base of code
add si,smsq_qxl_drl ; base of source string
mov di, OFFSET drf_drl ; base of destination string
mov cx,7
rep movsw
mov bl,loadf
test bl,bl ; load?
jz qst_shrink ; ... no
call qxl_bload ; bootloader
qst_shrink:
mov ax, OFFSET qxl_datatop ; top of unninitialised data
mov bx,ds ; segment
shr ax,4 ; top of data in paras
inc ax ; spare
inc ax ; spare
add bx,ax ; para address of top of data
mov ax,psp ; base of PSP
sub bx,ax ; size of prog
push es
mov es,ax
mov ah,04ah ; set size
int 21h
pop es
mov bl,loadf
test bl,bl ; load?
jnz qst_ldupdt ; ... yes
qst_rstrt:
mov ax, OFFSET mes_rstrt ; QXL restart message
mov cx, 8/2
call qxl_smess ; send this message
jc qst_rstrt
mov kbd_llck,-1 ; force led update at restart
mov flowqx_kbd,-1 ; at one go
jmp qst_main
qst_ldupdt:
mov kbd_lock, kbd_num
call qld_update_led
qst_main:
cli
call qxl_setio ; set up the io drivers / interrupt servers
call qxl_timer_setup ; set up the timer server
sti
;qx2_loop:
;inc qxl_tick ; count ticks
;jnz qx2_test
;inc qxl_tick
;call qxl_comm
;call qxl_rxmess
;qx2_test:
;test kbd_stop,0ffh
;jz qx2_loop
;jmp ex_done
call qxl_main
; all done
ex_done:
cli
call qxl_timer_restore
call qxl_restore
sti
ex_exit:
mov ah,4ch ; End Process
int 21h
; this is an error exit for any routine that decides that the QXL has gone away
err_nresp:
xor ax,ax
push ax
mov ax, DGROUP
mov ds,ax
mov es,ax
push ds
mov ax, OFFSET no_reply
push ax
push ds
mov bx, OFFSET wrk_buff
push bx
push ds
mov ax, OFFSET the_QXL
push ax
mov ax,qxl
mov al,ah
call dbw_btohex ; convert QXL address to hex
mov wrk_buff,dl
mov wrk_buff+1,al
mov ax,qxl
call dbw_btohex
mov wrk_buff+2,dl
mov wrk_buff+3,al
mov wrk_buff+4,"h"
mov wrk_buff+5,0
; this is a simple error exit which sends a message to the console
; any routine can jump directly here with the pointer to the messages
; on the stack (last pointer = 0)
err_exit_rest:
cli
call qxl_timer_restore
call qxl_restore
sti
err_exit_norest:
erx_sloop:
mov ax, DGROUP
mov ds,ax
pop si ; bit of message
test si,si
jz ex_exit
pop ds
erx_bloop:
lodsb
test al,al
jz erx_sloop
push si
push ds
mov dl,al
mov ah,02h ; send char
int 21h
pop ds
pop si
jmp erx_bloop
INCLUDE QXL_CMD.ASM
INCLUDE QXL_BLOD.ASM
INCLUDE QXL_STIO.ASM
INCLUDE QXL_TIMR.ASM
INCLUDE QXL_PCST.ASM
INCLUDE QXL_MAIN.ASM
INCLUDE QXL_REST.ASM
INCLUDE QXL_COMM.ASM
INCLUDE QXL_RXMS.ASM
INCLUDE QXL_RTC.ASM
INCLUDE QXL_MSE.ASM
INCLUDE QXL_FLOW.ASM
INCLUDE QXL_PORT.ASM
INCLUDE QXL_LPTP.ASM
INCLUDE QXL_COMP.ASM
INCLUDE QXL_PHYS.ASM
INCLUDE QXL_VMOD.ASM
INCLUDE QXL_SND.ASM
INCLUDE QXL_KBD.ASM
INCLUDE QXL_LED.ASM
INCLUDE QXL_BUFF.ASM
INCLUDE QXL_SMES.ASM
INCLUDE QXL_DEB.ASM
_text ENDS
INCLUDE QXL_DATA.ASM
stack SEGMENT PARA STACK 'STACK'
BYTE 256 DUP ('STACK ')
stack ENDS
INCLUDE QXL_BSS.ASM
END start
|
experiments/realbugs/balancedBST3.als | saiema/ARepair | 5 | 184 | one sig BinaryTree {
root: lone Node
}
sig Node {
left, right: lone Node,
elem: Int
}
// All nodes are in the tree.
fact Reachable {
Node = BinaryTree.root.*(left + right)
}
fact Acyclic {
all n:Node {
// There are no directed cycles, i.e., a node is not reachable
// from itself along one or more traversals of left or right.
n not in n.^(left + right)
// A node cannot have more than one parent
lone n.~(left + right)
// A node cannot have another node as both its left child
// and right child.
no n.left & n.right
}
}
pred Sorted() {
all n:Node {
// All elements in the n's left subtree are smaller than the n's elem.
// Fix: replace "n.^left" with "n.left.*(left + right)".
all n2:n.^left | n2.elem < n.elem
// All elements in the n's right subtree are bigger than the n's elem.
// Fix: replace "n.^right" with "n.right.*(left + right)".
all n2:n.^right | n2.elem > n.elem
}
}
pred HasAtMostOneChild(n:Node) {
// Node n has at most one child
#n.(left+right) <= 1
}
fun Depth(n: Node): one Int {
// The number of nodes from the tree's root to n.
#n.*~(left+right)
}
pred Balanced() {
// If n1 has at most one child and n2 has at most one child, then the
// depths of n1 and n2 differ by at most 1.
// Multiplying depth differences by the signum to get rid of negatives.
// Is there an absolute value in alloy?
all n1, n2: Node {
// Fix: replace "<=>" with "=>".
(HasAtMostOneChild[n1] && HasAtMostOneChild[n2]) <=> (mul[signum[minus[Depth[n1], Depth[n2]]], minus[Depth[n1], Depth[n2]]] <= 1)
}
}
pred RepOk() {
Sorted
Balanced
}
run RepOk for 5
|
src/pp/block3/cc/antlr/Expression.g4 | Pieterjaninfo/PP | 0 | 3670 | grammar Expression;
import ExpressionVocab;
expr : expr POW expr # pow
| expr PLUS expr # plus
| expr EQ expr # equality
| LPAR expr RPAR # par
| NUM # number
| BOOL # boolean
| STR # string
;
|
programs/oeis/104/A104538.asm | neoneye/loda | 22 | 176347 | <reponame>neoneye/loda
; A104538: Expansion of (1 + 2*x) / (1 + 2*x + 4*x^2).
; 1,0,-4,8,0,-32,64,0,-256,512,0,-2048,4096,0,-16384,32768,0,-131072,262144,0,-1048576,2097152,0,-8388608,16777216,0,-67108864,134217728,0,-536870912,1073741824,0,-4294967296,8589934592,0,-34359738368,68719476736,0,-274877906944,549755813888,0,-2199023255552,4398046511104,0,-17592186044416,35184372088832,0,-140737488355328,281474976710656,0,-1125899906842624,2251799813685248,0,-9007199254740992,18014398509481984,0,-72057594037927936,144115188075855872,0,-576460752303423488,1152921504606846976,0,-4611686018427387904,9223372036854775808,0,-36893488147419103232,73786976294838206464,0,-295147905179352825856,590295810358705651712,0,-2361183241434822606848,4722366482869645213696,0,-18889465931478580854784,37778931862957161709568,0,-151115727451828646838272,302231454903657293676544,0,-1208925819614629174706176,2417851639229258349412352,0,-9671406556917033397649408,19342813113834066795298816,0,-77371252455336267181195264,154742504910672534362390528,0,-618970019642690137449562112,1237940039285380274899124224,0,-4951760157141521099596496896,9903520314283042199192993792,0,-39614081257132168796771975168,79228162514264337593543950336,0,-316912650057057350374175801344,633825300114114700748351602688
add $0,1
mov $2,$0
mov $3,1
lpb $0
sub $0,1
cmp $4,0
add $1,$4
div $2,$1
mul $2,$3
mov $1,$2
sub $2,1
mul $3,2
cmp $4,0
lpe
mov $0,$1
|
oeis/337/A337360.asm | neoneye/loda-programs | 11 | 99132 | <gh_stars>10-100
; A337360: Sum of the coordinates of all pairs of divisors of n, (d1,d2), such that d1 <= d2.
; 2,9,12,28,18,60,24,75,52,90,36,196,42,120,120,186,54,273,60,294,160,180,72,540,124,210,200,392,90,648,96,441,240,270,240,910,114,300,280,810,126,864,132,588,546,360,144,1364,228,651,360,686,162,1080,360,1080,400,450,180,2184,186,480,728,1016,420,1296,204,882,480,1296,216,2535,222,570,868,980,480,1512,240,2046,726,630,252,2912,540,660,600,1620,270,3042,560,1176,640,720,600,3276,294,1197,1092,2170
add $0,1
mov $2,$0
mov $4,2
lpb $0
mov $3,$2
dif $3,$0
cmp $3,$2
cmp $3,0
add $4,$3
mul $3,$0
sub $0,1
add $1,$3
lpe
add $1,1
mul $1,$4
mov $0,$1
|
oeis/267/A267609.asm | neoneye/loda-programs | 11 | 161867 | ; A267609: Decimal representation of the n-th iteration of the "Rule 182" elementary cellular automaton starting with a single ON (black) cell.
; Submitted by <NAME>(s2)
; 1,7,21,127,381,1911,5461,32767,98301,491511,1408981,8355711,25001341,125269879,357913941,2147483647,6442450941,32212254711,92341796821,547608330111,1638530022781,8209829984119,23456963876181,140735340838911,422201727483901,2111025817550839,6051529460383701,35887507618889599,107379944056520061,538030035483195255,1537228672809129301,9223372036854775807,27670116110564327421,138350580552821637111,396604997584755359701,2351959869397967830911,7037432864120193940861,35260951296895807911799
add $0,1
mul $0,2
seq $0,219843 ; Rows of A219463 seen as numbers in binary representation.
div $0,2
|
programs/oeis/098/A098820.asm | neoneye/loda | 22 | 93904 | <reponame>neoneye/loda<gh_stars>10-100
; A098820: Periodicity of entries in the first row of a Laver Table of size 2^n.
; 1,1,2,4,4,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
lpb $0
mov $0,8
mov $1,1
lpe
add $1,1
lpb $0
sub $0,1
div $0,2
add $0,1
mul $1,2
lpe
mov $0,$1
|
src/asis/asis-ada_environments-containers.ads | My-Colaborations/dynamo | 15 | 17687 | ------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT INTERFACE COMPONENTS --
-- --
-- A S I S . A D A _ E N V I R O N M E N T S . C O N T A I N E R S --
-- --
-- S p e c --
-- --
-- Copyright (c) 1995-2006, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Semantic Interface --
-- Specification Standard (ISO/IEC 15291) for use with GNAT. The copyright --
-- notice above, and the license provisions that follow apply solely to the --
-- contents of the part following the private keyword. --
-- --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- 9 package Asis.Ada_Environments.Containers
------------------------------------------------------------------------------
------------------------------------------------------------------------------
package Asis.Ada_Environments.Containers is
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Asis.Ada_Environments.Containers
--
-- If an Ada implementation supports the notion of a program library or
-- "library" as specified in Subclause 10(2) of the Ada Reference Manual,
-- then an ASIS Context value can be mapped onto one or more implementor
-- libraries represented by Containers.
--
------------------------------------------------------------------------------
-- 9.1 type Container
------------------------------------------------------------------------------
--
-- The Container abstraction is a logical collection of compilation units.
-- For example, one container might hold compilation units which include Ada
-- predefined library units, another container might hold
-- implementation-defined packages. Alternatively, there might be 26
-- containers, each holding compilation units that begin with their respective
-- letter of the alphabet. The point is that no implementation-independent
-- semantics are associated with a container; it is simply a logical
-- collection.
--
-- ASIS implementations shall minimally map the Asis.Context to a list of
-- one ASIS Container whose Name is that of the Asis.Context Name.
------------------------------------------------------------------------------
type Container is private;
Nil_Container : constant Container;
function "="
(Left : Container;
Right : Container)
return Boolean is abstract;
------------------------------------------------------------------------------
-- 9.2 type Container_List
------------------------------------------------------------------------------
type Container_List is array (List_Index range <>) of Container;
------------------------------------------------------------------------------
-- 9.3 function Defining_Containers
------------------------------------------------------------------------------
function Defining_Containers
(The_Context : Asis.Context)
return Container_List;
------------------------------------------------------------------------------
-- The_Context - Specifies the Context to define
--
-- Returns a Container_List value that defines the single environment Context.
-- Each Container will have an Enclosing_Context that Is_Identical to the
-- argument The_Context. The order of Container values in the list is not
-- defined.
--
-- Returns a minimal list of length one if the ASIS Ada implementation does
-- not support the concept of a program library. In this case, the Container
-- will have the same name as the given Context.
--
-- Raises ASIS_Inappropriate_Context if The_Context is not open.
--
------------------------------------------------------------------------------
-- 9.4 function Enclosing_Context
------------------------------------------------------------------------------
function Enclosing_Context
(The_Container : Container)
return Asis.Context;
------------------------------------------------------------------------------
-- The_Container - Specifies the Container to query
--
-- Returns the Context value associated with the Container.
--
-- Returns the Context for which the Container value was originally obtained.
-- Container values obtained through the Defining_Containers query will always
-- remember the Context from which they were defined.
--
-- Because Context is limited private, this function is only intended to be
-- used to supply a Context parameter for other queries.
--
-- Raises ASIS_Inappropriate_Container if the Container is a Nil_Container.
--
------------------------------------------------------------------------------
-- 9.5 function Library_Unit_Declaration
------------------------------------------------------------------------------
function Library_Unit_Declarations
(The_Container : Container)
return Asis.Compilation_Unit_List;
------------------------------------------------------------------------------
-- The_Container - Specifies the Container to query
--
-- Returns a list of all library_unit_declaration and
-- library_unit_renaming_declaration elements contained in the Container.
-- Individual units will appear only once in an order that is not defined.
--
-- A Nil_Compilation_Unit_List is returned if there are no declarations of
-- library units within the Container.
--
-- This query will never return a unit with A_Configuration_Compilation or
-- a Nonexistent unit kind. It will never return a unit with A_Procedure_Body
-- or A_Function_Body unit kind even though the unit is interpreted as both
-- the declaration and body of a library procedure or library function.
-- (Reference Manual 10.1.4(4).
--
-- All units in the result will have an Enclosing_Container value that
-- Is_Identical to the Container.
--
-- Raises ASIS_Inappropriate_Context if the Enclosing_Context(Container)
-- is not open.
--
------------------------------------------------------------------------------
-- 9.6 function Compilation_Unit_Bodies
------------------------------------------------------------------------------
function Compilation_Unit_Bodies
(The_Container : Container)
return Asis.Compilation_Unit_List;
------------------------------------------------------------------------------
-- The_Container - Specifies the Container to query
--
-- Returns a list of all library_unit_body and subunit elements contained in
-- the Container. Individual units will appear only once in an order that is
-- not defined.
--
-- A Nil_Compilation_Unit_List is returned if there are no bodies within the
-- Container.
--
-- This query will never return a unit with A_Configuration_Compilation or
-- a nonexistent unit kind.
--
-- All units in the result will have an Enclosing_Container value that
-- Is_Identical to the Container.
--
-- Raises ASIS_Inappropriate_Context if the Enclosing_Context(Container)
-- is not open.
--
------------------------------------------------------------------------------
-- 9.7 function Compilation_Units
------------------------------------------------------------------------------
function Compilation_Units
(The_Container : Container)
return Asis.Compilation_Unit_List;
------------------------------------------------------------------------------
-- The_Container - Specifies the Container to query
--
-- Returns a list of all compilation units contained in the Container.
-- Individual units will appear only once in an order that is not defined.
--
-- A Nil_Compilation_Unit_List is returned if there are no units within the
-- Container.
--
-- This query will never return a unit with A_Configuration_Compilation or
-- a nonexistent unit kind.
--
-- All units in the result will have an Enclosing_Container value that
-- Is_Identical to the Container.
--
-- Raises ASIS_Inappropriate_Context if the Enclosing_Context(Container)
-- is not open.
--
------------------------------------------------------------------------------
-- 9.8 function Is_Equal
------------------------------------------------------------------------------
function Is_Equal
(Left : Container;
Right : Container)
return Boolean;
------------------------------------------------------------------------------
-- Left - Specifies the first Container
-- Right - Specifies the second Container
--
-- Returns True if Left and Right designate Container values that contain the
-- same set of compilation units. The Container values may have been defined
-- from different Context values.
--
------------------------------------------------------------------------------
-- 9.9 function Is_Identical
------------------------------------------------------------------------------
function Is_Identical
(Left : Container;
Right : Container)
return Boolean;
------------------------------------------------------------------------------
-- Left - Specifies the first Container
-- Right - Specifies the second Container
--
-- Returns True if Is_Equal(Left, Right) and the Container values have been
-- defined from Is_Equal Context values.
--
------------------------------------------------------------------------------
-- 9.10 function Name
------------------------------------------------------------------------------
function Name (The_Container : Container) return Wide_String;
------------------------------------------------------------------------------
-- The_Container - Specifies the Container to name
--
-- Returns the Name value associated with the Container.
--
-- Returns a null string if the Container is a Nil_Container.
private
type Container is record
Id : Container_Id := Nil_Container_Id;
Cont_Id : Context_Id := Non_Associated;
Obtained : ASIS_OS_Time := Nil_ASIS_OS_Time;
end record;
Nil_Container : constant Container :=
(Id => Nil_Container_Id,
Cont_Id => Non_Associated,
Obtained => Nil_ASIS_OS_Time);
end Asis.Ada_Environments.Containers;
|
bitmap/bitmap.asm | Admiral-Enigma/C64-playground | 0 | 178003 | <filename>bitmap/bitmap.asm<gh_stars>0
processor 6502
org $1000
; SET BACKGROUND
lda $4710
sta $d020
sta $d021
; LOAD BITMAP INTO SCREEN RAM
ldx #$00
loadavatarimage:
lda $3f40,x
sta $0400,x
lda $4040,x
sta $0500,x
lda $4140,x
sta $0600,x
lda $4240,x
sta $0700,x
; COLOR
lda $4328,x
sta $d800,x
lda $4428,x
sta $d900,x
lda $4528,x
sta $da00,x
lda $4628,x
sta $db00,x
inx
bne loadavatarimage
; ENABLE bitmap and multicolor mode
lda #$3b
sta $d011
lda #$18
sta $d016
lda #$18
sta $d018
loop:
jmp loop
org $1FFE
INCBIN "avatar.prg"
|
src/fot/FOTC/Data/Nat/Induction/Acc/WF-I.agda | asr/fotc | 11 | 202 | <reponame>asr/fotc
------------------------------------------------------------------------------
-- Well-founded induction on the natural numbers
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Data.Nat.Induction.Acc.WF-I where
open import FOTC.Base
open import FOTC.Data.Nat.Inequalities
open import FOTC.Data.Nat.Inequalities.EliminationPropertiesI
open import FOTC.Data.Nat.Inequalities.PropertiesI
open import FOTC.Data.Nat.Type
open import FOTC.Induction.WF
------------------------------------------------------------------------------
-- The relation _<_ is well-founded.
module <-WF where
<-wf : WellFounded _<_
<-wf Nn = acc (helper Nn)
where
-- N.B. The helper function is the same that the function used by
-- FOTC.Data.Nat.Induction.NonAcc.WellFoundedInductionATP.
helper : ∀ {n m} → N n → N m → m < n → Acc N _<_ m
helper nzero Nm m<0 = ⊥-elim (x<0→⊥ Nm m<0)
helper (nsucc _) nzero 0<Sn = acc (λ Nm' m'<0 → ⊥-elim (x<0→⊥ Nm' m'<0))
helper (nsucc {n} Nn) (nsucc {m} Nm) Sm<Sn =
acc (λ {m'} Nm' m'<Sm →
let m<n : m < n
m<n = Sx<Sy→x<y Sm<Sn
m'<n : m' < n
m'<n = case (λ m'<m → <-trans Nm' Nm Nn m'<m m<n)
(λ m'≡m → x≡y→y<z→x<z m'≡m m<n)
(x<Sy→x<y∨x≡y Nm' Nm m'<Sm)
in helper Nn Nm' m'<n
)
-- Well-founded induction on the natural numbers.
<-wfind : (A : D → Set) →
(∀ {n} → N n → (∀ {m} → N m → m < n → A m) → A n) →
∀ {n} → N n → A n
<-wfind A = WellFoundedInduction <-wf
------------------------------------------------------------------------------
-- The relation _<_ is well-founded (a different proof).
module <-WF' where
<-wf : WellFounded {N} _<_
<-wf nzero = acc (λ Nm m<0 → ⊥-elim (x<0→⊥ Nm m<0))
<-wf (nsucc Nn) = acc (λ Nm m<Sn → helper Nm Nn (<-wf Nn)
(x<Sy→x≤y Nm Nn m<Sn))
where
helper : ∀ {n m} → N n → N m → Acc N _<_ m → n ≤ m → Acc N _<_ n
helper {n} {m} Nn Nm (acc h) n≤m = case (λ n<m → h Nn n<m)
(λ n≡m → helper₁ (sym n≡m) (acc h))
(x≤y→x<y∨x≡y Nn Nm n≤m)
where
helper₁ : ∀ {a b} → a ≡ b → Acc N _<_ a → Acc N _<_ b
helper₁ refl h = h
|
oeis/212/A212344.asm | neoneye/loda-programs | 11 | 23307 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A212344: Sequence of coefficients of x^(n-3) in marked mesh pattern generating function Q_{n,132}^(0,3,0,0)(x).
; Submitted by <NAME>
; 5,5,10,25,70,210,660,2145,7150,24310,83980,293930,1040060,3714500,13372200,48474225,176788350,648223950,2388193500,8836315950,32820602100,122331335100,457412818200,1715298068250,6449520736620,24309732007260,91836765360760
seq $0,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!).
mul $0,5
|
test/Fail/Issue431.agda | shlevy/agda | 1,989 | 17093 | <filename>test/Fail/Issue431.agda
{-# OPTIONS --inversion-max-depth=10 #-}
open import Agda.Builtin.Nat
open import Agda.Builtin.Equality
data ⊥ : Set where
double : Nat → Nat
double zero = zero
double (suc n) = suc (suc (double n))
postulate
doubleSuc : (x y : Nat) → double x ≡ suc (double y) → ⊥
diverge : ⊥
diverge = doubleSuc _ _ refl
{-
double ?x == suc (double ?y)
?x := suc ?x₁
suc (suc (double ?x₁)) == suc (double ?y)
suc (double ?x₁) == double ?y
?y := suc ?y₁
double ?x₁ == suc (double ?y₁)
.
.
.
-}
|
libsrc/_DEVELOPMENT/arch/zx/display/c/sdcc_iy/zx_saddrcup_fastcall.asm | meesokim/z88dk | 0 | 172380 |
; void *zx_saddrcup_fastcall(void *saddr)
SECTION code_arch
PUBLIC _zx_saddrcup_fastcall
_zx_saddrcup_fastcall:
INCLUDE "arch/zx/display/z80/asm_zx_saddrcup.asm"
|
libsrc/c128/invdc.asm | andydansby/z88dk-mk2 | 1 | 2034 | <reponame>andydansby/z88dk-mk2
;
;Based on the SG C Tools 1.7
;(C) 1993 <NAME>
;
;$Id: invdc.asm,v 1.1 2008/06/23 17:34:33 stefano Exp $
;
;get vdc register
XLIB invdc
invdc:
;pop de ;return address
;pop hl ;vdc register to set
;push hl
;push de
; __FASTCALL__, so vdc register to set is in HL already
ld a,l
ld bc,0d600h ;vdc status port
out (c),a ;set reg to read
test7:
in a,(c) ;repeat
bit 7,a ; test bit 7
jr z,test7 ;until bit 7 high
inc bc ;vdc data register
in l,(c) ;get data
ld h,0
ret
;uchar invdc(uchar RegNum)
;{
; outp(vdcStatusReg,RegNum); /* internal vdc register to read */
; while ((inp(vdcStatusReg) & 0x80) == 0x00); /* wait for status bit to be set */
; return(inp(vdcDataReg)); /* read register */
;} |
programs/oeis/326/A326247.asm | neoneye/loda | 22 | 244547 | ; A326247: Number of labeled n-vertex 2-edge multigraphs that are neither crossing nor nesting.
; 0,0,1,9,32,80,165,301,504,792,1185,1705,2376,3224,4277,5565,7120,8976,11169,13737,16720,20160,24101,28589,33672,39400,45825,53001,60984,69832,79605,90365,102176,115104,129217,144585,161280,179376,198949,220077,242840
mov $2,1
lpb $0
mov $1,$0
mov $0,$2
trn $1,2
seq $1,207064 ; Number of n X 4 0..1 arrays avoiding 0 0 1 and 0 1 0 horizontally and 0 0 1 and 1 0 1 vertically.
lpe
div $1,9
mov $0,$1
|
src/gfx/ico_ice.asm | beckadamtheinventor/BOSshell5 | 2 | 10837 | ; convpng v7.3
; 8 bpp image
_ico_ice_size equ 258
_ico_ice:
db 16,16
db 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh
db 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh
db 0FFh,0FFh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,095h,03Dh,03Dh,03Dh,03Dh,03Dh,03Dh,03Dh,06Bh,012h,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,06Bh,06Bh,06Bh,06Bh,000h,000h,000h,000h,06Bh,06Bh,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,012h,012h,012h,000h,000h,000h,000h,000h,000h,06Bh,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,06Bh,06Bh,06Bh,000h,000h,06Bh,06Bh,000h,000h,06Bh,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,012h,03Dh,03Dh,000h,000h,03Dh,03Dh,000h,000h,012h,012h,06Bh,0FFh,0FFh
db 0FFh,0FFh,06Bh,06Bh,000h,000h,000h,000h,000h,000h,000h,000h,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,02Ch,02Ch,000h,000h,000h,000h,000h,000h,000h,000h,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,06Bh,06Bh,000h,000h,06Bh,06Bh,06Bh,06Bh,000h,000h,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,03Dh,03Dh,000h,000h,03Dh,03Dh,012h,012h,000h,000h,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,06Bh,06Bh,000h,000h,06Bh,06Bh,06Bh,06Bh,000h,000h,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,06Bh,06Bh,000h,000h,000h,000h,000h,000h,000h,000h,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,03Dh,03Dh,000h,000h,000h,000h,000h,000h,000h,000h,06Bh,06Bh,0FFh,0FFh
db 0FFh,0FFh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,06Bh,0FFh,0FFh
|
base/mvdm/wow16/kernel31/ldself.asm | npocmaka/Windows-Server-2003 | 17 | 90722 |
TITLE LDSELF - BootStrap procedure for KERNEL.EXE
.xlist
?NODATA=1
?TF=1
include kernel.inc
include newexe.inc
include tdb.inc
.list
externFP IGlobalAlloc
externFP IGlobalLock
externFP IGlobalUnlock
DataBegin
externW winVer
;externW pGlobalHeap
DataEnd
sBegin CODE
assumes CS,CODE
assumes DS,NOTHING
assumes ES,NOTHING
;externW MyCSDS
externNP SetOwner
externFP set_discarded_sel_owner
; extra debugging parameter for EntProcAddress to avoid RIPing if all
; we are doing is a GetProcAddress to something that isn't there.
externNP EntProcAddress
cProc FarEntProcAddress,<PUBLIC,FAR,NODATA>
parmW hExe
parmW entno
cBegin
if KDEBUG
mov cx,1
cCall EntProcAddress,<hExe,entno,cx>
else
cCall EntProcAddress,<hExe,entno>
endif
cEnd
if KDEBUG
; AppLoaderEntProcAddress
; This call added for the app loader. The above call (FarEntProcAddress)
; forces no RIPs. When we're using the app loader, we really want
; RIPs, so in debug we add this entry point.
; This call ONLY exists in debug.
cProc AppLoaderEntProcAddress,<PUBLIC,FAR,NODATA>
parmW hExe
parmW entno
cBegin
xor cx,cx ;Force RIPs on this one
cCall EntProcAddress,<hExe,entno,cx>
cEnd
endif ; KDEBUG
externNP FindOrdinal
cProc FarFindOrdinal,<PUBLIC,FAR,NODATA>
parmW hExe
parmD lpname
parmW fh
cBegin
cCall FindOrdinal,<hExe,lpName,fh>
cEnd
externNP LoadSegment
cProc FarLoadSegment,<PUBLIC,FAR,NODATA>
parmW hExe
parmW segno
parmW fh
parmW isfh
cBegin
cCall LoadSegment,<hExe,segno,fh,isfh>
cEnd
externNP AllocSeg
cProc FarAllocSeg,<PUBLIC,FAR,NODATA>
parmD pSegInfo
cBegin
cCall AllocSeg,<pSegInfo>
cEnd
externNP DeleteTask
cProc FarDeleteTask,<PUBLIC,FAR,NODATA,ATOMIC>
parmW taskID
cBegin
cCall DeleteTask,<taskID>
cEnd
externNP UnlinkObject
cProc FarUnlinkObject,<PUBLIC,FAR,NODATA,ATOMIC>
cBegin
cCall UnlinkObject
cEnd
externNP MyLower
cProc FarMyLower,<PUBLIC,FAR,NODATA,ATOMIC>
cBegin
cCall MyLower
cEnd
externNP MyUpper
cProc FarMyUpper,<PUBLIC,FAR,NODATA,ATOMIC>
cBegin
cCall MyUpper
cEnd
externNP MyAlloc
cProc FarMyAlloc,<PUBLIC,FAR,NODATA>
parmW aflags
parmW nsize
parmW nelem
cBegin
cCall MyAlloc,<aflags,nsize,nelem>
cEnd
externNP MyAllocLinear
cProc FarMyAllocLinear,<PUBLIC,FAR,NODATA>
parmW aflags
parmD dwBytes
cBegin
cCall MyAllocLinear,<aflags,dwBytes>
cEnd
externNP MyLock
cProc FarMyLock,<PUBLIC,FAR,NODATA>
parmW h1
cBegin
cCall MyLock,<h1>
cEnd
externNP MyFree
cProc FarMyFree,<PUBLIC,FAR,NODATA>
parmW h2
cBegin
cCall MyFree,<h2>
cEnd
externNP genter
cProc Far_genter,<PUBLIC,FAR,NODATA,ATOMIC>
cBegin
cCall genter
cEnd
externNP gleave
cProc Far_gleave,<PUBLIC,FAR,NODATA,ATOMIC>
cBegin
cCall gleave
cEnd
externNP lalign
cProc Far_lalign,<PUBLIC,FAR,NODATA,ATOMIC>
cBegin
cCall lalign
cEnd
externNP lrepsetup
cProc Far_lrepsetup,<PUBLIC,FAR,NODATA,ATOMIC>
cBegin
cCall lrepsetup
cEnd
if KDEBUG
externNP lfillCC
cProc Far_lfillCC,<PUBLIC,FAR,NODATA,ATOMIC>
cBegin
cCall lfillCC
cEnd
endif
sEnd CODE
sBegin INITCODE
;-----------------------------------------------------------------------;
; LKExeHeader ;
; ;
; Copy of LoadExeHeader (from LDHEADER.ASM) that has been stripped ;
; down to the minimum needed to load the new format .EXE header for ;
; KERNEL.EXE. ;
; ;
; Arguments: ;
; parmW pMem ;
; parmD pfilename ;
; ;
; Returns: ;
; AX = segment of exe header ;
; ;
; Error Returns: ;
; AX = 0 ;
; ;
; Registers Preserved: ;
; DI,SI,DS ;
; ;
; Registers Destroyed: ;
; AX,BX,CX,DX,ES ;
; Calls: ;
; ;
; History: ;
; ;
; Thu Mar 19, 1987 08:35:32p -by- <NAME> [davidw] ;
; Added this nifty comment block. ;
;-----------------------------------------------------------------------;
cProc LKExeHeader,<PUBLIC,NEAR>,<si,di,ds>
parmW pMem
parmD pfilename
localW nchars
cBegin
lds si,pfilename
xor ax,ax
mov al,ds:[si].opLen
inc ax ; include null byte
mov nchars,ax
mov ds,pMem
xor si,si
mov di,ds:[si].ne_enttab ; Compute size of resident new header
add di, 6 ; Room for one block of entries
push si
mov si, ds:[si].ne_enttab ; Scan current entry table
calc_next_block:
lodsw
xor cx, cx
mov cl, al
jcxz calc_ent_sized
cmp ah, ENT_UNUSED ; 6 bytes per unused block
jne calc_used_block
add di, 6
jmps calc_next_block
calc_used_block:
errnz <5-SIZE PENT>
mov bx, cx
shl bx, 1
add di, bx
add di, bx ; 5 bytes per entry
add di, cx
add si, bx
add si, cx ; Skip the block
cmp ah, ENT_MOVEABLE
jne calc_next_block
calc_moveable_block:
add si, bx
add si, cx ; Skip the block
jmps calc_next_block
calc_ent_sized:
pop si
mov cx,ds:[si].ne_cseg ; + 3 * #segments
; Reserve space for segment reference bytes
add di,cx
shl cx,1
; Reserve space for ns_handle field in segment table
add di,cx
errnz <10-SIZE NEW_SEG1>
if LDCHKSUM
; Reserve space for segment chksum table (2 words per segment)
add di,cx
add di,cx
endif
; Reserve space for file info block at end
add di,16 ; 16 bytes of slop
add di,nchars ; + size of file info block
xor ax,ax ; Allocate a block for header
cCall IGlobalAlloc,<GA_MOVEABLE,ax,di>
push ax
cCall IGlobalLock,<ax>
pop ax
push dx
cCall IGlobalUnlock,<ax>
pop ax
mov es,ax ; ES:DI -> new header location
xor di,di
cld ; DS:SI -> old header
mov cx,SIZE NEW_EXE ; Copy fixed portion of header
cld
rep movsb
mov cx,es:[ne_cseg] ; Copy segment table
mov es:[ne_segtab],di
recopyseg:
movsw ; ns_sector
movsw ; ns_cbseg
lodsw ; ns_flags
errnz <4-ns_flags>
and ax,not NS286DOS ; Clear 286DOS bits
or ax,NENOTP+4000h ; Mark library code segments
stosw
movsw ; ns_minalloc
errnz <8-SIZE NEW_SEG>
xor ax,ax
stosw ; one word for ns_handle field
errnz <10-SIZE NEW_SEG1>
loop recopyseg
recopysegx:
mov cx,es:[ne_restab] ; Copy resource table
sub cx,es:[ne_rsrctab]
mov es:[ne_rsrctab],di
rep movsb
rerestab:
mov cx,es:[ne_modtab] ; Copy resident name table
sub cx,es:[ne_restab]
mov es:[ne_restab],di
rep movsb
mov cx,es:[ne_imptab] ; Copy module xref table
sub cx,es:[ne_modtab]
mov es:[ne_modtab],di
rep movsb
mov es:[ne_psegrefbytes],di ; Insert segment reference byte table
mov cx,es:[ne_cseg]
mov al,0FFh
rep stosb ; initialize to not-loaded condition
mov es:[ne_pretthunks],di ; Setup return thunks
if LDCHKSUM
mov es:[ne_psegcsum],di ; Setup segment chksum table
mov cx,es:[ne_cseg]
jcxz resetsegcsumexit
xor ax,ax
shl cx,1 ; Two words per segment
rep stosw
resetsegcsumexit:
endif
mov cx,es:[ne_enttab] ; Copy imported name table
sub cx,es:[ne_imptab]
mov es:[ne_imptab],di
jcxz reenttab
rep movsb
reenttab:
mov es:[ne_enttab],di
; Scan current entry table
xor ax, ax ; First entry in block
mov bx, di ; Pointer to info for this block
stosw ; Starts at 0
stosw ; Ends at 0
stosw ; And is not even here!
copy_next_block:
lodsw ; Get # entries and type
xor cx, cx
mov cl, al
jcxz copy_ent_done
mov al, ah
cmp al, ENT_UNUSED
jne copy_used_block
mov ax, es:[bx].PM_EntEnd ; Last entry in current block
cmp ax, es:[bx].PM_EntStart ; No current block?
jne end_used_block
int 3
add es:[bx].PM_EntStart, cx
add es:[bx].PM_EntEnd, cx
jmps copy_next_block
end_used_block:
mov es:[bx].PM_EntNext, di ; Pointer to next block
mov bx, di
add ax, cx ; Skip unused entries
stosw ; First in new block
stosw ; Last in new block
xor ax, ax
stosw ; End of list
jmps copy_next_block
copy_used_block:
add es:[bx].PM_EntEnd, cx ; Add entries in this block
cmp al, ENT_MOVEABLE
je copy_moveable_block
copy_fixed_block:
stosb ; Segno
movsb ; Flag byte
stosb ; segno again to match structure
movsw ; Offset
loop copy_fixed_block
jmps copy_next_block
copy_moveable_block:
stosb ; ENT_MOVEABLE
movsb ; Flag byte
add si, 2 ; Toss int 3Fh
movsb ; Copy segment #
movsw ; and offset
loop copy_moveable_block
jmps copy_next_block
copy_ent_done:
xor bx,bx
mov es:[bx].ne_usage,1
mov es:[bx].ne_pnextexe,bx
mov es:[bx].ne_pautodata,bx
mov cx,nchars
mov es:[bx].ne_pfileinfo,di
lds si,pfilename
rep movsb
SetKernelDS
mov ax,winVer
mov es:[bx].ne_expver,ax
or es:[bx].ne_flags,NENONRES ; Remember that we have
; discardable code
UnSetKernelDS
cCall SetOwner,<es,es>
mov ax,es
reexit:
cEnd
cProc LKAllocSegs,<PUBLIC,NEAR>,<si,di,ds>
parmW hExe
localW fixed_seg
localW SegCount
cBegin
mov ds,hExe
mov si,ds:[ne_segtab]
mov di,ds:[si].ns_minalloc
xor ax,ax
mov bx,(GA_ALLOC_LOW or GA_CODE_DATA) shl 8
cCall IGlobalAlloc,<bx,ax,di>
or ax,ax
jz lkallocfail
mov fixed_seg,ax
mov ds:[si].ns_handle,ax
and byte ptr ds:[si].ns_flags,not NSLOADED
or byte ptr ds:[si].ns_flags,NSALLOCED
cCall SetOwner,<ax,ds>
add si,SIZE NEW_SEG1 ; NRES segment
mov di,ds:[si].ns_sector
mov SegCount, 0 ; NRES and MISC segments
;; SetKernelDS es
;; cmp fWinX,0
;; UnSetKernelDS es
;; je lk1
;; mov di,ds:[si].ns_cbseg
;; xchg ds:[si].ns_minalloc,di
;; xchg ds:[si].ns_sector,di
;;lk1:
SegLoop:
inc SegCount
xor ax,ax
mov bh,GA_DISCARDABLE + GA_SHAREABLE + GA_CODE_DATA
mov bl,GA_MOVEABLE + GA_DISCCODE
cCall IGlobalAlloc,<bx,ax,ax>
or ax,ax
jz lkallocfail
mov ds:[si].ns_handle,ax ; Handle into seg table
and byte ptr ds:[si].ns_flags,not NSLOADED
or byte ptr ds:[si].ns_flags,NSALLOCED
mov bx,ax ; put handle into base register
smov es,ds
call set_discarded_sel_owner
smov es,0
mov bx,ds:[si].ns_sector ; Save MiscCode sector
add si,SIZE NEW_SEG1 ; Next segment
cmp SegCount, 2
jnz SegLoop
; Allocate fixed block for kernel's data segment
push bx ; Save MisCode sector
mov bx,ds:[si].ns_minalloc
xor ax,ax
cCall IGlobalAlloc,<ax,ax,bx>
pop bx
or ax,ax
jz lkallocfail
mov ds:[ne_pautodata], si
mov ds:[si].ns_handle,ax
and byte ptr ds:[si].ns_flags,not NSLOADED
or byte ptr ds:[si].ns_flags,NSALLOCED
cCall SetOwner,<ax,ds>
mov ax,di ; Return offset to NR segment
lkallocfail:
cEnd
nop ; Stop linker from padding segment
sEnd INITCODE
end
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_79.asm | ljhsiun2/medusa | 9 | 97121 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r15
push %rbx
push %rdx
lea addresses_D_ht+0x9c11, %rbx
nop
and $36463, %rdx
movb (%rbx), %r13b
nop
nop
nop
nop
inc %rdx
lea addresses_WC_ht+0xc794, %r15
nop
cmp $46725, %r14
mov $0x6162636465666768, %r13
movq %r13, %xmm2
vmovups %ymm2, (%r15)
nop
nop
nop
sub $11294, %rdx
pop %rdx
pop %rbx
pop %r15
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r8
push %r9
push %rax
push %rbp
// Faulty Load
lea addresses_normal+0x12611, %r8
nop
nop
nop
nop
nop
add %r14, %r14
mov (%r8), %ebp
lea oracles, %r8
and $0xff, %rbp
shlq $12, %rbp
mov (%r8,%rbp,1), %rbp
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
Mount Media on Kevin.applescript | lukaspustina/applescripts | 0 | 2610 | <reponame>lukaspustina/applescripts
tell application "Finder"
mount volume "smb://kevin/media"
activate
open ("/Volumes/media" as POSIX file)
end tell |
programs/oeis/303/A303383.asm | neoneye/loda | 22 | 92706 | ; A303383: Total volume of all cubes with side length q such that n = p + q and p <= q.
; 0,1,8,35,91,216,405,748,1196,1925,2800,4131,5643,7840,10241,13616,17200,22113,27216,34075,41075,50336,59653,71820,83916,99541,114920,134603,153811,178200,201825,231616,260288,296225,330616,373491,414315,464968,512981
lpb $0
mov $2,$0
sub $0,1
seq $2,309335 ; a(n) = n^3 if n odd, 7*n^3/8 if n even.
add $1,$2
lpe
mov $0,$1
|
smsq/gold/driver/8.asm | olifink/smsqe | 0 | 5589 | <reponame>olifink/smsqe<gh_stars>0
; base area SMSQ GOLD Drivers / QL display
section header
xref smsq_end
include 'dev8_keys_con'
include 'dev8_smsq_smsq_base_keys'
include 'dev8_smsq_smsq_config_keys'
include 'dev8_mac_assert'
header_base
dc.l gl_con-header_base ; length of header
dc.l 0 ; module length unknown
dc.l smsq_end-gl_con ; loaded length
dc.l 0 ; checksum
dc.l 0 ; select
dc.b 1 ; 1 level down
dc.b 0
dc.w smsq_name-*
smsq_name
dc.w 26,'SMSQ GOLD 8 bit CON Driver'
dc.l ' '
dc.w $200a
section base
xref pt_setup
gl_con
move.b sms.conf+sms_issize,d1 ; config size
moveq #ptd.08,d2 ; 8 bit colour depth
moveq #ptm.aur8,d3 ; aurora 8 bit driver
move.b sms.conf+sms_ismode,d4 ; mode ql or 8 bit
jmp pt_setup
end
|
programs/oeis/059/A059993.asm | neoneye/loda | 22 | 244154 | ; A059993: Pinwheel numbers: a(n) = 2*n^2 + 6*n + 1.
; 1,9,21,37,57,81,109,141,177,217,261,309,361,417,477,541,609,681,757,837,921,1009,1101,1197,1297,1401,1509,1621,1737,1857,1981,2109,2241,2377,2517,2661,2809,2961,3117,3277,3441,3609,3781,3957,4137,4321,4509,4701,4897,5097,5301,5509,5721,5937,6157,6381,6609,6841,7077,7317,7561,7809,8061,8317,8577,8841,9109,9381,9657,9937,10221,10509,10801,11097,11397,11701,12009,12321,12637,12957,13281,13609,13941,14277,14617,14961,15309,15661,16017,16377,16741,17109,17481,17857,18237,18621,19009,19401,19797,20197
mov $1,$0
mul $0,2
add $1,3
mul $0,$1
add $0,1
|
Ada/src/Problem_54.adb | Tim-Tom/project-euler | 0 | 7725 | <reponame>Tim-Tom/project-euler<gh_stars>0
with Ada.Text_IO;
package body Problem_54 is
package IO renames Ada.Text_IO;
procedure Solve is
type Faces is (Low_Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace, Out_of_Range);
pragma Unreferenced (Out_of_Range);
type Suits is (Clubs, Diamonds, Spades, Hearts);
type Card is Record
face : Faces;
suit : Suits;
end Record;
function ">"(Left, Right : Card) return Boolean is
begin
return Left.face > Right.face;
end ">";
function "="(Left, Right : Card) return Boolean is
begin
return Left.face = Right.face;
end "=";
type Card_Hand is Array (1 .. 5) of Card;
type Hand_Score is new Integer range 0 .. 294;
type Hand_Type is (None, Pair, Two_Pair, Three_of_a_Kind, Straight, Flush,
Full_House, Four_of_a_Kind, Straight_Flush);
Hand_Counts : constant Array(Hand_Type) of Hand_Score :=
(
None => 1,
Pair => 13,
Two_Pair => (12 + 1) * 12 / 2,
Three_of_a_Kind => 13,
Straight => 10,
Flush => 1,
Full_House => 13 * 12,
Four_of_A_Kind => 13,
Straight_Flush => 10
);
Hand_Bases : constant Array(Hand_Type) of Hand_Score :=
(
None => 0,
Pair => Hand_Counts(None),
Two_Pair => Hand_Counts(None) + Hand_Counts(Pair),
Three_of_a_Kind => Hand_Counts(None) + Hand_Counts(Pair) + Hand_Counts(Two_Pair),
Straight => Hand_Counts(None) + Hand_Counts(Pair) + Hand_Counts(Two_Pair) + Hand_Counts(Three_of_a_Kind),
Flush => Hand_Counts(None) + Hand_Counts(Pair) + Hand_Counts(Two_Pair) + Hand_Counts(Three_of_a_Kind) + Hand_Counts(Straight),
Full_House => Hand_Counts(None) + Hand_Counts(Pair) + Hand_Counts(Two_Pair) + Hand_Counts(Three_of_a_Kind) + Hand_Counts(Straight) + Hand_Counts(Flush),
Four_of_A_Kind => Hand_Counts(None) + Hand_Counts(Pair) + Hand_Counts(Two_Pair) + Hand_Counts(Three_of_a_Kind) + Hand_Counts(Straight) + Hand_Counts(Flush) + Hand_Counts(Full_House),
Straight_Flush => Hand_Counts(None) + Hand_Counts(Pair) + Hand_Counts(Two_Pair) + Hand_Counts(Three_of_a_Kind) + Hand_Counts(Straight) + Hand_Counts(Flush) + Hand_Counts(Full_House) + Hand_Counts(Four_of_A_Kind)
);
Two_Pair_Offset : constant Array(Faces range Three .. Ace) of Hand_Score :=
(
Three => 0,
Four => 1,
Five => 3,
Six => 6,
Seven => 10,
Eight => 15,
Nine => 21,
Ten => 28,
Jack => 36,
Queen => 45,
King => 55,
Ace => 66
);
procedure Evaluate(hand : in out Card_Hand; result : out Hand_Score) is
is_flush : Boolean := True;
is_straight : Boolean := True;
counts : Array(Faces range Two .. Ace) of Natural := (others => 0);
pairs : Natural := 0;
triple : Boolean := False;
quad : Boolean := False;
previous : Card := (face => Faces'Pred(hand(1).face), suit => hand(1).suit);
function Score(face : Faces) return Hand_Score is
begin
return Faces'Pos(face) - 1;
end Score;
begin
for index in hand'Range loop
declare
finger : constant Card := Hand(index);
begin
if is_straight then
if finger.face /= Faces'Succ(previous.face) and
(finger.face /= Ace or previous.face /= Five) then
is_straight := False;
end if;
end if;
if is_flush and finger.suit /= previous.suit then
is_flush := False;
end if;
counts(finger.face) := counts(finger.face) + 1;
if counts(finger.face) = 2 then
pairs := pairs + 1;
elsif counts(finger.face) = 3 then
pairs := pairs - 1;
triple := True;
elsif counts(finger.face) = 4 then
triple := False;
quad := True;
end if;
previous := finger;
end;
end loop;
if is_straight and hand(5).face = Ace and hand(4).face = Five then
declare
ace_suit : constant Suits := hand(5).suit;
begin
for top in reverse 2 .. 5 loop
hand(top).face := hand(top - 1).face;
hand(top).suit := hand(top - 1).suit;
end loop;
hand(1).face := Low_Ace;
hand(1).suit := ace_suit;
end;
end if;
if is_straight then
if is_flush then
result := Hand_Bases(Straight_Flush) + Score(hand(5).face) - 3;
else
result := Hand_Bases(Straight) + Score(hand(5).face) - 3;
end if;
elsif quad then
for face in counts'Range loop
if counts(face) = 4 then
result := Hand_Bases(Four_of_a_Kind) + Score(face);
exit;
end if;
end loop;
elsif triple and pairs = 1 then
declare
last : Boolean := False;
begin
result := Hand_Bases(Full_House);
for face in counts'Range loop
if counts(face) = 3 then
result := result + 12*Score(face);
exit when last;
last := True;
elsif counts(face) = 2 then
result := result + Score(face);
if last then
result := result - 1;
exit;
else
last := True;
end if;
end if;
end loop;
end;
elsif is_flush then
result := Hand_Bases(Flush);
elsif triple then
for face in counts'Range loop
if counts(face) = 3 then
result := Hand_Bases(Three_of_a_Kind) + Score(face);
exit;
end if;
end loop;
elsif pairs = 2 then
declare
first : Boolean := True;
begin
result := Hand_Bases(Two_Pair);
for face in reverse counts'Range loop
if counts(face) = 2 then
if first then
result := result + Two_Pair_Offset(face);
first := False;
else
result := result + Score(face);
exit;
end if;
end if;
end loop;
end;
elsif pairs = 1 then
for face in counts'Range loop
if counts(face) = 2 then
result := Hand_Bases(pair) + Score(face);
exit;
end if;
end loop;
else
result := Hand_Bases(None);
end if;
end;
procedure High_Card(hand : Card_Hand;
index : in out Natural) is
begin
loop
declare
current : constant Faces := hand(index).face;
subtract : Positive := 1;
begin
for location in reverse 1 .. index - 1 loop
exit when current /= hand(location).face;
subtract := subtract + 1;
end loop;
exit when subtract = 1;
index := index - subtract;
exit when index = 0;
end;
end loop;
end High_Card;
input : IO.File_Type;
procedure Read_Card(finger : out Card) is
read : character;
begin
IO.Get(input, read);
case(read) is
when '2' =>
finger.face := Two;
when '3' =>
finger.face := Three;
when '4' =>
finger.face := Four;
when '5' =>
finger.face := Five;
when '6' =>
finger.face := Six;
when '7' =>
finger.face := Seven;
when '8' =>
finger.face := Eight;
when '9' =>
finger.face := Nine;
when 'T' =>
finger.face := Ten;
when 'J' =>
finger.face := Jack;
when 'Q' =>
finger.face := Queen;
when 'K' =>
finger.face := King;
when 'A' =>
finger.face := Ace;
when others =>
IO.Put_Line("Character was '" & Character'Image(read) & "'.");
raise Constraint_Error;
end case;
IO.Get(input, read);
case(read) is
when 'C' =>
finger.suit := Clubs;
when 'S' =>
finger.suit := Spades;
when 'H' =>
finger.suit := Hearts;
when 'D' =>
finger.suit := Diamonds;
when others =>
raise Constraint_Error;
end case;
if not (IO.End_Of_Line(input) or IO.End_Of_File(input)) then
IO.Get(input, read);
end if;
end;
procedure Sort(a : in out Card_Hand) is
begin
for j in 2 .. a'Last loop
declare
key : constant Card := a(j);
i : Natural := j - 1;
begin
while i > 0 and then a(i) > key loop
a(i + 1) := a(i);
i := i - 1;
end loop;
a(i + 1) := key;
end;
end loop;
end;
wins : Natural := 0;
begin
IO.Open(input, IO.In_File, "input/Problem_54.txt");
while not IO.End_Of_File(input) loop
declare
left, right : Card_Hand;
left_score, right_score : Hand_Score;
begin
for index in left'Range loop
Read_Card(left(index));
end loop;
Sort(left);
for index in right'Range loop
Read_Card(right(index));
end loop;
Sort(right);
Evaluate(left, left_score);
Evaluate(right, right_score);
if left_score > right_score then
wins := wins + 1;
elsif left_score = right_score then
declare
left_index : Natural := 5;
right_index : Natural := 5;
begin
while left_index > 0 and right_index > 0 loop
High_Card(left, left_index);
High_Card(right, right_index);
exit when left_index = 0 or right_index = 0;
if left(left_index) > right(right_index) then
wins := wins + 1;
end if;
exit when left(left_index) /= right(right_index);
end loop;
end;
end if;
end;
end loop;
IO.Put_Line(Natural'Image(wins));
end Solve;
end Problem_54;
|
registre.ads | Brawdunoir/administrative-family-tree-manager | 0 | 15294 | <filename>registre.ads
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package Registre is
type T_Registre is private;
type T_Donnee is private;
Cle_Presente_Exception_Reg : Exception; -- une clé est déjà présente dans un Registre
Cle_Absente_Exception_Reg : Exception; -- une clé est absente d'un Registre
-- Creer une clé Cle à partir d'une donnée Donnee sous le modèle suivant :
-- Cle = 100 000 000*Mois_N + 1 000 000*Jour_N + 100*Annee_N + X (Avec X entre 0 et 99, en assumant qu'il y a au maximum 100 naissances par jour)
-- Exemple : clé associée à la donnée <NAME> 24 Août 1999 F qui est la deuxième personne née le 24 Août 1999.
-- sera 0824199900
-- Assure : Cle >= 0
procedure Creer_Cle (Reg : in T_Registre; Cle : out Integer; Donnee : in T_Donnee) with
Post => Cle >= 0;
-- Initialiser une donnée Donnee
-- Paramètres : Donnee out T_Donnee
-- Nom in Chaîne de caractères
-- Prenom in Chaîne de caractères
-- Jour_N in Entier
-- Mois_N in Entier
-- Annee_N in Entier
-- Sexe in Caractère
procedure Initialiser_Donnee ( Donnee : out T_Donnee;
Nom : in unbounded_string;
Prenom : in unbounded_string;
Jour_N : in Integer;
Mois_N : in Integer;
Annee_N : in Integer;
Sexe : in Character);
-- Initialiser un Registre Reg. Le Registre est vide.
-- Paramètres : Reg out T_Registre
procedure Initialiser_Reg(Reg: out T_Registre; Cle : in Integer; Donnee : in T_Donnee);
-- Supprimer tous les éléments d'un Registre.
-- Doit être utilisée dès qu'on sait qu'un Registre ne sera plus utilisé.
-- Paramètres : Reg in out T_Registre
-- Assure : Est_Vide(Reg)
procedure Vider (Reg : in out T_Registre) with
Post => Est_Vide (Reg);
-- Renvoie True si le registre est vide, False sinon
-- Paramètres : Reg in T_Registre
function Est_Vide (Reg : in T_Registre) return Boolean;
-- Obtenir le nombre d'éléments d'un Registre.
-- Paramètres : Reg : in T_Registre
-- Assure : Taille >= 0 et Taille = 0 si Est_Vide(Reg)
function Taille (Reg : in T_Registre) return Integer with
Post => Taille'Result >= 0
and (Taille'Result = 0) = Est_Vide (Reg);
-- Insérer la donnée Donnee associée à la clé Cle dans le Registre Reg.
-- Paramètres : Reg in out T_Registre
-- Cle : in Entier
-- Donnee : in T_Donnee
-- Exception : Cle_Presente_Exception si Cle est déjà dans Reg.
-- Assure : La_Donnee(Reg,Cle) = Donnee et Taill(Reg) = Taille(Reg)'Old + 1
procedure Inserer (Reg : in out T_Registre ; Cle : in Integer ; Donnee : in T_Donnee) with
Post => La_Donnee (Reg, Cle) = Donnee -- donnée insérée
and Taille (Reg) = Taille (Reg)'Old + 1; -- un élément de plus
-- Modifier la donnée Donnee associée à la clé Cle dans le Registre Reg.
-- Paramètres : Reg in out T_Registre
-- Cle in Entier
-- Donnee in T_Donnee
-- Exception : Cle_Absente_Exception si Cle n'est pas utilisée dans Reg
-- Assure : La_Donnee(Reg,Cle) = Donnee
procedure Modifier (Reg : in out T_Registre ; Cle : in Integer ; Donnee : in T_Donnee) with
Post => La_Donnee (Reg, Cle) = Donnee; -- donnée mise à jour
-- Supprimer la donnée associée à la clé Cle dans le Registre Reg.
-- Paramètres : Reg in out T_Registre
-- Cle in Entier
-- Exception : Cle_Absente_Exception si Cle n'est pas utilisée dans Reg
-- Assure : Taille(Reg) = Taille(Reg)'Old - 1
procedure Supprimer (Reg : in out T_Registre ; Cle : in Integer) with
Post => Taille (Reg) = Taille (Reg)'Old - 1; -- un élément de moins
-- Obtenir la donnée associée à la clé Cle dans le Registre Reg.
-- Paramètres : Reg in T_Registre
-- Cle in Entier
-- Exception : Cle_Absente_Exception si Cle n'est pas utilisée dans Reg
function La_Donnee (Reg : in T_Registre ; Cle : in Integer) return T_Donnee;
function Retourner_Nom (Reg : in T_Registre; Cle : in Integer) return unbounded_string;
-- Afficher un Registre Reg dans l'ordre croissant des clés (parcours infixe)
-- Paramètres : Reg in T_Registre
procedure Afficher (Reg : in T_Registre);
-- Afficher un ABR Abr (en faisant apparaître la strucre grâce à une
-- indendation et un signe '<', '>', '/' pour indiquer la sous-arbre
-- gauche, '>' pour un sous arbre droit et '/' pour la racine)
-- Exemple :
--
-- / Cle1 : Valeur1
-- < Cle2 : Valeur2
-- > Cle3 : Valeur3
-- > Cle4 : Valeur 4
-- < Cle5 : Valeur 5
--procedure Afficher_Debug (Abr : in T_Registre);
private
-- Donnée qu'on souhaite ajouter au registre pour un ancêtre donné.
type T_Donnee is
record
Nom : unbounded_string;
Prenom : unbounded_string;
Jour_N : Integer;
Mois_N : Integer;
Annee_N : Integer;
Sexe : Character;
end record;
type T_Cellule;
type T_Registre is access T_Cellule;
type T_Cellule is
record
Cle: Integer;
Donnee : T_Donnee;
Sous_Arbre_Gauche : T_Registre;
Sous_Arbre_Droit : T_Registre;
end record;
end Registre;
|
sources/ippcp/asm_intel64/pcpsha1l9as.asm | ntyukaev/ipp-crypto | 30 | 244268 | ;===============================================================================
; Copyright 2017-2020 Intel Corporation
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;===============================================================================
;
;
; Purpose: Cryptography Primitive.
; Message block processing according to SHA1
;
; Content:
; UpdateSHA1
;
;
%include "asmdefs.inc"
%include "ia_32e.inc"
%include "pcpvariant.inc"
%if (_ENABLE_ALG_SHA1_)
%if (_SHA_NI_ENABLING_ == _FEATURE_OFF_) || (_SHA_NI_ENABLING_ == _FEATURE_TICKTOCK_)
%if (_IPP32E >= _IPP32E_L9 )
;;
;; assignments
;;
%xdefine hA eax ;; hash values into GPU registers
%xdefine F ebp
%xdefine hB ebx
%xdefine hC ecx
%xdefine hD edx
%xdefine hE r8d
%xdefine T1 r10d ;; SHA1 round computation (temporary)
%xdefine T2 r11d
%xdefine W00 ymm2 ;; W values into YMM registers
%xdefine W04 ymm3
%xdefine W08 ymm4
%xdefine W12 ymm5
%xdefine W16 ymm6
%xdefine W20 ymm7
%xdefine W24 ymm8
%xdefine W28 ymm9
%xdefine W16L xmm6
%xdefine W20L xmm7
%xdefine W24L xmm8
%xdefine W28L xmm9
%xdefine WTMP1 ymm0 ;; msg schedulling computation (temporary)
%xdefine WTMP2 ymm1
%xdefine WTMP3 ymm10
%xdefine YMM_SHUFB ymm11 ;; byte swap constant
%xdefine YMM_K ymm12 ;; sha1 round constant value
%xdefine F_PTR r13 ;; frame ptr/data block ptr
;;W_PTR textequ r12 ;; frame ptr/data block ptr
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; textual rotation of W array
;;
%macro ROTATE_W 0.nolist
%xdefine W_minus_32 W_minus_28
%xdefine W_minus_28 W_minus_24
%xdefine W_minus_24 W_minus_20
%xdefine W_minus_20 W_minus_16
%xdefine W_minus_16 W_minus_12
%xdefine W_minus_12 W_minus_08
%xdefine W_minus_08 W_minus_04
%xdefine W_minus_04 W
%xdefine W W_minus_32
%endmacro
;;
;; msg schedulling for initial 00-15 sha1 rounds:
;; - byte swap input
;; - add sha1 round constant
%macro W_CALC_00_15 2.nolist
%xdefine %%nr %1
%xdefine %%Wchunk %2
vpshufb W, %%Wchunk, YMM_SHUFB
vpaddd %%Wchunk, W, YMM_K
vmovdqa ymmword [F_PTR + (%%nr)*sizeof(dword)*2], %%Wchunk
ROTATE_W
%endmacro
;;
;; msg schedulling for other 16-79 sha1 rounds:
;;
%macro W_CALC 1.nolist
%xdefine %%rndw %1
%if (%%rndw < 32)
%if ((%%rndw & 3) == 0) ;; scheduling to interleave with ALUs
vpalignr W, W_minus_12, W_minus_16, 8 ;; w[t-14]
vpsrldq WTMP1, W_minus_04, 4 ;; w[t-3]
vpxor W, W, W_minus_16
vpxor WTMP1, WTMP1, W_minus_08
%elif ((%%rndw & 3) == 1)
vpxor W, W, WTMP1
vpsrld WTMP1, W, 31
vpslldq WTMP2, W, 12
vpaddd W, W, W
%elif ((%%rndw & 3) == 2)
vpsrld WTMP3, WTMP2, 30
vpxor W, W, WTMP1
vpslld WTMP2, WTMP2, 2
vpxor W, W, WTMP3
%elif ((%%rndw & 3) == 3)
vpxor W, W, WTMP2
;;vpaddd WTMP1, W, ymmword [K_SHA1_PTR]
vpaddd WTMP1, W, YMM_K
vmovdqa ymmword [F_PTR+4*sizeof(ymmword)+((%%rndw & 15)/4)*sizeof(ymmword)],WTMP1
ROTATE_W
%endif
%elif (%%rndw < 80)
%if ((%%rndw & 3) == 0) ;; scheduling to interleave with ALUs
vpalignr WTMP1, W_minus_04, W_minus_08, 8
vpxor W, W, W_minus_28 ;; W == W_minus_32
%elif ((%%rndw & 3) == 1)
vpxor W, W, W_minus_16
vpxor W, W, WTMP1
%elif ((%%rndw & 3) == 2)
vpslld WTMP1, W, 2
vpsrld W, W, 30
%elif ((%%rndw & 3) == 3)
vpxor W, WTMP1, W
;;vpaddd WTMP1, W, ymmword [K_SHA1_PTR]
vpaddd WTMP1, W, YMM_K
vmovdqa ymmword [F_PTR+4*sizeof(ymmword)+((%%rndw & 15)/4)*sizeof(ymmword)],WTMP1
ROTATE_W
%endif
%endif
%endmacro
;;
;; update hash macro
;;
%macro UPDATE_HASH 2.nolist
%xdefine %%hashMem %1
%xdefine %%hash %2
add %%hash, %%hashMem
mov %%hashMem, %%hash
%endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; textual rotation of HASH arguments
;;
%macro ROTATE_H 0.nolist
%xdefine %%_X hE
%xdefine hE hD
%xdefine hD hC
%xdefine hC hB
%xdefine hB F
%xdefine F hA
%xdefine hA %%_X
%endmacro
;;
;; SHA1 rounds 0 - 19
;; on entry:
;; - a, f(), b', c, d, e values
;; where: f() = F(b,c,d) = (b&c) & (~b&d) already pre-computed for this round
;; b' = rotl(b,30) already pre-computed for the next round
;; note:
;; %if nr==19 the f(b,c,d)=b^c^d precomputed
;;
%macro SHA1_ROUND_00_19 1.nolist
%xdefine %%nr %1
;; hE+=W[nr]+K
add hE, dword [F_PTR+((%%nr & 15)/4)*sizeof(ymmword)+(%%nr & 3)*sizeof(dword)]
%if (((%%nr+1) & 15) == 0)
add F_PTR, (16/4)*sizeof(ymmword)
%endif
%if (%%nr < 19)
andn T1,hA,hC ;; ~hB&hC (next round)
%endif
add hE, F ;; hE += F()
rorx T2,hA, 27 ;; hA<<<5
rorx F, hA, 2 ;; hB<<<30 (next round)
%if (%%nr < 19)
and hA, hB ;; hB&hC (next round)
%endif
add hE, T2 ;; hE += (hA<<<5)
%if (%%nr < 19)
xor hA, T1 ;; F() = (hB&hC)^(~hB&hC) (next round)
%else
xor hA, hB ;; F() = hB^hC^hD next round
xor hA, hC
%endif
ROTATE_H
%endmacro
;;
;; SHA1 rounds 20 - 39
;; on entry:
;; - a, f(), b', c, d, e values
;; where: f() = F(b,c,d) = b^c^d already pre-computed for this round
;; b' = rotl(b,30) already pre-computed for the next round
;;
;; note:
;; %if nr==39 the f(b,c,d)=(b^c)&(c^d) precomputed
;;
%macro SHA1_ROUND_20_39 1.nolist
%xdefine %%nr %1
;; hE+=W[nr]+K
add hE, dword [F_PTR+((%%nr & 15)/4)*sizeof(ymmword)+(%%nr & 3)*sizeof(dword)]
%if (((%%nr+1) & 15) == 0)
add F_PTR, (16/4)*sizeof(ymmword)
%endif
add hE, F ;; hE += F()
rorx T2,hA, 27 ;; hA<<<5
rorx F, hA, 2 ;; hB<<<30 (next round)
xor hA, hB ;; hB^hC (next round)
add hE, T2 ;; hE += (hA<<<5)
%if (%%nr < 39)
xor hA, hC ;; F() = hB^hC^hD (next round)
%else
mov T1, hB ;; hC^hD (next round)
xor T1, hC ;;
and hA, T1 ;; (hB^hC)&(hC^hD)
%endif
ROTATE_H
%endmacro
;;
;; SHA1 rounds 40 - 59
;; on entry:
;; - a, f(), b', c, d, e values
;; where: f() = (b&c)^(c&d) already pre-computed (part of F()) for this round
;; b' = rotl(b,30) already pre-computed for the next round
;;
;; F(b,c,d) = (b&c)^(b&d)^(c&d)
;;
;; note, using GF(2): arithmetic
;; F(b,c,d) = (b&c)^(b&d)^(c&d) ~ bc+bd+cd
;; =(b+c)(c+d) +c^2 = (b+c)(c+d) +c
;; ~ ((b^c)&(c^d)) ^c
;; direct substitution:
;; (b+c)(c+d) = bc + bd + c^2 + cd, but c^2 = c
;;
%macro SHA1_ROUND_40_59 1.nolist
%xdefine %%nr %1
;; hE+=W[nr]+K
add hE, dword [F_PTR+((%%nr & 15)/4)*sizeof(ymmword)+(%%nr & 3)*sizeof(dword)]
%if (((%%nr+1) & 15) == 0)
add F_PTR, (16/4)*sizeof(ymmword)
%endif
xor F, hC ;; F() = ((b^c)&(c^d)) ^c
%if(%%nr < 59)
mov T1, hB ;; hC^hD (next round)
xor T1, hC ;;
%endif
add hE, F ;; hE += F()
rorx T2,hA, 27 ;; hA<<<5
rorx F, hA, 2 ;; hB<<<30 (next round)
xor hA, hB ;; hB^hC (next round)
add hE, T2 ;; hE += (hA<<<5)
%if(%%nr < 59)
and hA, T1 ;; (hB^hC)&(hC^hD) (next round)
%else
xor hA, hC ;; (hB^hC^hD) (next round)
%endif
ROTATE_H
%endmacro
;;
;; SHA1 rounds 60 - 79
;; on entry:
;; - a, f(), b', c, d, e values
;; where: f() = F(b,c,d) = b^c^d already pre-computed for this round
;; b' = rotl(b,30) already pre-computed for the next round
;;
%macro SHA1_ROUND_60_79 1.nolist
%xdefine %%nr %1
;; hE+=W[nr]+K
add hE, dword [F_PTR+((%%nr & 15)/4)*sizeof(ymmword)+(%%nr & 3)*sizeof(dword)]
%if (((%%nr+1) & 15) == 0)
add F_PTR, (16/4)*sizeof(ymmword)
%endif
add hE, F ;; hE += F()
rorx T2,hA, 27 ;; hA<<<5
%if (%%nr < 79)
rorx F, hA, 2 ;; hB<<<30 (next round)
xor hA, hB ;; hB^hC (next round)
%endif
add hE, T2 ;; hE += (hA<<<5)
%if (%%nr < 79)
xor hA, hC ;; F() = hB^hC^hD (next round)
%endif
ROTATE_H
%endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
segment .text align=IPP_ALIGN_FACTOR
align IPP_ALIGN_FACTOR
SHA1_YMM_K dd 05a827999h, 05a827999h, 05a827999h, 05a827999h, 05a827999h, 05a827999h, 05a827999h, 05a827999h
dd 06ed9eba1h, 06ed9eba1h, 06ed9eba1h, 06ed9eba1h, 06ed9eba1h, 06ed9eba1h, 06ed9eba1h, 06ed9eba1h
dd 08f1bbcdch, 08f1bbcdch, 08f1bbcdch, 08f1bbcdch, 08f1bbcdch, 08f1bbcdch, 08f1bbcdch, 08f1bbcdch
dd 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h, 0ca62c1d6h
SHA1_YMM_BF dd 00010203h,04050607h,08090a0bh,0c0d0e0fh
dd 00010203h,04050607h,08090a0bh,0c0d0e0fh
;*****************************************************************************************
;* Purpose: Update internal digest according to message block
;*
;* void UpdateSHA1(DigestSHA1 digest, const Ipp32u* mblk, int mlen, const void* pParam)
;*
;*****************************************************************************************
align IPP_ALIGN_FACTOR
IPPASM UpdateSHA1,PUBLIC
%assign LOCAL_FRAME (sizeof(dword)*80*2)
USES_GPR rdi,rsi,rbp,rbx,r12,r13,r14,r15
USES_XMM_AVX xmm6,xmm7,xmm8,xmm9,xmm10,xmm11,xmm12
COMP_ABI 4
;; rdi = hash ptr
;; rsi = data block ptr
;; rdx = data length in bytes
;; rcx = dummy
%xdefine MBS_SHA1 (64)
mov r15, rsp ; store orifinal rsp
and rsp, -IPP_ALIGN_FACTOR ; 32-byte aligned stack
movsxd r14, edx ; input length in bytes
vmovdqa YMM_SHUFB, [rel SHA1_YMM_BF] ; load byte shuffler
mov hA, dword [rdi] ; load initial hash value
mov F, dword [rdi+sizeof(dword)]
mov hC, dword [rdi+2*sizeof(dword)]
mov hD, dword [rdi+3*sizeof(dword)]
mov hE, dword [rdi+4*sizeof(dword)]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; process next data 2 block
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; assignment:
;; - W00,...,W28 are fixed
;; - W_minus_04,...,W_minus_32 are rorarted
;; - W corresponds to W[t]
;;
%xdefine W W00
%xdefine W_minus_04 W04
%xdefine W_minus_08 W08
%xdefine W_minus_12 W12
%xdefine W_minus_16 W16
%xdefine W_minus_20 W20
%xdefine W_minus_24 W24
%xdefine W_minus_28 W28
%xdefine W_minus_32 W
align IPP_ALIGN_FACTOR
.sha1_block2_loop:
lea F_PTR, [rsi+MBS_SHA1] ; next block
cmp r14, MBS_SHA1 ; %if single block processed
cmovbe F_PTR, rsi ; use the same data block address
;;
;; load data block and merge next data block
;;
vmovdqa YMM_K, [rel SHA1_YMM_K] ; pre-load sha1 constant
vmovdqu W28L, xmmword [rsi] ; load data block
vmovdqu W24L, xmmword [rsi+1*sizeof(xmmword)]
vmovdqu W20L, xmmword [rsi+2*sizeof(xmmword)]
vmovdqu W16L, xmmword [rsi+3*sizeof(xmmword)]
vinserti128 W28, W28, xmmword [F_PTR], 1 ; merge next data block
vinserti128 W24, W24, xmmword [F_PTR+1*sizeof(xmmword)], 1
vinserti128 W20, W20, xmmword [F_PTR+2*sizeof(xmmword)], 1
vinserti128 W16, W16, xmmword [F_PTR+3*sizeof(xmmword)], 1
mov F_PTR, rsp ;; set local data pointer
W_CALC_00_15 0, W28 ;; msg scheduling for rounds 00 .. 15
W_CALC_00_15 4, W24 ;;
W_CALC_00_15 8, W20 ;; msg scheduling for rounds 08 .. 15
W_CALC_00_15 12, W16 ;;
rorx hB, F, 2 ;; pre-compute (b<<<30) next round
andn T1,F, hD ;; pre-compute F1(F,hC,hD) = hB&hC ^(~hB&hD)
and F, hC
xor F, T1
W_CALC 16 ;; msg schedilling ahead 16 rounds
SHA1_ROUND_00_19 0 ;; sha1 round
W_CALC 17
SHA1_ROUND_00_19 1
W_CALC 18
SHA1_ROUND_00_19 2
W_CALC 19
SHA1_ROUND_00_19 3
; pre-load sha1 constant
vmovdqa YMM_K, [rel SHA1_YMM_K+sizeof(ymmword)]
W_CALC 20
SHA1_ROUND_00_19 4
W_CALC 21
SHA1_ROUND_00_19 5
W_CALC 22
SHA1_ROUND_00_19 6
W_CALC 23
SHA1_ROUND_00_19 7
W_CALC 24
SHA1_ROUND_00_19 8
W_CALC 25
SHA1_ROUND_00_19 9
W_CALC 26
SHA1_ROUND_00_19 10
W_CALC 27
SHA1_ROUND_00_19 11
W_CALC 28
SHA1_ROUND_00_19 12
W_CALC 29
SHA1_ROUND_00_19 13
W_CALC 30
SHA1_ROUND_00_19 14
W_CALC 31
SHA1_ROUND_00_19 15
W_CALC 32
SHA1_ROUND_00_19 16
W_CALC 33
SHA1_ROUND_00_19 17
W_CALC 34
SHA1_ROUND_00_19 18
W_CALC 35
SHA1_ROUND_00_19 19
W_CALC 36
SHA1_ROUND_20_39 20
W_CALC 37
SHA1_ROUND_20_39 21
W_CALC 38
SHA1_ROUND_20_39 22
W_CALC 39
SHA1_ROUND_20_39 23
; pre-load sha1 constant
vmovdqa YMM_K, [rel SHA1_YMM_K+2*sizeof(ymmword)]
W_CALC 40
SHA1_ROUND_20_39 24
W_CALC 41
SHA1_ROUND_20_39 25
W_CALC 42
SHA1_ROUND_20_39 26
W_CALC 43
SHA1_ROUND_20_39 27
W_CALC 44
SHA1_ROUND_20_39 28
W_CALC 45
SHA1_ROUND_20_39 29
W_CALC 46
SHA1_ROUND_20_39 30
W_CALC 47
SHA1_ROUND_20_39 31
W_CALC 48
SHA1_ROUND_20_39 32
W_CALC 49
SHA1_ROUND_20_39 33
W_CALC 50
SHA1_ROUND_20_39 34
W_CALC 51
SHA1_ROUND_20_39 35
W_CALC 52
SHA1_ROUND_20_39 36
W_CALC 53
SHA1_ROUND_20_39 37
W_CALC 54
SHA1_ROUND_20_39 38
W_CALC 55
SHA1_ROUND_20_39 39
W_CALC 56
SHA1_ROUND_40_59 40
W_CALC 57
SHA1_ROUND_40_59 41
W_CALC 58
SHA1_ROUND_40_59 42
W_CALC 59
SHA1_ROUND_40_59 43
; pre-load sha1 constant
vmovdqa YMM_K, [rel SHA1_YMM_K+3*sizeof(ymmword)]
W_CALC 60
SHA1_ROUND_40_59 44
W_CALC 61
SHA1_ROUND_40_59 45
W_CALC 62
SHA1_ROUND_40_59 46
W_CALC 63
SHA1_ROUND_40_59 47
W_CALC 64
SHA1_ROUND_40_59 48
W_CALC 65
SHA1_ROUND_40_59 49
W_CALC 66
SHA1_ROUND_40_59 50
W_CALC 67
SHA1_ROUND_40_59 51
W_CALC 68
SHA1_ROUND_40_59 52
W_CALC 69
SHA1_ROUND_40_59 53
W_CALC 70
SHA1_ROUND_40_59 54
W_CALC 71
SHA1_ROUND_40_59 55
W_CALC 72
SHA1_ROUND_40_59 56
W_CALC 73
SHA1_ROUND_40_59 57
W_CALC 74
SHA1_ROUND_40_59 58
W_CALC 75
SHA1_ROUND_40_59 59
W_CALC 76
SHA1_ROUND_60_79 60
W_CALC 77
SHA1_ROUND_60_79 61
W_CALC 78
SHA1_ROUND_60_79 62
W_CALC 79
SHA1_ROUND_60_79 63
SHA1_ROUND_60_79 64
SHA1_ROUND_60_79 65
SHA1_ROUND_60_79 66
SHA1_ROUND_60_79 67
SHA1_ROUND_60_79 68
SHA1_ROUND_60_79 69
SHA1_ROUND_60_79 70
SHA1_ROUND_60_79 71
SHA1_ROUND_60_79 72
SHA1_ROUND_60_79 73
SHA1_ROUND_60_79 74
SHA1_ROUND_60_79 75
SHA1_ROUND_60_79 76
SHA1_ROUND_60_79 77
SHA1_ROUND_60_79 78
SHA1_ROUND_60_79 79
lea F_PTR, [rsp+sizeof(xmmword)] ;; set local data pointer
;; update hash values by 1-st data block
UPDATE_HASH dword [rdi], hA
UPDATE_HASH dword [rdi+4], F
UPDATE_HASH dword [rdi+8], hC
UPDATE_HASH dword [rdi+12],hD
UPDATE_HASH dword [rdi+16],hE
cmp r14, MBS_SHA1*2
jl .done
rorx hB, F, 2 ;; pre-compute (b<<<30) next round
andn T1,F, hD ;; pre-compute F1(F,hC,hD) = hB&hC ^(~hB&hD)
and F, hC
xor F, T1
SHA1_ROUND_00_19 0
SHA1_ROUND_00_19 1
SHA1_ROUND_00_19 2
SHA1_ROUND_00_19 3
SHA1_ROUND_00_19 4
SHA1_ROUND_00_19 5
SHA1_ROUND_00_19 6
SHA1_ROUND_00_19 7
SHA1_ROUND_00_19 8
SHA1_ROUND_00_19 9
SHA1_ROUND_00_19 10
SHA1_ROUND_00_19 11
SHA1_ROUND_00_19 12
SHA1_ROUND_00_19 13
SHA1_ROUND_00_19 14
SHA1_ROUND_00_19 15
SHA1_ROUND_00_19 16
SHA1_ROUND_00_19 17
SHA1_ROUND_00_19 18
SHA1_ROUND_00_19 19
SHA1_ROUND_20_39 20
SHA1_ROUND_20_39 21
SHA1_ROUND_20_39 22
SHA1_ROUND_20_39 23
SHA1_ROUND_20_39 24
SHA1_ROUND_20_39 25
SHA1_ROUND_20_39 26
SHA1_ROUND_20_39 27
SHA1_ROUND_20_39 28
SHA1_ROUND_20_39 29
SHA1_ROUND_20_39 30
SHA1_ROUND_20_39 31
SHA1_ROUND_20_39 32
SHA1_ROUND_20_39 33
SHA1_ROUND_20_39 34
SHA1_ROUND_20_39 35
SHA1_ROUND_20_39 36
SHA1_ROUND_20_39 37
SHA1_ROUND_20_39 38
SHA1_ROUND_20_39 39
SHA1_ROUND_40_59 40
SHA1_ROUND_40_59 41
SHA1_ROUND_40_59 42
SHA1_ROUND_40_59 43
SHA1_ROUND_40_59 44
SHA1_ROUND_40_59 45
SHA1_ROUND_40_59 46
SHA1_ROUND_40_59 47
SHA1_ROUND_40_59 48
SHA1_ROUND_40_59 49
SHA1_ROUND_40_59 50
SHA1_ROUND_40_59 51
SHA1_ROUND_40_59 52
SHA1_ROUND_40_59 53
SHA1_ROUND_40_59 54
SHA1_ROUND_40_59 55
SHA1_ROUND_40_59 56
SHA1_ROUND_40_59 57
SHA1_ROUND_40_59 58
SHA1_ROUND_40_59 59
SHA1_ROUND_60_79 60
SHA1_ROUND_60_79 61
SHA1_ROUND_60_79 62
SHA1_ROUND_60_79 63
SHA1_ROUND_60_79 64
SHA1_ROUND_60_79 65
SHA1_ROUND_60_79 66
SHA1_ROUND_60_79 67
SHA1_ROUND_60_79 68
SHA1_ROUND_60_79 69
SHA1_ROUND_60_79 70
SHA1_ROUND_60_79 71
SHA1_ROUND_60_79 72
SHA1_ROUND_60_79 73
SHA1_ROUND_60_79 74
SHA1_ROUND_60_79 75
SHA1_ROUND_60_79 76
SHA1_ROUND_60_79 77
SHA1_ROUND_60_79 78
SHA1_ROUND_60_79 79
;; update hash values by 2-nd data block
UPDATE_HASH dword [rdi], hA
UPDATE_HASH dword [rdi+4], F
UPDATE_HASH dword [rdi+8], hC
UPDATE_HASH dword [rdi+12],hD
UPDATE_HASH dword [rdi+16],hE
;; unfortunately 2*80%6 != 0
;; and so need to re-order hA,F,hB,hC,hD,hE values
;; to match the code generated for 1-st block processing
mov hB, hD ; re-order data physically
mov hD, hA
mov T1, hE
mov hE, F
mov F, hC
mov hC, T1
ROTATE_H ; re-order data logically
ROTATE_H ; twice, because 6 -(2*80%6) = 2
add rsi, MBS_SHA1*2
sub r14, MBS_SHA1*2
jg .sha1_block2_loop
.done:
mov rsp, r15
REST_XMM_AVX
REST_GPR
ret
ENDFUNC UpdateSHA1
%endif ;; _IPP32E >= _IPP32E_L9
%endif ;; _FEATURE_OFF_ / _FEATURE_TICKTOCK_
%endif ;; _ENABLE_ALG_SHA1_
|
src/arch/x86_64/interrupts.asm | kettle11/pacifickernel | 1 | 80064 |
bits 64
section .text
; Loads the IDT defined in '_idtp' into the processor.
; This is declared in C as 'extern void idt_load();'
global _idt_load
extern idtp
_idt_load:
lidt [idtp]
ret
; In just a few pages in this tutorial, we will add our Interrupt
; Service Routines (ISRs) right here!
global _isr0
global _isr1
global _isr2
global _isr3
global _isr4
global _isr5
global _isr6
global _isr7
global _isr8
global _isr9
global _isr10
global _isr11
global _isr12
global _isr13
global _isr14
global _isr15
global _isr16
global _isr17
global _isr18
global _isr19
global _isr20
global _isr21
global _isr22
global _isr23
global _isr24
global _isr25
global _isr26
global _isr27
global _isr28
global _isr29
global _isr30
global _isr31
; 0: Divide By Zero Exception
_isr0:
cli
push qword 0
push qword 0
jmp isr_common_stub
; 1: Debug Exception
_isr1:
cli
push qword 0
push qword 1
jmp isr_common_stub
; 2: Non Maskable Interrupt Exception
_isr2:
cli
push qword 0
push qword 2
jmp isr_common_stub
; 3: Int 3 Exception
_isr3:
cli
push qword 0
push qword 3
jmp isr_common_stub
; 4: INTO Exception
_isr4:
cli
push qword 0
push qword 4
jmp isr_common_stub
; 5: Out of Bounds Exception
_isr5:
cli
push qword 0
push qword 5
jmp isr_common_stub
; 6: Invalid Opcode Exception
_isr6:
cli
push qword 0
push qword 6
jmp isr_common_stub
; 7: Coprocessor Not Available Exception
_isr7:
cli
push qword 0
push qword 7
jmp isr_common_stub
; 8: Double Fault Exception (With Error Code!)
_isr8:
cli
push qword 8
jmp isr_common_stub
; 9: Coprocessor Segment Overrun Exception
_isr9:
cli
push qword 0
push qword 9
jmp isr_common_stub
; 10: Bad TSS Exception (With Error Code!)
_isr10:
cli
push qword 10
jmp isr_common_stub
; 11: Segment Not Present Exception (With Error Code!)
_isr11:
cli
push qword 11
jmp isr_common_stub
; 12: Stack Fault Exception (With Error Code!)
_isr12:
cli
push qword 12
jmp isr_common_stub
; 13: General Protection Fault Exception (With Error Code!)
_isr13:
cli
push qword 13
jmp isr_common_stub
; 14: Page Fault Exception (With Error Code!)
_isr14:
cli
push qword 14
jmp isr_common_stub
; 15: Reserved Exception
_isr15:
cli
push qword 0
push qword 15
jmp isr_common_stub
; 16: Floating Point Exception
_isr16:
cli
push qword 0
push qword 16
jmp isr_common_stub
; 17: Alignment Check Exception
_isr17:
cli
push qword 0
push qword 17
jmp isr_common_stub
; 18: Machine Check Exception
_isr18:
cli
push qword 0
push qword 18
jmp isr_common_stub
; 19: Reserved
_isr19:
cli
push qword 0
push qword 19
jmp isr_common_stub
; 20: Reserved
_isr20:
cli
push qword 0
push qword 20
jmp isr_common_stub
; 21: Reserved
_isr21:
cli
push qword 0
push qword 21
jmp isr_common_stub
; 22: Reserved
_isr22:
cli
push qword 0
push qword 22
jmp isr_common_stub
; 23: Reserved
_isr23:
cli
push qword 0
push qword 23
jmp isr_common_stub
; 24: Reserved
_isr24:
cli
push qword 0
push qword 24
jmp isr_common_stub
; 25: Reserved
_isr25:
cli
push qword 0
push qword 25
jmp isr_common_stub
; 26: Reserved
_isr26:
cli
push qword 0
push qword 26
jmp isr_common_stub
; 27: Reserved
_isr27:
cli
push qword 0
push qword 27
jmp isr_common_stub
; 28: Reserved
_isr28:
cli
push qword 0
push qword 28
jmp isr_common_stub
; 29: Reserved
_isr29:
cli
push qword 0
push qword 29
jmp isr_common_stub
; 30: Reserved
_isr30:
cli
push qword 0
push qword 30
jmp isr_common_stub
; 31: Reserved
_isr31:
cli
push qword 0
push qword 31
jmp isr_common_stub
ret;
; We call a C function in here. We need to let the assembler know
; that '_fault_handler' exists in another file
extern _fault_handler
; This is our common ISR stub. It saves the processor state, sets
; up for kernel mode segments, calls the C-level fault handler,
; and finally restores the stack frame.
isr_common_stub:
; save general purpose registers
push qword r15
push qword r14
push qword r13
push qword r12
push qword r11
push qword r10
push qword r9
push qword r8
push qword rax
push qword rcx
push qword rdx
push qword rbx
push qword rbp
push qword rsi
push qword rdi
mov qword rdi,rsp ; pass the iframe using rdi
;extern x86_exception_handler
;call x86_exception_handler
extern fault_handler
call fault_handler
; restore general purpose registers */
pop qword rdi
pop qword rsi
pop qword rbp
pop qword rbx
pop qword rdx
pop qword rcx
pop qword rax
pop qword r8
pop qword r9
pop qword r10
pop qword r11
pop qword r12
pop qword r13
pop qword r14
pop qword r15
add rsp, 16
iretq
global _irq0
global _irq1
global _irq2
global _irq3
global _irq4
global _irq5
global _irq6
global _irq7
global _irq8
global _irq9
global _irq10
global _irq11
global _irq12
global _irq13
global _irq14
global _irq15
; 32: IRQ0
_irq0:
cli
push qword 0
push qword 32
jmp irq_common_stub
; 33: IRQ1
_irq1:
cli
push qword 0
push qword 33
jmp irq_common_stub
; 34: IRQ2
_irq2:
cli
push qword 0
push qword 34
jmp irq_common_stub
; 35: IRQ3
_irq3:
cli
push qword 0
push qword 35
jmp irq_common_stub
; 36: IRQ4
_irq4:
cli
push qword 0
push qword 36
jmp irq_common_stub
; 37: IRQ5
_irq5:
cli
push qword 0
push qword 37
jmp irq_common_stub
; 38: IRQ6
_irq6:
cli
push qword 0
push qword 38
jmp irq_common_stub
; 39: IRQ7
_irq7:
cli
push qword 0
push qword 39
jmp irq_common_stub
; 40: IRQ8
_irq8:
cli
push qword 0
push qword 40
jmp irq_common_stub
; 41: IRQ9
_irq9:
cli
push qword 0
push qword 41
jmp irq_common_stub
; 42: IRQ10
_irq10:
cli
push qword 0
push qword 42
jmp irq_common_stub
; 43: IRQ11
_irq11:
cli
push qword 0
push qword 43
jmp irq_common_stub
; 44: IRQ12
_irq12:
cli
push qword 0
push qword 44
jmp irq_common_stub
; 45: IRQ13
_irq13:
cli
push qword 0
push qword 45
jmp irq_common_stub
; 46: IRQ14
_irq14:
cli
push qword 0
push qword 46
jmp irq_common_stub
; 47: IRQ15
_irq15:
cli
push qword 0
push qword 47
jmp irq_common_stub
extern _irq_handler
irq_common_stub:
; save general purpose registers
push qword r15
push qword r14
push qword r13
push qword r12
push qword r11
push qword r10
push qword r9
push qword r8
push qword rax
push qword rcx
push qword rdx
push qword rbx
push qword rbp
push qword rsi
push qword rdi
mov qword rdi,rsp ; pass the iframe using rdi
;extern x86_exception_handler
;call x86_exception_handler
extern irq_handler
call irq_handler
; restore general purpose registers */
pop qword rdi
pop qword rsi
pop qword rbp
pop qword rbx
pop qword rdx
pop qword rcx
pop qword rax
pop qword r8
pop qword r9
pop qword r10
pop qword r11
pop qword r12
pop qword r13
pop qword r14
pop qword r15
add rsp, 16
iretq |
oeis/126/A126967.asm | neoneye/loda-programs | 11 | 11150 | ; A126967: Expansion of e.g.f.: sqrt(1+4*x)/(1+2*x).
; Submitted by <NAME>
; 1,0,-4,48,-624,9600,-175680,3790080,-95235840,2752081920,-90328089600,3328103116800,-136191650918400,6131573025177600,-301213549769932800,16030999766605824000,-918678402394841088000,56387623092958789632000,-3690023220507773140992000,256425697620583349354496000,-18856184232678643753943040000,1462693931345217200487137280000,-119358736852152118172799467520000,10220519428273777712166202245120000,-916286510533871555043546114293760000,85830273856506218888976735928320000000
mul $0,2
lpb $0
sub $0,1
add $3,1
mod $4,2
add $4,1
mul $3,$4
mul $3,$0
sub $2,$3
add $3,$2
lpe
mov $0,$3
add $0,1
|
test/Succeed/HDUfallback.agda | cruhland/agda | 1,989 | 9852 | <gh_stars>1000+
-- Example by <NAME> on the Agda mailing list.
-- If higher-dimensional unification fails and --without-K is not
-- enabled, we should still apply injectivity.
open import Agda.Builtin.Nat
postulate Fin : Nat → Set
data Indexed : Nat → Nat → Set where
con : ∀ m {n} (i : Fin n) → Indexed (m + n) (m + suc n)
data RelIndexed : ∀ {m n} → Indexed m n → Indexed m n → Set where
relIdx : ∀ {m n} (i : Fin n) (j : Fin n) → RelIndexed (con m i) (con m j)
test1 : ∀ {m n} {a b : Indexed m n} → RelIndexed a b → Indexed m n
test1 (relIdx {m} i _) = con m i
test2 : ∀ {m n} {a : Indexed m n} → RelIndexed a a → Indexed m n
test2 (relIdx {m} i _) = con m i
|
programs/oeis/007/A007744.asm | neoneye/loda | 22 | 171981 | ; A007744: Expansion of (1+6*x)/(1-4*x)^(7/2).
; 1,20,210,1680,11550,72072,420420,2333760,12471030,64664600,327202876,1622493600,7909656300,38003792400,180324117000,846321189120,3934071152550,18132120329400,82937661506700,376780512108000,1701164012167620,7637879238303600,34117964696719800,151692727725302400,671556346700557500,2961294866410778352,13010422711893508440,56967447594463757120,248651282740121143960,1082120921318482029600,4696404798522212008464,20329910470189804323840,87791859471854799531270,378254733371848227181560,1626233585517375163574700,6977537735085162334488672,29880659282193403515750100,127729450781151057249210800,545061548278014414660413400,2322155708640061411570992000,9877869845627661229470107220,41955973050435158345280526800,177956116986029396110764683400,753787078547637766543812331200,3188799676293984146691024273000,13473269150800655979796742557920,56860252134522617154813284991600,239693376132491901740887872268800,1009333826057915117487020024631900,4245844082959159802840025926190000,17842735174227573155454924952220856,74910675933319914977919177423395520,314214824865279022070842940213073960
mov $1,$0
add $0,1
seq $1,2802 ; a(n) = (2*n+3)!/(6*n!*(n+1)!).
mul $0,$1
|
programs/oeis/170/A170775.asm | neoneye/loda | 22 | 91274 | ; A170775: a(n) = n^8*(n^3 + 1)/2.
; 0,1,1152,91854,2129920,24609375,182238336,991545772,4303355904,15712053165,50050000000,142763014746,371719176192,896488062379,2025520479360,4326159375000,8798240505856,17139436032537,32139715019904,58253621230630,102412800000000,175157661700791,292186588642432,476444034449604,760895609241600,1192169189453125,1835276657026176,2779671498046002,4146943634735104,6100505006059395,8857678050000000,12704664893721136,18014948265295872,25271756461172529,35095314715968640,48275704624218750,65812262476087296,88960567129457167,119288199007845504,158740594665866460,209718476800000000,275168508320738781,358689001881232512,464652713835750154,598348964757012480,766147558173046875,975687215909977216,1236091513185337032,1558215580245295104,1954927140756778825,2441425781250000000,3035604691576416726,3758459484539748352,4634549094531301479,5692514171133525120,6965658825245312500,8492602053346983936,10318005661099956597,12493386031623627904,15078017637587723490,18139936780800000000,21757054659374417971,26018389511971339392,31025428272166545504,36893628884907458560,43754075192450390625,51755297090359395456,61065269486322786862,71873604466964987904,84393951991776427455,98866625390050000000,115561468937616405516,134780985836549701632,156863746014225801229,182188094299537564800,211176180725097656250,244298335946311499776,282077816062714498827,325095942475397119104,373997663818165417720,429497568460800000000,492386377601900042361,563537950547867731072,643916835415158987654,734586400196575395840,836717580900696484375,951598285308167584896,1080643492791102963492,1225406092613993365504,1387588505177898021285,1569055132786050000000,1771845688700026991506,1998189455523073523712,2250520526292761623779,2531494084090721303680,2844003778484456250000,3191200259707099938816,3576510934157199251857,4003661007564092671104,4476695885017054365150
mov $1,$0
pow $0,8
mov $2,$1
pow $2,3
mul $2,$0
add $0,$2
div $0,2
|
src/orig/dds-request_reply-untypedcommon.ads | alexcamposruiz/dds-requestreply | 0 | 14691 | <filename>src/orig/dds-request_reply-untypedcommon.ads
with DDS.DataReader_Impl;
with DDS.DataReaderListener;
with DDS.DataWriter_Impl;
with DDS.DomainParticipant;
with DDS.Publisher;
with DDS.ReadCondition;
with DDS.Subscriber;
with DDS.WaitSet;
with Dds.Topic;
with DDS.TopicDescription;
with Interfaces.C.Extensions;
with RTIDDS.Low_Level.Ndds_Reda_Reda_FastBuffer_H;
with Ada.Finalization;
with System;
with DDS.Request_Reply.Connext_C_Entity_Params; use DDS.Request_Reply.Connext_C_Entity_Params;
package DDS.Request_Reply.Untypedcommon is
use Dds;
type RTI_Connext_EntityUntypedImpl is abstract new Ada.Finalization.Limited_Controlled with record
Participant : DDS.DomainParticipant.Ref_Access;
Publisher : DDS.Publisher.Ref_Access;
Subscriber : DDS.Subscriber.Ref_Access;
Writer_Topic : DDS.Topic.Ref_Access;
Reader_Topic : DDS.TopicDescription.Ref_Access;
Writer : DDS.DataWriter_Impl.Ref_Access;
Reader : DDS.DataReader_Impl.Ref_Access;
Waitset : DDS.WaitSet.Ref_Access;
Not_Read_Sample_Cond : DDS.ReadCondition.Ref_Access;
Any_Sample_Cond : DDS.ReadCondition.Ref_Access;
Sample_Size : DDS.long := -1;
-- waitset_pool : RTIDDS.Low_Level.ndds_reda_reda_fastBuffer_h.REDAFastBufferPool;
Waitset_Pool : Interfaces.C.Extensions.Void_Ptr;
Max_Samples_Per_Read : DDS.long;
end record;
type RTI_Connext_EntityUntypedImpl_Access is access all RTI_Connext_EntityUntypedImpl'Class;
function RTI_Connext_CreateWriterTopicFunc
(Self : access RTI_Connext_EntityUntypedImpl;
Params : access RTI_Connext_EntityParams;
Name : DDS.String) return DDS.TopicDescription.Ref_Access is abstract;
function Create_Writer_Topic
(Self : access RTI_Connext_EntityUntypedImpl;
Params : access RTI_Connext_EntityParams;
Name : DDS.String) return DDS.TopicDescription.Ref_Access is abstract;
function RTI_Connext_Get_Or_Create_Topic
(Participant : DDS.DomainParticipant.Ref_Access;
Name : DDS.String;
Type_Name : DDS.String;
Allow_Cft : DDS.Boolean) return DDS.TopicDescription.Ref_Access
is (Participant.Get_Or_Create_Topic (Name, Type_Name).As_Topicdescription);
function RTI_Connext_Create_Request_Topic_Name_From_Service_Name (Service_Name : DDS.String) return DDS.String is
(DDS.To_DDS_String (DDS.To_Standard_String (Service_Name) & "Request"));
function RTI_Connext_Create_Reply_Topic_Name_From_Service_Name (Service_Name : DDS.String) return DDS.String is
(DDS.To_DDS_String (DDS.To_Standard_String (Service_Name) & "Reply"));
--
function RTI_Connext_EntityUntypedImpl_Initialize (Self : in out RTI_Connext_EntityUntypedImpl;
Params : RTI_Connext_EntityParams;
Writer_Type_Name : DDS.String;
Reader_Type_Name : DDS.String;
Sample_Size : DDS.long;
Reader_Listener : DDS.DataReaderListener.Ref_Access;
Role_Name : DDS.String) return DDS.ReturnCode_T;
function RTI_Connext_EntityUntypedImpl_Touch_Samples
(Self : not null access RTI_Connext_EntityUntypedImpl;
Max_Count : DDS.Integer;
Read_Condition : DDS.ReadCondition.Ref_Access) return Integer;
function RTI_Connext_EntityUntypedImpl_Wait_For_Any_Sample
(Self : not null access RTI_Connext_EntityUntypedImpl;
Max_Wait : DDS.Duration_T;
Min_Sample_Count : DDS.Integer) return DDS.ReturnCode_T;
function RTI_Connext_EntityUntypedImpl_Get_Sample_Loaned_W_Len
(Self : not null access RTI_Connext_EntityUntypedImpl;
Received_Data : System.Address;
Data_Count : in out DDS.Natural;
Is_Loan : in out DDS.Boolean;
DataSeqContiguousBuffer : System.Address;
Info_Seq : not null access DDS.SampleInfo_Seq.Sequence;
Data_Seq_Len : DDS.long;
Data_Seq_Max_Len : DDS.long;
Data_Seq_Has_Ownership : DDS.Boolean;
Max_Samples : DDS.long;
Read_Condition : DDS.ReadCondition.Ref_Access;
Take : DDS.Boolean) return DDS.ReturnCode_T;
function RTI_Connext_SimpleReplierParams_To_Entityparams
(Self : RTI_Connext_EntityParams'Class;
ToParams : out RTI_Connext_EntityParams) return ReturnCode_T;
function To_Entityparams
(Self : RTI_Connext_EntityParams'Class;
ToParams : out RTI_Connext_EntityParams) return ReturnCode_T renames RTI_Connext_SimpleReplierParams_To_Entityparams;
end DDS.Request_Reply.Untypedcommon;
|
src/hyperion-applications.ads | stcarrez/hyperion | 0 | 24111 | <gh_stars>0
-----------------------------------------------------------------------
-- hyperion -- hyperion applications
-- Copyright (C) 2017, 2018 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Servlet.Core.Measures;
with Servlet.Core.Files;
with Servlet.Filters.Dump;
with Servlet.Filters.Cache_Control;
with Servlet.Core.Rest;
with Servlet.Security.OAuth;
with Servlet.Security.Filters.OAuth;
with ASF.Servlets.Faces;
with ASF.Servlets.Ajax;
with ASF.Applications;
with ASF.Converters.Sizes;
with ASF.Security.Servlets;
with Security.OAuth.Servers;
with Security.OAuth.File_Registry;
with AWA.Users.Servlets;
with AWA.Users.Modules;
with AWA.Mail.Modules;
with AWA.Comments.Modules;
with AWA.Tags.Modules;
with AWA.Storages.Modules;
with AWA.Applications;
with AWA.Workspaces.Modules;
with AWA.Services.Filters;
with AWA.Wikis.Modules;
with AWA.Wikis.Previews;
with AWA.Images.Modules;
with AWA.Jobs.Modules;
with AWA.Counters.Modules;
with AWA.Converters.Dates;
with Hyperion.Hosts.Modules;
with Hyperion.Agents.Modules;
with Hyperion.Monitoring.Modules;
package Hyperion.Applications is
CONFIG_PATH : constant String := "hyperion";
CONTEXT_PATH : constant String := "/hyperion";
type Application is new AWA.Applications.Application with private;
type Application_Access is access all Application'Class;
-- Initialize the application.
procedure Initialize (App : in Application_Access;
Config : in ASF.Applications.Config);
-- Initialize the application configuration properties. Properties defined in <b>Conf</b>
-- are expanded by using the EL expression resolver.
overriding
procedure Initialize_Config (App : in out Application;
Conf : in out ASF.Applications.Config);
-- Initialize the servlets provided by the application.
-- This procedure is called by <b>Initialize</b>.
-- It should register the application servlets.
overriding
procedure Initialize_Servlets (App : in out Application);
-- Initialize the filters provided by the application.
-- This procedure is called by <b>Initialize</b>.
-- It should register the application filters.
overriding
procedure Initialize_Filters (App : in out Application);
-- Initialize the AWA modules provided by the application.
-- This procedure is called by <b>Initialize</b>.
-- It should register the modules used by the application.
overriding
procedure Initialize_Modules (App : in out Application);
private
type Application is new AWA.Applications.Application with record
Self : Application_Access;
-- Application servlets and filters (add new servlet and filter instances here).
Faces : aliased ASF.Servlets.Faces.Faces_Servlet;
Ajax : aliased ASF.Servlets.Ajax.Ajax_Servlet;
Files : aliased Servlet.Core.Files.File_Servlet;
Dump : aliased Servlet.Filters.Dump.Dump_Filter;
Service_Filter : aliased AWA.Services.Filters.Service_Filter;
Measures : aliased Servlet.Core.Measures.Measure_Servlet;
No_Cache : aliased Servlet.Filters.Cache_Control.Cache_Control_Filter;
Api : aliased Servlet.Core.Rest.Rest_Servlet;
-- Authentication servlet and filter.
Auth : aliased ASF.Security.Servlets.Request_Auth_Servlet;
Verify_Auth : aliased AWA.Users.Servlets.Verify_Auth_Servlet;
OAuth : aliased Servlet.Security.OAuth.Token_Servlet;
-- Converters shared by web requests.
Rel_Date_Converter : aliased AWA.Converters.Dates.Relative_Date_Converter;
Size_Converter : aliased ASF.Converters.Sizes.Size_Converter;
-- The application modules.
User_Module : aliased AWA.Users.Modules.User_Module;
Workspace_Module : aliased AWA.Workspaces.Modules.Workspace_Module;
Mail_Module : aliased AWA.Mail.Modules.Mail_Module;
Comment_Module : aliased AWA.Comments.Modules.Comment_Module;
Storage_Module : aliased AWA.Storages.Modules.Storage_Module;
Tag_Module : aliased AWA.Tags.Modules.Tag_Module;
Job_Module : aliased AWA.Jobs.Modules.Job_Module;
Image_Module : aliased AWA.Images.Modules.Image_Module;
Wiki_Module : aliased AWA.Wikis.Modules.Wiki_Module;
Preview_Module : aliased AWA.Wikis.Previews.Preview_Module;
Counter_Module : aliased AWA.Counters.Modules.Counter_Module;
-- REST security
Api_Auth : aliased Security.OAuth.Servers.Auth_Manager;
Apps : aliased Security.OAuth.File_Registry.File_Application_Manager;
Realm : aliased Security.OAuth.File_Registry.File_Realm_Manager;
Api_Filter : aliased Servlet.Security.Filters.OAuth.Auth_Filter;
-- Add your modules here.
Host_Module : aliased Hyperion.Hosts.Modules.Host_Module;
Agent_Module : aliased Hyperion.Agents.Modules.Agent_Module;
Monitoring_Module : aliased Hyperion.Monitoring.Modules.Monitoring_Module;
end record;
end Hyperion.Applications;
|
2018/asisf/light_fence/test/unencrypt.asm | theKidOfArcrania/ctf-writeups | 5 | 14340 | <reponame>theKidOfArcrania/ctf-writeups
BITS 64
%define REL_LOC 0x1CB0
%define REL_HUFF 0x18a0
%define REL_NSG 0x14a0
%macro xcall 1
db 0xe8
dd %1 - (REL_LOC + $ - $$ + 4)
%endmacro
unencrypt: ; file
push rbx
push rbp
mov rbp, rsp
sub rsp, 0x1510
mov rbx, rdi
mov rsi, 0
mov eax, 2 ; open
syscall
mov [rbp - 0x1504], eax
mov edi, eax
lea rsi, [rbp - 0x100]
mov edx, 0x4
mov eax, 0 ; read
syscall
mov al, [rbp - 0x100 + 3]
mov [rbp - 0x150d], al
mov edx, 0x100
mov eax, 0 ; read
syscall
; Create huff extension filename
mov rdx, 0x400
mov rsi, rbx
lea rdi, [rbp - 0x500]
call strncpy
mov rdx, 0x400
lea rsi, [rel huff_file]
lea rdi, [rbp - 0x500]
call strcat
; Copy contents of our encoded file into huff file.
mov edx, 436 ; 0664
mov esi, 65 ; O_WRONLY | O_CREAT
lea rdi, [rbp - 0x500]
mov eax, 2 ; open
syscall
mov [rbp - 0x1508], eax
.copy_loop:
mov edx, 0x1000
lea rsi, [rbp - 0x1500]
mov edi, [rbp - 0x1504]
mov eax, 0 ; read
syscall
cmp eax, 0
jle .end_loop
mov edx, eax
lea rsi, [rbp - 0x1500]
mov edi, [rbp - 0x1508]
mov eax, 1 ; write
syscall
jmp .copy_loop
.end_loop:
mov rdx, 0x400
mov rsi, rbx
lea rax, [rbp - 0x900]
mov rdi, rax
call strncpy
mov rdx, 0x400
lea rsi, [rel nsg_file]
lea rdi, [rbp - 0x900]
call strcat
; Remove extension for output file
mov rdx, 0x400
mov rsi, rbx
lea rdi, [rbp - 0xd00]
call strncpy
lea rdi, [rbp - 0xd00]
call strlen
mov byte [(rbp - 0xd00) + rax - 4], 0
; Call huff decryption
xor ecx, ecx
mov cl, [rbp - 0x150d] ; number of bits to skip
lea rdx, [rbp - 0x100] ; bit lengths
lea rsi, [rbp - 0x900] ; nsg file
lea rdi, [rbp - 0x500] ; huff file
xcall REL_HUFF ; 0x555555555ddd
lea rsi, [rbp - 0xd00] ; output_file
lea rdi, [rbp - 0x900] ; nsg file
xcall REL_NSG
lea rdi, [rbp - 0x900] ; nsg file
mov eax, 87 ; unlink
syscall
lea rdi, [rbp - 0x500] ; huff file
mov eax, 87 ; unlink
syscall
leave
pop rbx
ret
strlen: ; (str)
push rbp
mov rbp, rsp
xor ecx, ecx
xor al, al
not ecx
cld
repne scasb
not ecx
lea eax, [ecx - 1]
leave
ret
strcat: ; (dst, str, len)
push rbp
mov rbp, rsp
xor eax, eax
mov ecx, edx
cld
repne scasb
jnz .exit
dec rdi
mov edx, ecx
call strncpy
.exit:
leave
ret
strncpy: ; (dst, src, len)
push rbp
mov rbp, rsp
mov ecx, edx
test ecx, ecx
jz .end
.loop:
mov al, [rsi]
mov [rdi], al
test al, al
jz .end
inc rdi
inc rsi
dec ecx
jnz .loop
.end:
leave
ret
huff_file:
db ".huff", 0
nsg_file:
db ".nsg", 0
times (0x20e - ($ - $$)) db 0
|
smsq/sbas/procs/base.asm | olifink/smsqe | 0 | 83009 | <gh_stars>0
; SBAS_PROCS_BASE - Standard SBASIC Procedures Base V2.02 1992 <NAME>
section header
xref smsq_end
header_base
dc.l sb_initp-header_base ; length of header
dc.l 0 ; module length unknown
dc.l smsq_end-sb_initp ; loaded length
dc.l 0 ; checksum
dc.l 0 ; always select
dc.b 1 ; one level down
dc.b 0
dc.w smsq_name-*
smsq_name
dc.w 18,'SBASIC Procedures '
dc.l ' '
dc.w $200a
xdef tk2_ext
xref sb_procs
xref sb_tk2procs
xref sb_xtprocs
xref wmon_def ; to get it loaded
include 'dev8_keys_qlv'
include 'dev8_keys_sbasic'
include 'dev8_keys_err'
;+++
; Initialise SBASIC procedures
;---
sb_initp
lea sb_procs,a1 ; QL procedures
bsr.s sb_inipr
lea sb_xtprocs,a1 ; extra procedures
bsr.s sb_inipr
tk2_ext
lea sb_tk2procs,a1
sb_inipr
jmp sb.inipr*3+qlv.off
section exten
xdef dec_point
xdef zero_w
xdef prior
xdef pipe_len
xdef pipe_nol
dec_point dc.b '.'
zero_w dc.w 0
prior dc.w 8
pipe_len dc.w 9,'pipe_1024'
pipe_nol dc.w 4,'pipe'
end
|
src/chr.asm | mdsteele/nesfxr | 1 | 20289 | ;;;=========================================================================;;;
SIZEOF_CHR = 16
;;;=========================================================================;;;
.SEGMENT "CHR"
;; Pattern table 0:
.assert * = $0000, error
.res SIZEOF_CHR * $21
.incbin "out/data/font.chr"
.res SIZEOF_CHR * $81
;; Pattern table 1:
.assert * = $1000, error
.res SIZEOF_CHR * $21
.incbin "out/data/font.chr"
.res SIZEOF_CHR * $81
.assert * = $2000, error
;;;=========================================================================;;;
|
tools/scitools/conf/understand/ada/ada05/a-catizo.ads | brucegua/moocos | 1 | 12709 | <filename>tools/scitools/conf/understand/ada/ada05/a-catizo.ads
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . C A L E N D A R . T I M E _ Z O N E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2005 - 2006, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 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, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
--
--
--
--
--
--
--
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package Ada.Calendar.Time_Zones is
-- Time zone manipulation
type Time_Offset is range -28 * 60 .. 28 * 60;
Unknown_Zone_Error : exception;
function UTC_Time_Offset (Date : Time := Clock) return Time_Offset;
end Ada.Calendar.Time_Zones;
|
src/Util/Relation/Binary/LogicalEquivalence.agda | JLimperg/msc-thesis-code | 5 | 12761 | <filename>src/Util/Relation/Binary/LogicalEquivalence.agda
{-# OPTIONS --without-K --safe #-}
module Util.Relation.Binary.LogicalEquivalence where
open import Relation.Binary using (IsEquivalence ; Setoid)
open import Util.Prelude
private
variable
α β γ : Level
A B C : Set α
infix 4 _↔_
record _↔_ (A : Set α) (B : Set β) : Set (α ⊔ℓ β) where
field
forth : A → B
back : B → A
open _↔_ public
↔-refl : A ↔ A
↔-refl .forth = id
↔-refl .back = id
↔-reflexive : A ≡ B → A ↔ B
↔-reflexive refl = ↔-refl
↔-sym : A ↔ B → B ↔ A
↔-sym A↔B .forth = A↔B .back
↔-sym A↔B .back = A↔B .forth
↔-trans : A ↔ B → B ↔ C → A ↔ C
↔-trans A↔B B↔C .forth = B↔C .forth ∘ A↔B .forth
↔-trans A↔B B↔C .back = A↔B .back ∘ B↔C .back
↔-isEquivalence : IsEquivalence (_↔_ {α})
↔-isEquivalence = record
{ refl = ↔-refl
; sym = ↔-sym
; trans = ↔-trans
}
↔-setoid : ∀ α → Setoid (lsuc α) α
↔-setoid α .Setoid.Carrier = Set α
↔-setoid α .Setoid._≈_ = _↔_
↔-setoid α .Setoid.isEquivalence = ↔-isEquivalence
|
src/screen1.asm | mattemoore/nes_learning | 0 | 89876 | screen1:
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0e,$0f
.byte $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$1d,$1e,$1f
.byte $00,$00,$00,$00,$24,$00,$00,$00,$00,$00,$00,$00,$00,$00,$2e,$2f
.byte $00,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$49,$4a,$4b,$00,$4d,$02,$02
.byte $00,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5a,$5b,$5c,$5d,$5e,$5f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$69,$6a,$00,$00,$6d,$02,$02
.byte $00,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$88,$89,$8a,$00,$00,$8d,$02,$02
.byte $00,$91,$92,$93,$94,$95,$96,$97,$98,$99,$9a,$9b,$9c,$9d,$9e,$9f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$a8,$a9,$aa,$00,$00,$00,$02,$02
.byte $00,$b1,$b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9,$ba,$bb,$bc,$bd,$be,$bf
.byte $00,$00,$00,$00,$00,$00,$00,$00,$c8,$c9,$ca,$00,$00,$00,$02,$02
.byte $00,$d1,$d2,$d3,$d4,$d5,$d6,$d7,$d8,$d9,$da,$db,$dc,$dd,$de,$df
.byte $00,$00,$00,$00,$00,$00,$00,$00,$e8,$00,$00,$00,$00,$00,$02,$02
.byte $00,$f1,$f2,$f3,$f4,$f5,$f6,$f7,$f8,$f9,$fa,$fb,$fc,$fd,$fe,$ff
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02
.byte $00,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$1d,$1e,$1f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02
.byte $00,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02
.byte $00,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5a,$5b,$5c,$5d,$5e,$5f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02
.byte $00,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02
.byte $00,$91,$92,$93,$94,$95,$96,$97,$98,$99,$9a,$9b,$9c,$9d,$9e,$9f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02
.byte $00,$b1,$b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9,$ba,$bb,$bc,$bd,$be,$bf
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02
.byte $d0,$d1,$d2,$d3,$d4,$d5,$d6,$d7,$d8,$d9,$da,$db,$dc,$dd,$de,$df
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02
.byte $f0,$f1,$f2,$f3,$f4,$f5,$f6,$f7,$f8,$f9,$fa,$fb,$fc,$fd,$fe,$ff
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02
.byte $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$1d,$1e,$1f
.byte $00,$00,$00,$00,$00,$00,$26,$00,$00,$00,$2a,$00,$00,$00,$02,$02
.byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02
.byte $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5a,$5b,$5c,$5d,$5e,$5f
.byte $00,$00,$00,$00,$00,$65,$00,$00,$00,$69,$00,$00,$00,$00,$02,$02
.byte $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
.byte $00,$00,$00,$00,$00,$85,$86,$00,$88,$00,$8a,$00,$00,$00,$02,$02
.byte $90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$9a,$9b,$9c,$9d,$9e,$9f
.byte $00,$00,$00,$00,$00,$a5,$a6,$00,$00,$00,$aa,$00,$00,$00,$02,$02
.byte $b0,$b1,$b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9,$ba,$bb,$bc,$bd,$be,$bf
.byte $00,$00,$00,$00,$00,$c5,$00,$00,$c8,$00,$ca,$cb,$00,$00,$02,$02
.byte $d0,$d1,$d2,$d3,$d4,$d5,$d6,$d7,$d8,$d9,$da,$db,$dc,$dd,$de,$df
.byte $00,$00,$00,$00,$00,$00,$00,$e7,$00,$00,$ea,$eb,$ec,$00,$02,$02
.byte $f0,$f1,$f2,$f3,$f4,$f5,$f6,$f7,$f8,$f9,$fa,$fb,$fc,$fd,$fe,$ff
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02
.byte $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$1d,$1e,$1f
.byte $00,$00,$00,$00,$00,$00,$26,$27,$28,$29,$2a,$2b,$2c,$00,$02,$02
.byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f
.byte $00,$00,$00,$00,$00,$00,$00,$47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f
.byte $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5a,$5b,$5c,$5d,$5e,$5f
.byte $00,$00,$00,$00,$00,$00,$00,$67,$68,$69,$6a,$6b,$6c,$6d,$6e,$6f
.byte $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
.byte $00,$00,$00,$00,$00,$85,$86,$87,$88,$89,$8a,$8b,$8c,$8d,$8e,$8f
.byte $90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$9a,$9b,$9c,$9d,$9e,$9f
.byte $00,$00,$00,$00,$a4,$a5,$a6,$a7,$a8,$a9,$aa,$ab,$ac,$ad,$ae,$af
.byte $b0,$b1,$b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9,$ba,$bb,$bc,$bd,$be,$bf
.byte $ff,$ff,$ff,$73,$d5,$c5,$d6,$c7,$ff,$ff,$fe,$77,$dd,$0d,$00,$cf
.byte $ff,$ff,$ff,$77,$d1,$10,$00,$c0,$ff,$ff,$ff,$77,$dd,$11,$00,$cc
.byte $ff,$ff,$ff,$77,$e0,$20,$00,$d4,$ff,$3f,$cf,$77,$ec,$21,$11,$dd
.byte $ff,$f3,$f0,$f5,$f0,$70,$c0,$f0,$ff,$fb,$fa,$fb,$fc,$fd,$fe,$ff
|
src/smk-settings.adb | mgrojo/smk | 0 | 783 | <filename>src/smk-settings.adb<gh_stars>0
-- -----------------------------------------------------------------------------
-- smk, the smart make
-- © 2018 <NAME> <<EMAIL>>
-- SPDX-License-Identifier: APSL-2.0
-- -----------------------------------------------------------------------------
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
-- http://www.apache.org/licenses/LICENSE-2.0
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- -----------------------------------------------------------------------------
-- -----------------------------------------------------------------------------
-- Package: Smk.Settings body
--
-- Implementation Notes:
--
-- Portability Issues:
--
-- Anticipated Changes:
-- -----------------------------------------------------------------------------
with Ada.Directories;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
package body Smk.Settings is
Make_Fl_Name : Unbounded_String := Null_Unbounded_String;
Previous_Run_Fl_Name : Unbounded_String := Null_Unbounded_String;
-- --------------------------------------------------------------------------
-- Procedure: Set_Makefile_Name
-- --------------------------------------------------------------------------
procedure Set_Makefile_Name (Name : in String) is
begin
Make_Fl_Name := To_Unbounded_String (Name);
Previous_Run_Fl_Name := To_Unbounded_String
(Smk_File_Prefix & Ada.Directories.Simple_Name (Makefile_Name));
end Set_Makefile_Name;
-- --------------------------------------------------------------------------
-- Function: Makefile_Name
-- --------------------------------------------------------------------------
function Makefile_Name return String is
(To_String (Make_Fl_Name));
function Previous_Run_File_Name return String is
(To_String (Previous_Run_Fl_Name));
function Run_Dir_Name return String is
(Ada.Directories.Containing_Directory (Makefile_Name));
function Strace_Outfile_Name return String is
(Ada.Directories.Full_Name (Smk_File_Prefix & Strace_Outfile_Suffix));
end Smk.Settings;
|
programs/oeis/316/A316843.asm | jmorken/loda | 1 | 1425 | ; A316843: Column 1 of table A316841.
; 1,2,2,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13
mov $1,1
mov $2,$0
lpb $2
add $1,1
add $2,1
lpb $0
sub $0,1
lpe
add $0,$1
lpb $0
sub $2,$0
trn $0,2
lpe
trn $2,1
lpe
|
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/a-cbdlli.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 19274 | <reponame>JCGobbi/Nucleo-STM32G474RE
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.BOUNDED_DOUBLY_LINKED_LISTS --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2021, 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. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by <NAME>. --
------------------------------------------------------------------------------
with System; use type System.Address;
with System.Put_Images;
package body Ada.Containers.Bounded_Doubly_Linked_Lists with
SPARK_Mode => Off
is
pragma Warnings (Off, "variable ""Busy*"" is not referenced");
pragma Warnings (Off, "variable ""Lock*"" is not referenced");
-- See comment in Ada.Containers.Helpers
-----------------------
-- Local Subprograms --
-----------------------
procedure Allocate
(Container : in out List;
New_Item : Element_Type;
New_Node : out Count_Type);
procedure Allocate
(Container : in out List;
Stream : not null access Root_Stream_Type'Class;
New_Node : out Count_Type);
procedure Free
(Container : in out List;
X : Count_Type);
procedure Insert_Internal
(Container : in out List;
Before : Count_Type;
New_Node : Count_Type);
procedure Splice_Internal
(Target : in out List;
Before : Count_Type;
Source : in out List);
procedure Splice_Internal
(Target : in out List;
Before : Count_Type;
Source : in out List;
Src_Pos : Count_Type;
Tgt_Pos : out Count_Type);
function Vet (Position : Cursor) return Boolean;
-- Checks invariants of the cursor and its designated container, as a
-- simple way of detecting dangling references (see operation Free for a
-- description of the detection mechanism), returning True if all checks
-- pass. Invocations of Vet are used here as the argument of pragma Assert,
-- so the checks are performed only when assertions are enabled.
---------
-- "=" --
---------
function "=" (Left, Right : List) return Boolean is
begin
if Left.Length /= Right.Length then
return False;
end if;
if Left.Length = 0 then
return True;
end if;
declare
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
LN : Node_Array renames Left.Nodes;
RN : Node_Array renames Right.Nodes;
LI : Count_Type := Left.First;
RI : Count_Type := Right.First;
begin
for J in 1 .. Left.Length loop
if LN (LI).Element /= RN (RI).Element then
return False;
end if;
LI := LN (LI).Next;
RI := RN (RI).Next;
end loop;
end;
return True;
end "=";
--------------
-- Allocate --
--------------
procedure Allocate
(Container : in out List;
New_Item : Element_Type;
New_Node : out Count_Type)
is
N : Node_Array renames Container.Nodes;
begin
if Container.Free >= 0 then
New_Node := Container.Free;
-- We always perform the assignment first, before we change container
-- state, in order to defend against exceptions duration assignment.
N (New_Node).Element := New_Item;
Container.Free := N (New_Node).Next;
else
-- A negative free store value means that the links of the nodes in
-- the free store have not been initialized. In this case, the nodes
-- are physically contiguous in the array, starting at the index that
-- is the absolute value of the Container.Free, and continuing until
-- the end of the array (Nodes'Last).
New_Node := abs Container.Free;
-- As above, we perform this assignment first, before modifying any
-- container state.
N (New_Node).Element := New_Item;
Container.Free := Container.Free - 1;
end if;
end Allocate;
procedure Allocate
(Container : in out List;
Stream : not null access Root_Stream_Type'Class;
New_Node : out Count_Type)
is
N : Node_Array renames Container.Nodes;
begin
if Container.Free >= 0 then
New_Node := Container.Free;
-- We always perform the assignment first, before we change container
-- state, in order to defend against exceptions duration assignment.
Element_Type'Read (Stream, N (New_Node).Element);
Container.Free := N (New_Node).Next;
else
-- A negative free store value means that the links of the nodes in
-- the free store have not been initialized. In this case, the nodes
-- are physically contiguous in the array, starting at the index that
-- is the absolute value of the Container.Free, and continuing until
-- the end of the array (Nodes'Last).
New_Node := abs Container.Free;
-- As above, we perform this assignment first, before modifying any
-- container state.
Element_Type'Read (Stream, N (New_Node).Element);
Container.Free := Container.Free - 1;
end if;
end Allocate;
------------
-- Append --
------------
procedure Append
(Container : in out List;
New_Item : Element_Type;
Count : Count_Type)
is
begin
Insert (Container, No_Element, New_Item, Count);
end Append;
procedure Append
(Container : in out List;
New_Item : Element_Type)
is
begin
Insert (Container, No_Element, New_Item, 1);
end Append;
------------
-- Assign --
------------
procedure Assign (Target : in out List; Source : List) is
SN : Node_Array renames Source.Nodes;
J : Count_Type;
begin
if Target'Address = Source'Address then
return;
end if;
if Checks and then Target.Capacity < Source.Length then
raise Capacity_Error -- ???
with "Target capacity is less than Source length";
end if;
Target.Clear;
J := Source.First;
while J /= 0 loop
Target.Append (SN (J).Element);
J := SN (J).Next;
end loop;
end Assign;
-----------
-- Clear --
-----------
procedure Clear (Container : in out List) is
N : Node_Array renames Container.Nodes;
X : Count_Type;
begin
if Container.Length = 0 then
pragma Assert (Container.First = 0);
pragma Assert (Container.Last = 0);
pragma Assert (Container.TC = (Busy => 0, Lock => 0));
return;
end if;
pragma Assert (Container.First >= 1);
pragma Assert (Container.Last >= 1);
pragma Assert (N (Container.First).Prev = 0);
pragma Assert (N (Container.Last).Next = 0);
TC_Check (Container.TC);
while Container.Length > 1 loop
X := Container.First;
pragma Assert (N (N (X).Next).Prev = Container.First);
Container.First := N (X).Next;
N (Container.First).Prev := 0;
Container.Length := Container.Length - 1;
Free (Container, X);
end loop;
X := Container.First;
pragma Assert (X = Container.Last);
Container.First := 0;
Container.Last := 0;
Container.Length := 0;
Free (Container, X);
end Clear;
------------------------
-- Constant_Reference --
------------------------
function Constant_Reference
(Container : aliased List;
Position : Cursor) return Constant_Reference_Type
is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert (Vet (Position), "bad cursor in Constant_Reference");
declare
N : Node_Type renames Container.Nodes (Position.Node);
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Constant_Reference_Type :=
(Element => N.Element'Access,
Control => (Controlled with TC))
do
Busy (TC.all);
end return;
end;
end Constant_Reference;
--------------
-- Contains --
--------------
function Contains
(Container : List;
Item : Element_Type) return Boolean
is
begin
return Find (Container, Item) /= No_Element;
end Contains;
----------
-- Copy --
----------
function Copy (Source : List; Capacity : Count_Type := 0) return List is
C : Count_Type;
begin
if Capacity < Source.Length then
if Checks and then Capacity /= 0 then
raise Capacity_Error
with "Requested capacity is less than Source length";
end if;
C := Source.Length;
else
C := Capacity;
end if;
return Target : List (Capacity => C) do
Assign (Target => Target, Source => Source);
end return;
end Copy;
------------
-- Delete --
------------
procedure Delete
(Container : in out List;
Position : in out Cursor;
Count : Count_Type := 1)
is
N : Node_Array renames Container.Nodes;
X : Count_Type;
begin
TC_Check (Container.TC);
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert (Vet (Position), "bad cursor in Delete");
pragma Assert (Container.First >= 1);
pragma Assert (Container.Last >= 1);
pragma Assert (N (Container.First).Prev = 0);
pragma Assert (N (Container.Last).Next = 0);
if Position.Node = Container.First then
Delete_First (Container, Count);
Position := No_Element;
return;
end if;
if Count = 0 then
Position := No_Element;
return;
end if;
for Index in 1 .. Count loop
pragma Assert (Container.Length >= 2);
X := Position.Node;
Container.Length := Container.Length - 1;
if X = Container.Last then
Position := No_Element;
Container.Last := N (X).Prev;
N (Container.Last).Next := 0;
Free (Container, X);
return;
end if;
Position.Node := N (X).Next;
N (N (X).Next).Prev := N (X).Prev;
N (N (X).Prev).Next := N (X).Next;
Free (Container, X);
end loop;
Position := No_Element;
end Delete;
------------------
-- Delete_First --
------------------
procedure Delete_First
(Container : in out List;
Count : Count_Type := 1)
is
N : Node_Array renames Container.Nodes;
X : Count_Type;
begin
TC_Check (Container.TC);
if Count >= Container.Length then
Clear (Container);
return;
end if;
if Count = 0 then
return;
end if;
for J in 1 .. Count loop
X := Container.First;
pragma Assert (N (N (X).Next).Prev = Container.First);
Container.First := N (X).Next;
N (Container.First).Prev := 0;
Container.Length := Container.Length - 1;
Free (Container, X);
end loop;
end Delete_First;
-----------------
-- Delete_Last --
-----------------
procedure Delete_Last
(Container : in out List;
Count : Count_Type := 1)
is
N : Node_Array renames Container.Nodes;
X : Count_Type;
begin
TC_Check (Container.TC);
if Count >= Container.Length then
Clear (Container);
return;
end if;
if Count = 0 then
return;
end if;
for J in 1 .. Count loop
X := Container.Last;
pragma Assert (N (N (X).Prev).Next = Container.Last);
Container.Last := N (X).Prev;
N (Container.Last).Next := 0;
Container.Length := Container.Length - 1;
Free (Container, X);
end loop;
end Delete_Last;
-------------
-- Element --
-------------
function Element (Position : Cursor) return Element_Type is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor has no element";
end if;
pragma Assert (Vet (Position), "bad cursor in Element");
return Position.Container.Nodes (Position.Node).Element;
end Element;
-----------
-- Empty --
-----------
function Empty (Capacity : Count_Type := 10) return List is
begin
return Result : List (Capacity) do
null;
end return;
end Empty;
--------------
-- Finalize --
--------------
procedure Finalize (Object : in out Iterator) is
begin
if Object.Container /= null then
Unbusy (Object.Container.TC);
end if;
end Finalize;
----------
-- Find --
----------
function Find
(Container : List;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor
is
Nodes : Node_Array renames Container.Nodes;
Node : Count_Type := Position.Node;
begin
if Node = 0 then
Node := Container.First;
else
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert (Vet (Position), "bad cursor in Find");
end if;
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
declare
Lock : With_Lock (Container.TC'Unrestricted_Access);
begin
while Node /= 0 loop
if Nodes (Node).Element = Item then
return Cursor'(Container'Unrestricted_Access, Node);
end if;
Node := Nodes (Node).Next;
end loop;
return No_Element;
end;
end Find;
-----------
-- First --
-----------
function First (Container : List) return Cursor is
begin
if Container.First = 0 then
return No_Element;
else
return Cursor'(Container'Unrestricted_Access, Container.First);
end if;
end First;
function First (Object : Iterator) return Cursor is
begin
-- The value of the iterator object's Node component influences the
-- behavior of the First (and Last) selector function.
-- When the Node component is 0, this means the iterator object was
-- constructed without a start expression, in which case the (forward)
-- iteration starts from the (logical) beginning of the entire sequence
-- of items (corresponding to Container.First, for a forward iterator).
-- Otherwise, this is iteration over a partial sequence of items. When
-- the Node component is positive, the iterator object was constructed
-- with a start expression, that specifies the position from which the
-- (forward) partial iteration begins.
if Object.Node = 0 then
return Bounded_Doubly_Linked_Lists.First (Object.Container.all);
else
return Cursor'(Object.Container, Object.Node);
end if;
end First;
-------------------
-- First_Element --
-------------------
function First_Element (Container : List) return Element_Type is
begin
if Checks and then Container.First = 0 then
raise Constraint_Error with "list is empty";
end if;
return Container.Nodes (Container.First).Element;
end First_Element;
----------
-- Free --
----------
procedure Free
(Container : in out List;
X : Count_Type)
is
pragma Assert (X > 0);
pragma Assert (X <= Container.Capacity);
N : Node_Array renames Container.Nodes;
pragma Assert (N (X).Prev >= 0); -- node is active
begin
-- The list container actually contains two lists: one for the "active"
-- nodes that contain elements that have been inserted onto the list,
-- and another for the "inactive" nodes for the free store.
-- We desire that merely declaring an object should have only minimal
-- cost; specially, we want to avoid having to initialize the free
-- store (to fill in the links), especially if the capacity is large.
-- The head of the free list is indicated by Container.Free. If its
-- value is non-negative, then the free store has been initialized in
-- the "normal" way: Container.Free points to the head of the list of
-- free (inactive) nodes, and the value 0 means the free list is empty.
-- Each node on the free list has been initialized to point to the next
-- free node (via its Next component), and the value 0 means that this
-- is the last free node.
-- If Container.Free is negative, then the links on the free store have
-- not been initialized. In this case the link values are implied: the
-- free store comprises the components of the node array started with
-- the absolute value of Container.Free, and continuing until the end of
-- the array (Nodes'Last).
-- If the list container is manipulated on one end only (for example if
-- the container were being used as a stack), then there is no need to
-- initialize the free store, since the inactive nodes are physically
-- contiguous (in fact, they lie immediately beyond the logical end
-- being manipulated). The only time we need to actually initialize the
-- nodes in the free store is if the node that becomes inactive is not
-- at the end of the list. The free store would then be discontiguous
-- and so its nodes would need to be linked in the traditional way.
-- ???
-- It might be possible to perform an optimization here. Suppose that
-- the free store can be represented as having two parts: one comprising
-- the non-contiguous inactive nodes linked together in the normal way,
-- and the other comprising the contiguous inactive nodes (that are not
-- linked together, at the end of the nodes array). This would allow us
-- to never have to initialize the free store, except in a lazy way as
-- nodes become inactive.
-- When an element is deleted from the list container, its node becomes
-- inactive, and so we set its Prev component to a negative value, to
-- indicate that it is now inactive. This provides a useful way to
-- detect a dangling cursor reference (and which is used in Vet).
N (X).Prev := -1; -- Node is deallocated (not on active list)
if Container.Free >= 0 then
-- The free store has previously been initialized. All we need to
-- do here is link the newly-free'd node onto the free list.
N (X).Next := Container.Free;
Container.Free := X;
elsif X + 1 = abs Container.Free then
-- The free store has not been initialized, and the node becoming
-- inactive immediately precedes the start of the free store. All
-- we need to do is move the start of the free store back by one.
-- Note: initializing Next to zero is not strictly necessary but
-- seems cleaner and marginally safer.
N (X).Next := 0;
Container.Free := Container.Free + 1;
else
-- The free store has not been initialized, and the node becoming
-- inactive does not immediately precede the free store. Here we
-- first initialize the free store (meaning the links are given
-- values in the traditional way), and then link the newly-free'd
-- node onto the head of the free store.
-- ???
-- See the comments above for an optimization opportunity. If the
-- next link for a node on the free store is negative, then this
-- means the remaining nodes on the free store are physically
-- contiguous, starting as the absolute value of that index value.
Container.Free := abs Container.Free;
if Container.Free > Container.Capacity then
Container.Free := 0;
else
for I in Container.Free .. Container.Capacity - 1 loop
N (I).Next := I + 1;
end loop;
N (Container.Capacity).Next := 0;
end if;
N (X).Next := Container.Free;
Container.Free := X;
end if;
end Free;
---------------------
-- Generic_Sorting --
---------------------
package body Generic_Sorting is
---------------
-- Is_Sorted --
---------------
function Is_Sorted (Container : List) return Boolean is
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
Lock : With_Lock (Container.TC'Unrestricted_Access);
Nodes : Node_Array renames Container.Nodes;
Node : Count_Type;
begin
Node := Container.First;
for J in 2 .. Container.Length loop
if Nodes (Nodes (Node).Next).Element < Nodes (Node).Element then
return False;
end if;
Node := Nodes (Node).Next;
end loop;
return True;
end Is_Sorted;
-----------
-- Merge --
-----------
procedure Merge
(Target : in out List;
Source : in out List)
is
begin
TC_Check (Target.TC);
TC_Check (Source.TC);
-- The semantics of Merge changed slightly per AI05-0021. It was
-- originally the case that if Target and Source denoted the same
-- container object, then the GNAT implementation of Merge did
-- nothing. However, it was argued that RM05 did not precisely
-- specify the semantics for this corner case. The decision of the
-- ARG was that if Target and Source denote the same non-empty
-- container object, then Program_Error is raised.
if Source.Is_Empty then
return;
end if;
if Checks and then Target'Address = Source'Address then
raise Program_Error with
"Target and Source denote same non-empty container";
end if;
if Checks and then Target.Length > Count_Type'Last - Source.Length
then
raise Constraint_Error with "new length exceeds maximum";
end if;
if Checks and then Target.Length + Source.Length > Target.Capacity
then
raise Capacity_Error with "new length exceeds target capacity";
end if;
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
declare
Lock_Target : With_Lock (Target.TC'Unchecked_Access);
Lock_Source : With_Lock (Source.TC'Unchecked_Access);
LN : Node_Array renames Target.Nodes;
RN : Node_Array renames Source.Nodes;
LI, LJ, RI, RJ : Count_Type;
begin
LI := Target.First;
RI := Source.First;
while RI /= 0 loop
pragma Assert (RN (RI).Next = 0
or else not (RN (RN (RI).Next).Element <
RN (RI).Element));
if LI = 0 then
Splice_Internal (Target, 0, Source);
exit;
end if;
pragma Assert (LN (LI).Next = 0
or else not (LN (LN (LI).Next).Element <
LN (LI).Element));
if RN (RI).Element < LN (LI).Element then
RJ := RI;
RI := RN (RI).Next;
Splice_Internal (Target, LI, Source, RJ, LJ);
else
LI := LN (LI).Next;
end if;
end loop;
end;
end Merge;
----------
-- Sort --
----------
procedure Sort (Container : in out List) is
N : Node_Array renames Container.Nodes;
procedure Partition (Pivot, Back : Count_Type);
-- What does this do ???
procedure Sort (Front, Back : Count_Type);
-- Internal procedure, what does it do??? rename it???
---------------
-- Partition --
---------------
procedure Partition (Pivot, Back : Count_Type) is
Node : Count_Type;
begin
Node := N (Pivot).Next;
while Node /= Back loop
if N (Node).Element < N (Pivot).Element then
declare
Prev : constant Count_Type := N (Node).Prev;
Next : constant Count_Type := N (Node).Next;
begin
N (Prev).Next := Next;
if Next = 0 then
Container.Last := Prev;
else
N (Next).Prev := Prev;
end if;
N (Node).Next := Pivot;
N (Node).Prev := N (Pivot).Prev;
N (Pivot).Prev := Node;
if N (Node).Prev = 0 then
Container.First := Node;
else
N (N (Node).Prev).Next := Node;
end if;
Node := Next;
end;
else
Node := N (Node).Next;
end if;
end loop;
end Partition;
----------
-- Sort --
----------
procedure Sort (Front, Back : Count_Type) is
Pivot : constant Count_Type :=
(if Front = 0 then Container.First else N (Front).Next);
begin
if Pivot /= Back then
Partition (Pivot, Back);
Sort (Front, Pivot);
Sort (Pivot, Back);
end if;
end Sort;
-- Start of processing for Sort
begin
if Container.Length <= 1 then
return;
end if;
pragma Assert (N (Container.First).Prev = 0);
pragma Assert (N (Container.Last).Next = 0);
TC_Check (Container.TC);
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
declare
Lock : With_Lock (Container.TC'Unchecked_Access);
begin
Sort (Front => 0, Back => 0);
end;
pragma Assert (N (Container.First).Prev = 0);
pragma Assert (N (Container.Last).Next = 0);
end Sort;
end Generic_Sorting;
------------------------
-- Get_Element_Access --
------------------------
function Get_Element_Access
(Position : Cursor) return not null Element_Access is
begin
return Position.Container.Nodes (Position.Node).Element'Access;
end Get_Element_Access;
-----------------
-- Has_Element --
-----------------
function Has_Element (Position : Cursor) return Boolean is
begin
pragma Assert (Vet (Position), "bad cursor in Has_Element");
return Position.Node /= 0;
end Has_Element;
------------
-- Insert --
------------
procedure Insert
(Container : in out List;
Before : Cursor;
New_Item : Element_Type;
Position : out Cursor;
Count : Count_Type := 1)
is
First_Node : Count_Type;
New_Node : Count_Type;
begin
TC_Check (Container.TC);
if Before.Container /= null then
if Checks and then Before.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Before cursor designates wrong list";
end if;
pragma Assert (Vet (Before), "bad cursor in Insert");
end if;
if Count = 0 then
Position := Before;
return;
end if;
if Checks and then Container.Length > Container.Capacity - Count then
raise Capacity_Error with "capacity exceeded";
end if;
Allocate (Container, New_Item, New_Node);
First_Node := New_Node;
Insert_Internal (Container, Before.Node, New_Node);
for Index in Count_Type'(2) .. Count loop
Allocate (Container, New_Item, New_Node);
Insert_Internal (Container, Before.Node, New_Node);
end loop;
Position := Cursor'(Container'Unchecked_Access, First_Node);
end Insert;
procedure Insert
(Container : in out List;
Before : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1)
is
Position : Cursor;
pragma Unreferenced (Position);
begin
Insert (Container, Before, New_Item, Position, Count);
end Insert;
procedure Insert
(Container : in out List;
Before : Cursor;
Position : out Cursor;
Count : Count_Type := 1)
is
pragma Warnings (Off);
Default_Initialized_Item : Element_Type;
pragma Unmodified (Default_Initialized_Item);
-- OK to reference, see below. Note that we need to suppress both the
-- front end warning and the back end warning. In addition, pragma
-- Unmodified is needed to suppress the warning ``actual type for
-- "Element_Type" should be fully initialized type'' on certain
-- instantiations.
begin
-- There is no explicit element provided, but in an instance the element
-- type may be a scalar with a Default_Value aspect, or a composite
-- type with such a scalar component, or components with default
-- initialization, so insert the specified number of possibly
-- initialized elements at the given position.
Insert (Container, Before, Default_Initialized_Item, Position, Count);
pragma Warnings (On);
end Insert;
---------------------
-- Insert_Internal --
---------------------
procedure Insert_Internal
(Container : in out List;
Before : Count_Type;
New_Node : Count_Type)
is
N : Node_Array renames Container.Nodes;
begin
if Container.Length = 0 then
pragma Assert (Before = 0);
pragma Assert (Container.First = 0);
pragma Assert (Container.Last = 0);
Container.First := New_Node;
N (Container.First).Prev := 0;
Container.Last := New_Node;
N (Container.Last).Next := 0;
-- Before = zero means append
elsif Before = 0 then
pragma Assert (N (Container.Last).Next = 0);
N (Container.Last).Next := New_Node;
N (New_Node).Prev := Container.Last;
Container.Last := New_Node;
N (Container.Last).Next := 0;
-- Before = Container.First means prepend
elsif Before = Container.First then
pragma Assert (N (Container.First).Prev = 0);
N (Container.First).Prev := New_Node;
N (New_Node).Next := Container.First;
Container.First := New_Node;
N (Container.First).Prev := 0;
else
pragma Assert (N (Container.First).Prev = 0);
pragma Assert (N (Container.Last).Next = 0);
N (New_Node).Next := Before;
N (New_Node).Prev := N (Before).Prev;
N (N (Before).Prev).Next := New_Node;
N (Before).Prev := New_Node;
end if;
Container.Length := Container.Length + 1;
end Insert_Internal;
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : List) return Boolean is
begin
return Container.Length = 0;
end Is_Empty;
-------------
-- Iterate --
-------------
procedure Iterate
(Container : List;
Process : not null access procedure (Position : Cursor))
is
Busy : With_Busy (Container.TC'Unrestricted_Access);
Node : Count_Type := Container.First;
begin
while Node /= 0 loop
Process (Cursor'(Container'Unrestricted_Access, Node));
Node := Container.Nodes (Node).Next;
end loop;
end Iterate;
function Iterate
(Container : List)
return List_Iterator_Interfaces.Reversible_Iterator'Class
is
begin
-- The value of the Node component influences the behavior of the First
-- and Last selector functions of the iterator object. When the Node
-- component is 0 (as is the case here), this means the iterator
-- object was constructed without a start expression. This is a
-- complete iterator, meaning that the iteration starts from the
-- (logical) beginning of the sequence of items.
-- Note: For a forward iterator, Container.First is the beginning, and
-- for a reverse iterator, Container.Last is the beginning.
return It : constant Iterator :=
Iterator'(Limited_Controlled with
Container => Container'Unrestricted_Access,
Node => 0)
do
Busy (Container.TC'Unrestricted_Access.all);
end return;
end Iterate;
function Iterate
(Container : List;
Start : Cursor)
return List_Iterator_Interfaces.Reversible_Iterator'class
is
begin
-- It was formerly the case that when Start = No_Element, the partial
-- iterator was defined to behave the same as for a complete iterator,
-- and iterate over the entire sequence of items. However, those
-- semantics were unintuitive and arguably error-prone (it is too easy
-- to accidentally create an endless loop), and so they were changed,
-- per the ARG meeting in Denver on 2011/11. However, there was no
-- consensus about what positive meaning this corner case should have,
-- and so it was decided to simply raise an exception. This does imply,
-- however, that it is not possible to use a partial iterator to specify
-- an empty sequence of items.
if Checks and then Start = No_Element then
raise Constraint_Error with
"Start position for iterator equals No_Element";
end if;
if Checks and then Start.Container /= Container'Unrestricted_Access then
raise Program_Error with
"Start cursor of Iterate designates wrong list";
end if;
pragma Assert (Vet (Start), "Start cursor of Iterate is bad");
-- The value of the Node component influences the behavior of the First
-- and Last selector functions of the iterator object. When the Node
-- component is positive (as is the case here), it means that this
-- is a partial iteration, over a subset of the complete sequence of
-- items. The iterator object was constructed with a start expression,
-- indicating the position from which the iteration begins. Note that
-- the start position has the same value irrespective of whether this
-- is a forward or reverse iteration.
return It : constant Iterator :=
Iterator'(Limited_Controlled with
Container => Container'Unrestricted_Access,
Node => Start.Node)
do
Busy (Container.TC'Unrestricted_Access.all);
end return;
end Iterate;
----------
-- Last --
----------
function Last (Container : List) return Cursor is
begin
if Container.Last = 0 then
return No_Element;
else
return Cursor'(Container'Unrestricted_Access, Container.Last);
end if;
end Last;
function Last (Object : Iterator) return Cursor is
begin
-- The value of the iterator object's Node component influences the
-- behavior of the Last (and First) selector function.
-- When the Node component is 0, this means the iterator object was
-- constructed without a start expression, in which case the (reverse)
-- iteration starts from the (logical) beginning of the entire sequence
-- (corresponding to Container.Last, for a reverse iterator).
-- Otherwise, this is iteration over a partial sequence of items. When
-- the Node component is positive, the iterator object was constructed
-- with a start expression, that specifies the position from which the
-- (reverse) partial iteration begins.
if Object.Node = 0 then
return Bounded_Doubly_Linked_Lists.Last (Object.Container.all);
else
return Cursor'(Object.Container, Object.Node);
end if;
end Last;
------------------
-- Last_Element --
------------------
function Last_Element (Container : List) return Element_Type is
begin
if Checks and then Container.Last = 0 then
raise Constraint_Error with "list is empty";
end if;
return Container.Nodes (Container.Last).Element;
end Last_Element;
------------
-- Length --
------------
function Length (Container : List) return Count_Type is
begin
return Container.Length;
end Length;
----------
-- Move --
----------
procedure Move
(Target : in out List;
Source : in out List)
is
N : Node_Array renames Source.Nodes;
X : Count_Type;
begin
TC_Check (Source.TC);
if Target'Address = Source'Address then
return;
end if;
if Checks and then Target.Capacity < Source.Length then
raise Capacity_Error with "Source length exceeds Target capacity";
end if;
-- Clear target, note that this checks busy bits of Target
Clear (Target);
while Source.Length > 1 loop
pragma Assert (Source.First in 1 .. Source.Capacity);
pragma Assert (Source.Last /= Source.First);
pragma Assert (N (Source.First).Prev = 0);
pragma Assert (N (Source.Last).Next = 0);
-- Copy first element from Source to Target
X := Source.First;
Append (Target, N (X).Element);
-- Unlink first node of Source
Source.First := N (X).Next;
N (Source.First).Prev := 0;
Source.Length := Source.Length - 1;
-- The representation invariants for Source have been restored. It is
-- now safe to free the unlinked node, without fear of corrupting the
-- active links of Source.
-- Note that the algorithm we use here models similar algorithms used
-- in the unbounded form of the doubly-linked list container. In that
-- case, Free is an instantation of Unchecked_Deallocation, which can
-- fail (because PE will be raised if controlled Finalize fails), so
-- we must defer the call until the last step. Here in the bounded
-- form, Free merely links the node we have just "deallocated" onto a
-- list of inactive nodes, so technically Free cannot fail. However,
-- for consistency, we handle Free the same way here as we do for the
-- unbounded form, with the pessimistic assumption that it can fail.
Free (Source, X);
end loop;
if Source.Length = 1 then
pragma Assert (Source.First in 1 .. Source.Capacity);
pragma Assert (Source.Last = Source.First);
pragma Assert (N (Source.First).Prev = 0);
pragma Assert (N (Source.Last).Next = 0);
-- Copy element from Source to Target
X := Source.First;
Append (Target, N (X).Element);
-- Unlink node of Source
Source.First := 0;
Source.Last := 0;
Source.Length := 0;
-- Return the unlinked node to the free store
Free (Source, X);
end if;
end Move;
----------
-- Next --
----------
procedure Next (Position : in out Cursor) is
begin
Position := Next (Position);
end Next;
function Next (Position : Cursor) return Cursor is
begin
if Position.Node = 0 then
return No_Element;
end if;
pragma Assert (Vet (Position), "bad cursor in Next");
declare
Nodes : Node_Array renames Position.Container.Nodes;
Node : constant Count_Type := Nodes (Position.Node).Next;
begin
if Node = 0 then
return No_Element;
else
return Cursor'(Position.Container, Node);
end if;
end;
end Next;
function Next
(Object : Iterator;
Position : Cursor) return Cursor
is
begin
if Position.Container = null then
return No_Element;
end if;
if Checks and then Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Next designates wrong list";
end if;
return Next (Position);
end Next;
-------------
-- Prepend --
-------------
procedure Prepend
(Container : in out List;
New_Item : Element_Type;
Count : Count_Type := 1)
is
begin
Insert (Container, First (Container), New_Item, Count);
end Prepend;
--------------
-- Previous --
--------------
procedure Previous (Position : in out Cursor) is
begin
Position := Previous (Position);
end Previous;
function Previous (Position : Cursor) return Cursor is
begin
if Position.Node = 0 then
return No_Element;
end if;
pragma Assert (Vet (Position), "bad cursor in Previous");
declare
Nodes : Node_Array renames Position.Container.Nodes;
Node : constant Count_Type := Nodes (Position.Node).Prev;
begin
if Node = 0 then
return No_Element;
else
return Cursor'(Position.Container, Node);
end if;
end;
end Previous;
function Previous
(Object : Iterator;
Position : Cursor) return Cursor
is
begin
if Position.Container = null then
return No_Element;
end if;
if Checks and then Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Previous designates wrong list";
end if;
return Previous (Position);
end Previous;
----------------------
-- Pseudo_Reference --
----------------------
function Pseudo_Reference
(Container : aliased List'Class) return Reference_Control_Type
is
TC : constant Tamper_Counts_Access := Container.TC'Unrestricted_Access;
begin
return R : constant Reference_Control_Type := (Controlled with TC) do
Busy (TC.all);
end return;
end Pseudo_Reference;
-------------------
-- Query_Element --
-------------------
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type))
is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor has no element";
end if;
pragma Assert (Vet (Position), "bad cursor in Query_Element");
declare
Lock : With_Lock (Position.Container.TC'Unrestricted_Access);
C : List renames Position.Container.all'Unrestricted_Access.all;
N : Node_Type renames C.Nodes (Position.Node);
begin
Process (N.Element);
end;
end Query_Element;
---------------
-- Put_Image --
---------------
procedure Put_Image
(S : in out Ada.Strings.Text_Buffers.Root_Buffer_Type'Class; V : List)
is
First_Time : Boolean := True;
use System.Put_Images;
begin
Array_Before (S);
for X of V loop
if First_Time then
First_Time := False;
else
Simple_Array_Between (S);
end if;
Element_Type'Put_Image (S, X);
end loop;
Array_After (S);
end Put_Image;
----------
-- Read --
----------
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out List)
is
N : Count_Type'Base;
X : Count_Type;
begin
Clear (Item);
Count_Type'Base'Read (Stream, N);
if Checks and then N < 0 then
raise Program_Error with "bad list length (corrupt stream)";
end if;
if N = 0 then
return;
end if;
if Checks and then N > Item.Capacity then
raise Constraint_Error with "length exceeds capacity";
end if;
for Idx in 1 .. N loop
Allocate (Item, Stream, New_Node => X);
Insert_Internal (Item, Before => 0, New_Node => X);
end loop;
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Cursor)
is
begin
raise Program_Error with "attempt to stream list cursor";
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
---------------
-- Reference --
---------------
function Reference
(Container : aliased in out List;
Position : Cursor) return Reference_Type
is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert (Vet (Position), "bad cursor in function Reference");
declare
N : Node_Type renames Container.Nodes (Position.Node);
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Reference_Type :=
(Element => N.Element'Access,
Control => (Controlled with TC))
do
Busy (TC.all);
end return;
end;
end Reference;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Container : in out List;
Position : Cursor;
New_Item : Element_Type)
is
begin
TE_Check (Container.TC);
if Checks and then Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unchecked_Access then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert (Vet (Position), "bad cursor in Replace_Element");
Container.Nodes (Position.Node).Element := New_Item;
end Replace_Element;
----------------------
-- Reverse_Elements --
----------------------
procedure Reverse_Elements (Container : in out List) is
N : Node_Array renames Container.Nodes;
I : Count_Type := Container.First;
J : Count_Type := Container.Last;
procedure Swap (L, R : Count_Type);
----------
-- Swap --
----------
procedure Swap (L, R : Count_Type) is
LN : constant Count_Type := N (L).Next;
LP : constant Count_Type := N (L).Prev;
RN : constant Count_Type := N (R).Next;
RP : constant Count_Type := N (R).Prev;
begin
if LP /= 0 then
N (LP).Next := R;
end if;
if RN /= 0 then
N (RN).Prev := L;
end if;
N (L).Next := RN;
N (R).Prev := LP;
if LN = R then
pragma Assert (RP = L);
N (L).Prev := R;
N (R).Next := L;
else
N (L).Prev := RP;
N (RP).Next := L;
N (R).Next := LN;
N (LN).Prev := R;
end if;
end Swap;
-- Start of processing for Reverse_Elements
begin
if Container.Length <= 1 then
return;
end if;
pragma Assert (N (Container.First).Prev = 0);
pragma Assert (N (Container.Last).Next = 0);
TC_Check (Container.TC);
Container.First := J;
Container.Last := I;
loop
Swap (L => I, R => J);
J := N (J).Next;
exit when I = J;
I := N (I).Prev;
exit when I = J;
Swap (L => J, R => I);
I := N (I).Next;
exit when I = J;
J := N (J).Prev;
exit when I = J;
end loop;
pragma Assert (N (Container.First).Prev = 0);
pragma Assert (N (Container.Last).Next = 0);
end Reverse_Elements;
------------------
-- Reverse_Find --
------------------
function Reverse_Find
(Container : List;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor
is
Node : Count_Type := Position.Node;
begin
if Node = 0 then
Node := Container.Last;
else
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert (Vet (Position), "bad cursor in Reverse_Find");
end if;
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
declare
Lock : With_Lock (Container.TC'Unrestricted_Access);
begin
while Node /= 0 loop
if Container.Nodes (Node).Element = Item then
return Cursor'(Container'Unrestricted_Access, Node);
end if;
Node := Container.Nodes (Node).Prev;
end loop;
return No_Element;
end;
end Reverse_Find;
---------------------
-- Reverse_Iterate --
---------------------
procedure Reverse_Iterate
(Container : List;
Process : not null access procedure (Position : Cursor))
is
Busy : With_Busy (Container.TC'Unrestricted_Access);
Node : Count_Type := Container.Last;
begin
while Node /= 0 loop
Process (Cursor'(Container'Unrestricted_Access, Node));
Node := Container.Nodes (Node).Prev;
end loop;
end Reverse_Iterate;
------------
-- Splice --
------------
procedure Splice
(Target : in out List;
Before : Cursor;
Source : in out List)
is
begin
TC_Check (Target.TC);
TC_Check (Source.TC);
if Before.Container /= null then
if Checks and then Before.Container /= Target'Unrestricted_Access then
raise Program_Error with
"Before cursor designates wrong container";
end if;
pragma Assert (Vet (Before), "bad cursor in Splice");
end if;
if Target'Address = Source'Address or else Source.Length = 0 then
return;
end if;
if Checks and then Target.Length > Count_Type'Last - Source.Length then
raise Constraint_Error with "new length exceeds maximum";
end if;
if Checks and then Target.Length + Source.Length > Target.Capacity then
raise Capacity_Error with "new length exceeds target capacity";
end if;
Splice_Internal (Target, Before.Node, Source);
end Splice;
procedure Splice
(Container : in out List;
Before : Cursor;
Position : Cursor)
is
N : Node_Array renames Container.Nodes;
begin
TC_Check (Container.TC);
if Before.Container /= null then
if Checks and then Before.Container /= Container'Unchecked_Access then
raise Program_Error with
"Before cursor designates wrong container";
end if;
pragma Assert (Vet (Before), "bad Before cursor in Splice");
end if;
if Checks and then Position.Node = 0 then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert (Vet (Position), "bad Position cursor in Splice");
if Position.Node = Before.Node
or else N (Position.Node).Next = Before.Node
then
return;
end if;
pragma Assert (Container.Length >= 2);
if Before.Node = 0 then
pragma Assert (Position.Node /= Container.Last);
if Position.Node = Container.First then
Container.First := N (Position.Node).Next;
N (Container.First).Prev := 0;
else
N (N (Position.Node).Prev).Next := N (Position.Node).Next;
N (N (Position.Node).Next).Prev := N (Position.Node).Prev;
end if;
N (Container.Last).Next := Position.Node;
N (Position.Node).Prev := Container.Last;
Container.Last := Position.Node;
N (Container.Last).Next := 0;
return;
end if;
if Before.Node = Container.First then
pragma Assert (Position.Node /= Container.First);
if Position.Node = Container.Last then
Container.Last := N (Position.Node).Prev;
N (Container.Last).Next := 0;
else
N (N (Position.Node).Prev).Next := N (Position.Node).Next;
N (N (Position.Node).Next).Prev := N (Position.Node).Prev;
end if;
N (Container.First).Prev := Position.Node;
N (Position.Node).Next := Container.First;
Container.First := Position.Node;
N (Container.First).Prev := 0;
return;
end if;
if Position.Node = Container.First then
Container.First := N (Position.Node).Next;
N (Container.First).Prev := 0;
elsif Position.Node = Container.Last then
Container.Last := N (Position.Node).Prev;
N (Container.Last).Next := 0;
else
N (N (Position.Node).Prev).Next := N (Position.Node).Next;
N (N (Position.Node).Next).Prev := N (Position.Node).Prev;
end if;
N (N (Before.Node).Prev).Next := Position.Node;
N (Position.Node).Prev := N (Before.Node).Prev;
N (Before.Node).Prev := Position.Node;
N (Position.Node).Next := Before.Node;
pragma Assert (N (Container.First).Prev = 0);
pragma Assert (N (Container.Last).Next = 0);
end Splice;
procedure Splice
(Target : in out List;
Before : Cursor;
Source : in out List;
Position : in out Cursor)
is
Target_Position : Count_Type;
begin
if Target'Address = Source'Address then
Splice (Target, Before, Position);
return;
end if;
TC_Check (Target.TC);
TC_Check (Source.TC);
if Before.Container /= null then
if Checks and then Before.Container /= Target'Unrestricted_Access then
raise Program_Error with
"Before cursor designates wrong container";
end if;
pragma Assert (Vet (Before), "bad Before cursor in Splice");
end if;
if Checks and then Position.Node = 0 then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Source'Unrestricted_Access then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert (Vet (Position), "bad Position cursor in Splice");
if Checks and then Target.Length >= Target.Capacity then
raise Capacity_Error with "Target is full";
end if;
Splice_Internal
(Target => Target,
Before => Before.Node,
Source => Source,
Src_Pos => Position.Node,
Tgt_Pos => Target_Position);
Position := Cursor'(Target'Unrestricted_Access, Target_Position);
end Splice;
---------------------
-- Splice_Internal --
---------------------
procedure Splice_Internal
(Target : in out List;
Before : Count_Type;
Source : in out List)
is
N : Node_Array renames Source.Nodes;
X : Count_Type;
begin
-- This implements the corresponding Splice operation, after the
-- parameters have been vetted, and corner-cases disposed of.
pragma Assert (Target'Address /= Source'Address);
pragma Assert (Source.Length > 0);
pragma Assert (Source.First /= 0);
pragma Assert (N (Source.First).Prev = 0);
pragma Assert (Source.Last /= 0);
pragma Assert (N (Source.Last).Next = 0);
pragma Assert (Target.Length <= Count_Type'Last - Source.Length);
pragma Assert (Target.Length + Source.Length <= Target.Capacity);
while Source.Length > 1 loop
-- Copy first element of Source onto Target
Allocate (Target, N (Source.First).Element, New_Node => X);
Insert_Internal (Target, Before => Before, New_Node => X);
-- Unlink the first node from Source
X := Source.First;
pragma Assert (N (N (X).Next).Prev = X);
Source.First := N (X).Next;
N (Source.First).Prev := 0;
Source.Length := Source.Length - 1;
-- Return the Source node to its free store
Free (Source, X);
end loop;
-- Copy first (and only remaining) element of Source onto Target
Allocate (Target, N (Source.First).Element, New_Node => X);
Insert_Internal (Target, Before => Before, New_Node => X);
-- Unlink the node from Source
X := Source.First;
pragma Assert (X = Source.Last);
Source.First := 0;
Source.Last := 0;
Source.Length := 0;
-- Return the Source node to its free store
Free (Source, X);
end Splice_Internal;
procedure Splice_Internal
(Target : in out List;
Before : Count_Type; -- node of Target
Source : in out List;
Src_Pos : Count_Type; -- node of Source
Tgt_Pos : out Count_Type)
is
N : Node_Array renames Source.Nodes;
begin
-- This implements the corresponding Splice operation, after the
-- parameters have been vetted, and corner-cases handled.
pragma Assert (Target'Address /= Source'Address);
pragma Assert (Target.Length < Target.Capacity);
pragma Assert (Source.Length > 0);
pragma Assert (Source.First /= 0);
pragma Assert (N (Source.First).Prev = 0);
pragma Assert (Source.Last /= 0);
pragma Assert (N (Source.Last).Next = 0);
pragma Assert (Src_Pos /= 0);
Allocate (Target, N (Src_Pos).Element, New_Node => Tgt_Pos);
Insert_Internal (Target, Before => Before, New_Node => Tgt_Pos);
if Source.Length = 1 then
pragma Assert (Source.First = Source.Last);
pragma Assert (Src_Pos = Source.First);
Source.First := 0;
Source.Last := 0;
elsif Src_Pos = Source.First then
pragma Assert (N (N (Src_Pos).Next).Prev = Src_Pos);
Source.First := N (Src_Pos).Next;
N (Source.First).Prev := 0;
elsif Src_Pos = Source.Last then
pragma Assert (N (N (Src_Pos).Prev).Next = Src_Pos);
Source.Last := N (Src_Pos).Prev;
N (Source.Last).Next := 0;
else
pragma Assert (Source.Length >= 3);
pragma Assert (N (N (Src_Pos).Next).Prev = Src_Pos);
pragma Assert (N (N (Src_Pos).Prev).Next = Src_Pos);
N (N (Src_Pos).Next).Prev := N (Src_Pos).Prev;
N (N (Src_Pos).Prev).Next := N (Src_Pos).Next;
end if;
Source.Length := Source.Length - 1;
Free (Source, Src_Pos);
end Splice_Internal;
----------
-- Swap --
----------
procedure Swap
(Container : in out List;
I, J : Cursor)
is
begin
TE_Check (Container.TC);
if Checks and then I.Node = 0 then
raise Constraint_Error with "I cursor has no element";
end if;
if Checks and then J.Node = 0 then
raise Constraint_Error with "J cursor has no element";
end if;
if Checks and then I.Container /= Container'Unchecked_Access then
raise Program_Error with "I cursor designates wrong container";
end if;
if Checks and then J.Container /= Container'Unchecked_Access then
raise Program_Error with "J cursor designates wrong container";
end if;
if I.Node = J.Node then
return;
end if;
pragma Assert (Vet (I), "bad I cursor in Swap");
pragma Assert (Vet (J), "bad J cursor in Swap");
declare
EI : Element_Type renames Container.Nodes (I.Node).Element;
EJ : Element_Type renames Container.Nodes (J.Node).Element;
EI_Copy : constant Element_Type := EI;
begin
EI := EJ;
EJ := EI_Copy;
end;
end Swap;
----------------
-- Swap_Links --
----------------
procedure Swap_Links
(Container : in out List;
I, J : Cursor)
is
begin
TC_Check (Container.TC);
if Checks and then I.Node = 0 then
raise Constraint_Error with "I cursor has no element";
end if;
if Checks and then J.Node = 0 then
raise Constraint_Error with "J cursor has no element";
end if;
if Checks and then I.Container /= Container'Unrestricted_Access then
raise Program_Error with "I cursor designates wrong container";
end if;
if Checks and then J.Container /= Container'Unrestricted_Access then
raise Program_Error with "J cursor designates wrong container";
end if;
if I.Node = J.Node then
return;
end if;
pragma Assert (Vet (I), "bad I cursor in Swap_Links");
pragma Assert (Vet (J), "bad J cursor in Swap_Links");
declare
I_Next : constant Cursor := Next (I);
begin
if I_Next = J then
Splice (Container, Before => I, Position => J);
else
declare
J_Next : constant Cursor := Next (J);
begin
if J_Next = I then
Splice (Container, Before => J, Position => I);
else
pragma Assert (Container.Length >= 3);
Splice (Container, Before => I_Next, Position => J);
Splice (Container, Before => J_Next, Position => I);
end if;
end;
end if;
end;
end Swap_Links;
--------------------
-- Update_Element --
--------------------
procedure Update_Element
(Container : in out List;
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type))
is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with "Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unchecked_Access then
raise Program_Error with
"Position cursor designates wrong container";
end if;
pragma Assert (Vet (Position), "bad cursor in Update_Element");
declare
Lock : With_Lock (Container.TC'Unchecked_Access);
N : Node_Type renames Container.Nodes (Position.Node);
begin
Process (N.Element);
end;
end Update_Element;
---------
-- Vet --
---------
function Vet (Position : Cursor) return Boolean is
begin
if Position.Node = 0 then
return Position.Container = null;
end if;
if Position.Container = null then
return False;
end if;
declare
L : List renames Position.Container.all;
N : Node_Array renames L.Nodes;
begin
if L.Length = 0 then
return False;
end if;
if L.First = 0 or L.First > L.Capacity then
return False;
end if;
if L.Last = 0 or L.Last > L.Capacity then
return False;
end if;
if N (L.First).Prev /= 0 then
return False;
end if;
if N (L.Last).Next /= 0 then
return False;
end if;
if Position.Node > L.Capacity then
return False;
end if;
-- An invariant of an active node is that its Previous and Next
-- components are non-negative. Operation Free sets the Previous
-- component of the node to the value -1 before actually deallocating
-- the node, to mark the node as inactive. (By "dellocating" we mean
-- only that the node is linked onto a list of inactive nodes used
-- for storage.) This marker gives us a simple way to detect a
-- dangling reference to a node.
if N (Position.Node).Prev < 0 then -- see Free
return False;
end if;
if N (Position.Node).Prev > L.Capacity then
return False;
end if;
if N (Position.Node).Next = Position.Node then
return False;
end if;
if N (Position.Node).Prev = Position.Node then
return False;
end if;
if N (Position.Node).Prev = 0
and then Position.Node /= L.First
then
return False;
end if;
pragma Assert (N (Position.Node).Prev /= 0
or else Position.Node = L.First);
if N (Position.Node).Next = 0
and then Position.Node /= L.Last
then
return False;
end if;
pragma Assert (N (Position.Node).Next /= 0
or else Position.Node = L.Last);
if L.Length = 1 then
return L.First = L.Last;
end if;
if L.First = L.Last then
return False;
end if;
if N (L.First).Next = 0 then
return False;
end if;
if N (L.Last).Prev = 0 then
return False;
end if;
if N (N (L.First).Next).Prev /= L.First then
return False;
end if;
if N (N (L.Last).Prev).Next /= L.Last then
return False;
end if;
if L.Length = 2 then
if N (L.First).Next /= L.Last then
return False;
end if;
if N (L.Last).Prev /= L.First then
return False;
end if;
return True;
end if;
if N (L.First).Next = L.Last then
return False;
end if;
if N (L.Last).Prev = L.First then
return False;
end if;
-- Eliminate earlier possibility
if Position.Node = L.First then
return True;
end if;
pragma Assert (N (Position.Node).Prev /= 0);
-- Eliminate another possibility
if Position.Node = L.Last then
return True;
end if;
pragma Assert (N (Position.Node).Next /= 0);
if N (N (Position.Node).Next).Prev /= Position.Node then
return False;
end if;
if N (N (Position.Node).Prev).Next /= Position.Node then
return False;
end if;
if L.Length = 3 then
if N (L.First).Next /= Position.Node then
return False;
end if;
if N (L.Last).Prev /= Position.Node then
return False;
end if;
end if;
return True;
end;
end Vet;
-----------
-- Write --
-----------
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : List)
is
Node : Count_Type;
begin
Count_Type'Base'Write (Stream, Item.Length);
Node := Item.First;
while Node /= 0 loop
Element_Type'Write (Stream, Item.Nodes (Node).Element);
Node := Item.Nodes (Node).Next;
end loop;
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Cursor)
is
begin
raise Program_Error with "attempt to stream list cursor";
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
end Ada.Containers.Bounded_Doubly_Linked_Lists;
|
Tools/esp/tests/lmem.asm | steakknife/pcgeos | 504 | 101555 | <filename>Tools/esp/tests/lmem.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Esp Test Suite
FILE: lmem.asm
AUTHOR: <NAME>, Sep 4, 1989
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 9/ 4/89 Initial revision
DESCRIPTION:
This is a test file designed to test the LMem support in Esp
$Id$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
;
; Types of lmem blocks
;
LMemTypes etype word, 0, 1
LMEM_TYPE_WINDOW enum LMemTypes
LMEM_TYPE_OBJ_BLOCK enum LMemTypes
LMEM_TYPE_GSTATE enum LMemTypes
LMEM_TYPE_FONT_BLK enum LMemTypes
LMEM_TYPE_STATE_BLOCK enum LMemTypes
LMEM_TYPE_GENERAL enum LMemTypes
LMEM_TYPE_ILLEGAL enum LMemTypes
;
; Structure at the beginning of every local-memory block.
;
LocalMemoryFlags record
LMF_HAS_FLAGS :1 ;True if block is has a flags block
LMF_IN_RESOURCE :1 ;True if block is just loaded from resource
LMF_DETACHABLE :1 ;True if block is detachable
LMF_HAS_STATE :1 ;True if block has an associated state block
LMF_DUPLICATED :1 ;True if block created by ObjDuplicateBlock
LMF_IN_RELOCATION:1 ;True if block is being relocated (used only
;in the EC version -- defeats error checking)
LMF_FREEING_BLOCK:1 ;Used by METHOD_FREE_DUPLICATE and
LMF_READY_TO_FREE:1 ;METHOD_REMOVE_BLOCK
:8
LocalMemoryFlags end
LMemBlockHeader struc
LMBH_handle hptr ; handle to this block.
LMBH_offset word ; offset to handle table.
LMBH_flags LocalMemoryFlags
LMBH_lmemType LMemTypes ; type of the block.
LMBH_blockSize word ; size of the block.
LMBH_nHandles word ; # of handles allocated.
LMBH_freeList word ; pointer to first free block.
LMBH_totalFree word ; sum of sizes of free blocks.
LMemBlockHeader ends
Interface segment lmem LMEM_TYPE_GENERAL
otherdata word 3 dup(3)
firstChunk chunk 3 dup(word)
word 1, 2, 3
firstChunk endc
ptrToFirstC lptr firstChunk
secondChunk chunk char
dc "So long, mom! I'm off to drop the bomb!"
secondChunk endc
optrToSecondC optr secondChunk
Interface ends
biff segment resource
whee optr firstChunk
biff ends
|
libsrc/target/nc100/txtgetcursor.asm | jpoikela/z88dk | 640 | 175376 | <reponame>jpoikela/z88dk
SECTION code_clib
PUBLIC txtgetcursor
PUBLIC _txtgetcursor
.txtgetcursor
._txtgetcursor
jp 0xB82D
|
data/pokemon/base_stats/dewgong.asm | Karkino/KarkCrystal16 | 0 | 86477 | db 0 ; species ID placeholder
db 95, 75, 85, 70, 25, 100
; hp atk def spd sat sdf
db WATER, ICE ; type
db 75 ; catch rate
db 176 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F50 ; gender ratio
db 100 ; unknown 1
db 20 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/dewgong/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_MEDIUM_FAST ; growth rate
dn EGG_WATER_1, EGG_GROUND ; egg groups
; tm/hm learnset
tmhm HEADBUTT, CURSE, TOXIC, SNORE, BLIZZARD, HYPER_BEAM, ICY_WIND, PROTECT, RAIN_DANCE, POISON_FANG, IRON_HEAD, RETURN, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, REST, ATTRACT, SURF, WHIRLPOOL, WATERFALL, ICE_BEAM
; end
|
oeis/082/A082150.asm | neoneye/loda-programs | 11 | 241280 | ; A082150: A transform of C(n,2).
; Submitted by <NAME>
; 0,0,1,9,60,360,2040,11088,58240,297216,1480320,7223040,34636800,163657728,763549696,3523645440,16107110400,73016672256,328570011648,1468890021888,6528375193600,28862235279360,126993714118656,556353148944384,2427722252943360,10555312884940800,45739686441779200,197595439539683328,851180342256599040,3656922924671041536,15672526761634037760,67013562580095467520,285924533408786022400,1217485109431766089728,5174311713880267554816,21951625450269871964160,92971590136907798937600
mov $1,2
pow $1,$0
bin $0,2
mov $2,4
mul $2,$0
mul $0,$1
add $0,$2
mul $1,$0
mov $0,$1
div $0,32
|
code-generation/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/MSpec.g4 | kdxq/plc4x | 0 | 6029 | grammar MSpec;
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
file
: complexTypeDefinition* EOF
;
complexTypeDefinition
: LBRACKET complexType RBRACKET
;
complexType
: 'type' name=idExpression (LBRACKET params=argumentList RBRACKET)? fieldDefinition*
| 'discriminatedType' name=idExpression (LBRACKET params=argumentList RBRACKET)? fieldDefinition+
| 'enum' (type=typeReference)? name=idExpression (LBRACKET params=argumentList RBRACKET)? enumValues=enumValueDefinition+
| 'dataIo' name=idExpression (LBRACKET params=argumentList RBRACKET)? dataIoTypeSwitch=dataIoDefinition
;
fieldDefinition
: LBRACKET field (LBRACKET params=multipleExpressions RBRACKET)? RBRACKET
;
dataIoDefinition
: LBRACKET typeSwitchField (LBRACKET params=multipleExpressions RBRACKET)? RBRACKET
;
field
: abstractField
| arrayField
| checksumField
| constField
| discriminatorField
| enumField
| implicitField
| manualArrayField
| manualField
| optionalField
| paddingField
| reservedField
| simpleField
| typeSwitchField
| unknownField
| virtualField
;
abstractField
: 'abstract' type=typeReference name=idExpression
;
arrayField
: 'array' type=typeReference name=idExpression loopType=ARRAY_LOOP_TYPE loopExpression=expression
;
checksumField
: 'checksum' type=dataType name=idExpression checksumExpression=expression
;
constField
: 'const' type=dataType name=idExpression expected=expression
;
discriminatorField
: 'discriminator' type=typeReference name=idExpression
;
enumField
: 'enum' type=typeReference name=idExpression (fieldName=idExpression)?
;
implicitField
: 'implicit' type=dataType name=idExpression serializeExpression=expression
;
manualArrayField
: 'manualArray' type=typeReference name=idExpression loopType=ARRAY_LOOP_TYPE loopExpression=expression parseExpression=expression serializeExpression=expression lengthExpression=expression
;
manualField
: 'manual' type=typeReference name=idExpression parseExpression=expression serializeExpression=expression lengthExpression=expression
;
optionalField
: 'optional' type=typeReference name=idExpression condition=expression
;
paddingField
: 'padding' type=dataType name=idExpression paddingValue=expression paddingCondition=expression
;
reservedField
: 'reserved' type=dataType expected=expression
;
simpleField
: 'simple' type=typeReference name=idExpression
;
typeSwitchField
: 'typeSwitch' discriminators=multipleExpressions caseStatement*
;
unknownField
: 'unknown' type=dataType
;
virtualField
: 'virtual' type=typeReference name=idExpression valueExpression=expression
;
enumValueDefinition
: LBRACKET (valueExpression=expression)? name=IDENTIFIER_LITERAL (LBRACKET constantValueExpressions=multipleExpressions RBRACKET)? RBRACKET
;
typeReference
: complexTypeReference=IDENTIFIER_LITERAL
| simpleTypeReference=dataType
;
caseStatement
: LBRACKET (discriminatorValues=multipleExpressions)? name=IDENTIFIER_LITERAL (LBRACKET params=argumentList RBRACKET)? fieldDefinition* RBRACKET
;
dataType
: base='bit'
| base='byte'
| base='int' size=INTEGER_LITERAL
| base='uint' size=INTEGER_LITERAL
| base='float' exponent=INTEGER_LITERAL '.' mantissa=INTEGER_LITERAL
| base='ufloat' exponent=INTEGER_LITERAL '.' mantissa=INTEGER_LITERAL
| base='string' length=expression (encoding=idExpression)?
| base='time'
| base='date'
| base='dateTime'
;
argument
: type=typeReference name=idExpression
;
argumentList
: argument (',' argument)*
;
expression
: TICK expr=innerExpression TICK
;
multipleExpressions
: expression (',' expression)*
;
innerExpression
: BOOLEAN_LITERAL
// Explicitly allow the loop type keywords in expressions
| ARRAY_LOOP_TYPE
| IDENTIFIER_LITERAL ('(' (innerExpression (',' innerExpression)* )? ')')? ('[' innerExpression ']')?
| innerExpression '.' innerExpression // Field Reference or method call
| innerExpression '[' + INTEGER_LITERAL + ']' // Array index
| innerExpression BinaryOperator innerExpression // Addition
| innerExpression '?' innerExpression ':' innerExpression
| '(' innerExpression ')'
| '"' innerExpression '"'
| '!' innerExpression
| HEX_LITERAL
| INTEGER_LITERAL
| STRING_LITERAL
;
idExpression
: TICK id=IDENTIFIER_LITERAL TICK
// Explicitly allow the loop type keywords in id-expressions
| TICK id=ARRAY_LOOP_TYPE TICK
;
TICK : '\'';
LBRACKET : '[';
RBRACKET : ']';
LCBRACKET : '{';
RCBRACKET : '}';
BinaryOperator
: '+'
| '-'
| '/'
| '*'
| '^'
| '=='
| '!='
| '>>'
| '<<'
| '>'
| '<'
| '>='
| '<='
| '&&'
| '||'
| '&'
| '|'
| '%'
;
ARRAY_LOOP_TYPE
: 'count'
| 'length'
| 'terminated'
;
// Integer literals
INTEGER_LITERAL
: INTEGER_CHARACTERS
;
fragment
INTEGER_CHARACTERS
: INTEGER_CHARACTER+
;
fragment
INTEGER_CHARACTER
: [0-9]
;
// Hexadecimal literals
HEX_LITERAL
: '0' [xX] HEX_CHARACTERS
;
fragment
HEX_CHARACTERS
: HEX_CHARACTER+
;
fragment
HEX_CHARACTER
: [0-9a-fA-F]
;
// Boolean literals
BOOLEAN_LITERAL
: 'true'
| 'false'
;
// String literals
STRING_LITERAL
: '"' STRING_CHARACTERS? '"'
;
// As we're generating property names and class names from these,
// we have to put more restrictions on them.
IDENTIFIER_LITERAL
: [A-Za-z0-9_-]+
;
fragment
STRING_CHARACTERS
: STRING_CHARACTER+
;
fragment
STRING_CHARACTER
: ~["\\\r\n]
;
// Stuff we just want to ignore
LINE_COMMENT
: '//' ~[\r\n]* -> skip
;
BLOCK_COMMENT
: '/*' .*? '*/' -> skip
;
WS
: [ \t\r\n\u000C]+ -> skip
;
|
src/test/ref/forced-zeropage.asm | jbrandwood/kickc | 2 | 3022 | // Test some forced zeropage access
// Commodore 64 PRG executable file
.file [name="forced-zeropage.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.segment Code
main: {
.label __1 = 4
.label u = 2
// u = *(word *)0xA0 - u
sec
lda.z $a0
sbc #<$22b
sta.z u
lda.z $a0+1
sbc #>$22b
sta.z u+1
// *((word*)0x0400) = u
lda.z u
sta $400
lda.z u+1
sta $400+1
// *(byte **)0xD1 + 0xD400
clc
lda.z $d1
adc #<$d400
sta.z __1
lda.z $d1+1
adc #>$d400
sta.z __1+1
// *(byte **)0xF3 = *(byte **)0xD1 + 0xD400
lda.z __1
sta.z $f3
lda.z __1+1
sta.z $f3+1
// }
rts
}
|
lxL4/x86/init/entry.asm | archibate/Lake-OS | 1 | 100317 | ; vim: ft=nasm ai
[BITS 32]
extern _main
extern _stktop
global _start
[SECTION .text] ; 目标文件中写了这些后再写程序
_start:
cli
mov eax, cr0
and eax, 0x1
or eax, 0x2
mov cr0, eax
check_x87:
fninit
fstsw ax
test al, al
jz .pm287
mov eax, cr0
xor eax, 0x6
mov cr0, eax
jmp .ok
.pm287: fsetpm
.ok:
mov esp, _stktop
xor ebp, ebp
call _main
halt:
hlt
jmp halt
|
thirdparty/adasdl/thin/adasdl/AdaSDL/binding/sdl-keysym.ads | Lucretia/old_nehe_ada95 | 0 | 1580 |
-- ----------------------------------------------------------------- --
-- AdaSDL --
-- Binding to Simple Direct Media Layer --
-- Copyright (C) 2001 A.M.F.Vargas --
-- <NAME> --
-- Ponta Delgada - Azores - Portugal --
-- http://www.adapower.net/~avargas --
-- E-mail: <EMAIL> --
-- ----------------------------------------------------------------- --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from --
-- this unit, or you link this unit with other files to produce an --
-- executable, this unit does not by itself cause the resulting --
-- executable to be covered by the GNU General Public License. This --
-- exception does not however invalidate any other reasons why the --
-- executable file might be covered by the GNU Public License. --
-- ----------------------------------------------------------------- --
-- **************************************************************** --
-- This is an Ada binding to SDL ( Simple DirectMedia Layer from --
-- Sam Lantinga - www.libsld.org ) --
-- **************************************************************** --
-- In order to help the Ada programmer, the comments in this file --
-- are, in great extent, a direct copy of the original text in the --
-- SDL header files. --
-- **************************************************************** --
with Interfaces.C;
package SDL.Keysym is
package C renames Interfaces.C;
-- The keyboard syms have been cleverly chosen to map to ASCII
type Key is new C.int;
-- The keyboard syms have been cleverly chosen to map to ASCII
K_UNKNOWN : constant Key := 0;
K_FIRST : constant Key := 0;
K_BACKSPACE : constant Key := 8;
K_TAB : constant Key := 9;
K_CLEAR : constant Key := 12;
K_RETURN : constant Key := 13;
K_PAUSE : constant Key := 19;
K_ESCAPE : constant Key := 27;
K_SPACE : constant Key := 32;
K_EXCLAIM : constant Key := 33;
K_QUOTEDBL : constant Key := 34;
K_HASH : constant Key := 35;
K_DOLLAR : constant Key := 36;
K_AMPERSAND : constant Key := 38;
K_QUOTE : constant Key := 39;
K_LEFTPAREN : constant Key := 40;
K_RIGHTPAREN : constant Key := 41;
K_ASTERISK : constant Key := 42;
K_PLUS : constant Key := 43;
K_COMMA : constant Key := 44;
K_MINUS : constant Key := 45;
K_PERIOD : constant Key := 46;
K_SLASH : constant Key := 47;
K_0 : constant Key := 48;
K_1 : constant Key := 49;
K_2 : constant Key := 50;
K_3 : constant Key := 51;
K_4 : constant Key := 52;
K_5 : constant Key := 53;
K_6 : constant Key := 54;
K_7 : constant Key := 55;
K_8 : constant Key := 56;
K_9 : constant Key := 57;
K_COLON : constant Key := 58;
K_SEMICOLON : constant Key := 59;
K_LESS : constant Key := 60;
K_EQUALS : constant Key := 61;
K_GREATER : constant Key := 62;
K_QUESTION : constant Key := 63;
K_AT : constant Key := 64;
-- Skip uppercase letters
K_LEFTBRACKET : constant Key := 91;
K_BACKSLASH : constant Key := 92;
K_RIGHTBRACKET : constant Key := 93;
K_CARET : constant Key := 94;
K_UNDERSCORE : constant Key := 95;
K_BACKQUOTE : constant Key := 96;
K_a : constant Key := 97;
K_b : constant Key := 98;
K_c : constant Key := 99;
K_d : constant Key := 100;
K_e : constant Key := 101;
K_f : constant Key := 102;
K_g : constant Key := 103;
K_h : constant Key := 104;
K_i : constant Key := 105;
K_j : constant Key := 106;
K_k : constant Key := 107;
K_l : constant Key := 108;
K_m : constant Key := 109;
K_n : constant Key := 110;
K_o : constant Key := 111;
K_p : constant Key := 112;
K_q : constant Key := 113;
K_r : constant Key := 114;
K_s : constant Key := 115;
K_t : constant Key := 116;
K_u : constant Key := 117;
K_v : constant Key := 118;
K_w : constant Key := 119;
K_x : constant Key := 120;
K_y : constant Key := 121;
K_z : constant Key := 122;
K_DELETE : constant Key := 127;
-- End of ASCII mapped keysyms
-- International keyboard syms
K_WORLD_0 : constant Key := 160; -- 0xA0
K_WORLD_1 : constant Key := 161;
K_WORLD_2 : constant Key := 162;
K_WORLD_3 : constant Key := 163;
K_WORLD_4 : constant Key := 164;
K_WORLD_5 : constant Key := 165;
K_WORLD_6 : constant Key := 166;
K_WORLD_7 : constant Key := 167;
K_WORLD_8 : constant Key := 168;
K_WORLD_9 : constant Key := 169;
K_WORLD_10 : constant Key := 170;
K_WORLD_11 : constant Key := 171;
K_WORLD_12 : constant Key := 172;
K_WORLD_13 : constant Key := 173;
K_WORLD_14 : constant Key := 174;
K_WORLD_15 : constant Key := 175;
K_WORLD_16 : constant Key := 176;
K_WORLD_17 : constant Key := 177;
K_WORLD_18 : constant Key := 178;
K_WORLD_19 : constant Key := 179;
K_WORLD_20 : constant Key := 180;
K_WORLD_21 : constant Key := 181;
K_WORLD_22 : constant Key := 182;
K_WORLD_23 : constant Key := 183;
K_WORLD_24 : constant Key := 184;
K_WORLD_25 : constant Key := 185;
K_WORLD_26 : constant Key := 186;
K_WORLD_27 : constant Key := 187;
K_WORLD_28 : constant Key := 188;
K_WORLD_29 : constant Key := 189;
K_WORLD_30 : constant Key := 190;
K_WORLD_31 : constant Key := 191;
K_WORLD_32 : constant Key := 192;
K_WORLD_33 : constant Key := 193;
K_WORLD_34 : constant Key := 194;
K_WORLD_35 : constant Key := 195;
K_WORLD_36 : constant Key := 196;
K_WORLD_37 : constant Key := 197;
K_WORLD_38 : constant Key := 198;
K_WORLD_39 : constant Key := 199;
K_WORLD_40 : constant Key := 200;
K_WORLD_41 : constant Key := 201;
K_WORLD_42 : constant Key := 202;
K_WORLD_43 : constant Key := 203;
K_WORLD_44 : constant Key := 204;
K_WORLD_45 : constant Key := 205;
K_WORLD_46 : constant Key := 206;
K_WORLD_47 : constant Key := 207;
K_WORLD_48 : constant Key := 208;
K_WORLD_49 : constant Key := 209;
K_WORLD_50 : constant Key := 210;
K_WORLD_51 : constant Key := 211;
K_WORLD_52 : constant Key := 212;
K_WORLD_53 : constant Key := 213;
K_WORLD_54 : constant Key := 214;
K_WORLD_55 : constant Key := 215;
K_WORLD_56 : constant Key := 216;
K_WORLD_57 : constant Key := 217;
K_WORLD_58 : constant Key := 218;
K_WORLD_59 : constant Key := 219;
K_WORLD_60 : constant Key := 220;
K_WORLD_61 : constant Key := 221;
K_WORLD_62 : constant Key := 222;
K_WORLD_63 : constant Key := 223;
K_WORLD_64 : constant Key := 224;
K_WORLD_65 : constant Key := 225;
K_WORLD_66 : constant Key := 226;
K_WORLD_67 : constant Key := 227;
K_WORLD_68 : constant Key := 228;
K_WORLD_69 : constant Key := 229;
K_WORLD_70 : constant Key := 230;
K_WORLD_71 : constant Key := 231;
K_WORLD_72 : constant Key := 232;
K_WORLD_73 : constant Key := 233;
K_WORLD_74 : constant Key := 234;
K_WORLD_75 : constant Key := 235;
K_WORLD_76 : constant Key := 236;
K_WORLD_77 : constant Key := 237;
K_WORLD_78 : constant Key := 238;
K_WORLD_79 : constant Key := 239;
K_WORLD_80 : constant Key := 240;
K_WORLD_81 : constant Key := 241;
K_WORLD_82 : constant Key := 242;
K_WORLD_83 : constant Key := 243;
K_WORLD_84 : constant Key := 244;
K_WORLD_85 : constant Key := 245;
K_WORLD_86 : constant Key := 246;
K_WORLD_87 : constant Key := 247;
K_WORLD_88 : constant Key := 248;
K_WORLD_89 : constant Key := 249;
K_WORLD_90 : constant Key := 250;
K_WORLD_91 : constant Key := 251;
K_WORLD_92 : constant Key := 252;
K_WORLD_93 : constant Key := 253;
K_WORLD_94 : constant Key := 254;
K_WORLD_95 : constant Key := 255; -- 0xFF
-- Numeric keypad
K_KP0 : constant Key := 256;
K_KP1 : constant Key := 257;
K_KP2 : constant Key := 258;
K_KP3 : constant Key := 259;
K_KP4 : constant Key := 260;
K_KP5 : constant Key := 261;
K_KP6 : constant Key := 262;
K_KP7 : constant Key := 263;
K_KP8 : constant Key := 264;
K_KP9 : constant Key := 265;
K_KP_PERIOD : constant Key := 266;
K_KP_DIVIDE : constant Key := 267;
K_KP_MULTIPLY : constant Key := 268;
K_KP_MINUS : constant Key := 269;
K_KP_PLUS : constant Key := 270;
K_KP_ENTER : constant Key := 271;
K_KP_EQUALS : constant Key := 272;
-- Arrows + Home/End pad
K_UP : constant Key := 273;
K_DOWN : constant Key := 274;
K_RIGHT : constant Key := 275;
K_LEFT : constant Key := 276;
K_INSERT : constant Key := 277;
K_HOME : constant Key := 278;
K_END : constant Key := 279;
K_PAGEUP : constant Key := 280;
K_PAGEDOWN : constant Key := 281;
-- Function keys
K_F1 : constant Key := 282;
K_F2 : constant Key := 283;
K_F3 : constant Key := 284;
K_F4 : constant Key := 285;
K_F5 : constant Key := 286;
K_F6 : constant Key := 287;
K_F7 : constant Key := 288;
K_F8 : constant Key := 289;
K_F9 : constant Key := 290;
K_F10 : constant Key := 291;
K_F11 : constant Key := 292;
K_F12 : constant Key := 293;
K_F13 : constant Key := 294;
K_F14 : constant Key := 295;
K_F15 : constant Key := 296;
-- Key state modifier keys
K_NUMLOCK : constant Key := 300;
K_CAPSLOCK : constant Key := 301;
K_SCROLLOCK : constant Key := 302;
K_RSHIFT : constant Key := 303;
K_LSHIFT : constant Key := 304;
K_RCTRL : constant Key := 305;
K_LCTRL : constant Key := 306;
K_RALT : constant Key := 307;
K_LALT : constant Key := 308;
K_RMETA : constant Key := 309;
K_LMETA : constant Key := 310;
K_LSUPER : constant Key := 311; -- Left "Windows" key
K_RSUPER : constant Key := 312; -- Right "Windows" key
K_MODE : constant Key := 313; -- "Alt Gr" key
K_COMPOSE : constant Key := 314; -- Multi-key compose key
-- Miscellaneous function keys
K_HELP : constant Key := 315;
K_PRINT : constant Key := 316;
K_SYSREQ : constant Key := 317;
K_BREAK : constant Key := 318;
K_MENU : constant Key := 319;
K_POWER : constant Key := 320; -- Power Macintosh power key */
K_EURO : constant Key := 321; -- Some european keyboards */
-- Add any other keys here
K_LAST : constant Key := 322;
-- Enumeration of valid key mods (possibly OR'd together)
type SDLMod is mod 2**32;
pragma Convention (C, SDLMod);
KMOD_NONE : constant SDLMod := 16#0000#;
KMOD_LSHIFT : constant SDLMod := 16#0001#;
KMOD_RSHIFT : constant SDLMod := 16#0002#;
KMOD_LCTRL : constant SDLMod := 16#0040#;
KMOD_RCTRL : constant SDLMod := 16#0080#;
KMOD_LALT : constant SDLMod := 16#0100#;
KMOD_RALT : constant SDLMod := 16#0200#;
KMOD_LMETA : constant SDLMod := 16#0400#;
KMOD_RMETA : constant SDLMod := 16#0800#;
KMOD_NUM : constant SDLMod := 16#1000#;
KMOD_CAPS : constant SDLMod := 16#2000#;
KMOD_MODE : constant SDLMod := 16#4000#;
KMOD_RESERVED : constant SDLMod := 16#8000#;
KMOD_CTRL : constant SDLMod := (KMOD_LCTRL or KMOD_RCTRL);
KMOD_SHIFT : constant SDLMod := (KMOD_LSHIFT or KMOD_RSHIFT);
KMOD_ALT : constant SDLMod := (KMOD_LALT or KMOD_RALT);
KMOD_META : constant SDLMod := (KMOD_LMETA or KMOD_RMETA);
end SDL.Keysym;
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-tassta.ads | djamal2727/Main-Bearing-Analytical-Model | 0 | 12993 | <reponame>djamal2727/Main-Bearing-Analytical-Model<gh_stars>0
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K I N G . S T A G E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- GNARL 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/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This package represents the high level tasking interface used by the
-- compiler to expand Ada 95 tasking constructs into simpler run time calls
-- (aka GNARLI, GNU Ada Run-time Library Interface)
-- Note: Only the compiler is allowed to use this interface, by generating
-- direct calls to it, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes
-- in exp_ch9.adb and possibly exp_ch7.adb
with System.Task_Info;
with System.Parameters;
with Ada.Real_Time;
package System.Tasking.Stages is
pragma Elaborate_Body;
-- The compiler will expand in the GNAT tree the following construct:
-- task type T (Discr : Integer);
-- task body T is
-- ...declarations, possibly some controlled...
-- begin
-- ...B...;
-- end T;
-- T1 : T (1);
-- as follows:
-- enter_master.all;
-- _chain : aliased activation_chain;
-- activation_chainIP (_chain);
-- task type t (discr : integer);
-- tE : aliased boolean := false;
-- tZ : size_type := unspecified_size;
-- type tV (discr : integer) is limited record
-- _task_id : task_id;
-- end record;
-- procedure tB (_task : access tV);
-- freeze tV [
-- procedure tVIP (_init : in out tV; _master : master_id;
-- _chain : in out activation_chain; _task_id : in task_image_type;
-- discr : integer) is
-- begin
-- _init.discr := discr;
-- _init._task_id := null;
-- create_task (unspecified_priority, tZ,
-- unspecified_task_info, unspecified_cpu,
-- ada__real_time__time_span_zero, 0, _master,
-- task_procedure_access!(tB'address), _init'address,
-- tE'unchecked_access, _chain, _task_id, _init._task_id);
-- return;
-- end tVIP;
-- ]
-- procedure tB (_task : access tV) is
-- discr : integer renames _task.discr;
-- procedure _clean is
-- begin
-- abort_defer.all;
-- complete_task;
-- finalize_list (F14b);
-- abort_undefer.all;
-- return;
-- end _clean;
-- begin
-- abort_undefer.all;
-- ...declarations...
-- complete_activation;
-- ...B...;
-- return;
-- at end
-- _clean;
-- end tB;
-- tE := true;
-- t1 : t (1);
-- _master : constant master_id := current_master.all;
-- t1S : task_image_type := new string'"t1";
-- task_image_typeIP (t1, _master, _chain, t1S, 1);
-- activate_tasks (_chain'unchecked_access);
procedure Abort_Tasks (Tasks : Task_List);
-- Compiler interface only. Do not call from within the RTS. Initiate
-- abort, however, the actual abort is done by abortee by means of
-- Abort_Handler and Abort_Undefer
--
-- source code:
-- Abort T1, T2;
-- code expansion:
-- abort_tasks (task_list'(t1._task_id, t2._task_id));
procedure Activate_Tasks (Chain_Access : Activation_Chain_Access);
-- Compiler interface only. Do not call from within the RTS.
-- This must be called by the creator of a chain of one or more new tasks,
-- to activate them. The chain is a linked list that up to this point is
-- only known to the task that created them, though the individual tasks
-- are already in the All_Tasks_List.
--
-- The compiler builds the chain in LIFO order (as a stack). Another
-- version of this procedure had code to reverse the chain, so as to
-- activate the tasks in the order of declaration. This might be nice, but
-- it is not needed if priority-based scheduling is supported, since all
-- the activated tasks synchronize on the activators lock before they
-- start activating and so they should start activating in priority order.
-- ??? Actually, the body of this package DOES reverse the chain, so I
-- don't understand the above comment.
procedure Complete_Activation;
-- Compiler interface only. Do not call from within the RTS.
-- This should be called from the task body at the end of
-- the elaboration code for its declarative part.
-- Decrement the count of tasks to be activated by the activator and
-- wake it up so it can check to see if all tasks have been activated.
-- Except for the environment task, which should never call this procedure,
-- T.Activator should only be null iff T has completed activation.
procedure Complete_Master;
-- Compiler interface only. Do not call from within the RTS. This must
-- be called on exit from any master where Enter_Master was called.
-- Assume abort is deferred at this point.
procedure Complete_Task;
-- Compiler interface only. Do not call from within the RTS.
-- This should be called from an implicit at-end handler
-- associated with the task body, when it completes.
-- From this point, the current task will become not callable.
-- If the current task have not completed activation, this should be done
-- now in order to wake up the activator (the environment task).
procedure Create_Task
(Priority : Integer;
Stack_Size : System.Parameters.Size_Type;
Secondary_Stack_Size : System.Parameters.Size_Type;
Task_Info : System.Task_Info.Task_Info_Type;
CPU : Integer;
Relative_Deadline : Ada.Real_Time.Time_Span;
Domain : Dispatching_Domain_Access;
Num_Entries : Task_Entry_Index;
Master : Master_Level;
State : Task_Procedure_Access;
Discriminants : System.Address;
Elaborated : Access_Boolean;
Chain : in out Activation_Chain;
Task_Image : String;
Created_Task : out Task_Id);
-- Compiler interface only. Do not call from within the RTS.
-- This must be called to create a new task.
--
-- Priority is the task's priority (assumed to be in range of type
-- System.Any_Priority)
--
-- Stack_Size is the stack size of the task to create
--
-- Secondary_Stack_Size is the size of the secondary stack to be used by
-- the task.
--
-- Task_Info is the task info associated with the created task, or
-- Unspecified_Task_Info if none.
--
-- CPU is the task affinity. Passed as an Integer because the undefined
-- value is not in the range of CPU_Range. Static range checks are
-- performed when analyzing the pragma, and dynamic ones are performed
-- before setting the affinity at run time.
--
-- Relative_Deadline is the relative deadline associated with the created
-- task by means of a pragma Relative_Deadline, or 0.0 if none.
--
-- Domain is the dispatching domain associated with the created task by
-- means of a Dispatching_Domain pragma or aspect, or null if none.
--
-- State is the compiler generated task's procedure body
--
-- Discriminants is a pointer to a limited record whose discriminants
-- are those of the task to create. This parameter should be passed as
-- the single argument to State.
--
-- Elaborated is a pointer to a Boolean that must be set to true on exit
-- if the task could be successfully elaborated.
--
-- Chain is a linked list of task that needs to be created. On exit,
-- Created_Task.Activation_Link will be Chain.T_ID, and Chain.T_ID
-- will be Created_Task (e.g the created task will be linked at the front
-- of Chain).
--
-- Task_Image is a string created by the compiler that the
-- run time can store to ease the debugging and the
-- Ada.Task_Identification facility.
--
-- Created_Task is the resulting task.
--
-- This procedure can raise Storage_Error if the task creation failed.
function Current_Master return Master_Level;
-- Compiler interface only.
-- This is called to obtain the current master nesting level.
procedure Enter_Master;
-- Compiler interface only. Do not call from within the RTS.
-- This must be called on entry to any "master" where a task,
-- or access type designating objects containing tasks, may be
-- declared.
procedure Expunge_Unactivated_Tasks (Chain : in out Activation_Chain);
-- Compiler interface only. Do not call from within the RTS.
-- This must be called by the compiler-generated code for an allocator if
-- the allocated object contains tasks, if the allocator exits without
-- calling Activate_Tasks for a given activation chains, as can happen if
-- an exception occurs during initialization of the object.
--
-- This should be called ONLY for tasks created via an allocator. Recovery
-- of storage for unactivated local task declarations is done by
-- Complete_Master and Complete_Task.
--
-- We remove each task from Chain and All_Tasks_List before we free the
-- storage of its ATCB.
--
-- In other places where we recover the storage of unactivated tasks, we
-- need to clean out the entry queues, but here that should not be
-- necessary, since these tasks should not have been visible to any other
-- tasks, and so no task should be able to queue a call on their entries.
--
-- Just in case somebody misuses this subprogram, there is a check to
-- verify this condition.
procedure Finalize_Global_Tasks;
-- This should be called to complete the execution of the environment task
-- and shut down the tasking runtime system. It is the equivalent of
-- Complete_Task, but for the environment task.
--
-- The environment task must first call Complete_Master, to wait for user
-- tasks that depend on library-level packages to terminate. It then calls
-- Abort_Dependents to abort the "independent" library-level server tasks
-- that are created implicitly by the RTS packages (signal and timer server
-- tasks), and then waits for them to terminate. Then, it calls
-- Vulnerable_Complete_Task.
--
-- It currently also executes the global finalization list, and then resets
-- the "soft links".
procedure Free_Task (T : Task_Id);
-- Recover all runtime system storage associated with the task T, but only
-- if T has terminated. Do nothing in the other case. It is called from
-- Unchecked_Deallocation, for objects that are or contain tasks.
procedure Move_Activation_Chain
(From, To : Activation_Chain_Access;
New_Master : Master_ID);
-- Compiler interface only. Do not call from within the RTS.
-- Move all tasks on From list to To list, and change their Master_Of_Task
-- to be New_Master. This is used to implement build-in-place function
-- returns. Tasks that are part of the return object are initially placed
-- on an activation chain local to the return statement, and their master
-- is the return statement, in case the return statement is left
-- prematurely (due to raising an exception, being aborted, or a goto or
-- exit statement). Once the return statement has completed successfully,
-- Move_Activation_Chain is called to move them to the caller's activation
-- chain, and change their master to the one passed in by the caller. If
-- that doesn't happen, they will never be activated, and will become
-- terminated on leaving the return statement.
function Terminated (T : Task_Id) return Boolean;
-- This is called by the compiler to implement the 'Terminated attribute.
-- Though is not required to be so by the ARM, we choose to synchronize
-- with the task's ATCB, so that this is more useful for polling the state
-- of a task, and so that it becomes an abort completion point for the
-- calling task (via Undefer_Abort).
--
-- source code:
-- T1'Terminated
--
-- code expansion:
-- terminated (t1._task_id)
procedure Terminate_Task (Self_ID : Task_Id);
-- Terminate the calling task.
-- This should only be called by the Task_Wrapper procedure, and to
-- deallocate storage associate with foreign tasks.
end System.Tasking.Stages;
|
header/000/NROM-128.asm | freem/nes_corelib | 16 | 85436 | ; NROM-128: 16KB PRG-ROM + 8KB CHR-ROM
; http://bootgod.dyndns.org:7777/search.php?keywords=NROM-128&kwtype=pcb
;------------------------------------------------------------------------------;
; NROM mirroring is hardwired via solder pads.
; %0000 = Horizontal
; %0001 = Vertical
MIRRORING = %0001
; Mapper 000 (NROM-128) iNES header
.byte "NES",$1A
.byte $01 ; 1x 16K PRG banks
.byte $01 ; 1x 8K CHR banks
.byte $00|MIRRORING ; flags 6
.byte $00 ; flags 7
.byte $00 ; no PRG RAM
.dsb 7, $00 ; clear the remaining bytes
|
maps/TwinleafHouse2.asm | AtmaBuster/pokecrystal16-493-plus | 1 | 170255 | <reponame>AtmaBuster/pokecrystal16-493-plus
object_const_def ; object_event constants
const TWINLEAFHOUSE2_OBJECT1
TwinleafHouse2_MapScripts:
db 0 ; scene scripts
db 0 ; callbacks
TwinleafHouse2_MapEvents:
db 0, 0 ; filler
db 2 ; warp events
warp_event 2, 7, TWINLEAF_TOWN, 4
warp_event 3, 7, TWINLEAF_TOWN, 4
db 0 ; coord events
db 0 ; bg events
db 1 ; object events
object_event 0, 0, SPRITE_CHRIS, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, ObjectEvent, -1
|
src/autogenerated/textBank1.asm | jannone/westen | 49 | 81928 | ; line: 'Vampires in my family sleep in coffins in'
; size in bytes: 42
line_0:
db #29,#5a,#69,#7f,#86,#79,#8a,#71,#8c,#00,#79,#82,#00,#7f,#9b,#00
db #73,#69,#7f,#79,#7e,#9b,#00,#8c,#7e,#71,#71,#86,#00,#79,#82,#00
db #6d,#84,#73,#73,#79,#82,#8c,#00,#79,#82
end_line_0:
; line: 'to kill them. Seek their coffins, they sleep'
; size in bytes: 45
line_1:
db #2c,#8e,#84,#00,#7c,#79,#7e,#7e,#00,#8e,#77,#71,#7f,#14,#00,#53
db #71,#71,#7c,#00,#8e,#77,#71,#79,#8a,#00,#6d,#84,#73,#73,#79,#82
db #8c,#10,#00,#8e,#77,#71,#9b,#00,#8c,#7e,#71,#71,#86
end_line_1:
; line: 'arrive, and they will perish in their sleep!'
; size in bytes: 45
line_2:
db #2c,#69,#8a,#8a,#79,#92,#71,#10,#00,#69,#82,#6f,#00,#8e,#77,#71
db #9b,#00,#95,#79,#7e,#7e,#00,#86,#71,#8a,#79,#8c,#77,#00,#79,#82
db #00,#8e,#77,#71,#79,#8a,#00,#8c,#7e,#71,#71,#86,#02
end_line_2:
; line: 'I think they used their vampire names as'
; size in bytes: 41
line_3:
db #28,#3b,#00,#8e,#77,#79,#82,#7c,#00,#8e,#77,#71,#9b,#00,#90,#8c
db #71,#6f,#00,#8e,#77,#71,#79,#8a,#00,#92,#69,#7f,#86,#79,#8a,#71
db #00,#82,#69,#7f,#71,#8c,#00,#69,#8c
end_line_3:
; line: 'I think I will pick her family name to'
; size in bytes: 39
line_4:
db #26,#3b,#00,#8e,#77,#79,#82,#7c,#00,#3b,#00,#95,#79,#7e,#7e,#00
db #86,#79,#6d,#7c,#00,#77,#71,#8a,#00,#73,#69,#7f,#79,#7e,#9b,#00
db #82,#69,#7f,#71,#00,#8e,#84
end_line_4:
; line: 'We hid our name to hide my sister's identity.'
; size in bytes: 46
line_5:
db #2d,#5d,#71,#00,#77,#79,#6f,#00,#84,#90,#8a,#00,#82,#69,#7f,#71
db #00,#8e,#84,#00,#77,#79,#6f,#71,#00,#7f,#9b,#00,#8c,#79,#8c,#8e
db #71,#8a,#08,#8c,#00,#79,#6f,#71,#82,#8e,#79,#8e,#9b,#14
end_line_5:
; line: 'John Seward's to do:'
; size in bytes: 21
line_6:
db #14,#3d,#84,#77,#82,#00,#53,#71,#95,#69,#8a,#6f,#08,#8c,#00,#8e
db #84,#00,#6f,#84,#2a
end_line_6:
; line: 'Joystick / arrow keys to move.'
; size in bytes: 31
line_7:
db #1e,#3d,#84,#9b,#8c,#8e,#79,#6d,#7c,#00,#03,#00,#69,#8a,#8a,#84
db #95,#00,#7c,#71,#9b,#8c,#00,#8e,#84,#00,#7f,#84,#92,#71,#14
end_line_7:
; line: 'John Seward's Diary.'
; size in bytes: 21
line_8:
db #14,#3d,#84,#77,#82,#00,#53,#71,#95,#69,#8a,#6f,#08,#8c,#00,#31
db #79,#69,#8a,#9b,#14
end_line_8:
; line: 'A vampire!'
; size in bytes: 11
line_9:
db #0a,#2b,#00,#92,#69,#7f,#86,#79,#8a,#71,#02
end_line_9:
; line: '- Thank Lucy for using our initials to'
; size in bytes: 39
line_10:
db #26,#12,#00,#55,#77,#69,#82,#7c,#00,#42,#90,#6d,#9b,#00,#73,#84
db #8a,#00,#90,#8c,#79,#82,#75,#00,#84,#90,#8a,#00,#79,#82,#79,#8e
db #79,#69,#7e,#8c,#00,#8e,#84
end_line_10:
; line: 'initials from those two? I am your'
; size in bytes: 35
line_11:
db #22,#79,#82,#79,#8e,#79,#69,#7e,#8c,#00,#73,#8a,#84,#7f,#00,#8e
db #77,#84,#8c,#71,#00,#8e,#95,#84,#0d,#00,#3b,#00,#69,#7f,#00,#9b
db #84,#90,#8a
end_line_11:
; line: 'notes before my sister Lucy takes'
; size in bytes: 34
line_12:
db #21,#82,#84,#8e,#71,#8c,#00,#6b,#71,#73,#84,#8a,#71,#00,#7f,#9b
db #00,#8c,#79,#8c,#8e,#71,#8a,#00,#42,#90,#6d,#9b,#00,#8e,#69,#7c
db #71,#8c
end_line_12:
; line: '- Joystick / arrow keys to'
; size in bytes: 27
line_13:
db #1a,#12,#00,#3d,#84,#9b,#8c,#8e,#79,#6d,#7c,#00,#03,#00,#69,#8a
db #8a,#84,#95,#00,#7c,#71,#9b,#8c,#00,#8e,#84
end_line_13:
; line: 'Thank you Richard!'
; size in bytes: 19
line_14:
db #12,#55,#77,#69,#82,#7c,#00,#9b,#84,#90,#00,#51,#79,#6d,#77,#69
db #8a,#6f,#02
end_line_14:
|
lib/scroll.asm | hxlnt/w2 | 1 | 29062 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Scrolling subroutines
PPU_SCROLL = $2005
Scroll:
LDA scroll_speed_x ; Scroll in X-direction at
AND #%10000000 ; speed indicated by bits
BEQ ScrollXLeft ; 0-6 of scroll_speed_x
ScrollXRight: ; and direction indicated
LDA scroll_speed_x ; by bit 7 of
AND #%01111111 ; of scroll_speed_x.
CLC ;
ADC scroll_x ;
STA scroll_x ;
STA PPU_SCROLL ;
JMP ScrollYCheck ;
ScrollXLeft: ;
LDA scroll_x ;
SEC ;
SBC scroll_speed_x ;
STA scroll_x ;
STA PPU_SCROLL ;
ScrollYCheck: ; Scroll in Y-direction at
LDA scroll_speed_y ; speed indicated by bits
AND #%10000000 ; 0-6 of scroll_speed_y
BEQ ScrollYDown ; and direction indicated
ScrollYUp: ; by bit 7 of
LDA scroll_speed_y ; scroll_speed_y.
AND #%01111111 ;
CLC ;
ADC scroll_y ;
CMP #$EF ;
BCS ResetScrollUp ;
STA scroll_y ;
STA PPU_SCROLL ;
RTS ;
ScrollYDown: ;
LDA scroll_y ;
SEC ;
SBC scroll_speed_y ;
BCC ResetScrollDown ;
STA scroll_y ;
STA PPU_SCROLL ;
RTS ;
ResetScrollUp: ;
LDA #$00 ;
STA scroll_y ;
STA PPU_SCROLL ;
RTS ;
ResetScrollDown: ;
LDA #$EE ;
STA scroll_y ;
STA PPU_SCROLL ;
RTS ; |
libsrc/_DEVELOPMENT/adt/wv_stack/c/sccz80/wv_stack_top.asm | jpoikela/z88dk | 640 | 29708 |
; void *wv_stack_top(wv_stack_t *s)
SECTION code_clib
SECTION code_adt_wv_stack
PUBLIC wv_stack_top
EXTERN asm_wv_stack_top
defc wv_stack_top = asm_wv_stack_top
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _wv_stack_top
defc _wv_stack_top = wv_stack_top
ENDIF
|
src/main-draw_help_overlay.adb | alkhimey/Ada_Curve | 5 | 20892 | <reponame>alkhimey/Ada_Curve
-- The MIT License (MIT)
--
-- Copyright (c) 2016 <EMAIL>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
--
--
with GL.Blending;
separate (Main)
procedure Draw_Help_Overlay is
begin
if Font_Loaded then
GL.Toggles.Enable(GL.Toggles.Blend);
GL.Blending.Set_Blend_Func(GL.Blending.Src_Alpha, GL.Blending.One_Minus_Src_Alpha);
declare
Token : Gl.Immediate.Input_Token := GL.Immediate.Start (Quads);
begin
Gl.Immediate.Set_Color (GL.Types.Colors.Color'(0.1, 0.1, 0.1, 0.9));
GL.Immediate.Add_Vertex(Token, Vector2'(0.0, 0.0 ));
GL.Immediate.Add_Vertex(Token, Vector2'(0.0, Double(WINDOW_HEIGHT)));
GL.Immediate.Add_Vertex(Token, Vector2'(Double(WINDOW_WIDTH), Double(WINDOW_HEIGHT)));
GL.Immediate.Add_Vertex(Token, Vector2'(Double(WINDOW_WIDTH), 0.0 ));
end;
GL.Toggles.Disable(GL.Toggles.Blend);
Gl.Immediate.Set_Color (GL.Types.Colors.Color'(0.1, 0.9, 0.1, 0.0));
Modelview.Push;
-- Set origin at bottom left
Modelview.Apply_Multiplication((( 1.0, 0.0, 0.0, 0.0),
( 0.0, -1.0, 0.0, 0.0),
( 0.0, 0.0, 1.0, 0.0),
( 0.0, 0.0, 0.0, 1.0) ));
Modelview.Apply_Translation (15.0, -Double(Info_Font.Line_Height), 0.0);
Info_Font.Render ("Use right mouse to add or remove points and left to move them", (Front => True, others => False));
Modelview.Apply_Translation ( 0.0, - 2.0 * Double(Info_Font.Line_Height), 0.0);
Info_Font.Render ("A - Cycle algorithms", (Front => True, others => False));
Modelview.Apply_Translation ( 0.0, -Double(Info_Font.Line_Height), 0.0);
Info_Font.Render ("P - Toggle control polygon", (Front => True, others => False));
Modelview.Apply_Translation ( 0.0, -Double(Info_Font.Line_Height), 0.0);
Info_Font.Render ("U - Generte uniform clamped knots vector (De Boor only)", (Front => True, others => False));
Modelview.Apply_Translation ( 0.0, -Double(Info_Font.Line_Height), 0.0);
Info_Font.Render ("Q - Quit", (Front => True, others => False));
Modelview.Pop;
end if;
end Draw_Help_Overlay;
|
libsrc/target/m100/graphics/clg.asm | Frodevan/z88dk | 1 | 176066 | <filename>libsrc/target/m100/graphics/clg.asm<gh_stars>1-10
;
; Fast CLS for the M100
; Stefano - 2020
;
;
; $Id: clg.asm $
;
SECTION code_clib
PUBLIC clg
PUBLIC _clg
EXTERN w_pixeladdress
; INCLUDE "target/kc/def/caos.def"
.clg
._clg
ld a,12
jp $20
|
src/Bisimilarity/Up-to.agda | nad/up-to | 0 | 8397 | ------------------------------------------------------------------------
-- Up-to techniques for strong bisimilarity
------------------------------------------------------------------------
{-# OPTIONS --sized-types #-}
open import Labelled-transition-system
module Bisimilarity.Up-to {ℓ} (lts : LTS ℓ) where
open import Equality.Propositional
open import Logical-equivalence using (_⇔_)
open import Prelude
open import Prelude.Size
open import Bisimilarity lts
import Bisimilarity.Equational-reasoning-instances
open import Equational-reasoning
open import Relation
import Up-to
open LTS lts
------------------------------------------------------------------------
-- The general up-to machinery, instantiated with the StepC container
open Up-to StepC public
------------------------------------------------------------------------
-- Some examples (based on techniques presented by Pous and Sangiorgi
-- in "Enhancements of the bisimulation proof method")
-- Up to bisimilarity.
Up-to-bisimilarity : Trans₂ ℓ Proc
Up-to-bisimilarity R = Bisimilarity ∞ ⊙ R ⊙ Bisimilarity ∞
-- Up to bisimilarity is monotone.
up-to-bisimilarity-monotone : Monotone Up-to-bisimilarity
up-to-bisimilarity-monotone R⊆S =
Σ-map id (Σ-map id (Σ-map id (Σ-map R⊆S id)))
-- Up to bisimilarity is size-preserving.
up-to-bisimilarity-size-preserving : Size-preserving Up-to-bisimilarity
up-to-bisimilarity-size-preserving
R⊆∼i {p₁ , p₄} (p₂ , p₁∼p₂ , p₃ , p₂Rp₃ , p₃∼p₄) =
p₁ ∼⟨ p₁∼p₂ ⟩
p₂ ∼⟨ R⊆∼i p₂Rp₃ ⟩
p₃ ∼⟨ p₃∼p₄ ⟩■
p₄
-- Up to union with bisimilarity.
Up-to-∪∼ : Trans₂ ℓ Proc
Up-to-∪∼ R = R ∪ Bisimilarity ∞
-- Up to union with bisimilarity is monotone.
up-to-∪∼-monotone : Monotone Up-to-∪∼
up-to-∪∼-monotone R⊆S = ⊎-map R⊆S id
-- Up to union with bisimilarity is size-preserving.
--
-- The proof is similar to parts of the proof of Corollary 6.3.15 from
-- Pous and Sangiorgi's "Enhancements of the bisimulation proof
-- method".
up-to-∪∼-size-preserving : Size-preserving Up-to-∪∼
up-to-∪∼-size-preserving =
∪-closure
id-size-preserving
(const-size-preserving (Bisimilarity ∞ ⊆⟨ id ⟩∎
Bisimilarity ∞ ∎))
-- Up to transitive closure.
Up-to-* : Trans₂ ℓ Proc
Up-to-* R = R *
-- Up to transitive closure is monotone.
up-to-*-monotone : Monotone Up-to-*
up-to-*-monotone R⊆S = Σ-map id (λ {n} → ^^-mono R⊆S n)
where
^^-mono : ∀ {R S} → R ⊆ S →
∀ n → R ^^ n ⊆ S ^^ n
^^-mono R⊆S zero = id
^^-mono R⊆S (suc n) = Σ-map id (Σ-map R⊆S (^^-mono R⊆S n))
-- Up to transitive closure is size-preserving.
up-to-*-size-preserving : Size-preserving Up-to-*
up-to-*-size-preserving =
_⇔_.from (monotone→⇔ up-to-*-monotone) drop-*
where
drop-* : ∀ {i} → Bisimilarity i * ⊆ Bisimilarity i
drop-* {x = p , .p} (zero , refl) = p ■
drop-* {x = p , r} (suc n , q , p∼q , ∼ⁿqr) =
p ∼⟨ p∼q ⟩
q ∼⟨ drop-* (n , ∼ⁿqr) ⟩■
r
|
Examples.agda | sseefried/well-typed-agda-interpreter | 3 | 1106 | {-# OPTIONS --without-K --safe --overlapping-instances #-}
module Examples where
open import Data.Nat
-- local imports
open import Interpreter
pf : y' ∈ y' ::: `ℕ , (x' ::: `ℕ , ·)
pf = H
pf2 : x' ∈ y' ::: `ℕ , (x' ::: `ℕ , ·)
pf2 = TH
testSimpleLambda : · ⊢ `ℕ
testSimpleLambda = (`λ x' `: `ℕ ⇨ (`v x' `+ `v x')) `₋ `n 10
testSimpleLambda2 : · ⊢ `ℕ `⇨ `ℕ
testSimpleLambda2 = `λ x' `: `ℕ ⇨ (`v x') `+ (`v x')
testNestedLambda : · ⊢ `ℕ
testNestedLambda = (`λ x' `: `ℕ ⇨ (`λ_`:_⇨_ y' `ℕ (`v x' `* `v y'))) `₋ `n 10 `₋ `n 15
testNestedLambda2 : · ⊢ `ℕ `⇨ `ℕ `⇨ `ℕ
testNestedLambda2 = (`λ x' `: `ℕ ⇨ (`λ_`:_⇨_ y' `ℕ (`v x' `* `v y')))
-- The following definitions do not type check. They are a relic from
-- when the interpreter still had some bugs. Uncomment them to verify
-- they don't type check
-- testNamingNotWorking : · ⊢ `Bool
-- testNamingNotWorking = (`λ x' `: `Bool ⇨ (`λ x' `: `⊤ ⇨ `v x')) `₋ `true `₋ `tt
-- testNamingNotWorking2 : · ⊢ `Bool `⇨ `⊤ `⇨ `Bool -- incorrect type!
-- testNamingNotWorking2 = `λ x' `: `Bool ⇨ (`λ x' `: `⊤ ⇨ `v x')
testNamingWorking : · ⊢ `⊤
testNamingWorking = (`λ x' `: `Bool ⇨ (`λ x' `: `⊤ ⇨ `v x')) `₋ `true `₋ `tt
testNamingWorking2 : · ⊢ `Bool `⇨ `⊤ `⇨ `⊤
testNamingWorking2 = `λ x' `: `Bool ⇨ (`λ x' `: `⊤ ⇨ `v x')
testSum1 : · ⊢ `ℕ
testSum1 = `let z' `= `case `left (`n 10) `of
`λ z' `: `ℕ ⇨ `v z'
|| `λ x' `: `Bool ⇨ `if `v x' `then `n 1 `else `n 0
`in `v z'
testSum2 : · ⊢ `ℕ
testSum2 = `let z' `= `case `right `true `of
`λ z' `: `ℕ ⇨ `v z'
|| `λ x' `: `Bool ⇨ `if `v x' `then `n 1 `else `n 0
`in `v z'
testProduct1 : · ⊢ `Bool
testProduct1 = `fst (`true `, (`n 10 `, `tt ))
testProduct2 : · ⊢ `ℕ `× `⊤
testProduct2 = `snd (`true `, (`n 10 `, `tt ))
testDeMorganFullOr : · ⊢ `Bool
testDeMorganFullOr = `let z' `= `λ x' `: `Bool ⇨ `λ y' `: `Bool ⇨ `¬ (`v x' `∨ `v y')
`in `v z' `₋ `true `₋ `true
testDeMorganBrokenAnd : · ⊢ `Bool
testDeMorganBrokenAnd = `let z' `= `λ x' `: `Bool ⇨ `λ y' `: `Bool ⇨ `¬ `v x' `∧ `¬ `v y'
`in `v z' `₋ `true `₋ `true
tester : Set
tester = {! interpret testSimpleLambda2 !}
|
45/qb/ir/exaryutl.asm | minblock/msdos | 0 | 11477 | <filename>45/qb/ir/exaryutl.asm
page 49,132
TITLE exaryutl - Array Utilities
;***
;exaryutl.asm - interpreter specific array support.
;
; Copyright <C> 1986, Microsoft Corporation
;
;Purpose:
;
; This module includes support routines for array related executors:
; - ResolveArray - a procedure that resolves indices and an array
; descriptor to a memory address.
;
;
;
;****************************************************************************
.xlist
include version.inc
EXARYUTL_ASM = ON
IncludeOnce architec
IncludeOnce array
IncludeOnce context
IncludeOnce exint
IncludeOnce qbimsgs
IncludeOnce rtinterp
IncludeOnce variable
.list
assumes cs, CODE
assumes es, NOTHING
assumes ss, DATA
assumes ds,DATA
sBegin CODE
page
;***
;oVarToPAd - Find/Make array descriptor for a variable table entry
;
;Purpose:
;
; This routine returns address of the array descriptor.
; The space for the array descriptor will always be allocated.
;
;Input:
;
; bx = oVar of array
;
;Output:
;
; ax = SB of array descriptor if SizeD
; ds:bx = address of array descriptor.
; cDims and fFeatures (FADF_STATIC only) fields set from variable table
;
;Preserves:
;
; cx,dx
;
;***************************************************************************
public oVarToPAd
oVarToPAd:
push cx
DbChk OVar,bx ;Verify that this is a variable
mov cl,byte ptr [pVarBx-VAR_value].VAR_fStat; Get FV_STATIC flag
mov ch,[pVarBx].ASTAT_cDims
mov ax,[pVarBx-VAR_value].VAR_Flags ;Get flags
TestX ax,FVVALUESTORED ;Static?
jnz StaticDescr
TestX ax,FVFORMAL ;Parameter?
jnz ParamDescr
TestX ax,FVCOMMON ;Common?
jnz CommonDescr
;Array descriptor is local variable
mov bx,[pVarBx].AFRAME_oFrame; oBP of array descriptor
add bx,bp ;Point at array descriptor in stack
jmp short SetupAD
StaticDescr:
lea bx,[pVarBx].ASTAT_ad ; Get address of array descriptor
SetupAD:
;ch = dim count
or ch,ch ; cDims unknown?
jz SetStatic
mov [bx].AD_cDims,ch ;Set the count of dimensions in AD
SetStatic:
test cl,FV_STATIC ;Is this a $STATIC array?
jz ArrayDescr ;Not $STATIC
or [bx].AD_fFeatures,FADF_STATIC ;Indicate $STATIC array
ArrayDescr:
pop cx
ret
ParamDescr:
;Array descriptor already set up - just point to it
mov bx,[pVarBx].AFORMAL_oFrame ;oBP of pAd
add bx,bp ;BX = Pointer to pAd
mov bx,[pFrame] ;ds:bx = pAD
;Added with [10]
cmp [bx].AD_cDims,ch ;cDims correct?
jz ArrayDescr
or ch,ch ;Unknown cDims?
jz ArrayDescr
jmp RangeErr ; cDims mismatch
;End of [10]
CommonDescr:
mov ax,[pVarBx].ACOM_oValue ;Offset into common block
mov bx,[pVarBx].ACOM_oCommon;oCommon
test cl,FV_STATIC ;Is the array $STATIC?
jz GetComDesc ; brif not
;$STATIC array descr. is in COMMON type table
add bx,COM_bdType - COM_bdValue ;Adjust to point to type table
GetComDesc:
add bx,[grs.GRS_bdtComBlk.BD_pb] ;pCommon
mov bx,[bx].COM_bdValue.BD_pb ;Common block
add bx,ax ;Offset in block
jmp SetupAD
subttl ResolveArray
page
;***
;ResolveArray - Resolve array reference to address
;
;Purpose:
;
; Resolve an array reference to an element address.
;
; NOTE:
;
; This algorithm requires that:
; 1. No more than 255 indices are allowed.
; 2. The number of indices is correct. This has been verified by SsScan.
;
;Input:
;
; ds:bx = address of array descriptor
; cx = index count
; stack contains cx ET_I2 index arguments
;
;Output:
;
; dx:bx = element address
; ax = address of array descriptor
; ds = base of module variable table if SizeD
; index parameters cleaned from stack
;
;Preserves:
;
; none
;
;Exceptions:
;
; $ERR_BS - error for bad subscript
;
;*************************************************************************
public ResolveArray
ResolveArray:
cmp [bx].AD_fhd.FHD_hData,0 ;this field is 0 when array not DIMed
jz UnDimmedErr ;Brif not allocated. Error.
dec cx ;Special case single dimension array
jnz ResolveMulDims ;Go resolve multiple dimension case
pop cx ;Return address
pop ax ;Get index
push cx ;Return address back
sub ax,[bx].AD_tDM.DM_iLbound ;Subtract lower bound
jl RangeErr
cmp ax,[bx].AD_tDM.DM_cElements ;Test for range
jge RangeErr
xor dx,dx ;Index in dx:ax
mov cx,[bx].AD_cbElement ;Size of each element
;Need to multiply index in dx:ax by size of element in cx
cmp cx,2 ;I2?
jz TwoByte
cmp cx,4 ;I4,R4,SD?
jnz OddSize
;Handle 4-byte element
shl ax,1
TwoByte:
shl ax,1
rcl dx,1
HugeArray:
;dx:ax has 32-bit offset
;bx = pAD
add ax,[bx].AD_fhd.FHD_oData;Add base offset
adc dx,0 ;Ripple carry
jz GetArraySeg
;Multiply dx by 64K/16 = 1000H to get relative segment
ror dx,1
ror dx,1
ror dx,1
ror dx,1
GetArraySeg:
add dx,[bx].AD_fhd.FHD_hData;Load segment from AD
xchg bx,ax ;Offset to bx, pAD to ax
ret
OddSize:
mul cx
jmp HugeArray
MulRangeErr:
pop cx
pop di
pop si ;Restore location of error
UnDimmedErr:
RangeErr:
mov al,ER_SOR ;Subscript out of range
call RtErrorCODE ;generate error, don't return
page
;ResolveMulDims
;
;Purpose:
;
; Handle the multiple dimension, R8 or user defined record type varients
; of array access. These varients can not be optimized in the same way as
; single dimension I2/I4/SD array resolution.
;
;Input:
;
; bx = address of AD
; cx = cDims minus one
ResolveMulDims:
push si
mov si,sp
add si,4 ;Point to first index
push di
lea di,[bx].AD_tDM ;Point to first dimension in descriptor
push cx
xor cx,cx ;Initialize byte offset value
mov dx,cx
jmp short IndexLoopEntry ;Start element offset comp with add
;Within this loop:
;ax = count of remaining indices
;dx:cx = current offset value (dx is high word). EB uses CX only!
;bx = pAD
;si points to next index
;di points into array descriptor
IndexLoop:
push ax
add di,SIZE DM ;Move to next descriptor field
;[di] * dx:cx multiplication (current offset by dimension in array descriptor)
mov ax,dx
mul [di].DM_cElements
xchg cx,ax ;High word has to be zero (DIM worked)
mul [di].DM_cElements
add dx,cx ;Can't be carry (DIM worked)
mov cx,ax
IndexLoopEntry:
lods word ptr DGROUP:[si] ; get index argument
sub ax,[di].DM_iLbound ;Account for TO or OPTION BASE
jl MulRangeErr ;Index error
cmp ax,[di].DM_cElements ;test for index out of bounds
jge MulRangeErr ;error - index too high
add cx,ax ;add index to offset value
adc dx,0 ; with carry into high word
; Can't be overflow - DIM worked
pop ax
dec ax ;Decrement argument count
jns IndexLoop ;Loop to process next argument
;DX:AX = DX:CX * cbElement. For EB: AX = CX * cbElement.
mov ax,dx ;Prepare for mult
mul [bx].AD_cbElement ;cbElement * high word
xchg cx,ax ;Save low word (high word is zero, since
; there was no error during DIM)
mul [bx].AD_cbElement ;cbElement * low word
add dx,cx ;Add in result of cbType * high word
dec si
dec si ;New top of stack
pop di
pop cx ;Old si
pop DGROUP:[si] ; Move return address to stack top
mov sp,si ;Clean off arguments
mov si,cx
jmp HugeArray ;Exit through single dim code
; with:
; ax = data offset low word
; bx = AD address
; dx = data offset high word
page
sEnd CODE
end
|
alloy4fun_models/trainstlt/models/8/Pdbpw5uvpfhCCno6q.als | Kaixi26/org.alloytools.alloy | 0 | 1583 | open main
pred idPdbpw5uvpfhCCno6q_prop9 {
always (all t:Train| eventually (no t.pos and one t.pos':>Entry))
}
pred __repair { idPdbpw5uvpfhCCno6q_prop9 }
check __repair { idPdbpw5uvpfhCCno6q_prop9 <=> prop9o } |
Transynther/x86/_processed/NONE/_zr_/i3-7100_9_0x84_notsx.log_21829_2639.asm | ljhsiun2/medusa | 9 | 18618 | <filename>Transynther/x86/_processed/NONE/_zr_/i3-7100_9_0x84_notsx.log_21829_2639.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x14d4c, %rsi
lea addresses_UC_ht+0x1b620, %rdi
clflush (%rdi)
nop
nop
nop
nop
inc %r14
mov $14, %rcx
rep movsq
nop
nop
and $36090, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
// Load
lea addresses_PSE+0x191bc, %rcx
nop
nop
xor $10919, %r10
movups (%rcx), %xmm1
vpextrq $0, %xmm1, %r14
nop
nop
nop
nop
nop
sub $55241, %r10
// REPMOV
lea addresses_D+0xbcdc, %rsi
lea addresses_normal+0x143dc, %rdi
nop
nop
nop
nop
nop
cmp $55882, %rax
mov $103, %rcx
rep movsq
nop
nop
inc %rdi
// Store
mov $0xb6a, %rcx
nop
cmp %r10, %r10
mov $0x5152535455565758, %r14
movq %r14, %xmm5
movups %xmm5, (%rcx)
nop
nop
nop
nop
nop
cmp $34041, %rdi
// Store
mov $0x748e000000001dc, %r13
nop
nop
nop
nop
nop
add $21389, %rax
mov $0x5152535455565758, %rdi
movq %rdi, %xmm1
vmovups %ymm1, (%r13)
nop
nop
and $16533, %r14
// Load
lea addresses_D+0x21dc, %r13
nop
nop
nop
nop
nop
cmp %rax, %rax
mov (%r13), %ecx
nop
nop
nop
nop
sub %rax, %rax
// Load
lea addresses_RW+0x315c, %rcx
sub $40802, %rdi
movb (%rcx), %dl
nop
nop
nop
nop
inc %rdx
// Faulty Load
lea addresses_A+0x1a9dc, %r10
clflush (%r10)
nop
nop
nop
nop
nop
add %rcx, %rcx
mov (%r10), %edi
lea oracles, %r10
and $0xff, %rdi
shlq $12, %rdi
mov (%r10,%rdi,1), %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_P', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D', 'same': False, 'size': 4, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_RW', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'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
*/
|
other.7z/SFC.7z/SFC/ソースデータ/MarioKart/Item-j.asm | prismotizm/gigaleak | 0 | 21985 | <reponame>prismotizm/gigaleak<gh_stars>0
Name: Item-j.asm
Type: file
Size: 57237
Last-Modified: '1992-07-14T15:00:00Z'
SHA-1: 23D8926EEA0DE73E191CF06E1D7329203287204B
Description: null
|
2-low/collada/source/collada-library.adb | charlie5/lace | 20 | 21820 | package body collada.Library
is
function find_in (Self : Inputs; the_Semantic : in library.Semantic) return Input_t
is
begin
for i in Self'Range
loop
if Self (i).Semantic = the_Semantic
then
return Self (i);
end if;
end loop;
return null_Input;
end find_in;
end collada.Library;
|
programs/oeis/136/A136006.asm | neoneye/loda | 22 | 93372 | ; A136006: a(n) = n^6 - n^3.
; 0,0,56,702,4032,15500,46440,117306,261632,530712,999000,1770230,2984256,4824612,7526792,11387250,16773120,24132656,34006392,47039022,63992000,85756860,113369256,148023722,191089152,244125000,308898200,387400806,481868352,594798932,728973000,887473890,1073709056,1291432032,1544765112,1838222750,2176735680,2565675756,3010881512,3518684442,4095936000,4750035320,5488957656,6321283542,7256228672,8303674500,9474199560,10779111506,12230479872,13841169552,15624875000,17596155150,19770469056,22164212252,24794753832,27680474250,30840803840,34296262056,38068497432,42180328262,46655784000,51520147380,56799997256,62523252162,68719214592,75418616000,82653662520,90458081406,98867168192,107917834572,117648657000,128099926010,139313696256,151333837272,164206084952,177978093750,192699489600,208421923556,225199126152,243086962482,262143488000,282429005040,304006120056,326939801582,351297438912,377148901500,404566599080,433625542506,464403405312,496980585992,531440271000,567868498470,606354222656,646989379092,689868950472,735091033250,782756904960,832971092256,885841439672,941479179102
pow $0,3
mov $1,$0
sub $1,1
mul $0,$1
|
p8b.asm | abhimanyudwivedi/mp-testing | 0 | 85800 | <reponame>abhimanyudwivedi/mp-testing<gh_stars>0
; stepper motor
.model small
outpa macro
mov dx,pa
out dx,al
endm
exit macro
mov ah,4ch
int 21h
endm
.data
pa equ 1190h
pb equ 1191h
cr equ 1193h
.code
mov ax,@data
mov ds,ax
mov al,82h
mov dx,cr
out dx,al
mov al,88h
mov cx,200
rotate:
outpa
call delay
ror al,01
dec cx
jnz rotate
exit
delay proc
push ax
push cx
mov ax,0cffh
outer:
mov cx,0ffffh
inner:
dec cx
jnz inner
dec ax
jnz outer
pop cx
pop ax
ret
delay endp
end |
src/bbox-api.adb | stcarrez/bbox-ada-api | 2 | 24480 | -----------------------------------------------------------------------
-- bbox -- Bbox API
-- Copyright (C) 2017, 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Properties.JSON;
with Util.Log.Loggers;
with Util.Strings;
with Util.Properties.Basic;
package body Bbox.API is
use Ada.Strings.Unbounded;
package Int_Property renames Util.Properties.Basic.Integer_Property;
package Bool_Property renames Util.Properties.Basic.Boolean_Property;
-- The logger
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Bbox.API");
function Strip_Unecessary_Array (Content : in String) return String;
-- ------------------------------
-- Set the server IP address.
-- ------------------------------
procedure Set_Server (Client : in out Client_Type;
Server : in String) is
begin
Log.Debug ("Using bbox server {0}", Server);
Client.Server := Ada.Strings.Unbounded.To_Unbounded_String (Server);
end Set_Server;
-- ------------------------------
-- Internal operation to get the URI based on the operation being called.
-- ------------------------------
function Get_URI (Client : in Client_Type;
Operation : in String) return String is
begin
return "https://" & To_String (Client.Server) & "/api/v1/" & Operation;
end Get_URI;
-- ------------------------------
-- Login to the server Bbox API with the password.
-- ------------------------------
procedure Login (Client : in out Client_Type;
Password : in String) is
procedure Process (Name, Value : in String);
URI : constant String := Client.Get_URI ("login");
Response : Util.Http.Clients.Response;
procedure Process (Name, Value : in String) is
Pos, Last : Natural;
begin
if Name = "Set-Cookie" then
Pos := Util.Strings.Index (Value, '=');
if Pos = 0 then
return;
end if;
Last := Util.Strings.Index (Value, ';');
if Last = 0 or else Last < Pos then
return;
end if;
Client.Http.Set_Header ("Cookie", Value (Value'First .. Last - 1));
Client.Is_Logged := True;
end if;
end Process;
begin
Log.Debug ("Login to {0}", URI);
Client.Is_Logged := False;
Client.Http.Set_Header ("Cookie", "");
Client.Http.Add_Header ("X-Requested-By", "Bbox Ada Api");
Client.Http.Set_Timeout (10.0);
Client.Http.Post (URI, "password=" & Password, Response);
if Response.Get_Status = Util.Http.SC_OK then
Response.Iterate_Headers (Process'Access);
else
Log.Error ("Connection and login to {0} failed", URI);
end if;
end Login;
-- ------------------------------
-- Strip [] for some Json content.
-- We did a mistake when we designed the Bbox API and used '[' ... ']' arrays
-- for most of the JSON result. Strip that unecessary array.
-- ------------------------------
function Strip_Unecessary_Array (Content : in String) return String is
Last : Natural := Content'Last;
begin
if Content'Length = 0 then
return Content;
end if;
while Last > Content'First and then Content (Last) = ASCII.LF loop
Last := Last - 1;
end loop;
if Content (Content'First) = '[' and Content (Last) = ']' then
return Content (Content'First + 1 .. Last - 1);
else
return Content;
end if;
end Strip_Unecessary_Array;
-- ------------------------------
-- Execute a GET operation on the Bbox API to retrieve the result into the property list.
-- ------------------------------
procedure Get (Client : in out Client_Type;
Operation : in String;
Result : in out Util.Properties.Manager) is
URI : constant String := Client.Get_URI (Operation);
Response : Util.Http.Clients.Response;
begin
Log.Debug ("Get {0}", URI);
Client.Http.Set_Timeout (10.0);
Client.Http.Get (URI, Response);
Util.Properties.JSON.Parse_JSON (Result, Strip_Unecessary_Array (Response.Get_Body));
end Get;
-- ------------------------------
-- Execute a GET operation on the Bbox API to retrieve the JSON result and return it.
-- ------------------------------
function Get (Client : in out Client_Type;
Operation : in String) return String is
URI : constant String := Client.Get_URI (Operation);
Response : Util.Http.Clients.Response;
begin
Log.Debug ("Get {0}", URI);
Client.Http.Set_Timeout (10.0);
Client.Http.Get (URI, Response);
return Response.Get_Body;
end Get;
-- ------------------------------
-- Execute a PUT operation on the Bbox API to change some parameter.
-- ------------------------------
procedure Put (Client : in out Client_Type;
Operation : in String;
Params : in String) is
URI : constant String := Client.Get_URI (Operation);
Response : Util.Http.Clients.Response;
begin
Log.Debug ("Put {0}", URI);
Client.Http.Set_Timeout (10.0);
Client.Http.Put (URI, Params, Response);
end Put;
procedure Refresh_Token (Client : in out Client_Type) is
use type Ada.Calendar.Time;
Now : constant Ada.Calendar.Time := Ada.Calendar.Clock;
Response : Util.Http.Clients.Response;
Tokens : Util.Properties.Manager;
begin
if Length (Client.Token) /= 0 and then Client.Expires > Now then
return;
end if;
Log.Debug ("Get bbox token");
Client.Http.Set_Timeout (10.0);
Client.Http.Get (Client.Get_URI ("device/token"), Response);
Util.Properties.JSON.Parse_JSON (Tokens, Strip_Unecessary_Array (Response.Get_Body));
Client.Token := To_Unbounded_String (Tokens.Get ("device.token", ""));
Client.Expires := Ada.Calendar.Clock + 60.0;
end Refresh_Token;
-- Execute a POST operation on the Bbox API to change some parameter.
procedure Post (Client : in out Client_Type;
Operation : in String;
Params : in String) is
URI : constant String := Client.Get_URI (Operation);
Response : Util.Http.Clients.Response;
begin
Log.Debug ("Post {0}", URI);
Client.Refresh_Token;
Client.Http.Set_Timeout (10.0);
Client.Http.Post (URI & "?btoken=" & To_String (Client.Token), Params, Response);
end Post;
-- Iterate over a JSON array flattened in the properties.
procedure Iterate (Props : in Util.Properties.Manager;
Name : in String;
Process : access procedure (P : in Util.Properties.Manager;
Base : in String)) is
Count : constant Integer := Int_Property.Get (Props, Name & ".length", 0);
begin
for I in 0 .. Count loop
declare
Base : constant String := Name & "." & Util.Strings.Image (I);
begin
Process (Props, Base);
end;
end loop;
end Iterate;
end Bbox.API;
|
library/fmGUI_ManageSecurity/fmGUI_ManageSecurity_Save.applescript | NYHTC/applescript-fm-helper | 1 | 3075 | <filename>library/fmGUI_ManageSecurity/fmGUI_ManageSecurity_Save.applescript
-- fmGUI_ManageSecurity_Save({fullAccessAccountName:null, fullAccessPassword:null})
-- <NAME>, NYHTC
-- Close ( and save ) Manage Security
(*
HISTORY:
2020-03-04 ( dshockley ): Standardized version.
1.5.2 - 2017-11-07 ( eshagdar ): click 'allow' to get past the 'full access accounts with no password' prompt.
1.5.1 - 2017-10-23 ( eshagdar ): FM16 renamed auth window name, so windw test is 'begins with' instead of 'is'
1.5 - 2017-10-19 ( eshagdar ): sub-handlers: button clicks, window checks, authentication.
1.4.2 - 2017-08-09 ( eshagdar ): instead of waiting for a set amount of time, wait until the frontmost window is not manage security ( it will either be the confirm full access window, or finished saving ).
1.4.1 - 2017-08-07 ( eshagdar ): added windowWaitUntil handler to execute sample code
1.4 - 2017-07-14 ( eshagdar ): renamed params: fullAccount -> fullAccessAccountName and fullPassword -> fullAccessPassword. wait until windows are gone.
1.3 - 2016-07-20 ( eshagdar ): converted params from list to record
1.2 - parameter as 'prefs' list for now, instead of two parameters.
1.1 -
1.0 - created
REQUIRES:
fmGUI_AppFrontMost
fmGUI_AuthenticateDialog
fmGUI_NameOfFrontmostWindow
fmGUI_ObjectClick_Button
fmGUI_ObjectClick_OkButton
windowWaitUntil
*)
on run
fmGUI_ManageSecurity_Save({fullAccessAccountName:"admin", fullAccessPassword:""})
end run
--------------------
-- START OF CODE
--------------------
on fmGUI_ManageSecurity_Save(prefs)
-- version 2020-03-04-1534
set defaulPrefs to {fullAccessAccountName:null, fullAccessPassword:<PASSWORD>}
set prefs to prefs & defaulPrefs
set authWindowName to "Confirm Full access"
set securityWindowName to "Manage Security for"
try
fmGUI_AppFrontMost()
-- save security changes
fmGUI_ObjectClick_OkButton({})
-- confirm with full access account
if fmGUI_NameOfFrontmostWindow() is equal to "FileMaker Pro Advanced" then fmGUI_ObjectClick_Button({buttonName:"Allow"})
if fmGUI_NameOfFrontmostWindow() begins with authWindowName then fmGUI_AuthenticateDialog({accountName:fullAccessAccountName of prefs, pwd:fullAccessPassword of prefs, windowname:authWindowName})
-- wait until window is gone
windowWaitUntil({whichWindow:"front", windowNameTest:"does not start with", windowname:securityWindowName})
return true
on error errMsg number errNum
error "Couldn't save Manage Security - " & errMsg number errNum
end try
end fmGUI_ManageSecurity_Save
--------------------
-- END OF CODE
--------------------
on fmGUI_AppFrontMost()
tell application "htcLib" to fmGUI_AppFrontMost()
end fmGUI_AppFrontMost
on fmGUI_AuthenticateDialog(prefs)
tell application "htcLib" to fmGUI_AuthenticateDialog(prefs)
end fmGUI_AuthenticateDialog
on fmGUI_NameOfFrontmostWindow()
tell application "htcLib" to fmGUI_NameOfFrontmostWindow()
end fmGUI_NameOfFrontmostWindow
on fmGUI_ObjectClick_Button(prefs)
tell application "htcLib" to fmGUI_ObjectClick_Button(prefs)
end fmGUI_ObjectClick_Button
on fmGUI_ObjectClick_OkButton(prefs)
tell application "htcLib" to fmGUI_ObjectClick_OkButton(prefs)
end fmGUI_ObjectClick_OkButton
on windowWaitUntil(prefs)
tell application "htcLib" to windowWaitUntil(prefs)
end windowWaitUntil
|
resources/scripts/api/ipinfo.ads | seczoid/Amass | 1 | 7149 | -- Copyright 2021 <NAME>. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "IPinfo"
type = "api"
function start()
setratelimit(1)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function asn(ctx, addr, asn)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
local prefix
if (asn == 0) then
if (addr == "") then
return
end
asn, prefix = getasn(ctx, addr, cfg.ttl, c.key)
if (asn == 0) then
return
end
end
local a = asinfo(ctx, asn, cfg.ttl, c.key)
if (a == nil) then
return
end
newasn(ctx, {
['addr']=addr,
['asn']=asn,
['prefix']=prefix,
['cc']=a.cc,
['registry']=a.registry,
['desc']=a.desc,
['netblocks']=a.netblocks,
})
end
function getasn(ctx, addr, ttl, token)
local u = "https://ipinfo.io/" .. addr .. "/asn?token=" .. token
local resp = cacherequest(ctx, u, ttl)
if (resp == "") then
return 0, ""
end
local j = json.decode(resp)
if (j ~= nil and j.error ~= nil) then
return 0, ""
end
return tonumber(string.sub(j.asn, 3)), j.route
end
function asinfo(ctx, asn, ttl, token)
local strasn = "AS" .. tostring(asn)
resp = cacherequest(ctx, "https://ipinfo.io/" .. strasn .. "/json?token=" .. token, ttl)
if (resp == "") then
return nil
end
local j = json.decode(resp)
if (j == nil or j.asn == nil or j.asn ~= strasn) then
return nil
end
local netblocks = {}
for _, p in pairs(j.prefixes) do
table.insert(netblocks, p.netblock)
end
for _, p in pairs(j.prefixes6) do
table.insert(netblocks, p.netblock)
end
return {
['desc']=j.name,
['cc']=j.country,
['registry']=j.registry,
['netblocks']=netblocks,
}
end
function cacherequest(ctx, url, ttl)
local resp, err = request(ctx, {
['url']=url,
headers={['Content-Type']="application/json"},
})
if (err ~= nil and err ~= "") then
return ""
end
return resp
end
|
alloy4fun_models/trashltl/models/1/xe7CWHdnBmwhkrLJD.als | Kaixi26/org.alloytools.alloy | 0 | 3498 | open main
pred idxe7CWHdnBmwhkrLJD_prop2 {
historically no File
}
pred __repair { idxe7CWHdnBmwhkrLJD_prop2 }
check __repair { idxe7CWHdnBmwhkrLJD_prop2 <=> prop2o } |
alloy4fun_models/trashltl/models/17/bmeca3ubTLA93Fxhy.als | Kaixi26/org.alloytools.alloy | 0 | 4864 | open main
pred idbmeca3ubTLA93Fxhy_prop18 {
always (all f : Protected | f in Trash implies after f not in Protected)
}
pred __repair { idbmeca3ubTLA93Fxhy_prop18 }
check __repair { idbmeca3ubTLA93Fxhy_prop18 <=> prop18o } |
2020 Fall E C E 252/EX11/ex11.asm | jsswd888/2020_FALL_UW_MADISON | 0 | 100399 | <filename>2020 Fall E C E 252/EX11/ex11.asm
.orig x0200
;
START JSR SUB2 ; CHANGE THIS LINE
BR START
;
SUB4 ADD R0, R0, #4
RET
;
SUB3 JSR SUB4
ADD R0, R0, #3
RET
;
SUB2 JSR SUB4
ADD R0, R0, #2
RET
;
SUB1 JSR SUB4
ADD R0, R0, #1
RET
;
.end |
src/licensing.ads | mosteo/licensing | 0 | 24717 | with Licensing_Raw;
package Licensing with Preelaborate is
type Licenses is new Licensing_Raw.Licenses;
end Licensing;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1964.asm | ljhsiun2/medusa | 9 | 972 | <filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1964.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r8
push %r9
push %rbp
lea addresses_WT_ht+0x1b899, %r9
dec %r11
movb $0x61, (%r9)
cmp $17753, %rbp
lea addresses_D_ht+0x1f99, %r12
nop
nop
nop
nop
xor %r8, %r8
mov (%r12), %r14w
nop
nop
sub %r12, %r12
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_WT+0xe399, %rsi
lea addresses_A+0x11a99, %rdi
clflush (%rsi)
and $65136, %rbp
mov $85, %rcx
rep movsw
nop
nop
nop
nop
nop
and %r14, %r14
// Store
lea addresses_D+0x18689, %r14
nop
nop
nop
sub $1157, %r11
movl $0x51525354, (%r14)
xor %r8, %r8
// Faulty Load
lea addresses_D+0x8899, %r11
xor $17166, %rdi
movups (%r11), %xmm5
vpextrq $1, %xmm5, %r14
lea oracles, %r11
and $0xff, %r14
shlq $12, %r14
mov (%r11,%r14,1), %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_D', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}}
[Faulty Load]
{'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': True, 'same': False, 'congruent': 11}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3604a.ada | best08618/asylo | 7 | 19104 | <reponame>best08618/asylo<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3604a.ada<gh_stars>1-10
-- CE3604A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT GET_LINE MAY BE CALLED TO RETURN AN ENTIRE LINE. ALSO
-- CHECK THAT GET_LINE MAY BE CALLED TO RETURN THE REMAINDER OF A
-- PARTLY READ LINE. ALSO CHECK THAT GET_LINE RETURNS IN THE
-- PARAMETER LAST, THE INDEX VALUE OF THE LAST CHARACTER READ.
-- WHEN NO CHARACTERS ARE READ, LAST IS ONE LESS THAN ITEM'S LOWER
-- BOUND.
-- APPLICABILITY CRITERIA:
-- THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH SUPPORT
-- TEXT FILES.
-- HISTORY:
-- JLH 09/25/87 COMPLETELY REVISED TEST.
WITH REPORT; USE REPORT;
WITH TEXT_IO; USE TEXT_IO;
PROCEDURE CE3604A IS
BEGIN
TEST ("CE3604A", "CHECK THAT GET_LINE READS LINES APPROPRIATELY " &
"AND CHECK THAT LAST RETURNS THE CORRECT INDEX " &
"VALUE");
DECLARE
FILE : FILE_TYPE;
STR : STRING (1 .. 25);
LAST : NATURAL;
ITEM1 : STRING (2 .. 6);
ITEM2 : STRING (3 .. 6);
CH : CHARACTER;
INCOMPLETE : EXCEPTION;
BEGIN
BEGIN
CREATE (FILE, OUT_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED ON TEXT CREATE " &
"WITH OUT_FILE MODE");
RAISE INCOMPLETE;
WHEN NAME_ERROR =>
NOT_APPLICABLE ("NAME_ERROR RAISED ON TEXT " &
"CREATE WITH OUT_FILE MODE");
RAISE INCOMPLETE;
WHEN OTHERS =>
FAILED ("UNEXPECTED EXCEPTION RAISED ON TEXT " &
"CREATE");
RAISE INCOMPLETE;
END;
PUT (FILE, "FIRST LINE OF INPUT");
NEW_LINE (FILE);
PUT (FILE, "SECOND LINE OF INPUT");
NEW_LINE (FILE);
PUT (FILE, "THIRD LINE OF INPUT");
NEW_LINE (FILE);
NEW_LINE (FILE);
CLOSE (FILE);
BEGIN
OPEN (FILE, IN_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED ON TEXT OPEN " &
"WITH IN_FILE MODE");
RAISE INCOMPLETE;
END;
GET_LINE (FILE, STR, LAST);
BEGIN
IF STR(1..LAST) /= "FIRST LINE OF INPUT" THEN
FAILED ("GET_LINE - RETURN OF ENTIRE LINE");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
FAILED ("CONSTRAINT_ERROR RAISED AFTER " &
"GET_LINE - 1");
END;
GET (FILE, ITEM1);
GET_LINE (FILE, STR, LAST);
BEGIN
IF STR(1..LAST) /= "D LINE OF INPUT" THEN
FAILED ("GET_LINE - REMAINDER OF PARTLY READ LINE");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
FAILED ("CONSTRAINT_ERROR RAISED AFTER " &
"GET_LINE - 2");
END;
GET_LINE (FILE, ITEM1, LAST);
IF LAST /= 6 THEN
FAILED ("INCORRECT VALUE FOR LAST PARAMETER - 1");
END IF;
WHILE NOT END_OF_LINE (FILE) LOOP
GET (FILE, CH);
END LOOP;
GET_LINE (FILE, ITEM1, LAST);
IF LAST /= 1 THEN
FAILED ("INCORRECT VALUE FOR LAST PARAMETER - 2");
END IF;
IF NOT END_OF_LINE (FILE) THEN
FAILED ("END_OF_LINE NOT TRUE");
END IF;
GET_LINE (FILE, ITEM2, LAST);
IF LAST /= 2 THEN
FAILED ("INCORRECT VALUE FOR LAST PARAMETER - 3");
END IF;
BEGIN
DELETE (FILE);
EXCEPTION
WHEN USE_ERROR =>
NULL;
END;
EXCEPTION
WHEN INCOMPLETE =>
NULL;
END;
RESULT;
END CE3604A;
|
services/cookbook/core/src/main/antlr/IngredientLexer.g4 | wolkenschloss/nubes | 0 | 7841 | lexer grammar IngredientLexer;
@header {
import family.haschka.wolkenschloss.cookbook.recipe.Unit;
}
@lexer::members {
private boolean isValidUnit(String unit) {
return Unit.Companion.list().contains(unit);
}
}
WS : [ \t\r\n]+ -> skip;
DIV : '/';
ZERO : '0';
SIGN : '-';
UINT : [1-9][0-9]*;
UNIT : [\p{Alpha}\p{Punctuation} ]+ { isValidUnit(getText()) }? -> pushMode(TEXT_SEPERATOR);
SYMBOL : [½⅔¾⅘⅚⅞⅓⅗¼⅖⅝⅕⅙⅜⅐⅛⅑⅒];
TEXT_START: [\p{Letter}\p{Mark}\p{Punctuation}\p{Symbol}] -> pushMode(TEXT) ;
mode TEXT_SEPERATOR;
SEPARATOR: ' '+ -> pushMode(TEXT);
mode TEXT;
REST : [\p{Alnum}\p{Mark}\p{Punctuation}\p{Symbol} ]+;
END : EOF -> popMode;
|
demos/src/calculatorcommands.adb | thindil/tashy2 | 2 | 24233 | <gh_stars>1-10
-- Copyright (c) 2021 <NAME> <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Tcl.Strings; use Tcl.Strings;
with Tk.TtkButton; use Tk.TtkButton;
with Tk.TtkLabel; use Tk.TtkLabel;
with Tk.Widget; use Tk.Widget;
package body CalculatorCommands with
SPARK_Mode
is
function Click_Action
(ButtonName, LabelName: String; Interpreter: Tcl_Interpreter)
return Tcl_Results is
Button: constant Ttk_Button :=
Get_Widget(Path_Name => ButtonName, Interpreter => Interpreter);
Display_Label: constant Ttk_Label :=
Get_Widget(Path_Name => LabelName, Interpreter => Interpreter);
Label_Options: Ttk_Label_Options := Get_Options(Label => Display_Label);
Button_Options: constant Ttk_Button_Options :=
Get_Options(Button => Button);
Operators_Set: constant Character_Set := To_Set(Sequence => "*+/-");
No_Minus_Operators_Set: constant Character_Set :=
To_Set(Sequence => "*+/");
Result: Float := 0.0;
Start_Index: Positive := 1;
Sign_Index: Natural := 0;
Expression: constant String :=
To_Ada_String(Source => Label_Options.Text);
Result_String: String(1 .. 30);
Is_Negative: Boolean := False;
begin
-- Remove leading zero from the display text but only when number was
-- pressed
if not Is_In
(Element => To_Ada_String(Source => Button_Options.Text)(1),
Set => No_Minus_Operators_Set)
and then Label_Options.Text = To_Tcl_String(Source => "0") then
Label_Options.Text := Null_Tcl_String;
end if;
-- Find the last occurence of mathematical operator
Sign_Index :=
Index(Source => Expression, Set => Operators_Set, Going => Backward);
if Button_Options.Text = To_Tcl_String(Source => ".") then
if Index(Source => Expression, Pattern => ".", Going => Backward) >
Sign_Index then
return TCL_OK;
end if;
if Label_Options.Text = Null_Tcl_String then
Label_Options.Text := To_Tcl_String(Source => "0");
end if;
end if;
-- If the user pressed equal button, count value of expression from
-- the display
if Button_Options.Text = To_Tcl_String(Source => "=") then
-- If mathematical operator is the last character, quit, probably the
-- user pressed the button by accident
if Sign_Index = Expression'Length then
return TCL_OK;
end if;
-- Count the result of the expression entered by the user
Count_Result_Loop :
loop
-- Find the occurence of a mathematical operator
Sign_Index :=
Index
(Source => Expression, Set => Operators_Set,
From => Start_Index);
-- No operator found, copy the whole text to result and quit
-- the loop
if Sign_Index = 0 then
if Start_Index = 1 then
Result := Float'Value(Expression);
exit Count_Result_Loop;
end if;
Sign_Index := Expression'Last + 1;
end if;
-- The operator is a negative number sign, go to end of loop to
-- find another
if (Sign_Index = 1 and then Expression(Sign_Index) = '-') or
Start_Index = Sign_Index then
Is_Negative := True;
goto End_Of_Count_Loop;
end if;
if Start_Index = 1 then
Result :=
Float'Value(Expression(Start_Index .. Sign_Index - 1));
goto End_Of_Count_Loop;
end if;
-- Get the matematical operator if the number is negative
if Is_Negative and Start_Index > 2 then
Start_Index := Start_Index - 1;
end if;
Is_Negative := False;
-- Count the expression, based on the found mathematical symbol
case Expression(Start_Index - 1) is
when '+' =>
Result :=
Result +
Float'Value(Expression(Start_Index .. Sign_Index - 1));
when '-' =>
Result :=
Result -
Float'Value(Expression(Start_Index .. Sign_Index - 1));
when '*' =>
Result :=
Result *
Float'Value(Expression(Start_Index .. Sign_Index - 1));
when '/' =>
Result :=
Result /
Float'Value(Expression(Start_Index .. Sign_Index - 1));
when others =>
null;
end case;
<<End_Of_Count_Loop>>
-- Set the start looking index to the new value
Start_Index := Sign_Index + 1;
exit Count_Result_Loop when Start_Index > Expression'Last;
end loop Count_Result_Loop;
-- Convert the result value to string with maximum 5 zeros
Put(To => Result_String, Item => Result, Aft => 5, Exp => 0);
-- Remove trailing zeros from the result string
Trim
(Source => Result_String, Left => Null_Set,
Right => To_Set(Sequence => ".0"));
-- Set the result string as the display value, remove also all
-- trailing spaces from it
Configure
(Label => Display_Label,
Options =>
(Text =>
To_Tcl_String
(Source => Trim(Source => Result_String, Side => Both)),
others => <>));
return TCL_OK;
end if;
-- Add the pressed button text (number or operator) to the calculator's
-- display
Configure
(Label => Display_Label,
Options =>
(Text => Label_Options.Text & Button_Options.Text, others => <>));
return TCL_OK;
end Click_Action;
function Clear_Action
(LabelName: String; Interpreter: Tcl_Interpreter) return Tcl_Results is
Display_Label: constant Ttk_Label :=
Get_Widget(Path_Name => LabelName, Interpreter => Interpreter);
begin
Configure
(Label => Display_Label,
Options => (Text => To_Tcl_String(Source => "0"), others => <>));
return TCL_OK;
end Clear_Action;
end CalculatorCommands;
|
programs/oeis/088/A088982.asm | neoneye/loda | 22 | 13862 | <filename>programs/oeis/088/A088982.asm
; A088982: Primes that are between consecutive prime-indexed primes.
; 7,13,19,23,29,37,43,47,53,61,71,73,79,89,97,101,103,107,113,131,137,139,149,151,163,167,173,181,193,197,199,223,227,229,233,239,251,257,263,269,271,281,293,307,311,313,317,337,347,349,359,373,379,383,389,397,409,419,421,433,439,443,449,457,463,467,479,487,491,499,503,521,523,541,557,569,571,577,593,601,607,613,619,631,641,643,647,653,659,661,673,677,683,691,701,719,727,733,743,751
seq $0,72668 ; Numbers one less than composite numbers.
sub $0,1
seq $0,98090 ; Numbers k such that 2k-3 is prime.
sub $0,5
mul $0,2
add $0,7
|
src/main/fragment/mos6502-common/vbuaa=vbuaa_bxor_pbuc1_derefidx_vbuxx.asm | jbrandwood/kickc | 2 | 88462 | <filename>src/main/fragment/mos6502-common/vbuaa=vbuaa_bxor_pbuc1_derefidx_vbuxx.asm
eor {c1},x
|
programs/oeis/151/A151923.asm | neoneye/loda | 22 | 174186 | ; A151923: A079316(2n+1).
; 3,7,11,21,25,35,45,73,77,87,97,125,135,163,191,273,277,287,297,325,335,363,391,473,483,511,539,621,649,731
mov $1,$0
seq $1,130665 ; a(n) = Sum_{k=0..n} 3^wt(k), where wt() = A000120().
add $0,$1
add $0,2
|
Sources/Globe_3d/gl/gl-frustums.adb | ForYouEyesOnly/Space-Convoy | 1 | 27787 | <filename>Sources/Globe_3d/gl/gl-frustums.adb
package body GL.Frustums is
procedure Normalise (the_Planes : in out plane_Array) is
use GL.Geometry;
begin
for Each in the_Planes'Range loop
Normalise (the_Planes (Each));
end loop;
end Normalise;
function Current_Planes return plane_Array is
the_Planes : plane_Array;
Proj : array (0 .. 15) of aliased GL.C_Float;
Modl : array (0 .. 15) of aliased GL.C_Float;
Clip : array (0 .. 15) of GL.C_Float;
begin
GL.GetFloatv (GL.PROJECTION_MATRIX, Proj (0)'Unchecked_Access); -- Get the current PROJECTION matrix from OpenGL
GL.GetFloatv (GL.MODELVIEW_MATRIX, Modl (0)'Unchecked_Access); -- Get the current MODELVIEW matrix from OpenGL
-- Combine the two matrices (multiply projection by modelview)
--
Clip (0) := Modl (0) * Proj (0) + Modl (1) * Proj (4) + Modl (2) * Proj (8) + Modl (3) * Proj (12);
Clip (1) := Modl (0) * Proj (1) + Modl (1) * Proj (5) + Modl (2) * Proj (9) + Modl (3) * Proj (13);
Clip (2) := Modl (0) * Proj (2) + Modl (1) * Proj (6) + Modl (2) * Proj (10) + Modl (3) * Proj (14);
Clip (3) := Modl (0) * Proj (3) + Modl (1) * Proj (7) + Modl (2) * Proj (11) + Modl (3) * Proj (15);
Clip (4) := Modl (4) * Proj (0) + Modl (5) * Proj (4) + Modl (6) * Proj (8) + Modl (7) * Proj (12);
Clip (5) := Modl (4) * Proj (1) + Modl (5) * Proj (5) + Modl (6) * Proj (9) + Modl (7) * Proj (13);
Clip (6) := Modl (4) * Proj (2) + Modl (5) * Proj (6) + Modl (6) * Proj (10) + Modl (7) * Proj (14);
Clip (7) := Modl (4) * Proj (3) + Modl (5) * Proj (7) + Modl (6) * Proj (11) + Modl (7) * Proj (15);
Clip (8) := Modl (8) * Proj (0) + Modl (9) * Proj (4) + Modl (10) * Proj (8) + Modl (11) * Proj (12);
Clip (9) := Modl (8) * Proj (1) + Modl (9) * Proj (5) + Modl (10) * Proj (9) + Modl (11) * Proj (13);
Clip (10) := Modl (8) * Proj (2) + Modl (9) * Proj (6) + Modl (10) * Proj (10) + Modl (11) * Proj (14);
Clip (11) := Modl (8) * Proj (3) + Modl (9) * Proj (7) + Modl (10) * Proj (11) + Modl (11) * Proj (15);
Clip (12) := Modl (12) * Proj (0) + Modl (13) * Proj (4) + Modl (14) * Proj (8) + Modl (15) * Proj (12);
Clip (13) := Modl (12) * Proj (1) + Modl (13) * Proj (5) + Modl (14) * Proj (9) + Modl (15) * Proj (13);
Clip (14) := Modl (12) * Proj (2) + Modl (13) * Proj (6) + Modl (14) * Proj (10) + Modl (15) * Proj (14);
Clip (15) := Modl (12) * Proj (3) + Modl (13) * Proj (7) + Modl (14) * Proj (11) + Modl (15) * Proj (15);
-- Extract the RIGHT plane
the_Planes (Right) (0) := GL.Double (Clip (3) - Clip (0));
the_Planes (Right) (1) := GL.Double (Clip (7) - Clip (4));
the_Planes (Right) (2) := GL.Double (Clip (11) - Clip (8));
the_Planes (Right) (3) := GL.Double (Clip (15) - Clip (12));
-- Extract the LEFT plane
the_Planes (Left) (0) := GL.Double (Clip (3) + Clip (0));
the_Planes (Left) (1) := GL.Double (Clip (7) + Clip (4));
the_Planes (Left) (2) := GL.Double (Clip (11) + Clip (8));
the_Planes (Left) (3) := GL.Double (Clip (15) + Clip (12));
-- Extract the LOW plane
the_Planes (Low) (0) := GL.Double (Clip (3) + Clip (1));
the_Planes (Low) (1) := GL.Double (Clip (7) + Clip (5));
the_Planes (Low) (2) := GL.Double (Clip (11) + Clip (9));
the_Planes (Low) (3) := GL.Double (Clip (15) + Clip (13));
-- Extract the HIGH plane
the_Planes (High) (0) := GL.Double (Clip (3) - Clip (1));
the_Planes (High) (1) := GL.Double (Clip (7) - Clip (5));
the_Planes (High) (2) := GL.Double (Clip (11) - Clip (9));
the_Planes (High) (3) := GL.Double (Clip (15) - Clip (13));
-- Extract the FAR plane
the_Planes (Far) (0) := GL.Double (Clip (3) - Clip (2));
the_Planes (Far) (1) := GL.Double (Clip (7) - Clip (6));
the_Planes (Far) (2) := GL.Double (Clip (11) - Clip (10));
the_Planes (Far) (3) := GL.Double (Clip (15) - Clip (14));
-- Extract the NEAR plane
the_Planes (Near) (0) := GL.Double (Clip (3) + Clip (2));
the_Planes (Near) (1) := GL.Double (Clip (7) + Clip (6));
the_Planes (Near) (2) := GL.Double (Clip (11) + Clip (10));
the_Planes (Near) (3) := GL.Double (Clip (15) + Clip (14));
Normalise (the_Planes);
return the_Planes;
end Current_Planes;
end GL.Frustums;
|
Universe/Utility/TruncUniverse.agda | sattlerc/HoTT-Agda | 0 | 13626 | <gh_stars>0
{-# OPTIONS --without-K #-}
{- The type of all types in some universe with a fixed truncation level
behaves almost like a universe itself. In this utility module, we develop
some notation for efficiently working with this pseudo-universe.
It will lead to considerably more briefer and more comprehensible proofs. -}
module Universe.Utility.TruncUniverse where
open import lib.Basics
open import lib.NType2
open import lib.types.Pi
open import lib.types.Sigma
open import lib.types.TLevel
open import lib.types.Unit
open import Universe.Utility.General
module _ {n : ℕ₋₂} where
⟦_⟧ : ∀ {i} → n -Type i → Type i
⟦ (B , _) ⟧ = B
module _ {n : ℕ₋₂} where
Lift-≤ : ∀ {i j} → n -Type i → n -Type (i ⊔ j)
Lift-≤ {i} {j} (A , h) = (Lift {j = j} A , equiv-preserves-level (lift-equiv ⁻¹) h)
raise : ∀ {i} → n -Type i → S n -Type i
raise (A , h) = (A , raise-level n h)
raise-≤T : ∀ {i} {m n : ℕ₋₂} → m ≤T n → m -Type i → n -Type i
raise-≤T p (A , h) = (A , raise-level-≤T p h)
⊤-≤ : n -Type lzero
⊤-≤ = (⊤ , raise-level-≤T (-2≤T n) Unit-is-contr)
Π-≤ : ∀ {i j} (A : Type i) → (A → n -Type j) → n -Type (i ⊔ j)
Π-≤ A B = (Π A (fst ∘ B) , Π-level (snd ∘ B))
infixr 2 _→-≤_
_→-≤_ : ∀ {i j} → Type i → n -Type j → n -Type (i ⊔ j)
A →-≤ B = Π-≤ A (λ _ → B)
Σ-≤ : ∀ {i j} (A : n -Type i) → (⟦ A ⟧ → n -Type j) → n -Type (i ⊔ j)
Σ-≤ A B = (Σ ⟦ A ⟧ (λ a → ⟦ B a ⟧) , Σ-level (snd A) (snd ∘ B))
infixr 4 _×-≤_
_×-≤_ : ∀ {i j} → n -Type i → n -Type j → n -Type (i ⊔ j)
A ×-≤ B = Σ-≤ A (λ _ → B)
Path-< : ∀ {i} (A : S n -Type i) (x y : ⟦ A ⟧) → n -Type i
Path-< A x y = (x == y , snd A _ _)
Path-≤ : ∀ {i} (A : n -Type i) (x y : ⟦ A ⟧) → n -Type i
Path-≤ A x y = Path-< (raise A) x y
_≃-≤_ : ∀ {i j} (A : n -Type i) (B : n -Type j) → n -Type (i ⊔ j)
A ≃-≤ B = (⟦ A ⟧ ≃ ⟦ B ⟧ , ≃-level (snd A) (snd B))
_-Type-≤_ : (n : ℕ₋₂) (i : ULevel) → S n -Type lsucc i
n -Type-≤ i = (n -Type i , n -Type-level i)
|
workflow/loader.applescript | thepratik/alfred4-youtube-control | 13 | 3703 | on init(p)
script Loader
property class : "Loader"
property prefix : missing value
on run {}
set prefix to p & "::"
return me
end run
on load(filename)
return (load script POSIX path of prefix & filename)
end load
end script
return run script Loader
end init
|
oeis/171/A171487.asm | neoneye/loda-programs | 11 | 82408 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A171487: Product of odd prime anti-factors < n, with multiplicity.
; Submitted by <NAME>
; 1,1,1,9,9,1,15,15,1,21,21,25,675,27,1,33,1155,35,39,39,1,45,45,49,2499,51,55,3135,57,1,63,4095,65,69,69,1,75,5775,77,81,81,85,7395,87,91,8463,8835,95,99,99,1,105,105,1,111,111,115,13455,13923,14399,14883,15375,125,129,129,133,17955,135,1,141,20163,20735,21315,147,1,153,23715,155,159,25599,161,165,165,169,28899,171,175,30975,177,1,183,33855,34595,35343,189,1,195,195,1,201
mov $1,1
lpb $0
mov $2,$0
sub $0,1
mul $2,2
add $2,2
pow $2,2
mul $3,$2
sub $2,1
add $3,$1
max $1,$2
lpe
gcd $3,$1
mov $0,$3
|
src/Generic/Property/Reify.agda | turion/Generic | 30 | 14628 | <reponame>turion/Generic<filename>src/Generic/Property/Reify.agda
module Generic.Property.Reify where
open import Generic.Core
data ExplView : Visibility -> Set where
yes-expl : ExplView expl
no-expl : ∀ {v} -> ExplView v
explView : ∀ v -> ExplView v
explView expl = yes-expl
explView v = no-expl
ExplMaybe : ∀ {α} -> Visibility -> Set α -> Set α
ExplMaybe v A with explView v
... | yes-expl = A
... | no-expl = ⊤
caseExplMaybe : ∀ {α π} {A : Set α} (P : Visibility -> Set π)
-> (A -> P expl) -> (∀ {v} -> P v) -> ∀ v -> ExplMaybe v A -> P v
caseExplMaybe P f y v x with explView v
... | yes-expl = f x
... | no-expl = y
Prod : ∀ {α} β -> Visibility -> Set α -> Set (α ⊔ β) -> Set (α ⊔ β)
Prod β v A B with explView v
... | yes-expl = A × B
... | no-expl = B
uncurryProd : ∀ {α β γ} {A : Set α} {B : Set (α ⊔ β)} {C : Set γ} v
-> Prod β v A B -> (ExplMaybe v A -> B -> C) -> C
uncurryProd v p g with explView v | p
... | yes-expl | (x , y) = g x y
... | no-expl | y = g tt y
SemReify : ∀ {i β} {I : Set i} -> Desc I β -> Set
SemReify (var i) = ⊤
SemReify (π i q C) = ⊥
SemReify (D ⊛ E) = SemReify D × SemReify E
mutual
ExtendReify : ∀ {i β} {I : Set i} -> Desc I β -> Set β
ExtendReify (var i) = ⊤
ExtendReify (π i q C) = ExtendReifyᵇ i C q
ExtendReify (D ⊛ E) = SemReify D × ExtendReify E
ExtendReifyᵇ : ∀ {ι α β γ q} {I : Set ι} i -> Binder α β γ i q I -> α ≤ℓ β -> Set β
ExtendReifyᵇ {β = β} i (coerce (A , D)) q = Coerce′ q $
Prod β (visibility i) (Reify A) (∀ {x} -> ExtendReify (D x))
-- Can't reify an irrelevant thing into its relevant representation.
postulate
reifyᵢ : ∀ {α} {A : Set α} {{aReify : Reify A}} -> .A -> Term
instance
{-# TERMINATING #-}
DataReify : ∀ {i β} {I : Set i} {D : Data (Desc I β)} {j}
{{reD : All ExtendReify (consTypes D)}} -> Reify (μ D j)
DataReify {ι} {β} {I} {D₀} = record { reify = reifyMu } where
mutual
reifySem : ∀ D {{reD : SemReify D}} -> ⟦ D ⟧ (μ D₀) -> Term
reifySem (var i) d = reifyMu d
reifySem (π i q C) {{()}}
reifySem (D ⊛ E) {{reD , reE}} (x , y) =
sate _,_ (reifySem D {{reD}} x) (reifySem E {{reE}} y)
reifyExtend : ∀ {j} D {{reD : ExtendReify D}} -> Extend D (μ D₀) j -> List Term
reifyExtend (var i) lrefl = []
reifyExtend (π i q C) p = reifyExtendᵇ i C q p
reifyExtend (D ⊛ E) {{reD , reE}} (x , e) =
reifySem D {{reD}} x ∷ reifyExtend E {{reE}} e
reifyExtendᵇ : ∀ {α γ q j} i (C : Binder α β γ i q I) q′ {{reC : ExtendReifyᵇ i C q′}}
-> Extendᵇ i C q′ (μ D₀) j -> List Term
reifyExtendᵇ i (coerce (A , D)) q {{reC}} p =
uncurryProd (visibility i) (uncoerce′ q reC) λ mreA reD -> split q p λ x e ->
let es = reifyExtend (D x) {{reD}} e in
caseExplMaybe _ (λ reA -> elimRelValue _ (reify {{reA}}) (reifyᵢ {{reA}}) x ∷ es)
es
(visibility i)
mreA
reifyDesc : ∀ {j} D {{reD : ExtendReify D}} -> Name -> Extend D (μ D₀) j -> Term
reifyDesc D n e = vis appCon n (reifyExtend D e)
reifyAny : ∀ {j} (Ds : List (Desc I β)) {{reD : All ExtendReify Ds}}
-> ∀ d a b ns -> Node D₀ (packData d a b Ds ns) j -> Term
reifyAny [] d a b tt ()
reifyAny (D ∷ []) {{reD , _}} d a b (n , ns) e = reifyDesc D {{reD}} n e
reifyAny (D ∷ E ∷ Ds) {{reD , reDs}} d a b (n , ns) (inj₁ e) = reifyDesc D {{reD}} n e
reifyAny (D ∷ E ∷ Ds) {{reD , reDs}} d a b (n , ns) (inj₂ r) =
reifyAny (E ∷ Ds) {{reDs}} d a b ns r
reifyMu : ∀ {j} -> μ D₀ j -> Term
reifyMu (node e) = reifyAny (consTypes D₀)
(dataName D₀)
(parsTele D₀)
(indsTele D₀)
(consNames D₀)
e
|
kernel/module/module_start.asm | madd-games/glidix | 98 | 178357 | section .init
push rbp
mov rbp, rsp
section .fini
push rbp
mov rbp, rsp
|
s2/sfx-original/C6 - Ring Spill.asm | Cancer52/flamedriver | 9 | 3247 | Sound46_RingSpill_Header:
smpsHeaderStartSong 2
smpsHeaderVoice Sound_Ring_Voices
smpsHeaderTempoSFX $01
smpsHeaderChanSFX $02
smpsHeaderSFXChannel cFM4, Sound46_RingSpill_FM4, $00, $05
smpsHeaderSFXChannel cFM5, Sound46_RingSpill_FM5, $00, $08
; FM4 Data
Sound46_RingSpill_FM4:
smpsSetvoice $00
dc.b nA5, $02, $05, $05, $05, $05, $05, $05, $3A
smpsStop
; FM5 Data
Sound46_RingSpill_FM5:
smpsSetvoice $00
dc.b nRst, $02, nG5, $02, $05, $15, $02, $05, $32
smpsStop
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c36104b.ada | best08618/asylo | 7 | 28029 | -- C36104B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT CONSTRAINT_ERROR IS RAISED OR NOT, AS APPROPRIATE,
-- DURING DISCRETE_RANGE ELABORATIONS/EVALUATIONS IN LOOPS,
-- ARRAY_TYPE_DEFINITIONS, ARRAY AGGREGATES, SLICES,
-- AND INDEX CONSTRAINTS IN OBJECT AND TYPE DECLARATIONS, WHERE
-- AN EXPLICIT (SUB)TYPE IS INCLUDED IN EACH DISCRETE_RANGE.
-- MEMBERSHIP OPERATORS ARE CHECKED HERE, ALSO, TO ENSURE THAT
-- EXCEPTIONS ARE NOT RAISED FOR NULL RANGES.
-- ONLY DYNAMIC CASES ARE CHECKED HERE.
-- DAT 2/3/81
-- JRK 2/25/81
-- L.BROWN 7/15/86 1) ADDED ACCESS TYPES.
-- 2) DELETED "NULL INDEX RANGE, CONSTRAINT_ERROR
-- RAISED" SECTION.
-- 3) MADE USE OF DYNAMIC-RESULT FUNCTIONS.
-- 4) DELETED ALL REFERENCES TO CASE STATEMENT CHOICES
-- AND VARIANT PART CHOICES IN THE ABOVE COMMENT.
-- EDS 7/16/98 AVOID OPTIMIZATION
WITH REPORT;
PROCEDURE C36104B IS
USE REPORT;
TYPE WEEK IS (SSUN, SMON, STUE, SWED, STHU, SFRI, SSAT);
SUN : WEEK := WEEK'VAL(IDENT_INT(0));
MON : WEEK := WEEK'VAL(IDENT_INT(1));
TUE : WEEK := WEEK'VAL(IDENT_INT(2));
WED : WEEK := WEEK'VAL(IDENT_INT(3));
THU : WEEK := WEEK'VAL(IDENT_INT(4));
FRI : WEEK := WEEK'VAL(IDENT_INT(5));
SAT : WEEK := WEEK'VAL(IDENT_INT(6));
TYPE WEEK_ARRAY IS ARRAY (WEEK RANGE <>) OF WEEK;
SUBTYPE WORK_WEEK IS WEEK RANGE MON .. FRI;
SUBTYPE MID_WEEK IS WORK_WEEK RANGE TUE .. THU;
TYPE INT_10 IS NEW INTEGER RANGE -10 .. 10;
TYPE I_10 IS NEW INT_10;
SUBTYPE I_5 IS I_10 RANGE I_10(IDENT_INT(-5)) ..
I_10(IDENT_INT(5));
TYPE I_5_ARRAY IS ARRAY (I_5 RANGE <>) OF I_5;
FUNCTION F(DAY : WEEK) RETURN WEEK IS
BEGIN
RETURN DAY;
END;
BEGIN
TEST ("C36104B", "CONSTRAINT_ERROR IS RAISED OR NOT IN DYNAMIC "
& "DISCRETE_RANGES WITH EXPLICIT TYPE_MARKS");
-- NON-NULL RANGES, CONSTRAINT_ERROR RAISED.
BEGIN
DECLARE
TYPE A IS ARRAY (I_5 RANGE 0 .. 6) OF I_5;
-- ABOVE DECLARATION RAISES CONSTRAINT_ERROR.
BEGIN
DECLARE
-- DEFINE AN OBJECT OF TYPE A AND USE IT TO AVOID
-- OPTIMIZATION OF SUBTYPE
A1 : A := (A'RANGE => I_5(IDENT_INT(1)));
BEGIN
FAILED ("CONSTRAINT_ERROR NOT RAISED 1 " &
I_5'IMAGE(A1(1)) ); --USE A1
END;
EXCEPTION
--MAKE SURE THAT CONSTRAINT_ERROR FROM ABOVE STATEMENTS
--REPORT FAILED.
WHEN OTHERS => FAILED ("UNHANDLED EXCEPTION RAISED 1");
END;
EXCEPTION
WHEN CONSTRAINT_ERROR => NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED 1");
END;
BEGIN
FOR I IN MID_WEEK RANGE MON .. MON LOOP
IF EQUAL(2,2) THEN
SAT := SSAT;
END IF;
END LOOP;
FAILED ("CONSTRAINT_ERROR NOT RAISED 3");
EXCEPTION
WHEN CONSTRAINT_ERROR => NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED 3");
END;
BEGIN
DECLARE
TYPE P IS ACCESS I_5_ARRAY (0 .. 6);
-- ABOVE DECLARATION RAISES CONSTRAINT_ERROR.
BEGIN
DECLARE
TYPE PA IS NEW P;
-- DEFINE AN OBJECT OF TYPE PA AND USE IT TO AVOID
-- OPTIMIZATION OF TYPE
PA1 : PA :=NEW I_5_ARRAY'(0.. I_5(IDENT_INT(6)) =>
I_5(IDENT_INT(1)));
BEGIN
FAILED ("CONSTRAINT_ERROR NOT RAISED 4 " &
I_5'IMAGE(PA1(1))); --USE PA1
END;
EXCEPTION
WHEN OTHERS => FAILED ("UNHANDLED EXCEPTION RAISED 4");
END;
EXCEPTION
WHEN CONSTRAINT_ERROR => NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED 4");
END;
DECLARE
W : WEEK_ARRAY (MID_WEEK);
BEGIN
W := (MID_WEEK RANGE MON .. WED => WED);
-- CONSTRAINT_ERROR RAISED.
BEGIN
FAILED ("CONSTRAINT_ERROR NOT RAISED 7 " &
MID_WEEK'IMAGE(W(WED))); --USE W
EXCEPTION
WHEN OTHERS => FAILED ("UNHANDLED EXCEPTION RAISED 7");
END;
EXCEPTION
WHEN CONSTRAINT_ERROR => NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED 7");
END;
DECLARE
W : WEEK_ARRAY (WORK_WEEK);
BEGIN
W := (W'RANGE => WED); -- OK.
W (MON .. WED) := W (MID_WEEK RANGE MON .. WED); -- EXCEPTION.
BEGIN
FAILED ("CONSTRAINT_ERROR NOT RAISED 8 " &
MID_WEEK'IMAGE(W(WED))); --USE W
EXCEPTION
WHEN OTHERS => FAILED ("UNHANDLED EXCEPTION RAISED 8");
END;
EXCEPTION
WHEN CONSTRAINT_ERROR => NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED 8");
END;
BEGIN
DECLARE
W : WEEK_ARRAY (MID_WEEK RANGE MON .. FRI);
-- ELABORATION OF ABOVE RAISES CONSTRAINT_ERROR.
BEGIN
W(WED) := THU; -- OK.
FAILED ("CONSTRAINT_ERROR NOT RAISED 9 " &
WEEK'IMAGE(W(WED))); -- USE W
END;
EXCEPTION
WHEN CONSTRAINT_ERROR => NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED 9");
END;
BEGIN
DECLARE
TYPE W IS NEW WEEK_ARRAY (MID_WEEK RANGE SUN .. WED);
-- RAISES CONSTRAINT_ERROR.
BEGIN
DECLARE
X : W; -- OK.
BEGIN
X(TUE) := THU; -- OK.
FAILED ("CONSTRAINT_ERROR NOT RAISED 10 " &
WEEK'IMAGE(X(TUE))); -- USE X
END;
EXCEPTION
WHEN OTHERS =>
FAILED ("DID NOT RAISE CONSTRAINT_ERROR AT PROPER PLACE");
END;
EXCEPTION
WHEN CONSTRAINT_ERROR => NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED 10");
END;
BEGIN
DECLARE
SUBTYPE W IS WEEK_ARRAY (MID_WEEK RANGE MON .. THU);
-- RAISES CONSTRAINT_ERROR.
BEGIN
DECLARE
T : W; -- OK.
BEGIN
T(TUE) := THU; -- OK.
FAILED ("CONSTRAINT_ERROR NOT RAISED 11 " &
WEEK'IMAGE(T(TUE)));
END;
EXCEPTION
WHEN OTHERS =>
FAILED ("DID NOT RAISE CONSTRAINT_ERROR AT PROPER PLACE");
END;
EXCEPTION
WHEN CONSTRAINT_ERROR => NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED 11");
END;
-- NULL DISCRETE/INDEX RANGES, EXCEPTION NOT RAISED.
BEGIN
DECLARE
TYPE A IS ARRAY (I_5 RANGE I_5(IDENT_INT(-5)) .. -6) OF I_5;
A1 : A;
BEGIN
IF A1'FIRST /= I_5(IDENT_INT(-5)) THEN
FAILED ("'FIRST OF NULL ARRAY INCORRECT");
END IF;
END;
EXCEPTION
WHEN OTHERS => FAILED ("EXCEPTION RAISED 1");
END;
BEGIN
FOR I IN MID_WEEK RANGE SAT .. SUN LOOP
IF EQUAL(2,2) THEN
TUE := STUE;
END IF;
END LOOP;
FOR I IN MID_WEEK RANGE FRI .. WED LOOP
IF EQUAL(2,2) THEN
MON := SMON;
END IF;
END LOOP;
FOR I IN MID_WEEK RANGE MON .. SUN LOOP
IF EQUAL(3,3) THEN
WED := SWED;
END IF;
END LOOP;
FOR I IN I_5 RANGE 10 .. -10 LOOP
IF EQUAL(2,2) THEN
TUE := STUE;
END IF;
END LOOP;
FOR I IN I_5 RANGE 10 .. 9 LOOP
IF EQUAL(2,2) THEN
THU := STHU;
END IF;
END LOOP;
FOR I IN I_5 RANGE -10 .. -11 LOOP
IF EQUAL(2,2) THEN
SAT := SSAT;
END IF;
END LOOP;
FOR I IN I_5 RANGE -10 .. -20 LOOP
IF EQUAL(2,2) THEN
SUN := SSUN;
END IF;
END LOOP;
FOR I IN I_5 RANGE 6 .. 5 LOOP
IF EQUAL(2,2) THEN
MON := SMON;
END IF;
END LOOP;
EXCEPTION
WHEN OTHERS => FAILED ("EXCEPTION RAISED 3");
END;
BEGIN
DECLARE
TYPE P IS ACCESS I_5_ARRAY (I_5(IDENT_INT(-5)) .. -6);
PA1 : P := NEW I_5_ARRAY (I_5(IDENT_INT(-5)) .. -6);
BEGIN
IF PA1'LENGTH /= IDENT_INT(0) THEN
FAILED ("'LENGTH OF NULL ARRAY INCORRECT");
END IF;
END;
EXCEPTION
WHEN OTHERS =>
FAILED ("EXCEPTION RAISED 5");
END;
DECLARE
TYPE NARR IS ARRAY(INTEGER RANGE <>) OF INTEGER;
SUBTYPE SNARR IS INTEGER RANGE 1 .. 2;
W : NARR(SNARR) := (1,2);
BEGIN
IF W = (SNARR RANGE IDENT_INT(4) .. 2 => 5) THEN
FAILED("EVALUATION OF EXPRESSION IS INCORRECT");
END IF;
EXCEPTION
WHEN OTHERS => FAILED ("EXCEPTION RAISED 7");
END;
DECLARE
W : WEEK_ARRAY (MID_WEEK);
BEGIN
W := (W'RANGE => WED); -- OK.
W (TUE .. MON) := W (MID_WEEK RANGE MON .. SUN);
EXCEPTION
WHEN OTHERS => FAILED ("EXCEPTION RAISED 8");
END;
BEGIN
DECLARE
W : WEEK_ARRAY (MID_WEEK RANGE MON .. SUN);
BEGIN
IF EQUAL(W'LENGTH,0) THEN
TUE := STUE;
END IF;
END;
EXCEPTION
WHEN OTHERS => FAILED ("EXCEPTION RAISED 9");
END;
BEGIN
DECLARE
TYPE W IS NEW WEEK_ARRAY (MID_WEEK RANGE TUE .. MON);
BEGIN
IF EQUAL(W'LENGTH,0) THEN
MON := SMON;
END IF;
END;
EXCEPTION
WHEN OTHERS => FAILED ("EXCEPTION RAISED 10");
END;
BEGIN
DECLARE
SUBTYPE W IS WEEK_ARRAY (MID_WEEK RANGE TUE .. MON);
BEGIN
IF EQUAL(W'LENGTH,0) THEN
WED := SWED;
END IF;
END;
EXCEPTION
WHEN OTHERS => FAILED ("EXCEPTION RAISED 12");
END;
-- NULL MEMBERSHIP RANGES, EXCEPTION NOT RAISED.
BEGIN
IF F(SUN) IN SAT .. SUN
OR SAT IN FRI .. WED
OR F(WED) IN THU .. TUE
OR THU IN MON .. SUN
OR F(FRI) IN SAT .. FRI
OR WED IN FRI .. MON
THEN
FAILED ("INCORRECT 'IN' EVALUATION 1");
END IF;
IF IDENT_INT(0) IN 10 .. IDENT_INT(-10)
OR 0 IN IDENT_INT(10) .. 9
OR IDENT_INT(0) IN IDENT_INT(-10) .. -11
OR 0 IN -10 .. IDENT_INT(-20)
OR IDENT_INT(0) IN 6 .. IDENT_INT(5)
OR 0 IN 5 .. IDENT_INT(3)
OR IDENT_INT(0) IN 7 .. IDENT_INT(3)
THEN
FAILED ("INCORRECT 'IN' EVALUATION 2");
END IF;
IF F(WED) NOT IN THU .. TUE
AND IDENT_INT(0) NOT IN IDENT_INT(4) .. -4
THEN NULL;
ELSE FAILED ("INCORRECT 'NOT IN' EVALUATION");
END IF;
EXCEPTION
WHEN OTHERS => FAILED ("EXCEPTION RAISED 52");
END;
RESULT;
END C36104B;
|
Source/Levels/L0205.asm | AbePralle/FGB | 0 | 96116 | <filename>Source/Levels/L0205.asm
;L0205.asm bridge
;<NAME> 3.4.2000
INCLUDE "Source/Defs.inc"
INCLUDE "Source/Levels.inc"
WATER_INDEX EQU 7
DARKWATER_INDEX EQU 22
FLOOR_INDEX EQU 40
STONEHEAD_INDEX EQU 41
STUNNED_INDEX EQU 42
STATE_BROKEN EQU 1
STATE_BROKEN_TALKED EQU 2
STATE_FIXED EQU 3
STATE_TALK_WHAT EQU 4
STATE_TALK_FORGIVE EQU 5
STATE_TALK_OKAY EQU 6
STATE_TALK_GOWEST EQU 7
STATE_TALK_AFTER EQU 8
STATE_WAIT_DIALOG EQU 9
;from L0312
STATE_HIVE_DESTROYED EQU 2
;---------------------------------------------------------------------
SECTION "LevelsSection0205",ROMX,BANK[MAP0ROM]
;---------------------------------------------------------------------
dialog:
L0205_idiot_gtx:
INCBIN "Data/Dialog/Talk/L0205_idiot.gtx"
L0205_what_gtx:
INCBIN "Data/Dialog/Talk/L0205_what.gtx"
L0205_forgive_gtx:
INCBIN "Data/Dialog/Talk/L0205_forgive.gtx"
L0205_okay_gtx:
INCBIN "Data/Dialog/Talk/L0205_okay.gtx"
L0205_west_gtx:
INCBIN "Data/Dialog/Talk/L0205_west.gtx"
L0205_Contents::
DW L0205_Load
DW L0205_Init
DW L0205_Check
DW L0205_Map
;---------------------------------------------------------------------
; landing
;---------------------------------------------------------------------
L0205_Load:
DW ((L0205_LoadFinished - L0205_Load2)) ;size
L0205_Load2:
call ParseMap
ret
L0205_LoadFinished:
L0205_Map:
INCBIN "Data/Levels/L0205_bridge.lvl"
;gtx_intro: INCBIN "Data/Dialog/Landing/intro.gtx"
;gtx_intro2: INCBIN "Data/Dialog/Landing/intro2.gtx"
;gtx_finished: INCBIN "Data/Dialog/Landing/finished.gtx"
;gtx_finished2: INCBIN "Data/Dialog/Landing/finished2.gtx"
;---------------------------------------------------------------------
L0205_Init:
;---------------------------------------------------------------------
DW ((L0205_InitFinished - L0205_Init2)) ;size
L0205_Init2:
ld a,BANK(dialog)
ld [dialogBank],a
call SetPressBDialog
ld a,LEVELSTATEBANK
ldio [$ff70],a
ld a,[levelState+$c3] ;bee house in sunset
cp STATE_HIVE_DESTROYED
jr nz,.notFixed
ld a,STATE_FIXED
ldio [mapState],a
.notFixed
ldio a,[mapState]
ld hl,((.resetStateTable-L0205_Init2)+levelCheckRAM)
call Lookup8
ldio [mapState],a
cp STATE_BROKEN
jr nz,.fixed
call ((.removeBridge-L0205_Init2)+levelCheckRAM)
jr .statesDone
.fixed
ld bc,classWallCreature
call DeleteObjectsOfClass
.statesDone
ret
.removeBridge
ld bc,classWallCreature
ld de,classWallTalker
call ChangeClass
ld bc,classStunnedWall
call DeleteObjectsOfClass
ld a,MAPBANK
ldio [$ff70],a
ld hl,$d34f
call ((.remove10Tiles-L0205_Init2)+levelCheckRAM)
ld hl,$d350
call ((.remove10Tiles-L0205_Init2)+levelCheckRAM)
ret
.remove10Tiles
ld a,[mapPitch]
ld e,a
ld d,0
ld c,10
ld a,WATER_INDEX
.remove10TilesLoop
ld [hl],a
add hl,de
dec c
jr nz,.remove10TilesLoop
ret
.resetStateTable
DB STATE_BROKEN,STATE_BROKEN,STATE_BROKEN
DB STATE_FIXED,STATE_FIXED
L0205_InitFinished:
;---------------------------------------------------------------------
L0205_Check:
;---------------------------------------------------------------------
DW ((L0205_CheckFinished - L0205_Check) - 2) ;size
L0205_Check2:
call SetSkipStackPos
call CheckSkip
call ((.animateWater-L0205_Check2)+levelCheckRAM)
VECTORTOSTATE ((.stateTable - L0205_Check2) + levelCheckRAM)
ret
.stateTable
DW ((.checkDialog-L0205_Check2)+levelCheckRAM)
DW ((.checkDialog-L0205_Check2)+levelCheckRAM)
DW ((.normal-L0205_Check2)+levelCheckRAM)
DW ((.normal-L0205_Check2)+levelCheckRAM)
DW ((.what-L0205_Check2)+levelCheckRAM)
DW ((.forgive-L0205_Check2)+levelCheckRAM)
DW ((.okay-L0205_Check2)+levelCheckRAM)
DW ((.gowest-L0205_Check2)+levelCheckRAM)
DW ((.afterDialog-L0205_Check2)+levelCheckRAM)
DW ((.waitDialog-L0205_Check2)+levelCheckRAM)
.normal
ret
.checkDialog
ld a,[dialogNPC_speakerIndex]
or a
ret z
ld a,%1
call DisableDialogBalloons
call MakeIdle
ld a,[dialogNPC_heroIndex]
ld c,a
call SetSpeakerFromHeroIndex
;Idiot says what?
ld a,[dialogNPC_speakerIndex]
ld c,a
ld de,((.what-L0205_Check2) + levelCheckRAM)
call SetDialogForward
ld de,((.afterDialog-L0205_Check2) + levelCheckRAM)
call SetDialogSkip
DIALOGTOP L0205_idiot_gtx
WAITDIALOG STATE_TALK_WHAT
ret
.what
;what?
call ClearDialog
ld a,[dialogNPC_heroIndex]
ld c,a
DIALOGBOTTOM L0205_what_gtx
WAITDIALOG STATE_TALK_FORGIVE
ret
.forgive
;Forgive me
call ClearDialog
ld a,[dialogNPC_speakerIndex]
ld c,a
DIALOGTOP L0205_forgive_gtx
WAITDIALOG STATE_TALK_OKAY
ret
.okay
;okay
call ClearDialog
ld a,[dialogNPC_heroIndex]
ld c,a
DIALOGBOTTOM L0205_okay_gtx
WAITDIALOG STATE_TALK_GOWEST
ret
.gowest
;go west
call ClearDialog
ld a,[dialogNPC_speakerIndex]
ld c,a
DIALOGTOP L0205_west_gtx
WAITDIALOG STATE_TALK_AFTER
ret
.afterDialog
ld a,STATE_BROKEN_TALKED
ldio [mapState],a
call ClearDialog
call MakeNonIdle
ld de,0
call SetDialogForward
call SetDialogSkip
xor a
ld [dialogNPC_speakerIndex],a
ret
.animateWater
ldio a,[updateTimer]
and %11
ret nz
;animate water by cycling the tile mapping of class 7 from
;7-10 and class 22 from 22-25
ld a,TILEINDEXBANK
ld [$ff70],a
ld hl,bgTileMap+WATER_INDEX
ld a,[hl]
sub WATER_INDEX
inc a
and %11
add WATER_INDEX
ld [hl],a
ld hl,bgTileMap+DARKWATER_INDEX
ld a,[hl]
sub DARKWATER_INDEX
inc a
and %11
add DARKWATER_INDEX
ld [hl],a
ret
.waitDialog
STDWAITDIALOG
ret
L0205_CheckFinished:
PRINT " 0205 Level Check Size: "
PRINT (L0205_CheckFinished - L0205_Check2)
PRINT "/$500 bytes"
|
programs/oeis/080/A080037.asm | neoneye/loda | 22 | 13214 | <filename>programs/oeis/080/A080037.asm
; A080037: a(0)=2; for n > 0, a(n) = n + floor(sqrt(4n-3)) + 2.
; 2,4,6,8,9,11,12,14,15,16,18,19,20,22,23,24,25,27,28,29,30,32,33,34,35,36,38,39,40,41,42,44,45,46,47,48,49,51,52,53,54,55,56,58,59,60,61,62,63,64,66,67,68,69,70,71,72,74,75,76,77,78,79,80,81,83,84,85,86,87,88,89,90,92
mov $2,$0
lpb $0
mov $0,$2
add $1,1
sub $0,$1
div $0,$1
add $2,1
lpe
add $0,$2
add $0,2
|
data/mapHeaders/SeafoamIslands1F.asm | AmateurPanda92/pokemon-rby-dx | 9 | 173478 | SeafoamIslands1F_h:
db CAVERN ; tileset
db SEAFOAM_ISLANDS_1F_HEIGHT, SEAFOAM_ISLANDS_1F_WIDTH ; dimensions (y, x)
dw SeafoamIslands1F_Blocks ; blocks
dw SeafoamIslands1F_TextPointers ; texts
dw SeafoamIslands1F_Script ; scripts
db 0 ; connections
dw SeafoamIslands1F_Object ; objects
|
testsuite/ubivm/expected/method_3.asm | alexgarzao/UOP | 0 | 1757 | Entity start
No options
Constants
0 S start
1 S oi
2 S x
3 S msg
4 S msg=
5 I 2
6 S io.writeln
End
Valid context (always)
No properties
Def start
No parameters
No local variables
No results
ldconst 1 --> [oi]
ldself
mcall 2 --> [x]
stop
End
Def x
Parameters
0 string msg
End
No local variables
No results
ldconst 4 --> [msg=]
ldpar 0 --> [msg]
ldconst 5 --> [2]
lcall 6 --> [io.writeln]
ret
End
End
|
src/commands-init.ads | bracke/websitegenerator | 1 | 1286 | <filename>src/commands-init.ads
with AAA.Strings;
private with GNAT.Strings;
package Commands.Init is
type Instance
is new CLIC.Subcommand.Command
with private;
overriding function Name (Cmd : Instance) return
CLIC.Subcommand.Identifier is ("init");
overriding procedure Execute
(Cmd : in out Instance; Args : AAA.Strings.Vector);
overriding
function Switch_Parsing (This : Instance)
return CLIC.Subcommand.Switch_Parsing_Kind
is (CLIC.Subcommand.All_As_Args);
overriding function Long_Description
(Cmd : Instance) return AAA.Strings.Vector is
(AAA.Strings.Empty_Vector.Append
("Initializes a new website in the current folder.")
.New_Line
);
overriding procedure Setup_Switches
(Cmd : in out Instance;
Config : in out CLIC.Subcommand.Switches_Configuration);
overriding function Short_Description (Cmd : Instance) return String is
("Initializes a new website in the current folder.");
overriding function Usage_Custom_Parameters (Cmd : Instance)
return String is ("[-dry-run] [--blueprint <name>]");
private
type Instance is new CLIC.Subcommand.Command with record
Dry_Run : aliased Boolean := False;
Blueprint : aliased GNAT.Strings.String_Access;
end record;
end Commands.Init; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.