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 |
|---|---|---|---|---|
mc-sema/validator/x86/tests/SUB32i32.asm | randolphwong/mcsema | 2 | 177760 | BITS 32
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=
;TEST_FILE_META_END
; SUB32i32
mov eax, 0x8
;TEST_BEGIN_RECORDING
sub eax, 0x6fffffff
;TEST_END_RECORDING
|
oeis/084/A084214.asm | neoneye/loda-programs | 11 | 8937 | <gh_stars>10-100
; A084214: Inverse binomial transform of a math magic problem.
; Submitted by <NAME>(s2)
; 1,1,4,6,14,26,54,106,214,426,854,1706,3414,6826,13654,27306,54614,109226,218454,436906,873814,1747626,3495254,6990506,13981014,27962026,55924054,111848106,223696214,447392426,894784854,1789569706,3579139414,7158278826,14316557654,28633115306,57266230614,114532461226,229064922454,458129844906,916259689814,1832519379626,3665038759254,7330077518506,14660155037014,29320310074026,58640620148054,117281240296106,234562480592214,469124961184426,938249922368854,1876499844737706,3752999689475414
mov $1,2
pow $1,$0
div $1,3
add $1,1
mov $2,$1
div $1,2
add $2,2
mul $2,2
add $2,$1
mov $0,$2
sub $0,5
|
programs/oeis/139/A139175.asm | neoneye/loda | 22 | 28683 | ; A139175: a(n) = (n! - 5)/5.
; 23,143,1007,8063,72575,725759,7983359,95800319,1245404159,17435658239,261534873599,4184557977599,71137485619199,1280474741145599,24329020081766399,486580401635327999,10218188434341887999,224800145555521535999,5170403347776995327999,124089680346647887871999,3102242008666197196799999,80658292225321127116799999,2177773890083670432153599999,60977668922342772100300799999,1768352398747940390908723199999,53050571962438211727261695999999,1644567730835584563545112575999999,52626167386738706033443602431999999
add $0,5
mov $1,1
lpb $0
mul $1,$0
sub $0,1
lpe
mul $1,8
sub $1,960
div $1,40
add $1,23
mov $0,$1
|
test/Compiler/with-stdlib/HelloWorldPrim.agda | ashinkarov/agda | 0 | 9668 | <reponame>ashinkarov/agda
module HelloWorldPrim where
open import IO.Primitive.Infinite
open import Codata.Musical.Costring
main = putStrLn (toCostring "Hello World!")
|
DSP1C/snesCcompilerDSP1Test/ressource.asm | Phillip-May/snes-homebrew | 11 | 163343 | SnesGraphics1 SECTION
XDEF ~~TestInsert
~~TestInsert:
INSERT ressource/Insert.bin
XDEF ~~SNESFONT_bin
~~SNESFONT_bin:
INSERT ressource/SNESFONT_bin.bin
XDEF ~~END_SNESFONT_bin
~~END_SNESFONT_bin:
SPCROM SECTION
XDEF ~~SPC700Code
~~SPC700Code:
INSERT ressource/ItaloTest.spc
XDEF ~~END_SPC700Code
~~END_SPC700Code: |
alloy4fun_models/trashltl/models/19/KZ9cfFP732Pqbjjhi.als | Kaixi26/org.alloytools.alloy | 0 | 2853 | <filename>alloy4fun_models/trashltl/models/19/KZ9cfFP732Pqbjjhi.als
open main
pred idKZ9cfFP732Pqbjjhi_prop20 {
always all f : Protected | f not in Protected since f in Trash
}
pred __repair { idKZ9cfFP732Pqbjjhi_prop20 }
check __repair { idKZ9cfFP732Pqbjjhi_prop20 <=> prop20o } |
oeis/000/A000387.asm | neoneye/loda-programs | 11 | 81489 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A000387: Rencontres numbers: number of permutations of [n] with exactly two fixed points.
; Submitted by <NAME>
; 0,0,1,0,6,20,135,924,7420,66744,667485,7342280,88107426,1145396460,16035550531,240533257860,3848532125880,65425046139824,1177650830516985,22375365779822544,447507315596451070,9397653627525472260,206748379805560389951,4755212735527888968620,114125105652669335247156,2853127641316733381178600,74181318674235067910643925,2002895604204346833587385624,56081076917721711340446797850,1626351230613929628872957137244,48790536918417888866188714117755,1512506644470954554851850137649940
mov $1,$0
mov $2,1
lpb $0
mul $2,$0
sub $0,1
dif $1,-1
add $1,$2
lpe
mov $0,$1
div $0,2
|
asm/hw_init.asm | mlndz28/selector-623 | 0 | 9128 | ;******************************************************************
;* Hardware configuration
;******************************************************************
#include registers.inc
org UserRTI
dw #RTI_ISR ; set user routine for RTI interruptions
org UserPortH
dw #CALCULAR ; set user routine for port H interruptions
org UserTimerCh3
dw #OC3_ISR
org UserTimerCh4
dw #OC4_ISR ; set user routines for timer
org UserTimerCh5
dw #TCNT_ISR
org UserAtoD0
dw #ATD_ISR
org $1F00
HW_INIT: movb #$F0, DDRA ; configure first nibble for output and the second one for input
bset PUCR,$01 ; port A is set for pull up operation
bset DDRB,$FF ; configure port B for output
bset DDRJ,$02 ; configure PJ1 pin for output
movb $F0,DDRP ; configure port P for output (7 seg display mux)
bset PTP,$0F
bclr PIEH,$09 ; disable interrupts on port H (initially)
bclr PPSH,$09 ; set polarity to use falling edge
movb #$40,RTICTL ; interruption check interval set to about 1ms
bset CRGINT,$80 ; enable rti
bset TSCR1,$90 ; enable the timer module
bset TSCR2,$03 ; set prescaler to 3
bset TIOS,$38 ; set timer channel 4 and 5 as output
bset TIE,$18 ; enable interruptions for channel 4
cli
bset ATD0CTL2,$C2 ; enable ATD interruptions with automatic flag clearing
movb D5mS,Cont_Delay
jsr DELAY
movb D5mS,Cont_Delay
jsr DELAY
movb #$28,ATD0CTL3 ; 5 conversion cycles
movb #$97,ATD0CTL4 ; 8 bit resolution, 2 clock cycles per sample, minimum conversion frequency (500 kHz:PRS=23)
bset DDRE,$04 ; port E as output for relay
jsr LCD_INIT
rts
LCD_INIT:
bset DDRK,$FF ; enable LCD screen ports
clr PORTK
ldx #IniDsp
loc
loop`: ldaa 1,X+
beq continue`
jsr Send_Command
movb D60uS,Cont_Delay
jsr DELAY
bra loop`
continue`: ldaa Clear_LCD
jsr Send_Command
movb D2mS,Cont_Delay
jsr DELAY
rts |
oeis/111/A111868.asm | neoneye/loda-programs | 11 | 174526 | <filename>oeis/111/A111868.asm
; A111868: The work performed by a function f:{1,...,n} -> {1,...,n} is defined to be work(f) = sum(|i-f(i)|, i=1...n); a(n) is equal to sum(work(f)) where the sum is over all functions f:{1,...,n}->{1,...,n}.
; 0,4,72,1280,25000,544320,13176688,352321536,10331213040,330000000000,11412466824440,425000788033536,16961005969166168,722280443661271040,32696077148437500000,1567973246265311887360,79415065141088329360992,4236296602773593878953984,237410358679237630694877480,13946060800000000000000000000,856912762696610769802564915080,54969888255639348740860122497024,3674962367973232518046485792259792,255632690562971123852740615628390400,18474111129762604832649230957031250000
mov $1,$0
mul $1,$0
add $1,$0
add $1,$0
add $0,1
pow $0,$0
mul $0,$1
div $0,3
|
stdlib-exts/Data/Nat/Instance.agda | WhatisRT/meta-cedille | 35 | 15678 | module Data.Nat.Instance where
open import Agda.Builtin.Nat
open import Class.Equality
open import Class.Monoid
open import Class.Show
open import Data.Char
open import Data.List
open import Data.Nat renaming (_≟_ to _≟ℕ_; _+_ to _+ℕ_)
open import Data.String
open import Function
private
postulate
primShowNat : ℕ -> List Char
{-# COMPILE GHC primShowNat = show #-}
showNat : ℕ -> String
showNat = fromList ∘ primShowNat
instance
Eq-ℕ : Eq ℕ
Eq-ℕ = record { _≟_ = _≟ℕ_ }
EqB-ℕ : EqB ℕ
EqB-ℕ = record { _≣_ = Agda.Builtin.Nat._==_ }
ℕ-Monoid : Monoid ℕ
ℕ-Monoid = record { mzero = zero ; _+_ = _+ℕ_ }
Show-ℕ : Show ℕ
Show-ℕ = record { show = showNat }
|
oeis/072/A072042.asm | neoneye/loda-programs | 11 | 5736 | ; A072042: a(n+2) = a(n+1)*a(n)*(1+1/n), a(1)=a(2)=1.
; Submitted by <NAME>(s1)
; 1,1,2,3,8,30,288,10080,3317760,37623398400,138694895861760000,5739990655358858585702400000,868480806755424464755519466250436608000000000
sub $0,1
mov $1,1
mov $2,1
mov $3,1
mov $4,1
lpb $0
sub $0,1
mul $4,$1
mov $1,$3
add $2,1
mul $1,$2
mov $3,$4
lpe
mov $0,$1
|
programs/oeis/137/A137521.asm | neoneye/loda | 22 | 247902 | ; A137521: Prime numbers concatenated with 45.
; 245,345,545,745,1145,1345,1745,1945,2345,2945,3145,3745,4145,4345,4745,5345,5945,6145,6745,7145,7345,7945,8345,8945,9745,10145,10345,10745,10945,11345
seq $0,6005 ; The odd prime numbers together with 1.
max $0,2
sub $0,2
mul $0,100
add $0,245
|
oeis/166/A166743.asm | neoneye/loda-programs | 11 | 87618 | <gh_stars>10-100
; A166743: a(n) = (2^p - p^2 - 1)/6 where p = prime(n).
; Submitted by <NAME>
; 1,13,321,1337,21797,87321,1398013,89478345,357913781,22906492017,366503875645,1466015503393,23456248058853,1501199875789697,96076792050570001,384307168202281705,24595658764946068073,393530540239137100301,1574122160956548403677,100743818301219097891141,1611901092819505566273753,103161669940448356241592365,26409387504754779197847981877,422550200076076467165567733425,1690200800304305868662270938733,27043212804868893898596335046113,108172851219475575594385340190105
add $0,2
seq $0,98105 ; Numbers of the form 2^p - p^2 where p is prime.
sub $0,7
div $0,6
add $0,1
|
tests/natools-static_hash_maps-s_expressions-tests.ads | faelys/natools | 0 | 22936 | ------------------------------------------------------------------------------
-- Copyright (c) 2014, <NAME> --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Natools.Static_Hash_Maps.S_Expressions.Tests provides a very limited --
-- test suite for the static hash map generator. --
-- Since Natools.Static_Hash_Maps is only a code generator, it is not used --
-- directly and does not need much testing. Testing should instead target --
-- the generated code, so that issues with the generator show up in when --
-- compiling or testing the generated code. --
-- Currently the test suite here only runs the generated self-test of the --
-- hash map used to decode S-expressions, so that generate_static_hash_map --
-- tool can be run without silent error. --
------------------------------------------------------------------------------
with Natools.Tests;
package Natools.Static_Hash_Maps.S_Expressions.Tests is
package NT renames Natools.Tests;
procedure All_Tests (Report : in out NT.Reporter'Class);
procedure Test_Hash_Functions (Report : in out NT.Reporter'Class);
end Natools.Static_Hash_Maps.S_Expressions.Tests;
|
programs/oeis/106/A106035.asm | neoneye/loda | 22 | 21850 | <reponame>neoneye/loda<gh_stars>10-100
; A106035: The "Octanacci" sequence: Trajectory of 1 under the morphism 1->{1,2,1}, 2->{1}.
; 1,2,1,1,1,2,1,1,2,1,1,2,1,1,1,2,1,1,2,1,1,1,2,1,1,2,1,1,1,2,1,1,2,1,1,2,1,1,1,2,1,1,2,1,1,1,2,1,1,2,1,1,2,1,1,1,2,1,1,2,1,1,1,2,1,1,2,1,1,2,1,1,1,2,1,1,2,1,1,1,2,1,1,2,1,1,1,2,1,1,2,1,1,2,1,1,1,2,1,1
mov $3,2
mov $5,$0
lpb $3
mov $0,$5
sub $3,1
add $0,$3
sub $0,1
add $6,1
lpb $6
add $0,1
max $0,0
seq $0,49473 ; Nearest integer to n/sqrt(2).
sub $6,1
lpe
mov $2,$3
mul $2,$0
add $1,$2
mov $4,$0
lpe
min $5,1
mul $5,$4
sub $1,$5
add $1,3
mod $1,2
add $1,1
mov $0,$1
|
Test/Cases/8.Cpp.g4 | studentmain/SempredTranslation | 0 | 6399 | lexer grammar g;
@lexer::postinclude {
#include <sc.h>
}
options {
superClass=sc;
}
L: 'L';
p: L; |
base/agda/Base/Free/Properties.agda | FreeProving/free-compiler | 36 | 11968 | <filename>base/agda/Base/Free/Properties.agda
module Base.Free.Properties where
open import Relation.Binary.PropositionalEquality using (_≢_)
open import Base.Free using (Free; pure; impure)
discriminate : ∀ {S P A} {s : S} {pf : P s → Free S P A} {a : A} → impure s pf ≢ pure a
discriminate = λ ()
|
programs/oeis/191/A191008.asm | neoneye/loda | 22 | 1639 | <filename>programs/oeis/191/A191008.asm
; A191008: a(n) = (n*3^(n+1)+((5*3^(n+1)+(-1)^(n))/4))/4.
; 1,5,22,86,319,1139,3964,13532,45517,151313,498226,1627538,5281195,17039327,54705208,174877304,556916953,1767605981,5593383310,17651846030,55570626391,174557144075,547207226932,1712229064916,5348509347109,16680994498409,51949382866474,161567346713162,501859634480707,1557051686465783,4825573408468336,14939975272617968,46209690959492785,142798368303394997,440902991184934918,1360232632379054534,4193268873609912943,12917519550247986851,39765697438998704620,122336508681760346060,376127775139573734781,1155738072701599294145,3549278459953432151842,10894028105406199263746,33420662492856306215899,102477722008482043921679,314080369615185507586984,962182719614774650226792,2946372991151978333077897,9018593470378898146426253,27594203901905583880856446,84397882178023419967302398,258039457950990264876106375,788655808103730809550916667,2409579727063472473420542628,7359576089447257554565005764,22471238993112293066605150933,68591249153648440408545853721,209306343983880004851828763930,638516821520444065434059900090,1947343833267744348937900525171,5937411605922469504720864050215,18098375136125117887884079574752,55153546363448481784816700996576,168035901955564829717943489806689,511833494462352642244310629870949,1558677849174032386004372370965494,4745565644883020535827438556954422,14445293226731831740925280003037087,43961668556443805623104733005632723,133762372298076348070300878006462556,406919216780463837813862670988080828
mov $2,$0
add $0,1
mov $1,$2
add $1,$0
lpb $0
sub $0,1
mul $1,3
add $1,3
mov $4,2
lpe
mul $4,2
div $1,$4
mov $3,$1
mov $1,2
add $3,2
add $1,$3
sub $1,5
div $1,2
add $1,1
mov $0,$1
|
test/Fail/Erasure-Illegal-Access.agda | shlevy/agda | 1,989 | 15705 | <gh_stars>1000+
-- Andreas, 2018-10-16, runtime erasure
id : (@0 A : Set) (@0 x : A) → A
id A x = x
-- Expected error:
--
-- Variable x is declared erased, so it cannot be used here
-- when checking that the expression x has type A
|
programs/oeis/217/A217575.asm | jmorken/loda | 1 | 24441 | ; A217575: Numbers n such that floor(sqrt(n)) = floor(n/floor(sqrt(n)))-1.
; 2,6,7,12,13,14,20,21,22,23,30,31,32,33,34,42,43,44,45,46,47,56,57,58,59,60,61,62,72,73,74,75,76,77,78,79,90,91,92,93,94,95,96,97,98,110,111,112,113,114,115,116,117,118,119,132,133,134,135,136,137,138,139,140,141,142,156,157,158,159,160,161,162,163,164,165,166,167,182,183,184,185,186,187,188,189,190,191,192,193,194,210,211,212,213,214,215,216,217,218,219,220,221,222,223,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524
mov $1,1
mov $2,$0
lpb $2
add $1,1
trn $2,$1
add $3,$1
lpe
add $1,1
add $1,$3
add $1,$0
|
alloy4fun_models/trashltl/models/4/Wcb4MKT6YJCsWyNod.als | Kaixi26/org.alloytools.alloy | 0 | 3443 | <gh_stars>0
open main
pred idWcb4MKT6YJCsWyNod_prop5 {
some t: Trash | eventually (t not in File)
}
pred __repair { idWcb4MKT6YJCsWyNod_prop5 }
check __repair { idWcb4MKT6YJCsWyNod_prop5 <=> prop5o } |
alloy4fun_models/trashltl/models/5/rqi6Lbbd8j9iiXgwq.als | Kaixi26/org.alloytools.alloy | 0 | 2660 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idrqi6Lbbd8j9iiXgwq_prop6 {
once some f : Trash | always f in Trash
}
pred __repair { idrqi6Lbbd8j9iiXgwq_prop6 }
check __repair { idrqi6Lbbd8j9iiXgwq_prop6 <=> prop6o } |
electrum/src/main/resources/models/examples/toys/numbering.als | haslab/Electrum | 29 | 4502 | <gh_stars>10-100
module examples/toys/numbering
/*
* Alloy model of paragraph numbering
*
* This model addresses some issues that arose in the design of a text tagging tool. The
* tool receives as input a text stream in which paragraphs are tagged with style names,
* along with a style sheet that indicates how paragraphs of a given style are to be numbered.
* In practice, the style sheet includes such details as what symbols to use for numbering (eg,
* roman numericals, letters of the alphabet, etc), but these details are uninteresting.
*
* In the simplest case, the styles are organized into chains. For example, there may be a
* single chain, chapter-section-subsection, so that chapters are numbered 1, 2, 3, etc,
* sections are numbered 1.1, 1.2, 1.3, etc, and subsections are numbered 1.1.1, 1.1.2,
* etc, each paragraph being numbered according to a number associated with its own
* style, and a number for each ancestor.
*
* Some styles, however, should be numbered independently of one another, but still
* according to the same ancestors. For example, we might also have a figure style
* that is numbered, like section, according to its chapter, with figures and sections in
* some arbitrary interleaving, the numbering of one not affecting the other.
*
* So in our style hierarchy, a style can have more than one "child". A more tricky complication
* allows multiple parents. We might want to have an appendix style, for example, with a
* different numbering from the chapter style, but would want section and subsection to work
* within appendix exactly as they would work within chapter. So the first section in an
* appendix numbered A might be numbered A.1, but if placed in a chapter numbered 1,
* it would be numbered 1.1 instead.
*
* To account for this, styles are organized into replacement classes. Chapter and appendix,
* for example, are replacements of one another. When a chapter style is encountered, it
* is as if the style hierarchy contains only chapter, with children section, figure and so on;
* when appendix is encountered subsequently, chapter is replaced, and figure and section
* become children of appendix. We'll call the set of styles active in the tree at a given time
* the "context".
*
* The first part focuses on the replacement mechanism. It characterizes a well-formed
* style sheet (with the fact StyleSheet), and a well-formed state (with the fact Forest). An
* operation addStyleToContext describes how the context is altered, and includes a
* precondition requiring that, for example, a child is not encountered before its parents
* (a document can't start with subsection, eg). The assertion PreservesForest checks that the
* operation preserves the well-formedness of the state; it was analyzing this that helped
* determine an appropriate precondition and the appropriate constraints in the invariant.
*
* The second part adds the numbering of styles. Note the idiom of declaring a subsignature
* and then equating it to the supersignature, thus essentially retrofitting the new fields to the
* old signature. A second operation describes how numbers are assigned; the conjunction of the
* two operations is what happens when a style is encountered. The assertion AddNeverReduces
* checks that when a style is encountered the number associated with each style in the context is
* not decreased. The first assertion is valid; the second isn't.
*
* author: <NAME>, 11/15/01
*/
open util/relation as rel
sig Style {
replaces, parents: set Style
}
fact StyleSheet {
equivalence [replaces, Style]
acyclic [parents, Style]
all x: Style {
x.replaces.parents.replaces = x.parents
all y,z: x.parents | y in z.replaces
}
}
sig State {
context: set Style,
ancestors: Style -> Style
}
fact DefineAncestors {
all s: State, x: Style | s.ancestors [x] = x.*parents & s.context
}
pred Forest [s: State] {
all x: s.context |
some root: s.ancestors[x] {
no root.parents
all y: s.ancestors[x] - root | one y.parents & s.context
}
all x: Style | lone x.replaces & s.context
}
pred AddStyleToContext [s, s1: State, style: Style] {
all x: style.^parents | some x.replaces & s.context
s1.context = s.context - style.replaces + style
}
assert PreserveForest {
all s,s1: State, z: Style |
Forest[s] && AddStyleToContext [s,s1,z] => Forest[s1]
}
check PreserveForest for 4 expect 0
sig Value {next: Value}
sig NumberedStyle extends Style {
initial: Value
}
sig NumberedState extends State {
value: Style -> one Value
}
fact {Style = NumberedStyle}
fact {State = NumberedState}
pred AddStyleToNumbering [s, s1: State, style: Style] {
s1.value[style] = (style in s.context => s.value[style].next else style.initial)
s1.context = s.context - style.replaces + style
all x: Style - style |
s1.value[x] = (style in x.^parents => x.initial else s.value[x])
}
pred AddStyle [s, s1: State, style: Style] {
AddStyleToContext [s,s1,style]
AddStyleToNumbering [s,s1,style]
}
assert AddNeverReduces {
all s,s1: State, z: Style |
Forest[s] && AddStyle [s,s1,z] =>
(all y: s1.context | s1.value[y] in s.value[y].*next)
}
check AddNeverReduces for 5 expect 1
|
Graphs/Graph.agda | copumpkin/categories | 98 | 1573 | <gh_stars>10-100
{-# OPTIONS --universe-polymorphism #-}
module Graphs.Graph where
open import Level
open import Categories.Support.Equivalence
open import Relation.Binary
using (Rel; IsEquivalence; module IsEquivalence; Reflexive; Symmetric; Transitive)
renaming (_⇒_ to _⊆_)
open import Relation.Binary.PropositionalEquality
using ()
renaming (_≡_ to _≣_)
record Graph (o ℓ e : Level) : Set (suc (o ⊔ ℓ ⊔ e)) where
field
Obj : Set o
_↝_ : Obj → Obj → Set ℓ
_≈_ : {A B : Obj} → Rel (A ↝ B) e
.equiv : ∀ {A B : Obj} → IsEquivalence (_≈_ {A}{B})
edge-setoid : ∀ {A B : Obj} → Setoid ℓ e
edge-setoid {A}{B} = record
{ Carrier = A ↝ B
; _≈_ = _≈_
; isEquivalence = equiv
}
module Equiv {A B : Obj} where
private
module e = IsEquivalence
.q : IsEquivalence _≈_
q = equiv {A} {B}
.refl : Reflexive _≈_
refl = e.refl q
.trans : Transitive _≈_
trans = e.trans q
.sym : Symmetric _≈_
sym = e.sym q
.reflexive : _≣_ ⊆ _≈_
reflexive = e.reflexive q
_[_↝_] : ∀ {o ℓ e} → (G : Graph o ℓ e) → Graph.Obj G → Graph.Obj G → Set ℓ
G [ A ↝ B ] = Graph._↝_ G A B
_[_≈_] : ∀ {o ℓ e} → (G : Graph o ℓ e) → {A B : Graph.Obj G} → Rel (G [ A ↝ B ]) e
G [ f ≈ g ] = Graph._≈_ G f g
module Heterogeneous {o ℓ e} (G : Graph o ℓ e) where
open Graph G
open Equiv renaming (refl to refl′; sym to sym′; trans to trans′)
data _~_ {A B} (f : A ↝ B) : ∀ {X Y} → (X ↝ Y) → Set (ℓ ⊔ e) where
≈⇒~ : {g : A ↝ B} → .(f ≈ g) → f ~ g
refl : ∀ {A B} {f : A ↝ B} → f ~ f
refl = ≈⇒~ refl′
sym : ∀ {A B} {f : A ↝ B} {D E} {g : D ↝ E} → f ~ g → g ~ f
sym (≈⇒~ f≈g) = ≈⇒~ (sym′ f≈g)
trans : ∀ {A B} {f : A ↝ B}
{D E} {g : D ↝ E}
{F G} {h : F ↝ G}
→ f ~ g → g ~ h → f ~ h
trans (≈⇒~ f≈g) (≈⇒~ g≈h) = ≈⇒~ (trans′ f≈g g≈h)
_[_~_] : ∀ {o ℓ e} (G : Graph o ℓ e) {A B} (f : G [ A ↝ B ]) {X Y} (g : G [ X ↝ Y ]) → Set (ℓ ⊔ e)
G [ f ~ g ] = Heterogeneous._~_ G f g |
Transynther/x86/_processed/US/_zr_/i7-8650U_0xd2.log_14529_1508.asm | ljhsiun2/medusa | 9 | 102498 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x1c863, %rax
nop
nop
nop
nop
xor $58088, %r9
movups (%rax), %xmm6
vpextrq $1, %xmm6, %r8
add $40392, %r10
lea addresses_UC_ht+0x3863, %rdi
nop
nop
inc %r8
movl $0x61626364, (%rdi)
nop
cmp $3354, %r10
lea addresses_WT_ht+0x1e579, %rsi
lea addresses_A_ht+0x19e61, %rdi
nop
nop
nop
nop
nop
xor %rdx, %rdx
mov $96, %rcx
rep movsl
add $47021, %rax
lea addresses_WC_ht+0x1b263, %r10
nop
nop
add %rdx, %rdx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm6
vmovups %ymm6, (%r10)
xor %rdi, %rdi
lea addresses_normal_ht+0xdf23, %rsi
lea addresses_D_ht+0x11d8b, %rdi
nop
nop
nop
sub $35454, %rax
mov $22, %rcx
rep movsw
and $62683, %r9
lea addresses_WT_ht+0x4963, %r8
clflush (%r8)
and %rcx, %rcx
mov (%r8), %eax
nop
nop
nop
and $30518, %rdx
lea addresses_normal_ht+0x151c3, %rsi
lea addresses_UC_ht+0x1e13b, %rdi
nop
xor $27697, %rax
mov $83, %rcx
rep movsw
nop
nop
nop
sub $28118, %r9
lea addresses_WC_ht+0x19a63, %r9
nop
and %rsi, %rsi
movl $0x61626364, (%r9)
nop
nop
nop
add %r10, %r10
lea addresses_A_ht+0x7823, %rsi
lea addresses_WC_ht+0x17e63, %rdi
clflush (%rsi)
nop
nop
xor %r9, %r9
mov $35, %rcx
rep movsq
nop
nop
nop
nop
nop
and $33617, %rdi
lea addresses_A_ht+0x18b63, %rdx
nop
nop
nop
nop
nop
xor %rcx, %rcx
mov (%rdx), %r10w
nop
nop
nop
nop
sub %r8, %r8
lea addresses_UC_ht+0x1ef33, %rsi
lea addresses_WT_ht+0x161fb, %rdi
nop
nop
nop
nop
cmp $45176, %r8
mov $85, %rcx
rep movsw
nop
nop
nop
nop
nop
add %rsi, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r9
push %rcx
// Store
lea addresses_normal+0x119bb, %rcx
nop
nop
nop
nop
nop
and $20231, %r13
movl $0x51525354, (%rcx)
nop
nop
nop
nop
nop
sub %r13, %r13
// Faulty Load
lea addresses_US+0x1ca63, %r12
nop
nop
dec %r13
mov (%r12), %ecx
lea oracles, %r12
and $0xff, %rcx
shlq $12, %rcx
mov (%r12,%rcx,1), %rcx
pop %rcx
pop %r9
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'00': 14529}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
MK1_CPU/programs/display_counter.asm | billionelectrons/8bit-cpu | 274 | 94880 | <reponame>billionelectrons/8bit-cpu
#include "lib/mk1.cpu"
jal init_display
ldi $a 0
loop:
push $a
out
jal print_int
ldi $a SPACE
jal print_char
pop $a
addi 1 $a
jc end
j loop
end:
hlt
#include "lib/helix.asm"
|
Move Events to Calendar.applescript | dgaxiola/applescript | 0 | 1459 | <filename>Move Events to Calendar.applescript<gh_stars>0
# Move Events to Calendar
# <NAME>
#
# Simple script to move events from multiple calendars into a target calendar.
# Change targetCalendar and sourcePrefix in the on run handler to
# what fits your situation.
#
# When running this, I would occassionally get duplicate entries in
# the set of returned events. These may apear as the same first or
# last event or they may be adjecent in order they are returned.
# I don't believe there's any issue with my logic but it seems odd
# that Calendar would behave this way.
#
# toString
# Originally from stackoverflow.com user mklement0.
#
# Converts the specified object - which may be of any type - into a string representation for logging/debugging.
# Tries hard to find a readable representation - sadly, simple conversion with `as text` mostly doesn't work with non-primitive types.
# An attempt is made to list the properties of non-primitive types (does not always work), and the result is prefixed with the type (class) name
# and, if present, the object's name and ID.
# EXAMPLE
# toString(path to desktop) # -> "[alias] Macintosh HD:Users:mklement:Desktop:"
# To test this subroutine and see the various representations, use the following:
# repeat with elem in {42, 3.14, "two", true, (current date), {"one", "two", "three"}, {one:1, two:"deux", three:false}, missing value, me, path to desktop, front window of application (path to frontmost application as text)}
# log my toString(contents of elem)
# end repeat
on toString(anyObj)
local i, txt, errMsg, orgTids, oName, oId, prefix
set txt to ""
repeat with i from 1 to 2
try
if i is 1 then
if class of anyObj is list then
set {orgTids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {", "}}
set txt to ("{" & anyObj as string) & "}"
set AppleScript's text item delimiters to orgTids # '
else
set txt to anyObj as string
end if
else
set txt to properties of anyObj as string
end if
on error errMsg
# Trick for records and record-*like* objects:
# We exploit the fact that the error message contains the desired string representation of the record, so we extract it from there. This (still) works as of AS 2.3 (OS X 10.9).
try
set txt to do shell script "egrep -o '\\{.*\\}' <<< " & quoted form of errMsg
end try
end try
if txt is not "" then exit repeat
end repeat
set prefix to ""
if class of anyObj is not in {text, integer, real, boolean, date, list, record} and anyObj is not missing value then
set prefix to "[" & class of anyObj
set oName to ""
set oId to ""
try
set oName to name of anyObj
if oName is not missing value then set prefix to prefix & " name=\"" & oName & "\""
end try
try
set oId to id of anyObj
if oId is not missing value then set prefix to prefix & " id=" & oId
end try
set prefix to prefix & "] "
end if
return prefix & txt
end toString
# extractEventProperties
#
# Creates a new record containing the properties of the
# passed in Calendar Event. If a property has missing value,
# it will not be included in the returned record.
on extractEventProperties(sourceEvent)
tell application "Calendar"
# AppleScript doesn't handle marshaling of missing values into text.
# This is a problem if we create a new event with "missing value"
# for some of the properties. As a workaround, we need to manually check
# fields and just include those with an actual value. This seemed
# to be the most elegant way after some investigation but the code
# still looks clunky.
set targetProps to {}
if exists description of sourceEvent then
set targetProps to targetProps & {description:(description of sourceEvent)}
end if
if exists summary of sourceEvent then
set targetProps to targetProps & {summary:(summary of sourceEvent)}
end if
if exists location of sourceEvent then
set targetProps to targetProps & {location:(location of sourceEvent)}
end if
if exists url of sourceEvent then
set targetProps to targetProps & {url:(url of sourceEvent)}
end if
if exists (start date of sourceEvent) then
set targetProps to targetProps & {start date:(start date of sourceEvent)}
end if
if exists (end date of sourceEvent) then
set targetProps to targetProps & {end date:(end date of sourceEvent)}
end if
if exists (allday event of sourceEvent) then
set targetProps to targetProps & {allday event:(allday event of sourceEvent)}
end if
if exists recurrence of sourceEvent then
set targetProps to targetProps & {recurrence:(recurrence of sourceEvent)}
end if
if exists (excluded dates of sourceEvent) then
set targetProps to targetProps & {excluded dates:(excluded dates of sourceEvent)}
end if
if exists status of sourceEvent then
set targetProps to targetProps & {status:(status of sourceEvent)}
end if
end tell
return targetProps
end extractEventProperties
# eventPropertiesToString
#
# Generates a string representation of the provided
# Calendar Event for debugging purposes.
on eventPropertiesToString(sourceEvent)
set eventAsStr to "{ "
# The toString handler above will output a string representation
# of the event but we'll only get class object names for the
# record keys. For debugging, it's better to manually build the
# string version of the Calendar Event.
tell application "Calendar"
if exists summary of sourceEvent then
set eventAsStr to eventAsStr & "summary:\"" & my toString(summary of sourceEvent) & "\""
end if
if exists description of sourceEvent then
set eventAsStr to eventAsStr & " , description:\"" & my toString(description of sourceEvent) & "\""
end if
if exists location of sourceEvent then
set eventAsStr to eventAsStr & ", location:\"" & my toString(location of sourceEvent) & "\""
end if
if exists url of sourceEvent then
set eventAsStr to eventAsStr & ", url:\"" & my toString(url of sourceEvent) & "\""
end if
if exists (start date of sourceEvent) then
set eventAsStr to eventAsStr & ", start date:" & my toString(start date of sourceEvent)
end if
if exists (end date of sourceEvent) then
set eventAsStr to eventAsStr & ", end date:" & my toString(end date of sourceEvent)
end if
if exists (allday event of sourceEvent) then
set eventAsStr to eventAsStr & ", allday event:" & my toString(allday event of sourceEvent)
end if
if exists recurrence of sourceEvent then
set eventAsStr to eventAsStr & ", recurrence:\"" & my toString(recurrence of sourceEvent) & "\""
end if
if exists (excluded dates of sourceEvent) then
set eventAsStr to eventAsStr & ", excluded dates:" & my toString(excluded dates of sourceEvent)
end if
if exists status of sourceEvent then
set eventAsStr to eventAsStr & ", status:" & my toString(status of sourceEvent)
end if
end tell
set eventAsStr to eventAsStr & " }"
return eventAsStr
end eventPropertiesToString
# Main Entry Point
on run
tell application "Calendar"
activate
set processedCount to 0
set errorCount to 0
set targetCalendar to "SDCC"
set sourcePrefix to "CC - "
set sourceCalendars to every calendar whose name starts with sourcePrefix
# Getting an event by index is the most reliable way
# but we can't delete the events in progress until everything is moved over.
# So, we loop through once to duplicate the events and then
# do a pass of all the events we duplicated to remove them.
repeat with myCalendar in sourceCalendars
set eventCount to (count of events in myCalendar)
set eventDeletionList to {}
log ("Working on " & eventCount & " events in calendar " & (name of myCalendar))
set eventCount to eventCount - 1
repeat with myIndex from 0 to eventCount
set myEvent to event myIndex of myCalendar
set myProps to properties of myEvent
try
set myEventDesc to (my toString(summary of myProps) & " in calendar " & (name of myCalendar))
# Duplicating an event doesn't seem to work reliably so
# we need to extract the details and create a new event.
set extractedProps to my extractEventProperties(myEvent)
make new event at the end of events of calendar targetCalendar with properties extractedProps
set eventDeletionList to eventDeletionList & {myEvent}
log (" Duplicated event #" & myIndex & ": " & myEventDesc & " to " & targetCalendar)
on error errMsg number errNumber
set errorCount to (errorCount + 1)
log (" Problem with duplicating event #" & myIndex & ": " & myEventDesc & ": " & errNumber & " - " & errMsg)
end try
end repeat
log ("Deleting " & (count of eventDeletionList) & " events in calendar " & (name of myCalendar))
set deletedEventIndex to 0
repeat with myEventToDelete in eventDeletionList
set deletedEventName to "not defined"
try
set deletedEventName to my toString(summary of myEventToDelete)
delete myEventToDelete
set processedCount to (processedCount + 1)
log (" Deleted event #" & deletedEventIndex & ": " & deletedEventName)
on error errMsg number errNumber
set errorCount to (errorCount + 1)
log (" Problem deleting event #" & deletedEventIndex & ": " & deletedEventName & ": " & errNumber & " - " & errMsg)
end try
end repeat
end repeat
log ("----")
log ("Moved " & processedCount & " events")
log ("Errors encounted with " & errorCount & " events")
end tell
end run |
programs/oeis/077/A077450.asm | karttu/loda | 0 | 169309 | <reponame>karttu/loda
; A077450: Continued fraction expansion of (29+sqrt(145))/12.
; 3,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1
sub $0,1
mod $0,5
mov $1,1
mov $2,$0
lpb $2,1
mov $2,$0
sub $2,1
lpe
trn $1,$2
add $1,1
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_876.asm | ljhsiun2/medusa | 9 | 245844 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x6f88, %r9
nop
nop
nop
nop
nop
and %r8, %r8
movups (%r9), %xmm5
vpextrq $0, %xmm5, %r14
and $28748, %r15
lea addresses_normal_ht+0x9b21, %rsi
lea addresses_WT_ht+0x37f1, %rdi
nop
nop
nop
sub %r8, %r8
mov $101, %rcx
rep movsq
nop
cmp %r14, %r14
lea addresses_A_ht+0xa721, %rsi
lea addresses_WT_ht+0x5231, %rdi
nop
nop
inc %r10
mov $42, %rcx
rep movsl
nop
sub %r14, %r14
lea addresses_D_ht+0x8a01, %r8
nop
nop
nop
nop
nop
sub %rdi, %rdi
mov (%r8), %rsi
nop
inc %rsi
lea addresses_UC_ht+0x15309, %rsi
lea addresses_WT_ht+0xff21, %rdi
xor $15494, %r9
mov $25, %rcx
rep movsb
add %rcx, %rcx
lea addresses_UC_ht+0x12921, %rsi
nop
nop
nop
nop
and %r10, %r10
movw $0x6162, (%rsi)
nop
nop
nop
nop
nop
add $9312, %r8
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r8
push %rax
push %rdi
push %rsi
// Faulty Load
lea addresses_UC+0x13521, %r14
clflush (%r14)
nop
add $64039, %r10
movups (%r14), %xmm6
vpextrq $1, %xmm6, %rsi
lea oracles, %r10
and $0xff, %rsi
shlq $12, %rsi
mov (%r10,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rax
pop %r8
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 5, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 2, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/161/A161702.asm | neoneye/loda-programs | 11 | 173510 | ; A161702: a(n) = (-n^3 + 9n^2 - 5n + 3)/3.
; 1,2,7,14,21,26,27,22,9,-14,-49,-98,-163,-246,-349,-474,-623,-798,-1001,-1234,-1499,-1798,-2133,-2506,-2919,-3374,-3873,-4418,-5011,-5654,-6349,-7098,-7903,-8766,-9689,-10674,-11723,-12838,-14021,-15274,-16599,-17998,-19473,-21026,-22659,-24374,-26173,-28058,-30031,-32094,-34249,-36498,-38843,-41286,-43829,-46474,-49223,-52078,-55041,-58114,-61299,-64598,-68013,-71546,-75199,-78974,-82873,-86898,-91051,-95334,-99749,-104298,-108983,-113806,-118769,-123874,-129123,-134518,-140061,-145754,-151599
mov $1,6
mov $2,$0
lpb $2
add $1,$0
add $0,3
sub $2,1
sub $0,$2
lpe
sub $1,5
mov $0,$1
|
programs/oeis/071/A071619.asm | karttu/loda | 1 | 94593 | <filename>programs/oeis/071/A071619.asm<gh_stars>1-10
; A071619: a(n) = ceiling( 2*n^2/3 ).
; 0,1,3,6,11,17,24,33,43,54,67,81,96,113,131,150,171,193,216,241,267,294,323,353,384,417,451,486,523,561,600,641,683,726,771,817,864,913,963,1014,1067,1121,1176,1233,1291,1350,1411,1473,1536,1601,1667,1734,1803,1873,1944,2017,2091,2166,2243,2321,2400,2481,2563,2646,2731,2817,2904,2993,3083,3174,3267,3361,3456,3553,3651,3750,3851,3953,4056,4161,4267,4374,4483,4593,4704,4817,4931,5046,5163,5281,5400,5521,5643,5766,5891,6017,6144,6273,6403,6534,6667,6801,6936,7073,7211,7350,7491,7633,7776,7921,8067,8214,8363,8513,8664,8817,8971,9126,9283,9441,9600,9761,9923,10086,10251,10417,10584,10753,10923,11094,11267,11441,11616,11793,11971,12150,12331,12513,12696,12881,13067,13254,13443,13633,13824,14017,14211,14406,14603,14801,15000,15201,15403,15606,15811,16017,16224,16433,16643,16854,17067,17281,17496,17713,17931,18150,18371,18593,18816,19041,19267,19494,19723,19953,20184,20417,20651,20886,21123,21361,21600,21841,22083,22326,22571,22817,23064,23313,23563,23814,24067,24321,24576,24833,25091,25350,25611,25873,26136,26401,26667,26934,27203,27473,27744,28017,28291,28566,28843,29121,29400,29681,29963,30246,30531,30817,31104,31393,31683,31974,32267,32561,32856,33153,33451,33750,34051,34353,34656,34961,35267,35574,35883,36193,36504,36817,37131,37446,37763,38081,38400,38721,39043,39366,39691,40017,40344,40673,41003,41334
pow $0,2
mov $1,$0
div $0,3
sub $1,$0
|
nasm assembly/library/read_num.asm | AI-Factor-y/NASM-library | 0 | 17526 | <filename>nasm assembly/library/read_num.asm
read_num:
;usage
;------
; 1: create a variable num(word)
; 2: the input number is stored into num(word)
section .bss
temp_for_read: resb 1
section .text
push rax ; push all
push rbx
push rcx
mov word[num], 0
loop_read:
;; read a digit
mov eax, 3
mov ebx, 0
mov ecx, temp_for_read
mov edx, 1
int 80h
;;check if the read digit is the end of number, i.e, the enter-key whose ASCII cmp byte[temp], 10
cmp byte[temp_for_read], 10
je end_read
mov ax, word[num]
mov bx, 10
mul bx
mov bl, byte[temp_for_read]
sub bl, 30h
mov bh, 0
add ax, bx
mov word[num], ax
jmp loop_read
end_read:
;;pop all the used registers from the stack using popa
;call pop_reg
pop rcx
pop rbx
pop rax
ret
|
test/Succeed/Issue2856.agda | shlevy/agda | 1,989 | 4887 | <filename>test/Succeed/Issue2856.agda<gh_stars>1000+
{-# OPTIONS --allow-unsolved-metas #-}
open import Agda.Builtin.Nat
open import Agda.Builtin.Equality
data _≅_ {A : Set} (x : A) : {B : Set} → B → Set where
refl : x ≅ x
test₁ : (A : Set) (x y : A) (z : Nat) → x ≡ y → x ≅ (suc z) → y ≅ 1 → Nat
test₁ A (suc z) (suc zero) .z refl refl refl = {!!}
test₂ : (A : Set) (x y : A) (z : Nat) → x ≡ y → x ≅ 1 → y ≅ (suc z) → Nat
test₂ A (suc zero) (suc z) .z refl refl refl = {!!}
|
src/lispy.adb | Lucretia/lispy | 2 | 11403 | <reponame>Lucretia/lispy
with Ada.Text_IO;
with Ada.Unchecked_Conversion;
-- with Ada.Characters.Latin_1;
with Interfaces.C.Strings;
with Edit_Line;
with AMPC;
procedure Lispy is
package IO renames Ada.Text_IO;
-- package L1 renames Ada.Characters.Latin_1;
package C renames Interfaces.C;
use type AMPC.Errors_Ptr;
use type C.Strings.chars_ptr;
Version_Number : constant String := "0.0.1";
Number : AMPC.Parsers_Ptr := AMPC.New_Parser ("number");
Operator : AMPC.Parsers_Ptr := AMPC.New_Parser ("operator");
Expression : AMPC.Parsers_Ptr := AMPC.New_Parser ("expr");
Lispy : AMPC.Parsers_Ptr := AMPC.New_Parser ("lispy");
Error : AMPC.Errors_Ptr := AMPC.Language (
AMPC.Default,
"number : /-?[0-9]+/ ;" &
"operator : '+' | '-' | '*' | '/' ;" &
"expr : <number> | '(' <operator> <expr>+ ')' ;" &
"lispy : /^/ <operator> <expr>+ /$/ ;",
Number, Operator, Expression, Lispy);
-- Pressing Ctrl+C will quit the application there and then, so no cleanup occurs, we have to catch the signal,
-- from there, do the cleanup and then raise and exception which will then gracefully exit.
-- TODO: There's got to be a better way to do this.
type Signal_Handler is access procedure (Dummy : C.int) with
Convention => C;
type Signals is (Sig_Hup, Sig_Int);
for Signals use (Sig_Hup => 1, Sig_Int => 2);
procedure Signal (Signal : in Signals; Callback : in Signal_Handler) with
Import => True,
Convention => C,
External_Name => "signal";
Finished : exception;
procedure Handler (Dummy : in C.int) with
Convention => C;
procedure Handler (Dummy : in C.int) is
begin
raise Finished;
end Handler;
function To_AST is new Ada.Unchecked_Conversion (Source => AMPC.Values_Ptr, Target => AMPC.AST_Ptr);
function Check_Error (Error : in AMPC.Errors_Ptr) return Boolean is
begin
if Error /= null then
IO.Put_Line ("Failed to create parser.");
IO.Put_Line (" >> Filename: " & C.Strings.Value (Error.Filename));
IO.Put_Line (" >> Failure : " &
(if Error.Failure = C.Strings.Null_Ptr then "" else C.Strings.Value (Error.Failure)));
IO.Put_Line (" >> Position: " & C.long'Image (Error.State.Position));
IO.Put_Line (" >> At : " & C.long'Image (Error.State.Row) & ", " & C.long'Image (Error.State.Column));
IO.Put_Line (" >> Term : " & C.int'Image (Error.State.Term));
return True; -- Exit Lispy.
end if;
return False;
end Check_Error;
begin
if Check_Error (Error) then
return;
end if;
Signal (Sig_Int, Handler'Access);
IO.Put_Line ("Lispy version v" & Version_Number);
IO.Put_Line ("Press Ctrl+C to exit");
REPL :
loop
declare
Result : aliased AMPC.Results := (Success => False, others => <>);
Input : String := Edit_Line.Read_Line ("Lispy> ");
Success : Boolean := False;
begin
Edit_Line.Add_History (Input);
-- Unrestricted_Access is a hack due to GNAT not accepting Access onm Unchecked_Unions, GNAT seems to think
-- there is no "aliased" keyword when there is.
Success := AMPC.Parse (Input, Lispy, Result'Unrestricted_Access);
if Success then
AMPC.Put (To_AST (Result.Output));
AMPC.Free (To_AST (Result.Output));
else
AMPC.Put (Result.Error);
AMPC.Free (Result.Error);
end if;
-- Echo the input back at the user.
IO.Put_Line (Input);
end;
end loop REPL;
exception
when Finished =>
IO.New_Line;
IO.Put_Line ("Exiting Lispy...");
AMPC.Free (Number, Operator, Expression, Lispy);
end Lispy;
|
programs/oeis/161/A161462.asm | jmorken/loda | 1 | 93465 | ; A161462: Final digit of the sum of all the integers from n to 2*n-1.
; 1,5,2,2,5,1,0,2,7,5,6,0,7,7,0,6,5,7,2,0,1,5,2,2,5,1,0,2,7,5,6,0,7,7,0,6,5,7,2,0,1,5,2,2,5,1,0,2,7,5,6,0,7,7,0,6,5,7,2,0,1,5,2,2,5,1,0,2,7,5,6,0,7,7,0,6,5,7,2,0,1,5,2,2,5,1
sub $0,2
bin $0,2
add $0,1
mov $2,$0
mul $2,3
lpb $2
mod $2,10
lpe
add $1,$2
sub $1,1
|
src/nanomsg-pubsub.adb | landgraf/nanomsg-ada | 2 | 19071 | -- The MIT License (MIT)
-- Copyright (c) 2015 <NAME> <<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 Interfaces.C;
package body Nanomsg.Pubsub is
package C renames Interfaces.C;
procedure Subscribe (Socket : in out Nanomsg.Socket.Socket_T;
Topic : in String) is
begin
Nanomsg.Socket.Set_Option (Socket,
Level => Nanomsg.Sockopt.Option_Level_T (Nn_Sub),
Name => Nn_Sub_Subscribe,
Value => Topic);
end Subscribe;
procedure Unsubscribe (Socket : in out Nanomsg.Socket.Socket_T;
Topuc : in String) is
begin
null;
end Unsubscribe;
end Nanomsg.Pubsub;
|
Cubical/Algebra/Group/Instances/Bool.agda | thomas-lamiaux/cubical | 0 | 4920 | {-# OPTIONS --safe #-}
module Cubical.Algebra.Group.Instances.Bool where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Structure
open import Cubical.Relation.Nullary
open import Cubical.Data.Bool
open import Cubical.Data.Empty as ⊥
open import Cubical.Data.Sum hiding (map ; rec)
open import Cubical.Algebra.Group.Base
open import Cubical.Algebra.Group.Morphisms
open import Cubical.Algebra.Group.MorphismProperties
open import Cubical.Algebra.Monoid
open import Cubical.Algebra.Semigroup
open GroupStr
open IsGroup
open IsMonoid
open IsSemigroup
BoolGroup : Group₀
fst BoolGroup = Bool
1g (snd BoolGroup) = true
(snd BoolGroup · false) false = true
(snd BoolGroup · false) true = false
(snd BoolGroup · true) y = y
inv (snd BoolGroup) x = x
is-set (isSemigroup (isMonoid (isGroup (snd BoolGroup)))) = isSetBool
·Assoc (isSemigroup (isMonoid (isGroup (snd BoolGroup)))) false false false = refl
·Assoc (isSemigroup (isMonoid (isGroup (snd BoolGroup)))) false false true = refl
·Assoc (isSemigroup (isMonoid (isGroup (snd BoolGroup)))) false true false = refl
·Assoc (isSemigroup (isMonoid (isGroup (snd BoolGroup)))) false true true = refl
·Assoc (isSemigroup (isMonoid (isGroup (snd BoolGroup)))) true false false = refl
·Assoc (isSemigroup (isMonoid (isGroup (snd BoolGroup)))) true false true = refl
·Assoc (isSemigroup (isMonoid (isGroup (snd BoolGroup)))) true true false = refl
·Assoc (isSemigroup (isMonoid (isGroup (snd BoolGroup)))) true true true = refl
·IdR (isMonoid (isGroup (snd BoolGroup))) false = refl
·IdR (isMonoid (isGroup (snd BoolGroup))) true = refl
·IdL (isMonoid (isGroup (snd BoolGroup))) false = refl
·IdL (isMonoid (isGroup (snd BoolGroup))) true = refl
·InvR (isGroup (snd BoolGroup)) false = refl
·InvR (isGroup (snd BoolGroup)) true = refl
·InvL (isGroup (snd BoolGroup)) false = refl
·InvL (isGroup (snd BoolGroup)) true = refl
-- Proof that any Group equivalent to Bool as types is also isomorphic to Bool as groups.
open GroupStr renaming (·Assoc to ·AssocG)
module _ {ℓ : Level} {A : Group ℓ} (e : Iso (fst A) Bool) where
private
discreteA : Discrete (typ A)
discreteA = isoPresDiscrete (invIso e) _≟_
_·A_ = GroupStr._·_ (snd A)
-A_ = GroupStr.inv (snd A)
IsoABool : Iso Bool (typ A)
IsoABool with (Iso.fun e (1g (snd A))) ≟ true
... | yes p = invIso e
... | no p = compIso notIso (invIso e)
true→1 : Iso.fun IsoABool true ≡ 1g (snd A)
true→1 with (Iso.fun e (1g (snd A))) ≟ true
... | yes p = sym (cong (Iso.inv e) p) ∙ Iso.leftInv e _
... | no p = sym (cong (Iso.inv e) (¬true→false (Iso.fun e (1g (snd A))) p))
∙ Iso.leftInv e (1g (snd A))
decA : (x : typ A) → (x ≡ 1g (snd A)) ⊎ (x ≡ Iso.fun IsoABool false)
decA x with (Iso.inv IsoABool x) ≟ false | discreteA x (1g (snd A))
... | yes p | yes q = inl q
... | yes p | no q = inr (sym (Iso.rightInv IsoABool x) ∙ cong (Iso.fun (IsoABool)) p)
... | no p | no q = inr (⊥.rec (q (sym (Iso.rightInv IsoABool x)
∙∙ cong (Iso.fun IsoABool) (¬false→true _ p)
∙∙ true→1)))
... | no p | yes q = inl q
≅Bool : GroupIso BoolGroup A
≅Bool .fst = IsoABool
≅Bool .snd = makeIsGroupHom homHelp
where
homHelp : _
homHelp false false with discreteA (Iso.fun IsoABool false) (1g (snd A))
| (decA ((Iso.fun IsoABool false) ·A Iso.fun IsoABool false))
... | yes p | _ = true→1 ∙∙ sym (GroupStr.·IdR (snd A) (1g (snd A))) ∙∙ cong₂ (_·A_) (sym p) (sym p)
... | no p | inl x = true→1 ∙ sym x
... | no p | inr x = true→1 ∙∙ sym (helper _ x) ∙∙ sym x
where
helper : (x : typ A) → x ·A x ≡ x → x ≡ (1g (snd A))
helper x p = sym (GroupStr.·IdR (snd A) x)
∙∙ cong (x ·A_) (sym ((snd A) .·InvR x))
∙∙ ·AssocG (snd A) x x (-A x) ∙∙ cong (_·A (-A x)) p
∙∙ (snd A) .·InvR x
homHelp false true = sym (GroupStr.·IdR (snd A) _) ∙ cong (Iso.fun IsoABool false ·A_) (sym true→1)
homHelp true y = sym (GroupStr.·IdL (snd A) _) ∙ cong (_·A (Iso.fun IsoABool y)) (sym true→1)
|
libsrc/_DEVELOPMENT/math/float/math32/z80/f32_floor.asm | ahjelm/z88dk | 640 | 29975 | <reponame>ahjelm/z88dk<filename>libsrc/_DEVELOPMENT/math/float/math32/z80/f32_floor.asm
SECTION code_fp_math32
EXTERN m32_fssub_callee
EXTERN m32_discardfraction
PUBLIC m32_floor_fastcall
PUBLIC _m32_floorf
; float floorf(float f) __z88dk_fastcall;
._m32_floorf
; Entry: dehl = floating point number
.m32_floor_fastcall
call m32_discardfraction
bit 7,d
ret Z
.was_negative
; And subtract 1
push de
push hl
ld de,$3f80
ld hl,$0000
call m32_fssub_callee
ret
|
TotalParserCombinators/And.agda | nad/parser-combinators | 1 | 1365 | <gh_stars>1-10
------------------------------------------------------------------------
-- And
------------------------------------------------------------------------
module TotalParserCombinators.And where
open import Category.Monad
open import Data.List.Relation.Binary.BagAndSetEquality
open import Data.List.Membership.Propositional.Properties
import Data.List.Categorical
open import Data.Product
open import Data.Product.Function.NonDependent.Propositional
open import Function.Base
open import Function.Inverse using (_↔_)
import Function.Related as Related
open import Function.Related.TypeIsomorphisms
open import Level
open RawMonadPlus {f = zero} Data.List.Categorical.monadPlus
using (_⊗_)
open Related using (SK-sym)
open import TotalParserCombinators.Congruence using (_∼[_]P_; _≅P_)
open import TotalParserCombinators.Derivative using (D)
open import TotalParserCombinators.Parser
import TotalParserCombinators.Pointwise as Pointwise
open import TotalParserCombinators.Semantics using (_∈_·_)
-- _&_ is defined as a pointwise lifting of _⊗_.
private
module And {R₁ R₂ : Set} = Pointwise R₁ R₂ id _⊗_ ⊗-cong
-- p₁ & p₂ returns a result if both p₁ and p₂ do.
infixr 6 _&_ _&-cong_
_&_ : ∀ {Tok R₁ R₂ xs₁ xs₂} →
Parser Tok R₁ xs₁ → Parser Tok R₂ xs₂ →
Parser Tok (R₁ × R₂) (xs₁ ⊗ xs₂)
_&_ = And.lift
-- D distributes over _&_.
D-& : ∀ {Tok R₁ R₂ xs₁ xs₂ t}
(p₁ : Parser Tok R₁ xs₁) (p₂ : Parser Tok R₂ xs₂) →
D t (p₁ & p₂) ≅P D t p₁ & D t p₂
D-& = And.D-lift
-- _&_ preserves equality.
_&-cong_ : ∀ {k Tok R xs₁ xs₁′ xs₂ xs₂′}
{p₁ : Parser Tok R xs₁} {p₁′ : Parser Tok R xs₁′}
{p₂ : Parser Tok R xs₂} {p₂′ : Parser Tok R xs₂′} →
p₁ ∼[ k ]P p₁′ → p₂ ∼[ k ]P p₂′ → p₁ & p₂ ∼[ k ]P p₁′ & p₂′
_&-cong_ = And.lift-cong
-- _&_ is correct.
correct : ∀ {Tok R₁ R₂ xs₁ xs₂ x₁ x₂ s}
(p₁ : Parser Tok R₁ xs₁) (p₂ : Parser Tok R₂ xs₂) →
(x₁ , x₂) ∈ p₁ & p₂ · s ↔ (x₁ ∈ p₁ · s × x₂ ∈ p₂ · s)
correct {x₁ = x₁} {x₂} =
And.lift-property
(λ F G H → H (x₁ , x₂) ↔ (F x₁ × G x₂))
(λ F↔F′ G↔G′ H↔H′ →
Related-cong (H↔H′ (x₁ , x₂)) (F↔F′ x₁ ×-↔ G↔G′ x₂))
(SK-sym ⊗-∈↔)
where open Related.EquationalReasoning
|
test/interaction/Issue1064.agda | shlevy/agda | 3 | 4048 | <filename>test/interaction/Issue1064.agda
data D : Set where
record R : Set where
constructor d
field x : D
record R′ : Set where
coinductive
constructor d
field r : R′
f : R → D
f r = let d x = r in x
|
test/Fail/Issue555a.agda | shlevy/agda | 1,989 | 12001 | -- Andreas, 2012-01-13
module Issue555a where
-- Do we want to allow this?
data Exp : Set → Set1
data Exp Γ where -- needs to report that too many parameters are given
var : Exp Γ
bla : {Δ : Set} → Exp Δ → Exp (Δ → Γ) → Exp Γ
-- A declared index is turned into a parameter by the definition.
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
data Vec : Set → ℕ → Set
data Vec A where
nil : Vec A zero
_∷_ : {n : ℕ} → A → Vec A n → Vec A (suc n)
|
app/cascade/data_model/language/cql.g4 | inmadria/cascade-server | 205 | 543 | /* NOTICE
This software was produced for the U. S. Government
under Basic Contract No. W15P7T-13-C-A802, and is
subject to the Rights in Noncommercial Computer Software
and Noncommercial Computer Software Documentation
Clause 252.227-7014 (FEB 2012)
(C) 2017 The MITRE Corporation.
*/
grammar cql;
SEARCH: 'search' | 'SEARCH';
WHERE: 'where' | 'WHERE';
ANALYTIC: 'analytic' | 'ANALYTIC';
AND: 'and' | 'AND';
OR: 'or' | 'OR';
NOT: 'not' | 'NOT';
floatValue: FLOAT;
intValue: INT;
number: floatValue | intValue;
value: string | number;
field: ID;
allQueries:
searchQuery (';' searchQuery)* ';'? EOF;
searchQuery: SEARCH query;
dataModelQuery:
eventObject eventAction WHERE query ;
eventObject: ID;
eventAction: ID;
EQ: '==';
NE: '!=';
LT: '<';
LE: '<=';
GT: '>';
GE: '>=';
analyticReference:
ANALYTIC '(' ANALYTIC_ID ')' # analyticReferenceByID
| ANALYTIC '(' string ')' # analyticReferenceByName;
valueComparator:
EQ | NE | LT | LE | GT | GE;
string:
STRING;
query:
'(' query ')' # ScopedQuery
| field valueComparator value # ValueComparatorQuery
| 'match' '(' field ',' value ')' # RegExQuery
| analyticReference # AnalyticReferenceQuery
| NOT query # NotQuery
| query AND query # AndQuery
| query OR query # OrQuery
| dataModelQuery # NestedDataModelQuery;
// Lexer rules
STRING : '"' ( '\\"' | '\\\\' | ~[\\"\r\n] )* '"';
INT: [0-9]+;
FLOAT : [0-9]+.[0-9]+;
ID : [a-zA-Z_][a-zA-Z_0-9]* ; // match identifiers
ANALYTIC_ID : [a-zA-Z_0-9]+ ; // match identifiers
COMMENT : '#' ~[\r\n]* -> skip ; // skip comment lines
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
|
programs/oeis/157/A157966.asm | neoneye/loda | 22 | 25253 | <reponame>neoneye/loda
; A157966: Number of 3's in A157733(n).
; 0,1,1,1,3,3,5,5,7,9,9,11,13,13,15,17,19,19,21,23,23,25,27,29,31,33,33,35,35,37,41,43,45,45,49,49,51,53,55,57,59,59,63,63,65,65,69,73,75,75,77,79,79,83,85,87,89,89,91,93,93,97,101,103,103,105,109,111,115,115,117
seq $0,40 ; The prime numbers.
sub $0,5
div $0,3
add $0,1
|
S5/AO/Assembler/TP/Assembleur/somme_solutionTd.asm | Momellouky/S5 | 1 | 103801 | <filename>S5/AO/Assembler/TP/Assembleur/somme_solutionTd.asm<gh_stars>1-10
; multi-segment executable file template.
data segment
N dw 5
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
mov ax , N
mov dx , 0
mov cx , 0
boucle:
cmp cx, ax
jg fin
add dx, cx
inc cx
jmp boucle
fin:
add dx, 48
mov ah, 2h
int 21h
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.
|
programs/oeis/024/A024122.asm | neoneye/loda | 22 | 242985 | ; A024122: a(n) = 10^n - n^8.
; 1,9,-156,-5561,-55536,-290625,-679616,4235199,83222784,956953279,9900000000,99785641119,999570018304,9999184269279,99998524210944,999997437109375,9999995705032704,99999993024242559,999999988980039424,9999999983016436959,99999999974400000000,999999999962177140639,9999999999945124126464,99999999999921689014719,999999999999889924685824,9999999999999847412109375,99999999999999791172935424,999999999999999717570463519,9999999999999999622198001664,99999999999999999499753587039,999999999999999999343900000000,9999999999999999999147108962559,99999999999999999998900488372224,999999999999999999998593591381759,9999999999999999999998214206095104,99999999999999999999997748124609375,999999999999999999999997178890092544
mov $1,10
pow $1,$0
pow $0,8
sub $1,$0
mov $0,$1
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_588.asm | ljhsiun2/medusa | 9 | 90852 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x1be99, %rdx
nop
nop
nop
and %r15, %r15
movl $0x61626364, (%rdx)
sub %rdx, %rdx
lea addresses_WT_ht+0x1e699, %rsi
lea addresses_UC_ht+0x7619, %rdi
clflush (%rsi)
nop
nop
nop
nop
sub $47507, %rbx
mov $60, %rcx
rep movsb
add $9134, %rdi
lea addresses_WT_ht+0x1bb99, %rdx
nop
nop
and %r14, %r14
mov (%rdx), %rcx
nop
sub %r15, %r15
lea addresses_WC_ht+0x2a19, %rsi
and %r14, %r14
mov $0x6162636465666768, %rdi
movq %rdi, %xmm5
and $0xffffffffffffffc0, %rsi
movaps %xmm5, (%rsi)
nop
nop
nop
nop
nop
sub %r15, %r15
lea addresses_WT_ht+0xac17, %rsi
nop
nop
nop
nop
nop
cmp $4045, %rdx
movl $0x61626364, (%rsi)
lfence
lea addresses_D_ht+0xc059, %rsi
lea addresses_UC_ht+0xca99, %rdi
nop
sub %rax, %rax
mov $57, %rcx
rep movsq
nop
nop
and %rsi, %rsi
lea addresses_WC_ht+0x3699, %rdx
nop
and %r15, %r15
mov $0x6162636465666768, %r14
movq %r14, (%rdx)
nop
nop
nop
sub %r15, %r15
lea addresses_A_ht+0x959, %rdx
nop
nop
nop
nop
add $60570, %rax
movw $0x6162, (%rdx)
and %rdi, %rdi
lea addresses_D_ht+0x19f79, %rsi
lea addresses_normal_ht+0x145f9, %rdi
nop
nop
nop
nop
sub $23450, %r14
mov $39, %rcx
rep movsw
nop
nop
cmp %rbx, %rbx
lea addresses_A_ht+0x5b68, %r14
nop
cmp %rcx, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
and $0xffffffffffffffc0, %r14
vmovaps %ymm3, (%r14)
nop
nop
nop
nop
nop
xor $45943, %rdi
lea addresses_D_ht+0x111d9, %rbx
nop
nop
nop
nop
sub $56258, %r15
movb (%rbx), %cl
nop
and $13259, %r14
lea addresses_WT_ht+0x9f3b, %rdi
nop
nop
cmp %rbx, %rbx
movups (%rdi), %xmm0
vpextrq $1, %xmm0, %rax
add $54384, %rax
lea addresses_WT_ht+0x6559, %rbx
nop
nop
nop
nop
inc %rdi
movb (%rbx), %cl
nop
nop
and %rsi, %rsi
lea addresses_UC_ht+0x7a99, %r15
clflush (%r15)
nop
inc %rdx
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
and $0xffffffffffffffc0, %r15
vmovntdq %ymm5, (%r15)
nop
add $14221, %rdi
lea addresses_normal_ht+0x4259, %rsi
lea addresses_WT_ht+0x6699, %rdi
nop
nop
nop
nop
xor %rdx, %rdx
mov $40, %rcx
rep movsw
nop
nop
nop
nop
xor %rdx, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r8
push %r9
push %rbp
push %rcx
push %rdx
// Faulty Load
lea addresses_D+0x12a99, %rbp
nop
nop
nop
and $11417, %rcx
vmovups (%rbp), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %r8
lea oracles, %rcx
and $0xff, %r8
shlq $12, %r8
mov (%rcx,%r8,1), %r8
pop %rdx
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 3}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_WC_ht', 'congruent': 7}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC_ht', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A_ht', 'congruent': 6}, 'OP': 'STOR'}
{'dst': {'same': True, 'congruent': 5, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_D_ht'}}
{'dst': {'same': True, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 0}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 6}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT_ht', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 6}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
v0.2/Source/display.asm | sjmeunier/cros | 0 | 170934 | <filename>v0.2/Source/display.asm
;-----------------------------------------------------
;CrOs v0.02
;<NAME>
;
;Display procedures
;-----------------------------------------------------
;
;-----------------------------------------------------
;Display space chaacter
;I: none
;O: none
;-----------------------------------------------------
_display_space:
mov ah, 0Eh ; BIOS teletype
mov al, 20h ; space character
mov bh, 00h ; display page 0
mov bl, 07h ; text attribute
int 10h ; invoke BIOS
ret
;-----------------------------------------------------
;-----------------------------------------------------
;Display CRLF
;I: none
;O: none
;-----------------------------------------------------
_display_endl:
mov ah, 0Eh ; BIOS teletype acts on newline!
mov al, 0Dh
mov bh, 00h
mov bl, 07h
int 10h
mov ah, 0Eh ; BIOS teletype acts on linefeed!
mov al, 0Ah
mov bh, 00h
mov bl, 07h
int 10h
ret
;-----------------------------------------------------
;-----------------------------------------------------
;Display prompt
;I: none
;O: none
;-----------------------------------------------------
_display_prompt:
mov si, strPrompt ;load message
mov ah, 01h ;request sub-service 0x01
int 21h
ret
;-----------------------------------------------------
;-----------------------------------------------------
;Display welcome
;I: none
;O: none
;-----------------------------------------------------
_display_welcome:
mov si, OsName ; load message
mov ah, 01h ; request sub-service 0x01
int 21h
call _display_endl
mov si, strWelcome ; load message
mov ah, 01h ; request sub-service 0x01
int 21h
ret
;-----------------------------------------------------
;-----------------------------------------------------
;Display string
;I: si Address of string
;O: none
;-----------------------------------------------------
_display_string:
mov ah, 01h ; request sub-service 0x01
int 21h
ret
;-----------------------------------------------------
|
agda/Algebra/Construct/Free/Semilattice/FromList.agda | oisdk/combinatorics-paper | 6 | 14365 | {-# OPTIONS --cubical --safe #-}
module Algebra.Construct.Free.Semilattice.FromList where
open import Prelude
open import Algebra.Construct.Free.Semilattice.Definition
open import Algebra.Construct.Free.Semilattice.Eliminators
open import Algebra.Construct.Free.Semilattice.Relation.Unary
open import Data.List
import Data.List.Membership as ℰ
open import Data.Fin using (Fin; fs; f0)
open import HITs.PropositionalTruncation.Sugar
open import HITs.PropositionalTruncation.Properties
fromList : List A → 𝒦 A
fromList = foldr _∷_ []
∈List⇒∈𝒦 : ∀ xs {x : A} → ∥ x ℰ.∈ xs ∥ → x ∈ fromList xs
∈List⇒∈𝒦 [] ∣x∈xs∣ = ⊥-elim (refute-trunc (λ ()) ∣x∈xs∣)
∈List⇒∈𝒦 (x ∷ xs) ∣x∈xs∣ = do
(fs n , x∈xs) ← ∣x∈xs∣
where (f0 , x∈xs) → ∣ inl x∈xs ∣
∣ inr (∈List⇒∈𝒦 xs ∣ n , x∈xs ∣) ∣
|
experiments/test-suite/mutation-based/10/4/cd.als | kaiyuanw/AlloyFLCore | 1 | 5143 | pred test21 {
some disj Object0: Object {some disj Object0, Class0, Class1: Class {
Object = Object0
Class = Object0 + Class0 + Class1
ext = Class0->Class1 + Class1->Object0
AllExtObject[]
}}
}
run test21 for 3 expect 1
pred test16 {
some disj Object0: Object {some disj Object0, Class0: Class {
Object = Object0
Class = Object0 + Class0
ext = Object0->Class0 + Class0->Class0
AllExtObject[]
}}
}
run test16 for 3 expect 0
|
Transynther/x86/_processed/AVXALIGN/_st_sm_/i7-8650U_0xd2.log_23_1055.asm | ljhsiun2/medusa | 9 | 100864 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1def0, %r13
nop
nop
nop
xor $22322, %r8
mov $0x6162636465666768, %r14
movq %r14, (%r13)
nop
nop
and $28696, %r13
lea addresses_normal_ht+0xc7f0, %rdi
cmp %r9, %r9
movups (%rdi), %xmm5
vpextrq $1, %xmm5, %r13
nop
nop
nop
inc %r9
lea addresses_normal_ht+0x4810, %r11
nop
nop
nop
nop
nop
add $7278, %rdi
movb $0x61, (%r11)
nop
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_WC_ht+0x7aba, %rsi
lea addresses_D_ht+0x1ddf0, %rdi
clflush (%rdi)
nop
nop
nop
nop
dec %r13
mov $56, %rcx
rep movsl
nop
nop
nop
xor $47229, %r13
lea addresses_normal_ht+0xe2f0, %rsi
lea addresses_normal_ht+0x16bf0, %rdi
nop
nop
cmp %r14, %r14
mov $71, %rcx
rep movsl
nop
sub %r14, %r14
lea addresses_WC_ht+0xc558, %rsi
lea addresses_normal_ht+0x123f0, %rdi
nop
nop
and %r14, %r14
mov $91, %rcx
rep movsq
nop
nop
nop
nop
inc %r9
lea addresses_normal_ht+0x38d0, %rsi
lea addresses_WT_ht+0x18ad0, %rdi
nop
nop
nop
nop
nop
sub $34868, %r11
mov $8, %rcx
rep movsl
add $41814, %r14
lea addresses_A_ht+0x18f30, %rdi
clflush (%rdi)
nop
nop
nop
nop
and $30034, %rcx
mov $0x6162636465666768, %r9
movq %r9, %xmm3
movups %xmm3, (%rdi)
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_normal_ht+0x1d5f0, %rsi
xor $34805, %r9
mov (%rsi), %r8w
nop
nop
xor %r9, %r9
lea addresses_A_ht+0x121f8, %r13
nop
nop
and $49665, %rsi
movl $0x61626364, (%r13)
xor $4217, %r13
lea addresses_normal_ht+0x103f0, %rsi
nop
cmp $39465, %r8
mov $0x6162636465666768, %r11
movq %r11, %xmm5
vmovups %ymm5, (%rsi)
nop
nop
nop
add %r11, %r11
lea addresses_WT_ht+0x19da0, %r11
nop
nop
add %r14, %r14
movw $0x6162, (%r11)
add %rdi, %rdi
lea addresses_normal_ht+0x9570, %rcx
nop
nop
and %rdi, %rdi
mov (%rcx), %r14d
nop
sub $42232, %r9
lea addresses_WC_ht+0x71f0, %r11
nop
nop
cmp $29010, %r14
mov $0x6162636465666768, %r9
movq %r9, (%r11)
cmp $22536, %r9
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %rax
push %rbp
push %rcx
push %rdx
// Store
lea addresses_A+0x1abf0, %rdx
nop
nop
nop
dec %rax
mov $0x5152535455565758, %rcx
movq %rcx, (%rdx)
nop
nop
nop
nop
nop
sub %r12, %r12
// Store
lea addresses_A+0x1abf0, %rdx
nop
nop
inc %rbp
movw $0x5152, (%rdx)
nop
and $31526, %rbp
// Store
lea addresses_WT+0x6cf0, %r11
nop
nop
cmp %r12, %r12
mov $0x5152535455565758, %rcx
movq %rcx, %xmm2
vmovntdq %ymm2, (%r11)
nop
nop
xor $22120, %rcx
// Faulty Load
lea addresses_A+0x1abf0, %r12
clflush (%r12)
and $56226, %rcx
movb (%r12), %al
lea oracles, %r13
and $0xff, %rax
shlq $12, %rax
mov (%r13,%rax,1), %rax
pop %rdx
pop %rcx
pop %rbp
pop %rax
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 7, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': True, 'NT': True, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': True, 'NT': True, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'52': 23}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
examples/example.adb | cyberpython/xpath_utils | 0 | 28560 | -- Copyright 2017 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded;
with XPATH_UTILS;
procedure example
is
package SU renames Ada.Strings.Unbounded;
use type Ada.Strings.Unbounded.Unbounded_String;
Context : XPATH_UTILS.Context_T;
Ret_Code : Boolean := False;
Val : SU.Unbounded_String := SU.Null_Unbounded_String;
begin
XPATH_UTILS.Initialize;
XPATH_UTILS.Parse_File(Filename => SU.To_Unbounded_String("test.xml"),
Context => Context,
Success => Ret_Code);
if Ret_Code then
-- Example of fully qualified XPath to extract the value of an attribute
XPATH_UTILS.Get_Value(XPath_Expression => SU.To_Unbounded_String("/config/entry/item[@id=12]/@param_x"),
Context => Context,
Value => Val);
Put_Line(SU.To_String(Val));
-- Example of XPath that matches all 'item' elements with the 'id' attribute
-- set to '10'.
-- Note that XPATH_UTILS will return the value for the first match only.
XPATH_UTILS.Get_Value(XPath_Expression => SU.To_Unbounded_String("//item[@id=10]"),
Context => Context,
Value => Val);
Put_Line(SU.To_String(Val));
-- List processing example.
-- Each list entry contains 2 elements: 'path' and 'checksum'
-- If both are empty, we consider that we have reached the end of the list.
declare
Continue : Boolean := True;
I : Integer := 1;
File_Path : SU.Unbounded_String := SU.Null_Unbounded_String;
Checksum : SU.Unbounded_String := SU.Null_Unbounded_String;
begin
while Continue loop
XPATH_UTILS.Get_Value(XPath_Expression => SU.To_Unbounded_String("/config/checksums/entry["&I'Img&"]/path"),
Context => Context,
Value => File_Path);
XPATH_UTILS.Get_Value(XPath_Expression => SU.To_Unbounded_String("/config/checksums/entry["&I'Img&"]/checksum"),
Context => Context,
Value => Checksum);
if File_Path = XPATH_UTILS.Empty_String_C and then Checksum = XPATH_UTILS.Empty_String_C then
Continue := False;
else
if File_Path = XPATH_UTILS.Empty_String_C or else Checksum = XPATH_UTILS.Empty_String_C then
Put_Line("Invalid list item at index " & I'Img &": both path and checksum need to be provided.");
else
Put_Line(SU.To_String(File_Path) & " : " & SU.To_String(Checksum));
end if;
I := I + 1;
end if;
end loop;
end;
else
Put_Line("**** Could not load the XML file! ****");
end if;
XPATH_UTILS.Free_Resources(Context => Context);
XPATH_UTILS.Finalize;
end example;
|
src/instruction-test/halt.asm | brgmnn/uob-cpu-simulator | 0 | 90184 | <gh_stars>0
# 'halt' test case code
# modifying this code with cause tests to fail!
halt |
source/web/tools/a2js/engines-contexts.ads | svn2github/matreshka | 24 | 2730 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Tools Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the <NAME>, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Containers.Hashed_Maps;
with Asis.Elements;
with League.Strings;
with Engines.Generic_Engines;
package Engines.Contexts is
type Context;
package Text_Engines is new Generic_Engines
(Propert_Name => Text_Property,
Property_Type => League.Strings.Universal_String,
Abstract_Context => Context);
package Boolean_Engines is new Generic_Engines
(Propert_Name => Boolean_Property,
Property_Type => Boolean,
Abstract_Context => Context);
package Integer_Engines is new Generic_Engines
(Propert_Name => Integer_Property,
Property_Type => Integer,
Abstract_Context => Context);
package Call_Convention_Engines is new Generic_Engines
(Propert_Name => Convention_Property,
Property_Type => Convention_Kind,
Abstract_Context => Context);
package Uniques is
type Unique_Map is tagged private;
function Get
(Self : access Unique_Map;
Element : Asis.Element;
Prefix : Wide_Wide_String := "")
return League.Strings.Universal_String;
private
function Hash (Item : Asis.Element) return Ada.Containers.Hash_Type;
package Maps is new Ada.Containers.Hashed_Maps
(Key_Type => Asis.Element,
Element_Type => Positive,
Hash => Hash,
Equivalent_Keys => Asis.Elements.Is_Equal,
"=" => "=");
type Unique_Map is new Maps.Map with null record;
end Uniques;
type Context is tagged limited record
Text : aliased Text_Engines.Engine (Context'Unchecked_Access);
Boolean : aliased Boolean_Engines.Engine
(Context'Unchecked_Access);
Integer : aliased Integer_Engines.Engine
(Context'Unchecked_Access);
Call_Convention : aliased Call_Convention_Engines.Engine
(Context'Unchecked_Access);
Unique : aliased Uniques.Unique_Map;
end record;
end Engines.Contexts;
|
oeis/181/A181509.asm | neoneye/loda-programs | 11 | 179080 | ; A181509: a(1) = 2, a(n) = (n-th-even n^3) - (sum of previous terms)
; 2,6,56,152,296,488,728,1016,1352,1736,2168,2648,3176,3752,4376,5048,5768,6536,7352,8216,9128,10088,11096,12152,13256,14408,15608,16856,18152,19496,20888,22328,23816,25352,26936,28568,30248,31976,33752,35576,37448,39368,41336,43352,45416,47528,49688,51896,54152,56456,58808,61208,63656,66152,68696,71288,73928,76616,79352,82136,84968,87848,90776,93752,96776,99848,102968,106136,109352,112616,115928,119288,122696,126152,129656,133208,136808,140456,144152,147896,151688,155528,159416,163352,167336
mul $0,2
mov $1,$0
lpb $1
sub $0,1
pow $0,2
mul $0,3
mod $1,3
lpe
mul $0,2
add $0,2
|
xosera_test_m68k/interrupt.asm | roscopeco/Xosera | 0 | 1420 | ; *************************************************************
; Copyright (c) 2021 roscopeco <AT> gmail <DOT> com
; *************************************************************
;
section .text ; This is normal code
include "../xosera_m68k_api/xosera_equates.asm"
install_intr::
movem.l D0-D7/A0-A6,-(A7)
move.l #Xosera_intr,$68
and.w #$F0FF,SR
movem.l (A7)+,D0-D7/A0-A6
rts
remove_intr::
movem.l D0-D7/A0-A6,-(A7)
move.l $60,D0 ; copy spurious int handler
move.l D0,$68
movem.l (A7)+,D0-D7/A0-A6
rts
; interrupt routine
Xosera_intr:
movem.l D0-D1/A0,-(A7) ; save minimal regs
move.l #XVR_regbase,A0 ; get Xosera base addr
movep.w XVR_aux_addr(A0),D1 ; save aux_addr value
moveq.l #XVA_scanline,D0 ; current scanline reg
movep.w D0,XVR_aux_addr(A0)
movep.w XVR_aux_data(A0),D0 ; read scanline
tst.w D0 ; must tst, movep does not set flags
bmi .Xosera_Vsync ; if in blank, assume vsync
moveq.l #XVA_linestart,D0 ; set line_start reg
movep.w D0,XVR_aux_addr(A0)
moveq.l #$0000,D0 ; to VRAM addr $0000
movep.w D0,XVR_aux_data(A0)
movep.w D1,XVR_aux_addr(A0) ; restore aux_addr
movem.l (A7)+,D0-D1/A0 ; restore regs
rte ; return from interrupt
.Xosera_Vsync
move.w #XVA_COLORMEM+2,D0 ; set color entry #2
movep.w D0,XVR_aux_addr(A0)
move.w NukeColor,D0 ; increment NukeColor
addq.l #1,D0
move.w D0,NukeColor
movep.w D0,XVR_aux_data(A0) ; to NukeColor
add.l #1,XFrameCount ; increment frame counter
movep.w D2,XVR_aux_addr(A0) ; restore aux_addr
movem.l (A7)+,D0-D1/A0 ; restore regs
rte
NukeColor dc.w $0000
XFrameCount:: dc.l $00000000
|
test/asset/agda-stdlib-1.0/Data/Product/Properties/WithK.agda | omega12345/agda-mode | 0 | 9165 | <reponame>omega12345/agda-mode<gh_stars>0
------------------------------------------------------------------------
-- The Agda standard library
--
-- Properties, related to products, that rely on the K rule
------------------------------------------------------------------------
{-# OPTIONS --with-K --safe #-}
module Data.Product.Properties.WithK where
open import Data.Product
open import Data.Product.Properties
open import Function
open import Relation.Binary using (Decidable)
open import Relation.Binary.PropositionalEquality
open import Relation.Nullary using (yes; no)
------------------------------------------------------------------------
-- Equality
module _ {a b} {A : Set a} {B : Set b} where
,-injective : ∀ {a c : A} {b d : B} → (a , b) ≡ (c , d) → a ≡ c × b ≡ d
,-injective refl = refl , refl
module _ {a b} {A : Set a} {B : A → Set b} where
,-injectiveʳ : ∀ {a} {b c : B a} → (Σ A B ∋ (a , b)) ≡ (a , c) → b ≡ c
,-injectiveʳ refl = refl
≡-dec : Decidable _≡_ → (∀ {a} → Decidable {A = B a} _≡_) →
Decidable {A = Σ A B} _≡_
≡-dec dec₁ dec₂ (a , x) (b , y) with dec₁ a b
... | no a≢b = no (a≢b ∘ ,-injectiveˡ)
... | yes refl with dec₂ x y
... | no x≢y = no (x≢y ∘ ,-injectiveʳ)
... | yes refl = yes refl
|
oeis/008/A008455.asm | neoneye/loda-programs | 11 | 93775 | ; A008455: 11th powers: a(n) = n^11.
; 0,1,2048,177147,4194304,48828125,362797056,1977326743,8589934592,31381059609,100000000000,285311670611,743008370688,1792160394037,4049565169664,8649755859375,17592186044416,34271896307633,64268410079232,116490258898219,204800000000000,350277500542221,584318301411328,952809757913927,1521681143169024,2384185791015625,3670344486987776,5559060566555523,8293509467471872,12200509765705829,17714700000000000,25408476896404831,36028797018963968,50542106513726817,70188843638032384,96549157373046875
pow $0,11
|
library/standalone/WIP_fmGUI_CustomMenus_MenuSet_CreateUpdate.applescript | NYHTC/applescript-fm-helper | 1 | 4048 | -- fmGUI_CustomMenus_MenuSet_CreateUpdate({})
-- <NAME>, NYHTC
-- create/update a menu set
(*
HISTORY:
1.4 - 2017-12-18 ( eshagdar ): added to htcLib. renamed fmGUI_CustomMenus_CustomMenuSet_CreateUpdate to fmGUI_CustomMenus_MenuSet_CreateUpdate.
1.3 - 2014-06-12 ( dshockley ): updated to successfully finish editing menus
1.2 - 2014-03-06 ( dshockley ): updated to remove any extra menu items that go beyond what was specified by the parameters.
1.1 - 2014-01-15 ( dshockley ):
1.0 - 201x-xx-xx ( dshockley ): created
REQUIRES:
fmGUI_CustomMenus_GotoTab_MenuSets
fmGUI_CustomMenus_MenuSet_Select
fmGUI_ObjectClick_Button
windowWaitUntil_FrontIS
*)
on run
fmGUI_CustomMenus_MenuSet_CreateUpdate({})
end run
--------------------
-- START OF CODE
--------------------
on fmGUI_CustomMenus_MenuSet_CreateUpdate(prefs)
-- version 1.4
try
set defaultPrefs to {menuSetRec:null}
set prefs to prefs & defaultPrefs
set menuSetRec to menuSetRec of prefs
-- open menu sets window
fmGUI_CustomMenus_GotoTab_MenuSets({})
-- get button refs
tell application "System Events"
tell application process "FileMaker Pro Advanced"
set createButton to first button of tab group 1 of window 1 whose name starts with "Create"
set editButton to first button of tab group 1 of window 1 whose name starts with "Edit"
set duplicateButton to first button of tab group 1 of window 1 whose name starts with "Duplicate"
end tell
end tell
-- determine next command, and get to menu set edit window
set menuSetAlreadyExists to fmGUI_CustomMenus_MenuSet_Select({menuSetName:menuSetName of menuSetRec})
try
set menuSetToDupeFromExisting to fmGUI_CustomMenus_MenuSet_Select({menuSetName:dupeExisting of menuSetRec})
on error
set menuSetToDupeFromExisting to false
end try
if menuSetAlreadyExists then
fmGUI_ObjectClick_Button({buttonRef:editButton})
else if menuSetToDupeFromExisting then
fmGUI_ObjectClick_Button({buttonRef:duplicateButton})
fmGUI_ObjectClick_Button({buttonRef:editButton})
else
fmGUI_ObjectClick_Button({buttonRef:createButton})
end if
windowWaitUntil_FrontIS({windowName:"Edit Custom Menu Set"})
-- We now have open a custom menu SET we can create/edit:
tell application "System Events"
tell application process "FileMaker Pro Advanced"
-- ensure name and comment
set value of text field "Menu Set Name:" of window 1 to menuSetName of menuSetRec
set value of text field "Comment:" of window 1 to menuSetComment of menuSetRec
-- get button refs
set menuTable to table 1 of scroll area 1 of window 1
set menuEditButton to first button of window 1 whose name starts with "Edit"
set menuAddButton to first button of window 1 whose name starts with "Add"
set menuRemoveButton to first button of window 1 whose name starts with "Remove"
-- other info
set initialRowCount to count of rows of table 1 of scroll area 1 of window 1
-- TODO: continue updated from here
-- TODO: continue updated from here
-- TODO: continue updated from here
-- TODO: continue updated from here
-- TODO: continue updated from here
-- TODO: continue updated from here
-- TODO: continue updated from here
-- TODO: continue updated from here
-- TODO: continue updated from here
-- iterate through menuList
set menuNeededCount to count of menuList of menuSetRec
repeat with menuRowNumber from 1 to menuNeededCount
set oneMenuRec to CustomMenu of item menuRowNumber of menuList of menuSetRec
(*
For each MENU that should be in this Custom Menu Set, we need to see if the row-by-index menu is the correct one. If it isn't, then we need to select that wrong one, ADD the right one, make any tweaks to that, save it, then REMOVE the wrong one that is (now) above.
*)
set nextCommand to null
try
select row menuRowNumber of menuTable
set nextCommand to "CHECK" -- no error selecting, so EDIT.
set rowSelected to row menuRowNumber of menuTable
on error
-- couldn't select the row number we want, so ADD, and try to select previous
set nextCommand to "ADD" -- could NOT select specified row, so need to ADD a Menu, AFTER the previous row.
try
select row (menuRowNumber - 1) of menuTable
on error
-- if we could not select "previous" it would be because there was no previous, so just ignore this error.
end try
end try
if nextCommand is "CHECK" then
if value of static text 1 of rowSelected is equal to menuName of oneMenuRec then
set nextCommand to "EDIT" -- Has the MATCHING name, so edit it.
else
set nextCommand to "REPLACE" -- wrong menu, so replace.
end if
end if
if debugMode then my logConsole(ScriptName, menuName of oneMenuRec & " - " & nextCommand)
if nextCommand is "ADD" or nextCommand is "REPLACE" then
if name of window 1 is "Edit Custom Menu Set" then
my fmGUI_ObjectClick_AffectsWindow(menuAddButton)
end if
try -- to select the menu specified:
if not my windowWaitUntil_FrontIS({windowName:"Select Menu"}) then error "Timed out waiting for 'Select Menu' window." number 1024
select (first row of table 1 of scroll area 1 of window 1 whose value of static text 1 is menuName of oneMenuRec)
my fmGUI_ObjectClick_AffectsWindow(button "Select" of window 1)
on error errMsg number errNum
-- that menu does NOT EXIST, so need to create it:
if debugMode then my logConsole(ScriptName, "Select Menu failed ( need to create ): " & errMsg)
my fmGUI_ObjectClick_AffectsWindow(first button of window 1 whose description starts with "New Menu")
if my isNullOrEmpty(menuBasedOn of oneMenuRec) or menuBasedOn of oneMenuRec is "none" then
-- CHOICE: Start with an empty menu:
click (first checkbox of window 1 whose name contains "empty")
else
-- CHOICE: Start with a standard FileMaker menu:
click (first checkbox of window 1 whose name contains "standard")
select (first row of table 1 of scroll area 1 of window 1 whose value of static text 1 is menuBasedOn of oneMenuRec)
end if
my fmGUI_ObjectClick_AffectsWindow(button "OK" of window 1)
if not my windowWaitUntil_FrontIS({windowName:"Edit Custom Menu"}) then error "Timed out waiting for 'Edit Custom Menu' window to OPEN" number 1024
end try
end if
(*
Current situation possibilities:
in 'Edit Custom Menu' (MENU) because we made a new one
in 'Edit Custom Menu Set' (SET) because we selected one
*)
if debugMode then my logConsole(ScriptName, menuName of oneMenuRec & " - " & nextCommand & " (so far)")
-- Do any editing that is needed:
if nextCommand is not "DONE" then
if (builtinMenu of oneMenuRec) then
-- CANNOT edit, since builtin command.
if (value of static text 1 of (first row of menuTable whose selected is true)) is equal to (menuName of oneMenuRec) then set nextCommand to "DONE"
if debugMode then my logConsole(ScriptName, "Did not edit MENU, since it is using the correct built-in menu: " & menuName of oneMenuRec)
else
-- we need to EDIT this menu to be sure it is correct.
-- only open Edit Custom Menu if it isn't already open:
if name of window 1 is not "Edit Custom Menu" then
my fmGUI_ObjectClick_AffectsWindow(menuEditButton)
-- RESULT: we open an EDIT MENU window.
if not my windowWaitUntil_FrontIS({windowName:"Edit Custom Menu"}) then error "Timed out waiting for 'Edit Custom Menu' window to OPEN" number 1024
end if
if debugMode then my logConsole(ScriptName, "About to edit menu: " & menuName of oneMenuRec)
set menuEditResult to my fmGUI_CustomMenus_Menu_Edit({CustomMenu:oneMenuRec})
if menuEditResult is true then
if name of window 1 is "Select Menu" then
-- we were editing a menu in order to select it, so do that:
my fmGUI_ObjectClick_AffectsWindow(button "Select" of window 1)
delay 0.5 --seconds
set windowClosed to windowWaitUntil_FrontIsNOT({windowName:"Select Menu", waitCycleDelaySeconds:0.5, waitCycleMax:50})
if not windowClosed then error "Timed out waiting for 'Select Menu' window to CLOSE after we edited/created a Custom Menu '" & menuName of oneMenuRec & "' in order to select it to add to the set" number 1024
end if
end if
end if
end if
if nextCommand is "REPLACE" then
-- need to re-select the row that was there and Remove it.
select row menuRowNumber of menuTable
click menuRemoveButton
if debugMode then my logConsole(ScriptName, "Removed wrong menu after replacing it with: " & menuName of oneMenuRec)
end if
-- END OF: desired menus
end repeat
if debugMode then my logConsole(ScriptName, "finished looping over desired menus")
-- Now if we are still looking at the menus for this set, remove any extra menus that go beyond those specified.
if name of window 1 is "Edit Custom Menu Set" then
repeat while (count of rows of menuTable) is greater than menuNeededCount
select row (menuNeededCount + 1) of menuTable
click (first button of window 1 whose name starts with "Remove")
-- was incorrectly "Delete" before. 2014-06-12-dshockley
end repeat
end if
return true
end tell
end tell
on error errMsg number errNum
set errMsg to "unable to fmGUI_CustomMenus_MenuSet_CreateUpdate - " & errMsg
error errMsg number errNum
end try
end fmGUI_CustomMenus_MenuSet_CreateUpdate
--------------------
-- END OF CODE
--------------------
on fmGUI_AppFrontMost()
tell application "htcLib" to fmGUI_AppFrontMost()
end fmGUI_AppFrontMost
on fmGUI_ObjectClick_OkButton(prefs)
tell application "htcLib" to fmGUI_ObjectClick_OkButton(prefs)
end fmGUI_ObjectClick_OkButton
on fmGUI_NameOfFrontmostWindow()
tell application "htcLib" to fmGUI_NameOfFrontmostWindow()
end fmGUI_NameOfFrontmostWindow
on windowWaitUntil_FrontNotIS(prefs)
tell application "htcLib" to windowWaitUntil_FrontNotIS(prefs)
end windowWaitUntil_FrontNotIS
|
programs/oeis/257/A257272.asm | neoneye/loda | 22 | 13987 | ; A257272: a(n) = 2^(n-1)*(2^n+7).
; 4,9,22,60,184,624,2272,8640,33664,132864,527872,2104320,8402944,33583104,134275072,536985600,2147713024,8590393344,34360655872,137440788480,549759483904,2199030595584,8796107702272,35184401448960,140737547075584,562950070861824,2251800048566272,9007199724503040,36028797958488064,144115189954904064,576460756061519872,2305843016729886720,9223372051887161344,36893488177483874304,147573952649805955072,590295810478964736000,2361183241675340775424,9444732966220326764544,37778931863919234383872,151115727453752792186880,604462909811162878050304,2417851639236954930806784,9671406556932426560438272,38685626227698919916175360,154742504910734107013545984,618970019642813282751873024,2475880078571006840402870272,9903520314283534780402237440,39614081257133153959190462464,158456325028530645511924875264,633825300114118641398025551872,2535301200456466684292754309120,10141204801825850974572321439744,40564819207303372373091894165504,162259276829213426441972793475072,649037107316853579667101607526400,2596148429267414066466827297357824,10384593717069655761464150923935744,41538374868278622037050287164751872,166153499473114486130588515597025280,664613997892457940487128796264136704
mov $1,2
pow $1,$0
add $1,4
bin $1,2
sub $1,6
mov $0,$1
|
software/profi/net-tools/src/pqdos/browser/gopher/engine/media-processor.asm | andykarpov/karabas-pro | 26 | 4618 | <gh_stars>10-100
MODULE MediaProcessor
processResource:
call turboOn
call UrlEncoder.extractHostName
ld a, (historyBlock.mediaType)
cp MIME_LINK : jr z, processPage
cp MIME_INPUT : jr z, processPage
cp MIME_MUSIC : jr z, processPT
; Fallback to plain text
processText:
call Render.renderPlainTextScreen
jp Render.plainTextLoop
processPT:
call VortexProcessor.play
jp History.back
processPage:
call Render.renderGopherScreen
jp Render.workLoop
ENDMODULE |
alloy4fun_models/trashltl/models/17/eQFz47B6fREc9wSAH.als | Kaixi26/org.alloytools.alloy | 0 | 3954 | open main
pred ideQFz47B6fREc9wSAH_prop18 {
always all f: Protected | f in Protected until f in Trash
}
pred __repair { ideQFz47B6fREc9wSAH_prop18 }
check __repair { ideQFz47B6fREc9wSAH_prop18 <=> prop18o } |
tstfiles/hello.asm | embeddednodejs/jisonexample | 11 | 88748 | <reponame>embeddednodejs/jisonexample
ld r1, 0x34 ; load value
add r1, r2 ; add numbers
st r1 ; store value
|
programs/oeis/007/A007007.asm | jmorken/loda | 1 | 6053 | <filename>programs/oeis/007/A007007.asm
; A007007: Valence of graph of maximal intersecting families of sets.
; 0,1,3,4,10,15,35,56,126,210,462,792,1716,3003,6435,11440,24310,43758,92378,167960,352716,646646,1352078,2496144,5200300,9657700,20058300,37442160,77558760,145422675,300540195,565722720,1166803110,2203961430
mov $2,$0
mov $4,$0
lpb $2
mov $1,$4
add $1,1
mov $3,$2
trn $2,39
div $3,2
bin $1,$3
lpe
|
test/asset/agda-stdlib-1.0/Data/Fin/Dec.agda | omega12345/agda-mode | 0 | 16586 | <gh_stars>0
------------------------------------------------------------------------
-- The Agda standard library
--
-- Decision procedures for finite sets and subsets of finite sets
--
-- This module is DEPRECATED. Please use the Data.Fin.Properties
-- and Data.Fin.Subset.Properties directly.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Fin.Dec where
open import Data.Fin.Properties public
using (decFinSubset; any?; all?; ¬∀⟶∃¬-smallest; ¬∀⟶∃¬)
open import Data.Fin.Subset.Properties public
using (_∈?_; _⊆?_; nonempty?; anySubset?)
renaming (Lift? to decLift)
|
Fields/FieldOfFractions/Addition.agda | Smaug123/agdaproofs | 4 | 6084 | <filename>Fields/FieldOfFractions/Addition.agda
{-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Groups.Definition
open import Rings.Definition
open import Rings.IntegralDomains.Definition
open import Setoids.Setoids
open import Sets.EquivalenceRelations
module Fields.FieldOfFractions.Addition {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} (I : IntegralDomain R) where
open import Fields.FieldOfFractions.Setoid I
fieldOfFractionsPlus : fieldOfFractionsSet → fieldOfFractionsSet → fieldOfFractionsSet
fieldOfFractionsSet.num (fieldOfFractionsPlus (record { num = a ; denom = b ; denomNonzero = b!=0 }) (record { num = c ; denom = d ; denomNonzero = d!=0 })) = (a * d) + (b * c)
fieldOfFractionsSet.denom (fieldOfFractionsPlus (record { num = a ; denom = b ; denomNonzero = b!=0 }) (record { num = c ; denom = d ; denomNonzero = d!=0 })) = b * d
fieldOfFractionsSet.denomNonzero (fieldOfFractionsPlus (record { num = a ; denom = b ; denomNonzero = b!=0 }) (record { num = c ; denom = d ; denomNonzero = d!=0 })) = λ pr → exFalso (d!=0 (IntegralDomain.intDom I pr b!=0))
--record { num = ((a * d) + (b * c)) ; denom = b * d ; denomNonzero = λ pr → exFalso (d!=0 (IntegralDomain.intDom I pr b!=0)) }
plusWellDefined : {a b c d : fieldOfFractionsSet} → (Setoid._∼_ fieldOfFractionsSetoid a c) → (Setoid._∼_ fieldOfFractionsSetoid b d) → Setoid._∼_ fieldOfFractionsSetoid (fieldOfFractionsPlus a b) (fieldOfFractionsPlus c d)
plusWellDefined {record { num = a ; denom = b ; denomNonzero = b!=0 }} {record { num = c ; denom = d ; denomNonzero = d!=0 }} {record { num = e ; denom = f ; denomNonzero = f!=0 }} {record { num = g ; denom = h ; denomNonzero = h!=0 }} af=be ch=dg = need
where
open Setoid S
open Ring R
open Equivalence eq
have1 : (c * h) ∼ (d * g)
have1 = ch=dg
have2 : (a * f) ∼ (b * e)
have2 = af=be
need : (((a * d) + (b * c)) * (f * h)) ∼ ((b * d) * (((e * h) + (f * g))))
need = transitive (transitive (Ring.*Commutative R) (transitive (Ring.*DistributesOver+ R) (Group.+WellDefined (Ring.additiveGroup R) (transitive *Associative (transitive (*WellDefined (*Commutative) reflexive) (transitive (*WellDefined *Associative reflexive) (transitive (*WellDefined (*WellDefined have2 reflexive) reflexive) (transitive (symmetric *Associative) (transitive (*WellDefined reflexive *Commutative) (transitive *Associative (transitive (*WellDefined (transitive (transitive (symmetric *Associative) (*WellDefined reflexive *Commutative)) *Associative) reflexive) (symmetric *Associative))))))))) (transitive *Commutative (transitive (transitive (symmetric *Associative) (*WellDefined reflexive (transitive (*WellDefined reflexive *Commutative) (transitive *Associative (transitive (*WellDefined have1 reflexive) (transitive (symmetric *Associative) (*WellDefined reflexive *Commutative))))))) *Associative))))) (symmetric (Ring.*DistributesOver+ R))
|
audio/sfx/battle_21.asm | AmateurPanda92/pokemon-rby-dx | 9 | 170563 | <gh_stars>1-10
SFX_Battle_21_Ch7:
noisenote 2, 15, 1, 51
noisenote 2, 12, 1, 50
noisenote 2, 10, 1, 49
noisenote 15, 8, 2, 50
noisenote 8, 15, 1, 52
endchannel
|
src/giza-widget-tiles.adb | Fabien-Chouteau/Giza | 7 | 16678 | <gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- Giza --
-- --
-- Copyright (C) 2015 <NAME> (<EMAIL>) --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package body Giza.Widget.Tiles is
---------------
-- Set_Dirty --
---------------
overriding
procedure Set_Dirty (This : in out Instance;
Dirty : Boolean := True)
is
begin
Set_Dirty (Parent (This), Dirty);
for Index in This.Widgs'Range loop
if This.Widgs (Index) /= null then
This.Widgs (Index).Set_Dirty (Dirty);
end if;
end loop;
end Set_Dirty;
----------
-- Draw --
----------
overriding procedure Draw
(This : in out Instance;
Ctx : in out Context.Class;
Force : Boolean := True)
is
W, H : Integer;
Margin : constant Integer := 1;
procedure Draw_Tile (Index : Integer);
---------------
-- Draw_Tile --
---------------
procedure Draw_Tile (Index : Integer) is
begin
if Index in This.Widgs'Range and then This.Widgs (Index) /= null then
-- Ctx.Set_Bounds ((My_Bounds.Org + Ref.Pos, Ref.Widg.Get_Size));
This.Widgs (Index).Set_Size ((W, H));
Ctx.Set_Position ((0, 0));
Ctx.Save;
Ctx.Set_Bounds (((0, 0), (W, H)));
Draw (This.Widgs (Index).all, Ctx, Force);
Ctx.Restore;
-- Translate for next tile
case This.Dir is
when Top_Down | Bottom_Up =>
Ctx.Translate ((0, This.Spacing + H));
when Left_Right | Right_Left =>
Ctx.Translate ((This.Spacing + W, 0));
end case;
end if;
end Draw_Tile;
begin
if This.Dirty or else Force then
Draw (Parent (This), Ctx, Force);
end if;
case This.Dir is
when Top_Down | Bottom_Up =>
H := This.Get_Size.H;
H := H - 2 * This.Margin;
H := H - (This.Number_Of_Widget - 1) * This.Spacing;
H := H / This.Number_Of_Widget;
W := This.Get_Size.W - 2 * This.Margin;
when Left_Right | Right_Left =>
W := This.Get_Size.W;
W := W - 2 * This.Margin;
W := W - (This.Number_Of_Widget - 1) * This.Spacing;
W := W / This.Number_Of_Widget;
H := This.Get_Size.H - 2 * This.Margin;
end case;
Ctx.Save;
Ctx.Translate ((Margin, Margin));
if This.Dir = Left_Right or else This.Dir = Top_Down then
for Index in This.Widgs'Range loop
Draw_Tile (Index);
end loop;
else
for Index in reverse This.Widgs'Range loop
Draw_Tile (Index);
end loop;
end if;
Ctx.Restore;
end Draw;
-----------------------
-- On_Position_Event --
-----------------------
overriding
function On_Position_Event
(This : in out Instance;
Evt : Position_Event_Ref;
Pos : Point_T)
return Boolean
is
W, H : Integer;
begin
case This.Dir is
when Top_Down | Bottom_Up =>
H := This.Get_Size.H / This.Number_Of_Widget;
when Left_Right | Right_Left =>
W := This.Get_Size.W / This.Number_Of_Widget;
end case;
for Index in This.Widgs'Range loop
case This.Dir is
when Top_Down =>
if Pos.Y in (Index - 1) * H .. Index * H then
return On_Position_Event (This.Widgs (Index).all,
Evt,
Pos - (0, (Index - 1) * H));
end if;
when Bottom_Up =>
if Pos.Y in (This.Widgs'Last - Index) * H ..
(This.Widgs'Last - Index + 1) * H
then
return On_Position_Event
(This.Widgs (Index).all,
Evt,
Pos - (0, (This.Widgs'Last - Index) * H));
end if;
when Left_Right =>
if Pos.X in (Index - 1) * W .. Index * W then
return On_Position_Event (This.Widgs (Index).all,
Evt,
Pos - ((Index - 1) * W, 0));
end if;
when Right_Left =>
if Pos.X in (This.Widgs'Last - Index) * W ..
(This.Widgs'Last - Index + 1) * W
then
return On_Position_Event (This.Widgs (Index).all,
Evt,
Pos - ((Index - 1) * W, 0));
end if;
end case;
end loop;
return False;
end On_Position_Event;
--------------
-- On_Event --
--------------
overriding
function On_Event
(This : in out Instance;
Evt : Event_Not_Null_Ref) return Boolean
is
Handled : Boolean := False;
begin
for W of This.Widgs loop
if W /= null then
Handled := Handled or W.On_Event (Evt);
end if;
end loop;
return Handled;
end On_Event;
---------------
-- Set_Child --
---------------
procedure Set_Child
(This : in out Instance;
Index : Positive;
Child : Widget.Reference)
is
begin
if Index in This.Widgs'Range then
This.Widgs (Index) := Child;
end if;
end Set_Child;
-----------------
-- Set_Spacing --
-----------------
procedure Set_Spacing (This : in out Instance; Spacing : Natural) is
begin
This.Spacing := Spacing;
end Set_Spacing;
----------------
-- Set_Margin --
----------------
procedure Set_Margin (This : in out Instance; Margin : Natural) is
begin
This.Margin := Margin;
end Set_Margin;
end Giza.Widget.Tiles;
|
programs/oeis/113/A113009.asm | neoneye/loda | 22 | 82651 | ; A113009: {Sum of the digits of n} raised to the power {number of digits of n}.
; 0,1,2,3,4,5,6,7,8,9,1,4,9,16,25,36,49,64,81,100,4,9,16,25,36,49,64,81,100,121,9,16,25,36,49,64,81,100,121,144,16,25,36,49,64,81,100,121,144,169,25,36,49,64,81,100,121,144,169,196,36,49,64,81,100,121,144,169,196
mov $2,$0
seq $0,7953 ; Digital sum (i.e., sum of digits) of n; also called digsum(n).
lpb $2
pow $0,2
mod $2,10
lpe
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2423.asm | ljhsiun2/medusa | 9 | 87035 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r8
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x5129, %rsi
lea addresses_WC_ht+0x5d29, %rdi
nop
nop
sub %r8, %r8
mov $104, %rcx
rep movsw
nop
nop
nop
nop
dec %r12
lea addresses_UC_ht+0xc459, %rbx
dec %rax
movw $0x6162, (%rbx)
nop
add $31265, %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %rbp
push %rbx
push %rcx
push %rdi
// Store
lea addresses_WT+0x1b029, %rbp
nop
inc %rbx
movw $0x5152, (%rbp)
nop
nop
cmp %rbp, %rbp
// Faulty Load
lea addresses_RW+0x10529, %r14
nop
nop
nop
nop
and %r11, %r11
mov (%r14), %edi
lea oracles, %rcx
and $0xff, %rdi
shlq $12, %rdi
mov (%rcx,%rdi,1), %rdi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_RW', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_RW', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
firmware/coreboot/3rdparty/libgfxinit/common/haswell/hw-gfx-gma-spll.adb | fabiojna02/OpenCellular | 1 | 7106 | <reponame>fabiojna02/OpenCellular<gh_stars>1-10
--
-- Copyright (C) 2015-2016 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
with HW.Time;
with HW.GFX.GMA.Registers;
package body HW.GFX.GMA.SPLL is
SPLL_CTL_PLL_ENABLE : constant := 1 * 2 ** 31;
SPLL_CTL_REF_SEL_MASK : constant := 3 * 2 ** 28;
SPLL_CTL_REF_SEL_SSC : constant := 1 * 2 ** 28;
SPLL_CTL_REF_SEL_NON_SSC : constant := 2 * 2 ** 28;
SPLL_CTL_FREQ_SEL_MASK : constant := 3 * 2 ** 26;
SPLL_CTL_FREQ_SEL_810 : constant := 0 * 2 ** 26;
SPLL_CTL_FREQ_SEL_1350 : constant := 1 * 2 ** 26;
procedure On is
begin
Registers.Write
(Register => Registers.SPLL_CTL,
Value => SPLL_CTL_PLL_ENABLE or
SPLL_CTL_REF_SEL_SSC or
SPLL_CTL_FREQ_SEL_1350);
Registers.Posting_Read (Registers.SPLL_CTL);
Time.U_Delay (20);
end On;
procedure Off is
begin
Registers.Unset_Mask (Registers.SPLL_CTL, SPLL_CTL_PLL_ENABLE);
end Off;
end HW.GFX.GMA.SPLL;
|
agda-stdlib/src/Codata/Stream/Properties.agda | DreamLinuxer/popl21-artifact | 5 | 2664 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Properties of operations on the Stream type
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe --sized-types #-}
module Codata.Stream.Properties where
open import Level using (Level)
open import Size
open import Codata.Thunk as Thunk using (Thunk; force)
open import Codata.Stream
open import Codata.Stream.Bisimilarity
open import Data.Nat.Base
open import Data.Nat.GeneralisedArithmetic using (fold; fold-pull)
open import Data.List.Base as List using ([]; _∷_)
open import Data.List.NonEmpty as List⁺ using (List⁺; _∷_)
import Data.List.Relation.Binary.Equality.Propositional as Eq
open import Data.Product as Prod using (_,_)
open import Data.Vec.Base as Vec using (_∷_)
open import Function
open import Relation.Binary.PropositionalEquality as P using (_≡_; _≢_)
private
variable
a b c : Level
A : Set a
B : Set b
C : Set c
i : Size
------------------------------------------------------------------------
-- repeat
lookup-repeat-identity : (n : ℕ) (a : A) → lookup n (repeat a) ≡ a
lookup-repeat-identity zero a = P.refl
lookup-repeat-identity (suc n) a = lookup-repeat-identity n a
take-repeat-identity : (n : ℕ) (a : A) → take n (repeat a) ≡ Vec.replicate a
take-repeat-identity zero a = P.refl
take-repeat-identity (suc n) a = P.cong (a Vec.∷_) (take-repeat-identity n a)
splitAt-repeat-identity : (n : ℕ) (a : A) → splitAt n (repeat a) ≡ (Vec.replicate a , repeat a)
splitAt-repeat-identity zero a = P.refl
splitAt-repeat-identity (suc n) a = P.cong (Prod.map₁ (a ∷_)) (splitAt-repeat-identity n a)
replicate-repeat : ∀ {i} (n : ℕ) (a : A) → i ⊢ List.replicate n a ++ repeat a ≈ repeat a
replicate-repeat zero a = refl
replicate-repeat (suc n) a = P.refl ∷ λ where .force → replicate-repeat n a
cycle-replicate : ∀ {i} (n : ℕ) (n≢0 : n ≢ 0) (a : A) → i ⊢ cycle (List⁺.replicate n n≢0 a) ≈ repeat a
cycle-replicate {i} n n≢0 a = let as = List⁺.replicate n n≢0 a in begin
cycle as ≡⟨⟩
as ⁺++ _ ≈⟨ ⁺++⁺ Eq.≋-refl (λ where .force → cycle-replicate n n≢0 a) ⟩
as ⁺++ (λ where .force → repeat a) ≈⟨ P.refl ∷ (λ where .force → replicate-repeat (pred n) a) ⟩
repeat a ∎ where open ≈-Reasoning
module _ {a b} {A : Set a} {B : Set b} where
map-repeat : ∀ (f : A → B) a {i} → i ⊢ map f (repeat a) ≈ repeat (f a)
map-repeat f a = P.refl ∷ λ where .force → map-repeat f a
ap-repeat : ∀ (f : A → B) a {i} → i ⊢ ap (repeat f) (repeat a) ≈ repeat (f a)
ap-repeat f a = P.refl ∷ λ where .force → ap-repeat f a
ap-repeatˡ : ∀ (f : A → B) as {i} → i ⊢ ap (repeat f) as ≈ map f as
ap-repeatˡ f (a ∷ as) = P.refl ∷ λ where .force → ap-repeatˡ f (as .force)
ap-repeatʳ : ∀ (fs : Stream (A → B) ∞) (a : A) {i} → i ⊢ ap fs (repeat a) ≈ map (_$ a) fs
ap-repeatʳ (f ∷ fs) a = P.refl ∷ λ where .force → ap-repeatʳ (fs .force) a
map-++ : ∀ {i} (f : A → B) as xs → i ⊢ map f (as ++ xs) ≈ List.map f as ++ map f xs
map-++ f [] xs = refl
map-++ f (a ∷ as) xs = P.refl ∷ λ where .force → map-++ f as xs
map-⁺++ : ∀ {i} (f : A → B) as xs → i ⊢ map f (as ⁺++ xs) ≈ List⁺.map f as ⁺++ Thunk.map (map f) xs
map-⁺++ f (a ∷ as) xs = P.refl ∷ (λ where .force → map-++ f as (xs .force))
map-cycle : ∀ {i} (f : A → B) as → i ⊢ map f (cycle as) ≈ cycle (List⁺.map f as)
map-cycle f as = begin
map f (cycle as) ≈⟨ map-⁺++ f as _ ⟩
List⁺.map f as ⁺++ _ ≈⟨ ⁺++⁺ Eq.≋-refl (λ where .force → map-cycle f as) ⟩
cycle (List⁺.map f as) ∎ where open ≈-Reasoning
------------------------------------------------------------------------
-- Functor laws
map-identity : ∀ (as : Stream A ∞) → i ⊢ map id as ≈ as
map-identity (a ∷ as) = P.refl ∷ λ where .force → map-identity (as .force)
map-map-fusion : ∀ (f : A → B) (g : B → C) as → i ⊢ map g (map f as) ≈ map (g ∘ f) as
map-map-fusion f g (a ∷ as) = P.refl ∷ λ where .force → map-map-fusion f g (as .force)
------------------------------------------------------------------------
-- splitAt
splitAt-map : ∀ n (f : A → B) xs →
splitAt n (map f xs) ≡ Prod.map (Vec.map f) (map f) (splitAt n xs)
splitAt-map zero f xs = P.refl
splitAt-map (suc n) f (x ∷ xs) =
P.cong (Prod.map₁ (f x Vec.∷_)) (splitAt-map n f (xs .force))
------------------------------------------------------------------------
-- iterate
lookup-iterate-identity : ∀ n f (a : A) → lookup n (iterate f a) ≡ fold a f n
lookup-iterate-identity zero f a = P.refl
lookup-iterate-identity (suc n) f a = begin
lookup (suc n) (iterate f a) ≡⟨⟩
lookup n (iterate f (f a)) ≡⟨ lookup-iterate-identity n f (f a) ⟩
fold (f a) f n ≡⟨ fold-pull (const ∘′ f) (f a) P.refl (λ _ → P.refl) n ⟩
f (fold a f n) ≡⟨⟩
fold a f (suc n) ∎ where open P.≡-Reasoning
------------------------------------------------------------------------
-- DEPRECATED NAMES
------------------------------------------------------------------------
-- Please use the new names as continuing support for the old names is
-- not guaranteed.
-- Version 1.1
repeat-ap-identity = ap-repeatˡ
{-# WARNING_ON_USAGE repeat-ap-identity
"Warning: repeat-ap-identity was deprecated in v1.1.
Please use ap-repeatˡ instead."
#-}
ap-repeat-identity = ap-repeatʳ
{-# WARNING_ON_USAGE ap-repeat-identity
"Warning: ap-repeat-identity was deprecated in v1.1.
Please use ap-repeatʳ instead."
#-}
ap-repeat-commute = ap-repeat
{-# WARNING_ON_USAGE ap-repeat-commute
"Warning: ap-repeat-commute was deprecated in v1.1.
Please use ap-repeat instead."
#-}
map-repeat-commute = map-repeat
{-# WARNING_ON_USAGE map-repeat-commute
"Warning: map-repeat-commute was deprecated in v1.1.
Please use map-repeat instead."
#-}
|
memsim-master/src/memory-ram.adb | strenkml/EE368 | 0 | 11011 |
with Ada.Assertions; use Ada.Assertions;
with Device; use Device;
package body Memory.RAM is
function Create_RAM(latency : Time_Type := 1;
burst : Time_Type := 0;
word_size : Positive := 8;
word_count : Natural := 65536) return RAM_Pointer is
result : constant RAM_Pointer := new RAM_Type;
begin
result.latency := latency;
result.burst := burst;
result.word_size := word_size;
result.word_count := word_count;
return result;
end Create_RAM;
function Clone(mem : RAM_Type) return Memory_Pointer is
result : constant RAM_Pointer := new RAM_Type'(mem);
begin
return Memory_Pointer(result);
end Clone;
procedure Reset(mem : in out RAM_Type;
context : in Natural) is
begin
Reset(Memory_Type(mem), context);
mem.writes := 0;
end Reset;
procedure Read(mem : in out RAM_Type;
address : in Address_Type;
size : in Positive) is
word : constant Address_Type := Address_Type(mem.word_size);
offset : constant Natural := Natural(address mod word);
count : constant Natural := (size + mem.word_size + offset - 1) /
mem.word_size;
begin
Assert(address < Address_Type(2) ** Get_Address_Bits,
"invalid address in Memory.RAM.Read");
if mem.burst = 0 then
Advance(mem, mem.latency * Time_Type(count));
else
Advance(mem, mem.latency);
Advance(mem, mem.burst * Time_Type(count - 1));
end if;
end Read;
procedure Write(mem : in out RAM_Type;
address : in Address_Type;
size : in Positive) is
word : constant Address_Type := Address_Type(mem.word_size);
offset : constant Natural := Natural(address mod word);
count : constant Natural := (size + mem.word_size + offset - 1) /
mem.word_size;
begin
Assert(address < Address_Type(2) ** Get_Address_Bits,
"invalid address in Memory.RAM.Write");
if mem.burst = 0 then
Advance(mem, mem.latency * Time_Type(count));
else
Advance(mem, mem.latency);
Advance(mem, mem.burst * Time_Type(count - 1));
end if;
mem.writes := mem.writes + 1;
end Write;
function To_String(mem : RAM_Type) return Unbounded_String is
result : Unbounded_String;
begin
Append(result, "(ram ");
Append(result, "(latency" & Time_Type'Image(mem.latency) & ")");
if mem.burst /= 0 then
Append(result, "(burst" & Time_Type'Image(mem.burst) & ")");
end if;
Append(result, "(word_size" & Positive'Image(mem.word_size) & ")");
Append(result, "(word_count" & Natural'Image(mem.word_count) & ")");
Append(result, ")");
return result;
end To_String;
function Get_Cost(mem : RAM_Type) return Cost_Type is
begin
return 0;
end Get_Cost;
function Get_Writes(mem : RAM_Type) return Long_Integer is
begin
return mem.writes;
end Get_Writes;
function Get_Word_Size(mem : RAM_Type) return Positive is
begin
return mem.word_size;
end Get_Word_Size;
function Get_Ports(mem : RAM_Type) return Port_Vector_Type is
result : Port_Vector_Type;
port : constant Port_Type := Get_Port(mem);
begin
-- Emit a port if we aren't creating a model.
if mem.word_count = 0 then
result.Append(port);
end if;
return result;
end Get_Ports;
procedure Generate(mem : in RAM_Type;
sigs : in out Unbounded_String;
code : in out Unbounded_String) is
name : constant String := "m" & To_String(Get_ID(mem));
pname : constant String := "p" & To_String(Get_ID(mem));
words : constant Natural := mem.word_count;
word_bits : constant Natural := 8 * Get_Word_Size(mem);
latency : constant Time_Type := mem.latency;
burst : constant Time_Type := mem.burst;
begin
Declare_Signals(sigs, name, word_bits);
if words > 0 then
-- Emit a memory model.
Line(code, name & "_inst : entity work.ram");
Line(code, " generic map (");
Line(code, " ADDR_WIDTH => ADDR_WIDTH,");
Line(code, " WORD_WIDTH => " & To_String(word_bits) & ",");
Line(code, " SIZE => " & To_String(words) & ",");
Line(code, " LATENCY => " & To_String(latency) & ",");
Line(code, " BURST => " & To_String(burst));
Line(code, " )");
Line(code, " port map (");
Line(code, " clk => clk,");
Line(code, " rst => rst,");
Line(code, " addr => " & name & "_addr,");
Line(code, " din => " & name & "_din,");
Line(code, " dout => " & name & "_dout,");
Line(code, " re => " & name & "_re,");
Line(code, " we => " & name & "_we,");
Line(code, " mask => " & name & "_mask,");
Line(code, " ready => " & name & "_ready");
Line(code, " );");
else
-- No model; wire up a port.
Declare_Signals(sigs, pname, word_bits);
Line(code, pname & "_addr <= " & name & "_addr;");
Line(code, pname & "_din <= " & name & "_din;");
Line(code, name & "_dout <= " & pname & "_dout;");
Line(code, pname & "_re <= " & name & "_re;");
Line(code, pname & "_we <= " & name & "_we;");
Line(code, pname & "_mask <= " & name & "_mask;");
Line(code, name & "_ready <= " & pname & "_ready;");
end if;
end Generate;
end Memory.RAM;
|
src/errors/error_handling.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 25797 | package Error_Handling is
procedure Make_Safe;
-- The inverter is forced into a safe state.
end Error_Handling;
|
test/Fail/RewriteLhsReduction.agda | cruhland/agda | 1,989 | 11831 | {-# OPTIONS --rewriting #-}
open import Common.Equality
{-# BUILTIN REWRITE _≡_ #-}
postulate
A : Set
f g : A → A
f≡g : ∀ a → f a ≡ g a
{-# REWRITE f≡g #-}
-- Adding the same rule again would make Agda loop
postulate
f≡g' : ∀ a → f a ≡ g a
{-# REWRITE f≡g' #-}
goal : ∀ {a} → f a ≡ g a
goal = refl
|
test/Fail/Issue917.agda | cruhland/agda | 1,989 | 6744 | <reponame>cruhland/agda<gh_stars>1000+
open import Agda.Builtin.Nat
bar : Nat → Nat
bar n = let _!_ : Nat → Nat → Nat
x ! y = 2 * x ! y -- should give scope error in RHS
in n ! n
|
binutils-2.21.1/gcc-4.5.1/gcc/config/h8300/crtn.asm | cberner12/xv6 | 51 | 21918 | /* Copyright (C) 2001, 2009 Free Software Foundation, Inc.
This file was adapted from glibc sources.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
GCC 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.
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/>. */
/* See an explanation about .init and .fini in crti.asm. */
#ifdef __H8300H__
#ifdef __NORMAL_MODE__
.h8300hn
#else
.h8300h
#endif
#endif
#ifdef __H8300S__
#ifdef __NORMAL_MODE__
.h8300sn
#else
.h8300s
#endif
#endif
#ifdef __H8300SX__
#ifdef __NORMAL_MODE__
.h8300sxn
#else
.h8300sx
#endif
#endif
.section .init
rts
.section .fini
rts
|
windows-x64/tests/main_read.asm | mazoti/adler32 | 0 | 24073 | <reponame>mazoti/adler32<gh_stars>0
; int main(int argc, char** argv){
bits 64
default rel
global main
extern ExitProcess
extern GetCommandLineA
extern adler32file
extern printhex
extern print
%define STDOUT -11
%define STDERR -12
%macro cmd_line 1
inc rax
or byte [rax],0
je usage
cmp byte [rax],%1
%endmacro
%macro exit 1
mov rcx,%1
call ExitProcess
%endmacro
segment .data
usage_message db 10,'Usage: adler32 <file>',10
open_error db 10,'Error opening input file',10
close_error db 10,'Error closing input file',10
read_error db 10,'Error reading input file',10
segment .text
get_argv1:
call GetCommandLineA ; rax points to full command line string (ex: program.exe arg1 arg2)
cmp byte [rax],'"' ; works only when argc == 2 (skips program name)
jz skip_quotes
skip_char:
cmd_line ' '
jnz skip_char
jmp first_arg
skip_quotes:
cmd_line '"'
jz first_arg
jmp skip_quotes
first_arg:
cmd_line ' '
jz first_arg
ret
main:
call get_argv1
push rax
mov rcx,rax
push 1 ; rax points to input file address
lea rdx,[rsp]
call adler32file
mov rax,3
jmp process_error
mov rcx,STDOUT
pop rdx ; prints adler32 in hexadecimal
call printhex
mov rcx,STDOUT
lea rdx,[rel usage_message+7] ; prints one space
mov r8,1
call print
mov rax,[rsp]
xor r8,r8 ; calculates input file name size
argv1_size:
inc r8
or byte [rel rax+r8],0
jne argv1_size
pop rax
mov rcx,STDOUT
mov rdx,rax ; prints input filename
call print
mov rcx,STDOUT
lea rdx,[rel usage_message] ; prints one end of line (10)
mov r8,1
call print
exit 0
process_error:
mov rcx,STDERR
mov r8,26 ; error message size
cmp rax,2
je error_close_file
cmp rax,3
je error_read_file
error_open_file:
lea rdx,[rel open_error]
call print
exit 1
error_close_file:
lea rdx,[rel close_error]
call print
exit 2
error_read_file:
lea rdx,[rel read_error]
call print
exit 3
usage:
mov rcx,STDERR
lea rdx,[rel usage_message]
mov r8,23
call print
exit 4
|
tools/scitools/conf/understand/ada/ada95/i-cporte.ads | brucegua/moocos | 1 | 17878 | ------------------------------------------------------------------------------
-- --
-- GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS --
-- --
-- I N T E R F A C E S . C . P O S I X _ R T E --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- Copyright (c) 1991,1992,1993,1994, FSU, All Rights Reserved --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU Library General Public License as published by the --
-- Free Software Foundation; either version 2, or (at your option) any --
-- later version. GNARL is distributed in the hope that it will be use- --
-- ful, but but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Gen- --
-- eral Library Public License for more details. You should have received --
-- a copy of the GNU Library General Public License along with GNARL; see --
-- file COPYING.LIB. If not, write to the Free Software Foundation, 675 --
-- Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
-- This package interfaces with the POSIX real-time extensions. It may
-- also implement some of them using UNIX operations. It is not a complete
-- interface, it only includes what is needed to implement the Ada runtime.
with System;
-- temporarily, should really only be for 1 ???
with Interfaces.C.POSIX_Error; use Interfaces.C.POSIX_Error;
-- Used for, Return_Code
with Interfaces.C.System_Constants;
use Interfaces.C;
-- Used for, various constants
package Interfaces.C.POSIX_RTE is
pragma Elaborate_Body (Interfaces.C.POSIX_RTE);
Alignment : constant := Natural'Min (1, 8);
NSIG : constant := System_Constants.NSIG;
-- Maximum number of signal entries
type Signal is new int;
type Signal_Set is private;
procedure sigaddset
(set : access Signal_Set;
sig : in Signal;
Result : out POSIX_Error.Return_Code);
procedure sigdelset
(set : access Signal_Set;
sig : in Signal;
Result : out POSIX_Error.Return_Code);
procedure sigfillset
(set : access Signal_Set;
Result : out POSIX_Error.Return_Code);
procedure sigemptyset
(set : access Signal_Set;
Result : out POSIX_Error.Return_Code);
function sigismember
(set : access Signal_Set;
sig : Signal)
return Return_Code;
pragma Import (C, sigismember, "sigismember");
type sigval is record
u0 : int;
end record;
-- This is not used at the moment, need to update to reflect
-- any changes in the Pthreads signal.h in the future
type struct_siginfo is record
si_signo : Signal;
si_code : int;
si_value : sigval;
end record;
type siginfo_ptr is access struct_siginfo;
type sigset_t_ptr is access Signal_Set;
SIG_ERR : constant := System_Constants.SIG_ERR;
SIG_DFL : constant := System_Constants.SIG_DFL;
SIG_IGN : constant := System_Constants.SIG_IGN;
-- constants for sa_handler
type struct_sigaction is record
sa_handler : System.Address;
-- address of signal handler
sa_mask : aliased Signal_Set;
-- Additional signals to be blocked during
-- execution of signal-catching function
sa_flags : int;
-- Special flags to affect behavior of signal
end record;
type sigaction_ptr is access struct_sigaction;
-- Signal catching function (signal handler) has the following profile :
-- procedure Signal_Handler
-- (signo : Signal;
-- info : siginfo_ptr;
-- context : sigcontext_ptr);
SA_NOCLDSTOP : constant := System_Constants.SA_NOCLDSTOP;
-- Don't send a SIGCHLD on child stop
SA_SIGINFO : constant := System_Constants.SA_SIGINFO;
-- sa_flags flags for struct_sigaction
SIG_BLOCK : constant := System_Constants.SIG_BLOCK;
SIG_UNBLOCK : constant := System_Constants.SIG_UNBLOCK;
SIG_SETMASK : constant := System_Constants.SIG_SETMASK;
-- sigprocmask flags (how)
type jmp_buf is array
(1 .. System_Constants.jmp_buf_size) of unsigned;
for jmp_buf'Alignment use Alignment;
type sigjmp_buf is array
(1 .. System_Constants.sigjmp_buf_size) of unsigned;
for sigjmp_buf'Alignment use Alignment;
type jmp_buf_ptr is access jmp_buf;
type sigjmp_buf_ptr is access sigjmp_buf;
-- Environment for long jumps
procedure sigaction
(sig : Signal;
act : access struct_sigaction;
oact : access struct_sigaction;
Result : out Return_Code);
pragma Inline (sigaction);
-- install new sigaction structure and obtain old one
procedure sigaction
(sig : Signal;
oact : access struct_sigaction;
Result : out Return_Code);
pragma Inline (sigaction);
-- Same thing as above, but without the act parameter. By passing null
-- pointer we can find out the action associated with it.
-- WE WANT TO MAKE THIS VERSION TO INCLUDE THE PREVIOUS sigaction.
-- TO BE FIXED LATER ???
procedure sigprocmask
(how : int;
set : access Signal_Set;
oset : access Signal_Set;
Result : out Return_Code);
pragma Inline (sigprocmask);
-- Install new signal mask and obtain old one
procedure sigsuspend
(mask : access Signal_Set;
Result : out Return_Code);
pragma Inline (sigsuspend);
-- Suspend waiting for signals in mask and resume after
-- executing handler or take default action
procedure sigpending
(set : access Signal_Set;
Result : out Return_Code);
pragma Inline (sigpending);
-- get pending signals on thread and process
procedure longjmp (env : jmp_buf; val : int);
pragma Inline (longjmp);
-- execute a jump across procedures according to setjmp
procedure siglongjmp (env : sigjmp_buf; val : int);
pragma Inline (siglongjmp);
-- execute a jump across procedures according to sigsetjmp
procedure setjmp (env : jmp_buf; Result : out Return_Code);
pragma Inline (setjmp);
-- set up a jump across procedures and return here with longjmp
procedure sigsetjmp
(env : sigjmp_buf;
savemask : int;
Result : out Return_Code);
pragma Inline (sigsetjmp);
-- Set up a jump across procedures and return here with siglongjmp
SIGKILL : constant Signal := System_Constants.SIGKILL;
SIGSTOP : constant Signal := System_Constants.SIGSTOP;
-- Signals which cannot be masked
-- Some synchronous signals (cannot be used for interrupt entries)
SIGALRM : constant Signal := System_Constants.SIGALRM;
SIGILL : constant Signal := System_Constants.SIGILL;
SIGFPE : constant Signal := System_Constants.SIGFPE;
SIGSEGV : constant Signal := System_Constants.SIGSEGV;
SIGABRT : constant Signal := System_Constants.SIGABRT;
-- Signals which can be used for Interrupt Entries.
SIGHUP : constant Signal := System_Constants.SIGHUP;
SIGINT : constant Signal := System_Constants.SIGINT;
SIGQUIT : constant Signal := System_Constants.SIGQUIT;
SIGPIPE : constant Signal := System_Constants.SIGPIPE;
SIGTERM : constant Signal := System_Constants.SIGTERM;
SIGUSR1 : constant Signal := System_Constants.SIGUSR1;
SIGUSR2 : constant Signal := System_Constants.SIGUSR2;
SIGCHLD : constant Signal := System_Constants.SIGCHLD;
SIGCONT : constant Signal := System_Constants.SIGCONT;
SIGTSTP : constant Signal := System_Constants.SIGTSTP;
SIGTTIN : constant Signal := System_Constants.SIGTTIN;
SIGTTOU : constant Signal := System_Constants.SIGTTOU;
-- OS specific signals
type Signal_Array is array (positive range <>) of Signal;
OS_Specific_Sync_Signals :
Signal_Array (System_Constants.OS_Specific_Sync_Sigs'Range);
OS_Specific_Async_Signals :
Signal_Array (System_Constants.OS_Specific_Async_Sigs'Range);
private
type Signal_Set is array
(1 .. System_Constants.sigset_t_size) of unsigned;
for Signal_Set'Alignment use Alignment;
end Interfaces.C.POSIX_RTE;
|
test/asset/agda-stdlib-1.0/Relation/Binary/Construct/Never.agda | omega12345/agda-mode | 0 | 14856 | <reponame>omega12345/agda-mode
------------------------------------------------------------------------
-- The Agda standard library
--
-- The empty binary relation
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Relation.Binary.Construct.Never where
open import Relation.Binary
open import Relation.Binary.Construct.Constant
open import Data.Empty using (⊥)
open import Level using (Lift; lift)
------------------------------------------------------------------------
-- Definition
Never : ∀ {a ℓ} {A : Set a} → Rel A ℓ
Never = Const (Lift _ ⊥)
|
demo/tutorial/engines.ads | csb6/libtcod-ada | 0 | 756 | <filename>demo/tutorial/engines.ads
with Actors, Game_Maps, GUIs;
with Libtcod, Libtcod.Console, Libtcod.Maps, Libtcod.Input;
use Actors, Game_Maps, Libtcod;
package Engines is
type Game_Status is
(Status_Idle, Status_New_Turn, Status_Victory, Status_Defeat);
subtype Endgame_Status is Game_Status range Status_Victory .. Status_Defeat;
subtype Valid_Key_Type is Input.Key_Type
with Static_Predicate => Valid_Key_Type in Input.Arrow_Key_Type;
type Engine(width : Maps.X_Pos; height : Maps.Y_Pos) is tagged limited record
map : Game_Map(width, height);
gui : GUIs.GUI;
actor_list : Actor_Vector;
player_id : Actor_Id;
fov_radius : Maps.Radius;
status : Game_Status;
last_key_type : Valid_Key_Type;
end record;
function make_engine(w : Width; h : Height) return Engine;
procedure update(self : in out Engine);
procedure render(self : in out Engine; screen : in out Console.Screen);
function can_walk(self : Engine; x : Maps.X_Pos; y : Maps.Y_Pos) return Boolean;
function player(self : in out Engine) return Actor_Ref;
end Engines;
|
examples/shared/common/gui/hershey_fonts.adb | rocher/Ada_Drivers_Library | 192 | 23729 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package body Hershey_Fonts is
function Get_Glyph (C : Character) return Glyph_Index;
---------------
-- Get_Glyph --
---------------
function Get_Glyph (C : Character) return Glyph_Index
is
Ret : constant Integer := Character'Pos (C) - 31;
begin
if Ret <= 0 then
return Glyph_Index'First;
else
return Glyph_Index (Ret);
end if;
end Get_Glyph;
----------------
-- Draw_Glyph --
----------------
procedure Draw_Glyph
(Fnt : Hershey_Font;
C : Character;
X : in out Natural;
Y : Natural;
Height : Natural;
Bold : Boolean)
is
Ratio : constant Float := Float (Height) / Float (Fnt.Font_Height);
Thickness : Natural := Natural ((if Bold then 3.0 else 2.0) * Ratio);
G : constant Glyph := Fnt.Glyphs (Get_Glyph (C));
First : Boolean := True;
Current : Coord;
begin
if Thickness < 1 then
Thickness := 1;
end if;
for V in 1 .. G.Vertices loop
if G.Coords (V) = Raise_Pen then
First := True;
elsif First then
Current := G.Coords (V);
First := False;
else
declare
X0, Y0, X1, Y1 : Natural;
begin
X0 := Natural (Float (Current.X) * Ratio) + X;
Y0 := Natural (Float (Current.Y) * Ratio) + Y;
Current := G.Coords (V);
X1 := Natural (Float (Current.X) * Ratio) + X;
Y1 := Natural (Float (Current.Y) * Ratio) + Y;
Draw_Line (X0, Y0, X1, Y1, Thickness);
end;
end if;
end loop;
X := X + Natural (Float (G.Width) * Ratio);
end Draw_Glyph;
------------
-- Strlen --
------------
function Strlen (S : String;
Fnt : Hershey_Font;
Height : Natural) return Natural
is
Ret : Natural := 0;
Ratio : constant Float := Float (Height) / Float (Fnt.Font_Height);
begin
for C of S loop
declare
G : Glyph renames Fnt.Glyphs (Get_Glyph (C));
begin
Ret := Ret + Natural (Float (G.Width) * Ratio);
end;
end loop;
return Ret;
end Strlen;
----------
-- Read --
----------
function Read (Fnt : Font_Desc) return Hershey_Font
is
Ret : Hershey_Font;
begin
Read (Fnt, Ret);
return Ret;
end Read;
----------
-- Read --
----------
procedure Read (Fnt : Font_Desc;
Ret : out Hershey_Font)
is
Glyph_Idx : Natural := 0;
Fnt_Idx : Natural;
Fnt_Y_Min : Integer_8 := Integer_8'Last;
function To_UInt8 (S : String) return Natural;
-------------
-- To_UInt8 --
-------------
function To_UInt8 (S : String) return Natural
is
Ret : Natural := 0;
begin
for J in S'Range loop
if S (J) /= ' ' then
Ret := 10 * Ret + Character'Pos (S (J)) - Character'Pos ('0');
end if;
end loop;
return Ret;
end To_UInt8;
begin
Fnt_Idx := Fnt'First;
while Fnt_Idx <= Fnt'Last loop
-- Skip the 5 first characters of the glyph header
Fnt_Idx := Fnt_Idx + 5;
declare
Size : constant Natural := To_UInt8 (Fnt (Fnt_Idx .. Fnt_Idx + 2));
G : Glyph;
CStr : String (1 .. 2);
C : Coord;
Left : Integer_8;
XMin : Integer_8 := Integer_8'Last;
YMin : Integer_8 := Integer_8'Last;
XMax : Integer_8 := Integer_8'First;
YMax : Integer_8 := Integer_8'First;
begin
Fnt_Idx := Fnt_Idx + 3;
for Idx in 0 .. Size - 1 loop
for J in CStr'Range loop
while Fnt (Fnt_Idx) = ASCII.LF loop
Fnt_Idx := Fnt_Idx + 1;
end loop;
CStr (J) := Fnt (Fnt_Idx);
Fnt_Idx := Fnt_Idx + 1;
end loop;
if CStr = " R" then
G.Coords (Idx) := Raise_Pen;
else
C := (Character'Pos (CStr (1)) - Character'Pos ('R'),
Character'Pos (CStr (2)) - Character'Pos ('R'));
if Idx = 0 then
-- First coordinate tells the left and right borders of
-- the glyph.
Left := C.X;
G.Width := UInt8 (C.Y - C.X + 1);
else
C.X := C.X - Left;
XMin := Integer_8'Min (XMin, C.X);
YMin := Integer_8'Min (YMin, C.Y);
XMax := Integer_8'Max (XMax, C.X);
YMax := Integer_8'Max (XMax, C.Y);
G.Coords (Idx) := C;
end if;
end if;
end loop;
G.Vertices := Size - 1;
if G.Vertices = 0 then
G.Height := 0;
else
G.Height := UInt8 (YMax - YMin);
Fnt_Y_Min := Integer_8'Min (YMin, Fnt_Y_Min);
end if;
Glyph_Idx := Glyph_Idx + 1;
Ret.Glyphs (Glyph_Index (Glyph_Idx)) := G;
end;
end loop;
Ret.Number_Of_Glyphs := Glyph_Index (Glyph_Idx);
Ret.Font_Height := 0;
for Idx in 1 .. Ret.Number_Of_Glyphs loop
declare
G : Glyph renames Ret.Glyphs (Idx);
begin
for Vert in 1 .. G.Vertices loop
if G.Coords (Vert) /= Raise_Pen then
G.Coords (Vert).Y := G.Coords (Vert).Y - Fnt_Y_Min;
end if;
end loop;
Ret.Baseline := UInt8 (-Fnt_Y_Min);
Ret.Font_Height := UInt8'Max (Ret.Font_Height, G.Height);
end;
end loop;
end Read;
end Hershey_Fonts;
|
tests/regex_test_cases.adb | skordal/ada-regex | 2 | 16334 | <reponame>skordal/ada-regex
-- Ada regular expression library
-- (c) <NAME> 2020-2021 <<EMAIL>>
-- Report bugs and issues on <https://github.com/skordal/ada-regex>
with Ada.Characters.Latin_1;
with AUnit.Assertions; use AUnit.Assertions;
with Regex.Matchers; use Regex.Matchers;
with Regex.Regular_Expressions; use Regex.Regular_Expressions;
with Regex.Syntax_Trees; use Regex.Syntax_Trees;
package body Regex_Test_Cases is
procedure Test_Single_Character (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("a");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "b");
Matches (Test_Expr, "a");
end Test_Single_Character;
procedure Test_Kleene_Closure (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("a*");
begin
Matches_Empty_Strings (Test_Expr);
Matches (Test_Expr, "a");
Matches (Test_Expr, "aaaaaaaaaaa");
Does_Not_Match (Test_Expr, "g");
Does_Not_Match (Test_Expr, "bbsa");
end Test_Kleene_Closure;
procedure Test_Concatenation (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("ab");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "a");
Does_Not_Match (Test_Expr, "b");
Does_Not_Match (Test_Expr, "abc");
Matches (Test_Expr, "ab");
end Test_Concatenation;
procedure Test_Alternation_Single (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("a|b");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "ab");
Matches (Test_Expr, "a");
Matches (Test_Expr, "b");
end Test_Alternation_Single;
procedure Test_Alternation_Multiple (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("a|b|c|d");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Matches (Test_Expr, "a");
Matches (Test_Expr, "b");
Matches (Test_Expr, "c");
Matches (Test_Expr, "d");
Does_Not_Match (Test_Expr, "e");
end Test_Alternation_Multiple;
procedure Test_Dragon_Example (T : in out Test_Fixture) is
pragma Unreferenced (T);
-- Pattern borrowed from the chapter on regular expression parsing in the "Dragon Book":
Test_Expr : constant Regular_Expression := Create ("(a|b)*abb");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Matches (Test_Expr, "abbaaabb");
Matches (Test_Expr, "aabb");
Matches (Test_Expr, "bbbbabb");
end Test_Dragon_Example;
procedure Test_Any_Char_Single (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("a.c");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "ac");
Matches (Test_Expr, "abc");
end Test_Any_Char_Single;
procedure Test_Any_Char_Optional (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create (".*");
begin
Matches_Empty_Strings (Test_Expr);
Matches (Test_Expr, "abc");
end Test_Any_Char_Optional;
procedure Test_Any_Alternate (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("(a|.|b)bc");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Matches (Test_Expr, "abc");
Matches (Test_Expr, "bbc");
Matches (Test_Expr, "fbc");
Does_Not_Match (Test_Expr, "bc");
end Test_Any_Alternate;
procedure Test_Escape_Seqs (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("\.|\[|\]|\(|\)|\*|\+|\\|\||\?|\-");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Matches (Test_Expr, ".");
Matches (Test_Expr, "[");
Matches (Test_Expr, "]");
Matches (Test_Expr, "(");
Matches (Test_Expr, ")");
Matches (Test_Expr, "*");
Matches (Test_Expr, "+");
Matches (Test_Expr, "\");
Matches (Test_Expr, "|");
Matches (Test_Expr, "?");
Matches (Test_Expr, "-");
end Test_Escape_Seqs;
procedure Test_Quotes (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("a""b""c");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "abc");
Does_Not_Match (Test_Expr, "a""");
Does_Not_Match (Test_Expr, "a""b""");
Matches (Test_Expr, "a""b""c");
end Test_Quotes;
procedure Test_Single_Quotes (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("a'b'c");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "abc");
Does_Not_Match (Test_Expr, "a'");
Does_Not_Match (Test_Expr, "a'b'");
Matches (Test_Expr, "a'b'c");
end Test_Single_Quotes;
procedure Test_Single_Range (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("[a-c]d");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "a");
Does_Not_Match (Test_Expr, "b");
Does_Not_Match (Test_Expr, "c");
Does_Not_Match (Test_Expr, "abc");
Does_Not_Match (Test_Expr, "abcd");
Matches (Test_Expr, "ad");
Matches (Test_Expr, "bd");
Matches (Test_Expr, "cd");
end Test_Single_Range;
procedure Test_Multiple_Ranges (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("[a-cA-C0-1]");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "_");
Does_Not_Match (Test_Expr, "aC1");
Does_Not_Match (Test_Expr, "d");
Does_Not_Match (Test_Expr, "00");
Matches (Test_Expr, "a");
Matches (Test_Expr, "b");
Matches (Test_Expr, "c");
Matches (Test_Expr, "A");
Matches (Test_Expr, "B");
Matches (Test_Expr, "C");
Matches (Test_Expr, "0");
Matches (Test_Expr, "1");
end Test_Multiple_Ranges;
procedure Test_Ranges_And_Chars (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("[a-cfA-C_]");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "f_");
Matches (Test_Expr, "a");
Matches (Test_Expr, "b");
Matches (Test_Expr, "c");
Matches (Test_Expr, "A");
Matches (Test_Expr, "B");
Matches (Test_Expr, "C");
Matches (Test_Expr, "_");
Matches (Test_Expr, "f");
end Test_Ranges_And_Chars;
procedure Test_Plus_Operator (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("ab+");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "a");
Matches (Test_Expr, "ab");
Matches (Test_Expr, "abb");
Matches (Test_Expr, "abbb");
end Test_Plus_Operator;
procedure Test_Hexadecimal (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("0(x|X)[0-9a-fA-F]+");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "0");
Does_Not_Match (Test_Expr, "00");
Does_Not_Match (Test_Expr, "0x");
Does_Not_Match (Test_Expr, "0X");
Matches (Test_Expr, "0x0");
Matches (Test_Expr, "0xabcd1234");
Matches (Test_Expr, "0xdeadbeef");
end Test_Hexadecimal;
procedure Test_Question_Operator (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("a?b");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Matches (Test_Expr, "ab");
Matches (Test_Expr, "b");
Does_Not_Match (Test_Expr, "aab");
Does_Not_Match (Test_Expr, "abb");
Does_Not_Match (Test_Expr, "aa");
Does_Not_Match (Test_Expr, "bb");
end Test_Question_Operator;
procedure Test_Partial_Matching (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("abc");
begin
declare
Complete : Boolean;
Partial_Match : constant String := Get_Match (Test_Expr, "abff", Complete);
begin
Assert (not Complete, "partial match is reported as complete match");
Assert (Partial_Match = "ab", "partial match is incorrect");
end;
declare
Complete : Boolean;
Full_Match : constant String := Get_Match (Test_Expr, "abcdef", Complete);
begin
Assert (Complete, "full match is reported as incomplete match");
Assert (Full_Match = "abc", "full match is incorrect");
end;
declare
Complete : Boolean;
No_Match : constant String := Get_Match (Test_Expr, "bbdd", Complete);
begin
Assert (not Complete, "no match is reported as complete match");
Assert (No_Match'Length = 0, "incorrect partial match for string that should not match");
end;
end Test_Partial_Matching;
procedure Test_Newlines (T : in out Test_Fixture) is
pragma Unreferenced (T);
Test_Expr : constant Regular_Expression := Create ("aab\n|bc\r|df\r\n");
begin
Does_Not_Match_Empty_Strings (Test_Expr);
Does_Not_Match (Test_Expr, "aab");
Does_Not_Match (Test_Expr, "bc");
Does_Not_Match (Test_Expr, "df");
Does_Not_Match (Test_Expr, "aab" & Ada.Characters.Latin_1.CR);
Matches (Test_Expr, "aab" & Ada.Characters.Latin_1.LF);
Does_Not_Match (Test_Expr, "bc" & Ada.Characters.Latin_1.LF);
Matches (Test_Expr, "bc" & Ada.Characters.Latin_1.CR);
Does_Not_Match (Test_Expr, "df" & Ada.Characters.Latin_1.LF);
Does_Not_Match (Test_Expr, "df" & Ada.Characters.Latin_1.CR);
Matches (Test_Expr, "df" & Ada.Characters.Latin_1.CR & Ada.Characters.Latin_1.LF);
end Test_Newlines;
procedure Test_Syntax_Tree_Compile (T : in out Test_Fixture) is
pragma Unreferenced (T);
Original_Expression : constant Regular_Expression := Create ("abc|ef");
Test_Tree : Syntax_Tree_Node_Access := Clone_Tree (Original_Expression.Get_Syntax_Tree);
Test_Expr : constant Regular_Expression := Create (Test_Tree);
begin
Free_Recursively (Test_Tree);
Does_Not_Match_Empty_Strings (Test_Expr);
Matches (Test_Expr, "abc");
Matches (Test_Expr, "ef");
end Test_Syntax_Tree_Compile;
procedure Test_Multiple_Accept (T : in out Test_Fixture) is
pragma Unreferenced (T);
First_Expression : constant Regular_Expression := Create ("abc");
Second_Expression : constant Regular_Expression := Create ("def");
begin
Get_Acceptance_Node (First_Expression.Get_Syntax_Tree).Acceptance_Id := 1;
Get_Acceptance_Node (Second_Expression.Get_Syntax_Tree).Acceptance_Id := 2;
declare
Id_Counter : Natural := 1;
Combined_Tree : Syntax_Tree_Node_Access := Create_Node (
Node_Type => Alternation,
Id => 0,
Left_Child => Clone_Tree (First_Expression.Get_Syntax_Tree, Id_Counter),
Right_Child => Clone_Tree (Second_Expression.Get_Syntax_Tree, Id_Counter));
Test_Expr : constant Regular_Expression := Create (Combined_Tree);
begin
Free_Recursively (Combined_Tree);
Does_Not_Match_Empty_Strings (Test_Expr);
Matches (Test_Expr, "abc", 1);
Matches (Test_Expr, "def", 2);
end;
end Test_Multiple_Accept;
------ Test utility functions -----
procedure Matches_Empty_Strings (Regex : in Regular_Expression) is
begin
Assert (Matches (Regex, ""), "regex does not match the empty string");
end Matches_Empty_Strings;
procedure Does_Not_Match_Empty_Strings (Regex : in Regular_Expression) is
begin
Assert (not Matches (Regex, ""), "regex matches the empty string");
end Does_Not_Match_Empty_Strings;
procedure Matches (Regex : in Regular_Expression; Matching : in String) is
begin
Assert (Matches (Regex, Matching), "regex does not match correct input string '"
& Matching & "'");
end Matches;
procedure Matches (Regex : in Regular_Expression; Matching : in String; Expected_Id : in Natural) is
Match_Id : Natural;
begin
Assert (Matches (Regex, Matching, Match_Id), "regex does not match correct input string '"
& Matching & "'");
Assert (Match_Id = Expected_Id, "expected match ID ( " & Natural'Image (Expected_Id)
& ") does not match actual match ID (" & Natural'Image (Match_Id) & ")");
end Matches;
procedure Does_Not_Match (Regex : in Regular_Expression; Not_Matching : in String) is
begin
Assert (not Matches (Regex, Not_Matching), "regex matches incorrect input string '"
& Not_Matching & "'");
end Does_Not_Match;
end Regex_Test_Cases;
|
oeis/129/A129952.asm | neoneye/loda-programs | 11 | 17032 | ; A129952: Binomial transform of A124625.
; 1,1,2,6,16,40,96,224,512,1152,2560,5632,12288,26624,57344,122880,262144,557056,1179648,2490368,5242880,11010048,23068672,48234496,100663296,209715200,436207616,905969664,1879048192,3892314112,8053063680,16642998272,34359738368,70866960384,146028888064,300647710720,618475290624,1271310319616,2611340115968,5360119185408,10995116277760,22539988369408,46179488366592,94557999988736,193514046488576,395824185999360,809240558043136,1653665488175104,3377699720527872,6896136929411072,14073748835532800
mov $1,2
pow $1,$0
mul $1,$0
sub $1,7
div $1,4
add $1,2
mov $0,$1
|
Transynther/x86/_processed/NC/_st_sm_/i7-8650U_0xd2_notsx.log_8_927.asm | ljhsiun2/medusa | 9 | 164858 | <filename>Transynther/x86/_processed/NC/_st_sm_/i7-8650U_0xd2_notsx.log_8_927.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r9
push %rbx
push %rdi
push %rdx
lea addresses_A_ht+0xeb1a, %rdx
xor %r9, %r9
mov $0x6162636465666768, %r13
movq %r13, (%rdx)
nop
lfence
lea addresses_A_ht+0x9cdd, %r13
nop
nop
xor %rbx, %rbx
movl $0x61626364, (%r13)
nop
nop
nop
nop
nop
add %r13, %r13
lea addresses_A_ht+0xee3a, %r14
nop
nop
nop
nop
nop
sub $39751, %rdi
and $0xffffffffffffffc0, %r14
vmovaps (%r14), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %r9
nop
nop
xor $24677, %r9
pop %rdx
pop %rdi
pop %rbx
pop %r9
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %rbp
push %rbx
push %rcx
push %rdx
// Store
lea addresses_UC+0x627a, %rbx
nop
nop
nop
nop
nop
sub %r14, %r14
movb $0x51, (%rbx)
nop
dec %r10
// Store
mov $0x753ee2000000089a, %r10
inc %r13
mov $0x5152535455565758, %rbx
movq %rbx, %xmm1
movups %xmm1, (%r10)
nop
nop
nop
nop
nop
xor $37371, %rcx
// Store
mov $0x6936f9000000011a, %r14
nop
nop
nop
nop
nop
xor $23578, %r13
movw $0x5152, (%r14)
nop
nop
add %rdx, %rdx
// Load
lea addresses_A+0x17dc2, %r14
clflush (%r14)
nop
nop
and $19427, %rbp
mov (%r14), %rcx
nop
nop
nop
nop
and %r14, %r14
// Faulty Load
mov $0x6936f9000000011a, %r14
nop
add %rbp, %rbp
movb (%r14), %dl
lea oracles, %rbx
and $0xff, %rdx
shlq $12, %rdx
mov (%rbx,%rdx,1), %rdx
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'52': 8}
52 52 52 52 52 52 52 52
*/
|
Driver/Printer/PrintCom/Color/Correct/correctGamma27.asm | steakknife/pcgeos | 504 | 4810 | <filename>Driver/Printer/PrintCom/Color/Correct/correctGamma27.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: DotMatrix printers
FILE: correctGamma27.asm
AUTHOR: <NAME>, May 27, 1992
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 5/27/92 Initial revision
DESCRIPTION:
Gamma correction table for printing
$Id: correctGamma27.asm,v 1.1 97/04/18 11:51:33 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
gamma27 segment resource
; A Gamma-correction table for GAMMA = 2.70
byte 0x00, 0x21, 0x2a, 0x31, 0x37, 0x3b, 0x40, 0x43
byte 0x47, 0x4a, 0x4d, 0x50, 0x52, 0x55, 0x57, 0x59
byte 0x5b, 0x5e, 0x60, 0x61, 0x63, 0x65, 0x67, 0x69
byte 0x6a, 0x6c, 0x6d, 0x6f, 0x71, 0x72, 0x73, 0x75
byte 0x76, 0x78, 0x79, 0x7a, 0x7b, 0x7d, 0x7e, 0x7f
byte 0x80, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88
byte 0x89, 0x8a, 0x8b, 0x8c, 0x8e, 0x8f, 0x90, 0x90
byte 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98
byte 0x99, 0x9a, 0x9b, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
byte 0xa0, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa5
byte 0xa6, 0xa7, 0xa8, 0xa8, 0xa9, 0xaa, 0xaa, 0xab
byte 0xac, 0xad, 0xad, 0xae, 0xaf, 0xb0, 0xb0, 0xb1
byte 0xb2, 0xb2, 0xb3, 0xb4, 0xb4, 0xb5, 0xb6, 0xb6
byte 0xb7, 0xb8, 0xb8, 0xb9, 0xba, 0xba, 0xbb, 0xbb
byte 0xbc, 0xbd, 0xbd, 0xbe, 0xbe, 0xbf, 0xc0, 0xc0
byte 0xc1, 0xc1, 0xc2, 0xc3, 0xc3, 0xc4, 0xc4, 0xc5
byte 0xc6, 0xc6, 0xc7, 0xc7, 0xc8, 0xc8, 0xc9, 0xc9
byte 0xca, 0xcb, 0xcb, 0xcc, 0xcc, 0xcd, 0xcd, 0xce
byte 0xce, 0xcf, 0xcf, 0xd0, 0xd0, 0xd1, 0xd2, 0xd2
byte 0xd3, 0xd3, 0xd4, 0xd4, 0xd5, 0xd5, 0xd6, 0xd6
byte 0xd7, 0xd7, 0xd8, 0xd8, 0xd9, 0xd9, 0xda, 0xda
byte 0xda, 0xdb, 0xdb, 0xdc, 0xdc, 0xdd, 0xdd, 0xde
byte 0xde, 0xdf, 0xdf, 0xe0, 0xe0, 0xe1, 0xe1, 0xe2
byte 0xe2, 0xe2, 0xe3, 0xe3, 0xe4, 0xe4, 0xe5, 0xe5
byte 0xe6, 0xe6, 0xe6, 0xe7, 0xe7, 0xe8, 0xe8, 0xe9
byte 0xe9, 0xe9, 0xea, 0xea, 0xeb, 0xeb, 0xec, 0xec
byte 0xec, 0xed, 0xed, 0xee, 0xee, 0xef, 0xef, 0xef
byte 0xf0, 0xf0, 0xf1, 0xf1, 0xf1, 0xf2, 0xf2, 0xf3
byte 0xf3, 0xf3, 0xf4, 0xf4, 0xf5, 0xf5, 0xf5, 0xf6
byte 0xf6, 0xf7, 0xf7, 0xf7, 0xf8, 0xf8, 0xf9, 0xf9
byte 0xf9, 0xfa, 0xfa, 0xfa, 0xfb, 0xfb, 0xfc, 0xfc
byte 0xfc, 0xfd, 0xfd, 0xfe, 0xfe, 0xfe, 0xff, 0xff
gamma27 ends
|
oeis/048/A048504.asm | neoneye/loda-programs | 11 | 4891 | ; A048504: a(n) = T(n,n), array T given by A048494.
; 1,2,7,28,101,326,967,2696,7177,18442,46091,112652,270349,638990,1490959,3440656,7864337,17825810,40108051,89653268,199229461,440401942,968884247,2122317848,4630511641,10066329626,21810380827,47110422556,101468602397,217969590302,467077693471,998579896352,2130303778849,4535485464610,9637906612259,20444044328996,43293270343717,91534343012390,193239168581671,407369058091048,857619069665321,1803199069552682,3786718046060587,7942871999053868,16642207998017581,34832528367943726,72831650223882287
mov $1,2
pow $1,$0
mov $2,$0
bin $0,2
mul $0,$1
add $0,$2
add $0,1
|
Univalence/EnumEquiv.agda | JacquesCarette/pi-dual | 14 | 13383 | {-# OPTIONS --without-K #-}
module EnumEquiv where
open import Data.Empty using (⊥; ⊥-elim)
open import Data.Nat using (ℕ; _+_)
open import Data.Fin using (Fin; inject+; raise)
open import Data.Sum using (_⊎_; inj₁; inj₂)
open import Data.Product using (_,_; proj₁; proj₂)
open import Function using (_∘_)
open import Relation.Binary.PropositionalEquality
using (_≡_; refl; cong; module ≡-Reasoning)
open import Equiv using (_≃_; trans≃; _⊎≃_; iseq; module isequiv)
open import FinEquiv using (Fin0-⊥; module Plus)
open Plus using (+≃⊎; ⊎≃+)
------------------------------------------------------------------------------
-- An equivalence between a set 'A' and a finite set 'Fin n' is an
-- enumeration of A.
Enum : ∀ {ℓ} → (A : Set ℓ) → (n : ℕ) → Set ℓ
Enum A n = A ≃ Fin n
-- We only need some additive equivalences...
0E : Enum ⊥ 0
0E = ⊥-elim , iseq Fin0-⊥ (λ { () }) Fin0-⊥ (λ { () })
_⊕e_ : {A : Set} {B : Set} {n m : ℕ} →
Enum A n → Enum B m → Enum (A ⊎ B) (n + m)
eA ⊕e eB = trans≃ (eA ⊎≃ eB) ⊎≃+
-- shorthand to select the element indexed by i in the enumeration
select : {A B : Set} (eq : A ≃ B) → (B → A)
select (_ , iseq g _ _ _) = g
-- The enumeration of (A ⊎ B) is an enumeration of A followed by an
-- enumeration of B; in other words if we have an equivalence between
-- (A ⊎ B) and Fin (m + n) and we are given an index i < m then this
-- index selects an element of A.
-- evaluating an ⊕e on the left component
eval-left : {A B : Set} {m n : ℕ} {eA : Enum A m} {eB : Enum B n} (i : Fin m) →
select (eA ⊕e eB) (inject+ n i) ≡ inj₁ (select eA i)
eval-left {m = m} {n} {eA} {eB} i =
let (fwd , iseq bwd _ _ bwd∘fwd~id) = ⊎≃+ {m} {n} in
begin (
select (eA ⊕e eB) (inject+ n i)
≡⟨ refl ⟩ -- β reduce ⊕e, reverse-β Plus.fwd
select (trans≃ (eA ⊎≃ eB) ⊎≃+) (fwd (inj₁ i))
≡⟨ refl ⟩ -- expand qinv.g and trans≃
select (eA ⊎≃ eB) (select ⊎≃+ (fwd (inj₁ i)))
≡⟨ refl ⟩ -- expand rhs
select (eA ⊎≃ eB) ((bwd ∘ fwd) (inj₁ i))
≡⟨ cong (select (eA ⊎≃ eB)) (bwd∘fwd~id (inj₁ i)) ⟩
select (eA ⊎≃ eB) (inj₁ i)
≡⟨ refl ⟩ -- by definition of path⊎
inj₁ (select eA i) ∎)
where open ≡-Reasoning
eval-right : {A B : Set} {m n : ℕ} {eA : Enum A m} {eB : Enum B n} →
(i : Fin n) → select (eA ⊕e eB) (raise m i) ≡ inj₂ (select eB i)
eval-right {eA = eA} {eB} i =
cong (select (eA ⊎≃ eB)) (isequiv.β (proj₂ ⊎≃+) (inj₂ i))
------------------------------------------------------------------------------
-- We can also do the same for multiplication but it's not needed
-- _⊛e_ : {A B : Set} {n m : ℕ} → Enum A n → Enum B m → Enum (A × B) (n * m)
-- eA ⊛e eB = trans≃ (path× eA eB) Times.fwd-iso
--
-- etc.
------------------------------------------------------------------------------
|
Task/Sierpinski-carpet/AppleScript/sierpinski-carpet-2.applescript | LaudateCorpus1/RosettaCodeData | 1 | 3941 | -- weave :: [String] -> [String]
on weave(xs)
script thread
property f : zipWith(my append)
on |λ|(x)
f's |λ|(f's |λ|(xs, x), xs)
end |λ|
end script
script blank
on |λ|(x)
replicate(length of x, space)
end |λ|
end script
concatMap(thread, {xs, map(blank, xs), xs})
end weave
-- TEST ---------------------------------------------------
on run
-- sierpinksi :: Int -> String
script sierpinski
on |λ|(n)
unlines(item n of take(n, ¬
iterate(weave, {character id 9608})))
end |λ|
end script
sierpinski's |λ|(3)
end run
-- GENERIC ABSTRACTIONS -----------------------------------
-- Append two lists.
-- append (++) :: [a] -> [a] -> [a]
-- append (++) :: String -> String -> String
on append(xs, ys)
xs & ys
end append
-- concatMap :: (a -> [b]) -> [a] -> [b]
on concatMap(f, xs)
set lng to length of xs
set acc to {}
tell mReturn(f)
repeat with i from 1 to lng
set acc to acc & |λ|(item i of xs, i, xs)
end repeat
end tell
return acc
end concatMap
-- iterate :: (a -> a) -> a -> Gen [a]
on iterate(f, x)
script
property v : missing value
property g : mReturn(f)'s |λ|
on |λ|()
if missing value is v then
set v to x
else
set v to g(v)
end if
return v
end |λ|
end script
end iterate
-- length :: [a] -> Int
on |length|(xs)
set c to class of xs
if list is c or string is c then
length of xs
else
(2 ^ 29 - 1) -- (maxInt - simple proxy for non-finite)
end if
end |length|
-- Lift 2nd class handler function into 1st class script wrapper
-- mReturn :: First-class m => (a -> b) -> m (a -> b)
on mReturn(f)
if class of f is script then
f
else
script
property |λ| : f
end script
end if
end mReturn
-- map :: (a -> b) -> [a] -> [b]
on map(f, xs)
tell mReturn(f)
set lng to length of xs
set lst to {}
repeat with i from 1 to lng
set end of lst to |λ|(item i of xs, i, xs)
end repeat
return lst
end tell
end map
-- min :: Ord a => a -> a -> a
on min(x, y)
if y < x then
y
else
x
end if
end min
-- replicate :: Int -> String -> String
on replicate(n, s)
set out to ""
if n < 1 then return out
set dbl to s
repeat while (n > 1)
if (n mod 2) > 0 then set out to out & dbl
set n to (n div 2)
set dbl to (dbl & dbl)
end repeat
return out & dbl
end replicate
-- take :: Int -> [a] -> [a]
-- take :: Int -> String -> String
on take(n, xs)
set c to class of xs
if list is c then
if 0 < n then
items 1 thru min(n, length of xs) of xs
else
{}
end if
else if string is c then
if 0 < n then
text 1 thru min(n, length of xs) of xs
else
""
end if
else if script is c then
set ys to {}
repeat with i from 1 to n
set v to xs's |λ|()
if missing value is v then
return ys
else
set end of ys to v
end if
end repeat
return ys
else
missing value
end if
end take
-- unlines :: [String] -> String
on unlines(xs)
set {dlm, my text item delimiters} to ¬
{my text item delimiters, linefeed}
set str to xs as text
set my text item delimiters to dlm
str
end unlines
-- zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
on zipWith(f)
script
on |λ|(xs, ys)
set lng to min(|length|(xs), |length|(ys))
if 1 > lng then return {}
set xs_ to take(lng, xs) -- Allow for non-finite
set ys_ to take(lng, ys) -- generators like cycle etc
set lst to {}
tell mReturn(f)
repeat with i from 1 to lng
set end of lst to |λ|(item i of xs_, item i of ys_)
end repeat
return lst
end tell
end |λ|
end script
end zipWith
|
Cubical/Algebra/SymmetricGroup.agda | dan-iel-lee/cubical | 0 | 7312 | {-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Algebra.SymmetricGroup where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.HLevels
open import Cubical.Data.Sigma
open import Cubical.Data.Nat using (ℕ ; suc ; zero)
open import Cubical.Data.Fin using (Fin ; isSetFin)
open import Cubical.Data.Empty
open import Cubical.Relation.Nullary using (¬_)
open import Cubical.Algebra.Group
private
variable
ℓ : Level
Symmetric-Group : (X : Type ℓ) → isSet X → Group {ℓ}
Symmetric-Group X isSetX = makeGroup (idEquiv X) compEquiv invEquiv (isOfHLevel≃ 2 isSetX isSetX)
compEquiv-assoc compEquivEquivId compEquivIdEquiv invEquiv-is-rinv invEquiv-is-linv
-- Finite symmetrics groups
Sym : ℕ → Group
Sym n = Symmetric-Group (Fin n) isSetFin
|
itunes_sort_groups.applescript | Bilalh/Scripts | 0 | 4553 | <gh_stars>0
var app = Application.currentApplication()
app.includeStandardAdditions = true
var tracks = Application('iTunes').selection()
var kinds = new Set();
var disallow = new Set();
for (var item of ["spring", "eng", "mbl", "great", "ps2", "Winter", "nice", "ex'",
"latin", "spring 2010", "Winter 2011", "Great", "bg", "dq", "zmain"]){
disallow.add(item);
}
mapping = {"in" : "yInsert" }
function rejector (x){
if (!x){
return false;
}else{
return ( !disallow.has(x));
}
}
function changer(x){
if (x in mapping){
return mapping[x];
}else{
return x;
}
}
for (var track of tracks) {
if (track.grouping().indexOf(',') !== -1 ){
parts = track.grouping().split(',');
parts = parts.map( function (x) { return x.trim() } );
parts = parts.map( changer );
parts = parts.filter( rejector );
if (parts.length >0){
for (var part of parts){ kinds.add(part); }
new_grouping = parts.sort().map(function(x){return x + "," } ).join(' ')
if (track.grouping() != new_grouping){
track.grouping = new_grouping;
}
}
}
}
for (var item of kinds) console.log(item);
|
notes/FOT/Agsy/AxiomaticPA.agda | asr/fotc | 11 | 5976 | ------------------------------------------------------------------------------
-- Axiomatic Peano arithmetic using Agsy
------------------------------------------------------------------------------
{-# OPTIONS --allow-unsolved-metas #-}
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOT.Agsy.AxiomaticPA where
open import Common.FOL.FOL public renaming ( D to ℕ )
infixl 10 _*_
infix 7 _≐_
infixl 9 _+_
------------------------------------------------------------------------------
-- Non-logical constants
postulate
zero : ℕ
succ : ℕ → ℕ
_+_ : ℕ → ℕ → ℕ
_*_ : ℕ → ℕ → ℕ
_≐_ : ℕ → ℕ → Set
-- Proper axioms
-- (From <NAME>. Introduction to mathematical
-- logic. Chapman & Hall, 4th edition, 1997, p. 155)
-- N.B. We make the recursion in the first argument for _+_ and _*_.
-- S₁. m = n → m = o → n = o
-- S₂. m = n → succ m = succ n
-- S₃. 0 ≠ succ n
-- S₄. succ m = succ n → m = n
-- S₅. 0 + n = n
-- S₆. succ m + n = succ (m + n)
-- S₇. 0 * n = 0
-- S₈. succ m * n = (m * n) + m
-- S₉. P(0) → (∀n.P(n) → P(succ n)) → ∀n.P(n), for any wf P(n) of PA.
postulate
S₁ : {m n o : ℕ} → m ≐ n → m ≐ o → n ≐ o
S₂ : ∀ {m n} → m ≐ n → succ m ≐ succ n
S₃ : ∀ {n} → ¬ (zero ≐ succ n)
S₄ : ∀ {m n} → succ m ≐ succ n → m ≐ n
S₅ : ∀ n → zero + n ≐ n
S₆ : ∀ m n → succ m + n ≐ succ (m + n)
S₇ : ∀ n → zero * n ≐ zero
S₈ : ∀ m n → succ m * n ≐ n + m * n
S₉ : (A : ℕ → Set) → A zero → (∀ n → A n → A (succ n)) → ∀ n → A n
-- Properties
refl : ∀ {n} → n ≐ n
refl {n} = S₁ (S₅ n) (S₅ n) -- Via Agsy {-m}
sym : ∀ {m n} → m ≐ n → n ≐ m
sym h = S₁ h refl -- Via Agsy {-m}
trans : ∀ {m n o} → m ≐ n → n ≐ o → m ≐ o
trans h₁ h₂ = S₁ (sym h₁) h₂ -- Via Agsy {-m}
+-rightIdentity : ∀ n → n + zero ≐ n
+-rightIdentity n = {!-t 20 -m!} -- Agsy fails
|
src/keystore-tools.ads | thierr26/ada-keystore | 25 | 23421 | <filename>src/keystore-tools.ads<gh_stars>10-100
-----------------------------------------------------------------------
-- keystore-tools -- Tools for the keystore
-- Copyright (C) 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Directories;
package Keystore.Tools is
subtype Directory_Entry_Type is Ada.Directories.Directory_Entry_Type;
-- Store the file in the keystore and use the prefix followed by the file basename
-- for the name to identify the stored the content.
procedure Store (Wallet : in out Keystore.Wallet'Class;
Path : in String;
Prefix : in String);
-- Scan the directory for files matching the pattern and store them in the
-- keystore when the filter predicate accepts them.
procedure Store (Wallet : in out Keystore.Wallet'Class;
Path : in String;
Prefix : in String;
Pattern : in String;
Filter : not null
access function (Ent : in Directory_Entry_Type) return Boolean);
end Keystore.Tools;
|
Definition/LogicalRelation/Substitution/Introductions/Pi.agda | loic-p/logrel-mltt | 0 | 6667 | <filename>Definition/LogicalRelation/Substitution/Introductions/Pi.agda
{-# OPTIONS --without-K --safe #-}
open import Definition.Typed.EqualityRelation
module Definition.LogicalRelation.Substitution.Introductions.Pi {{eqrel : EqRelSet}} where
open EqRelSet {{...}}
open import Definition.Untyped as U hiding (wk)
open import Definition.Untyped.Properties
open import Definition.Typed
open import Definition.Typed.Weakening using (_∷_⊆_)
open import Definition.Typed.Properties
open import Definition.LogicalRelation
open import Definition.LogicalRelation.ShapeView
open import Definition.LogicalRelation.Weakening
open import Definition.LogicalRelation.Irrelevance
open import Definition.LogicalRelation.Properties
open import Definition.LogicalRelation.Substitution
open import Definition.LogicalRelation.Substitution.Weakening
open import Definition.LogicalRelation.Substitution.Properties
import Definition.LogicalRelation.Substitution.Irrelevance as S
open import Definition.LogicalRelation.Substitution.Introductions.Universe
open import Tools.Nat
open import Tools.Product
import Tools.PropositionalEquality as PE
-- Validity of Π.
Πᵛ : ∀ {F G Γ l}
([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
→ Γ ∙ F ⊩ᵛ⟨ l ⟩ G / ([Γ] ∙″ [F])
→ Γ ⊩ᵛ⟨ l ⟩ Π F ▹ G / [Γ]
Πᵛ {F} {G} {Γ} {l} [Γ] [F] [G] {Δ = Δ} {σ = σ} ⊢Δ [σ] =
let [F]σ {σ′} [σ′] = [F] {σ = σ′} ⊢Δ [σ′]
[σF] = proj₁ ([F]σ [σ])
⊢F {σ′} [σ′] = escape (proj₁ ([F]σ {σ′} [σ′]))
⊢F≡F = escapeEq [σF] (reflEq [σF])
[G]σ {σ′} [σ′] = [G] {σ = liftSubst σ′} (⊢Δ ∙ ⊢F [σ′])
(liftSubstS {F = F} [Γ] ⊢Δ [F] [σ′])
⊢G {σ′} [σ′] = escape (proj₁ ([G]σ {σ′} [σ′]))
⊢G≡G = escapeEq (proj₁ ([G]σ [σ])) (reflEq (proj₁ ([G]σ [σ])))
⊢ΠF▹G = Πⱼ ⊢F [σ] ▹ ⊢G [σ]
[G]a : ∀ {ρ Δ₁} a ([ρ] : ρ ∷ Δ₁ ⊆ Δ) (⊢Δ₁ : ⊢ Δ₁)
([a] : Δ₁ ⊩⟨ l ⟩ a ∷ subst (ρ •ₛ σ) F
/ proj₁ ([F] ⊢Δ₁ (wkSubstS [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ])))
→ Σω₀ (Δ₁ ⊩⟨ l ⟩ subst (consSubst (ρ •ₛ σ) a) G)
(λ [Aσ] →
{σ′ : Nat → Term} →
(Σω₂ (Δ₁ ⊩ˢ tail σ′ ∷ Γ / [Γ] / ⊢Δ₁)
(λ [tailσ] →
Δ₁ ⊩⟨ l ⟩ head σ′ ∷ subst (tail σ′) F / proj₁ ([F] ⊢Δ₁ [tailσ]))) →
Δ₁ ⊩ˢ consSubst (ρ •ₛ σ) a ≡ σ′ ∷ Γ ∙ F /
[Γ] ∙″ [F] / ⊢Δ₁ /
consSubstS {t = a} {A = F} [Γ] ⊢Δ₁ (wkSubstS [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ]) [F]
[a] →
Δ₁ ⊩⟨ l ⟩ subst (consSubst (ρ •ₛ σ) a) G ≡
subst σ′ G / [Aσ])
[G]a {ρ} a [ρ] ⊢Δ₁ [a] = ([G] {σ = consSubst (ρ •ₛ σ) a} ⊢Δ₁
(consSubstS {t = a} {A = F} [Γ] ⊢Δ₁
(wkSubstS [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ])
[F] [a]))
[G]a′ : ∀ {ρ Δ₁} a ([ρ] : ρ ∷ Δ₁ ⊆ Δ) (⊢Δ₁ : ⊢ Δ₁)
→ Δ₁ ⊩⟨ l ⟩ a ∷ subst (ρ •ₛ σ) F
/ proj₁ ([F] ⊢Δ₁ (wkSubstS [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ]))
→ Δ₁ ⊩⟨ l ⟩ U.wk (lift ρ) (subst (liftSubst σ) G) [ a ]
[G]a′ a ρ ⊢Δ₁ [a] = irrelevance′ (PE.sym (singleSubstWkComp a σ G))
(proj₁ ([G]a a ρ ⊢Δ₁ [a]))
in Πᵣ′ (subst σ F) (subst (liftSubst σ) G)
(idRed:*: ⊢ΠF▹G) (⊢F [σ]) (⊢G [σ]) (≅-Π-cong (⊢F [σ]) ⊢F≡F ⊢G≡G)
(λ ρ ⊢Δ₁ → wk ρ ⊢Δ₁ [σF])
(λ {ρ} {Δ₁} {a} [ρ] ⊢Δ₁ [a] →
let [a]′ = irrelevanceTerm′
(wk-subst F) (wk [ρ] ⊢Δ₁ [σF])
(proj₁ ([F] ⊢Δ₁ (wkSubstS [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ]))) [a]
in [G]a′ a [ρ] ⊢Δ₁ [a]′)
(λ {ρ} {Δ₁} {a} {b} [ρ] ⊢Δ₁ [a] [b] [a≡b] →
let [ρσ] = wkSubstS [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ]
[a]′ = irrelevanceTerm′
(wk-subst F) (wk [ρ] ⊢Δ₁ [σF])
(proj₁ ([F] ⊢Δ₁ [ρσ])) [a]
[b]′ = irrelevanceTerm′
(wk-subst F) (wk [ρ] ⊢Δ₁ [σF])
(proj₁ ([F] ⊢Δ₁ [ρσ])) [b]
[a≡b]′ = irrelevanceEqTerm′
(wk-subst F) (wk [ρ] ⊢Δ₁ [σF])
(proj₁ ([F] ⊢Δ₁ [ρσ])) [a≡b]
in irrelevanceEq″
(PE.sym (singleSubstWkComp a σ G))
(PE.sym (singleSubstWkComp b σ G))
(proj₁ ([G]a a [ρ] ⊢Δ₁ [a]′))
([G]a′ a [ρ] ⊢Δ₁ [a]′)
(proj₂ ([G]a a [ρ] ⊢Δ₁ [a]′)
([ρσ] , [b]′)
(reflSubst [Γ] ⊢Δ₁ [ρσ] , [a≡b]′)))
, (λ {σ′} [σ′] [σ≡σ′] →
let var0 = var (⊢Δ ∙ ⊢F [σ])
(PE.subst (λ x → 0 ∷ x ∈ (Δ ∙ subst σ F))
(wk-subst F) here)
[wk1σ] = wk1SubstS [Γ] ⊢Δ (⊢F [σ]) [σ]
[wk1σ′] = wk1SubstS [Γ] ⊢Δ (⊢F [σ]) [σ′]
[wk1σ≡wk1σ′] = wk1SubstSEq [Γ] ⊢Δ (⊢F [σ]) [σ] [σ≡σ′]
[F][wk1σ] = proj₁ ([F] (⊢Δ ∙ ⊢F [σ]) [wk1σ])
[F][wk1σ′] = proj₁ ([F] (⊢Δ ∙ ⊢F [σ]) [wk1σ′])
var0′ = conv var0
(≅-eq (escapeEq [F][wk1σ]
(proj₂ ([F] (⊢Δ ∙ ⊢F [σ]) [wk1σ])
[wk1σ′] [wk1σ≡wk1σ′])))
in Π₌ _ _ (id (Πⱼ ⊢F [σ′] ▹ ⊢G [σ′]))
(≅-Π-cong (⊢F [σ])
(escapeEq (proj₁ ([F] ⊢Δ [σ]))
(proj₂ ([F] ⊢Δ [σ]) [σ′] [σ≡σ′]))
(escapeEq (proj₁ ([G]σ [σ])) (proj₂ ([G]σ [σ])
([wk1σ′] , neuTerm [F][wk1σ′] (var 0) var0′ (~-var var0′))
([wk1σ≡wk1σ′] , neuEqTerm [F][wk1σ]
(var 0) (var 0) var0 var0 (~-var var0)))))
(λ ρ ⊢Δ₁ → wkEq ρ ⊢Δ₁ [σF] (proj₂ ([F] ⊢Δ [σ]) [σ′] [σ≡σ′]))
(λ {ρ} {Δ₁} {a} [ρ] ⊢Δ₁ [a] →
let [ρσ] = wkSubstS [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ]
[ρσ′] = wkSubstS [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ′]
[a]′ = irrelevanceTerm′ (wk-subst F) (wk [ρ] ⊢Δ₁ [σF])
(proj₁ ([F] ⊢Δ₁ [ρσ])) [a]
[a]″ = convTerm₁ (proj₁ ([F] ⊢Δ₁ [ρσ]))
(proj₁ ([F] ⊢Δ₁ [ρσ′]))
(proj₂ ([F] ⊢Δ₁ [ρσ]) [ρσ′]
(wkSubstSEq [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ] [σ≡σ′]))
[a]′
[ρσa≡ρσ′a] = consSubstSEq {t = a} {A = F} [Γ] ⊢Δ₁
(wkSubstS [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ])
(wkSubstSEq [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ] [σ≡σ′])
[F] [a]′
in irrelevanceEq″ (PE.sym (singleSubstWkComp a σ G))
(PE.sym (singleSubstWkComp a σ′ G))
(proj₁ ([G]a a [ρ] ⊢Δ₁ [a]′))
([G]a′ a [ρ] ⊢Δ₁ [a]′)
(proj₂ ([G]a a [ρ] ⊢Δ₁ [a]′)
(wkSubstS [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ′] , [a]″)
[ρσa≡ρσ′a])))
-- Validity of Π-congurence.
Π-congᵛ : ∀ {F G H E Γ l}
([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
([G] : Γ ∙ F ⊩ᵛ⟨ l ⟩ G / ([Γ] ∙″ [F]))
([H] : Γ ⊩ᵛ⟨ l ⟩ H / [Γ])
([E] : Γ ∙ H ⊩ᵛ⟨ l ⟩ E / ([Γ] ∙″ [H]))
([F≡H] : Γ ⊩ᵛ⟨ l ⟩ F ≡ H / [Γ] / [F])
([G≡E] : Γ ∙ F ⊩ᵛ⟨ l ⟩ G ≡ E / [Γ] ∙″ [F] / [G])
→ Γ ⊩ᵛ⟨ l ⟩ Π F ▹ G ≡ Π H ▹ E / [Γ] / Πᵛ {F} {G} [Γ] [F] [G]
Π-congᵛ {F} {G} {H} {E} [Γ] [F] [G] [H] [E] [F≡H] [G≡E] {σ = σ} ⊢Δ [σ] =
let [ΠFG] = Πᵛ {F} {G} [Γ] [F] [G]
[σΠFG] = proj₁ ([ΠFG] ⊢Δ [σ])
Πᵣ F′ G′ D′ ⊢F′ ⊢G′ A≡A′ [F]′ [G]′ G-ext′ = extractMaybeEmbΠ (Π-elim [σΠFG])
[σF] = proj₁ ([F] ⊢Δ [σ])
⊢σF = escape [σF]
[σG] = proj₁ ([G] (⊢Δ ∙ ⊢σF) (liftSubstS {F = F} [Γ] ⊢Δ [F] [σ]))
⊢σH = escape (proj₁ ([H] ⊢Δ [σ]))
⊢σE = escape (proj₁ ([E] (⊢Δ ∙ ⊢σH) (liftSubstS {F = H} [Γ] ⊢Δ [H] [σ])))
⊢σF≡σH = escapeEq [σF] ([F≡H] ⊢Δ [σ])
⊢σG≡σE = escapeEq [σG] ([G≡E] (⊢Δ ∙ ⊢σF) (liftSubstS {F = F} [Γ] ⊢Δ [F] [σ]))
in Π₌ (subst σ H)
(subst (liftSubst σ) E)
(id (Πⱼ ⊢σH ▹ ⊢σE))
(≅-Π-cong ⊢σF ⊢σF≡σH ⊢σG≡σE)
(λ ρ ⊢Δ₁ → let [ρσ] = wkSubstS [Γ] ⊢Δ ⊢Δ₁ ρ [σ]
in irrelevanceEq″ (PE.sym (wk-subst F))
(PE.sym (wk-subst H))
(proj₁ ([F] ⊢Δ₁ [ρσ]))
([F]′ ρ ⊢Δ₁)
([F≡H] ⊢Δ₁ [ρσ]))
(λ {ρ} {Δ} {a} [ρ] ⊢Δ₁ [a] →
let [ρσ] = wkSubstS [Γ] ⊢Δ ⊢Δ₁ [ρ] [σ]
[a]′ = irrelevanceTerm′ (wk-subst F)
([F]′ [ρ] ⊢Δ₁)
(proj₁ ([F] ⊢Δ₁ [ρσ])) [a]
[aρσ] = consSubstS {t = a} {A = F} [Γ] ⊢Δ₁ [ρσ] [F] [a]′
in irrelevanceEq″ (PE.sym (singleSubstWkComp a σ G))
(PE.sym (singleSubstWkComp a σ E))
(proj₁ ([G] ⊢Δ₁ [aρσ]))
([G]′ [ρ] ⊢Δ₁ [a])
([G≡E] ⊢Δ₁ [aρσ]))
-- Validity of Π as a term.
Πᵗᵛ : ∀ {F G Γ} ([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ ¹ ⟩ F / [Γ])
([U] : Γ ∙ F ⊩ᵛ⟨ ¹ ⟩ U / ([Γ] ∙″ [F]))
→ Γ ⊩ᵛ⟨ ¹ ⟩ F ∷ U / [Γ] / Uᵛ [Γ]
→ Γ ∙ F ⊩ᵛ⟨ ¹ ⟩ G ∷ U / [Γ] ∙″ [F] / (λ {Δ} {σ} → [U] {Δ} {σ})
→ Γ ⊩ᵛ⟨ ¹ ⟩ Π F ▹ G ∷ U / [Γ] / Uᵛ [Γ]
Πᵗᵛ {F} {G} {Γ} [Γ] [F] [U] [Fₜ] [Gₜ] {Δ = Δ} {σ = σ} ⊢Δ [σ] =
let [liftσ] = liftSubstS {F = F} [Γ] ⊢Δ [F] [σ]
⊢F = escape (proj₁ ([F] ⊢Δ [σ]))
⊢Fₜ = escapeTerm (Uᵣ′ ⁰ 0<1 ⊢Δ) (proj₁ ([Fₜ] ⊢Δ [σ]))
⊢F≡Fₜ = escapeTermEq (Uᵣ′ ⁰ 0<1 ⊢Δ)
(reflEqTerm (Uᵣ′ ⁰ 0<1 ⊢Δ) (proj₁ ([Fₜ] ⊢Δ [σ])))
⊢Gₜ = escapeTerm (proj₁ ([U] (⊢Δ ∙ ⊢F) [liftσ]))
(proj₁ ([Gₜ] (⊢Δ ∙ ⊢F) [liftσ]))
⊢G≡Gₜ = escapeTermEq (proj₁ ([U] (⊢Δ ∙ ⊢F) [liftσ]))
(reflEqTerm (proj₁ ([U] (⊢Δ ∙ ⊢F) [liftσ]))
(proj₁ ([Gₜ] (⊢Δ ∙ ⊢F) [liftσ])))
[F]₀ = univᵛ {F} [Γ] (Uᵛ [Γ]) [Fₜ]
[Gₜ]′ = S.irrelevanceTerm {A = U} {t = G}
(_∙″_ {A = F} [Γ] [F]) (_∙″_ {A = F} [Γ] [F]₀)
(λ {Δ} {σ} → [U] {Δ} {σ})
(λ {Δ} {σ} → Uᵛ (_∙″_ {A = F} [Γ] [F]₀) {Δ} {σ})
[Gₜ]
[G]₀ = univᵛ {G} (_∙″_ {A = F} [Γ] [F]₀)
(λ {Δ} {σ} → Uᵛ (_∙″_ {A = F} [Γ] [F]₀) {Δ} {σ})
(λ {Δ} {σ} → [Gₜ]′ {Δ} {σ})
[ΠFG] = (Πᵛ {F} {G} [Γ] [F]₀ [G]₀) ⊢Δ [σ]
in Uₜ (Π subst σ F ▹ subst (liftSubst σ) G) (idRedTerm:*: (Πⱼ ⊢Fₜ ▹ ⊢Gₜ))
Πₙ (≅ₜ-Π-cong ⊢F ⊢F≡Fₜ ⊢G≡Gₜ) (proj₁ [ΠFG])
, (λ {σ′} [σ′] [σ≡σ′] →
let [liftσ′] = liftSubstS {F = F} [Γ] ⊢Δ [F] [σ′]
[wk1σ] = wk1SubstS [Γ] ⊢Δ ⊢F [σ]
[wk1σ′] = wk1SubstS [Γ] ⊢Δ ⊢F [σ′]
var0 = conv (var (⊢Δ ∙ ⊢F)
(PE.subst (λ x → 0 ∷ x ∈ (Δ ∙ subst σ F))
(wk-subst F) here))
(≅-eq (escapeEq (proj₁ ([F] (⊢Δ ∙ ⊢F) [wk1σ]))
(proj₂ ([F] (⊢Δ ∙ ⊢F) [wk1σ]) [wk1σ′]
(wk1SubstSEq [Γ] ⊢Δ ⊢F [σ] [σ≡σ′]))))
[liftσ′]′ = [wk1σ′]
, neuTerm (proj₁ ([F] (⊢Δ ∙ ⊢F) [wk1σ′])) (var 0)
var0 (~-var var0)
⊢F′ = escape (proj₁ ([F] ⊢Δ [σ′]))
⊢Fₜ′ = escapeTerm (Uᵣ′ ⁰ 0<1 ⊢Δ) (proj₁ ([Fₜ] ⊢Δ [σ′]))
⊢Gₜ′ = escapeTerm (proj₁ ([U] (⊢Δ ∙ ⊢F′) [liftσ′]))
(proj₁ ([Gₜ] (⊢Δ ∙ ⊢F′) [liftσ′]))
⊢F≡F′ = escapeTermEq (Uᵣ′ ⁰ 0<1 ⊢Δ)
(proj₂ ([Fₜ] ⊢Δ [σ]) [σ′] [σ≡σ′])
⊢G≡G′ = escapeTermEq (proj₁ ([U] (⊢Δ ∙ ⊢F) [liftσ]))
(proj₂ ([Gₜ] (⊢Δ ∙ ⊢F) [liftσ]) [liftσ′]′
(liftSubstSEq {F = F} [Γ] ⊢Δ [F] [σ] [σ≡σ′]))
[ΠFG]′ = (Πᵛ {F} {G} [Γ] [F]₀ [G]₀) ⊢Δ [σ′]
in Uₜ₌ (Π subst σ F ▹ subst (liftSubst σ) G)
(Π subst σ′ F ▹ subst (liftSubst σ′) G)
(idRedTerm:*: (Πⱼ ⊢Fₜ ▹ ⊢Gₜ))
(idRedTerm:*: (Πⱼ ⊢Fₜ′ ▹ ⊢Gₜ′))
Πₙ Πₙ (≅ₜ-Π-cong ⊢F ⊢F≡F′ ⊢G≡G′)
(proj₁ [ΠFG]) (proj₁ [ΠFG]′) (proj₂ [ΠFG] [σ′] [σ≡σ′]))
-- Validity of Π-congurence as a term equality.
Π-congᵗᵛ : ∀ {F G H E Γ}
([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ ¹ ⟩ F / [Γ])
([H] : Γ ⊩ᵛ⟨ ¹ ⟩ H / [Γ])
([UF] : Γ ∙ F ⊩ᵛ⟨ ¹ ⟩ U / ([Γ] ∙″ [F]))
([UH] : Γ ∙ H ⊩ᵛ⟨ ¹ ⟩ U / ([Γ] ∙″ [H]))
([F]ₜ : Γ ⊩ᵛ⟨ ¹ ⟩ F ∷ U / [Γ] / Uᵛ [Γ])
([G]ₜ : Γ ∙ F ⊩ᵛ⟨ ¹ ⟩ G ∷ U / [Γ] ∙″ [F]
/ (λ {Δ} {σ} → [UF] {Δ} {σ}))
([H]ₜ : Γ ⊩ᵛ⟨ ¹ ⟩ H ∷ U / [Γ] / Uᵛ [Γ])
([E]ₜ : Γ ∙ H ⊩ᵛ⟨ ¹ ⟩ E ∷ U / [Γ] ∙″ [H]
/ (λ {Δ} {σ} → [UH] {Δ} {σ}))
([F≡H]ₜ : Γ ⊩ᵛ⟨ ¹ ⟩ F ≡ H ∷ U / [Γ] / Uᵛ [Γ])
([G≡E]ₜ : Γ ∙ F ⊩ᵛ⟨ ¹ ⟩ G ≡ E ∷ U / [Γ] ∙″ [F]
/ (λ {Δ} {σ} → [UF] {Δ} {σ}))
→ Γ ⊩ᵛ⟨ ¹ ⟩ Π F ▹ G ≡ Π H ▹ E ∷ U / [Γ] / Uᵛ [Γ]
Π-congᵗᵛ {F} {G} {H} {E}
[Γ] [F] [H] [UF] [UH] [F]ₜ [G]ₜ [H]ₜ [E]ₜ [F≡H]ₜ [G≡E]ₜ {Δ} {σ} ⊢Δ [σ] =
let ⊢F = escape (proj₁ ([F] ⊢Δ [σ]))
⊢H = escape (proj₁ ([H] ⊢Δ [σ]))
[liftFσ] = liftSubstS {F = F} [Γ] ⊢Δ [F] [σ]
[liftHσ] = liftSubstS {F = H} [Γ] ⊢Δ [H] [σ]
[F]ᵤ = univᵛ {F} [Γ] (Uᵛ [Γ]) [F]ₜ
[G]ᵤ₁ = univᵛ {G} {l′ = ⁰} (_∙″_ {A = F} [Γ] [F])
(λ {Δ} {σ} → [UF] {Δ} {σ}) [G]ₜ
[G]ᵤ = S.irrelevance {A = G} (_∙″_ {A = F} [Γ] [F])
(_∙″_ {A = F} [Γ] [F]ᵤ) [G]ᵤ₁
[H]ᵤ = univᵛ {H} [Γ] (Uᵛ [Γ]) [H]ₜ
[E]ᵤ = S.irrelevance {A = E} (_∙″_ {A = H} [Γ] [H]) (_∙″_ {A = H} [Γ] [H]ᵤ)
(univᵛ {E} {l′ = ⁰} (_∙″_ {A = H} [Γ] [H])
(λ {Δ} {σ} → [UH] {Δ} {σ}) [E]ₜ)
[F≡H]ᵤ = univEqᵛ {F} {H} [Γ] (Uᵛ [Γ]) [F]ᵤ [F≡H]ₜ
[G≡E]ᵤ = S.irrelevanceEq {A = G} {B = E} (_∙″_ {A = F} [Γ] [F])
(_∙″_ {A = F} [Γ] [F]ᵤ) [G]ᵤ₁ [G]ᵤ
(univEqᵛ {G} {E} (_∙″_ {A = F} [Γ] [F])
(λ {Δ} {σ} → [UF] {Δ} {σ}) [G]ᵤ₁ [G≡E]ₜ)
ΠFGₜ = Πⱼ escapeTerm {l = ¹} (Uᵣ′ ⁰ 0<1 ⊢Δ) (proj₁ ([F]ₜ ⊢Δ [σ]))
▹ escapeTerm (proj₁ ([UF] (⊢Δ ∙ ⊢F) [liftFσ]))
(proj₁ ([G]ₜ (⊢Δ ∙ ⊢F) [liftFσ]))
ΠHEₜ = Πⱼ escapeTerm {l = ¹} (Uᵣ′ ⁰ 0<1 ⊢Δ) (proj₁ ([H]ₜ ⊢Δ [σ]))
▹ escapeTerm (proj₁ ([UH] (⊢Δ ∙ ⊢H) [liftHσ]))
(proj₁ ([E]ₜ (⊢Δ ∙ ⊢H) [liftHσ]))
in Uₜ₌ (Π subst σ F ▹ subst (liftSubst σ) G)
(Π subst σ H ▹ subst (liftSubst σ) E)
(idRedTerm:*: ΠFGₜ) (idRedTerm:*: ΠHEₜ)
Πₙ Πₙ
(≅ₜ-Π-cong ⊢F (escapeTermEq (Uᵣ′ ⁰ 0<1 ⊢Δ) ([F≡H]ₜ ⊢Δ [σ]))
(escapeTermEq (proj₁ ([UF] (⊢Δ ∙ ⊢F) [liftFσ]))
([G≡E]ₜ (⊢Δ ∙ ⊢F) [liftFσ])))
(proj₁ (Πᵛ {F} {G} [Γ] [F]ᵤ [G]ᵤ ⊢Δ [σ]))
(proj₁ (Πᵛ {H} {E} [Γ] [H]ᵤ [E]ᵤ ⊢Δ [σ]))
(Π-congᵛ {F} {G} {H} {E} [Γ] [F]ᵤ [G]ᵤ [H]ᵤ [E]ᵤ [F≡H]ᵤ [G≡E]ᵤ ⊢Δ [σ])
-- Validity of non-dependent function types.
▹▹ᵛ : ∀ {F G Γ l}
([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
→ Γ ⊩ᵛ⟨ l ⟩ G / [Γ]
→ Γ ⊩ᵛ⟨ l ⟩ F ▹▹ G / [Γ]
▹▹ᵛ {F} {G} [Γ] [F] [G] =
Πᵛ {F} {wk1 G} [Γ] [F] (wk1ᵛ {G} {F} [Γ] [F] [G])
-- Validity of non-dependent function type congurence.
▹▹-congᵛ : ∀ {F F′ G G′ Γ l}
([Γ] : ⊩ᵛ Γ)
([F] : Γ ⊩ᵛ⟨ l ⟩ F / [Γ])
([F′] : Γ ⊩ᵛ⟨ l ⟩ F′ / [Γ])
([F≡F′] : Γ ⊩ᵛ⟨ l ⟩ F ≡ F′ / [Γ] / [F])
([G] : Γ ⊩ᵛ⟨ l ⟩ G / [Γ])
([G′] : Γ ⊩ᵛ⟨ l ⟩ G′ / [Γ])
([G≡G′] : Γ ⊩ᵛ⟨ l ⟩ G ≡ G′ / [Γ] / [G])
→ Γ ⊩ᵛ⟨ l ⟩ F ▹▹ G ≡ F′ ▹▹ G′ / [Γ] / ▹▹ᵛ {F} {G} [Γ] [F] [G]
▹▹-congᵛ {F} {F′} {G} {G′} [Γ] [F] [F′] [F≡F′] [G] [G′] [G≡G′] =
Π-congᵛ {F} {wk1 G} {F′} {wk1 G′} [Γ]
[F] (wk1ᵛ {G} {F} [Γ] [F] [G])
[F′] (wk1ᵛ {G′} {F′} [Γ] [F′] [G′])
[F≡F′] (wk1Eqᵛ {G} {G′} {F} [Γ] [F] [G] [G≡G′])
|
1.proc/generated-asm/101.proc_return.asm | takenobu-hs/haskell-ghc-cmm-examples | 1 | 165432 | <filename>1.proc/generated-asm/101.proc_return.asm<gh_stars>1-10
==================== Asm code ====================
.section .text
.align 8
.globl proc
.type proc, @function
proc:
_c1:
jmp *(%rbp)
.size proc, .-proc
|
src/firmware/Platform/Lcd/EnableDisplayOnState.asm | pete-restall/Cluck2Sesame-Prototype | 1 | 166742 | <reponame>pete-restall/Cluck2Sesame-Prototype
#include "Platform.inc"
#include "FarCalls.inc"
#include "Lcd.inc"
#include "States.inc"
radix decimal
defineLcdState LCD_STATE_ENABLE_DISPLAYON
movlw LCD_CMD_DISPLAYON
call writeRegister
.setBankFor lcdFlags
bsf lcdFlags, LCD_FLAG_ENABLED
setLcdState LCD_STATE_IDLE
returnFromLcdState
end
|
s2/sfx-original/E1 - Rumbling 2.asm | Cancer52/flamedriver | 9 | 9263 | <gh_stars>1-10
Sound61_Rumbling2_Header:
smpsHeaderStartSong 2, 1
smpsHeaderVoice Sound61_Rumbling2_Voices
smpsHeaderTempoSFX $01
smpsHeaderChanSFX $01
smpsHeaderSFXChannel cFM4, Sound61_Rumbling2_FM4, $00, $04
; FM4 Data
Sound61_Rumbling2_FM4:
dc.b nRst, $01
smpsSetvoice $00
smpsModSet $00, $01, $70, $06
dc.b nCs0, $06, nE0, $08, nD0, $01, nCs0, $05, nF0, $06, nAb0, $03
dc.b nCs0, $08, nG0, $04, nCs0, $06
smpsAlterVol $02
dc.b nE0, $08
smpsAlterVol $02
dc.b nD0, $01
smpsAlterVol $02
dc.b nCs0, $05
smpsAlterVol $02
dc.b nF0, $06
smpsAlterVol $02
dc.b nAb0, $03
smpsAlterVol $02
dc.b nCs0, $08
smpsAlterVol $02
dc.b nG0, $04
smpsAlterVol $02
smpsStop
Sound61_Rumbling2_Voices:
; Voice $00
; $32
; $30, $50, $30, $30, $1F, $19, $0E, $0E, $07, $15, $12, $09
; $0A, $1D, $09, $06, $E8, $0A, $03, $17, $07, $00, $00, $00
smpsVcAlgorithm $02
smpsVcFeedback $06
smpsVcUnusedBits $00
smpsVcDetune $03, $03, $05, $03
smpsVcCoarseFreq $00, $00, $00, $00
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $0E, $0E, $19, $1F
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $09, $12, $15, $07
smpsVcDecayRate2 $06, $09, $1D, $0A
smpsVcDecayLevel $01, $00, $00, $0E
smpsVcReleaseRate $07, $03, $0A, $08
smpsVcTotalLevel $00, $00, $00, $07
|
ASDialog.applescript | darricktheprogrammer/ASDialog | 3 | 3904 | <reponame>darricktheprogrammer/ASDialog<filename>ASDialog.applescript
on NewDialog(msg, scriptPath)
copy my Dialog to x
set translate to load script file (scriptPath & "pastybridge:pytranslate.scpt")
set translateLib of x to translate
set x's message to msg
x's set_path(scriptPath)
return x
end NewDialog
script Dialog
property _myPath : missing value -- (** Folder containing ASDialog. *)
property _python_path : "python3"
property message : missing value -- (** Message to the user explaining the dialog. *)
property translateLib : missing value
property _return_types : {} -- (** List of classes defining how each value should be returned after its trip to python *)
property _widgets : {} -- (** List of widgets that will be displayed (added to every time an add_*() routine is called). *)
property _cancelbutton : "Cancel" -- (** Button that will stop the script if clicked. *)
property _title : "" -- (** Window title of the dialog. *)
(**
* Set the folder path which contains ASDialog.
*
* It is important ASDialog knows where it is. That is the only
* way it can call the python bindings.
*
* @param String The folder containing ASDialog.
* @return void
*)
on set_path(pth)
set _myPath to pth
return
end set_path
(**
* Adds a title to the dialog window.
*
* @param String The window title.
* @return void
*)
on add_title(title)
set _title to title
return
end add_title
(*!
* Use a custom python interpreter
*
* Allows you to change the Python path from the default (`python3`) by
* giving a Unix file path to the desired python command. Helpful when using
* virtual environments or custom installations.
*
* @param pth (String) The full path to a custom Python interpreter in Unix
* form
*)
on set_python(pth)
set my _python_path to pth
end set_python
(*
Routines for adding widgets
*)
(**
* Adds custom buttons to the dialog.
*
* This is not mandatory. The default {Cancel, OK} buttons will
* be used if no buttons are specified.
*
* @param List Names of the buttons, in order from left to right.
* @param String The button that should be clicked when the user presses enter (can be null or empty string if a default button is not desired).
* @param String Stops the script (can be null or empty string if a cancel button is not desired).
* @return Dialog The dialog the buttons belong to.
*)
on add_buttons(buttonList, okbutton, cancelbutton)
set _cancelbutton to cancelbutton
set vals to {¬
{"buttons", buttonList}, ¬
{"okButton", okbutton}, ¬
{"cancelButton", cancelbutton}}
return _add_widget("buttons", vals)
end add_buttons
(**
* Adds a checkbox to the dialog.
*
* Unlike other widgets, the label for the checkbox will be on the right side of the window.
*
* @param String The text description for the checkbox.
* @param Bool Initial state of the checkbox.
* @return Dialog The dialog the checkbox belongs to.
*)
on add_checkbox(label, checked)
_cache_return_value(boolean)
set vals to {¬
{"label", label}, ¬
{"checked", checked}}
return _add_widget("checkbox", vals)
end add_checkbox
(**
* Adds a dropdown list menu to the dialog (where only one option can be chosen).
*
* @param {String+Number} Possible values for the user to choose.
* @param String The text description for the dropdown.
* @param String+Number Initial value shown in the dropdown.
* @return Dialog The dialog the dropdown belongs to.
*)
on add_dropdown(values, label, defaultValue)
_cache_return_value(values)
set vals to {¬
{"label", label}, ¬
{"values", translateLib's list_to_python(values)}, ¬
{"defaultValue", defaultValue}}
return _add_widget("dropdown", vals)
end add_dropdown
(**
* Adds a text field for user input.
*
* @param String The text description for the text field.
* @param String Initial value shown in the text field.
* @return Dialog The dialog the dropdown belongs to.
*)
on add_text_field(label, defaultValue)
_cache_return_value(string)
set vals to {¬
{"label", label}, ¬
{"defaultValue", defaultValue}}
return _add_widget("textField", vals)
end add_text_field
(**
* Adds a group of radio buttons to the dialog.
*
* @param {String+Number} Possible values for the user to choose.
* @param String The text description for the radio group.
* @param String+Number Initial chosen value.
* @return Dialog The dialog the radio buttons belong to.
*)
on add_radio_buttons(buttonList, label, defaultButton)
_cache_return_value(buttonList)
set vals to {¬
{"label", label}, ¬
{"choices", buttonList}, ¬
{"defaultButton", defaultButton}}
return _add_widget("radioButtons", vals)
end add_radio_buttons
(**
* Same as add_separator_with_label, but without adding a label.
*
* @return Dialog The dialog the radio buttons belong to.
*)
on add_separator()
return add_separator_with_label("")
end add_separator
(**
* Adds a separating line between elements.
*
* @param String The text description for the separator.
* @return Dialog The dialog the radio buttons belong to.
*)
on add_separator_with_label(label)
set vals to {¬
{"label", label}}
return _add_widget("separator", vals)
end add_separator_with_label
(**
* Pops the dialog up to the user and returns the values the user chose in an Associative Array.
*
* Must be called after widgets have been added to the dialog, otherwise it won't do anything.
*
* @return AssociativeArray
*)
on display()
set vals to do shell script _compile_shell_script()
set returnedData to _unserialize(vals)
if readKey("button returned") of returnedData is _cancelbutton then
error number -128
end if
set values to readKey("values") of returnedData
repeat with i from 1 to (count values)
set item i of values to _convert_to_applescript(item i of values, item i of _return_types)
end repeat
return {buttonReturned:readKey("button returned") of returnedData, values:values}
end display
(**
* Create an AssociativeArray with widget properties and add to the list of widgets.
*
* @param String The type of widget (i.e.: buttons, separator, checkbox, ...).
* @return Dialog
*)
on _add_widget(widgetType, widgetProperties)
set array to translateLib's newAssociativeArray()
set widgetProperties to {{"name", widgetType}} & widgetProperties
repeat with i from 1 to (count widgetProperties)
set {k, v} to {item 1, item 2} of item i of widgetProperties
array's setKey(k, v)
end repeat
set end of _widgets to array
return me
end _add_widget
(**
* Compiles the arguments together and creates the
* formatted shell command for calling the python bindings.
*
* @return String
*)
on _compile_shell_script()
set args to _compile_args()
set pieces to {my _python_path, "-B", quoted form of POSIX path of (_myPath & "asdialog.py"), args}
return my implode(pieces, space)
end _compile_shell_script
(**
* Compiles together all of the arguments to be sent to the python bindings,
* including serializing all of the widget arrays.
*
* @return List
*)
on _compile_args()
set args to {quoted form of message, quoted form of _title}
repeat with i from 1 to (count _widgets)
set end of args to quoted form of (translateLib's array_to_python(item i of _widgets))
end repeat
return args
end _compile_args
(**
* Goes through and makes sure that all values have been unserialized.
*
* This should be implemented in AssociativeArray's unserialize instead.
*
* @param String Value returned from python.
* @return AssociativeArray
*)
on _unserialize(vals)
set valueArray to translateLib's array_to_applescript(vals)
set {keys, values} to valueArray's {getKeys(), getValues()}
repeat with i from 1 to (count keys)
set {k, v} to {item i of keys, item i of values}
if v contains "|" or (v begins with "{" and v ends with "}") then
valueArray's setKey(k, translateLib's list_to_applescript(v))
end if
end repeat
return valueArray
end _unserialize
(**
* Returns the lowest common denominator class for a value or list of values
*
* Given a list of values with the classes {real, real, integer} this routine will return 'number'
* Given a list of values with the classes {string, string, boolean} it will return 'string.'
* A string can not always be coerced into a boolean, but a boolean can always be coerced into a string
*
* @param Mixed The value or list of values to which you want to find the lowest common denominator class
* @return Class
*)
on _get_class(values)
if class of values is not list then set values to {values}
set classList to {}
repeat with i from 1 to (count values)
set c to class of item i of values
if c is string then
--Exit early for lowest common denominator
return string
else
set end of classList to c
end if
end repeat
if (number is in classList) or (real is in classList) or (integer is in classList) then
return number
else if boolean is in classList then
return boolean
else
return string
end if
end _get_class
(**
* Helper routine to coerce values returned from python back into their AppleScript equivalent.
*
* @param String The returned python value to convert.
* @param Class The class that the value should be coerced to.
* @return Mixed
*)
on _convert_to_applescript(val, valType)
if valType is string then
return translateLib's string_to_applescript(val)
else if valType is number then
return translateLib's number_to_applescript(val)
else if valType is boolean then
return translateLib's bool_to_applescript(val)
else if valType is date then
return translateLib's date_to_applescript(val)
end if
end _convert_to_applescript
(**
* Helper routine to coerce values into python readable strings.
*
* @param Mixed The value to convert into a python value
* @return String
*)
on _convert_for_python(val)
if class of val is number then
return translateLib's number_to_python(val)
else if class of val is date then
return translateLib's date_to_python(val)
else if class of val is boolean then
return translateLib's bool_to_python(val)
else
return translateLib's string_to_python(val)
end if
end _convert_for_python
(**
* Saves the class of a value in the _return_types property.
*
* If given a class, it will directly cache that value. If given a value,
* it will use _get_class() to determine the class to use.
*
* @param Class+Mixed
* @return void
*)
on _cache_return_value(val)
if class of val is not class then
set val to _get_class(val)
end if
set end of _return_types to val
return
end _cache_return_value
end script
--Sub-routine to join a list into a string
--------------------------------------------------------------------------------
on implode(theList, theDelim)
set AppleScript's text item delimiters to theDelim
set theText to theList as text
set AppleScript's text item delimiters to ""
return theText
end implode
|
unittests/ASM/Secondary/09_XX_01_2.asm | cobalt2727/FEX | 628 | 4026 | <reponame>cobalt2727/FEX
%ifdef CONFIG
{
"RegData": {
"RAX": "0x80000000",
"RDX": "0xFFFFFFFF",
"RBX": "0x41424344",
"RCX": "0x51525354",
"R13": "0xFFFFFFFF80000000",
"R14": "0x0"
},
"MemoryRegions": {
"0x100000000": "4096"
}
}
%endif
mov r15, 0xe0000000
mov rax, 0xFFFFFFFF80000000
mov [r15 + 8 * 0], rax
mov r14, 0
; Expected
mov eax, 0xFFFFFFFF
mov edx, 0xFFFFFFFF
; Desired
mov ebx, 0x41424344
mov ecx, 0x51525354
cmpxchg8b [r15]
; Set r14 to 1 if if the memory location was expected
setz r14b
; edx and eax will now contain the memory's data
; Check memory location to ensure it contains what we want
mov r13, [r15 + 8 * 0]
hlt
|
programs/oeis/117/A117951.asm | neoneye/loda | 22 | 90075 | <gh_stars>10-100
; A117951: a(n) = n^2 + 5.
; 5,6,9,14,21,30,41,54,69,86,105,126,149,174,201,230,261,294,329,366,405,446,489,534,581,630,681,734,789,846,905,966,1029,1094,1161,1230,1301,1374,1449,1526,1605,1686,1769,1854,1941,2030,2121,2214,2309,2406,2505,2606,2709,2814,2921,3030,3141,3254,3369,3486,3605,3726,3849,3974,4101,4230,4361,4494,4629,4766,4905,5046,5189,5334,5481,5630,5781,5934,6089,6246,6405,6566,6729,6894,7061,7230,7401,7574,7749,7926,8105,8286,8469,8654,8841,9030,9221,9414,9609,9806
pow $0,2
add $0,5
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/aggr15.adb | best08618/asylo | 7 | 24136 | -- { dg-do compile }
-- { dg-options "-gnatws" }
package body Aggr15 is
function CREATE return DATA_T is
D : DATA_T;
begin
return D;
end;
function ALL_CREATE return ALL_DATA_T is
C : constant ALL_DATA_T := (others => (others => Create));
begin
return C;
end;
end Aggr15;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.