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 |
|---|---|---|---|---|
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4 | yy2so/shardingsphere | 0 | 3634 | <gh_stars>0
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
grammar BaseRule;
import Symbol, Keyword, SQLServerKeyword, Literals;
parameterMarker
: QUESTION_
;
literals
: stringLiterals
| numberLiterals
| dateTimeLiterals
| hexadecimalLiterals
| bitValueLiterals
| booleanLiterals
| nullValueLiterals
;
stringLiterals
: STRING_
;
numberLiterals
: MINUS_? NUMBER_
;
dateTimeLiterals
: (DATE | TIME | TIMESTAMP) STRING_
| LBE_ identifier STRING_ RBE_
;
hexadecimalLiterals
: HEX_DIGIT_
;
bitValueLiterals
: BIT_NUM_
;
booleanLiterals
: TRUE | FALSE
;
nullValueLiterals
: NULL
;
identifier
: IDENTIFIER_ | unreservedWord
;
unreservedWord
: TRUNCATE | FUNCTION | TRIGGER | LIMIT | OFFSET | SAVEPOINT | BOOLEAN
| ARRAY | LOCALTIME | LOCALTIMESTAMP | QUARTER | WEEK | MICROSECOND | ENABLE
| DISABLE | BINARY | HIDDEN_ | MOD | PARTITION | TOP | ROW
| XOR | ALWAYS | ROLE | START | ALGORITHM | AUTO | BLOCKERS
| CLUSTERED | COLUMNSTORE | CONTENT | CONCAT | DATABASE | DAYS | DENY | DETERMINISTIC
| DISTRIBUTION | DOCUMENT | DURABILITY | ENCRYPTED | FILESTREAM | FILETABLE | FOLLOWING
| HASH | HEAP | INBOUND | INFINITE | LOGIN | MASKED | MAXDOP
| MINUTES | MONTHS | MOVE | NOCHECK | NONCLUSTERED | OBJECT | OFF
| ONLINE | OUTBOUND | OVER | PAGE | PARTITIONS | PAUSED | PERIOD
| PERSISTED | PRECEDING | RANDOMIZED | RANGE | REBUILD | REPLICATE | REPLICATION
| RESUMABLE | ROWGUIDCOL | SAVE | SELF | SPARSE | SWITCH | TRAN
| TRANCOUNT | UNBOUNDED | YEARS | WEEKS | ABORT_AFTER_WAIT | ALLOW_PAGE_LOCKS | ALLOW_ROW_LOCKS
| ALL_SPARSE_COLUMNS | BUCKET_COUNT | COLUMNSTORE_ARCHIVE | COLUMN_ENCRYPTION_KEY | COLUMN_SET | COMPRESSION_DELAY | DATABASE_DEAULT
| DATA_COMPRESSION | DATA_CONSISTENCY_CHECK | ENCRYPTION_TYPE | SYSTEM_TIME | SYSTEM_VERSIONING | TEXTIMAGE_ON | WAIT_AT_LOW_PRIORITY
| STATISTICS_INCREMENTAL | STATISTICS_NORECOMPUTE | ROUND_ROBIN | SCHEMA_AND_DATA | SCHEMA_ONLY | SORT_IN_TEMPDB | IGNORE_DUP_KEY
| IMPLICIT_TRANSACTIONS | MAX_DURATION | MEMORY_OPTIMIZED | MIGRATION_STATE | PAD_INDEX | REMOTE_DATA_ARCHIVE | FILESTREAM_ON
| FILETABLE_COLLATE_FILENAME | FILETABLE_DIRECTORY | FILETABLE_FULLPATH_UNIQUE_CONSTRAINT_NAME | FILETABLE_PRIMARY_KEY_CONSTRAINT_NAME | FILETABLE_STREAMID_UNIQUE_CONSTRAINT_NAME
| FILLFACTOR | FILTER_PREDICATE | HISTORY_RETENTION_PERIOD | HISTORY_TABLE | LOCK_ESCALATION | DROP_EXISTING | ROW_NUMBER
| CONTROL | TAKE | OWNERSHIP | DEFINITION | APPLICATION | ASSEMBLY | SYMMETRIC | ASYMMETRIC
| SERVER | RECEIVE | CHANGE | TRACE | TRACKING | RESOURCES | SETTINGS
| STATE | AVAILABILITY | CREDENTIAL | ENDPOINT | EVENT | NOTIFICATION
| LINKED | AUDIT | DDL | SQL | XML | IMPERSONATE | SECURABLES | AUTHENTICATE
| EXTERNAL | ACCESS | ADMINISTER | BULK | OPERATIONS | UNSAFE | SHUTDOWN
| SCOPED | CONFIGURATION |DATASPACE | SERVICE | CERTIFICATE | CONTRACT | ENCRYPTION
| MASTER | DATA | SOURCE | FILE | FORMAT | LIBRARY | FULLTEXT | MASK | UNMASK
| MESSAGE | TYPE | REMOTE | BINDING | ROUTE | SECURITY | POLICY | AGGREGATE | QUEUE
| RULE | SYNONYM | COLLECTION | SCRIPT | KILL | BACKUP | LOG | SHOWPLAN
| SUBSCRIBE | QUERY | NOTIFICATIONS | CHECKPOINT | SEQUENCE | INSTANCE | DO | DEFINER | LOCAL | CASCADED
| NEXT | NAME | INTEGER | TYPE | MAX | MIN | SUM | COUNT | AVG | FIRST | DATETIME2
| OUTPUT | INSERTED | DELETED | KB | MB | GB | TB | FILENAME | MAXSIZE | FILEGROWTH | UNLIMITED | MEMORY_OPTIMIZED_DATA | FILEGROUP | NON_TRANSACTED_ACCESS
| DB_CHAINING | TRUSTWORTHY | GROUP | ROWS | DATE | DATEPART | CAST | DAY
| FORWARD_ONLY | KEYSET | FAST_FORWARD | READ_ONLY | SCROLL_LOCKS | OPTIMISTIC | TYPE_WARNING | SCHEMABINDING | CALLER
| OWNER | SNAPSHOT | REPEATABLE | SERIALIZABLE | NATIVE_COMPILATION | VIEW_METADATA | INSTEAD | APPEND | INCREMENT | CACHE | MINVALUE | MAXVALUE | RESTART
| LOB_COMPACTION | COMPRESS_ALL_ROW_GROUPS | REORGANIZE | RESUME | PAUSE | ABORT
;
databaseName
: identifier
;
schemaName
: identifier
;
functionName
: (owner DOT_)? name
;
procedureName
: (owner DOT_)? name (SEMI_ numberLiterals)?
;
viewName
: (owner DOT_)? name
;
triggerName
: (schemaName DOT_)? name
;
sequenceName
: (schemaName DOT_)? name
;
tableName
: (owner DOT_)? name
;
columnName
: (owner DOT_)? name
;
owner
: identifier
;
name
: identifier
;
columnNames
: LP_ columnName (COMMA_ columnName)* RP_
;
columnNamesWithSort
: LP_ columnNameWithSort (COMMA_ columnNameWithSort)* RP_
;
tableNames
: LP_? tableName (COMMA_ tableName)* RP_?
;
indexName
: identifier
;
constraintName
: identifier
;
collationName
: STRING_ | IDENTIFIER_
;
alias
: IDENTIFIER_
;
dataTypeLength
: LP_ (NUMBER_ (COMMA_ NUMBER_)?)? RP_
;
primaryKey
: PRIMARY? KEY
;
// TODO comb expr
expr
: expr andOperator expr
| expr orOperator expr
| notOperator expr
| LP_ expr RP_
| booleanPrimary
;
andOperator
: AND | AND_
;
orOperator
: OR | OR_
;
notOperator
: NOT | NOT_
;
booleanPrimary
: booleanPrimary IS NOT? (TRUE | FALSE | UNKNOWN | NULL)
| booleanPrimary SAFE_EQ_ predicate
| booleanPrimary comparisonOperator predicate
| booleanPrimary comparisonOperator (ALL | ANY) subquery
| predicate
;
comparisonOperator
: EQ_ | GTE_ | GT_ | LTE_ | LT_ | NEQ_
;
predicate
: bitExpr NOT? IN subquery
| bitExpr NOT? IN LP_ expr (COMMA_ expr)* RP_
| bitExpr NOT? BETWEEN bitExpr AND predicate
| bitExpr NOT? LIKE simpleExpr (ESCAPE simpleExpr)?
| bitExpr
;
bitExpr
: bitExpr VERTICAL_BAR_ bitExpr
| bitExpr AMPERSAND_ bitExpr
| bitExpr SIGNED_LEFT_SHIFT_ bitExpr
| bitExpr SIGNED_RIGHT_SHIFT_ bitExpr
| bitExpr PLUS_ bitExpr
| bitExpr MINUS_ bitExpr
| bitExpr ASTERISK_ bitExpr
| bitExpr SLASH_ bitExpr
| bitExpr MOD_ bitExpr
| bitExpr CARET_ bitExpr
| simpleExpr
;
simpleExpr
: functionCall
| parameterMarker
| literals
| columnName
| variableName
| simpleExpr OR_ simpleExpr
| (PLUS_ | MINUS_ | TILDE_ | NOT_ | BINARY) simpleExpr
| ROW? LP_ expr (COMMA_ expr)* RP_
| EXISTS? subquery
| LBE_ identifier expr RBE_
| caseExpression
| privateExprOfDb
;
functionCall
: aggregationFunction | specialFunction | regularFunction
;
aggregationFunction
: aggregationFunctionName LP_ distinct? (expr (COMMA_ expr)* | ASTERISK_)? RP_
;
aggregationFunctionName
: MAX | MIN | SUM | COUNT | AVG
;
distinct
: DISTINCT
;
specialFunction
: castFunction | charFunction
;
castFunction
: CAST LP_ expr AS dataType RP_
;
charFunction
: CHAR LP_ expr (COMMA_ expr)* (USING ignoredIdentifier)? RP_
;
regularFunction
: regularFunctionName LP_ (expr (COMMA_ expr)* | ASTERISK_)? RP_
;
regularFunctionName
: (owner DOT_)? identifier | IF | LOCALTIME | LOCALTIMESTAMP | INTERVAL
;
caseExpression
: CASE simpleExpr? caseWhen+ caseElse?
;
caseWhen
: WHEN expr THEN expr
;
caseElse
: ELSE expr
;
privateExprOfDb
: windowedFunction | atTimeZoneExpr | castExpr | convertExpr
;
subquery
: matchNone
;
orderByClause
: ORDER BY orderByItem (COMMA_ orderByItem)*
(OFFSET expr (ROW | ROWS) (FETCH (FIRST | NEXT) expr (ROW | ROWS) ONLY)?)?
;
orderByItem
: (columnName | numberLiterals | expr) (COLLATE identifier)? (ASC | DESC)?
;
dataType
: (ignoredIdentifier DOT_)? dataTypeName (dataTypeLength | LP_ MAX RP_ | LP_ (CONTENT | DOCUMENT)? ignoredIdentifier RP_)?
;
dataTypeName
: BIGINT | NUMERIC | BIT | SMALLINT | DECIMAL | SMALLMONEY | INT | TINYINT | MONEY | FLOAT | REAL
| DATE | DATETIMEOFFSET | SMALLDATETIME | DATETIME | DATETIME2 | TIME | CHAR | VARCHAR | TEXT | NCHAR | NVARCHAR
| NTEXT | BINARY | VARBINARY | IMAGE | SQL_VARIANT | XML | UNIQUEIDENTIFIER | HIERARCHYID | GEOMETRY
| GEOGRAPHY | IDENTIFIER_ | INTEGER
;
atTimeZoneExpr
: IDENTIFIER_ (WITH TIME ZONE)? STRING_
;
castExpr
: CAST LP_ expr AS dataType (LP_ NUMBER_ RP_)? RP_
;
convertExpr
: CONVERT (dataType (LP_ NUMBER_ RP_)? COMMA_ expr (COMMA_ NUMBER_)?)
;
windowedFunction
: functionCall overClause
;
overClause
: OVER LP_ partitionByClause? orderByClause? rowRangeClause? RP_
;
partitionByClause
: PARTITION BY expr (COMMA_ expr)*
;
rowRangeClause
: (ROWS | RANGE) windowFrameExtent
;
windowFrameExtent
: windowFramePreceding | windowFrameBetween
;
windowFrameBetween
: BETWEEN windowFrameBound AND windowFrameBound
;
windowFrameBound
: windowFramePreceding | windowFrameFollowing
;
windowFramePreceding
: UNBOUNDED PRECEDING | NUMBER_ PRECEDING | CURRENT ROW
;
windowFrameFollowing
: UNBOUNDED FOLLOWING | NUMBER_ FOLLOWING | CURRENT ROW
;
columnNameWithSort
: columnName (ASC | DESC)?
;
indexOption
: FILLFACTOR EQ_ NUMBER_
| eqOnOffOption
| (COMPRESSION_DELAY | MAX_DURATION) eqTime
| MAXDOP EQ_ NUMBER_
| compressionOption onPartitionClause?
;
compressionOption
: DATA_COMPRESSION EQ_ (NONE | ROW | PAGE | COLUMNSTORE | COLUMNSTORE_ARCHIVE)
;
eqTime
: EQ_ NUMBER_ (MINUTES)?
;
eqOnOffOption
: eqKey eqOnOff
;
eqKey
: PAD_INDEX
| SORT_IN_TEMPDB
| IGNORE_DUP_KEY
| STATISTICS_NORECOMPUTE
| STATISTICS_INCREMENTAL
| DROP_EXISTING
| ONLINE
| RESUMABLE
| ALLOW_ROW_LOCKS
| ALLOW_PAGE_LOCKS
| COMPRESSION_DELAY
| SORT_IN_TEMPDB
| OPTIMIZE_FOR_SEQUENTIAL_KEY
;
eqOnOff
: EQ_ (ON | OFF)
;
onPartitionClause
: ON PARTITIONS LP_ partitionExpressions RP_
;
partitionExpressions
: partitionExpression (COMMA_ partitionExpression)*
;
partitionExpression
: NUMBER_ | numberRange
;
numberRange
: NUMBER_ TO NUMBER_
;
lowPriorityLockWait
: WAIT_AT_LOW_PRIORITY LP_ MAX_DURATION EQ_ NUMBER_ (MINUTES)? COMMA_ ABORT_AFTER_WAIT EQ_ (NONE | SELF | BLOCKERS) RP_
;
onLowPriorLockWait
: ON (LP_ lowPriorityLockWait RP_)?
;
ignoredIdentifier
: IDENTIFIER_
;
ignoredIdentifiers
: ignoredIdentifier (COMMA_ ignoredIdentifier)*
;
matchNone
: 'Default does not match anything'
;
variableName
: AT_ identifier
;
executeAsClause
: (EXEC | EXECUTE) AS (CALLER | SELF | OWNER | stringLiterals)
;
transactionName
: identifier
;
transactionVariableName
: variableName
;
savepointName
: identifier
;
savepointVariableName
: variableName
;
|
formalization/preservation.agda | ivoysey/Obsidian | 79 | 5316 | <reponame>ivoysey/Obsidian
open import Silica
open import HeapProperties
import Context
open TypeEnvContext
open import Data.Nat
open import Relation.Nullary using (¬_; Dec; yes; no)
open import Data.Empty
import Relation.Binary.PropositionalEquality as Eq
data Preservation : Expr → Set where
pres : ∀ {e e' : Expr}
→ ∀ {T T' : Type}
→ ∀ {Δ Δ'' Δ''' : StaticEnv}
→ ∀ {Σ Σ' : RuntimeEnv }
→ Δ ⊢ e ⦂ T ⊣ Δ''
→ Σ & Δ ok
-- TODO: hdref(e)
→ Σ , e ⟶ Σ' , e'
→ (Δ' : StaticEnv)
→ (Δ' ⊢ e' ⦂ T' ⊣ Δ''')
→ (Σ' & Δ' ok) --
→ (Δ''' <* Δ'')
-----------------
→ Preservation e
splitIdempotent : ∀ {Γ T₁ T₂ T₃}
→ Γ ⊢ T₁ ⇛ T₂ / T₃
→ Γ ⊢ T₂ ⇛ T₂ / T₃
splitIdempotent {Γ} {.(base Void)} {.(base Void)} {.(base Void)} voidSplit = voidSplit
splitIdempotent {Γ} {.(base Boolean)} {.(base Boolean)} {.(base Boolean)} booleanSplit = booleanSplit
splitIdempotent {Γ} {.(contractType _)} {.(contractType _)} {.(contractType _)} (unownedSplit namesEq1 namesEq2 permsEq permUnowned) =
unownedSplit refl (Eq.trans (Eq.sym namesEq1) namesEq2) refl permUnowned
splitIdempotent {Γ} {.(contractType _)} {.(contractType _)} {.(contractType _)} (shared-shared-shared x) =
shared-shared-shared x
splitIdempotent {Γ} {.(contractType (tc _ Owned))} {.(contractType (tc _ Shared))} {.(contractType (tc _ Shared))} (owned-shared x) =
shared-shared-shared refl
splitIdempotent {Γ} {.(contractType (record { contractName = _ ; perm = S _ }))}
{.(contractType (record { contractName = _ ; perm = Shared }))}
{.(contractType (record { contractName = _ ; perm = Shared }))}
(states-shared x) =
shared-shared-shared refl
preservation : ∀ {e e' : Expr}
→ {Γ : ContractEnv.ctx}
→ ∀ {T : Type}
→ ∀ {Δ Δ'' : StaticEnv}
→ ∀ {Σ Σ' : RuntimeEnv}
→ Δ ⊢ e ⦂ T ⊣ Δ''
→ Σ & Δ ok
→ Σ , e ⟶ Σ' , e'
-----------------------
→ Preservation e
-- Proof proceeds by induction on the dynamic semantics.
preservation ty@(locTy {Γ} {Δ₀} l voidSplit) consis st@(SElookup {l = l} {v = voidVal} _ lookupL) =
let
Δ = (Δ₀ ,ₗ l ⦂ base Void)
Δ' = Δ
e'TypingJudgment = voidTy {Γ} {Δ = Δ'}
in
pres ty consis st Δ' e'TypingJudgment consis <*-refl
preservation ty@(locTy {Γ} {Δ₀} l booleanSplit) consis st@(SElookup {l = l} {v = boolVal b} _ lookupL) =
let
Δ = (Δ₀ ,ₗ l ⦂ base Boolean)
Δ' = Δ
e'TypingJudgment = boolTy {Γ} {Δ = Δ'} b
in
pres {Δ = Δ} ty consis st Δ' e'TypingJudgment consis <*-refl
-- The code duplication below is very sad, but I haven't figured out a way that doesn't require refactoring the split judgment to be two-level.
preservation ty@(locTy {Γ} {Δ₀} {T₁ = contractType t₁} {T₂ = contractType t₂} {T₃ = contractType t₃} l spl@(unownedSplit _ _ _ _))
consis@(ok Δ voidLookup boolLookup objLookup refConsistencyFunc)
st@(SElookup {Σ} {l = l} {v = objVal o} _ lookupL) =
let
spl' = splitIdempotent spl
e'TypingJudgment = objTy {Γ} {Δ = Δ''} {T₁ = contractType t₂} {T₂ = contractType t₂} {T₃ = contractType t₃} o spl'
consis' = ok {Σ} Δ' voidLookup' boolLookup' objLookup' refConsistency'
in
pres {_} {_} {_} {_} {Δ = Δ} {Δ'' = Δ''} {_} {_} {_} ty consis st Δ' e'TypingJudgment consis' <*-o-extension
where
splT = splitType spl
Δ'' = Δ₀ ,ₗ l ⦂ (SplitType.t₃ splT) -- This is the result of checking e.
Δ' = Δ'' ,ₒ o ⦂ (SplitType.t₂ splT) -- This is the typing context in which we need to typecheck e'.
--Δ = Δ₀ ,ₗ l ⦂ (SplitType.t₁ splT)
-- Show that if you look up l in the new context, you get the same type as before.
voidLookup' : (∀ (l' : IndirectRef)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ base Void
→ (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ voidVal)))
voidLookup' l' l'InΔ' with l' Data.Nat.≟ l
voidLookup' l' (Context.S l'NeqL l'VoidType) | yes eq = ⊥-elim (l'NeqL eq)
voidLookup' l' l'InΔ' | no nEq = voidLookup l' (S nEq (irrelevantReductionsOK l'InΔ' nEq))
boolLookup' : (∀ (l' : IndirectRef)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ base Boolean
→ ∃[ b ] (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ boolVal b)))
boolLookup' l' l'InΔ' with l' Data.Nat.≟ l
boolLookup' l' (Context.S l'NeqL l'BoolType) | yes eq = ⊥-elim (l'NeqL eq)
boolLookup' l' l'InΔ' | no nEq = boolLookup l' (S nEq (irrelevantReductionsOK l'InΔ' nEq))
objLookup' : (l' : IndirectRef) → (T : Tc)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ (contractType T)
→ ∃[ o ] (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ objVal o × (o ObjectRefContext.∈dom (RuntimeEnv.μ Σ))))
objLookup' l' _ l'InΔ' with l' Data.Nat.≟ l
objLookup' l' _ (Context.S l'NeqL l'ObjType) | yes eq = ⊥-elim (l'NeqL eq)
objLookup' l' t l'InΔ'@(Z {a = contractType t₃}) | yes eq = objLookup l' t₁ Z
objLookup' l' t l'InΔ' | no nEq = objLookup l' t (S nEq (irrelevantReductionsOK l'InΔ' nEq))
lookupUnique : objVal o ≡ objVal ( proj₁ (objLookup l t₁ Z))
lookupUnique = IndirectRefContext.contextLookupUnique {RuntimeEnv.ρ Σ} lookupL (proj₁ (proj₂ (objLookup l t₁ Z)))
oLookupUnique = objValInjectiveContrapositive lookupUnique
-- Show that all location-based aliases from the previous environment are compatible with the new alias.
-- Note that Σ is unchanged, so we use Σ instead of defining a separate Σ'.
refConsistency' : (o' : ObjectRef) → o' ObjectRefContext.∈dom (RuntimeEnv.μ Σ) → ReferenceConsistency Σ Δ' o'
refConsistency' o' o'Inμ =
let
origRefConsistency = refConsistencyFunc o' o'Inμ
origConnected = referencesConsistentImpliesConnectivity origRefConsistency
newConnected = splitReplacementOK {Γ} {Σ} {Δ₀} {o} {o'} {l} {t₁} {t₂} {SplitType.t₁ splT} {SplitType.t₂ splT} {SplitType.t₃ splT}
refl refl consis oLookupUnique (proj₁ origConnected) (proj₂ origConnected) spl
in
referencesConsistent {_} {_} {o'} newConnected
preservation ty@(locTy {Γ} {Δ₀} {T₁ = contractType t₁} {T₂ = contractType t₂} {T₃ = contractType t₃} l spl@(shared-shared-shared _))
consis@(ok Δ voidLookup boolLookup objLookup refConsistencyFunc)
st@(SElookup {Σ} {l = l} {v = objVal o} _ lookupL) =
let
spl' = splitIdempotent spl
e'TypingJudgment = objTy {Γ} {Δ = Δ''} {T₁ = contractType t₂} {T₂ = contractType t₂} {T₃ = contractType t₃} o spl'
consis' = ok {Σ} Δ' voidLookup' boolLookup' objLookup' refConsistency'
in
pres {_} {_} {_} {_} {Δ = Δ} {Δ'' = Δ''} {_} {_} {_} ty consis st Δ' e'TypingJudgment consis' <*-o-extension
where
splT = splitType spl
Δ'' = Δ₀ ,ₗ l ⦂ (SplitType.t₃ splT) -- This is the result of checking e.
Δ' = Δ'' ,ₒ o ⦂ (SplitType.t₂ splT) -- This is the typing context in which we need to typecheck e'.
--Δ = Δ₀ ,ₗ l ⦂ (SplitType.t₁ splT)
-- Show that if you look up l in the new context, you get the same type as before.
voidLookup' : (∀ (l' : IndirectRef)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ base Void
→ (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ voidVal)))
voidLookup' l' l'InΔ' with l' Data.Nat.≟ l
voidLookup' l' (Context.S l'NeqL l'VoidType) | yes eq = ⊥-elim (l'NeqL eq)
voidLookup' l' l'InΔ' | no nEq = voidLookup l' (S nEq (irrelevantReductionsOK l'InΔ' nEq))
boolLookup' : (∀ (l' : IndirectRef)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ base Boolean
→ ∃[ b ] (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ boolVal b)))
boolLookup' l' l'InΔ' with l' Data.Nat.≟ l
boolLookup' l' (Context.S l'NeqL l'BoolType) | yes eq = ⊥-elim (l'NeqL eq)
boolLookup' l' l'InΔ' | no nEq = boolLookup l' (S nEq (irrelevantReductionsOK l'InΔ' nEq))
objLookup' : (l' : IndirectRef) → (T : Tc)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ (contractType T)
→ ∃[ o ] (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ objVal o × (o ObjectRefContext.∈dom (RuntimeEnv.μ Σ))))
objLookup' l' _ l'InΔ' with l' Data.Nat.≟ l
objLookup' l' _ (Context.S l'NeqL l'ObjType) | yes eq = ⊥-elim (l'NeqL eq)
objLookup' l' t l'InΔ'@(Z {a = contractType t₃}) | yes eq = objLookup l' t₁ Z
objLookup' l' t l'InΔ' | no nEq = objLookup l' t (S nEq (irrelevantReductionsOK l'InΔ' nEq))
lookupUnique : objVal o ≡ objVal ( proj₁ (objLookup l t₁ Z))
lookupUnique = IndirectRefContext.contextLookupUnique {RuntimeEnv.ρ Σ} lookupL (proj₁ (proj₂ (objLookup l t₁ Z)))
oLookupUnique = objValInjectiveContrapositive lookupUnique
-- Show that all location-based aliases from the previous environment are compatible with the new alias.
-- Note that Σ is unchanged, so we use Σ instead of defining a separate Σ'.
refConsistency' : (o' : ObjectRef) → o' ObjectRefContext.∈dom (RuntimeEnv.μ Σ) → ReferenceConsistency Σ Δ' o'
refConsistency' o' o'Inμ =
let
origRefConsistency = refConsistencyFunc o' o'Inμ
origConnected = referencesConsistentImpliesConnectivity origRefConsistency
newConnected = splitReplacementOK {Γ} {Σ} {Δ₀} {o} {o'} {l} {t₁} {t₂} {SplitType.t₁ splT} {SplitType.t₂ splT} {SplitType.t₃ splT}
refl refl consis oLookupUnique (proj₁ origConnected) (proj₂ origConnected) spl
in
referencesConsistent {_} {_} {o'} newConnected
preservation ty@(locTy {Γ} {Δ₀} {T₁ = contractType t₁} {T₂ = contractType t₂} {T₃ = contractType t₃} l spl@(owned-shared _))
consis@(ok Δ voidLookup boolLookup objLookup refConsistencyFunc)
st@(SElookup {Σ} {l = l} {v = objVal o} _ lookupL) =
let
spl' = splitIdempotent spl
e'TypingJudgment = objTy {Γ} {Δ = Δ''} {T₁ = contractType t₂} {T₂ = contractType t₂} {T₃ = contractType t₃} o spl'
consis' = ok {Σ} Δ' voidLookup' boolLookup' objLookup' refConsistency'
in
pres {_} {_} {_} {_} {Δ = Δ} {Δ'' = Δ''} {_} {_} {_} ty consis st Δ' e'TypingJudgment consis' <*-o-extension
where
splT = splitType spl
Δ'' = Δ₀ ,ₗ l ⦂ (SplitType.t₃ splT) -- This is the result of checking e.
Δ' = Δ'' ,ₒ o ⦂ (SplitType.t₂ splT) -- This is the typing context in which we need to typecheck e'.
--Δ = Δ₀ ,ₗ l ⦂ (SplitType.t₁ splT)
-- Show that if you look up l in the new context, you get the same type as before.
voidLookup' : (∀ (l' : IndirectRef)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ base Void
→ (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ voidVal)))
voidLookup' l' l'InΔ' with l' Data.Nat.≟ l
voidLookup' l' (Context.S l'NeqL l'VoidType) | yes eq = ⊥-elim (l'NeqL eq)
voidLookup' l' l'InΔ' | no nEq = voidLookup l' (S nEq (irrelevantReductionsOK l'InΔ' nEq))
boolLookup' : (∀ (l' : IndirectRef)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ base Boolean
→ ∃[ b ] (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ boolVal b)))
boolLookup' l' l'InΔ' with l' Data.Nat.≟ l
boolLookup' l' (Context.S l'NeqL l'BoolType) | yes eq = ⊥-elim (l'NeqL eq)
boolLookup' l' l'InΔ' | no nEq = boolLookup l' (S nEq (irrelevantReductionsOK l'InΔ' nEq))
objLookup' : (l' : IndirectRef) → (T : Tc)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ (contractType T)
→ ∃[ o ] (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ objVal o × (o ObjectRefContext.∈dom (RuntimeEnv.μ Σ))))
objLookup' l' _ l'InΔ' with l' Data.Nat.≟ l
objLookup' l' _ (Context.S l'NeqL l'ObjType) | yes eq = ⊥-elim (l'NeqL eq)
objLookup' l' t l'InΔ'@(Z {a = contractType t₃}) | yes eq = objLookup l' t₁ Z
objLookup' l' t l'InΔ' | no nEq = objLookup l' t (S nEq (irrelevantReductionsOK l'InΔ' nEq))
lookupUnique : objVal o ≡ objVal ( proj₁ (objLookup l t₁ Z))
lookupUnique = IndirectRefContext.contextLookupUnique {RuntimeEnv.ρ Σ} lookupL (proj₁ (proj₂ (objLookup l t₁ Z)))
oLookupUnique = objValInjectiveContrapositive lookupUnique
-- Show that all location-based aliases from the previous environment are compatible with the new alias.
-- Note that Σ is unchanged, so we use Σ instead of defining a separate Σ'.
refConsistency' : (o' : ObjectRef) → o' ObjectRefContext.∈dom (RuntimeEnv.μ Σ) → ReferenceConsistency Σ Δ' o'
refConsistency' o' o'Inμ =
let
origRefConsistency = refConsistencyFunc o' o'Inμ
origConnected = referencesConsistentImpliesConnectivity origRefConsistency
newConnected = splitReplacementOK {Γ} {Σ} {Δ₀} {o} {o'} {l} {t₁} {t₂} {SplitType.t₁ splT} {SplitType.t₂ splT} {SplitType.t₃ splT}
refl refl consis oLookupUnique (proj₁ origConnected) (proj₂ origConnected) spl
in
referencesConsistent {_} {_} {o'} newConnected
preservation ty@(locTy {Γ} {Δ₀} {T₁ = contractType t₁} {T₂ = contractType t₂} {T₃ = contractType t₃} l spl@(states-shared _))
consis@(ok Δ voidLookup boolLookup objLookup refConsistencyFunc)
st@(SElookup {Σ} {l = l} {v = objVal o} _ lookupL) =
let
spl' = splitIdempotent spl
e'TypingJudgment = objTy {Γ} {Δ = Δ''} {T₁ = contractType t₂} {T₂ = contractType t₂} {T₃ = contractType t₃} o spl'
consis' = ok {Σ} Δ' voidLookup' boolLookup' objLookup' refConsistency'
in
pres {_} {_} {_} {_} {Δ = Δ} {Δ'' = Δ''} {_} {_} {_} ty consis st Δ' e'TypingJudgment consis' <*-o-extension
where
splT = splitType spl
Δ'' = Δ₀ ,ₗ l ⦂ (SplitType.t₃ splT) -- This is the result of checking e.
Δ' = Δ'' ,ₒ o ⦂ (SplitType.t₂ splT) -- This is the typing context in which we need to typecheck e'.
--Δ = Δ₀ ,ₗ l ⦂ (SplitType.t₁ splT)
-- Show that if you look up l in the new context, you get the same type as before.
voidLookup' : (∀ (l' : IndirectRef)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ base Void
→ (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ voidVal)))
voidLookup' l' l'InΔ' with l' Data.Nat.≟ l
voidLookup' l' (Context.S l'NeqL l'VoidType) | yes eq = ⊥-elim (l'NeqL eq)
voidLookup' l' l'InΔ' | no nEq = voidLookup l' (S nEq (irrelevantReductionsOK l'InΔ' nEq))
boolLookup' : (∀ (l' : IndirectRef)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ base Boolean
→ ∃[ b ] (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ boolVal b)))
boolLookup' l' l'InΔ' with l' Data.Nat.≟ l
boolLookup' l' (Context.S l'NeqL l'BoolType) | yes eq = ⊥-elim (l'NeqL eq)
boolLookup' l' l'InΔ' | no nEq = boolLookup l' (S nEq (irrelevantReductionsOK l'InΔ' nEq))
objLookup' : (l' : IndirectRef) → (T : Tc)
→ ((StaticEnv.locEnv Δ') ∋ l' ⦂ (contractType T)
→ ∃[ o ] (RuntimeEnv.ρ Σ IndirectRefContext.∋ l' ⦂ objVal o × (o ObjectRefContext.∈dom (RuntimeEnv.μ Σ))))
objLookup' l' _ l'InΔ' with l' Data.Nat.≟ l
objLookup' l' _ (Context.S l'NeqL l'ObjType) | yes eq = ⊥-elim (l'NeqL eq)
objLookup' l' t l'InΔ'@(Z {a = contractType t₃}) | yes eq = objLookup l' t₁ Z
objLookup' l' t l'InΔ' | no nEq = objLookup l' t (S nEq (irrelevantReductionsOK l'InΔ' nEq))
lookupUnique : objVal o ≡ objVal ( proj₁ (objLookup l t₁ Z))
lookupUnique = IndirectRefContext.contextLookupUnique {RuntimeEnv.ρ Σ} lookupL (proj₁ (proj₂ (objLookup l t₁ Z)))
oLookupUnique = objValInjectiveContrapositive lookupUnique
-- Show that all location-based aliases from the previous environment are compatible with the new alias.
-- Note that Σ is unchanged, so we use Σ instead of defining a separate Σ'.
refConsistency' : (o' : ObjectRef) → o' ObjectRefContext.∈dom (RuntimeEnv.μ Σ) → ReferenceConsistency Σ Δ' o'
refConsistency' o' o'Inμ =
let
origRefConsistency = refConsistencyFunc o' o'Inμ
origConnected = referencesConsistentImpliesConnectivity origRefConsistency
newConnected = splitReplacementOK {Γ} {Σ} {Δ₀} {o} {o'} {l} {t₁} {t₂} {SplitType.t₁ splT} {SplitType.t₂ splT} {SplitType.t₃ splT}
refl refl consis oLookupUnique (proj₁ origConnected) (proj₂ origConnected) spl
in
referencesConsistent {_} {_} {o'} newConnected
preservation {T = contractType t₂}
(locTy {Γ} {Δ₀} {contractType t₁} {.(contractType t₂)} {contractType t₃} l spl)
(ok .(Δ₀ ,ₗ l ⦂ contractType t₁) voidLookup boolLookup objLookup refConsistencyFunc)
(SElookup {Σ} {l = l} {boolVal b} _ lookupL) =
-- The context says the location refers to a contract, but also a boolean value?? Inconsistent.
⊥-elim (lookupNeq lookupUnique)
where
objLookupResult = objLookup l t₁ Z
o = proj₁ objLookupResult
lHasObjType = proj₁ (proj₂ objLookupResult)
lookupUnique = IndirectRefContext.contextLookupUnique lHasObjType lookupL
lookupNeq : (objVal o) ≢ boolVal b
lookupNeq ()
preservation {T = contractType t₂}
(locTy {Γ} {Δ₀} {contractType t₁} {.(contractType t₂)} {contractType t₃} l spl)
(ok .(Δ₀ ,ₗ l ⦂ contractType t₁) voidLookup boolLookup objLookup refConsistencyFunc)
(SElookup {Σ} {l = l} {voidVal} _ lookupL) =
-- The context says the location refers to a contract, but also a boolean value?? Inconsistent.
⊥-elim (lookupNeq lookupUnique)
where
objLookupResult = objLookup l t₁ Z
o = proj₁ objLookupResult
lHasObjType = proj₁ (proj₂ objLookupResult)
lookupUnique = IndirectRefContext.contextLookupUnique lHasObjType lookupL
lookupNeq : (objVal o) ≢ voidVal
lookupNeq ()
preservation
(locTy {Γ} {Δ₀} {.(base Void)} l voidSplit)
(ok .(Δ₀ ,ₗ l ⦂ base Void) voidLookup boolLookup objLookup refConsistencyFunc)
(SElookup {Σ} {Δ} {T = T} {l = l} {boolVal b} lookupLType lookupL) =
⊥-elim (lookupNeq lookupUnique)
where
lLookupResult = voidLookup l Z
lookupUnique = IndirectRefContext.contextLookupUnique lLookupResult lookupL
lookupNeq : voidVal ≢ boolVal b
lookupNeq ()
preservation
(locTy {Γ} {Δ₀} {.(base Void)} l voidSplit)
(ok .(Δ₀ ,ₗ l ⦂ base Void) voidLookup boolLookup objLookup refConsistencyFunc)
(SElookup {Σ} {Δ} {T = T} {l = l} {objVal o} lookupLType lookupL) =
⊥-elim (lookupNeq lookupUnique)
where
lLookupResult = voidLookup l Z
lookupUnique = IndirectRefContext.contextLookupUnique lLookupResult lookupL
lookupNeq : voidVal ≢ objVal o
lookupNeq ()
preservation
(locTy {Γ} {Δ₀} {.(base Boolean)} l booleanSplit)
(ok .(Δ₀ ,ₗ l ⦂ base Boolean) voidLookup boolLookup objLookup refConsistencyFunc)
(SElookup {Σ} {Δ} {T = T} {l = l} {voidVal} lookupLType lookupL) =
⊥-elim (lookupNeq lookupUnique)
where
lLookupResult = boolLookup l Z
lookupUnique = IndirectRefContext.contextLookupUnique (proj₂ lLookupResult) lookupL
lookupNeq : boolVal (proj₁ lLookupResult) ≢ voidVal
lookupNeq ()
preservation
(locTy {Γ} {Δ₀} {.(base Boolean)} l booleanSplit)
(ok .(Δ₀ ,ₗ l ⦂ base Boolean) voidLookup boolLookup objLookup refConsistencyFunc)
(SElookup {Σ} {Δ} {T = T} {l = l} {objVal o} lookupLType lookupL) =
⊥-elim (lookupNeq lookupUnique)
where
lLookupResult = boolLookup l Z
lookupUnique = IndirectRefContext.contextLookupUnique (proj₂ lLookupResult) lookupL
lookupNeq : boolVal (proj₁ lLookupResult) ≢ objVal o
lookupNeq ()
preservation {Γ = Γ} {Δ = Δ} {Δ'' = Δ''} ty@(assertTyₓ _ _) consis st@(SEassertₓ x s) =
pres ty consis st Δ (voidTy {Γ = Γ} {Δ = Δ}) consis <*-refl
preservation {Γ = Γ} {Δ = Δ} {Δ'' = Δ''} ty@(assertTyₗ _ _) consis st@(SEassertₗ x s) =
pres ty consis st Δ (voidTy {Γ = Γ} {Δ = Δ}) consis <*-refl
preservation {Γ = Γ} {Δ = Δ} {Δ'' = Δ''}
ty@(newTy {C = C} {st = st} stOK ty₁ ty₂ CInΓ refl)
consis
step@(SEnew {Σ} {o = o} oFresh refl refl) =
pres ty consis step Δ' newTypeJudgment {!!} {!!}
where
T = contractType (tc C (S [ st ]) )
Δ' = Δ ,ₒ o ⦂ T
spl = unownedSplit {Γ} refl refl refl refl
newTypeJudgment = objTy o spl
|
sound/sfxasm/C2.asm | NatsumiFox/Sonic-3-93-Nov-03 | 7 | 105408 | C2_Header:
sHeaderInit ; Z80 offset is $D98E
sHeaderPatch C2_Patches
sHeaderTick $01
sHeaderCh $01
sHeaderSFX $80, $05, C2_FM5, $E5, $06
C2_FM5:
sPatFM $00
ssModZ80 $02, $01, $06, $D7
dc.b nD0, $64
sStop
C2_Patches:
; Patch $00
; $EB
; $1F, $77, $D0, $11, $1C, $0B, $0F, $0F
; $00, $00, $00, $00, $00, $00, $00, $03
; $D2, $00, $03, $17, $13, $30, $A0, $80
spAlgorithm $03
spFeedback $05
spDetune $01, $0D, $07, $01
spMultiple $0F, $00, $07, $01
spRateScale $00, $00, $00, $00
spAttackRt $1C, $0F, $0B, $0F
spAmpMod $00, $00, $00, $00
spSustainRt $00, $00, $00, $00
spSustainLv $0D, $00, $00, $01
spDecayRt $00, $00, $00, $03
spReleaseRt $02, $03, $00, $07
spTotalLv $13, $20, $30, $00
|
tools/akt-commands.ads | thierr26/ada-keystore | 0 | 22903 | <reponame>thierr26/ada-keystore
-----------------------------------------------------------------------
-- akt-commands -- Ada Keystore Tool commands
-- 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 Keystore.Passwords;
with Keystore.Passwords.GPG;
with Util.Commands;
with Keystore;
private with Util.Log.Loggers;
private with Keystore.Files;
private with Keystore.Passwords.Keys;
private with Ada.Finalization;
private with GNAT.Command_Line;
private with GNAT.Strings;
package AKT.Commands is
Error : exception;
subtype Argument_List is Util.Commands.Argument_List;
type Context_Type is limited private;
-- Print the command usage.
procedure Usage (Args : in Argument_List'Class;
Context : in out Context_Type;
Name : in String := "");
-- Open the keystore file using the password password.
-- When `Use_Worker` is set, a workers of N tasks is created and assigned to the keystore
-- for the decryption and encryption process.
procedure Open_Keystore (Context : in out Context_Type;
Args : in Argument_List'Class;
Use_Worker : in Boolean := False);
-- Open the keystore file and change the password.
procedure Change_Password (Context : in out Context_Type;
Args : in Argument_List'Class;
New_Password : in out Keystore.Passwords.Provider'Class;
Config : in Keystore.Wallet_Config;
Mode : in Keystore.Mode_Type);
-- Execute the command with its arguments.
procedure Execute (Name : in String;
Args : in Argument_List'Class;
Context : in out Context_Type);
procedure Parse (Context : in out Context_Type;
Arguments : out Util.Commands.Dynamic_Argument_List);
procedure Parse_Range (Value : in String;
Config : in out Keystore.Wallet_Config);
-- Get the keystore file path.
function Get_Keystore_Path (Context : in out Context_Type;
Args : in Argument_List'Class) return String;
private
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AKT.Commands");
package GC renames GNAT.Command_Line;
procedure Initialize (Context : in out Keystore.Passwords.GPG.Context_Type);
type Context_Type is limited new Ada.Finalization.Limited_Controlled with record
Wallet : Keystore.Files.Wallet_File;
Info : Keystore.Wallet_Info;
Config : Keystore.Wallet_Config := Keystore.Secure_Config;
Workers : Keystore.Task_Manager_Access;
Provider : Keystore.Passwords.Provider_Access;
Key_Provider : Keystore.Passwords.Keys.Key_Provider_Access;
Slot : Keystore.Key_Slot;
Worker_Count : aliased Integer := 1;
Version : aliased Boolean := False;
Verbose : aliased Boolean := False;
Debug : aliased Boolean := False;
Dump : aliased Boolean := False;
Zero : aliased Boolean := False;
Config_File : aliased GNAT.Strings.String_Access;
Wallet_File : aliased GNAT.Strings.String_Access;
Data_Path : aliased GNAT.Strings.String_Access;
Wallet_Key_File : aliased GNAT.Strings.String_Access;
Password_File : aliased GNAT.Strings.String_Access;
Password_Env : aliased GNAT.Strings.String_Access;
Unsafe_Password : aliased GNAT.Strings.String_Access;
Password_Socket : aliased GNAT.Strings.String_Access;
Password_Command : aliased GNAT.Strings.String_Access;
Password_Askpass : aliased Boolean := False;
No_Password_Opt : Boolean := False;
Command_Config : GC.Command_Line_Configuration;
First_Arg : Positive := 1;
GPG : Keystore.Passwords.GPG.Context_Type;
end record;
-- Initialize the commands.
overriding
procedure Initialize (Context : in out Context_Type);
overriding
procedure Finalize (Context : in out Context_Type);
procedure Setup_Password_Provider (Context : in out Context_Type);
procedure Setup_Key_Provider (Context : in out Context_Type);
-- Setup the command before parsing the arguments and executing it.
procedure Setup (Config : in out GC.Command_Line_Configuration;
Context : in out Context_Type);
end AKT.Commands;
|
core/src/main/java/com/dnt/itl/grammar/LiteralVars.g4 | deepnighttwo/inmem-transfer-language | 5 | 7353 | lexer grammar LiteralVars;
EQUALS : '=';
BIGGER : '>';
SMALLER : '<';
BIGGEROREQ : '>=';
SMALLEROREQ : '<=';
NOTEQUAL : '!=';
NOT : 'not';
AND : 'and';
OR : 'or';
SELECT : 'select' ;
COMMA : ',' ;
FROM : 'from' ;
WHERE : 'where' ;
AS : 'as' ;
LPAREN : '(' ;
RPAREN : ')' ;
DOT : '.' ;
LBRACK : '[' ;
RBRACK : ']' ;
TRUE :'true';
FALSE :'false';
NULL :'null';
MUL : '*' ;
DIV : '/' ;
ADD : '+' ;
SUB : '-' ;
MAP : 'map';
REDUCE : 'reduce';
ON : 'on';
USING : 'using';
HexLiteral : '0' ('x'|'X') HexDigit+ IntegerTypeSuffix? ;
DecimalLiteral : ('0' | '1'..'9' '0'..'9'*) IntegerTypeSuffix? ;
OctalLiteral : '0' ('0'..'7')+ IntegerTypeSuffix? ;
fragment
HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
fragment
IntegerTypeSuffix : ('l'|'L') ;
FloatingPointLiteral
: ('0'..'9')+ '.' ('0'..'9')* Exponent? FloatTypeSuffix?
| '.' ('0'..'9')+ Exponent? FloatTypeSuffix?
| ('0'..'9')+ Exponent FloatTypeSuffix?
| ('0'..'9')+ FloatTypeSuffix
| ('0x' | '0X') (HexDigit )*
('.' (HexDigit)*)?
( 'p' | 'P' )
( '+' | '-' )?
( '0' .. '9' )+
FloatTypeSuffix?
;
fragment
Exponent : ('e'|'E') ('+'|'-')? ('0'..'9')+ ;
fragment
FloatTypeSuffix : ('f'|'F'|'d'|'D') ;
CharacterLiteral
: '\'' ( EscapeSequence | ~('\''|'\\') ) '\''
;
StringLiteral
: '"' ( EscapeSequence | ~('\\'|'"') )* '"'
;
fragment
EscapeSequence
: '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\')
| UnicodeEscape
| OctalEscape
;
fragment
OctalEscape
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
| '\\' ('0'..'7') ('0'..'7')
| '\\' ('0'..'7')
;
fragment
UnicodeEscape
: '\\' 'u' HexDigit HexDigit HexDigit HexDigit
;
ID : [a-zA-Z] [a-zA-Z0-9]*;
WS : [ \t\n\r]+ -> skip;
|
fasm/count.asm | Kharacternyk/ceto19 | 0 | 16679 | ; The number of arguments to proccess.
count=1000000
; Put the start of the arguments chunk into rax.
sub rax, 1
imul rax, count
; The lowest x that should be checked.
mov r9, 1
; Fill `cubes` array.
cubes=buffer
zer rdi
cubesLoop:
inc rdi
mov rbx, rdi
imul rbx, rdi; ^2
imul rbx, rdi; ^3
mov [cubes+rdi*8], rbx
mov rcx, rbx
imul rcx, 3
cmp rcx, rax
ja @f
mov r9, rdi
@@: sub rbx, count
cmp rbx, rax
jl cubesLoop
; Store the highest index.
mov rcx, rdi
; Prepare `results` array.
results=buffer+5000*8
zer r15
zerLoop:
mov byte [results+r15], 0
inc r15
cmp r15, count
jna zerLoop
; Check every combination, x>=y>=z.
mov r12, r9 ; x
xLoop:
mov r13, 1 ; y
yLoop:
mov r14, 1 ; z
zLoop:
mov r15, [cubes+r12*8]
add r15, [cubes+r13*8]
add r15, [cubes+r14*8]
sub r15, rax
cmp r15, 0
jl @f
cmp r15, count
jg @f
inc byte [results+r15]
@@: inc r14
cmp r14, r13
jna zLoop
inc r13
cmp r13, r12
jna yLoop
inc r12
cmp r12, rcx
jna xLoop
; Push all results.
zer r8
pushLoop:
movzx rbx, byte [results+r8]
cmp rbx, 0
je @f
push LF
push rbx
push TAB
mov r9, rax
add r9, r8
push r9
@@: inc r8
cmp r8, count
jb pushLoop
|
theorems/homotopy/SuspSmash.agda | cmknapp/HoTT-Agda | 0 | 7387 | <filename>theorems/homotopy/SuspSmash.agda
{-# OPTIONS --without-K #-}
open import HoTT
open import homotopy.elims.SuspSmash
open import homotopy.elims.CofPushoutSection
-- Σ(X∧Y) ≃ X * Y
module homotopy.SuspSmash {i j} (X : Ptd i) (Y : Ptd j) where
private
{- path lemmas -}
private
reduce-x : ∀ {i} {A : Type i} {x y z : A} (p : x == y) (q : z == y)
→ p ∙ ! q ∙ q ∙ ! p ∙ p == p
reduce-x idp idp = idp
reduce-y : ∀ {i} {A : Type i} {x y z : A} (p : x == y) (q : x == z)
→ p ∙ ! p ∙ q ∙ ! q ∙ p == p
reduce-y idp idp = idp
module Into = SuspensionRec {A = Smash X Y}
{C = fst (X ⊙* Y)}
(left (snd X))
(right (snd Y))
(CofPushoutSection.rec (λ _ → tt) (λ _ → idp)
(glue (snd X , snd Y))
(λ {(x , y) →
glue (snd X , snd Y) ∙ ! (glue (x , snd Y))
∙ glue (x , y)
∙ ! (glue (snd X , y)) ∙ glue (snd X , snd Y)})
(λ x → ! (reduce-x (glue (snd X , snd Y)) (glue (x , snd Y))))
(λ y → ! (reduce-y (glue (snd X , snd Y)) (glue (snd X , y)))))
into = Into.f
module Out = PushoutRec {d = ⊙span-out (*-⊙span X Y)}
{D = Suspension (Smash X Y)}
(λ _ → north)
(λ _ → south)
(λ {(x , y) → merid (cfcod (x , y))})
out = Out.f
into-out : (j : fst (X ⊙* Y)) → into (out j) == j
into-out = Pushout-elim
(λ x → glue (snd X , snd Y) ∙ ! (glue (x , snd Y)))
(λ y → ! (glue (snd X , snd Y)) ∙ glue (snd X , y))
(↓-∘=idf-from-square into out ∘ λ {(x , y) →
(ap (ap into) (Out.glue-β (x , y))
∙ Into.merid-β (cfcod (x , y)))
∙v⊡ lemma (glue (snd X , snd Y)) (glue (x , snd Y))
(glue (snd X , y)) (glue (x , y))})
where
lemma : ∀ {i} {A : Type i} {x y z w : A}
(p : x == y) (q : z == y) (r : x == w) (s : z == w)
→ Square (p ∙ ! q) (p ∙ ! q ∙ s ∙ ! r ∙ p) s (! p ∙ r)
lemma idp idp idp s =
vert-degen-square (∙-unit-r s)
out-into : (σ : Suspension (Smash X Y)) → out (into σ) == σ
out-into = susp-smash-elim
idp
idp
(↓-∘=idf-in out into ∘ λ {(x , y) →
ap (ap out) (Into.merid-β (cfcod (x , y)))
∙ lemma₁ out (Out.glue-β (snd X , snd Y))
(Out.glue-β (x , snd Y))
(Out.glue-β (x , y))
(Out.glue-β (snd X , y))
(Out.glue-β (snd X , snd Y))
∙ lemma₂ {p = merid (cfcod (snd X , snd Y))}
{q = merid (cfcod (x , snd Y))}
{r = merid (cfcod (x , y))}
{s = merid (cfcod (snd X , y))}
{t = merid (cfcod (snd X , snd Y))}
(ap merid (! (cfglue (winl (snd X))) ∙ cfglue (winl x)))
(ap merid (! (cfglue (winr y)) ∙ cfglue (winr (snd Y))))})
where
lemma₁ : ∀ {i j} {A : Type i} {B : Type j} (f : A → B)
{x y z u v w : A}
{p : x == y} {q : z == y} {r : z == u} {s : v == u} {t : v == w}
{p' : f x == f y} {q' : f z == f y} {r' : f z == f u}
{s' : f v == f u} {t' : f v == f w}
(α : ap f p == p') (β : ap f q == q') (γ : ap f r == r')
(δ : ap f s == s') (ε : ap f t == t')
→ ap f (p ∙ ! q ∙ r ∙ ! s ∙ t) == p' ∙ ! q' ∙ r' ∙ ! s' ∙ t'
lemma₁ f {p = idp} {q = idp} {r = idp} {s = idp} {t = idp}
idp idp idp idp idp
= idp
lemma₂ : ∀ {i} {A : Type i} {x y z u : A}
{p q : x == y} {r : x == z} {s t : u == z}
(α : p == q) (β : s == t)
→ p ∙ ! q ∙ r ∙ ! s ∙ t == r
lemma₂ {p = idp} {r = idp} {s = idp} idp idp = idp
module SuspSmash where
eq : Suspension (Smash X Y) ≃ fst (X ⊙* Y)
eq = equiv into out into-out out-into
path : Suspension (Smash X Y) == fst (X ⊙* Y)
path = ua eq
⊙path : ⊙Susp (⊙Smash X Y) == (X ⊙* Y)
⊙path = ⊙ua (⊙≃-in eq idp)
|
user/crashtest.asm | joshiamey/xv6-riscv-fall19 | 1 | 85991 |
user/_crashtest: file format elf64-littleriscv
Disassembly of section .text:
0000000000000000 <test0>:
test0();
exit();
}
void test0()
{
0: 7179 addi sp,sp,-48
2: f406 sd ra,40(sp)
4: f022 sd s0,32(sp)
6: 1800 addi s0,sp,48
struct stat st;
printf("test0 start\n");
8: 00001517 auipc a0,0x1
c: 83850513 addi a0,a0,-1992 # 840 <malloc+0xe4>
10: 00000097 auipc ra,0x0
14: 68e080e7 jalr 1678(ra) # 69e <printf>
mknod("disk1", DISK, 1);
18: 4605 li a2,1
1a: 4581 li a1,0
1c: 00001517 auipc a0,0x1
20: 83450513 addi a0,a0,-1996 # 850 <malloc+0xf4>
24: 00000097 auipc ra,0x0
28: 32a080e7 jalr 810(ra) # 34e <mknod>
if (stat("/m/crashf", &st) == 0) {
2c: fd840593 addi a1,s0,-40
30: 00001517 auipc a0,0x1
34: 82850513 addi a0,a0,-2008 # 858 <malloc+0xfc>
38: 00000097 auipc ra,0x0
3c: 208080e7 jalr 520(ra) # 240 <stat>
40: cd21 beqz a0,98 <test0+0x98>
printf("stat /m/crashf succeeded\n");
exit();
}
if (mount("/disk1", "/m") < 0) {
42: 00001597 auipc a1,0x1
46: 84658593 addi a1,a1,-1978 # 888 <malloc+0x12c>
4a: 00001517 auipc a0,0x1
4e: 84650513 addi a0,a0,-1978 # 890 <malloc+0x134>
52: 00000097 auipc ra,0x0
56: 364080e7 jalr 868(ra) # 3b6 <mount>
5a: 04054b63 bltz a0,b0 <test0+0xb0>
printf("mount failed\n");
exit();
}
if (stat("/m/crashf", &st) < 0) {
5e: fd840593 addi a1,s0,-40
62: 00000517 auipc a0,0x0
66: 7f650513 addi a0,a0,2038 # 858 <malloc+0xfc>
6a: 00000097 auipc ra,0x0
6e: 1d6080e7 jalr 470(ra) # 240 <stat>
72: 04054b63 bltz a0,c8 <test0+0xc8>
printf("stat /m/crashf failed\n");
exit();
}
if (minor(st.dev) != 1) {
76: fd845583 lhu a1,-40(s0)
7a: 4785 li a5,1
7c: 06f59263 bne a1,a5,e0 <test0+0xe0>
printf("stat wrong minor %d\n", minor(st.dev));
exit();
}
printf("test0 ok\n");
80: 00001517 auipc a0,0x1
84: 85850513 addi a0,a0,-1960 # 8d8 <malloc+0x17c>
88: 00000097 auipc ra,0x0
8c: 616080e7 jalr 1558(ra) # 69e <printf>
}
90: 70a2 ld ra,40(sp)
92: 7402 ld s0,32(sp)
94: 6145 addi sp,sp,48
96: 8082 ret
printf("stat /m/crashf succeeded\n");
98: 00000517 auipc a0,0x0
9c: 7d050513 addi a0,a0,2000 # 868 <malloc+0x10c>
a0: 00000097 auipc ra,0x0
a4: 5fe080e7 jalr 1534(ra) # 69e <printf>
exit();
a8: 00000097 auipc ra,0x0
ac: 25e080e7 jalr 606(ra) # 306 <exit>
printf("mount failed\n");
b0: 00000517 auipc a0,0x0
b4: 7e850513 addi a0,a0,2024 # 898 <malloc+0x13c>
b8: 00000097 auipc ra,0x0
bc: 5e6080e7 jalr 1510(ra) # 69e <printf>
exit();
c0: 00000097 auipc ra,0x0
c4: 246080e7 jalr 582(ra) # 306 <exit>
printf("stat /m/crashf failed\n");
c8: 00000517 auipc a0,0x0
cc: 7e050513 addi a0,a0,2016 # 8a8 <malloc+0x14c>
d0: 00000097 auipc ra,0x0
d4: 5ce080e7 jalr 1486(ra) # 69e <printf>
exit();
d8: 00000097 auipc ra,0x0
dc: 22e080e7 jalr 558(ra) # 306 <exit>
printf("stat wrong minor %d\n", minor(st.dev));
e0: 00000517 auipc a0,0x0
e4: 7e050513 addi a0,a0,2016 # 8c0 <malloc+0x164>
e8: 00000097 auipc ra,0x0
ec: 5b6080e7 jalr 1462(ra) # 69e <printf>
exit();
f0: 00000097 auipc ra,0x0
f4: 216080e7 jalr 534(ra) # 306 <exit>
00000000000000f8 <main>:
{
f8: 1141 addi sp,sp,-16
fa: e406 sd ra,8(sp)
fc: e022 sd s0,0(sp)
fe: 0800 addi s0,sp,16
test0();
100: 00000097 auipc ra,0x0
104: f00080e7 jalr -256(ra) # 0 <test0>
exit();
108: 00000097 auipc ra,0x0
10c: 1fe080e7 jalr 510(ra) # 306 <exit>
0000000000000110 <strcpy>:
#include "kernel/fcntl.h"
#include "user/user.h"
char*
strcpy(char *s, const char *t)
{
110: 1141 addi sp,sp,-16
112: e422 sd s0,8(sp)
114: 0800 addi s0,sp,16
char *os;
os = s;
while((*s++ = *t++) != 0)
116: 87aa mv a5,a0
118: 0585 addi a1,a1,1
11a: 0785 addi a5,a5,1
11c: fff5c703 lbu a4,-1(a1)
120: fee78fa3 sb a4,-1(a5)
124: fb75 bnez a4,118 <strcpy+0x8>
;
return os;
}
126: 6422 ld s0,8(sp)
128: 0141 addi sp,sp,16
12a: 8082 ret
000000000000012c <strcmp>:
int
strcmp(const char *p, const char *q)
{
12c: 1141 addi sp,sp,-16
12e: e422 sd s0,8(sp)
130: 0800 addi s0,sp,16
while(*p && *p == *q)
132: 00054783 lbu a5,0(a0)
136: cb91 beqz a5,14a <strcmp+0x1e>
138: 0005c703 lbu a4,0(a1)
13c: 00f71763 bne a4,a5,14a <strcmp+0x1e>
p++, q++;
140: 0505 addi a0,a0,1
142: 0585 addi a1,a1,1
while(*p && *p == *q)
144: 00054783 lbu a5,0(a0)
148: fbe5 bnez a5,138 <strcmp+0xc>
return (uchar)*p - (uchar)*q;
14a: 0005c503 lbu a0,0(a1)
}
14e: 40a7853b subw a0,a5,a0
152: 6422 ld s0,8(sp)
154: 0141 addi sp,sp,16
156: 8082 ret
0000000000000158 <strlen>:
uint
strlen(const char *s)
{
158: 1141 addi sp,sp,-16
15a: e422 sd s0,8(sp)
15c: 0800 addi s0,sp,16
int n;
for(n = 0; s[n]; n++)
15e: 00054783 lbu a5,0(a0)
162: cf91 beqz a5,17e <strlen+0x26>
164: 0505 addi a0,a0,1
166: 87aa mv a5,a0
168: 4685 li a3,1
16a: 9e89 subw a3,a3,a0
16c: 00f6853b addw a0,a3,a5
170: 0785 addi a5,a5,1
172: fff7c703 lbu a4,-1(a5)
176: fb7d bnez a4,16c <strlen+0x14>
;
return n;
}
178: 6422 ld s0,8(sp)
17a: 0141 addi sp,sp,16
17c: 8082 ret
for(n = 0; s[n]; n++)
17e: 4501 li a0,0
180: bfe5 j 178 <strlen+0x20>
0000000000000182 <memset>:
void*
memset(void *dst, int c, uint n)
{
182: 1141 addi sp,sp,-16
184: e422 sd s0,8(sp)
186: 0800 addi s0,sp,16
char *cdst = (char *) dst;
int i;
for(i = 0; i < n; i++){
188: ce09 beqz a2,1a2 <memset+0x20>
18a: 87aa mv a5,a0
18c: fff6071b addiw a4,a2,-1
190: 1702 slli a4,a4,0x20
192: 9301 srli a4,a4,0x20
194: 0705 addi a4,a4,1
196: 972a add a4,a4,a0
cdst[i] = c;
198: 00b78023 sb a1,0(a5)
for(i = 0; i < n; i++){
19c: 0785 addi a5,a5,1
19e: fee79de3 bne a5,a4,198 <memset+0x16>
}
return dst;
}
1a2: 6422 ld s0,8(sp)
1a4: 0141 addi sp,sp,16
1a6: 8082 ret
00000000000001a8 <strchr>:
char*
strchr(const char *s, char c)
{
1a8: 1141 addi sp,sp,-16
1aa: e422 sd s0,8(sp)
1ac: 0800 addi s0,sp,16
for(; *s; s++)
1ae: 00054783 lbu a5,0(a0)
1b2: cb99 beqz a5,1c8 <strchr+0x20>
if(*s == c)
1b4: 00f58763 beq a1,a5,1c2 <strchr+0x1a>
for(; *s; s++)
1b8: 0505 addi a0,a0,1
1ba: 00054783 lbu a5,0(a0)
1be: fbfd bnez a5,1b4 <strchr+0xc>
return (char*)s;
return 0;
1c0: 4501 li a0,0
}
1c2: 6422 ld s0,8(sp)
1c4: 0141 addi sp,sp,16
1c6: 8082 ret
return 0;
1c8: 4501 li a0,0
1ca: bfe5 j 1c2 <strchr+0x1a>
00000000000001cc <gets>:
char*
gets(char *buf, int max)
{
1cc: 711d addi sp,sp,-96
1ce: ec86 sd ra,88(sp)
1d0: e8a2 sd s0,80(sp)
1d2: e4a6 sd s1,72(sp)
1d4: e0ca sd s2,64(sp)
1d6: fc4e sd s3,56(sp)
1d8: f852 sd s4,48(sp)
1da: f456 sd s5,40(sp)
1dc: f05a sd s6,32(sp)
1de: ec5e sd s7,24(sp)
1e0: 1080 addi s0,sp,96
1e2: 8baa mv s7,a0
1e4: 8a2e mv s4,a1
int i, cc;
char c;
for(i=0; i+1 < max; ){
1e6: 892a mv s2,a0
1e8: 4481 li s1,0
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
1ea: 4aa9 li s5,10
1ec: 4b35 li s6,13
for(i=0; i+1 < max; ){
1ee: 89a6 mv s3,s1
1f0: 2485 addiw s1,s1,1
1f2: 0344d863 bge s1,s4,222 <gets+0x56>
cc = read(0, &c, 1);
1f6: 4605 li a2,1
1f8: faf40593 addi a1,s0,-81
1fc: 4501 li a0,0
1fe: 00000097 auipc ra,0x0
202: 120080e7 jalr 288(ra) # 31e <read>
if(cc < 1)
206: 00a05e63 blez a0,222 <gets+0x56>
buf[i++] = c;
20a: faf44783 lbu a5,-81(s0)
20e: 00f90023 sb a5,0(s2)
if(c == '\n' || c == '\r')
212: 01578763 beq a5,s5,220 <gets+0x54>
216: 0905 addi s2,s2,1
218: fd679be3 bne a5,s6,1ee <gets+0x22>
for(i=0; i+1 < max; ){
21c: 89a6 mv s3,s1
21e: a011 j 222 <gets+0x56>
220: 89a6 mv s3,s1
break;
}
buf[i] = '\0';
222: 99de add s3,s3,s7
224: 00098023 sb zero,0(s3)
return buf;
}
228: 855e mv a0,s7
22a: 60e6 ld ra,88(sp)
22c: 6446 ld s0,80(sp)
22e: 64a6 ld s1,72(sp)
230: 6906 ld s2,64(sp)
232: 79e2 ld s3,56(sp)
234: 7a42 ld s4,48(sp)
236: 7aa2 ld s5,40(sp)
238: 7b02 ld s6,32(sp)
23a: 6be2 ld s7,24(sp)
23c: 6125 addi sp,sp,96
23e: 8082 ret
0000000000000240 <stat>:
int
stat(const char *n, struct stat *st)
{
240: 1101 addi sp,sp,-32
242: ec06 sd ra,24(sp)
244: e822 sd s0,16(sp)
246: e426 sd s1,8(sp)
248: e04a sd s2,0(sp)
24a: 1000 addi s0,sp,32
24c: 892e mv s2,a1
int fd;
int r;
fd = open(n, O_RDONLY);
24e: 4581 li a1,0
250: 00000097 auipc ra,0x0
254: 0f6080e7 jalr 246(ra) # 346 <open>
if(fd < 0)
258: 02054563 bltz a0,282 <stat+0x42>
25c: 84aa mv s1,a0
return -1;
r = fstat(fd, st);
25e: 85ca mv a1,s2
260: 00000097 auipc ra,0x0
264: 0fe080e7 jalr 254(ra) # 35e <fstat>
268: 892a mv s2,a0
close(fd);
26a: 8526 mv a0,s1
26c: 00000097 auipc ra,0x0
270: 0c2080e7 jalr 194(ra) # 32e <close>
return r;
}
274: 854a mv a0,s2
276: 60e2 ld ra,24(sp)
278: 6442 ld s0,16(sp)
27a: 64a2 ld s1,8(sp)
27c: 6902 ld s2,0(sp)
27e: 6105 addi sp,sp,32
280: 8082 ret
return -1;
282: 597d li s2,-1
284: bfc5 j 274 <stat+0x34>
0000000000000286 <atoi>:
int
atoi(const char *s)
{
286: 1141 addi sp,sp,-16
288: e422 sd s0,8(sp)
28a: 0800 addi s0,sp,16
int n;
n = 0;
while('0' <= *s && *s <= '9')
28c: 00054603 lbu a2,0(a0)
290: fd06079b addiw a5,a2,-48
294: 0ff7f793 andi a5,a5,255
298: 4725 li a4,9
29a: 02f76963 bltu a4,a5,2cc <atoi+0x46>
29e: 86aa mv a3,a0
n = 0;
2a0: 4501 li a0,0
while('0' <= *s && *s <= '9')
2a2: 45a5 li a1,9
n = n*10 + *s++ - '0';
2a4: 0685 addi a3,a3,1
2a6: 0025179b slliw a5,a0,0x2
2aa: 9fa9 addw a5,a5,a0
2ac: 0017979b slliw a5,a5,0x1
2b0: 9fb1 addw a5,a5,a2
2b2: fd07851b addiw a0,a5,-48
while('0' <= *s && *s <= '9')
2b6: 0006c603 lbu a2,0(a3)
2ba: fd06071b addiw a4,a2,-48
2be: 0ff77713 andi a4,a4,255
2c2: fee5f1e3 bgeu a1,a4,2a4 <atoi+0x1e>
return n;
}
2c6: 6422 ld s0,8(sp)
2c8: 0141 addi sp,sp,16
2ca: 8082 ret
n = 0;
2cc: 4501 li a0,0
2ce: bfe5 j 2c6 <atoi+0x40>
00000000000002d0 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
2d0: 1141 addi sp,sp,-16
2d2: e422 sd s0,8(sp)
2d4: 0800 addi s0,sp,16
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2d6: 02c05163 blez a2,2f8 <memmove+0x28>
2da: fff6071b addiw a4,a2,-1
2de: 1702 slli a4,a4,0x20
2e0: 9301 srli a4,a4,0x20
2e2: 0705 addi a4,a4,1
2e4: 972a add a4,a4,a0
dst = vdst;
2e6: 87aa mv a5,a0
*dst++ = *src++;
2e8: 0585 addi a1,a1,1
2ea: 0785 addi a5,a5,1
2ec: fff5c683 lbu a3,-1(a1)
2f0: fed78fa3 sb a3,-1(a5)
while(n-- > 0)
2f4: fee79ae3 bne a5,a4,2e8 <memmove+0x18>
return vdst;
}
2f8: 6422 ld s0,8(sp)
2fa: 0141 addi sp,sp,16
2fc: 8082 ret
00000000000002fe <fork>:
# generated by usys.pl - do not edit
#include "kernel/syscall.h"
.global fork
fork:
li a7, SYS_fork
2fe: 4885 li a7,1
ecall
300: 00000073 ecall
ret
304: 8082 ret
0000000000000306 <exit>:
.global exit
exit:
li a7, SYS_exit
306: 4889 li a7,2
ecall
308: 00000073 ecall
ret
30c: 8082 ret
000000000000030e <wait>:
.global wait
wait:
li a7, SYS_wait
30e: 488d li a7,3
ecall
310: 00000073 ecall
ret
314: 8082 ret
0000000000000316 <pipe>:
.global pipe
pipe:
li a7, SYS_pipe
316: 4891 li a7,4
ecall
318: 00000073 ecall
ret
31c: 8082 ret
000000000000031e <read>:
.global read
read:
li a7, SYS_read
31e: 4895 li a7,5
ecall
320: 00000073 ecall
ret
324: 8082 ret
0000000000000326 <write>:
.global write
write:
li a7, SYS_write
326: 48c1 li a7,16
ecall
328: 00000073 ecall
ret
32c: 8082 ret
000000000000032e <close>:
.global close
close:
li a7, SYS_close
32e: 48d5 li a7,21
ecall
330: 00000073 ecall
ret
334: 8082 ret
0000000000000336 <kill>:
.global kill
kill:
li a7, SYS_kill
336: 4899 li a7,6
ecall
338: 00000073 ecall
ret
33c: 8082 ret
000000000000033e <exec>:
.global exec
exec:
li a7, SYS_exec
33e: 489d li a7,7
ecall
340: 00000073 ecall
ret
344: 8082 ret
0000000000000346 <open>:
.global open
open:
li a7, SYS_open
346: 48bd li a7,15
ecall
348: 00000073 ecall
ret
34c: 8082 ret
000000000000034e <mknod>:
.global mknod
mknod:
li a7, SYS_mknod
34e: 48c5 li a7,17
ecall
350: 00000073 ecall
ret
354: 8082 ret
0000000000000356 <unlink>:
.global unlink
unlink:
li a7, SYS_unlink
356: 48c9 li a7,18
ecall
358: 00000073 ecall
ret
35c: 8082 ret
000000000000035e <fstat>:
.global fstat
fstat:
li a7, SYS_fstat
35e: 48a1 li a7,8
ecall
360: 00000073 ecall
ret
364: 8082 ret
0000000000000366 <link>:
.global link
link:
li a7, SYS_link
366: 48cd li a7,19
ecall
368: 00000073 ecall
ret
36c: 8082 ret
000000000000036e <mkdir>:
.global mkdir
mkdir:
li a7, SYS_mkdir
36e: 48d1 li a7,20
ecall
370: 00000073 ecall
ret
374: 8082 ret
0000000000000376 <chdir>:
.global chdir
chdir:
li a7, SYS_chdir
376: 48a5 li a7,9
ecall
378: 00000073 ecall
ret
37c: 8082 ret
000000000000037e <dup>:
.global dup
dup:
li a7, SYS_dup
37e: 48a9 li a7,10
ecall
380: 00000073 ecall
ret
384: 8082 ret
0000000000000386 <getpid>:
.global getpid
getpid:
li a7, SYS_getpid
386: 48ad li a7,11
ecall
388: 00000073 ecall
ret
38c: 8082 ret
000000000000038e <sbrk>:
.global sbrk
sbrk:
li a7, SYS_sbrk
38e: 48b1 li a7,12
ecall
390: 00000073 ecall
ret
394: 8082 ret
0000000000000396 <sleep>:
.global sleep
sleep:
li a7, SYS_sleep
396: 48b5 li a7,13
ecall
398: 00000073 ecall
ret
39c: 8082 ret
000000000000039e <uptime>:
.global uptime
uptime:
li a7, SYS_uptime
39e: 48b9 li a7,14
ecall
3a0: 00000073 ecall
ret
3a4: 8082 ret
00000000000003a6 <ntas>:
.global ntas
ntas:
li a7, SYS_ntas
3a6: 48d9 li a7,22
ecall
3a8: 00000073 ecall
ret
3ac: 8082 ret
00000000000003ae <crash>:
.global crash
crash:
li a7, SYS_crash
3ae: 48dd li a7,23
ecall
3b0: 00000073 ecall
ret
3b4: 8082 ret
00000000000003b6 <mount>:
.global mount
mount:
li a7, SYS_mount
3b6: 48e1 li a7,24
ecall
3b8: 00000073 ecall
ret
3bc: 8082 ret
00000000000003be <umount>:
.global umount
umount:
li a7, SYS_umount
3be: 48e5 li a7,25
ecall
3c0: 00000073 ecall
ret
3c4: 8082 ret
00000000000003c6 <putc>:
static char digits[] = "0123456789ABCDEF";
static void
putc(int fd, char c)
{
3c6: 1101 addi sp,sp,-32
3c8: ec06 sd ra,24(sp)
3ca: e822 sd s0,16(sp)
3cc: 1000 addi s0,sp,32
3ce: feb407a3 sb a1,-17(s0)
write(fd, &c, 1);
3d2: 4605 li a2,1
3d4: fef40593 addi a1,s0,-17
3d8: 00000097 auipc ra,0x0
3dc: f4e080e7 jalr -178(ra) # 326 <write>
}
3e0: 60e2 ld ra,24(sp)
3e2: 6442 ld s0,16(sp)
3e4: 6105 addi sp,sp,32
3e6: 8082 ret
00000000000003e8 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
3e8: 7139 addi sp,sp,-64
3ea: fc06 sd ra,56(sp)
3ec: f822 sd s0,48(sp)
3ee: f426 sd s1,40(sp)
3f0: f04a sd s2,32(sp)
3f2: ec4e sd s3,24(sp)
3f4: 0080 addi s0,sp,64
3f6: 84aa mv s1,a0
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
3f8: c299 beqz a3,3fe <printint+0x16>
3fa: 0805c863 bltz a1,48a <printint+0xa2>
neg = 1;
x = -xx;
} else {
x = xx;
3fe: 2581 sext.w a1,a1
neg = 0;
400: 4881 li a7,0
402: fc040693 addi a3,s0,-64
}
i = 0;
406: 4701 li a4,0
do{
buf[i++] = digits[x % base];
408: 2601 sext.w a2,a2
40a: 00000517 auipc a0,0x0
40e: 4e650513 addi a0,a0,1254 # 8f0 <digits>
412: 883a mv a6,a4
414: 2705 addiw a4,a4,1
416: 02c5f7bb remuw a5,a1,a2
41a: 1782 slli a5,a5,0x20
41c: 9381 srli a5,a5,0x20
41e: 97aa add a5,a5,a0
420: 0007c783 lbu a5,0(a5)
424: 00f68023 sb a5,0(a3)
}while((x /= base) != 0);
428: 0005879b sext.w a5,a1
42c: 02c5d5bb divuw a1,a1,a2
430: 0685 addi a3,a3,1
432: fec7f0e3 bgeu a5,a2,412 <printint+0x2a>
if(neg)
436: 00088b63 beqz a7,44c <printint+0x64>
buf[i++] = '-';
43a: fd040793 addi a5,s0,-48
43e: 973e add a4,a4,a5
440: 02d00793 li a5,45
444: fef70823 sb a5,-16(a4)
448: 0028071b addiw a4,a6,2
while(--i >= 0)
44c: 02e05863 blez a4,47c <printint+0x94>
450: fc040793 addi a5,s0,-64
454: 00e78933 add s2,a5,a4
458: fff78993 addi s3,a5,-1
45c: 99ba add s3,s3,a4
45e: 377d addiw a4,a4,-1
460: 1702 slli a4,a4,0x20
462: 9301 srli a4,a4,0x20
464: 40e989b3 sub s3,s3,a4
putc(fd, buf[i]);
468: fff94583 lbu a1,-1(s2)
46c: 8526 mv a0,s1
46e: 00000097 auipc ra,0x0
472: f58080e7 jalr -168(ra) # 3c6 <putc>
while(--i >= 0)
476: 197d addi s2,s2,-1
478: ff3918e3 bne s2,s3,468 <printint+0x80>
}
47c: 70e2 ld ra,56(sp)
47e: 7442 ld s0,48(sp)
480: 74a2 ld s1,40(sp)
482: 7902 ld s2,32(sp)
484: 69e2 ld s3,24(sp)
486: 6121 addi sp,sp,64
488: 8082 ret
x = -xx;
48a: 40b005bb negw a1,a1
neg = 1;
48e: 4885 li a7,1
x = -xx;
490: bf8d j 402 <printint+0x1a>
0000000000000492 <vprintf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
vprintf(int fd, const char *fmt, va_list ap)
{
492: 7119 addi sp,sp,-128
494: fc86 sd ra,120(sp)
496: f8a2 sd s0,112(sp)
498: f4a6 sd s1,104(sp)
49a: f0ca sd s2,96(sp)
49c: ecce sd s3,88(sp)
49e: e8d2 sd s4,80(sp)
4a0: e4d6 sd s5,72(sp)
4a2: e0da sd s6,64(sp)
4a4: fc5e sd s7,56(sp)
4a6: f862 sd s8,48(sp)
4a8: f466 sd s9,40(sp)
4aa: f06a sd s10,32(sp)
4ac: ec6e sd s11,24(sp)
4ae: 0100 addi s0,sp,128
char *s;
int c, i, state;
state = 0;
for(i = 0; fmt[i]; i++){
4b0: 0005c903 lbu s2,0(a1)
4b4: 18090f63 beqz s2,652 <vprintf+0x1c0>
4b8: 8aaa mv s5,a0
4ba: 8b32 mv s6,a2
4bc: 00158493 addi s1,a1,1
state = 0;
4c0: 4981 li s3,0
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
4c2: 02500a13 li s4,37
if(c == 'd'){
4c6: 06400c13 li s8,100
printint(fd, va_arg(ap, int), 10, 1);
} else if(c == 'l') {
4ca: 06c00c93 li s9,108
printint(fd, va_arg(ap, uint64), 10, 0);
} else if(c == 'x') {
4ce: 07800d13 li s10,120
printint(fd, va_arg(ap, int), 16, 0);
} else if(c == 'p') {
4d2: 07000d93 li s11,112
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
4d6: 00000b97 auipc s7,0x0
4da: 41ab8b93 addi s7,s7,1050 # 8f0 <digits>
4de: a839 j 4fc <vprintf+0x6a>
putc(fd, c);
4e0: 85ca mv a1,s2
4e2: 8556 mv a0,s5
4e4: 00000097 auipc ra,0x0
4e8: ee2080e7 jalr -286(ra) # 3c6 <putc>
4ec: a019 j 4f2 <vprintf+0x60>
} else if(state == '%'){
4ee: 01498f63 beq s3,s4,50c <vprintf+0x7a>
for(i = 0; fmt[i]; i++){
4f2: 0485 addi s1,s1,1
4f4: fff4c903 lbu s2,-1(s1)
4f8: 14090d63 beqz s2,652 <vprintf+0x1c0>
c = fmt[i] & 0xff;
4fc: 0009079b sext.w a5,s2
if(state == 0){
500: fe0997e3 bnez s3,4ee <vprintf+0x5c>
if(c == '%'){
504: fd479ee3 bne a5,s4,4e0 <vprintf+0x4e>
state = '%';
508: 89be mv s3,a5
50a: b7e5 j 4f2 <vprintf+0x60>
if(c == 'd'){
50c: 05878063 beq a5,s8,54c <vprintf+0xba>
} else if(c == 'l') {
510: 05978c63 beq a5,s9,568 <vprintf+0xd6>
} else if(c == 'x') {
514: 07a78863 beq a5,s10,584 <vprintf+0xf2>
} else if(c == 'p') {
518: 09b78463 beq a5,s11,5a0 <vprintf+0x10e>
printptr(fd, va_arg(ap, uint64));
} else if(c == 's'){
51c: 07300713 li a4,115
520: 0ce78663 beq a5,a4,5ec <vprintf+0x15a>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
524: 06300713 li a4,99
528: 0ee78e63 beq a5,a4,624 <vprintf+0x192>
putc(fd, va_arg(ap, uint));
} else if(c == '%'){
52c: 11478863 beq a5,s4,63c <vprintf+0x1aa>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
530: 85d2 mv a1,s4
532: 8556 mv a0,s5
534: 00000097 auipc ra,0x0
538: e92080e7 jalr -366(ra) # 3c6 <putc>
putc(fd, c);
53c: 85ca mv a1,s2
53e: 8556 mv a0,s5
540: 00000097 auipc ra,0x0
544: e86080e7 jalr -378(ra) # 3c6 <putc>
}
state = 0;
548: 4981 li s3,0
54a: b765 j 4f2 <vprintf+0x60>
printint(fd, va_arg(ap, int), 10, 1);
54c: 008b0913 addi s2,s6,8
550: 4685 li a3,1
552: 4629 li a2,10
554: 000b2583 lw a1,0(s6)
558: 8556 mv a0,s5
55a: 00000097 auipc ra,0x0
55e: e8e080e7 jalr -370(ra) # 3e8 <printint>
562: 8b4a mv s6,s2
state = 0;
564: 4981 li s3,0
566: b771 j 4f2 <vprintf+0x60>
printint(fd, va_arg(ap, uint64), 10, 0);
568: 008b0913 addi s2,s6,8
56c: 4681 li a3,0
56e: 4629 li a2,10
570: 000b2583 lw a1,0(s6)
574: 8556 mv a0,s5
576: 00000097 auipc ra,0x0
57a: e72080e7 jalr -398(ra) # 3e8 <printint>
57e: 8b4a mv s6,s2
state = 0;
580: 4981 li s3,0
582: bf85 j 4f2 <vprintf+0x60>
printint(fd, va_arg(ap, int), 16, 0);
584: 008b0913 addi s2,s6,8
588: 4681 li a3,0
58a: 4641 li a2,16
58c: 000b2583 lw a1,0(s6)
590: 8556 mv a0,s5
592: 00000097 auipc ra,0x0
596: e56080e7 jalr -426(ra) # 3e8 <printint>
59a: 8b4a mv s6,s2
state = 0;
59c: 4981 li s3,0
59e: bf91 j 4f2 <vprintf+0x60>
printptr(fd, va_arg(ap, uint64));
5a0: 008b0793 addi a5,s6,8
5a4: f8f43423 sd a5,-120(s0)
5a8: 000b3983 ld s3,0(s6)
putc(fd, '0');
5ac: 03000593 li a1,48
5b0: 8556 mv a0,s5
5b2: 00000097 auipc ra,0x0
5b6: e14080e7 jalr -492(ra) # 3c6 <putc>
putc(fd, 'x');
5ba: 85ea mv a1,s10
5bc: 8556 mv a0,s5
5be: 00000097 auipc ra,0x0
5c2: e08080e7 jalr -504(ra) # 3c6 <putc>
5c6: 4941 li s2,16
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
5c8: 03c9d793 srli a5,s3,0x3c
5cc: 97de add a5,a5,s7
5ce: 0007c583 lbu a1,0(a5)
5d2: 8556 mv a0,s5
5d4: 00000097 auipc ra,0x0
5d8: df2080e7 jalr -526(ra) # 3c6 <putc>
for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4)
5dc: 0992 slli s3,s3,0x4
5de: 397d addiw s2,s2,-1
5e0: fe0914e3 bnez s2,5c8 <vprintf+0x136>
printptr(fd, va_arg(ap, uint64));
5e4: f8843b03 ld s6,-120(s0)
state = 0;
5e8: 4981 li s3,0
5ea: b721 j 4f2 <vprintf+0x60>
s = va_arg(ap, char*);
5ec: 008b0993 addi s3,s6,8
5f0: 000b3903 ld s2,0(s6)
if(s == 0)
5f4: 02090163 beqz s2,616 <vprintf+0x184>
while(*s != 0){
5f8: 00094583 lbu a1,0(s2)
5fc: c9a1 beqz a1,64c <vprintf+0x1ba>
putc(fd, *s);
5fe: 8556 mv a0,s5
600: 00000097 auipc ra,0x0
604: dc6080e7 jalr -570(ra) # 3c6 <putc>
s++;
608: 0905 addi s2,s2,1
while(*s != 0){
60a: 00094583 lbu a1,0(s2)
60e: f9e5 bnez a1,5fe <vprintf+0x16c>
s = va_arg(ap, char*);
610: 8b4e mv s6,s3
state = 0;
612: 4981 li s3,0
614: bdf9 j 4f2 <vprintf+0x60>
s = "(null)";
616: 00000917 auipc s2,0x0
61a: 2d290913 addi s2,s2,722 # 8e8 <malloc+0x18c>
while(*s != 0){
61e: 02800593 li a1,40
622: bff1 j 5fe <vprintf+0x16c>
putc(fd, va_arg(ap, uint));
624: 008b0913 addi s2,s6,8
628: 000b4583 lbu a1,0(s6)
62c: 8556 mv a0,s5
62e: 00000097 auipc ra,0x0
632: d98080e7 jalr -616(ra) # 3c6 <putc>
636: 8b4a mv s6,s2
state = 0;
638: 4981 li s3,0
63a: bd65 j 4f2 <vprintf+0x60>
putc(fd, c);
63c: 85d2 mv a1,s4
63e: 8556 mv a0,s5
640: 00000097 auipc ra,0x0
644: d86080e7 jalr -634(ra) # 3c6 <putc>
state = 0;
648: 4981 li s3,0
64a: b565 j 4f2 <vprintf+0x60>
s = va_arg(ap, char*);
64c: 8b4e mv s6,s3
state = 0;
64e: 4981 li s3,0
650: b54d j 4f2 <vprintf+0x60>
}
}
}
652: 70e6 ld ra,120(sp)
654: 7446 ld s0,112(sp)
656: 74a6 ld s1,104(sp)
658: 7906 ld s2,96(sp)
65a: 69e6 ld s3,88(sp)
65c: 6a46 ld s4,80(sp)
65e: 6aa6 ld s5,72(sp)
660: 6b06 ld s6,64(sp)
662: 7be2 ld s7,56(sp)
664: 7c42 ld s8,48(sp)
666: 7ca2 ld s9,40(sp)
668: 7d02 ld s10,32(sp)
66a: 6de2 ld s11,24(sp)
66c: 6109 addi sp,sp,128
66e: 8082 ret
0000000000000670 <fprintf>:
void
fprintf(int fd, const char *fmt, ...)
{
670: 715d addi sp,sp,-80
672: ec06 sd ra,24(sp)
674: e822 sd s0,16(sp)
676: 1000 addi s0,sp,32
678: e010 sd a2,0(s0)
67a: e414 sd a3,8(s0)
67c: e818 sd a4,16(s0)
67e: ec1c sd a5,24(s0)
680: 03043023 sd a6,32(s0)
684: 03143423 sd a7,40(s0)
va_list ap;
va_start(ap, fmt);
688: fe843423 sd s0,-24(s0)
vprintf(fd, fmt, ap);
68c: 8622 mv a2,s0
68e: 00000097 auipc ra,0x0
692: e04080e7 jalr -508(ra) # 492 <vprintf>
}
696: 60e2 ld ra,24(sp)
698: 6442 ld s0,16(sp)
69a: 6161 addi sp,sp,80
69c: 8082 ret
000000000000069e <printf>:
void
printf(const char *fmt, ...)
{
69e: 711d addi sp,sp,-96
6a0: ec06 sd ra,24(sp)
6a2: e822 sd s0,16(sp)
6a4: 1000 addi s0,sp,32
6a6: e40c sd a1,8(s0)
6a8: e810 sd a2,16(s0)
6aa: ec14 sd a3,24(s0)
6ac: f018 sd a4,32(s0)
6ae: f41c sd a5,40(s0)
6b0: 03043823 sd a6,48(s0)
6b4: 03143c23 sd a7,56(s0)
va_list ap;
va_start(ap, fmt);
6b8: 00840613 addi a2,s0,8
6bc: fec43423 sd a2,-24(s0)
vprintf(1, fmt, ap);
6c0: 85aa mv a1,a0
6c2: 4505 li a0,1
6c4: 00000097 auipc ra,0x0
6c8: dce080e7 jalr -562(ra) # 492 <vprintf>
}
6cc: 60e2 ld ra,24(sp)
6ce: 6442 ld s0,16(sp)
6d0: 6125 addi sp,sp,96
6d2: 8082 ret
00000000000006d4 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
6d4: 1141 addi sp,sp,-16
6d6: e422 sd s0,8(sp)
6d8: 0800 addi s0,sp,16
Header *bp, *p;
bp = (Header*)ap - 1;
6da: ff050693 addi a3,a0,-16
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6de: 00000797 auipc a5,0x0
6e2: 22a7b783 ld a5,554(a5) # 908 <freep>
6e6: a805 j 716 <free+0x42>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
6e8: 4618 lw a4,8(a2)
6ea: 9db9 addw a1,a1,a4
6ec: feb52c23 sw a1,-8(a0)
bp->s.ptr = p->s.ptr->s.ptr;
6f0: 6398 ld a4,0(a5)
6f2: 6318 ld a4,0(a4)
6f4: fee53823 sd a4,-16(a0)
6f8: a091 j 73c <free+0x68>
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
6fa: ff852703 lw a4,-8(a0)
6fe: 9e39 addw a2,a2,a4
700: c790 sw a2,8(a5)
p->s.ptr = bp->s.ptr;
702: ff053703 ld a4,-16(a0)
706: e398 sd a4,0(a5)
708: a099 j 74e <free+0x7a>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
70a: 6398 ld a4,0(a5)
70c: 00e7e463 bltu a5,a4,714 <free+0x40>
710: 00e6ea63 bltu a3,a4,724 <free+0x50>
{
714: 87ba mv a5,a4
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
716: fed7fae3 bgeu a5,a3,70a <free+0x36>
71a: 6398 ld a4,0(a5)
71c: 00e6e463 bltu a3,a4,724 <free+0x50>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
720: fee7eae3 bltu a5,a4,714 <free+0x40>
if(bp + bp->s.size == p->s.ptr){
724: ff852583 lw a1,-8(a0)
728: 6390 ld a2,0(a5)
72a: 02059713 slli a4,a1,0x20
72e: 9301 srli a4,a4,0x20
730: 0712 slli a4,a4,0x4
732: 9736 add a4,a4,a3
734: fae60ae3 beq a2,a4,6e8 <free+0x14>
bp->s.ptr = p->s.ptr;
738: fec53823 sd a2,-16(a0)
if(p + p->s.size == bp){
73c: 4790 lw a2,8(a5)
73e: 02061713 slli a4,a2,0x20
742: 9301 srli a4,a4,0x20
744: 0712 slli a4,a4,0x4
746: 973e add a4,a4,a5
748: fae689e3 beq a3,a4,6fa <free+0x26>
} else
p->s.ptr = bp;
74c: e394 sd a3,0(a5)
freep = p;
74e: 00000717 auipc a4,0x0
752: 1af73d23 sd a5,442(a4) # 908 <freep>
}
756: 6422 ld s0,8(sp)
758: 0141 addi sp,sp,16
75a: 8082 ret
000000000000075c <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
75c: 7139 addi sp,sp,-64
75e: fc06 sd ra,56(sp)
760: f822 sd s0,48(sp)
762: f426 sd s1,40(sp)
764: f04a sd s2,32(sp)
766: ec4e sd s3,24(sp)
768: e852 sd s4,16(sp)
76a: e456 sd s5,8(sp)
76c: e05a sd s6,0(sp)
76e: 0080 addi s0,sp,64
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
770: 02051493 slli s1,a0,0x20
774: 9081 srli s1,s1,0x20
776: 04bd addi s1,s1,15
778: 8091 srli s1,s1,0x4
77a: 0014899b addiw s3,s1,1
77e: 0485 addi s1,s1,1
if((prevp = freep) == 0){
780: 00000517 auipc a0,0x0
784: 18853503 ld a0,392(a0) # 908 <freep>
788: c515 beqz a0,7b4 <malloc+0x58>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
78a: 611c ld a5,0(a0)
if(p->s.size >= nunits){
78c: 4798 lw a4,8(a5)
78e: 02977f63 bgeu a4,s1,7cc <malloc+0x70>
792: 8a4e mv s4,s3
794: 0009871b sext.w a4,s3
798: 6685 lui a3,0x1
79a: 00d77363 bgeu a4,a3,7a0 <malloc+0x44>
79e: 6a05 lui s4,0x1
7a0: 000a0b1b sext.w s6,s4
p = sbrk(nu * sizeof(Header));
7a4: 004a1a1b slliw s4,s4,0x4
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
7a8: 00000917 auipc s2,0x0
7ac: 16090913 addi s2,s2,352 # 908 <freep>
if(p == (char*)-1)
7b0: 5afd li s5,-1
7b2: a88d j 824 <malloc+0xc8>
base.s.ptr = freep = prevp = &base;
7b4: 00000797 auipc a5,0x0
7b8: 15c78793 addi a5,a5,348 # 910 <base>
7bc: 00000717 auipc a4,0x0
7c0: 14f73623 sd a5,332(a4) # 908 <freep>
7c4: e39c sd a5,0(a5)
base.s.size = 0;
7c6: 0007a423 sw zero,8(a5)
if(p->s.size >= nunits){
7ca: b7e1 j 792 <malloc+0x36>
if(p->s.size == nunits)
7cc: 02e48b63 beq s1,a4,802 <malloc+0xa6>
p->s.size -= nunits;
7d0: 4137073b subw a4,a4,s3
7d4: c798 sw a4,8(a5)
p += p->s.size;
7d6: 1702 slli a4,a4,0x20
7d8: 9301 srli a4,a4,0x20
7da: 0712 slli a4,a4,0x4
7dc: 97ba add a5,a5,a4
p->s.size = nunits;
7de: 0137a423 sw s3,8(a5)
freep = prevp;
7e2: 00000717 auipc a4,0x0
7e6: 12a73323 sd a0,294(a4) # 908 <freep>
return (void*)(p + 1);
7ea: 01078513 addi a0,a5,16
if((p = morecore(nunits)) == 0)
return 0;
}
}
7ee: 70e2 ld ra,56(sp)
7f0: 7442 ld s0,48(sp)
7f2: 74a2 ld s1,40(sp)
7f4: 7902 ld s2,32(sp)
7f6: 69e2 ld s3,24(sp)
7f8: 6a42 ld s4,16(sp)
7fa: 6aa2 ld s5,8(sp)
7fc: 6b02 ld s6,0(sp)
7fe: 6121 addi sp,sp,64
800: 8082 ret
prevp->s.ptr = p->s.ptr;
802: 6398 ld a4,0(a5)
804: e118 sd a4,0(a0)
806: bff1 j 7e2 <malloc+0x86>
hp->s.size = nu;
808: 01652423 sw s6,8(a0)
free((void*)(hp + 1));
80c: 0541 addi a0,a0,16
80e: 00000097 auipc ra,0x0
812: ec6080e7 jalr -314(ra) # 6d4 <free>
return freep;
816: 00093503 ld a0,0(s2)
if((p = morecore(nunits)) == 0)
81a: d971 beqz a0,7ee <malloc+0x92>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
81c: 611c ld a5,0(a0)
if(p->s.size >= nunits){
81e: 4798 lw a4,8(a5)
820: fa9776e3 bgeu a4,s1,7cc <malloc+0x70>
if(p == freep)
824: 00093703 ld a4,0(s2)
828: 853e mv a0,a5
82a: fef719e3 bne a4,a5,81c <malloc+0xc0>
p = sbrk(nu * sizeof(Header));
82e: 8552 mv a0,s4
830: 00000097 auipc ra,0x0
834: b5e080e7 jalr -1186(ra) # 38e <sbrk>
if(p == (char*)-1)
838: fd5518e3 bne a0,s5,808 <malloc+0xac>
return 0;
83c: 4501 li a0,0
83e: bf45 j 7ee <malloc+0x92>
|
src/Data/FingerTree/View.agda | oisdk/agda-indexed-fingertree | 1 | 10592 | {-# OPTIONS --without-K --safe #-}
open import Algebra
module Data.FingerTree.View
{r m}
(ℳ : Monoid r m)
where
open import Level using (_⊔_)
open import Data.Product
open import Function
open import Data.List as List using (List; _∷_; [])
open import Data.FingerTree.Structures ℳ
open import Data.FingerTree.Reasoning ℳ
open import Data.FingerTree.Measures ℳ
open import Data.FingerTree.Cons ℳ
open σ ⦃ ... ⦄
{-# DISPLAY σ.μ _ = μ #-}
{-# DISPLAY μ-tree _ x = μ x #-}
{-# DISPLAY μ-deep _ x = μ x #-}
open Monoid ℳ renaming (Carrier to 𝓡)
infixr 5 _◃_
data Viewₗ {a b} (A : Set a) (Σ : Set b) : Set (a ⊔ b) where
nilₗ : Viewₗ A Σ
_◃_ : A → Σ → Viewₗ A Σ
instance
σ-Viewₗ : ∀ {a b} {A : Set a} {Σ : Set b} ⦃ _ : σ A ⦄ ⦃ _ : σ Σ ⦄ → σ (Viewₗ A Σ)
μ ⦃ σ-Viewₗ ⦄ nilₗ = ε
μ ⦃ σ-Viewₗ ⦄ (x ◃ xs) = μ x ∙ μ xs
viewₗ : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → (xs : Tree Σ) → μ⟨ Viewₗ Σ (Tree Σ) ⟩≈ (μ xs)
viewₗ empty = nilₗ ⇑
viewₗ (single x) = (x ◃ empty) ⇑[ ℳ ↯ ]
viewₗ (deep (𝓂 ↤ (D₂ a b & m & rs) ⇑[ 𝓂≈ ])) = a ◃ deep ⟪ D₁ b & m & rs ⇓⟫ ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′
viewₗ (deep (𝓂 ↤ (D₃ a b c & m & rs) ⇑[ 𝓂≈ ])) = a ◃ deep ⟪ D₂ b c & m & rs ⇓⟫ ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′
viewₗ (deep (𝓂 ↤ (D₄ a b c d & m & rs) ⇑[ 𝓂≈ ])) = a ◃ deep ⟪ D₃ b c d & m & rs ⇓⟫ ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′
viewₗ (deep (𝓂 ↤ (D₁ a & m & rs) ⇑[ 𝓂≈ ])) with viewₗ m
... | (μ⟨y⟩ ↤ N₂ y₁ y₂ ⇑[ yp ]) ◃ ys ⇑[ p ] = a ◃ deep (μ m ∙ μ rs ↤ D₂ y₁ y₂ & ys & rs ⇑[ ℳ ↯ ] ≈[ ≪∙ (≪∙ yp ⍮ p) ]′) ⇑[ 𝓂≈ ]
... | (μ⟨y⟩ ↤ N₃ y₁ y₂ y₃ ⇑[ yp ]) ◃ ys ⇑[ p ] = a ◃ deep (μ m ∙ μ rs ↤ D₃ y₁ y₂ y₃ & ys & rs ⇑[ ℳ ↯ ] ≈[ ≪∙ (≪∙ yp ⍮ p) ]′) ⇑[ 𝓂≈ ]
... | nilₗ ⇑[ p ] = (digitToTree rs [ _ ∙> r ⟿ r ] >>= (λ rs′ → (a ◃ rs′) ⇑)) ≈[ ∙≫ sym (identityˡ _) ⍮ (∙≫ ≪∙ p) ⍮ 𝓂≈ ]
infixl 5 _▹_
data Viewᵣ {a b} (A : Set a) (Σ : Set b) : Set (a ⊔ b) where
nilᵣ : Viewᵣ A Σ
_▹_ : Σ → A → Viewᵣ A Σ
instance
σ-Viewᵣ : ∀ {a b} {A : Set a} {Σ : Set b} ⦃ _ : σ A ⦄ ⦃ _ : σ Σ ⦄ → σ (Viewᵣ A Σ)
μ ⦃ σ-Viewᵣ ⦄ nilᵣ = ε
μ ⦃ σ-Viewᵣ ⦄ (xs ▹ x) = μ xs ∙ μ x
viewᵣ : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → (xs : Tree Σ) → μ⟨ Viewᵣ Σ (Tree Σ) ⟩≈ (μ xs)
viewᵣ empty = nilᵣ ⇑
viewᵣ (single x) = empty ▹ x ⇑[ ℳ ↯ ]
viewᵣ (deep (𝓂 ↤ (ls & m & D₂ a b ) ⇑[ 𝓂≈ ])) = (deep ⟪ ls & m & D₁ a ⇓⟫ ▹ b) ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′
viewᵣ (deep (𝓂 ↤ (ls & m & D₃ a b c ) ⇑[ 𝓂≈ ])) = (deep ⟪ ls & m & D₂ a b ⇓⟫ ▹ c) ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′
viewᵣ (deep (𝓂 ↤ (ls & m & D₄ a b c d) ⇑[ 𝓂≈ ])) = (deep ⟪ ls & m & D₃ a b c ⇓⟫ ▹ d) ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′
viewᵣ (deep (𝓂 ↤ (ls & m & D₁ a) ⇑[ 𝓂≈ ])) with viewᵣ m
... | ys ▹ (μ⟨y⟩ ↤ N₂ y₁ y₂ ⇑[ yp ]) ⇑[ p ] = deep (μ ls ∙ μ m ↤ ls & ys & D₂ y₁ y₂ ⇑[ ℳ ↯ ] ≈[ ∙≫ (∙≫ yp ⍮ p) ]′) ▹ a ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′
... | ys ▹ (μ⟨y⟩ ↤ N₃ y₁ y₂ y₃ ⇑[ yp ]) ⇑[ p ] = deep (μ ls ∙ μ m ↤ ls & ys & D₃ y₁ y₂ y₃ ⇑[ ℳ ↯ ] ≈[ ∙≫ (∙≫ yp ⍮ p) ]′) ▹ a ⇑[ ℳ ↯ ] ≈[ 𝓂≈ ]′
... | nilᵣ ⇑[ p ] = (digitToTree ls [ l <∙ _ ⟿ l ] >>= (λ ls′ → (ls′ ▹ a) ⇑)) ≈[ ℳ ↯ ↣ μ ls ∙ (ε ∙ μ a) ] ≈[ ∙≫ ≪∙ p ⍮ 𝓂≈ ]′
deepₗ : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → (l : List Σ) → (m : Tree ⟪ Node Σ ⟫) → (r : Digit Σ) → μ⟨ Tree Σ ⟩≈ (μ l ∙ (μ m ∙ μ r))
deepₗ [] m r with viewₗ m
deepₗ [] m r | nilₗ ⇑[ n≈ ] = digitToTree r ≈[ ℳ ↯ ↣ ε ∙ (ε ∙ μ r) ] ≈[ ∙≫ ≪∙ n≈ ]′
deepₗ [] m r | ((μ⟨y⟩ ↤ N₂ y₁ y₂ ⇑[ yp ]) ◃ ys) ⇑[ ys≈ ] = deep (μ m ∙ μ r ↤ D₂ y₁ y₂ & ys & r ⇑[ ≪∙ yp ⍮ sym (assoc _ _ _) ⍮ ≪∙ ys≈ ]) ⇑[ ℳ ↯ ]
deepₗ [] m r | ((μ⟨y⟩ ↤ N₃ y₁ y₂ y₃ ⇑[ yp ]) ◃ ys) ⇑[ ys≈ ] = deep (μ m ∙ μ r ↤ D₃ y₁ y₂ y₃ & ys & r ⇑[ ≪∙ yp ⍮ sym (assoc _ _ _) ⍮ ≪∙ ys≈ ]) ⇑[ ℳ ↯ ]
deepₗ (l ∷ ls) m r = go l ls m r
where
go : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → (l : Σ) → (ls : List Σ) → (m : Tree ⟪ Node Σ ⟫) → (r : Digit Σ) → μ⟨ Tree Σ ⟩≈ (μ l ∙ μ ls ∙ (μ m ∙ μ r))
go l [] m r = deep ⟪ D₁ l & m & r ⇓⟫ ⇑[ ℳ ↯ ]
go l₁ (l₂ ∷ ls) m r = (go l₂ ls m r [ _ ∙> ls′ ⟿ ls′ ] >>= (l₁ ◂_)) ≈[ ℳ ↯ ]
deepᵣ : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → (l : Digit Σ) → (m : Tree ⟪ Node Σ ⟫) → (r : List Σ) → μ⟨ Tree Σ ⟩≈ (μ l ∙ (μ m ∙ μ r))
deepᵣ l m [] with viewᵣ m
deepᵣ l m [] | nilᵣ ⇑[ p ] = digitToTree l ≈[ sym (identityʳ _) ⍮ ∙≫ (p ⍮ sym (identityʳ _)) ]
deepᵣ l m [] | (ys ▹ (μ⟨y⟩ ↤ N₂ y₁ y₂ ⇑[ μ⟨y⟩≈ ])) ⇑[ p ] = deep (μ l ∙ μ m ↤ l & ys & D₂ y₁ y₂ ⇑[ ∙≫ (∙≫ μ⟨y⟩≈ ⍮ p) ]) ⇑[ ℳ ↯ ]
deepᵣ l m [] | (ys ▹ (μ⟨y⟩ ↤ N₃ y₁ y₂ y₃ ⇑[ μ⟨y⟩≈ ])) ⇑[ p ] = deep (μ l ∙ μ m ↤ l & ys & D₃ y₁ y₂ y₃ ⇑[ ∙≫ (∙≫ μ⟨y⟩≈ ⍮ p) ]) ⇑[ ℳ ↯ ]
deepᵣ l m (r ∷ rs) = go (deep ⟪ l & m & D₁ r ⇓⟫ ⇑) rs ≈[ ℳ ↯ ]
where
go : ∀ {a} {Σ : Set a} ⦃ _ : σ Σ ⦄ → ∀ {xs} → μ⟨ Tree Σ ⟩≈ xs → (rs : List Σ) → μ⟨ Tree Σ ⟩≈ (xs ∙ μ rs)
go xs [] = xs ≈[ sym (identityʳ _) ]
go xs (r ∷ rs) = go (xs [ sz <∙ _ ⟿ sz ] >>= (_▸ r)) rs ≈[ ℳ ↯ ]
|
libsrc/graphics/ticalc/closegfx.asm | meesokim/z88dk | 0 | 1278 | ;
; Graphics for the TI82
; By <NAME> - Dec. 2000
;
; CLOSEGFX - wait for keypress
;
;
; $Id: closegfx.asm,v 1.4 2015/01/23 07:07:31 stefano Exp $
;
PUBLIC closegfx
.closegfx
IF FORti82
; This is called before scrolling: we wait for any keypress
.kloop
;halt ; Power saving (?? maybe. It worked on ti86)
ld hl,$8004
bit 2,(hl)
jr z,kloop
ENDIF
IF FORti83
.kloop
call $4CFE
and a
jr z,kloop
ENDIF
ret
|
src/scenic/simulators/webots/WBT.g4 | HaoranBai17/Scenic | 1 | 3335 | <reponame>HaoranBai17/Scenic<gh_stars>1-10
grammar WBT;
world : (node | defn)* ;
defn : 'DEF' Identifier node;
node : Identifier ' {' Newline nodeBody '}' Newline? ;
nodeBody : (attribute Newline)* ;
attribute
: 'hidden' Identifier value
| Identifier value ;
value : vector | string | array | node | boolean ;
vector : Number+ ;
string : String ;
/* The VRML grammar is highly ambiguous for multi-valued fields:
we have no way of knowing whether whitespace (including newlines)
separates two different values or components of a single value.
The intended solution is to use type information about each field;
instead, we use the following simple heuristic: vectors may be
separated by commas, everything else only by newlines. This works
for the two .wbt files I've looked at... */
array
: '[' (Newline value)* Newline? ']'
| '[' vectorWithNewlines (',' vectorWithNewlines)+ ','? ']' ;
vectorWithNewlines: (Newline? Number Newline?)+ ;
boolean : 'TRUE' | 'FALSE' ;
Comment : '#' .*? Newline -> skip ;
Whitespace : [ \t]+ -> skip ;
Identifier : Letter (Letter | Digit)* ;
fragment
Letter : [a-zA-Z_] ;
Number : '-'? Digit+ ('.' Digit+)? ('e' '-'? Digit+)? ;
fragment
Digit : [0-9] ;
String : '"' (~["\\] | '\\"' | '\\\\')* '"' ;
Newline : '\r'? '\n' ;
|
XMLParser.g4 | AILab-FOI/APi | 0 | 4348 | /*
[The "BSD licence"]
Copyright (c) 2013 <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR 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.
*/
/** XML parser derived from ANTLR v4 ref guide book example */
parser grammar XMLParser;
options { tokenVocab=XMLLexer; }
xml : prolog? misc* element misc*;
prolog : XMLDeclOpen attribute* SPECIAL_CLOSE ;
content : chardata?
((element | reference | CDATA | PI | COMMENTXML) chardata?)* ;
element : '<' var_or_ident attribute* '>' content '<' '/' var_or_ident '>'
| '<' var_or_ident attribute* '/>'
;
var_or_ident : IDENT | VARIABLE ;
reference : EntityRef | CharRef ;
attribute : ( var_or_ident '=' VARIABLE ) | ( var_or_ident '=' STRING ) ; // Our STRINGXML is AttValue in spec
/** ``All text that is not markup constitutes the character data of
* the document.''
*/
chardata : ( TEXT | SEA_WS | value | IDENT | VARIABLE )+;
misc : COMMENTXML | PI | SEA_WS ;
|
bench/conv_eval.agda | int-index/smalltt | 377 | 14815 | {-# OPTIONS --type-in-type #-}
data IBool : Set where
itrue ifalse : IBool
Bool : Set; Bool
= (B : Set) → B → B → B
toIBool : Bool → IBool
toIBool b = b _ itrue ifalse
true : Bool; true
= λ B t f → t
and : Bool → Bool → Bool; and
= λ a b B t f → a B (b B t f) f
Nat : Set; Nat
= (n : Set) → (n → n) → n → n
add : Nat → Nat → Nat; add
= λ a b n s z → a n s (b n s z)
mul : Nat → Nat → Nat; mul
= λ a b n s → a n (b n s)
suc : Nat → Nat; suc
= λ a n s z → s (a n s z)
Eq : {A : Set} → A → A → Set
Eq {A} x y = (P : A → Set) → P x → P y
refl : {A : Set}{x : A} → Eq {A} x x; refl
= λ P px → px
n2 : Nat; n2 = λ N s z → s (s z)
n3 : Nat; n3 = λ N s z → s (s (s z))
n4 : Nat; n4 = λ N s z → s (s (s (s z)))
n5 : Nat; n5 = λ N s z → s (s (s (s (s z))))
n10 = mul n2 n5
n10b = mul n5 n2
n15 = add n10 n5
n15b = add n10b n5
n18 = add n15 n3
n18b = add n15b n3
n19 = add n15 n4
n19b = add n15b n4
n20 = mul n2 n10
n20b = mul n2 n10b
n21 = suc n20
n21b = suc n20b
n22 = suc n21
n22b = suc n21b
n23 = suc n22
n23b = suc n22b
n100 = mul n10 n10
n100b = mul n10b n10b
n10k = mul n100 n100
n10kb = mul n100b n100b
n100k = mul n10k n10
n100kb = mul n10kb n10b
n1M = mul n10k n100
n1Mb = mul n10kb n100b
n5M = mul n1M n5
n5Mb = mul n1Mb n5
n10M = mul n5M n2
n10Mb = mul n5Mb n2
Tree : Set; Tree = (T : Set) → (T → T → T) → T → T
leaf : Tree; leaf = λ T n l → l
node : Tree → Tree → Tree; node = λ t1 t2 T n l → n (t1 T n l) (t2 T n l)
fullTree : Nat → Tree; fullTree
= λ n → n Tree (λ t → node t t) leaf
-- full tree with given trees at bottom level
fullTreeWithLeaf : Tree → Nat → Tree; fullTreeWithLeaf
= λ bottom n → n Tree (λ t → node t t) bottom
forceTree : Tree → Bool; forceTree
= λ t → t Bool and true
t15 = fullTree n15
t15b = fullTree n15b
t18 = fullTree n18
t18b = fullTree n18b
t19 = fullTree n19
t19b = fullTree n19b
t20 = fullTree n20
t20b = fullTree n20b
t21 = fullTree n21
t21b = fullTree n21b
t22 = fullTree n22
t22b = fullTree n22b
t23 = fullTree n23
t23b = fullTree n23b
-- Nat conversion
--------------------------------------------------------------------------------
-- convn1M : Eq n1M n1Mb; convn1M = refl
-- convn5M : Eq n5M n5Mb; convn5M = refl
-- convn10M : Eq n10M n10Mb; convn10M = refl
-- Full tree conversion
--------------------------------------------------------------------------------
-- convt15 : Eq t15 t15b; convt15 = refl -- 16 ms
-- convt18 : Eq t18 t18b; convt18 = refl -- 20 ms
-- convt19 : Eq t19 t19b; convt19 = refl -- 30 ms
-- convt20 : Eq t20 t20b; convt20 = refl -- 1.7 s
-- convt21 : Eq t21 t21b; convt21 = refl -- 3.4 s
-- convt22 : Eq t22 t22b; convt22 = refl -- 6.6 s
-- convt23 : Eq t23 t23b; convt23 = refl -- 13.1 s
-- Full meta-containing tree conversion
--------------------------------------------------------------------------------
-- convmt15 : Eq t15b (fullTreeWithLeaf _ n15 ); convmt15 = refl --
-- convmt18 : Eq t18b (fullTreeWithLeaf _ n18 ); convmt18 = refl --
-- convmt19 : Eq t19b (fullTreeWithLeaf _ n19 ); convmt19 = refl --
-- convmt20 : Eq t20b (fullTreeWithLeaf _ n20 ); convmt20 = refl --
-- convmt21 : Eq t21b (fullTreeWithLeaf _ n21 ); convmt21 = refl
-- convmt22 : Eq t22b (fullTreeWithLeaf _ n22 ); convmt22 = refl
-- convmt23 : Eq t23b (fullTreeWithLeaf _ n23 ); convmt23 = refl
-- Full tree forcing
--------------------------------------------------------------------------------
-- forcet15 : Eq (toIBool (forceTree t15)) itrue; forcet15 = refl -- 50 ms
-- forcet18 : Eq (toIBool (forceTree t18)) itrue; forcet18 = refl -- 450 ms
-- forcet19 : Eq (toIBool (forceTree t19)) itrue; forcet19 = refl -- 900 ms
-- forcet20 : Eq (toIBool (forceTree t20)) itrue; forcet20 = refl -- 1.75 s
-- forcet21 : Eq (toIBool (forceTree t21)) itrue; forcet21 = refl -- 3.5 s
-- forcet22 : Eq (toIBool (forceTree t22)) itrue; forcet22 = refl -- 7.5 s
-- forcet23 : Eq (toIBool (forceTree t23)) itrue; forcet23 = refl -- 15 s
|
apps/rfm69_modem/host_message.ads | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 5044 | with Interfaces; use Interfaces;
with STM32GD.Board; use STM32GD.Board;
package Host_Message is
type Packet_Type is array (Unsigned_8 range <>) of Unsigned_8;
procedure Send_Hello;
procedure Send_Packet (Packet: Packet_Type; Length: Unsigned_8);
procedure Send_Heartbeat;
procedure Send_Error_Message (M : String);
end Host_Message;
|
libsrc/ctype/isbdigit.asm | andydansby/z88dk-mk2 | 1 | 169915 | ; isbdigit
XLIB isbdigit
LIB asm_isbdigit
; FASTCALL
.isbdigit
ld a,l
call asm_isbdigit
ld hl,0
ret c
inc l
ret
|
srcs/fuzzers/pdf.asm | gamozolabs/falkervisor_beta | 69 | 13534 | [bits 64]
corrupt_pdf:
push rax
push rbx
push rcx
push rdx
push rsi
push rdi
push rbp
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
XMMPUSH xmm5
call start_log
; Pick a random base PDF input
call rand_pdf
mov [gs:thread_local.fuzz_input_len], rcx
mov rdi, [gs:thread_local.fuzz_maps]
mov rsi, rsi
mov rcx, [gs:thread_local.fuzz_input_len]
rep movsb
mov rdi, [gs:thread_local.fuzz_input]
mov rsi, rbx
mov rcx, [gs:thread_local.fuzz_input_len]
rep movsb
call xorshift64
test r15, 0x7
jz .create_new_fuzz
%ifdef ENABLE_COVERAGE_FEEDBACK
.use_coverage:
mov r10, -1
mov r11, 0
mov r12, 8
.try_another:
dec r12
jz short .do_the_copy
; Pick a random covearge entry
mov rcx, qword [fs:globals.coverage_fht]
call fht_random
test rax, rax
jz .try_another
; If this entry is not more rare, try another entry
cmp qword [rax + bb_struc.count], r10
jae short .try_another
; Save off this rare entry
mov r10, qword [rax + bb_struc.count]
mov r11, rax
jmp short .try_another
.do_the_copy:
; If we didn't find any entries, start a new fuzz
test r11, r11
jz .create_new_fuzz
; Fetch the input associated with this coverage entry
movdqu xmm5, [r11 + bb_struc.input_hash]
call input_entry_from_hash
; Copy the coverage entry to the fuzz_input
mov rsi, [rdx + input_entry.input]
mov rdi, [gs:thread_local.fuzz_input]
mov rcx, [rdx + input_entry.len]
rep movsb
; Copy the coverage entry maps to fuzz_maps
mov rsi, [rdx + input_entry.maps]
mov rdi, [gs:thread_local.fuzz_maps]
mov rcx, [rdx + input_entry.len]
rep movsb
; Set the new fuzz input length
mov rcx, qword [rdx + input_entry.len]
mov [gs:thread_local.fuzz_input_len], rcx
jmp .create_new_fuzz
%endif
.create_new_fuzz:
%ifdef ENABLE_FUZZING
call xorshift64
mov r14, r15
and r14, 0xf
inc r14
.corrupt_stuff:
mov r8, [gs:thread_local.fuzz_input]
mov r9, [gs:thread_local.fuzz_input_len]
mov r10, [gs:thread_local.fuzz_maps]
call xorshift64
xor rdx, rdx
mov rax, r15
div r9
mov r11, rdx
movzx edi, byte [r10 + r11]
mov rbp, 100
.find_match:
call rand_pdf
call xorshift64
xor rdx, rdx
mov rax, r15
div rcx
mov r12, rdx
movzx ecx, byte [rsi + r12]
cmp edi, ecx
je short .match
dec rbp
jnz .find_match
jmp .no_match
.match:
xor r15, r15
lea rbp, [rsi + r12]
.lewp:
cmp r15, 0x100
jae short .end
cmp dil, byte [rbp + r15]
jne short .end
inc r15
jmp short .lewp
.end:
mov rbp, r15
call xorshift64
xor rdx, rdx
mov rax, r15
div rbp
inc rdx
push rsi
push rdi
push rcx
lea rsi, [r8 + r11]
lea rdi, [r8 + r11]
add rdi, rdx
mov rcx, r9
sub rcx, r11
call memcpy
pop rcx
pop rdi
pop rsi
push rsi
push rdi
push rcx
lea rsi, [r10 + r11]
lea rdi, [r10 + r11]
add rdi, rdx
mov rcx, r9
sub rcx, r11
call memcpy
pop rcx
pop rdi
pop rsi
add qword [gs:thread_local.fuzz_input_len], rdx
lea rsi, [rbx + r12] ; source
lea rcx, [ r8 + r11] ; destination in the input
lea rbp, [r10 + r11] ; destination in the map
.hax:
mov al, [rsi]
mov [rcx], al
mov [rbp], dil
inc rbp
inc rsi
inc rcx
dec rdx
jnz short .hax
.no_match:
dec r14
jnz .corrupt_stuff
mov rcx, 8
lea rbp, [rel corrupt_from_corpus]
call invoke_random
mov rcx, 8
lea rbp, [rel corpymem]
call invoke_random
%endif
.done:
call stop_log
add qword [gs:thread_local.time_corrupt], rdx
XMMPOP xmm5
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rbp
pop rdi
pop rsi
pop rdx
pop rcx
pop rbx
pop rax
ret
inject_pdf:
push rcx
push rdi
push rsi
; rdx - PDF buffer base
; r8 - PDF length
mov rdi, rdx
mov rsi, qword [gs:thread_local.fuzz_input]
mov rcx, qword [gs:thread_local.fuzz_input_len]
call mm_copy_to_guest_vm_vmcb
mov r8, qword [gs:thread_local.fuzz_input_len]
pop rsi
pop rdi
pop rcx
ret
; rbx <- Pointer to random entry in dict
; rcx <- Size of random entry
; rsi <- Fuzz map
rand_pdf:
push rax
push rdx
push rbp
push r15
mov rbx, [fs:globals.fs_base]
lea rbx, [rbx + globals.per_node_pdfs]
call per_node_data
mov rbp, rax
mov rbx, [fs:globals.fs_base]
lea rbx, [rbx + globals.per_node_pdfmaps]
call per_node_data
mov rsi, rax
.try_another:
; Pick a random entry in the dict
call xorshift64
xor rdx, rdx
mov rax, r15
div qword [rbp]
imul rdx, 0x10
add rdx, 8
mov rbx, [rbp + rdx + 0] ; File offset
mov rcx, [rbp + rdx + 8] ; File size
test rcx, rcx
jz short .try_another
lea rsi, [rsi + rbx]
lea rbx, [rbp + rbx]
pop r15
pop rbp
pop rdx
pop rax
ret
|
Source/Assembly/stdlib.asm | vitorfeliper/GGOS | 0 | 177674 | <gh_stars>0
itoa:
%define num [bp + 4]
%define outstr [bp + 6]
%define tmp [bp - 8]
push bp
mov bp, sp
push word 0
push word "00"
push word "00"
push word 0
mov di, bp
sub di, 2
std
mov ax, num
.decloop:
cwd
mov bx, 10
div bx
mov tmp, ax
add dx, 48
mov ax, dx
stosb
mov ax, tmp
cmp ax, 10
jge .decloop
add ax, 48
stosb
cld
mov di, bp
sub di, 6
push di
push word outstr
call strcpy
;push di
;push word 0x3F8
;call WriteSerialSB
;push dx
;push word 0x3F8
;call WriteSerialB
add sp, 8
pop bp
ret 4 |
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/array24.adb | best08618/asylo | 7 | 1785 | -- { dg-do compile }
-- { dg-options "-fdump-tree-optimized" }
procedure Array24 (N : Natural) is
S : String (1 .. N);
pragma Volatile (S);
begin
S := (others => '0');
end;
-- { dg-final { scan-tree-dump-not "builtin_unwind_resume" "optimized" } }
|
oeis/094/A094373.asm | neoneye/loda-programs | 11 | 175415 | ; A094373: Expansion of (1-x-x^2)/((1-x)*(1-2*x)).
; Submitted by <NAME>
; 1,2,3,5,9,17,33,65,129,257,513,1025,2049,4097,8193,16385,32769,65537,131073,262145,524289,1048577,2097153,4194305,8388609,16777217,33554433,67108865,134217729,268435457,536870913,1073741825,2147483649,4294967297,8589934593,17179869185,34359738369,68719476737,137438953473,274877906945,549755813889,1099511627777,2199023255553,4398046511105,8796093022209,17592186044417,35184372088833,70368744177665,140737488355329,281474976710657,562949953421313,1125899906842625,2251799813685249,4503599627370497
sub $0,1
mov $2,2
pow $2,$0
add $2,1
mov $0,$2
|
src/sdl-log.ads | Fabien-Chouteau/sdlada | 1 | 30339 | --------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, <NAME>
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.Log
--
-- Message logging.
--------------------------------------------------------------------------------------------------------------------
package SDL.Log is
-- Messages longer than Max_Length will be truncated.
-- TODO: Import this from a C constant set from SDL_MAX_LOG_MESSAGE.
Max_Length : constant Integer := 4096;
-- Had to make this into a type with constants due to the abuse of
-- the C enumeration.
type Categories is range 0 .. 2 ** 32;
Application : constant Categories := 0;
Errors : constant Categories := 1;
Assert : constant Categories := 2;
System : constant Categories := 3;
Audio : constant Categories := 4;
Video : constant Categories := 5;
Render : constant Categories := 6;
Input : constant Categories := 7;
Test : constant Categories := 8;
-- Reserved categories.
Reserved_First : constant Categories := 9;
Reserved_Last : constant Categories := 18;
-- Custom categories.
subtype Custom_Categories is Categories range Reserved_Last .. Categories'Last;
type Priorities is (Verbose, Debug, Info, Warn, Error, Critical) with
Convention => C;
for Priorities use
(Verbose => 1,
Debug => 2,
Info => 3,
Warn => 4,
Error => 5,
Critical => 6);
-- Log a message with Category: Application and Priority: Info.
procedure Put (Message : in String) with
Inline => True;
procedure Put (Message : in String; Category : in Categories; Priority : in Priorities) with
Inline => True;
-- Log a message with Priority: Critical.
procedure Put_Critical (Message : in String; Category : in Categories := Application) with
Inline => True;
-- Log a message with Priority: Debug.
procedure Put_Debug (Message : in String; Category : in Categories := Application) with
Inline => True;
-- Log a message with Priority: Error.
procedure Put_Error (Message : in String; Category : in Categories := Application) with
Inline => True;
-- Log a message with Priority: Info.
procedure Put_Info (Message : in String; Category : in Categories := Application) with
Inline => True;
-- Log a message with Priority: Verbose.
procedure Put_Verbose (Message : in String; Category : in Categories := Application) with
Inline => True;
-- Log a message with Priority: Warn.
procedure Put_Warn (Message : in String; Category : in Categories := Application) with
Inline => True;
--
procedure Reset_Priorities with
Inline => True;
-- Set the priority of all the log categories to the given Priority.
procedure Set (Priority : in Priorities) with
Inline => True;
-- Set the the given log Category to the given Priority.
procedure Set (Category : in Categories; Priority : in Priorities) with
Inline => True;
-- Logging callbacks.
-- TODO: complete this.
-- I think this will require a bit more work. I think we will have to allocate a record
-- and store this in a container which gets destroyed on application shutdown before SDL quits.
type Root_User_Data is tagged null record;
type Output_Callback is access procedure
(User_Data : in Root_User_Data'Class;
Category : in Categories;
Priority : in Priorities;
Message : in String);
end SDL.Log;
|
programs/oeis/304/A304205.asm | karttu/loda | 1 | 161726 | ; A304205: Numbers k such that 24*k + 6 is congruent to 0 (mod 49).
; 12,61,110,159,208,257,306,355,404,453,502,551,600,649,698,747,796,845,894,943,992,1041,1090,1139,1188,1237,1286,1335,1384,1433,1482,1531,1580,1629,1678,1727,1776,1825,1874,1923,1972,2021,2070,2119,2168,2217,2266,2315,2364,2413,2462,2511,2560,2609,2658,2707,2756,2805,2854,2903,2952,3001,3050,3099,3148,3197,3246,3295,3344,3393,3442,3491,3540,3589,3638,3687,3736,3785,3834,3883,3932,3981,4030,4079,4128,4177,4226,4275,4324,4373,4422,4471,4520,4569,4618,4667,4716,4765,4814,4863,4912,4961,5010,5059,5108,5157,5206,5255,5304,5353,5402,5451,5500,5549,5598,5647,5696,5745,5794,5843,5892,5941,5990,6039,6088,6137,6186,6235,6284,6333,6382,6431,6480,6529,6578,6627,6676,6725,6774,6823,6872,6921,6970,7019,7068,7117,7166,7215,7264,7313,7362,7411,7460,7509,7558,7607,7656,7705,7754,7803,7852,7901,7950,7999,8048,8097,8146,8195,8244,8293,8342,8391,8440,8489,8538,8587,8636,8685,8734,8783,8832,8881,8930,8979,9028,9077,9126,9175,9224,9273,9322,9371,9420,9469,9518,9567,9616,9665,9714,9763,9812,9861,9910,9959,10008,10057,10106,10155,10204,10253,10302,10351,10400,10449,10498,10547,10596,10645,10694,10743,10792,10841,10890,10939,10988,11037,11086,11135,11184,11233,11282,11331,11380,11429,11478,11527,11576,11625,11674,11723,11772,11821,11870,11919,11968,12017,12066,12115,12164,12213
mov $1,$0
mul $1,49
add $1,12
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/iface2.ads | best08618/asylo | 7 | 16263 | <gh_stars>1-10
with Iface1;
generic
with package Prot is new Iface1 (<>);
package Iface2 is
procedure change (This, That : Prot.Any_Future);
end Iface2;
|
programs/oeis/010/A010857.asm | neoneye/loda | 22 | 86620 | <gh_stars>10-100
; A010857: Constant sequence: a(n) = 18.
; 18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18
mov $0,18
|
ruby-antlr-hash-2-json/raw/Pred.g4 | msangel/playground | 0 | 3593 | // antlr4 Pred.g4
// javac -cp ".:$(realpath ~/soft/antlr4/antlr-4.7.2-complete.jar):$CLASSPATH" Pred*.java
// grun Pred assign
grammar Pred;
assign
: ID '=' v=INT {$v.int>0}? ';'
{System.out.println("assign "+$ID.text+" to ");}
;
INT : [0-9]+ ;
ID : [a-zA-Z]+ ;
WS : [ \t\r\n]+ -> skip ;
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cd/cd3015g.ada | best08618/asylo | 7 | 4533 | -- CD3015G.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT A DERIVED ENUMERATION TYPE WITH A REPRESENTATION
-- CLAUSE CAN BE USED CORRECTLY IN ORDERING RELATIONS, INDEXING
-- ARRAYS, AND IN GENERIC INSTANTIATIONS WHEN THERE IS AN
-- ENUMERATION CLAUSE FOR THE PARENT.
-- HISTORY
-- DHH 09/30/87 CREATED ORIGINAL TEST.
-- BCB 03/20/89 CHANGED EXTENSION FROM '.DEP' TO '.ADA'.
-- BCB 03/08/90 REVISED WORDING IN HEADER COMMENT AND IN CALL TO
-- REPORT.TEST. ADDED CHECK FOR NON-CONTIGUOUS CODES.
-- REVISED CHECK FOR ARRAY INDEXING.
-- THS 09/18/90 REVISED WORDING IN HEADER COMMENT AND FIXED FAILURE
-- ERROR MESSAGE.
WITH REPORT; USE REPORT;
PROCEDURE CD3015G IS
BEGIN
TEST ("CD3015G", "CHECK THAT A DERIVED ENUMERATION TYPE WITH A " &
"REPRESENTATION CLAUSE CAN BE USED CORRECTLY " &
"IN ORDERING RELATIONS, INDEXING ARRAYS, AND " &
"IN GENERIC INSTANTIATIONS WHEN THERE IS AN " &
"ENUMERATION CLAUSE FOR THE PARENT");
DECLARE
PACKAGE PACK IS
TYPE MAIN IS (RED,BLUE,YELLOW,'R','B','Y');
FOR MAIN USE (RED => 1, BLUE => 2, YELLOW => 3, 'R' => 4,
'B' => 5, 'Y' => 6);
TYPE HUE IS NEW MAIN;
FOR HUE USE (RED => 8, BLUE => 9, YELLOW => 10,
'R' => 11, 'B' => 12, 'Y' => 13);
TYPE HUE1 IS NEW MAIN;
FOR HUE1 USE (RED => 10, BLUE => 14, YELLOW => 16,
'R' => 19, 'B' => 41, 'Y' => 46);
TYPE BASE1 IS ARRAY(HUE1) OF INTEGER;
COLOR1,BASIC1 : HUE1;
BARRAY1 : BASE1;
TYPE BASE IS ARRAY(HUE) OF INTEGER;
COLOR,BASIC : HUE;
BARRAY : BASE;
GENERIC
TYPE ENUM IS (<>);
PROCEDURE CHANGE(X,Y : IN OUT ENUM);
END PACK;
PACKAGE BODY PACK IS
PROCEDURE CHANGE(X,Y : IN OUT ENUM) IS
T : ENUM;
BEGIN
T := X;
X := Y;
Y := T;
END CHANGE;
PROCEDURE PROC IS NEW CHANGE(HUE);
PROCEDURE PROC1 IS NEW CHANGE(HUE1);
BEGIN
BASIC := RED;
COLOR := HUE'SUCC(BASIC);
BASIC1 := RED;
COLOR1 := HUE1'SUCC(BASIC1);
IF (COLOR < BASIC OR BASIC >= 'R' OR 'Y' <= COLOR OR
COLOR > 'B') OR
NOT (COLOR1 >= BASIC1 AND BASIC1 < 'R' AND
'Y' > COLOR1 AND COLOR1 <= 'B') THEN
FAILED("ORDERING RELATIONS ARE INCORRECT");
END IF;
PROC(BASIC,COLOR);
PROC1(BASIC1,COLOR1);
IF COLOR /= RED OR COLOR1 /= RED THEN
FAILED("VALUES OF PARAMETERS TO INSTANCE OF " &
"GENERIC UNIT NOT CORRECT AFTER CALL");
END IF;
BARRAY := (IDENT_INT(1),IDENT_INT(2),IDENT_INT(3),
IDENT_INT(4),IDENT_INT(5),IDENT_INT(6));
BARRAY1 := (IDENT_INT(1),IDENT_INT(2),IDENT_INT(3),
IDENT_INT(4),IDENT_INT(5),IDENT_INT(6));
IF (BARRAY (RED) /= 1 OR BARRAY (BLUE) /= 2 OR
BARRAY (YELLOW) /= 3 OR BARRAY ('R') /= 4 OR
BARRAY ('B') /= 5 OR BARRAY ('Y') /= 6) OR
NOT (BARRAY1 (RED) = 1 AND BARRAY1 (BLUE) = 2 AND
BARRAY1 (YELLOW) = 3 AND BARRAY1 ('R') = 4 AND
BARRAY1 ('B') = 5 AND BARRAY1 ('Y') = 6)
THEN
FAILED("INDEXING ARRAY FAILURE");
END IF;
END PACK;
BEGIN
NULL;
END;
RESULT;
END CD3015G;
|
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/sfc/ys_w15.asm | prismotizm/gigaleak | 0 | 166622 | Name: ys_w15.asm
Type: file
Size: 6153
Last-Modified: '2016-05-13T04:51:15Z'
SHA-1: F82A00A10134F37BFA9CAE9AF8EE47D438956679
Description: null
|
rev/large_prime.asm | Masrt200/asm-disasm | 0 | 87467 | ; Masrt
; 22-05-21
; finding lasrgest prime factor of a given number
SECTION .data
SYS_EXIT equ 60
EXIT_SUCCESS equ 0
NUM dq 87984
greatest dq 0
SECTION .text
global _start
_start:
mov rbx,0 ;counter for factors
func1:
inc rbx
cmp rbx,qword [NUM] ; till how much?
jg last
mov rdx,0 ;
mov rax,qword [NUM] ; check for
div rbx ; a factor
cmp rdx,0 ;
jne func1
mov r8,rbx ; store current factor in r8
; check r8 for prime
mov rbx,0
mov rcx,0
func2:
inc rbx
mov rax, r8
mov rdx,0
div rbx
cmp rdx,0
jne func2
inc rcx
cmp rbx,r8
jl func2
cmp rcx,2
jne func1
mov qword [greatest],rbx ; if prime then store that in greatest
jmp func1
; exit peacefully
last:
mov rax,SYS_EXIT
mov rdi,EXIT_SUCCESS
syscall
|
boot/stage2/func16.asm | arushsharma24/KSOS | 87 | 91332 | [bits 16]
print_si_16:
pusha
mov ah,0x0e ;This is the higher byte of the ax register
print_16_loop:
; mov al,[si]
; inc si
lodsb ;Performs the function of the previous two shits
cmp al,0
je print_16_end
int 0x10
jmp print_16_loop
print_16_end:
; mov al,0x0A ;Enter
; int 0x10
; mov al,0x0D ;Carriage return
; int 0x10
popa
ret
print_hex_bx:
pusha
mov ah,0x0e
; mov al,10
; int 0x10
; mov al,13
; int 0x10
mov al,'0'
int 0x10
mov al,'x'
int 0x10
mov cx,4
.loop:
mov ax,bx
and ax,0xf000
shr ax,12
cmp ax,9
jg .print_hex_letter
add ax,0x30 ;ascii encoding for numbers
jmp .print_hex_conv_end
.print_hex_letter:
add ax,55 ;ascii encoding for numbers
.print_hex_conv_end:
mov ah,0x0e ;Printing routine
int 0x10
shl bx,4
loop .loop
popa
ret
get_cursor_16:
;pusha can't use this becuase we expect a return vlaue in bx
push dx
push ax
mov al, 0x0f ;Refer to the index register table port mapping for CRT (low byte)
mov dx, 0x3d4 ; port number CRT index
out dx,al ;Write 0x0f in port 0x3D4 --- note that the port registers are 1 byte in size
mov dx,0x3d5 ;port number CRT data
in al,dx ;Store the low byte in al -- Hardware forced to use al
mov bl,al
mov al, 0x0e ;Refer to the index register table port mapping for CRT (high byte)
mov dx, 0x3d4 ; port number CRT index
out dx,al ;Write 0x0f in port 0x3D4 --- note that the port registers are 1 byte in size
mov dx,0x3d5 ;port number CRT data
in al,dx ;Store the high byte in al -- Hardware forced to use al
mov bh,al ;Store the high byte in bh
pop ax
pop dx
ret
|
src/_test/harness/apsepp_test_harness.adb | thierr26/ada-apsepp | 0 | 20981 | -- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
with Ada.Command_Line,
Apsepp.Test_Node_Class.Runner_Sequential.Create;
package body Apsepp_Test_Harness is
----------------------------------------------------------------------------
procedure Apsepp_Test_Procedure is
use Ada.Command_Line,
Apsepp.Test_Node_Class,
Apsepp.Test_Node_Class.Runner_Sequential;
Test_Runner : Test_Runner_Sequential
:= Create (Test_Suite'Access, Reporter'Access);
Outcome : Test_Outcome;
begin
Test_Runner.Early_Run;
Test_Runner.Run (Outcome);
Set_Exit_Status (if Outcome = Passed then
Success
else
Failure);
end Apsepp_Test_Procedure;
----------------------------------------------------------------------------
end Apsepp_Test_Harness;
|
Projetos/F-Assembly/src/nasm/letra.nasm | mariaeduardabicalho/Z01 | 2 | 29647 | ; carrega x"FF" em S (todos pxs em '1')
leaw $0, %A
movw %A, %S
notw %S
leaw $16426, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16446, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16466, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16486, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16506, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16526, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16546, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16566, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16586, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16606, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16626, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16646, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16666, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16686, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16706, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16726, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16746, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16766, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16786, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16806, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16826, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16846, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $16866, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16886, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16906, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16926, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16946, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16966, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $16986, %A
movw %S, (%A)
incw %A
movw %S, (%A)
incw %A
movw %S, (%A)
leaw $17006, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17026, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17046, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17066, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17086, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17106, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17126, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17146, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17166, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17186, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17206, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17226, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17246, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17266, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17286, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17306, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17326, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17346, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
leaw $17366, %A
movw %S, (%A)
incw %A
incw %A
movw %S, (%A)
;;LEDs
;; endereco 21184
leaw $5, %A
movw %A, %S
leaw %21184, %A
movw %S, (%A)
|
third_party/spirv-cross/shaders-other/aliased-entry-point-names.asm | Alan-love/filament | 13,885 | 91348 | ; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 3
; Bound: 20
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %_
OpEntryPoint Vertex %main2 "main2" %_
OpEntryPoint Fragment %main3 "main" %FragColor
OpEntryPoint Fragment %main4 "main2" %FragColor
OpSource GLSL 450
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
OpDecorate %FragColor Location 0
OpDecorate %gl_PerVertex Block
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%v4floatptr = OpTypePointer Output %v4float
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
%FragColor = OpVariable %v4floatptr Output
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%float_1 = OpConstant %float 1
%17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%float_2 = OpConstant %float 2
%18 = OpConstantComposite %v4float %float_2 %float_2 %float_2 %float_2
%_ptr_Output_v4float = OpTypePointer Output %v4float
%main = OpFunction %void None %3
%5 = OpLabel
%19 = OpAccessChain %_ptr_Output_v4float %_ %int_0
OpStore %19 %17
OpReturn
OpFunctionEnd
%main2 = OpFunction %void None %3
%6 = OpLabel
%20 = OpAccessChain %_ptr_Output_v4float %_ %int_0
OpStore %20 %18
OpReturn
OpFunctionEnd
%main3 = OpFunction %void None %3
%7 = OpLabel
OpStore %FragColor %17
OpReturn
OpFunctionEnd
%main4 = OpFunction %void None %3
%8 = OpLabel
OpStore %FragColor %18
OpReturn
OpFunctionEnd
|
oeis/245/A245833.asm | neoneye/loda-programs | 11 | 81062 | ; A245833: The Szeged index of the triangle-shaped benzenoid T_k (see Fig. 5.7 of the Diudea et al. reference).
; Submitted by <NAME>(s1.)
; 54,540,2610,8820,23940,55944,117180,225720,406890,694980,1135134,1785420,2719080,4026960,5820120,8232624,11424510,15584940,20935530,27733860,36277164,46906200,60009300,76026600,95454450,118850004,146835990,180105660
add $0,4
mov $1,$0
pow $0,2
sub $0,7
bin $1,4
mul $0,$1
div $0,3
mul $0,18
|
programs/oeis/264/A264446.asm | karttu/loda | 1 | 168077 | ; A264446: a(n) = n*(n + 5)*(n + 10)*(n + 15)/24.
; 0,44,119,234,399,625,924,1309,1794,2394,3125,4004,5049,6279,7714,9375,11284,13464,15939,18734,21875,25389,29304,33649,38454,43750,49569,55944,62909,70499,78750,87699,97384,107844,119119,131250,144279,158249,173204,189189,206250
mov $1,$0
mov $4,48
lpb $2,4
mod $4,2
add $4,$1
lpe
mov $2,5
mov $6,4
lpb $5,6
mul $2,$4
add $4,5
sub $6,1
lpe
mov $1,$2
div $1,120
|
test/Succeed/Issue5579.agda | cagix/agda | 1,989 | 8296 | {-# OPTIONS --cubical --allow-unsolved-metas #-}
open import Agda.Builtin.Cubical.Path
open import Agda.Primitive.Cubical
open import Agda.Builtin.Bool
postulate
Index : Set
i : Index
data D : Index → Set where
c : D i
cong : {A B : Set} (x y : A) (f : A → B) → x ≡ y → f x ≡ f y
cong _ _ f x≡y = λ i → f (x≡y i)
refl : {A : Set} {x : A} → x ≡ x
refl {x = x} = λ _ → x
subst :
{A : Set} {x y : A}
(P : A → Set) → x ≡ y → P x → P y
subst P eq p = primTransp (λ i → P (eq i)) i0 p
postulate
subst-refl :
{A : Set} {x : A} (P : A → Set) {p : P x} →
subst P refl p ≡ p
f : {i : Index} (xs : D i) → D i
f c = c
works : f (subst D refl c) ≡ c
works = cong (subst D refl c) c f (subst-refl D)
-- There is no type error here, just a meta to solve.
-- The original problem was assuming injectivity of f.
should-work-too : f (subst D refl c) ≡ c
should-work-too = cong _ _ f (subst-refl D)
|
programs/oeis/071/A071190.asm | neoneye/loda | 22 | 29728 | <gh_stars>10-100
; A071190: Greatest prime factor of sum of divisors of n, for n >= 2; a(1) = 1.
; 1,3,2,7,3,3,2,5,13,3,3,7,7,3,3,31,3,13,5,7,2,3,3,5,31,7,5,7,5,3,2,7,3,3,3,13,19,5,7,5,7,3,11,7,13,3,3,31,19,31,3,7,3,5,3,5,5,5,5,7,31,3,13,127,7,3,17,7,3,3,3,13,37,19,31,7,3,7,5,31,11,7,7,7,3,11,5,5,5,13,7,7,2,3,5,7,7,19,13,31
seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
sub $0,1
seq $0,6530 ; Gpf(n): greatest prime dividing n, for n >= 2; a(1)=1.
|
data/maps/headers/VictoryRoad1F.asm | opiter09/ASM-Machina | 1 | 83054 |
map_header VictoryRoad1F, VICTORY_ROAD_1F, CAVERN, 0
end_map_header
|
alloy4fun_models/trashltl/models/7/jEBS8kzBdSu44kmpE.als | Kaixi26/org.alloytools.alloy | 0 | 4646 | <filename>alloy4fun_models/trashltl/models/7/jEBS8kzBdSu44kmpE.als
open main
pred idjEBS8kzBdSu44kmpE_prop8 {
some f : File | eventually f.link + link.f in Trash
}
pred __repair { idjEBS8kzBdSu44kmpE_prop8 }
check __repair { idjEBS8kzBdSu44kmpE_prop8 <=> prop8o } |
oeis/190/A190038.asm | neoneye/loda-programs | 11 | 12067 | ; A190038: Number of nondecreasing arrangements of n+2 numbers in 0..6 with the last equal to 6 and each after the second equal to the sum of one or two of the preceding three.
; 10,18,30,47,72,107,151,203,263,331,407,491,583,683,791,907,1031,1163,1303,1451,1607,1771,1943,2123,2311,2507,2711,2923,3143,3371,3607,3851,4103,4363,4631,4907,5191,5483,5783,6091,6407,6731,7063,7403,7751,8107,8471,8843,9223,9611,10007,10411,10823,11243,11671,12107,12551,13003,13463,13931,14407,14891,15383,15883,16391,16907,17431,17963,18503,19051,19607,20171,20743,21323,21911,22507,23111,23723,24343,24971,25607,26251,26903,27563,28231,28907,29591,30283,30983,31691,32407,33131,33863,34603,35351
mov $1,1
mov $2,$0
trn $2,1
mov $3,$0
lpb $0
mov $0,0
mov $1,5
trn $2,1
lpe
sub $1,$2
sub $1,$2
add $1,2
trn $1,$2
add $1,7
mov $4,$3
mov $6,$3
lpb $6
add $5,$4
sub $6,1
lpe
mov $4,$5
mov $7,4
lpb $7
add $1,$4
sub $7,1
lpe
mov $0,$1
|
app/hack/bad_buffer.asm | USN484259/COFUOS | 1 | 86919 | [bits 64]
exit_process equ 0x0210
stream_write equ 0x050C
section .text
mov edx,2
mov r8,0xFFFF8000_00001000
mov r9d,0x10
mov eax,stream_write
syscall
mov edx,eax
mov eax,exit_process
syscall |
gb_03/src/lists-fixed.ads | gerr135/gnat_bugs | 6 | 18723 | <filename>gb_03/src/lists-fixed.ads
--
-- This is a "fixed" implementation, as a straight (discriminated) array, no memory management.
--
-- Copyright (C) 2018 <NAME> <<EMAIL>>
--
-- 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.
--
generic
package Lists.fixed is
type List(Last : Index_Base) is new List_Interface with private;
-- Last - last index of array, e.g. 1..2 - last:=2; 4..9 - last:=9;
-- first index is Index_Type'First
overriding
function Element_Constant_Reference (Container : aliased in List; Position : Cursor) return Constant_Reference_Type;
overriding
function Element_Constant_Reference (Container : aliased in List; Index : Index_Type) return Constant_Reference_Type;
overriding
function Element_Reference (Container : aliased in out List; Position : Cursor) return Reference_Type;
overriding
function Element_Reference (Container : aliased in out List; Index : Index_Type) return Reference_Type;
overriding
function Iterate (Container : in List) return Iterator_Interface'Class;
---- Extras --
overriding
function Length (Container : aliased in out List) return Index_Base;
overriding
function First_Index(Container : aliased in out List) return Index_Type;
overriding
function Last_Index (Container : aliased in out List) return Index_Type;
private
type Element_Array is array (Index_Type range <>) of aliased Element_Type;
type List(Last : Index_Base) is new List_Interface with record
data : Element_Array(Index_Type'First .. Last);
end record;
function Has_Element (L : List; Position : Index_Base) return Boolean;
-- here we also need to implement Reversible_Iterator interface
type Iterator is new Iterator_Interface with record
Container : List_Access;
Index : Index_Type'Base;
end record;
overriding
function First (Object : Iterator) return Cursor;
overriding
function Last (Object : Iterator) return Cursor;
overriding
function Next (Object : Iterator; Position : Cursor) return Cursor;
overriding
function Previous (Object : Iterator; Position : Cursor) return Cursor;
end Lists.fixed;
|
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0x48_notsx.log_21829_1688.asm | ljhsiun2/medusa | 9 | 173403 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %rbx
lea addresses_A_ht+0x1eef1, %r14
nop
nop
xor %r10, %r10
movups (%r14), %xmm0
vpextrq $1, %xmm0, %r12
nop
nop
nop
nop
nop
dec %rbx
pop %rbx
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_UC+0xac6c, %r11
clflush (%r11)
nop
nop
nop
nop
nop
dec %r12
movw $0x5152, (%r11)
nop
nop
nop
nop
add $54502, %rbx
// REPMOV
lea addresses_PSE+0x176c, %rsi
lea addresses_D+0x15c6c, %rdi
xor $47112, %r12
mov $5, %rcx
rep movsw
xor %rcx, %rcx
// Faulty Load
lea addresses_UC+0xac6c, %rbx
clflush (%rbx)
cmp %r9, %r9
mov (%rbx), %esi
lea oracles, %r9
and $0xff, %rsi
shlq $12, %rsi
mov (%r9,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC', 'congruent': 0}}
{'dst': {'same': True, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 11, 'type': 'addresses_D'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_PSE'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_A_ht', 'congruent': 0}}
{'52': 21829}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
kv-avm-control.ads | davidkristola/vole | 4 | 29095 | <gh_stars>1-10
with Interfaces;
with kv.avm.Actor_References;
with kv.avm.Tuples;
with kv.avm.Registers;
with kv.avm.Messages;
package kv.avm.Control is
NO_FUTURE : constant Interfaces.Unsigned_32 := 0;
type Status_Type is (Active, Blocked, Deferred, Idle, Error);
subtype Running_Status_Type is Status_Type range Active .. Deferred;
type Control_Interface is interface;
type Control_Access is access all Control_Interface'CLASS;
procedure New_Actor
(Self : in out Control_Interface;
Name : in String;
Instance : out kv.avm.Actor_References.Actor_Reference_Type) is abstract;
procedure Post_Message
(Self : in out Control_Interface;
Message : in kv.avm.Messages.Message_Type;
Status : out Status_Type) is abstract;
procedure Post_Response
(Self : in out Control_Interface;
Reply_To : in kv.avm.Actor_References.Actor_Reference_Type;
Answer : in kv.avm.Tuples.Tuple_Type;
Future : in Interfaces.Unsigned_32) is abstract;
procedure Generate_Next_Future
(Self : in out Control_Interface;
Future : out Interfaces.Unsigned_32) is abstract;
procedure Trap_To_The_Machine
(Self : in out Control_Interface;
Trap : in String;
Data : in kv.avm.Registers.Register_Type;
Answer : out kv.avm.Registers.Register_Type;
Status : out Status_Type) is abstract;
procedure Activate_Instance
(Self : in out Control_Interface;
Instance : in kv.avm.Actor_References.Actor_Reference_Type) is abstract;
end kv.avm.Control;
|
source/amf/dd/amf-internals-dg_canvases.ads | svn2github/matreshka | 24 | 18878 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with AMF.DC;
with AMF.DG.Canvases;
with AMF.DG.Clip_Paths;
with AMF.DG.Fills.Collections;
with AMF.DG.Graphical_Elements.Collections;
with AMF.DG.Groups;
with AMF.DG.Markers.Collections;
with AMF.DG.Styles.Collections;
with AMF.Internals.DG_Elements;
with AMF.Visitors;
package AMF.Internals.DG_Canvases is
type DG_Canvas_Proxy is
limited new AMF.Internals.DG_Elements.DG_Element_Proxy
and AMF.DG.Canvases.DG_Canvas with null record;
overriding function Get_Background_Fill
(Self : not null access constant DG_Canvas_Proxy)
return AMF.DG.Fills.DG_Fill_Access;
-- Getter of Canvas::backgroundFill.
--
-- a reference to a fill that is used to paint the background of the
-- canvas itself. A backgroundFill value is exclusive with a
-- backgroundColor value. If both are specified, the backgroundFill value
-- is used. If none is specified, no fill is applied (i.e. the canvas
-- becomes see-through).
overriding procedure Set_Background_Fill
(Self : not null access DG_Canvas_Proxy;
To : AMF.DG.Fills.DG_Fill_Access);
-- Setter of Canvas::backgroundFill.
--
-- a reference to a fill that is used to paint the background of the
-- canvas itself. A backgroundFill value is exclusive with a
-- backgroundColor value. If both are specified, the backgroundFill value
-- is used. If none is specified, no fill is applied (i.e. the canvas
-- becomes see-through).
overriding function Get_Background_Color
(Self : not null access constant DG_Canvas_Proxy)
return AMF.DC.Optional_DC_Color;
-- Getter of Canvas::backgroundColor.
--
-- a color that is used to paint the background of the canvas itself. A
-- backgroundColor value is exclusive with a backgroundFill value. If both
-- are specified, the backgroundFill value is used. If none is specified,
-- no fill is applied (i.e. the canvas becomes see-through).
overriding procedure Set_Background_Color
(Self : not null access DG_Canvas_Proxy;
To : AMF.DC.Optional_DC_Color);
-- Setter of Canvas::backgroundColor.
--
-- a color that is used to paint the background of the canvas itself. A
-- backgroundColor value is exclusive with a backgroundFill value. If both
-- are specified, the backgroundFill value is used. If none is specified,
-- no fill is applied (i.e. the canvas becomes see-through).
overriding function Get_Packaged_Fill
(Self : not null access constant DG_Canvas_Proxy)
return AMF.DG.Fills.Collections.Set_Of_DG_Fill;
-- Getter of Canvas::packagedFill.
--
-- a set of fills packaged by the canvas and referenced by graphical
-- elements in the canvas.
overriding function Get_Packaged_Marker
(Self : not null access constant DG_Canvas_Proxy)
return AMF.DG.Markers.Collections.Set_Of_DG_Marker;
-- Getter of Canvas::packagedMarker.
--
-- A set of markers packaged by the canvas and referenced by marked
-- elements in the canvas.
overriding function Get_Packaged_Style
(Self : not null access constant DG_Canvas_Proxy)
return AMF.DG.Styles.Collections.Set_Of_DG_Style;
-- Getter of Canvas::packagedStyle.
--
-- a set of styles packaged by the canvas and referenced by graphical
-- elements in the canvas as shared styles.
overriding function Get_Member
(Self : not null access constant DG_Canvas_Proxy)
return AMF.DG.Graphical_Elements.Collections.Ordered_Set_Of_DG_Graphical_Element;
-- Getter of Group::member.
--
-- the list of graphical elements that are members of (owned by) this
-- group.
overriding function Get_Group
(Self : not null access constant DG_Canvas_Proxy)
return AMF.DG.Groups.DG_Group_Access;
-- Getter of GraphicalElement::group.
--
-- the group element that owns this graphical element.
overriding procedure Set_Group
(Self : not null access DG_Canvas_Proxy;
To : AMF.DG.Groups.DG_Group_Access);
-- Setter of GraphicalElement::group.
--
-- the group element that owns this graphical element.
overriding function Get_Local_Style
(Self : not null access constant DG_Canvas_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style;
-- Getter of GraphicalElement::localStyle.
--
-- a list of locally-owned styles for this graphical element.
overriding function Get_Shared_Style
(Self : not null access constant DG_Canvas_Proxy)
return AMF.DG.Styles.Collections.Ordered_Set_Of_DG_Style;
-- Getter of GraphicalElement::sharedStyle.
--
-- a list of shared styles for this graphical element.
overriding function Get_Transform
(Self : not null access constant DG_Canvas_Proxy)
return AMF.DG.Sequence_Of_DG_Transform;
-- Getter of GraphicalElement::transform.
--
-- a list of zero or more transforms to apply to this graphical element.
overriding function Get_Clip_Path
(Self : not null access constant DG_Canvas_Proxy)
return AMF.DG.Clip_Paths.DG_Clip_Path_Access;
-- Getter of GraphicalElement::clipPath.
--
-- an optional reference to a clip path element that masks the painting of
-- this graphical element.
overriding procedure Set_Clip_Path
(Self : not null access DG_Canvas_Proxy;
To : AMF.DG.Clip_Paths.DG_Clip_Path_Access);
-- Setter of GraphicalElement::clipPath.
--
-- an optional reference to a clip path element that masks the painting of
-- this graphical element.
overriding procedure Enter_Element
(Self : not null access constant DG_Canvas_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Leave_Element
(Self : not null access constant DG_Canvas_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
overriding procedure Visit_Element
(Self : not null access constant DG_Canvas_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
end AMF.Internals.DG_Canvases;
|
mc-sema/validator/x86_64/tests/ADD_F32m.asm | randolphwong/mcsema | 2 | 161734 | <reponame>randolphwong/mcsema
BITS 64
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=
;TEST_FILE_META_END
; set up st0 to be 3.141593
lea rdi, [rsp-0x8]
mov qword [rdi], 0x40490fdb
fld qword [rdi]
;TEST_BEGIN_RECORDING
lea rdi, [rsp-0x8]
mov qword [rdi], 0x40490fdb
FADD qword [rdi]
mov rdi, 0
;TEST_END_RECORDING
|
oeis/177/A177870.asm | neoneye/loda-programs | 11 | 97013 | ; A177870: Decimal expansion of 3*Pi/4.
; Submitted by <NAME>
; 2,3,5,6,1,9,4,4,9,0,1,9,2,3,4,4,9,2,8,8,4,6,9,8,2,5,3,7,4,5,9,6,2,7,1,6,3,1,4,7,8,7,7,0,4,9,5,3,1,3,2,9,3,6,5,7,3,1,2,0,8,4,4,4,2,3,0,8,6,2,3,0,4,7,1,4,6,5,6,7,4,8,9,7,1,0,2,6,1,1,9,0,0,6,5,8,7,8,0,0
mov $1,1
mov $2,1
mov $3,$0
mul $3,5
lpb $3
mul $1,$3
mov $5,$3
mul $5,2
add $5,1
mul $2,$5
add $1,$2
div $5,$2
add $5,$0
div $1,$5
div $2,$5
sub $3,1
lpe
mul $1,9
mov $4,10
pow $4,$0
div $2,$4
mul $2,6
div $1,$2
add $1,$4
mov $0,$1
mod $0,10
|
oeis/017/A017048.asm | neoneye/loda-programs | 11 | 25550 | <gh_stars>10-100
; A017048: a(n) = (7*n + 5)^8.
; 390625,429981696,16983563041,208827064576,1406408618241,6553600000000,23811286661761,72301961339136,191707312997281,457163239653376,1001129150390625,2044140858654976,3936588805702081,7213895789838336,12667700813876161,21435888100000000,35114532758015841,55895067029733376,86730203469006241,131532383853732096,195408755062890625,284936905588473856,408485828788939521,576586811427594496,802359178476091681,1101996057600000000,1495315559180183521,2006383000160502016,2664210032449121601
mul $0,7
add $0,5
pow $0,8
|
Appl/GeoWrite/Article/articleArticle.asm | steakknife/pcgeos | 504 | 164696 | COMMENT @----------------------------------------------------------------------
Copyright (c) Berkeley Softworks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: GeoWrite
FILE: articleArticle.asm
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 3/92 Initial version
DESCRIPTION:
This file contains the code for WriteArticleClass.
$Id: articleArticle.asm,v 1.1 97/04/04 15:57:14 newdeal Exp $
------------------------------------------------------------------------------@
GeoWriteClassStructures segment resource
WriteArticleClass
GeoWriteClassStructures ends
DocNotify segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: WriteArticleCurrentRegionChanged --
MSG_VIS_LARGE_TEXT_CURRENT_REGION_CHANGED for WriteArticleClass
DESCRIPTION: Generate additional notifications for the article
PASS:
*ds:si - instance data
es - segment of WriteArticleClass
ax - The message
cx - region number
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 3/31/92 Initial version
------------------------------------------------------------------------------@
WriteArticleCurrentRegionChanged method dynamic WriteArticleClass,
MSG_VIS_LARGE_TEXT_CURRENT_REGION_CHANGED
call GetRegionPos
mov ax, MSG_WRITE_DOCUMENT_SET_POSITION_ABS
call VisCallParent
ret
WriteArticleCurrentRegionChanged endm
COMMENT @----------------------------------------------------------------------
FUNCTION: GetRegionPos
DESCRIPTION: Get the position of a region
CALLED BY: INTERNAL
PASS:
*ds:si - WriteArticle
cx - region number
RETURN:
cx - x position
dxbp - y position
DESTROYED:
ax
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/16/92 Initial version
------------------------------------------------------------------------------@
GetRegionPos proc far uses si, di
.enter
mov_tr ax, cx
mov si, offset ArticleRegionArray
call ChunkArrayElementToPtr
mov cx, ds:[di].VLTRAE_spatialPosition.PD_x.low
movdw dxbp, ds:[di].VLTRAE_spatialPosition.PD_y
.leave
ret
GetRegionPos endp
DocNotify ends
DocPageCreDest segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: WriteArticleRegionIsLast -- MSG_VIS_LARGE_TEXT_REGION_IS_LAST
for WriteArticleClass
DESCRIPTION: Handle notification that a region is the last region
PASS:
*ds:si - instance data
es - segment of WriteArticleClass
ax - The message
cx - last region #
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 5/28/92 Initial version
------------------------------------------------------------------------------@
WriteArticleRegionIsLast method dynamic WriteArticleClass,
MSG_VIS_LARGE_TEXT_REGION_IS_LAST
; in draft mode we want to bail completely and not delete regions
cmp ds:[di].VLTI_displayMode, VLTDM_DRAFT_WITH_STYLES
jae done
mov di, MSG_WRITE_DOCUMENT_DELETE_PAGES_AFTER_POSITION
GOTO AppendDeleteCommon
done:
ret
WriteArticleRegionIsLast endm
COMMENT @----------------------------------------------------------------------
MESSAGE: WriteArticleAppendRegion -- MSG_VIS_LARGE_TEXT_APPEND_REGION
for WriteArticleClass
DESCRIPTION: Add another region to an article
PASS:
*ds:si - instance data
es - segment of WriteArticleClass
ax - The message
cx - region to append after
RETURN:
carry - set if another region cannot be appended
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 5/27/92 Initial version
------------------------------------------------------------------------------@
WriteArticleAppendRegion method dynamic WriteArticleClass,
MSG_VIS_LARGE_TEXT_APPEND_REGION
mov di, MSG_WRITE_DOCUMENT_APPEND_PAGES_VIA_POSITION
FALL_THRU AppendDeleteCommon
WriteArticleAppendRegion endm
;---
; di = message
AppendDeleteCommon proc far
class WriteArticleClass
; first we suspend ourself (so that the suspend/unsuspend from
; inserting regions has no ill effects)
push cx
mov ax, MSG_META_SUSPEND
call ObjCallInstanceNoLock
pop cx ;cx = region #
; now we add pages
call GetRegionPos ;cx = x, dxbp = y
mov_tr ax, di
call VisCallParent
if _REGION_LIMIT
jc done
endif
; now nuke the suspend data, so the MSG_META_UNSUSPEND won't do
; anything...
mov ax, ATTR_VIS_TEXT_SUSPEND_DATA
call ObjVarFindData ;DS:BX <- VisTextSuspendData
EC < ERROR_NC -1 >
clr ax
clrdw ds:[bx].VTSD_recalcRange.VTR_start, ax
clrdw ds:[bx].VTSD_recalcRange.VTR_end
movdw ds:[bx].VTSD_showSelectionPos, 0xffffffff
mov ds:[bx].VTSD_notifications, ax
mov ds:[bx].VTSD_needsRecalc, al
mov ax, MSG_META_UNSUSPEND
call ObjCallInstanceNoLock
clc
if _REGION_LIMIT
done:
endif
ret
AppendDeleteCommon endp
DocPageCreDest ends
DocSTUFF segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: WriteArticleSubstAttrToken -- MSG_VIS_TEXT_SUBST_ATTR_TOKEN
for WriteArticleClass
DESCRIPTION: Substitute a text attribute token
PASS:
*ds:si - instance data
es - segment of WriteArticleClass
ax - The message
ss:bp - VisTextSubstAttrTokenParams
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/26/92 Initial version
------------------------------------------------------------------------------@
WriteArticleSubstAttrToken method dynamic WriteArticleClass,
MSG_VIS_TEXT_SUBST_ATTR_TOKEN
tst ss:[bp].VTSATP_relayedToLikeTextObjects
jnz toSuper
; send to attribute manager to take care of
mov ax, MSG_GOAM_SUBST_TEXT_ATTR_TOKEN
mov dx, size VisTextSubstAttrTokenParams
mov di, mask MF_RECORD or mask MF_STACK
call ToAttrMgrCommon
ret
toSuper:
mov di, offset WriteArticleClass
GOTO ObjCallSuperNoLock
WriteArticleSubstAttrToken endm
;---
; ax = message, di = flags
ToAttrMgrCommon proc near
push si
mov bx, segment GrObjAttributeManagerClass
mov si, offset GrObjAttributeManagerClass
call ObjMessage
pop si
mov cx, di
mov ax, MSG_META_SEND_CLASSED_EVENT
mov dx, TO_TARGET
call VisCallParent
ret
ToAttrMgrCommon endp
COMMENT @----------------------------------------------------------------------
MESSAGE: WriteArticleRecalcForAttrChange --
MSG_VIS_TEXT_RECALC_FOR_ATTR_CHANGE for WriteArticleClass
DESCRIPTION: Recalculate for an attribute change
PASS:
*ds:si - instance data
es - segment of WriteArticleClass
ax - The message
cx - relayed globally flag
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/26/92 Initial version
------------------------------------------------------------------------------@
WriteArticleRecalcForAttrChange method dynamic WriteArticleClass,
MSG_VIS_TEXT_RECALC_FOR_ATTR_CHANGE
tst cx
jnz toSuper
; send to attribute manager to take care of
mov ax, MSG_GOAM_RECALC_FOR_TEXT_ATTR_CHANGE
mov di, mask MF_RECORD
call ToAttrMgrCommon
ret
toSuper:
mov di, offset WriteArticleClass
GOTO ObjCallSuperNoLock
WriteArticleRecalcForAttrChange endm
COMMENT @----------------------------------------------------------------------
MESSAGE: WriteArticleGetObjectForSearchSpell --
MSG_META_GET_OBJECT_FOR_SEARCH_SPELL for WriteArticleClass
DESCRIPTION: Get the next object for search/spell
PASS:
*ds:si - instance data
es - segment of WriteArticleClass
ax - The message
cx:dx - object that search/spell is currently in
bp - GetSearchSpellObjectOption
RETURN:
cx:dx - requested object (or 0 if none)
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 11/19/92 Initial version
------------------------------------------------------------------------------@
WriteArticleGetObjectForSearchSpell method dynamic WriteArticleClass,
MSG_META_GET_OBJECT_FOR_SEARCH_SPELL
call VisCallParent
ret
WriteArticleGetObjectForSearchSpell endm
DocSTUFF ends
DocMiscFeatures segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: WriteArticleSetVisParent -- MSG_WRITE_ARTICLE_SET_VIS_PARENT
for WriteArticleClass
DESCRIPTION: Set the vis parent for an article
PASS:
*ds:si - instance data
es - segment of WriteArticleClass
ax - The message
cxdx - parent
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 10/21/92 Initial version
------------------------------------------------------------------------------@
WriteArticleSetVisParent method dynamic WriteArticleClass,
MSG_WRITE_ARTICLE_SET_VIS_PARENT
ornf dx, LP_IS_PARENT
movdw ds:[di].VI_link.LP_next, cxdx
ret
WriteArticleSetVisParent endm
DocMiscFeatures ends
DocSTUFF segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: WriteArticleDisplayObjectForSearchSpell --
MSG_META_DISPLAY_OBJECT_FOR_SEARCH_SPELL for WriteArticleClass
DESCRIPTION: Display the object
PASS:
*ds:si - instance data
es - segment of WriteArticleClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 11/20/92 Initial version
------------------------------------------------------------------------------@
WriteArticleDisplayObjectForSearchSpell method dynamic WriteArticleClass,
MSG_META_DISPLAY_OBJECT_FOR_SEARCH_SPELL
call MakeContentEditable
ret
WriteArticleDisplayObjectForSearchSpell endm
COMMENT @----------------------------------------------------------------------
MESSAGE: WriteArticleCrossSectionReplaceAborted --
MSG_VIS_TEXT_CROSS_SECTION_REPLACE_ABORTED for WriteArticleClass
DESCRIPTION: Notification that a cross section change has been aborted
PASS:
*ds:si - instance data
es - segment of WriteArticleClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 11/30/92 Initial version
------------------------------------------------------------------------------@
WriteArticleCrossSectionReplaceAborted method dynamic WriteArticleClass,
MSG_VIS_TEXT_CROSS_SECTION_REPLACE_ABORTED
mov ax, offset CrossSectionReplaceAbortedString
call DisplayError
ret
WriteArticleCrossSectionReplaceAborted endm
;
; only select text in current section
;
ifdef GPC
WriteArticleSelectAll method dynamic WriteArticleClass,
MSG_META_SELECT_ALL, MSG_VIS_TEXT_SELECT_ALL
selAll local VisTextRange
regStart local dword
regEnd local dword
curSelStart local dword
selAllSection local word
.enter
movdw bxax, ds:[di].VTI_selectStart
movdw curSelStart, bxax
clrdw bxax
movdw selAll.VTR_start, bxax
movdw selAll.VTR_end, bxax
movdw regStart, bxax
movdw regEnd, bxax
mov selAllSection, ax
push si
mov si, ds:[di].VLTI_regionArray
call ChunkArrayGetCount
findStartLoop:
call ChunkArrayElementToPtr
LONG jc gotSelection
adddw regEnd, ds:[di].VLTRAE_charCount, bx
; if new section, start selectAll here
mov bx, ds:[di].VLTRAE_section
cmp bx, selAllSection
je gotSection
mov selAllSection, bx
movdw selAll.VTR_start, regStart, bx
gotSection:
; if selection is in this region, found start
cmpdw curSelStart, regEnd, bx
jb findEndLoop
adddw regStart, ds:[di].VLTRAE_charCount, bx
inc ax
loop findStartLoop
findEndLoop:
; find all matching sections
mov bx, ds:[di].VLTRAE_section
cmp selAllSection, bx
jne gotSelection
; same section as selection, selectAll to end of this region
movdw selAll.VTR_end, regEnd, bx
; some hacks for last region
cmp cx, 1 ; last region, select all
jbe gotEnd
tstdw selAll.VTR_end
jz gotEnd
decdw selAll.VTR_end ; otherwise don't include
; region break
gotEnd:
jcxz gotSelection
dec cx
jcxz gotSelection ; stop at end
inc ax
call ChunkArrayElementToPtr
jc gotSelection ; erm...stop at end
movdw regStart, regEnd, bx
adddw regEnd, ds:[di].VLTRAE_charCount, bx
jmp short findEndLoop
gotSelection:
pop si
push bp
lea bp, selAll
mov ax, MSG_VIS_TEXT_SELECT_RANGE
call ObjCallInstanceNoLock
pop bp
.leave
ret
WriteArticleSelectAll endm
endif
DocSTUFF ends
|
old/tst7ram.asm | Jaxartes/vtj1 | 0 | 241077 | <gh_stars>0
; Copyright (c) 2015 <NAME>
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; 1. Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; 2. Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY JEREMY DILATUSH 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 JEREMY DILATUSH 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.
; For testing my 6502 based "VTJ-1" platform, in particular the RAM.
; Takes commands to write/read 2kB chunks of memory.
; It's also "strung out" through ROM to provide a test of that.
; Intended assembler: "crasm"
cpu 6502
code
; Basic system info
LEDOUT = $b280 ; write LED state
SER_BASE = $b800 ; base of serial port registers
SER_INFO = $0 ; offset of serial port information byte
SER_TX = $1 ; register to transmit a byte
SER_RX = $2 ; register to receive a byte
SER_ST = $3 ; register to query device status
SER_TA = $4 ; transmit control byte A
SER_TB = $5 ; transmit control byte B
SER_RA = $6 ; receive control byte A
SER_RB = $7 ; receive control byte B
SER_LBL = $10 ; start of an ASCIIZ label
ICTL_PEA0 = $b040 ; interrupt control: pending slot 0-7 alpha IRQs
ICTL_PEA1 = $b041 ; interrupt control: pending slot 8-15 alpha IRQs
ICTL_PEB0 = $b048 ; interrupt control: pending slot 0-7 beta IRQs
ICTL_PEB1 = $b049 ; interrupt control: pending slot 8-15 beta IRQs
ICTL_PEPR = $b080 ; interrupt control: highest priority pending IRQ
BAUDCODE = $15 ; code for 9600 baud
TXMODE = $30 ; code for 8n2, compatible with 8n1
RXMODE = $20 ; code for 8n1
; Zero page addresses
cb = $00 ; cyclic byte value
cm = $01 ; cyclic byte modulus value
num = $02 ; 1 byte number
pg = $03 ; page address (2 bytes)
pgc = $05 ; number of pages to go
; $06 is unused
ecks = $07 ; if we're running 'x' (1) or 'r' (0)
; And now the program.
* = $c0dd
; txchar: transmit a character on the serial port in slot 8, without using
; interrupts. The character is in the accumulator; doesn't alter
; any registers.
txchar = *
pha ; stash the byte value for later
txchar__loop = *
lda ICTL_PEB1
ror a ; get bit 0 into carry, indicating port 8 is ready for write
bcc txchar__loop ; not ready
pla
sta SER_BASE+SER_TX ; write the byte to port 8
rts ; done
; rxchar()
; Routine to receive a byte on the serial port in slot 8, without using
; interrupts.
;
; Returns with either:
; . the received byte value, in the accumulator; carry flag is clear
; . some exception value, in the accumulator; carry flag is set
;
; Doesn't mangle any other registers.
rxchar = *
; check for availability of a character or exception in the serial
; device's buffer, which is indicated by its alpha IRQ
lda ICTL_PEA1
ror a ; get bit 0 into carry
bcc rxchar ; not ready
; it's ready; receive a byte or exception
lda SER_BASE+SER_ST ; serial status byte
ror a ; get bit 0 into carry
lda SER_BASE+SER_RX ; byte or exception received
sta SER_BASE+SER_RX ; remove it from the buffer to make room for another
rts ; done
* = $c258
start = *
; no interrupts, we don't use them
sei
; initialize serial port on slot 8
lda #BAUDCODE
sta SER_BASE+SER_TA
sta SER_BASE+SER_RA
lda #TXMODE
sta SER_BASE+SER_TB
lda #RXMODE
sta SER_BASE+SER_RB
; blank the LEDs
lda #0
sta LEDOUT
; initialize zero page variables
lda #1 ; cyclic byte (to read/write in memory)
sta cb
lda #101 ; cyclic modulus (when to reset cyclic byte)
sta cm
lda #0 ; numeric input
sta num
; now the main loop: read command input & perform it
main_loop = *
jsr rxchar
cmp #'s'
beq cmd_s_jmp
cmp #'m'
beq cmd_m_jmp
cmp #'w'
beq cmd_w_jmp
cmp #'r'
beq cmd_r_jmp
cmp #'l'
beq cmd_l_jmp
cmp #'@'
beq cmd_at_jmp
sec
sbc #'0' ; convert to digit value, assuming it is a digit
bmi main_loop ; it's not a digit
cmp #10 ; is it really a digit
bpl main_loop ; nope
; it's a digit; so do: num = num * 10 + digit
pha ; stash the digit
asl num ; num * 2
lda num
asl a
asl a ; num * 8
clc
adc num ; num * 10
sta num
pla ; get the digit back
pha ; stash it again
clc ; and add it to the number
adc num
sta num
pla ; get the digit back
clc
adc #'0' ; convert back to a digit
jsr txchar ; and echo it
jmp main_loop ; and do the next digit or command
cmd_s_jmp jmp cmd_s
cmd_m_jmp jmp cmd_m
cmd_w_jmp jmp cmd_w
cmd_r_jmp jmp cmd_r
cmd_l_jmp jmp cmd_l
cmd_at_jmp jmp cmd_at
* = $c581
cmd_s = *
; the 's' command sets the cyclic byte value
jsr txchar ; echo the command
lda num
sta cb
lda #0
sta num
jmp main_loop
cmd_m = *
; the 'm' command sets the cyclic modulus value
jsr txchar ; echo the command
lda num
sta cm
lda #0
sta num
jmp main_loop
* = $d000
cmd_w = *
; the 'w' command writes to memory
jsr txchar ; echo the command
lda num ; 2kB block number
asl a
asl a
asl a ; 256B page number
sta pg+1 ; store page address
lda #0
sta pg ; page address divisible by $00
sta num ; reset input number
lda #8 ; 256B pages in 2kB
sta pgc
cmd_w__oloop = *
; write to a page, at (pg); there are pgc left
lda pg+1
and #$86
beq cmd_w__next ; skip pages 0 & 1 - we're using them
ldy #0
cmd_w__iloop = *
; write to a byte, at (pg),y
lda cb ; the cyclic byte: the one we write
sta (pg),y
inc cb ; and go on to the next one
lda cb ; see if the cyclic byte resets, by checking the cyclic modulus
cmp cm
bne cmd_w__noreset
lda #0 ; reset the cyclic byte
sta cb
cmd_w__noreset = *
iny ; index to next byte
bne cmd_w__iloop ; branch if there are any
cmd_w__next = *
; this page is done; print a status character before going on to the
; next one
lda #'.' ; success
jsr txchar
inc pg+1 ; next page
dec pgc ; one fewer to go
bne cmd_w__oloop ; do that page
; all pages have been done; ready to accept a new command
lda #'>'
jsr txchar
jmp main_loop
* = $eeee
cmd_at = *
; the '@' command just resets the number and does nothing
jsr txchar ; echo the command
lda #0
sta num
jmp main_loop
cmd_r = *
; the 'r' command reads from memory and checks its contents
jsr txchar ; echo the command
lda num ; 2kB block number
asl a
asl a
asl a ; 256B page number
sta pg+1 ; store page address
lda #0
sta pg ; page address divisible by $00
sta num ; reset the input number
lda #8 ; 256B pages in 2kB
sta pgc
cmd_r__oloop = *
; read a page, at (pg); there are pgc left
lda pg+1
and #$86
beq cmd_r__next ; skip pages 0 & 1 - they weren't written
ldy #0
cmd_r__iloop = *
; read a byte, at (pg),y
lda (pg),y ; the byte in memory
cmp cb ; and compare to cyclic byte, what we expect to read
bne cmd_r__bad ; branches if it failed
cmd_r__ok = *
; we've checked the byte and printed any error; now to go on to
; the next one
inc cb ; and go on to the next one
lda cb ; see if the cyclic byte resets, by checking the cyclic modulus
cmp cm
bne cmd_r__noreset
lda #0 ; reset the cyclic byte
sta cb
cmd_r__noreset = *
iny ; index to next byte
bne cmd_r__iloop ; branch if there are any
; this page is done; print a status character before going on to the
; next one
cmd_r__next = *
lda #'.' ; success
jsr txchar
inc pg+1 ; next page
dec pgc ; one fewer to go
bne cmd_r__oloop ; do that page
cmd_r__done = *
; all pages have been done; ready to accept a new command
lda #'>'
jsr txchar
jmp main_loop
cmd_r__bad = *
; Some byte had the wrong value. Print out, in hex:
; address
; expected value
; actual value
; exclamation point
; Then terminate.
pha ; stash the actual value
lda pg+1 ; upper half of address
jsr txhex
tya ; lower half of address
jsr txhex
lda #' '
jsr txchar
lda cb ; expected value
jsr txhex
lda #' '
jsr txchar
pla ; actual value
jsr txhex
lda #'!' ; error indicator
jsr txchar
jmp cmd_r__done
cmd_l = *
; 'l' command sets LEDs
jsr txchar ; echo the command
lda num ; set the LEDs
sta LEDOUT
lda #0 ; blank the number
sta num
jmp main_loop ; next command
hextbl = *
; table of hex digits
asc "0123456789abcdef"
txhex = *
; txhex(): Write to the serial port two hex digits, representing
; the single byte that's in the accumulator. Clobbers it and the
; X register.
pha ; save the byte value for later
ror a ; now extracting the upper half byte
ror a
ror a
ror a
and #15
tax ; and converting to hex
lda hextbl, x
jsr txchar ; and transmitting it
pla ; and get the original byte value back
and #15 ; and extract the lower half byte
tax ; now converting to hex
lda hextbl, x
jsr txchar ; and transmitting it
rts ; and done
* = $fffc
dw start ; reset vector
|
alloy4fun_models/trashltl/models/14/YnY9Mmpq6T9TnYZkT.als | Kaixi26/org.alloytools.alloy | 0 | 2765 | <reponame>Kaixi26/org.alloytools.alloy<filename>alloy4fun_models/trashltl/models/14/YnY9Mmpq6T9TnYZkT.als
open main
pred idYnY9Mmpq6T9TnYZkT_prop15 {
eventually File in Trash
}
pred __repair { idYnY9Mmpq6T9TnYZkT_prop15 }
check __repair { idYnY9Mmpq6T9TnYZkT_prop15 <=> prop15o } |
practica.asm | lichobaron/MIPSMARS | 0 | 1724 | <reponame>lichobaron/MIPSMARS
.data
num1: .word 4
texto: .asciiz "Cantidad de unos: "
.text
main:
la $t2,num1
lw $s0,0($t2)
li $v0,5
syscall
add $s1,$v0,$s0
addi $s2,$zero,1
division:
beq $s1,1,imprimirMensaje
add $s4,$s1,$zero
div $s1,$s1,2,
resto:
mul $s3,$s1,2
sub $s5,$s4,$s3
beq $s5,1,sumarUnos
j division
sumarUnos:
addi $s2,$s2,1
j division
imprimirMensaje:
li $v0,4
la $a0,texto
syscall
li $v0,1
add $a0,$s2,$zero
syscall
finalizarProg:
li $v0,10
syscall
|
programs/oeis/004/A004354.asm | neoneye/loda | 22 | 161088 | ; A004354: Binomial coefficient C(5n, n-12).
; 1,65,2415,67525,1581580,32801517,622614630,11050084695,186087894300,3005047770725,46897636623981,711521944864290,10542859559688820,153121753939078375,2186185620108204000,30756373941461374800,427193415484608717000,5867530676298843674265
mov $1,$0
add $0,12
mul $0,5
bin $0,$1
|
examples/common/tlv.ads | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 7219 | with STM32_SVD; use STM32_SVD;
with Interfaces; use Interfaces;
generic
type Buffer_Size_Type is range <>;
type Buffer_Type is array (Buffer_Size_Type) of Byte;
type Tag_Type is (<>);
package TLV is
-- type Data_Types is (False, True, Byte, Short, Long, Float, Double,
-- String, Timestamp, Duration, Sequence);
procedure Encode (Tag : Tag_Type; Value : Integer;
Buffer : in out Buffer_Type; Position : in out Buffer_Size_Type);
procedure Encode (Tag : Tag_Type; Value : Short_Float;
Buffer : in out Buffer_Type; Position : in out Buffer_Size_Type);
procedure Encode (Tag : Tag_Type; Value : String;
Buffer : in out Buffer_Type; Position : in out Buffer_Size_Type);
procedure Start_Sequence (Tag : Tag_Type; Buffer : in out Buffer_Type;
Length_Position : out Buffer_Size_Type;
Position : in out Buffer_Size_Type);
procedure End_Sequence (Buffer : in out Buffer_Type;
Length_Position : in Buffer_Size_Type;
Position : in out Buffer_Size_Type);
end TLV;
|
Task/Stack/Ada/stack-2.ada | LaudateCorpus1/RosettaCodeData | 1 | 4842 | with Ada.Unchecked_Deallocation;
package body Generic_Stack is
------------
-- Create --
------------
function Create return Stack is
begin
return (null);
end Create;
----------
-- Push --
----------
procedure Push(Item : Element_Type; Onto : in out Stack) is
Temp : Stack := new Node;
begin
Temp.Element := Item;
Temp.Next := Onto;
Onto := Temp;
end Push;
---------
-- Pop --
---------
procedure Pop(Item : out Element_Type; From : in out Stack) is
procedure Free is new Ada.Unchecked_Deallocation(Node, Stack);
Temp : Stack := From;
begin
if Temp = null then
raise Stack_Empty_Error;
end if;
Item := Temp.Element;
From := Temp.Next;
Free(Temp);
end Pop;
end Generic_Stack;
|
software/hal/boards/stm32f7_discovery/hal-audio.adb | TUM-EI-RCS/StratoX | 12 | 1512 | <reponame>TUM-EI-RCS/StratoX
with STM32_SVD.RCC; use STM32_SVD.RCC;
with STM32_SVD.SAI; use STM32_SVD.SAI;
with STM32.Device; use STM32.Device;
with STM32.Board; use STM32.Board;
with STM32.GPIO; use STM32.GPIO;
with STM32.DMA; use STM32.DMA;
with STM32.I2C; use STM32.I2C;
with STM32.SAI; use STM32.SAI;
with WM8994; use WM8994;
package body HAL.Audio is
procedure Set_Audio_Clock (Freq : Audio_Frequency);
procedure Initialize_Audio_Out_Pins;
procedure Initialize_SAI_Out (Freq : Audio_Frequency);
procedure Initialize_Audio_I2C;
-- Communication with the Audio chip
Audio_I2C_Addr : constant I2C_Address := 16#34#;
Driver : WM8994_Device (Port => Audio_I2C'Access,
I2C_Addr => Audio_I2C_Addr);
-- AUDIO OUT
SAI_Out : SAI_Controller renames SAI_2;
SAI_Out_Block : SAI_Block renames Block_A;
DMA_Out : STM32.DMA.DMA_Controller renames DMA_2;
DMA_Out_Stream : DMA_Stream_Selector renames Stream_4;
DMA_Out_Channel : DMA_Channel_Selector renames Channel_3;
-- AUDIO IN
-- SAI_In : SAI_Controller renames SAI_2;
-- SAI_In_Block : SAI_Block renames Block_B;
-- DMA_In : STM32.DMA.DMA_Controller renames DMA_2;
-- DMA_In_Sream : DMA_Stream_Selector renames Stream_7;
-- DMA_In_Channel : DMA_Channel_Selector renames Channel_0;
--------------------
-- DMA_Out_Status --
--------------------
function DMA_Out_Status
(Flag : STM32.DMA.DMA_Status_Flag) return Boolean
is
begin
return STM32.DMA.Status (DMA_Out, DMA_Out_Stream, Flag);
end DMA_Out_Status;
--------------------------
-- DMA_Out_Clear_Status --
--------------------------
procedure DMA_Out_Clear_Status
(Flag : STM32.DMA.DMA_Status_Flag)
is
begin
STM32.DMA.Clear_Status (DMA_Out, DMA_Out_Stream, Flag);
end DMA_Out_Clear_Status;
---------------------
-- Set_Audio_Clock --
---------------------
procedure Set_Audio_Clock (Freq : Audio_Frequency)
is
begin
-- Two groups of frequencies: the 44kHz family and the 48kHz family
-- The Actual audio frequency is calculated then with the following
-- formula:
-- Master_Clock = 256 * FS = SAI_CK / Master_Clock_Divider
-- We need to find a value of SAI_CK that allows such integer master
-- clock divider
case Freq is
when Audio_Freq_11kHz | Audio_Freq_22kHz | Audio_Freq_44kHz =>
-- HSE/PLLM = 1MHz = PLLI2S VCO Input
Configure_SAI_I2S_Clock
(SAI_Out,
PLLI2SN => 429, -- VCO Output = 429MHz
PLLI2SQ => 2, -- SAI Clk(First level) = 214.5 MHz
PLLI2SDIVQ => 19); -- I2S Clk = 215.4 / 19 = 11.289 MHz
when Audio_Freq_8kHz | Audio_Freq_16kHz |
Audio_Freq_48kHz | Audio_Freq_96kHz =>
Configure_SAI_I2S_Clock
(SAI_Out,
PLLI2SN => 344, -- VCO Output = 344MHz
PLLI2SQ => 7, -- SAI Clk(First level) = 49.142 MHz
PLLI2SDIVQ => 1); -- I2S Clk = 49.142 MHz
end case;
end Set_Audio_Clock;
-------------------------------
-- Initialize_Audio_Out_Pins --
-------------------------------
procedure Initialize_Audio_Out_Pins
is
SAI_Pins : constant GPIO_Points :=
(SAI2_MCLK_A, SAI2_FS_A, SAI2_SD_A, SAI2_SCK_A);
begin
Enable_Clock (SAI_2);
Enable_Clock (SAI_Pins);
Configure_IO
(SAI_Pins,
(Mode => Mode_AF,
Output_Type => Push_Pull,
Speed => Speed_High,
Resistors => Floating));
Configure_Alternate_Function
(SAI_Pins, GPIO_AF_SAI2);
Enable_Clock (DMA_Out);
-- Configure the DMA channel to the SAI peripheral
Disable (DMA_Out, DMA_Out_Stream);
Configure
(DMA_Out,
DMA_Out_Stream,
(Channel => DMA_Out_Channel,
Direction => Memory_To_Peripheral,
Increment_Peripheral_Address => False,
Increment_Memory_Address => True,
Peripheral_Data_Format => HalfWords,
Memory_Data_Format => HalfWords,
Operation_Mode => Circular_Mode,
Priority => Priority_High,
FIFO_Enabled => True,
FIFO_Threshold => FIFO_Threshold_Full_Configuration,
Memory_Burst_Size => Memory_Burst_Single,
Peripheral_Burst_Size => Peripheral_Burst_Single));
Clear_All_Status (DMA_Out, DMA_Out_Stream);
end Initialize_Audio_Out_Pins;
------------------------
-- Initialize_SAI_Out --
------------------------
procedure Initialize_SAI_Out (Freq : Audio_Frequency)
is
begin
STM32.SAI.Disable (SAI_Out, SAI_Out_Block);
STM32.SAI.Configure_Audio_Block
(SAI_Out,
SAI_Out_Block,
Frequency => Audio_Frequency'Enum_Rep (Freq),
Stereo_Mode => Stereo,
Mode => Master_Transmitter,
MCD_Enabled => True,
Protocol => Free_Protocol,
Data_Size => Data_16b,
Endianness => Data_MSB_First,
Clock_Strobing => Clock_Strobing_Rising_Edge,
Synchronization => Asynchronous_Mode,
Output_Drive => Drive_Immediate,
FIFO_Threshold => FIFO_1_Quarter_Full);
STM32.SAI.Configure_Block_Frame
(SAI_Out,
SAI_Out_Block,
Frame_Length => 64,
Frame_Active => 32,
Frame_Sync => FS_Frame_And_Channel_Identification,
FS_Polarity => FS_Active_Low,
FS_Offset => Before_First_Bit);
STM32.SAI.Configure_Block_Slot
(SAI_Out,
SAI_Out_Block,
First_Bit_Offset => 0,
Slot_Size => Data_Size,
Number_Of_Slots => 4,
Enabled_Slots => Slot_0 or Slot_2);
STM32.SAI.Enable (SAI_Out, SAI_Out_Block);
end Initialize_SAI_Out;
--------------------------
-- Initialize_Audio_I2C --
--------------------------
procedure Initialize_Audio_I2C
is
begin
Initialize_I2C_GPIO (Audio_I2C);
Configure_I2C (Audio_I2C);
end Initialize_Audio_I2C;
----------------
-- Initialize --
----------------
procedure Initialize_Audio_Out
(Volume : Audio_Volume;
Frequency : Audio_Frequency)
is
begin
STM32.SAI.Deinitialize (SAI_Out, SAI_Out_Block);
Set_Audio_Clock (Frequency);
-- Initialize the SAI
Initialize_Audio_Out_Pins;
Initialize_SAI_Out (Frequency);
-- Initialize the I2C Port to send commands to the driver
Initialize_Audio_I2C;
if Driver.Read_ID /= WM8994.WM8994_ID then
raise Constraint_Error with "Invalid ID received from the Audio Code";
end if;
Driver.Reset;
Driver.Init
(Input => WM8994.No_Input,
Output => WM8994.Auto,
Volume => Byte (Volume),
Frequency =>
WM8994.Audio_Frequency'Enum_Val
(Audio_Frequency'Enum_Rep (Frequency)));
end Initialize_Audio_Out;
----------
-- Play --
----------
procedure Play
(Buffer : Audio_Buffer)
is
begin
Driver.Play;
Start_Transfer_with_Interrupts
(Unit => DMA_Out,
Stream => DMA_Out_Stream,
Source => Buffer (Buffer'First)'Address,
Destination => SAI_Out.ADR'Address,
Data_Count => Buffer'Length,
Enabled_Interrupts => (Half_Transfer_Complete_Interrupt => True,
Transfer_Complete_Interrupt => True,
others => False));
Enable_DMA (SAI_Out, SAI_Out_Block);
if not Enabled (SAI_Out, SAI_Out_Block) then
Enable (SAI_Out, SAI_Out_Block);
end if;
end Play;
-------------------
-- Change_Buffer --
-------------------
procedure Change_Buffer
(Buffer : Audio_Buffer)
is
begin
null;
end Change_Buffer;
-----------
-- Pause --
-----------
procedure Pause is
begin
Driver.Pause;
STM32.DMA.Disable (DMA_Out, DMA_Out_Stream);
end Pause;
------------
-- Resume --
------------
procedure Resume
is
begin
null;
end Resume;
----------
-- Stop --
----------
procedure Stop
is
begin
null;
end Stop;
----------------
-- Set_Volume --
----------------
procedure Set_Volume
(Volume : Audio_Volume)
is
begin
Driver.Set_Volume (Byte (Volume));
end Set_Volume;
-------------------
-- Set_Frequency --
-------------------
procedure Set_Frequency
(Frequency : Audio_Frequency)
is
begin
Set_Audio_Clock (Frequency);
STM32.SAI.Disable (SAI_Out, SAI_Out_Block);
Initialize_SAI_Out (Frequency);
STM32.SAI.Enable (SAI_Out, SAI_Out_Block);
end Set_Frequency;
end HAL.Audio;
|
audio/music/magnettrain.asm | Dev727/ancientplatinum | 28 | 22794 | <filename>audio/music/magnettrain.asm
Music_MagnetTrain:
musicheader 4, 1, Music_MagnetTrain_Ch1
musicheader 1, 2, Music_MagnetTrain_Ch2
musicheader 1, 3, Music_MagnetTrain_Ch3
musicheader 1, 4, Music_MagnetTrain_Ch4
Music_MagnetTrain_Ch1:
tempo 110
volume $77
stereopanning $f
vibrato $14, $23
dutycycle $2
notetype $c, $b2
note __, 16
note __, 16
intensity $b7
octave 4
note D_, 1
note C_, 1
octave 3
note G_, 1
octave 4
note C_, 1
note D_, 1
note C_, 1
octave 3
note G_, 1
octave 4
note C_, 1
note D_, 1
note C_, 1
octave 3
note G_, 1
octave 4
note C_, 1
note D_, 1
note C_, 1
octave 3
note G_, 1
octave 4
note C_, 1
note E_, 1
note C_, 1
octave 3
note A_, 1
octave 4
note C_, 1
note E_, 1
note C_, 1
octave 3
note A_, 1
octave 4
note C_, 1
note E_, 1
note C_, 1
octave 3
note A_, 1
octave 4
note C_, 1
note E_, 1
note C_, 1
notetype $6, $b7
note F#, 1
note __, 1
note F#, 1
note __, 1
notetype $c, $b7
note D_, 16
endchannel
Music_MagnetTrain_Ch2:
vibrato $14, $23
dutycycle $1
notetype $c, $d2
stereopanning $f0
notetype $c, $d8
octave 1
note F_, 12
note __, 2
notetype $6, $d7
note F_, 1
note __, 1
note F_, 1
note __, 1
octave 2
note F_, 4
note __, 4
note F_, 4
note __, 4
note F_, 4
note __, 4
note F_, 4
note __, 4
dutycycle $3
notetype $c, $d7
octave 4
note G_, 16
note A_, 13
note __, 1
notetype $6, $d7
note A_, 1
note __, 1
note A_, 1
note __, 1
notetype $c, $d7
note A_, 16
endchannel
Music_MagnetTrain_Ch3:
stereopanning $ff
vibrato $10, $23
notetype $c, $15
octave 6
note C_, 1
octave 5
note G_, 1
note D#, 1
note C_, 1
note G_, 1
note D#, 1
note C_, 1
octave 4
note G_, 1
octave 5
note D#, 1
note C_, 1
octave 4
note G_, 1
note D#, 1
octave 5
note C_, 1
octave 4
note G_, 1
note D#, 1
note C_, 1
note G_, 1
note D#, 1
note C_, 1
octave 3
note G_, 1
octave 4
note C_, 1
note D#, 1
note G_, 1
note C_, 1
note D#, 1
note G_, 1
octave 5
note C_, 1
octave 4
note G_, 1
octave 5
note C_, 1
note D#, 1
note G_, 1
note C_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 1
octave 3
note D_, 1
octave 2
note D_, 16
endchannel
Music_MagnetTrain_Ch4:
togglenoise $3
notetype $c
note B_, 12
note D_, 2
note A#, 1
note A#, 1
notetype $6
note D#, 4
note F#, 4
note D#, 4
note F#, 4
note A#, 4
note F#, 4
note A#, 4
note D_, 2
note D_, 2
callchannel Music_MagnetTrain_branch_ef71e
callchannel Music_MagnetTrain_branch_ef71e
notetype $c
note B_, 16
endchannel
; unused
Music_MagnetTrain_branch_ef711:
note G#, 1
note G_, 1
note G_, 1
note G#, 1
note G_, 1
note G_, 1
note G#, 1
note G_, 1
note G_, 1
note G#, 1
note G_, 1
note G_, 1
endchannel
Music_MagnetTrain_branch_ef71e:
note G#, 2
note G_, 2
note G_, 2
note G_, 2
note G#, 2
note G_, 2
note G_, 2
note G_, 2
note G#, 2
note G_, 2
note G_, 2
note G_, 2
note G#, 2
note G_, 2
note G_, 2
note G_, 2
endchannel
|
src/lzma-block.ads | stcarrez/ada-lzma | 4 | 24020 | pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Ada.Streams;
with Lzma.Check;
with Lzma.Vli;
limited with Lzma.Filter;
with System;
with Lzma.Base;
package Lzma.Block is
LZMA_BLOCK_HEADER_SIZE_MIN : constant := 8; -- /usr/include/lzma/block.h:68
LZMA_BLOCK_HEADER_SIZE_MAX : constant := 1024; -- /usr/include/lzma/block.h:69
-- arg-macro: function lzma_block_header_size_decode (((uint32_t)(b) + 1) * 4
-- return ((uint32_t)(b) + 1) * 4;
--*
-- * \file lzma/block.h
-- * \brief .xz Block handling
--
-- * Author: <NAME>
-- *
-- * This file has been put into the public domain.
-- * You can do whatever you want with this file.
-- *
-- * See ../lzma.h for information about liblzma as a whole.
--
--*
-- * \brief Options for the Block and Block Header encoders and decoders
-- *
-- * Different Block handling functions use different parts of this structure.
-- * Some read some members, other functions write, and some do both. Only the
-- * members listed for reading need to be initialized when the specified
-- * functions are called. The members marked for writing will be assigned
-- * new values at some point either by calling the given function or by
-- * later calls to lzma_code().
--
--*
-- * \brief Block format version
-- *
-- * To prevent API and ABI breakages if new features are needed in
-- * the Block field, a version number is used to indicate which
-- * fields in this structure are in use. For now, version must always
-- * be zero. With non-zero version, most Block related functions will
-- * return LZMA_OPTIONS_ERROR.
-- *
-- * Read by:
-- * - All functions that take pointer to lzma_block as argument,
-- * including lzma_block_header_decode().
-- *
-- * Written by:
-- * - lzma_block_header_decode()
--
type lzma_block_raw_check_array is array (0 .. 63) of aliased Ada.Streams.Stream_Element;
type lzma_block is record
version : aliased Interfaces.C.unsigned; -- /usr/include/lzma/block.h:47
header_size : aliased Interfaces.C.unsigned; -- /usr/include/lzma/block.h:67
check : aliased Lzma.Check.lzma_check; -- /usr/include/lzma/block.h:88
compressed_size : aliased Lzma.Vli.lzma_vli; -- /usr/include/lzma/block.h:143
uncompressed_size : aliased Lzma.Vli.lzma_vli; -- /usr/include/lzma/block.h:167
filters : access Lzma.Filter.lzma_filter; -- /usr/include/lzma/block.h:195
raw_check : aliased lzma_block_raw_check_array; -- /usr/include/lzma/block.h:212
reserved_ptr1 : System.Address; -- /usr/include/lzma/block.h:221
reserved_ptr2 : System.Address; -- /usr/include/lzma/block.h:222
reserved_ptr3 : System.Address; -- /usr/include/lzma/block.h:223
reserved_int1 : aliased Interfaces.C.unsigned; -- /usr/include/lzma/block.h:224
reserved_int2 : aliased Interfaces.C.unsigned; -- /usr/include/lzma/block.h:225
reserved_int3 : aliased Lzma.Vli.lzma_vli; -- /usr/include/lzma/block.h:226
reserved_int4 : aliased Lzma.Vli.lzma_vli; -- /usr/include/lzma/block.h:227
reserved_int5 : aliased Lzma.Vli.lzma_vli; -- /usr/include/lzma/block.h:228
reserved_int6 : aliased Lzma.Vli.lzma_vli; -- /usr/include/lzma/block.h:229
reserved_int7 : aliased Lzma.Vli.lzma_vli; -- /usr/include/lzma/block.h:230
reserved_int8 : aliased Lzma.Vli.lzma_vli; -- /usr/include/lzma/block.h:231
reserved_enum1 : aliased Lzma.Base.lzma_reserved_enum_type; -- /usr/include/lzma/block.h:232
reserved_enum2 : aliased Lzma.Base.lzma_reserved_enum_type; -- /usr/include/lzma/block.h:233
reserved_enum3 : aliased Lzma.Base.lzma_reserved_enum_type; -- /usr/include/lzma/block.h:234
reserved_enum4 : aliased Lzma.Base.lzma_reserved_enum_type; -- /usr/include/lzma/block.h:235
reserved_bool1 : aliased Lzma.Base.lzma_bool; -- /usr/include/lzma/block.h:236
reserved_bool2 : aliased Lzma.Base.lzma_bool; -- /usr/include/lzma/block.h:237
reserved_bool3 : aliased Lzma.Base.lzma_bool; -- /usr/include/lzma/block.h:238
reserved_bool4 : aliased Lzma.Base.lzma_bool; -- /usr/include/lzma/block.h:239
reserved_bool5 : aliased Lzma.Base.lzma_bool; -- /usr/include/lzma/block.h:240
reserved_bool6 : aliased Lzma.Base.lzma_bool; -- /usr/include/lzma/block.h:241
reserved_bool7 : aliased Lzma.Base.lzma_bool; -- /usr/include/lzma/block.h:242
reserved_bool8 : aliased Lzma.Base.lzma_bool; -- /usr/include/lzma/block.h:243
end record;
pragma Convention (C_Pass_By_Copy, lzma_block); -- /usr/include/lzma/block.h:245
-- skipped anonymous struct anon_15
--*
-- * \brief Size of the Block Header field
-- *
-- * This is always a multiple of four.
-- *
-- * Read by:
-- * - lzma_block_header_encode()
-- * - lzma_block_header_decode()
-- * - lzma_block_compressed_size()
-- * - lzma_block_unpadded_size()
-- * - lzma_block_total_size()
-- * - lzma_block_decoder()
-- * - lzma_block_buffer_decode()
-- *
-- * Written by:
-- * - lzma_block_header_size()
-- * - lzma_block_buffer_encode()
--
--*
-- * \brief Type of integrity Check
-- *
-- * The Check ID is not stored into the Block Header, thus its value
-- * must be provided also when decoding.
-- *
-- * Read by:
-- * - lzma_block_header_encode()
-- * - lzma_block_header_decode()
-- * - lzma_block_compressed_size()
-- * - lzma_block_unpadded_size()
-- * - lzma_block_total_size()
-- * - lzma_block_encoder()
-- * - lzma_block_decoder()
-- * - lzma_block_buffer_encode()
-- * - lzma_block_buffer_decode()
--
--*
-- * \brief Size of the Compressed Data in bytes
-- *
-- * Encoding: If this is not LZMA_VLI_UNKNOWN, Block Header encoder
-- * will store this value to the Block Header. Block encoder doesn't
-- * care about this value, but will set it once the encoding has been
-- * finished.
-- *
-- * Decoding: If this is not LZMA_VLI_UNKNOWN, Block decoder will
-- * verify that the size of the Compressed Data field matches
-- * compressed_size.
-- *
-- * Usually you don't know this value when encoding in streamed mode,
-- * and thus cannot write this field into the Block Header.
-- *
-- * In non-streamed mode you can reserve space for this field before
-- * encoding the actual Block. After encoding the data, finish the
-- * Block by encoding the Block Header. Steps in detail:
-- *
-- * - Set compressed_size to some big enough value. If you don't know
-- * better, use LZMA_VLI_MAX, but remember that bigger values take
-- * more space in Block Header.
-- *
-- * - Call lzma_block_header_size() to see how much space you need to
-- * reserve for the Block Header.
-- *
-- * - Encode the Block using lzma_block_encoder() and lzma_code().
-- * It sets compressed_size to the correct value.
-- *
-- * - Use lzma_block_header_encode() to encode the Block Header.
-- * Because space was reserved in the first step, you don't need
-- * to call lzma_block_header_size() anymore, because due to
-- * reserving, header_size has to be big enough. If it is "too big",
-- * lzma_block_header_encode() will add enough Header Padding to
-- * make Block Header to match the size specified by header_size.
-- *
-- * Read by:
-- * - lzma_block_header_size()
-- * - lzma_block_header_encode()
-- * - lzma_block_compressed_size()
-- * - lzma_block_unpadded_size()
-- * - lzma_block_total_size()
-- * - lzma_block_decoder()
-- * - lzma_block_buffer_decode()
-- *
-- * Written by:
-- * - lzma_block_header_decode()
-- * - lzma_block_compressed_size()
-- * - lzma_block_encoder()
-- * - lzma_block_decoder()
-- * - lzma_block_buffer_encode()
-- * - lzma_block_buffer_decode()
--
--*
-- * \brief Uncompressed Size in bytes
-- *
-- * This is handled very similarly to compressed_size above.
-- *
-- * uncompressed_size is needed by fewer functions than
-- * compressed_size. This is because uncompressed_size isn't
-- * needed to validate that Block stays within proper limits.
-- *
-- * Read by:
-- * - lzma_block_header_size()
-- * - lzma_block_header_encode()
-- * - lzma_block_decoder()
-- * - lzma_block_buffer_decode()
-- *
-- * Written by:
-- * - lzma_block_header_decode()
-- * - lzma_block_encoder()
-- * - lzma_block_decoder()
-- * - lzma_block_buffer_encode()
-- * - lzma_block_buffer_decode()
--
--*
-- * \brief Array of filters
-- *
-- * There can be 1-4 filters. The end of the array is marked with
-- * .id = LZMA_VLI_UNKNOWN.
-- *
-- * Read by:
-- * - lzma_block_header_size()
-- * - lzma_block_header_encode()
-- * - lzma_block_encoder()
-- * - lzma_block_decoder()
-- * - lzma_block_buffer_encode()
-- * - lzma_block_buffer_decode()
-- *
-- * Written by:
-- * - lzma_block_header_decode(): Note that this does NOT free()
-- * the old filter options structures. All unused filters[] will
-- * have .id == LZMA_VLI_UNKNOWN and .options == NULL. If
-- * decoding fails, all filters[] are guaranteed to be
-- * LZMA_VLI_UNKNOWN and NULL.
-- *
-- * \note Because of the array is terminated with
-- * .id = LZMA_VLI_UNKNOWN, the actual array must
-- * have LZMA_FILTERS_MAX + 1 members or the Block
-- * Header decoder will overflow the buffer.
--
--*
-- * \brief Raw value stored in the Check field
-- *
-- * After successful coding, the first lzma_check_size(check) bytes
-- * of this array contain the raw value stored in the Check field.
-- *
-- * Note that CRC32 and CRC64 are stored in little endian byte order.
-- * Take it into account if you display the Check values to the user.
-- *
-- * Written by:
-- * - lzma_block_encoder()
-- * - lzma_block_decoder()
-- * - lzma_block_buffer_encode()
-- * - lzma_block_buffer_decode()
--
-- * Reserved space to allow possible future extensions without
-- * breaking the ABI. You should not touch these, because the names
-- * of these variables may change. These are and will never be used
-- * with the currently supported options, so it is safe to leave these
-- * uninitialized.
--
--*
-- * \brief Decode the Block Header Size field
-- *
-- * To decode Block Header using lzma_block_header_decode(), the size of the
-- * Block Header has to be known and stored into lzma_block.header_size.
-- * The size can be calculated from the first byte of a Block using this macro.
-- * Note that if the first byte is 0x00, it indicates beginning of Index; use
-- * this macro only when the byte is not 0x00.
-- *
-- * There is no encoding macro, because Block Header encoder is enough for that.
--
--*
-- * \brief Calculate Block Header Size
-- *
-- * Calculate the minimum size needed for the Block Header field using the
-- * settings specified in the lzma_block structure. Note that it is OK to
-- * increase the calculated header_size value as long as it is a multiple of
-- * four and doesn't exceed LZMA_BLOCK_HEADER_SIZE_MAX. Increasing header_size
-- * just means that lzma_block_header_encode() will add Header Padding.
-- *
-- * \return - LZMA_OK: Size calculated successfully and stored to
-- * block->header_size.
-- * - LZMA_OPTIONS_ERROR: Unsupported version, filters or
-- * filter options.
-- * - LZMA_PROG_ERROR: Invalid values like compressed_size == 0.
-- *
-- * \note This doesn't check that all the options are valid i.e. this
-- * may return LZMA_OK even if lzma_block_header_encode() or
-- * lzma_block_encoder() would fail. If you want to validate the
-- * filter chain, consider using lzma_memlimit_encoder() which as
-- * a side-effect validates the filter chain.
--
function lzma_block_header_size (block : access lzma_block) return Lzma.Base.lzma_ret; -- /usr/include/lzma/block.h:283
pragma Import (C, lzma_block_header_size, "lzma_block_header_size");
--*
-- * \brief Encode Block Header
-- *
-- * The caller must have calculated the size of the Block Header already with
-- * lzma_block_header_size(). If a value larger than the one calculated by
-- * lzma_block_header_size() is used, the Block Header will be padded to the
-- * specified size.
-- *
-- * \param out Beginning of the output buffer. This must be
-- * at least block->header_size bytes.
-- * \param block Block options to be encoded.
-- *
-- * \return - LZMA_OK: Encoding was successful. block->header_size
-- * bytes were written to output buffer.
-- * - LZMA_OPTIONS_ERROR: Invalid or unsupported options.
-- * - LZMA_PROG_ERROR: Invalid arguments, for example
-- * block->header_size is invalid or block->filters is NULL.
--
function lzma_block_header_encode (block : access constant lzma_block; c_out : access Ada.Streams.Stream_Element) return Lzma.Base.lzma_ret; -- /usr/include/lzma/block.h:305
pragma Import (C, lzma_block_header_encode, "lzma_block_header_encode");
--*
-- * \brief Decode Block Header
-- *
-- * block->version should be set to the highest value supported by the
-- * application; currently the only possible version is zero. This function
-- * will set version to the lowest value that still supports all the features
-- * required by the Block Header.
-- *
-- * The size of the Block Header must have already been decoded with
-- * lzma_block_header_size_decode() macro and stored to block->header_size.
-- *
-- * block->filters must have been allocated, but they don't need to be
-- * initialized (possible existing filter options are not freed).
-- *
-- * \param block Destination for Block options.
-- * \param allocator lzma_allocator for custom allocator functions.
-- * Set to NULL to use malloc() (and also free()
-- * if an error occurs).
-- * \param in Beginning of the input buffer. This must be
-- * at least block->header_size bytes.
-- *
-- * \return - LZMA_OK: Decoding was successful. block->header_size
-- * bytes were read from the input buffer.
-- * - LZMA_OPTIONS_ERROR: The Block Header specifies some
-- * unsupported options such as unsupported filters. This can
-- * happen also if block->version was set to a too low value
-- * compared to what would be required to properly represent
-- * the information stored in the Block Header.
-- * - LZMA_DATA_ERROR: Block Header is corrupt, for example,
-- * the CRC32 doesn't match.
-- * - LZMA_PROG_ERROR: Invalid arguments, for example
-- * block->header_size is invalid or block->filters is NULL.
--
function lzma_block_header_decode
(block : access lzma_block;
allocator : access Lzma.Base.lzma_allocator;
c_in : access Ada.Streams.Stream_Element) return Lzma.Base.lzma_ret; -- /usr/include/lzma/block.h:343
pragma Import (C, lzma_block_header_decode, "lzma_block_header_decode");
--*
-- * \brief Validate and set Compressed Size according to Unpadded Size
-- *
-- * Block Header stores Compressed Size, but Index has Unpadded Size. If the
-- * application has already parsed the Index and is now decoding Blocks,
-- * it can calculate Compressed Size from Unpadded Size. This function does
-- * exactly that with error checking:
-- *
-- * - Compressed Size calculated from Unpadded Size must be positive integer,
-- * that is, Unpadded Size must be big enough that after Block Header and
-- * Check fields there's still at least one byte for Compressed Size.
-- *
-- * - If Compressed Size was present in Block Header, the new value
-- * calculated from Unpadded Size is compared against the value
-- * from Block Header.
-- *
-- * \note This function must be called _after_ decoding the Block Header
-- * field so that it can properly validate Compressed Size if it
-- * was present in Block Header.
-- *
-- * \return - LZMA_OK: block->compressed_size was set successfully.
-- * - LZMA_DATA_ERROR: unpadded_size is too small compared to
-- * block->header_size and lzma_check_size(block->check).
-- * - LZMA_PROG_ERROR: Some values are invalid. For example,
-- * block->header_size must be a multiple of four and
-- * between 8 and 1024 inclusive.
--
function lzma_block_compressed_size (block : access lzma_block; unpadded_size : Lzma.Vli.lzma_vli) return Lzma.Base.lzma_ret; -- /usr/include/lzma/block.h:375
pragma Import (C, lzma_block_compressed_size, "lzma_block_compressed_size");
--*
-- * \brief Calculate Unpadded Size
-- *
-- * The Index field stores Unpadded Size and Uncompressed Size. The latter
-- * can be taken directly from the lzma_block structure after coding a Block,
-- * but Unpadded Size needs to be calculated from Block Header Size,
-- * Compressed Size, and size of the Check field. This is where this function
-- * is needed.
-- *
-- * \return Unpadded Size on success, or zero on error.
--
function lzma_block_unpadded_size (block : access constant lzma_block) return Lzma.Vli.lzma_vli; -- /usr/include/lzma/block.h:391
pragma Import (C, lzma_block_unpadded_size, "lzma_block_unpadded_size");
--*
-- * \brief Calculate the total encoded size of a Block
-- *
-- * This is equivalent to lzma_block_unpadded_size() except that the returned
-- * value includes the size of the Block Padding field.
-- *
-- * \return On success, total encoded size of the Block. On error,
-- * zero is returned.
--
function lzma_block_total_size (block : access constant lzma_block) return Lzma.Vli.lzma_vli; -- /usr/include/lzma/block.h:404
pragma Import (C, lzma_block_total_size, "lzma_block_total_size");
--*
-- * \brief Initialize .xz Block encoder
-- *
-- * Valid actions for lzma_code() are LZMA_RUN, LZMA_SYNC_FLUSH (only if the
-- * filter chain supports it), and LZMA_FINISH.
-- *
-- * \return - LZMA_OK: All good, continue with lzma_code().
-- * - LZMA_MEM_ERROR
-- * - LZMA_OPTIONS_ERROR
-- * - LZMA_UNSUPPORTED_CHECK: block->check specifies a Check ID
-- * that is not supported by this buid of liblzma. Initializing
-- * the encoder failed.
-- * - LZMA_PROG_ERROR
--
function lzma_block_encoder (strm : access Lzma.Base.lzma_stream; block : access lzma_block) return Lzma.Base.lzma_ret; -- /usr/include/lzma/block.h:422
pragma Import (C, lzma_block_encoder, "lzma_block_encoder");
--*
-- * \brief Initialize .xz Block decoder
-- *
-- * Valid actions for lzma_code() are LZMA_RUN and LZMA_FINISH. Using
-- * LZMA_FINISH is not required. It is supported only for convenience.
-- *
-- * \return - LZMA_OK: All good, continue with lzma_code().
-- * - LZMA_UNSUPPORTED_CHECK: Initialization was successful, but
-- * the given Check ID is not supported, thus Check will be
-- * ignored.
-- * - LZMA_PROG_ERROR
-- * - LZMA_MEM_ERROR
--
function lzma_block_decoder (strm : access Lzma.Base.lzma_stream; block : access lzma_block) return Lzma.Base.lzma_ret; -- /usr/include/lzma/block.h:440
pragma Import (C, lzma_block_decoder, "lzma_block_decoder");
--*
-- * \brief Calculate maximum output size for single-call Block encoding
-- *
-- * This is equivalent to lzma_stream_buffer_bound() but for .xz Blocks.
-- * See the documentation of lzma_stream_buffer_bound().
--
function lzma_block_buffer_bound (uncompressed_size : Interfaces.C.size_t) return Interfaces.C.size_t; -- /usr/include/lzma/block.h:451
pragma Import (C, lzma_block_buffer_bound, "lzma_block_buffer_bound");
--*
-- * \brief Single-call .xz Block encoder
-- *
-- * In contrast to the multi-call encoder initialized with
-- * lzma_block_encoder(), this function encodes also the Block Header. This
-- * is required to make it possible to write appropriate Block Header also
-- * in case the data isn't compressible, and different filter chain has to be
-- * used to encode the data in uncompressed form using uncompressed chunks
-- * of the LZMA2 filter.
-- *
-- * When the data isn't compressible, header_size, compressed_size, and
-- * uncompressed_size are set just like when the data was compressible, but
-- * it is possible that header_size is too small to hold the filter chain
-- * specified in block->filters, because that isn't necessarily the filter
-- * chain that was actually used to encode the data. lzma_block_unpadded_size()
-- * still works normally, because it doesn't read the filters array.
-- *
-- * \param block Block options: block->version, block->check,
-- * and block->filters must have been initialized.
-- * \param allocator lzma_allocator for custom allocator functions.
-- * Set to NULL to use malloc() and free().
-- * \param in Beginning of the input buffer
-- * \param in_size Size of the input buffer
-- * \param out Beginning of the output buffer
-- * \param out_pos The next byte will be written to out[*out_pos].
-- * *out_pos is updated only if encoding succeeds.
-- * \param out_size Size of the out buffer; the first byte into
-- * which no data is written to is out[out_size].
-- *
-- * \return - LZMA_OK: Encoding was successful.
-- * - LZMA_BUF_ERROR: Not enough output buffer space.
-- * - LZMA_UNSUPPORTED_CHECK
-- * - LZMA_OPTIONS_ERROR
-- * - LZMA_MEM_ERROR
-- * - LZMA_DATA_ERROR
-- * - LZMA_PROG_ERROR
--
function lzma_block_buffer_encode
(block : access lzma_block;
allocator : access Lzma.Base.lzma_allocator;
c_in : access Ada.Streams.Stream_Element;
in_size : Interfaces.C.size_t;
c_out : access Ada.Streams.Stream_Element;
out_pos : access Interfaces.C.size_t;
out_size : Interfaces.C.size_t) return Lzma.Base.lzma_ret; -- /usr/include/lzma/block.h:492
pragma Import (C, lzma_block_buffer_encode, "lzma_block_buffer_encode");
--*
-- * \brief Single-call .xz Block decoder
-- *
-- * This is single-call equivalent of lzma_block_decoder(), and requires that
-- * the caller has already decoded Block Header and checked its memory usage.
-- *
-- * \param block Block options just like with lzma_block_decoder().
-- * \param allocator lzma_allocator for custom allocator functions.
-- * Set to NULL to use malloc() and free().
-- * \param in Beginning of the input buffer
-- * \param in_pos The next byte will be read from in[*in_pos].
-- * *in_pos is updated only if decoding succeeds.
-- * \param in_size Size of the input buffer; the first byte that
-- * won't be read is in[in_size].
-- * \param out Beginning of the output buffer
-- * \param out_pos The next byte will be written to out[*out_pos].
-- * *out_pos is updated only if encoding succeeds.
-- * \param out_size Size of the out buffer; the first byte into
-- * which no data is written to is out[out_size].
-- *
-- * \return - LZMA_OK: Decoding was successful.
-- * - LZMA_OPTIONS_ERROR
-- * - LZMA_DATA_ERROR
-- * - LZMA_MEM_ERROR
-- * - LZMA_BUF_ERROR: Output buffer was too small.
-- * - LZMA_PROG_ERROR
--
function lzma_block_buffer_decode
(block : access lzma_block;
allocator : access Lzma.Base.lzma_allocator;
c_in : access Ada.Streams.Stream_Element;
in_pos : access Interfaces.C.size_t;
in_size : Interfaces.C.size_t;
c_out : access Ada.Streams.Stream_Element;
out_pos : access Interfaces.C.size_t;
out_size : Interfaces.C.size_t) return Lzma.Base.lzma_ret; -- /usr/include/lzma/block.h:526
pragma Import (C, lzma_block_buffer_decode, "lzma_block_buffer_decode");
end Lzma.Block;
|
programs/oeis/131/A131937.asm | neoneye/loda | 22 | 102378 | ; A131937: a(1)=1; a(2)=4. a(n) = a(n-1) + (n-th positive integer which does not occur in sequence A131938).
; 1,4,8,14,21,29,38,49,61,74,88,103,120,138,157,177,198,220,244,269,295,322,350,379,409,440,473,507,542,578,615,653,692,732,773,816,860,905,951,998,1046,1095,1145,1196,1248,1302,1357,1413,1470,1528,1587,1647
lpb $0
mov $2,$0
sub $0,1
seq $2,175139 ; a(1)= 1. a(n) = smallest integer > a(n-1) such that the partial sums of A175140 are avoided. Or, the first difference of A131937.
add $1,$2
lpe
add $1,1
mov $0,$1
|
src/Structure/SRAM.asm | stoneface86/GameboyBoilerplateProj | 25 | 241219 | section "SRAM Bank 0 Setup", sram[$A000],bank[0]
sBank0No::
ds 1
; If the RAM has been formatted then it will have the proper signature
; "CAFE BABE F1EE DECF FEED"
sSignature::
ds 10
; Keep track of version differences and incompatibilities
sVersion::
ds 2
; Bank #1 is a Non-Persistent Data Bank
section "SRAM Bank 1 Setup", sram[$A000],bank[1]
sBank1No::
ds 1
section "SRAM Bank 2 Setup", sram[$A000],bank[2]
sBank2No::
ds 1
section "SRAM Bank 3 Setup", sram[$A000],bank[3]
sBank3No::
ds 1
section "SRAM Bank 4 Setup", sram[$A000],bank[4]
sBank4No::
ds 1
section "SRAM Bank 5 Setup", sram[$A000],bank[5]
sBank5No::
ds 1
section "SRAM Bank 6 Setup", sram[$A000],bank[6]
sBank6No::
ds 1
section "SRAM Bank 7 Setup", sram[$A000],bank[7]
sBank7No::
ds 1
section "SRAM Bank 8 Setup", sram[$A000],bank[8]
sBank8No::
ds 1
section "SRAM Bank 9 Setup", sram[$A000],bank[9]
sBank9No::
ds 1
section "SRAM Bank 10 Setup", sram[$A000],bank[10]
sBank10No::
ds 1
section "SRAM Bank 11 Setup", sram[$A000],bank[11]
sBank11No::
ds 1
section "SRAM Bank 12 Setup", sram[$A000],bank[12]
sBank12No::
ds 1
section "SRAM Bank 13 Setup", sram[$A000],bank[13]
sBank13No::
ds 1
section "SRAM Bank 14 Setup", sram[$A000],bank[14]
sBank14No::
ds 1
section "SRAM Bank 15 Setup", sram[$A000],bank[15]
sBank15No::
ds 1
|
source/webdriver-remote.adb | reznikmm/webdriver | 2 | 21996 | -- Copyright (c) 2017 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with AWS.Client;
with League.JSON.Objects;
with League.JSON.Values;
with League.String_Vectors;
with WebDriver.Elements;
with WebDriver.Sessions;
package body WebDriver.Remote is
type Method_Kinds is (Get, Post);
type Command is record
Method : Method_Kinds;
Path : League.Strings.Universal_String;
Session_Id : League.Strings.Universal_String;
Parameters : League.JSON.Objects.JSON_Object;
end record;
type Response is record
Session_Id : League.Strings.Universal_String;
State : League.Strings.Universal_String;
Status : Integer;
Value : League.JSON.Objects.JSON_Object;
end record;
package Executors is
type HTTP_Command_Executor is tagged limited record
Server : AWS.Client.HTTP_Connection;
end record;
not overriding function Execute
(Self : access HTTP_Command_Executor;
Command : Remote.Command) return Response;
end Executors;
package body Executors is separate;
package Elements is
type Element is new WebDriver.Elements.Element with record
Session_Id : League.Strings.Universal_String;
Element_Id : League.Strings.Universal_String;
Executor : access Executors.HTTP_Command_Executor;
end record;
overriding function Is_Selected (Self : access Element) return Boolean;
overriding function Is_Enabled (Self : access Element) return Boolean;
overriding function Get_Attribute
(Self : access Element;
Name : League.Strings.Universal_String)
return League.Strings.Universal_String;
overriding function Get_Property
(Self : access Element;
Name : League.Strings.Universal_String)
return League.Strings.Universal_String;
overriding function Get_CSS_Value
(Self : access Element;
Name : League.Strings.Universal_String)
return League.Strings.Universal_String;
overriding function Get_Text
(Self : access Element) return League.Strings.Universal_String;
overriding function Get_Tag_Name
(Self : access Element) return League.Strings.Universal_String;
overriding procedure Click (Self : access Element);
overriding procedure Clear (Self : access Element);
overriding procedure Send_Keys
(Self : access Element;
Text : League.String_Vectors.Universal_String_Vector);
end Elements;
package body Elements is separate;
package Sessions is
type Session is new WebDriver.Sessions.Session with record
Session_Id : League.Strings.Universal_String;
Executor : access Executors.HTTP_Command_Executor;
end record;
overriding procedure Go
(Self : access Session;
URL : League.Strings.Universal_String);
overriding function Get_Current_URL
(Self : access Session) return League.Strings.Universal_String;
overriding function Find_Element
(Self : access Session;
Strategy : WebDriver.Location_Strategy;
Selector : League.Strings.Universal_String)
return WebDriver.Elements.Element_Access;
end Sessions;
package body Sessions is separate;
package Drivers is
type Driver is limited new WebDriver.Drivers.Driver with record
Executor : aliased Executors.HTTP_Command_Executor;
end record;
overriding function New_Session
(Self : access Driver;
Capabilities : League.JSON.Values.JSON_Value :=
League.JSON.Values.Empty_JSON_Value)
return WebDriver.Sessions.Session_Access;
end Drivers;
package body Drivers is separate;
------------
-- Create --
------------
function Create
(URL : League.Strings.Universal_String)
return WebDriver.Drivers.Driver'Class
is
begin
return Result : Drivers.Driver do
AWS.Client.Create
(Result.Executor.Server,
Host => URL.To_UTF_8_String);
end return;
end Create;
end WebDriver.Remote;
|
test/js/TestNat.agda | redfish64/autonomic-agda | 1 | 7495 | open import Common.Prelude
open import TestHarness
open import TestBool using ( not; _∧_ ; _↔_ )
module TestNat where
_*_ : Nat → Nat → Nat
zero * n = zero
suc m * n = n + (m * n)
{-# COMPILED_JS _*_ function (x) { return function (y) { return x*y; }; } #-}
fact : Nat → Nat
fact zero = 1
fact (suc x) = suc x * fact x
_≟_ : Nat → Nat → Bool
zero ≟ zero = true
suc x ≟ suc y = x ≟ y
x ≟ y = false
{-# COMPILED_JS _≟_ function (x) { return function (y) { return x === y; }; } #-}
tests : Tests
tests _ = (
assert (0 ≟ 0) "0=0" ,
assert (not (0 ≟ 1)) "0≠1" ,
assert ((1 + 2) ≟ 3) "1+2=3" ,
assert ((2 ∸ 1) ≟ 1) "2∸1=1" ,
assert ((1 ∸ 2) ≟ 0) "1∸2=0" ,
assert ((2 * 3) ≟ 6) "2+3=6" ,
assert (fact 0 ≟ 1) "0!=1" ,
assert (fact 1 ≟ 1) "1!=1" ,
assert (fact 2 ≟ 2) "2!=2" ,
assert (fact 3 ≟ 6) "3!=6" ,
assert (fact 4 ≟ 24) "4!=24"
)
|
tests/test.asm | nirkog/6800-emulator | 0 | 176278 | nam test_program
org $0
* The entry point of the program
l_start
jmp l_test_aba_adc
* Test the ABA and ADC instructions
l_test_aba_adc
adcb #$f0
adcb #$10
adcb #$00
cmpb #$01
bne l_aba_adc_error
aba
cmpb #$01
bne l_aba_adc_error
bra l_aba_adc_end
l_aba_adc_error
jmp l_error
l_aba_adc_end
jmp l_test_add
* Test the ADD instruction
l_test_add
ldaa #0
adda #$f2
cmpa #$f2
bne l_add_error
adda #$10
cmpa #$02
bne l_add_error
ldab #0
addb #$f2
cmpb #$f2
bne l_add_error
addb #$10
cmpb #$02
bne l_add_error
bra l_add_end
l_add_error
jmp l_error
l_add_end
jmp l_test_and
* Test the AND instruction
l_test_and
ldaa #$c5
anda #$27
cmpa #$05
bne l_and_error
ldab #$1b
andb #$82
cmpb #$2
bne l_and_error
bra l_and_end
l_and_error
jmp l_error
l_and_end
jmp l_test_asr_asl
* Test the ASL and ASR instructions
l_test_asr_asl
ldaa #$c3
asla
bcc l_asr_asl_error
cmpa #$86
bne l_asr_asl_error
ldaa #$a6
asra
bcs l_asr_asl_error
cmpa #$d3
bne l_asr_asl_error
ldab #$73
aslb
bcs l_asr_asl_error
cmpb #$e6
bne l_asr_asl_error
ldab #$f7
asrb
bcc l_asr_asl_error
cmpb #$fb
bne l_asr_asl_error
bra l_asr_asl_end
l_asr_asl_error
jmp l_error
l_asr_asl_end
jmp l_test_bcc_sec
* Test the BCC, BCS and SEC, CLC instructions
l_test_bcc_sec
sec
bcc l_bcc_sec_error
clc
bcs l_bcc_sec_error
bra l_bcc_sec_end
l_bcc_sec_error
jmp l_error
l_bcc_sec_end
jmp l_test_branch
* Test most of the conditionall branching instructions and the unconditionall branch
l_test_branch
ldaa #$05
cmpa #$12
beq l_branch_error
bge l_branch_error
cmpa #$05
beq l_after_beq
l_after_beq
cmpa #$02
bge l_after_bge
l_after_bge
cmpa #$05
bgt l_branch_error
cmpa #$2c
bgt l_branch_error
cmpa #$03
bgt l_after_bgt
l_after_bgt
cmpa #$ff
bhi l_branch_error
cmpa #$02
bhi l_after_bhi
l_after_bhi
cmpa #$c2
ble l_branch_error
cmpa #$32
ble l_after_ble
l_after_ble
cmpa #$03
bls l_branch_error
cmpa #$d9
bls l_after_bls
l_after_bls
cmpa #$a9
blt l_branch_error
cmpa #$25
blt l_after_blt
l_after_blt
cmpa #$01
bmi l_branch_error
cmpa #$07
bmi l_after_bmi
l_after_bmi
cmpa #$05
bne l_branch_error
cmpa #$b8
bne l_after_bne
l_after_bne
cmpa #$20
bpl l_branch_error
cmpa #$04
bpl l_branch_always
l_branch_always
bra l_branch_end
l_branch_error
jmp l_error
l_branch_end
jmp l_test_bit
* Test the BIT instruction
l_test_bit
bra l_bit_end
l_bit_error
jmp l_error
l_bit_end
jmp l_test_bsr_rts
* A test function that does nothing
l_test_func
ldaa #$13
ldab #$37
rts
* Test subroutine related instruction (BSR, RTS)
l_test_bsr_rts
lds #$1000
bsr l_test_func
jmp l_test_bvc_bvs
* Test the BVC and BVS instructions
l_test_bvc_bvs
sev
bvc l_error
clv
bvc l_after_bvc
l_after_bvc
clv
bvs l_bvc_bvs_error
sev
bvs l_bvc_bvs_end
l_bvc_bvs_error
jmp l_error
l_bvc_bvs_end
jmp l_test_cba
* Test the CBA instruction
l_test_cba
ldaa #$02
ldab #$05
cba
bgt l_cba_error
bge l_cba_error
ldaa #$32
ldab #$23
cba
ble l_cba_error
jmp l_test_clr
l_cba_error
jmp l_error
* Test the CLR instruction
l_test_clr
ldaa #$12
clra
cmpa #$00
bne l_clr_error
staa $2000
clr #$2000
ldaa $2000
cmpa #$00
bne l_clr_error
jmp l_test_com
l_clr_error
jmp l_error
* Test the COM instruction
l_test_com
ldaa #$e7
coma
cmpa #$18
bne l_com_error
ldaa #$3c
staa $2000
com $2000
ldaa $2000
cmpa #$c3
bne l_com_error
ldaa #$12
ldx #$2000
staa $00, x
com $00, x
ldaa $00, x
cmpa #$ed
bne l_com_error
jmp l_test_cpx
l_com_error
jmp l_error
* Test the CPX instruction
l_test_cpx
ldx #$3412
ldaa #$34
ldab #$12
staa $2000
stab $2001
cpx $2000
bne l_cpx_error
cpx #$4412
bge l_cpx_error
jmp l_test_dec_inc
l_cpx_error
jmp l_error
* Test the DEC and INC instructions
l_test_dec_inc
ldaa #$34
deca
cmpa #$33
bne l_dec_inc_error
inca
cmpa #$34
bne l_dec_inc_error
ldaa #$0
deca
cmpa #$ff
bne l_dec_inc_error
inca
cmpa #$00
bne l_dec_inc_error
ldaa #$54
staa $2000
dec $2000
ldaa $2000
cmpa #$53
bne l_dec_inc_error
jmp l_test_des_dex
l_dec_inc_error
jmp l_error
* Test the DES and DEX instructions
l_test_des_dex
lds #$1337
des
sts $2000
ldaa $2000
ldab $2001
cmpa #$13
bne l_des_dex_error
cmpb #$36
bne l_des_dex_error
ldx #$dead
dex
stx $2000
ldaa $2000
ldab $2001
cmpa #$de
bne l_des_dex_error
cmpb #$ac
bne l_des_dex_error
jmp l_test_eor
l_des_dex_error
jmp l_error
* Test the EOR instruction
l_test_eor
ldaa #$33
eora #$86
cmpa #$b5
bne l_eor_error
jmp l_test_ins_inx
l_eor_error
jmp l_error
* Test the INS and INX instructions
l_test_ins_inx
lds #$1337
ins
sts $2000
ldaa $2000
ldab $2001
cmpa #$13
bne l_ins_inx_error
cmpb #$38
bne l_ins_inx_error
ldx #$dead
inx
stx $2000
ldaa $2000
ldab $2001
cmpa #$de
bne l_ins_inx_error
cmpb #$ae
bne l_ins_inx_error
jmp l_test_jsr
l_ins_inx_error
jmp l_error
* Test the jst instruction
l_test_jsr
* The test is commented out because of a bug in the assembler
* jsr l_test_func
jmp l_test_lsr
* Test the LSR instruction
l_test_lsr
ldaa #$17
lsra
bcc l_lsr_error
cmpa #$0b
bne l_lsr_error
jmp l_test_neg
l_lsr_error
jmp l_error
* Test the NEG instruction
l_test_neg
ldaa #$f3
nega
cmpa #$0d
bne l_neg_error
jmp l_test_nop
l_neg_error
jmp l_error
* Test the NOP instruction
l_test_nop
nop
jmp l_test_ora
* Test the ORA instruction
l_test_ora
ldaa #$5c
oraa #$d7
cmpa #$df
bne l_ora_error
jmp l_test_pul_psh
l_ora_error
jmp l_error
* Test the PSH and PUL instructions
l_test_pul_psh
lds #$2000
ldaa #$13
ldab #$37
psha
pshb
pula
pulb
cmpa #$37
bne l_pul_psh_error
cmpb #$13
bne l_pul_psh_error
jmp l_test_rol_ror
l_pul_psh_error
jmp l_error
* Test the ROL and ROR instructions
l_test_rol_ror
clc
ldaa #$64
rora
bcs l_rol_ror_error
cmpa #$32
bne l_rol_ror_error
sec
ldaa #$13
rora
bcc l_rol_ror_error
cmpa #$89
bne l_rol_ror_error
clc
ldaa #$64
rola
bcs l_rol_ror_error
cmpa #$c8
bne l_rol_ror_error
sec
ldaa #$93
rola
bcc l_rol_ror_error
cmpa #$27
bne l_rol_ror_error
jmp l_test_sba
l_rol_ror_error
jmp l_error
* Test the SBA instruction
l_test_sba
ldaa #$f2
ldab #$54
sba
cmpa #$9e
bne l_sba_error
ldab #$a2
sba
cmpa #$fc
bne l_sba_error
jmp l_test_sbc
l_sba_error
jmp l_error
* Test the SBC instruction
l_test_sbc
ldaa #$a2
clc
sbca #$12
cmpa #$90
bne l_sbc_error
sec
sbca #$15
cmpa #$7a
bne l_sbc_error
jmp l_test_sub
l_sbc_error
jmp l_error
* Test the SUB instruction
l_test_sub
ldaa #$43
suba #$f5
cmpa #$4e
bne l_test_error
ldaa #$12
suba #$3
cmpa #$0f
bne l_test_error
jmp l_test_tab_tba
l_test_error
jmp l_error
* Test the TAB and TBA instructions
l_test_tab_tba
ldaa #$82
tab
cmpb #$82
bne l_tab_tba_error
ldab #$cd
tba
cmpb #$cd
bne l_tab_tba_error
jmp l_test_tap_tpa
l_tab_tba_error
jmp l_error
* Test the TAP and TPA instructions
l_test_tap_tpa
ldaa #$3
suba #$4
clc
sev
sei
tpa
cmpa #$da
bne l_tap_tpa_error
ldaa #$3
tap
bvc l_tap_tpa_error
bcc l_tap_tpa_error
jmp l_test_tst
l_tap_tpa_error
jmp l_error
* Test the TST instruction
l_test_tst
ldaa #$f8
tst
beq l_tst_error
ldaa #$00
bne l_tst_error
jmp l_test_tsx_txs
l_tst_error
jmp l_error
* Test the TSX and TXS instructions
l_test_tsx_txs
lds #$8202
tsx
cpx #$8203
bne l_tsx_txs_error
ldx #$1338
txs
ldaa #$13
ldab #$37
psha
pshb
ldab $1337
ldaa $1336
cmpa #$37
bne l_tsx_txs_error
cmpb #$13
bne l_tsx_txs_error
jmp l_success
l_tsx_txs_error
jmp l_error
* Something went wrong
l_error
jmp l_error
* Everything was OK!
l_success
jmp l_success
|
regtests/gen-testsuite.adb | My-Colaborations/dynamo | 0 | 22282 | <gh_stars>0
-----------------------------------------------------------------------
-- gen-testsuite -- Testsuite for gen
-- Copyright (C) 2012, 2018 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Directories;
with Ada.Strings.Unbounded;
with Gen.Artifacts.XMI.Tests;
with Gen.Artifacts.Yaml.Tests;
with Gen.Integration.Tests;
package body Gen.Testsuite is
Tests : aliased Util.Tests.Test_Suite;
Dir : Ada.Strings.Unbounded.Unbounded_String;
function Suite return Util.Tests.Access_Test_Suite is
Result : constant Util.Tests.Access_Test_Suite := Tests'Access;
begin
Gen.Artifacts.XMI.Tests.Add_Tests (Result);
Gen.Artifacts.Yaml.Tests.Add_Tests (Result);
Gen.Integration.Tests.Add_Tests (Result);
return Result;
end Suite;
-- ------------------------------
-- Get the test root directory.
-- ------------------------------
function Get_Test_Directory return String is
begin
return Ada.Strings.Unbounded.To_String (Dir);
end Get_Test_Directory;
procedure Initialize (Props : in Util.Properties.Manager) is
pragma Unreferenced (Props);
begin
Dir := Ada.Strings.Unbounded.To_Unbounded_String (Ada.Directories.Current_Directory);
end Initialize;
end Gen.Testsuite;
|
test/asset/agda-stdlib-1.0/Relation/Binary/Reasoning/Base/Triple.agda | omega12345/agda-mode | 0 | 10241 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- The basic code for equational reasoning with three relations:
-- equality, strict ordering and non-strict ordering.
------------------------------------------------------------------------
--
-- See `Data.Nat.Properties` or `Relation.Binary.Reasoning.PartialOrder`
-- for examples of how to instantiate this module.
{-# OPTIONS --without-K --safe #-}
open import Relation.Binary
module Relation.Binary.Reasoning.Base.Triple {a ℓ₁ ℓ₂ ℓ₃} {A : Set a}
{_≈_ : Rel A ℓ₁} {_≤_ : Rel A ℓ₂} {_<_ : Rel A ℓ₃}
(isPreorder : IsPreorder _≈_ _≤_)
(<-trans : Transitive _<_) (<-resp-≈ : _<_ Respects₂ _≈_) (<⇒≤ : _<_ ⇒ _≤_)
(<-≤-trans : Trans _<_ _≤_ _<_) (≤-<-trans : Trans _≤_ _<_ _<_)
where
open import Data.Product using (proj₁; proj₂)
open import Function using (case_of_; id)
open import Level using (Level; _⊔_; Lift; lift)
open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym)
open import Relation.Nullary using (Dec; yes; no)
open import Relation.Nullary.Decidable using (True; toWitness)
open IsPreorder isPreorder
renaming
( reflexive to ≤-reflexive
; trans to ≤-trans
; ∼-resp-≈ to ≤-resp-≈
)
------------------------------------------------------------------------
-- A datatype to hide the current relation type
data _IsRelatedTo_ (x y : A) : Set (a ⊔ ℓ₁ ⊔ ℓ₂ ⊔ ℓ₃) where
strict : (x<y : x < y) → x IsRelatedTo y
nonstrict : (x≤y : x ≤ y) → x IsRelatedTo y
equals : (x≈y : x ≈ y) → x IsRelatedTo y
------------------------------------------------------------------------
-- Types that are used to ensure that the final relation proved by the
-- chain of reasoning can be converted into the required relation.
data IsStrict {x y} : x IsRelatedTo y → Set (a ⊔ ℓ₁ ⊔ ℓ₂ ⊔ ℓ₃) where
isStrict : ∀ x<y → IsStrict (strict x<y)
IsStrict? : ∀ {x y} (x≲y : x IsRelatedTo y) → Dec (IsStrict x≲y)
IsStrict? (strict x<y) = yes (isStrict x<y)
IsStrict? (nonstrict _) = no λ()
IsStrict? (equals _) = no λ()
extractStrict : ∀ {x y} {x≲y : x IsRelatedTo y} → IsStrict x≲y → x < y
extractStrict (isStrict x<y) = x<y
data IsEquality {x y} : x IsRelatedTo y → Set (a ⊔ ℓ₁ ⊔ ℓ₂ ⊔ ℓ₃) where
isEquality : ∀ x≈y → IsEquality (equals x≈y)
IsEquality? : ∀ {x y} (x≲y : x IsRelatedTo y) → Dec (IsEquality x≲y)
IsEquality? (strict _) = no λ()
IsEquality? (nonstrict _) = no λ()
IsEquality? (equals x≈y) = yes (isEquality x≈y)
extractEquality : ∀ {x y} {x≲y : x IsRelatedTo y} → IsEquality x≲y → x ≈ y
extractEquality (isEquality x≈y) = x≈y
------------------------------------------------------------------------
-- Reasoning combinators
infix -1 begin_ begin-strict_ begin-equality_
infixr 0 _<⟨_⟩_ _≤⟨_⟩_ _≈⟨_⟩_ _≈˘⟨_⟩_ _≡⟨_⟩_ _≡˘⟨_⟩_ _≡⟨⟩_
infix 1 _∎
begin_ : ∀ {x y} (r : x IsRelatedTo y) → x ≤ y
begin (strict x<y) = <⇒≤ x<y
begin (nonstrict x≤y) = x≤y
begin (equals x≈y) = ≤-reflexive x≈y
begin-strict_ : ∀ {x y} (r : x IsRelatedTo y) → {s : True (IsStrict? r)} → x < y
begin-strict_ r {s} = extractStrict (toWitness s)
begin-equality_ : ∀ {x y} (r : x IsRelatedTo y) → {s : True (IsEquality? r)} → x ≈ y
begin-equality_ r {s} = extractEquality (toWitness s)
_<⟨_⟩_ : ∀ (x : A) {y z} → x < y → y IsRelatedTo z → x IsRelatedTo z
x <⟨ x<y ⟩ strict y<z = strict (<-trans x<y y<z)
x <⟨ x<y ⟩ nonstrict y≤z = strict (<-≤-trans x<y y≤z)
x <⟨ x<y ⟩ equals y≈z = strict (proj₁ <-resp-≈ y≈z x<y)
_≤⟨_⟩_ : ∀ (x : A) {y z} → x ≤ y → y IsRelatedTo z → x IsRelatedTo z
x ≤⟨ x≤y ⟩ strict y<z = strict (≤-<-trans x≤y y<z)
x ≤⟨ x≤y ⟩ nonstrict y≤z = nonstrict (≤-trans x≤y y≤z)
x ≤⟨ x≤y ⟩ equals y≈z = nonstrict (proj₁ ≤-resp-≈ y≈z x≤y)
_≈⟨_⟩_ : ∀ (x : A) {y z} → x ≈ y → y IsRelatedTo z → x IsRelatedTo z
x ≈⟨ x≈y ⟩ strict y<z = strict (proj₂ <-resp-≈ (Eq.sym x≈y) y<z)
x ≈⟨ x≈y ⟩ nonstrict y≤z = nonstrict (proj₂ ≤-resp-≈ (Eq.sym x≈y) y≤z)
x ≈⟨ x≈y ⟩ equals y≈z = equals (Eq.trans x≈y y≈z)
_≈˘⟨_⟩_ : ∀ x {y z} → y ≈ x → y IsRelatedTo z → x IsRelatedTo z
x ≈˘⟨ x≈y ⟩ y∼z = x ≈⟨ Eq.sym x≈y ⟩ y∼z
_≡⟨_⟩_ : ∀ (x : A) {y z} → x ≡ y → y IsRelatedTo z → x IsRelatedTo z
x ≡⟨ x≡y ⟩ strict y<z = strict (case x≡y of λ where refl → y<z)
x ≡⟨ x≡y ⟩ nonstrict y≤z = nonstrict (case x≡y of λ where refl → y≤z)
x ≡⟨ x≡y ⟩ equals y≈z = equals (case x≡y of λ where refl → y≈z)
_≡˘⟨_⟩_ : ∀ x {y z} → y ≡ x → y IsRelatedTo z → x IsRelatedTo z
x ≡˘⟨ x≡y ⟩ y∼z = x ≡⟨ sym x≡y ⟩ y∼z
_≡⟨⟩_ : ∀ (x : A) {y} → x IsRelatedTo y → x IsRelatedTo y
x ≡⟨⟩ x≲y = x≲y
_∎ : ∀ x → x IsRelatedTo x
x ∎ = equals Eq.refl
|
src/ui/table.ads | thindil/steamsky | 80 | 2694 | <filename>src/ui/table.ads
-- Copyright (c) 2021 <NAME> <<EMAIL>>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Tcl.Tk.Ada.Widgets.Canvas; use Tcl.Tk.Ada.Widgets.Canvas;
with Tcl.Tk.Ada.Widgets.TtkScrollbar; use Tcl.Tk.Ada.Widgets.TtkScrollbar;
-- ****h* Table/Table
-- FUNCTION
-- Provides code for create and manipulate more advanced table widget
-- SOURCE
package Table is
-- ****
-- ****t* Table/Table.Width_Array
-- FUNCTION
-- Used to store width of Table_Widget columns
-- SOURCE
type Width_Array is array(Positive range <>) of Positive;
-- ****
-- ****s* Table/Table.Table_Widget
-- FUNCTION
-- Store data for each created table
-- PARAMETERS
-- Canvas - Tk_Canvas which is used as table
-- Columns_Width - The array with the width for each column in the table
-- Row - The current row of the table
-- Row_Height - The height of each row
-- Scrollbar - The vertical Ttk_Scrollbar associated with the table
-- SOURCE
type Table_Widget(Amount: Positive) is record
Canvas: Tk_Canvas;
Columns_Width: Width_Array(1 .. Amount) := (others => 1);
Row: Positive := 1;
Row_Height: Positive := 1;
Scrollbar: Ttk_Scrollbar;
end record;
-- ****
-- ****t* Table/Table.Headers_Array
-- FUNCTION
-- Used to store the titles for columns in the selected table
-- SOURCE
type Headers_Array is array(Positive range <>) of Unbounded_String;
-- ****
-- ****f* Table/Table.CreateTable
-- FUNCTION
-- Create a new table and columns headers in it
-- PARAMETERS
-- Parent - The Tk path for the parent widget
-- Headers - The titles for the table headers
-- Scrollbar - Ttk_Scrollbar associated with the table. If empty
-- then create a new scrollbars. Default value is empty.
-- Command - The Tcl command executed when the player press the table
-- header. If empty, no command is executed. Default value is
-- empty
-- Tooltip - The tooltip show when the player hover mouse over the table
-- header. Can be empty. Default value is empty
-- RESULT
-- The newly created Table_Widget
-- HISTORY
-- 5.7 - Added
-- 6.4 - Added Command parameter
-- SOURCE
function CreateTable
(Parent: String; Headers: Headers_Array;
Scrollbar: Ttk_Scrollbar := Get_Widget(".");
Command, Tooltip: String := "") return Table_Widget with
Pre => Parent'Length > 0 and Headers'Length > 0,
Post => CreateTable'Result.Row_Height > 1;
-- ****
-- ****f* Table/Table.ClearTable
-- FUNCTION
-- Clear data from the table
-- PARAMETERS
-- Table - The Table_Widget which will be cleared
-- OUTPUT
-- Cleared Table parameter Table_Widget
-- HISTORY
-- 5.7 - Added
-- SOURCE
procedure ClearTable(Table: in out Table_Widget) with
Pre => Table.Row_Height > 1;
-- ****
-- ****f* Table/Table.AddButton
-- FUNCTION
-- Add button item to the selected Table_Widget
-- PARAMETERS
-- Table - The Table_Widget in which button will be added
-- Text - The text displayed on the button
-- Tooltip - The tooltip show when user hover mouse over button
-- Command - Tcl command which will be executed when button was clicked
-- Column - The column in which the button will be added
-- NewRow - If True, increase current number of row in the Table_Widget.
-- Default value is False.
-- Color - The color of the text on button which will be added. If empty,
-- use default interface color. Default value is empty.
-- OUTPUT
-- Updated Table parameter Table_Widget
-- HISTORY
-- 5.7 - Added
-- SOURCE
procedure AddButton
(Table: in out Table_Widget; Text, Tooltip, Command: String;
Column: Positive; NewRow: Boolean := False; Color: String := "") with
Pre => Table.Row_Height > 1 and Command'Length > 0;
-- ****
-- ****f* Table/Table.UpdateTable
-- FUNCTION
-- Update size and coordinates of all elements in the selected table
-- PARAMETERS
-- Table - The Table_Widget which elements will be resized if needed
-- Grab_Focus - If true, grab the keyboard focus for the table
-- HISTORY
-- 5.7 - Added
-- 6.7 - Added option to set focus on table
-- SOURCE
procedure UpdateTable
(Table: in out Table_Widget; Grab_Focus: Boolean := True) with
Pre => Table.Row_Height > 1;
-- ****
-- ****f* Table/Table.AddProgressBar
-- FUNCTION
-- Add progress bar item to the selected Table_Widget
-- PARAMETERS
-- Table - The Table_Widget in which progress bar will be added
-- Value - The current value of the progress bar
-- MaxValue - The maximum value of the progress bar
-- Tooltip - The tooltip show when user hover mouse over progress bar
-- Command - Tcl command which will be executed when the row in which the
-- the progress bar is was clicked
-- Column - The column in which the progress bar will be added
-- NewRow - If True, increase current number of row in the Table_Widget.
-- Default value is False.
-- InvertColors - Invert colors of the progress bar (small amount green, max
-- red instead of small amount red and max green)
-- OUTPUT
-- Updated Table parameter Table_Widget
-- HISTORY
-- 5.7 - Added
-- SOURCE
procedure AddProgressBar
(Table: in out Table_Widget; Value: Natural; MaxValue: Positive;
Tooltip, Command: String; Column: Positive;
NewRow, InvertColors: Boolean := False) with
Pre => Table.Row_Height > 1 and Value <= MaxValue;
-- ****
-- ****f* Table/Table.AddPagination
-- FUNCTION
-- Add pagination buttons to the bottom of the table
-- PARAMETERS
-- Table - The Table_Widget to which buttons will be added
-- PreviousCommand - The Tcl command which will be executed by the previous
-- button. If empty, button will not be shown.
-- NextCommand - The Tcl command which will be executed by the next
-- button. If empty, button will not be shown.
-- HISTORY
-- 5.9 - Added
-- SOURCE
procedure AddPagination
(Table: in out Table_Widget; PreviousCommand, NextCommand: String) with
Pre => Table.Row_Height > 1;
-- ****
-- ****f* Table/Table.AddCheckButton
-- FUNCTION
-- Add check button item to the selected Table_Widget
-- PARAMETERS
-- Table - The Table_Widget in which button will be added
-- Tooltip - The tooltip show when user hover mouse over button
-- Command - Tcl command which will be executed when button was clicked. If
-- empty, the button will be disabled
-- Checked - If True, the button will be checked
-- Column - The column in which the button will be added
-- NewRow - If True, increase current number of row in the Table_Widget.
-- Default value is False.
-- HISTORY
-- 6.0 - Added
-- SOURCE
procedure AddCheckButton
(Table: in out Table_Widget; Tooltip, Command: String; Checked: Boolean;
Column: Positive; NewRow: Boolean := False) with
Pre => Table.Row_Height > 1;
-- ****
-- ****f* Table/Table.Get_Column_Number
-- FUNCTION
-- Get the number of the Table_Widget column for the selected X axis
-- coordinate
-- PARAMETERS
-- Table - The Table_Widget which column will be taken
-- X_Position - The X axis coordinate from which the column will be count
-- RESULT
-- The number of the column for the selected coordinate. The number starts
-- from 1.
-- HISTORY
-- 6.4 - Added
-- SOURCE
function Get_Column_Number
(Table: Table_Widget; X_Position: Natural) return Positive;
-- ****
-- ****f* Table/Table.Update_Headers_Command
-- FUNCTION
-- Update the Tcl command executed when the player clicked on Table_Widget
-- headers
-- PARAMETERS
-- Table - The Table_Widget in which headers will be updated
-- Command - The Tcl command to execute. If empty, the command will be
-- removed
-- HISTORY
-- 6.5 - Added
-- SOURCE
procedure Update_Headers_Command(Table: Table_Widget; Command: String);
-- ****
-- ****f* Table/Tabel.AddCommands
-- FUNCTION
-- Add Tcl commands related to the Table_Widget
-- HISTORY
-- 6.6 - Added
-- SOURCE
procedure AddCommands;
-- ****
end Table;
|
src/Vi/Ip.agda | mietek/formal-logic | 26 | 9722 | -- Intuitionistic propositional logic, vector-based de Bruijn approach, initial encoding
module Vi.Ip where
open import Lib using (Nat; suc; _+_; Fin; fin; Vec; _,_; proj; VMem; mem)
-- Types
infixl 2 _&&_
infixl 1 _||_
infixr 0 _=>_
data Ty : Set where
UNIT : Ty
_=>_ : Ty -> Ty -> Ty
_&&_ : Ty -> Ty -> Ty
_||_ : Ty -> Ty -> Ty
FALSE : Ty
infixr 0 _<=>_
_<=>_ : Ty -> Ty -> Ty
a <=> b = (a => b) && (b => a)
NOT : Ty -> Ty
NOT a = a => FALSE
TRUE : Ty
TRUE = FALSE => FALSE
-- Context and truth judgement
Cx : Nat -> Set
Cx n = Vec Ty n
isTrue : forall {tn} -> Ty -> Fin tn -> Cx tn -> Set
isTrue a i tc = VMem a i tc
-- Terms
module Ip where
infixl 1 _$_
infixr 0 lam=>_
data Tm {tn} (tc : Cx tn) : Ty -> Set where
var : forall {a i} -> isTrue a i tc -> Tm tc a
lam=>_ : forall {a b} -> Tm (tc , a) b -> Tm tc (a => b)
_$_ : forall {a b} -> Tm tc (a => b) -> Tm tc a -> Tm tc b
pair' : forall {a b} -> Tm tc a -> Tm tc b -> Tm tc (a && b)
fst : forall {a b} -> Tm tc (a && b) -> Tm tc a
snd : forall {a b} -> Tm tc (a && b) -> Tm tc b
left : forall {a b} -> Tm tc a -> Tm tc (a || b)
right : forall {a b} -> Tm tc b -> Tm tc (a || b)
case' : forall {a b c} -> Tm tc (a || b) -> Tm (tc , a) c -> Tm (tc , b) c -> Tm tc c
abort : forall {a} -> Tm tc FALSE -> Tm tc a
syntax pair' x y = [ x , y ]
syntax case' xy x y = case xy => x => y
v : forall {tn} (k : Nat) {tc : Cx (suc (k + tn))} -> Tm tc (proj tc (fin k))
v i = var (mem i)
Thm : Ty -> Set
Thm a = forall {tn} {tc : Cx tn} -> Tm tc a
open Ip public
-- Example theorems
t1 : forall {a b} -> Thm (a => NOT a => b)
t1 =
lam=>
lam=> abort (v 0 $ v 1)
t2 : forall {a b} -> Thm (NOT a => a => b)
t2 =
lam=>
lam=> abort (v 1 $ v 0)
t3 : forall {a} -> Thm (a => NOT (NOT a))
t3 =
lam=>
lam=> v 0 $ v 1
t4 : forall {a} -> Thm (NOT a <=> NOT (NOT (NOT a)))
t4 =
[ lam=>
lam=> v 0 $ v 1
, lam=>
lam=> v 1 $ (lam=> v 0 $ v 1)
]
|
arch/RISC-V/SiFive/drivers/fe310.adb | rocher/Ada_Drivers_Library | 192 | 13322 | <filename>arch/RISC-V/SiFive/drivers/fe310.adb
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017-2018, AdaCore and other contributors --
-- --
-- See github.com/AdaCore/Ada_Drivers_Library/graphs/contributors --
-- for more information --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
with FE310.Time; use FE310.Time;
with FE310_SVD.OTP_Mem; use FE310_SVD.OTP_Mem;
with FE310_SVD.PRIC; use FE310_SVD.PRIC;
with FE310_SVD.SPI; use FE310_SVD.SPI;
package body FE310 is
Crystal_Frequency : constant := 16_000_000;
HFROSC_Frequency : constant := 72_000_000; -- High frequency internal oscillator
-------------------
-- CPU_Frequency --
-------------------
function CPU_Frequency return UInt32 is
Freq : UInt32;
begin
if PRIC_Periph.PLLCFG.SEL = Internal then
Freq := HFROSC_Frequency / (UInt32 (PRIC_Periph.HFROSCCFG.DIV) + 1);
else
if PRIC_Periph.PLLCFG.REFSEL = Crystal then
Freq := Crystal_Frequency;
else
Freq := HFROSC_Frequency;
end if;
if PRIC_Periph.PLLCFG.BYPASS = False then
Freq := Freq / (UInt32 (PRIC_Periph.PLLCFG.R) + 1)
* (2 * (UInt32 (PRIC_Periph.PLLCFG.F) + 1))
/ (2**(Natural (PRIC_Periph.PLLCFG.Q)));
end if;
if PRIC_Periph.PLLOUTDIV.DIV_BY_1 = False then
Freq := Freq / (2 * (UInt32 (PRIC_Periph.PLLOUTDIV.DIV) + 1));
end if;
end if;
return Freq;
end CPU_Frequency;
-----------------------------------------
-- Load_Internal_Oscilator_Calibration --
-----------------------------------------
procedure Load_Internal_Oscilator_Calibration is
begin
PRIC_Periph.HFROSCCFG.TRIM := OTP_Mem_Periph.HFROSC_TRIM.VALUE - 1;
end Load_Internal_Oscilator_Calibration;
----------------------------
-- Use_Crystal_Oscillator --
----------------------------
procedure Use_Crystal_Oscillator (Divider : PLL_Output_Divider := 1) is
begin
-- Use internal oscillator during switch
PRIC_Periph.HFROSCCFG.DIV := 4; -- Divide by 5, Freq = 14.4 MHz
PRIC_Periph.HFROSCCFG.ENABLE := True;
loop
exit when PRIC_Periph.HFROSCCFG.READY;
end loop;
PRIC_Periph.PLLCFG.SEL := Internal;
-- Start the crystal oscillator
PRIC_Periph.HFXOSCCFG.ENABLE := True;
loop
exit when PRIC_Periph.HFXOSCCFG.READY;
end loop;
-- Configure the final divider
if Divider = 1 then
PRIC_Periph.PLLOUTDIV.DIV_BY_1 := True;
else
PRIC_Periph.PLLOUTDIV.DIV_BY_1 := False;
PRIC_Periph.PLLOUTDIV.DIV := PLLOUTDIV_DIV_Field ((Divider / 2) - 1);
end if;
-- Switch to crystal oscillator
PRIC_Periph.PLLCFG.REFSEL := Crystal;
PRIC_Periph.PLLCFG.BYPASS := True;
PRIC_Periph.PLLCFG.SEL := Pll;
-- Disable internal oscillator
PRIC_Periph.HFROSCCFG.ENABLE := False;
end Use_Crystal_Oscillator;
-----------------------------
-- Use_Internal_Oscillator --
-----------------------------
procedure Use_Internal_Oscillator (Divider : Internal_Oscillator_Divider := 5) is
begin
PRIC_Periph.HFROSCCFG.DIV := HFROSCCFG_DIV_Field (Divider - 1);
PRIC_Periph.HFROSCCFG.ENABLE := True;
loop
exit when PRIC_Periph.HFROSCCFG.READY;
end loop;
PRIC_Periph.PLLCFG.SEL := Internal;
-- Disable crystal oscillator and PLL
PRIC_Periph.HFXOSCCFG.ENABLE := False;
PRIC_Periph.PLLCFG.BYPASS := True;
end Use_Internal_Oscillator;
------------
-- Use_PLL--
------------
procedure Use_PLL (Reference : PLL_Reference;
Internal_Osc_Div : Internal_Oscillator_Divider := 5;
R_Div : PLL_R;
F_Mul : PLL_F;
Q_Div : PLL_Q;
Output_Div : PLL_Output_Divider) is
begin
-- Use internal oscillator during switch
PRIC_Periph.HFROSCCFG.DIV := HFROSCCFG_DIV_Field (Internal_Osc_Div - 1);
PRIC_Periph.HFROSCCFG.ENABLE := True;
loop
exit when PRIC_Periph.HFROSCCFG.READY;
end loop;
PRIC_Periph.PLLCFG.SEL := Internal;
if Reference = Crystal then
-- Start the crystal oscillator
PRIC_Periph.HFXOSCCFG.ENABLE := True;
loop
exit when PRIC_Periph.HFXOSCCFG.READY;
end loop;
else
PRIC_Periph.HFXOSCCFG.ENABLE := False;
end if;
-- Configure the PLL
PRIC_Periph.PLLCFG.REFSEL := PLLCFG_REFSEL_Field (Reference);
PRIC_Periph.PLLCFG.R := PLLCFG_R_Field (R_Div - 1);
PRIC_Periph.PLLCFG.F := PLLCFG_F_Field ((F_Mul / 2) - 1);
PRIC_Periph.PLLCFG.Q := PLLCFG_Q_Field (PLL_Q'Enum_Rep (Q_Div));
-- Configure the final divider
if Output_Div = 1 then
PRIC_Periph.PLLOUTDIV.DIV_BY_1 := True;
else
PRIC_Periph.PLLOUTDIV.DIV_BY_1 := False;
PRIC_Periph.PLLOUTDIV.DIV := PLLOUTDIV_DIV_Field ((Output_Div / 2) - 1);
end if;
-- Start the PLL
PRIC_Periph.PLLCFG.BYPASS := False;
Delay_Us (150);
loop
exit when PRIC_Periph.PLLCFG.LOCK;
end loop;
-- Switch to PLL
PRIC_Periph.PLLCFG.SEL := Pll;
-- Disable internal oscillator if the crystal reference is used
if Reference = Crystal then
PRIC_Periph.HFROSCCFG.ENABLE := False;
end if;
end Use_PLL;
---------------------------------
-- Set_SPI_Flash_Clock_Divider --
---------------------------------
procedure Set_SPI_Flash_Clock_Divider (Divider : SPI_Clock_Divider) is
begin
QSPI0_Periph.SCKDIV.SCALE := (UInt12 (Divider) / 2) - 1;
end Set_SPI_Flash_Clock_Divider;
-----------------------------
-- SPI_Flash_Clock_Divider --
-----------------------------
function SPI_Flash_Clock_Divider return SPI_Clock_Divider is
begin
return 2 * (Integer (QSPI0_Periph.SCKDIV.SCALE) + 1);
end SPI_Flash_Clock_Divider;
end FE310;
|
base/ntdll/amd64/ldrthunk.asm | npocmaka/Windows-Server-2003 | 17 | 86925 | <filename>base/ntdll/amd64/ldrthunk.asm
title "LdrInitializeThunk"
;++
;
; Copyright (c) 1989 Microsoft Corporation
;
; Module Name:
;
; ldrthunk.s
;
; Abstract:
;
; This module implements the thunk for the loader staetup APC routine.
;
; Author:
;
; <NAME> (davec) 25-Jun-2000
;
; Environment:
;
; Any mode.
;
;--
include ksamd64.inc
extrn LdrpInitialize:proc
subttl "Initialize Thunk"
;++
;
; VOID
; LdrInitializeThunk(
; IN PVOID NormalContext,
; IN PVOID SystemArgument1,
; IN PVOID SystemArgument2
; )
;
; Routine Description:
;
; This function computes a pointer to the context record on the stack
; and jumps to the LdrpInitialize function with that pointer as its
; parameter.
;
; Arguments:
;
; NormalContext (rcx) - User Mode APC context parameter (ignored).
;
; SystemArgument1 (rdx) - User Mode APC system argument 1 (ignored).
;
; SystemArgument2 (r8) - User Mode APC system argument 2 (ignored).
;
; Return Value:
;
; None.
;
;--
LEAF_ENTRY LdrInitializeThunk, _TEXT$00
lea rcx, [rsp+8] ; set context record address
jmp LdrpInitialize ; finish in common common
LEAF_END LdrInitializeThunk, _TEXT$00
end
|
src/z80flags.asm | SHARPENTIERS/z80test | 2 | 96594 | ; Z80 test - flags only version.
;
; Copyright (C) 2012 <NAME> (<EMAIL>)
;
; This source code is released under the MIT license, see included license.txt.
macro testname
db "FLAGS"
endm
maskflags equ 0
onlyflags equ 1
postccf equ 0
memptr equ 0
include main.asm
; EOF ;
|
llvm-gcc-4.2-2.9/gcc/ada/mlib-tgt-vms-ia64.adb | vidkidz/crossbridge | 1 | 17044 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- M L I B . T G T --
-- (Integrity VMS Version) --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is the Integrity VMS version of the body
with Ada.Characters.Handling; use Ada.Characters.Handling;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with MLib.Fil;
with MLib.Utl;
with Namet; use Namet;
with Opt; use Opt;
with Output; use Output;
with Prj.Com;
with System; use System;
with System.Case_Util; use System.Case_Util;
with System.CRTL; use System.CRTL;
package body MLib.Tgt is
use GNAT;
Empty_Argument_List : aliased Argument_List := (1 .. 0 => null);
Additional_Objects : Argument_List_Access := Empty_Argument_List'Access;
-- Used to add the generated auto-init object files for auto-initializing
-- stand-alone libraries.
Macro_Name : constant String := "mcr gnu:[bin]gcc -c -x assembler";
-- The name of the command to invoke the macro-assembler
VMS_Options : Argument_List := (1 .. 1 => null);
Gnatsym_Name : constant String := "gnatsym";
Gnatsym_Path : String_Access;
Arguments : Argument_List_Access := null;
Last_Argument : Natural := 0;
Success : Boolean := False;
Shared_Libgcc : aliased String := "-shared-libgcc";
No_Shared_Libgcc_Switch : aliased Argument_List := (1 .. 0 => null);
Shared_Libgcc_Switch : aliased Argument_List :=
(1 => Shared_Libgcc'Access);
Link_With_Shared_Libgcc : Argument_List_Access :=
No_Shared_Libgcc_Switch'Access;
---------------------
-- Archive_Builder --
---------------------
function Archive_Builder return String is
begin
return "ar";
end Archive_Builder;
-----------------------------
-- Archive_Builder_Options --
-----------------------------
function Archive_Builder_Options return String_List_Access is
begin
return new String_List'(1 => new String'("cr"));
end Archive_Builder_Options;
-----------------
-- Archive_Ext --
-----------------
function Archive_Ext return String is
begin
return "olb";
end Archive_Ext;
---------------------
-- Archive_Indexer --
---------------------
function Archive_Indexer return String is
begin
return "ranlib";
end Archive_Indexer;
-----------------------------
-- Archive_Indexer_Options --
-----------------------------
function Archive_Indexer_Options return String_List_Access is
begin
return new String_List (1 .. 0);
end Archive_Indexer_Options;
---------------------------
-- Build_Dynamic_Library --
---------------------------
procedure Build_Dynamic_Library
(Ofiles : Argument_List;
Foreign : Argument_List;
Afiles : Argument_List;
Options : Argument_List;
Options_2 : Argument_List;
Interfaces : Argument_List;
Lib_Filename : String;
Lib_Dir : String;
Symbol_Data : Symbol_Record;
Driver_Name : Name_Id := No_Name;
Lib_Version : String := "";
Auto_Init : Boolean := False)
is
pragma Unreferenced (Foreign);
pragma Unreferenced (Afiles);
Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Filename, DLL_Ext);
Opts : Argument_List := Options;
Last_Opt : Natural := Opts'Last;
Opts2 : Argument_List (Options'Range);
Last_Opt2 : Natural := Opts2'First - 1;
Inter : constant Argument_List := Interfaces;
function Is_Interface (Obj_File : String) return Boolean;
-- For a Stand-Alone Library, returns True if Obj_File is the object
-- file name of an interface of the SAL. For other libraries, always
-- return True.
function Option_File_Name return String;
-- Returns Symbol_File, if not empty. Otherwise, returns "symvec.opt"
function Version_String return String;
-- Returns Lib_Version if not empty and if Symbol_Data.Symbol_Policy is
-- not Autonomous, otherwise returns "".
-- When Symbol_Data.Symbol_Policy is Autonomous, fails gnatmake if
-- Lib_Version is not the image of a positive number.
------------------
-- Is_Interface --
------------------
function Is_Interface (Obj_File : String) return Boolean is
ALI : constant String :=
Fil.Ext_To
(Filename => To_Lower (Base_Name (Obj_File)),
New_Ext => "ali");
begin
if Inter'Length = 0 then
return True;
elsif ALI'Length > 2 and then
ALI (ALI'First .. ALI'First + 2) = "b__"
then
return True;
else
for J in Inter'Range loop
if Inter (J).all = ALI then
return True;
end if;
end loop;
return False;
end if;
end Is_Interface;
----------------------
-- Option_File_Name --
----------------------
function Option_File_Name return String is
begin
if Symbol_Data.Symbol_File = No_Name then
return "symvec.opt";
else
Get_Name_String (Symbol_Data.Symbol_File);
To_Lower (Name_Buffer (1 .. Name_Len));
return Name_Buffer (1 .. Name_Len);
end if;
end Option_File_Name;
--------------------
-- Version_String --
--------------------
function Version_String return String is
Version : Integer := 0;
begin
if Lib_Version = ""
or else Symbol_Data.Symbol_Policy /= Autonomous
then
return "";
else
begin
Version := Integer'Value (Lib_Version);
if Version <= 0 then
raise Constraint_Error;
end if;
return Lib_Version;
exception
when Constraint_Error =>
Fail ("illegal version """, Lib_Version,
""" (on VMS version must be a positive number)");
return "";
end;
end if;
end Version_String;
Opt_File_Name : constant String := Option_File_Name;
Version : constant String := Version_String;
For_Linker_Opt : String_Access;
-- Start of processing for Build_Dynamic_Library
begin
-- Invoke gcc with -shared-libgcc, but only for GCC 3 or higher
if GCC_Version >= 3 then
Link_With_Shared_Libgcc := Shared_Libgcc_Switch'Access;
else
Link_With_Shared_Libgcc := No_Shared_Libgcc_Switch'Access;
end if;
-- Option file must end with ".opt"
if Opt_File_Name'Length > 4
and then
Opt_File_Name (Opt_File_Name'Last - 3 .. Opt_File_Name'Last) = ".opt"
then
For_Linker_Opt := new String'("--for-linker=" & Opt_File_Name);
else
Fail ("Options File """, Opt_File_Name, """ must end with .opt");
end if;
VMS_Options (VMS_Options'First) := For_Linker_Opt;
for J in Inter'Range loop
To_Lower (Inter (J).all);
end loop;
-- "gnatsym" is necessary for building the option file
if Gnatsym_Path = null then
Gnatsym_Path := OS_Lib.Locate_Exec_On_Path (Gnatsym_Name);
if Gnatsym_Path = null then
Fail (Gnatsym_Name, " not found in path");
end if;
end if;
-- For auto-initialization of a stand-alone library, we create
-- a macro-assembly file and we invoke the macro-assembler.
if Auto_Init then
declare
Macro_File_Name : constant String := Lib_Filename & "__init.asm";
Macro_File : File_Descriptor;
Init_Proc : String := Lib_Filename & "INIT";
Popen_Result : System.Address;
Pclose_Result : Integer;
Len : Natural;
OK : Boolean := True;
command : constant String :=
Macro_Name & " " & Macro_File_Name & ASCII.NUL;
-- The command to invoke the assembler on the generated auto-init
-- assembly file.
mode : constant String := "r" & ASCII.NUL;
-- The mode for the invocation of Popen
begin
To_Upper (Init_Proc);
if Verbose_Mode then
Write_Str ("Creating auto-init assembly file """);
Write_Str (Macro_File_Name);
Write_Line ("""");
end if;
-- Create and write the auto-init assembly file
declare
First_Line : constant String :=
ASCII.HT &
".type " & Init_Proc & "#, @function" &
ASCII.LF;
Second_Line : constant String :=
ASCII.HT &
".global " & Init_Proc & "#" &
ASCII.LF;
Third_Line : constant String :=
ASCII.HT &
".global LIB$INITIALIZE#" &
ASCII.LF;
Fourth_Line : constant String :=
ASCII.HT &
".section LIB$INITIALIZE#,""a"",@progbits" &
ASCII.LF;
Fifth_Line : constant String :=
ASCII.HT &
"data4 @fptr(" & Init_Proc & "#)" &
ASCII.LF;
begin
Macro_File := Create_File (Macro_File_Name, Text);
OK := Macro_File /= Invalid_FD;
if OK then
Len := Write
(Macro_File, First_Line (First_Line'First)'Address,
First_Line'Length);
OK := Len = First_Line'Length;
end if;
if OK then
Len := Write
(Macro_File, Second_Line (Second_Line'First)'Address,
Second_Line'Length);
OK := Len = Second_Line'Length;
end if;
if OK then
Len := Write
(Macro_File, Third_Line (Third_Line'First)'Address,
Third_Line'Length);
OK := Len = Third_Line'Length;
end if;
if OK then
Len := Write
(Macro_File, Fourth_Line (Fourth_Line'First)'Address,
Fourth_Line'Length);
OK := Len = Fourth_Line'Length;
end if;
if OK then
Len := Write
(Macro_File, Fifth_Line (Fifth_Line'First)'Address,
Fifth_Line'Length);
OK := Len = Fifth_Line'Length;
end if;
if OK then
Close (Macro_File, OK);
end if;
if not OK then
Fail ("creation of auto-init assembly file """,
Macro_File_Name, """ failed");
end if;
end;
-- Invoke the macro-assembler
if Verbose_Mode then
Write_Str ("Assembling auto-init assembly file """);
Write_Str (Macro_File_Name);
Write_Line ("""");
end if;
Popen_Result := popen (command (command'First)'Address,
mode (mode'First)'Address);
if Popen_Result = Null_Address then
Fail ("assembly of auto-init assembly file """,
Macro_File_Name, """ failed");
end if;
-- Wait for the end of execution of the macro-assembler
Pclose_Result := pclose (Popen_Result);
if Pclose_Result < 0 then
Fail ("assembly of auto init assembly file """,
Macro_File_Name, """ failed");
end if;
-- Add the generated object file to the list of objects to be
-- included in the library.
Additional_Objects :=
new Argument_List'
(1 => new String'(Lib_Filename & "__init.obj"));
end;
end if;
-- Allocate the argument list and put the symbol file name, the
-- reference (if any) and the policy (if not autonomous).
Arguments := new Argument_List (1 .. Ofiles'Length + 8);
Last_Argument := 0;
-- Verbosity
if Verbose_Mode then
Last_Argument := Last_Argument + 1;
Arguments (Last_Argument) := new String'("-v");
end if;
-- Version number (major ID)
if Lib_Version /= "" then
Last_Argument := Last_Argument + 1;
Arguments (Last_Argument) := new String'("-V");
Last_Argument := Last_Argument + 1;
Arguments (Last_Argument) := new String'(Version);
end if;
-- Symbol file
Last_Argument := Last_Argument + 1;
Arguments (Last_Argument) := new String'("-s");
Last_Argument := Last_Argument + 1;
Arguments (Last_Argument) := new String'(Opt_File_Name);
-- Reference Symbol File
if Symbol_Data.Reference /= No_Name then
Last_Argument := Last_Argument + 1;
Arguments (Last_Argument) := new String'("-r");
Last_Argument := Last_Argument + 1;
Arguments (Last_Argument) :=
new String'(Get_Name_String (Symbol_Data.Reference));
end if;
-- Policy
case Symbol_Data.Symbol_Policy is
when Autonomous =>
null;
when Compliant =>
Last_Argument := Last_Argument + 1;
Arguments (Last_Argument) := new String'("-c");
when Controlled =>
Last_Argument := Last_Argument + 1;
Arguments (Last_Argument) := new String'("-C");
when Restricted =>
Last_Argument := Last_Argument + 1;
Arguments (Last_Argument) := new String'("-R");
end case;
-- Add each relevant object file
for Index in Ofiles'Range loop
if Is_Interface (Ofiles (Index).all) then
Last_Argument := Last_Argument + 1;
Arguments (Last_Argument) := new String'(Ofiles (Index).all);
end if;
end loop;
-- Spawn gnatsym
Spawn (Program_Name => Gnatsym_Path.all,
Args => Arguments (1 .. Last_Argument),
Success => Success);
if not Success then
Fail ("unable to create symbol file for library """,
Lib_Filename, """");
end if;
Free (Arguments);
-- Move all the -l switches from Opts to Opts2
declare
Index : Natural := Opts'First;
Opt : String_Access;
begin
while Index <= Last_Opt loop
Opt := Opts (Index);
if Opt'Length > 2 and then
Opt (Opt'First .. Opt'First + 1) = "-l"
then
if Index < Last_Opt then
Opts (Index .. Last_Opt - 1) :=
Opts (Index + 1 .. Last_Opt);
end if;
Last_Opt := Last_Opt - 1;
Last_Opt2 := Last_Opt2 + 1;
Opts2 (Last_Opt2) := Opt;
else
Index := Index + 1;
end if;
end loop;
end;
-- Invoke gcc to build the library
Utl.Gcc
(Output_File => Lib_File,
Objects => Ofiles & Additional_Objects.all,
Options => VMS_Options,
Options_2 => Link_With_Shared_Libgcc.all &
Opts (Opts'First .. Last_Opt) &
Opts2 (Opts2'First .. Last_Opt2) & Options_2,
Driver_Name => Driver_Name);
-- The auto-init object file need to be deleted, so that it will not
-- be included in the library as a regular object file, otherwise
-- it will be included twice when the library will be built next
-- time, which may lead to errors.
if Auto_Init then
declare
Auto_Init_Object_File_Name : constant String :=
Lib_Filename & "__init.obj";
Disregard : Boolean;
begin
if Verbose_Mode then
Write_Str ("deleting auto-init object file """);
Write_Str (Auto_Init_Object_File_Name);
Write_Line ("""");
end if;
Delete_File (Auto_Init_Object_File_Name, Success => Disregard);
end;
end if;
end Build_Dynamic_Library;
-------------
-- DLL_Ext --
-------------
function DLL_Ext return String is
begin
return "exe";
end DLL_Ext;
----------------
-- DLL_Prefix --
----------------
function DLL_Prefix return String is
begin
return "lib";
end DLL_Prefix;
--------------------
-- Dynamic_Option --
--------------------
function Dynamic_Option return String is
begin
return "-shared";
end Dynamic_Option;
-------------------
-- Is_Object_Ext --
-------------------
function Is_Object_Ext (Ext : String) return Boolean is
begin
return Ext = ".obj";
end Is_Object_Ext;
--------------
-- Is_C_Ext --
--------------
function Is_C_Ext (Ext : String) return Boolean is
begin
return Ext = ".c";
end Is_C_Ext;
--------------------
-- Is_Archive_Ext --
--------------------
function Is_Archive_Ext (Ext : String) return Boolean is
begin
return Ext = ".olb" or else Ext = ".exe";
end Is_Archive_Ext;
-------------
-- Libgnat --
-------------
function Libgnat return String is
Libgnat_A : constant String := "libgnat.a";
Libgnat_Olb : constant String := "libgnat.olb";
begin
Name_Len := Libgnat_A'Length;
Name_Buffer (1 .. Name_Len) := Libgnat_A;
if Osint.Find_File (Name_Enter, Osint.Library) /= No_File then
return Libgnat_A;
else
return Libgnat_Olb;
end if;
end Libgnat;
------------------------
-- Library_Exists_For --
------------------------
function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
is
begin
if not In_Tree.Projects.Table (Project).Library then
Fail ("INTERNAL ERROR: Library_Exists_For called " &
"for non library project");
return False;
else
declare
Lib_Dir : constant String :=
Get_Name_String
(In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String :=
Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name);
begin
if In_Tree.Projects.Table (Project).Library_Kind =
Static
then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, Archive_Ext));
else
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, DLL_Ext));
end if;
end;
end if;
end Library_Exists_For;
---------------------------
-- Library_File_Name_For --
---------------------------
function Library_File_Name_For
(Project : Project_Id;
In_Tree : Project_Tree_Ref) return Name_Id
is
begin
if not In_Tree.Projects.Table (Project).Library then
Prj.Com.Fail ("INTERNAL ERROR: Library_File_Name_For called " &
"for non library project");
return No_Name;
else
declare
Lib_Name : constant String :=
Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name);
begin
Name_Len := 3;
Name_Buffer (1 .. Name_Len) := "lib";
if In_Tree.Projects.Table (Project).Library_Kind =
Static then
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
else
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
end if;
return Name_Find;
end;
end if;
end Library_File_Name_For;
----------------
-- Object_Ext --
----------------
function Object_Ext return String is
begin
return "obj";
end Object_Ext;
----------------
-- PIC_Option --
----------------
function PIC_Option return String is
begin
return "";
end PIC_Option;
-----------------------------------------------
-- Standalone_Library_Auto_Init_Is_Supported --
-----------------------------------------------
function Standalone_Library_Auto_Init_Is_Supported return Boolean is
begin
return True;
end Standalone_Library_Auto_Init_Is_Supported;
---------------------------
-- Support_For_Libraries --
---------------------------
function Support_For_Libraries return Library_Support is
begin
return Full;
end Support_For_Libraries;
end MLib.Tgt;
|
datetime/datetime.g4 | ChristianWulf/grammars-v4 | 127 | 133 | <reponame>ChristianWulf/grammars-v4
/*
BSD License
Copyright (c) 2013, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of <NAME> 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.
*/
grammar datetime;
date_time
: (day ',')? date time
;
day
: 'Mon'
| 'Tue'
| 'Wed'
| 'Thu'
| 'Fri'
| 'Sat'
| 'Sun'
;
date
: two_digit + month two_digit
;
month
: 'Jan'
| 'Feb'
| 'Mar'
| 'Apr'
| 'May'
| 'Jun'
| 'Jul'
| 'Aug'
| 'Sep'
| 'Oct'
| 'Nov'
| 'Dec'
;
time
: hour zone
;
hour
: two_digit ':' two_digit (':' two_digit)?
;
zone
: 'UT'
| 'GMT'
| 'EST'
| 'EDT'
| 'CST'
| 'CDT'
| 'MST'
| 'MDT'
| 'PST'
| 'PDT'
| ALPHA
| (('+' | '-') four_digit)
;
two_digit
: alphanumeric alphanumeric
;
four_digit
: alphanumeric alphanumeric alphanumeric alphanumeric
;
alphanumeric
: ALPHA
| DIGIT
;
fragment CHAR
: [\u0000-\u007F]
;
ALPHA
: [a-zA-Z]
;
DIGIT
: [0-9]
;
fragment NOTALPHANUMERIC
: ~ [a-zA-Z0-9]
;
WS
: [ \r\n\t] -> skip
;
|
validation-vsd_orders.adb | annexi-strayline/AURA | 13 | 19822 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- Command Line Interface --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME> (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Assertions;
with Ada.Strings.Fixed;
with Ada.Strings.Unbounded;
with Unit_Names.Sets;
with Workers.Reporting;
separate (Validation)
package body VSD_Orders is
package UBS renames Ada.Strings.Unbounded;
New_Line: Character renames Workers.Reporting.New_Line;
-----------
-- Image --
-----------
function Image (Order: Validate_Subsystem_Dependencies_Order)
return String
is
Image_String: Bounded_String := UBS.To_Unbounded_String
( "[Validate_Subsystem_Dependencies_Order] (Validation)" & New_Line
& "Subsystems to be checked:");
procedure Append (Source : in out UBS.Unbounded_String := Image_String;
New_Item: in String)
renames UBS.Append;
begin
for SS of Order.Check_Subset loop
Append (New_Line & "- " & SS.Name.To_UTF8_String);
end loop;
return UBS.To_String (Image_String);
end Image;
-------------
-- Execute --
-------------
procedure Execute (Order: in out Validate_Subsystem_Dependencies_Order) is
use Repositories;
use Registrar.Subsystems;
Dependencies: constant Subsystem_Sets.Set
:= Registrar.Queries.Subsystem_Dependencies (Order.Target);
Failed_Set: Subsystem_Sets.Set;
procedure Fail is
Fail_Message: UBS.Bounded_String := UBS.To_Unbounded_String
( "Subsystem """ & Order.Target.Name.To_UTF8_String & """ "
& " was checked out from a " & New_Line
& " System Repository (Repository"
& Repository_Index'Image (Order.Target.Source_Repository)
& "). Subsystems checked-out from System Repositories"
& New_Line
& "must only depend on other subsystems from the same repository."
& New_Line
& "The offending dependencies, and their repository index, "
& "are as follows: ");
procedure Append (Source : in out UBS.Unbounded_String := Fail_Message;
New_Item: in String)
renames UBS.Append;
function Trim (Souce: in Sting;
Side : in Ada.Strings.Trim_End := Ada.Strings.Both)
return String
renames Ada.Strings.Fixed.Trim;
begin
for SS of Failed_Set loop
Append (SS.Name.To_UTF8_String
& " ("
& Trim (Repository_Index'Image (SS.Source_Repository))
& ')' & New_Line);
end loop;
raise Ada.Assertions.Assertion_Error with
UBS.To_String (Fail_Message);
end Fail;
begin
for SS of Dependencies loop
if SS.Source_Repository /= Order.Target.Source_Repository then
Failed_Set.Insert (SS);
end if;
end loop;
if not Failed_Set.Is_Empty then Fail; end if;
end Execute;
end VSD_Orders;
|
go/interface-internal/main.asm | so61pi/examples | 4 | 172466 | <reponame>so61pi/examples<gh_stars>1-10
__go_td_I19_AnotherLongFunctionFe20_VeryLongFunctionNameFee$gc:
.quad 16
.quad 9
.quad 0
.quad 0
.LC0:
.ascii "\tmain\tmain.XInterface"
.zero 1
C0:
.quad .LC0
.quad 21
.LC1:
.ascii "XInterface"
.zero 1
C1:
.quad .LC1
.quad 10
.LC2:
.ascii "main"
.zero 1
C2:
.quad .LC2
.quad 4
C3:
C4:
.quad C1
.quad C2
.quad C3
.quad 0
.quad 0
__go_tdn_main.XInterface$gc:
.quad 16
.quad 9
.quad 0
.quad 0
__go_td_pN15_main.XInterface$gc:
.quad 8
.quad 1
.quad 0
.quad __go_tdn_main.XInterface$gc
.quad 0
.LC3:
.ascii "*\tmain\tmain.XInterface"
.zero 1
C5:
.quad .LC3
.quad 22
__go_td_pN15_main.XInterface:
.byte 54
.byte 8
.byte 8
.zero 5
.quad 8
.long -634905927
.zero 4
.quad runtime.memhash64$descriptor
.quad runtime.memequal64$descriptor
.quad __go_td_pN15_main.XInterface$gc
.quad C5
.quad 0
.quad 0
.quad __go_tdn_main.XInterface
.LC4:
.ascii "AnotherLongFunction"
.zero 1
C6:
.quad .LC4
.quad 19
__go_td_Fe$gc:
.quad 8
.quad 2
.quad 0
.quad 0
.LC5:
.ascii "func()"
.zero 1
C7:
.quad .LC5
.quad 6
C8:
C9:
__go_td_Fe:
.byte 19
.byte 8
.byte 8
.zero 5
.quad 8
.long 8
.zero 4
.quad 0
.quad 0
.quad __go_td_Fe$gc
.quad C7
.quad 0
.quad 0
.byte 0
.zero 7
.quad C8
.quad 0
.quad 0
.quad C9
.quad 0
.quad 0
.LC6:
.ascii "VeryLongFunctionName"
.zero 1
C10:
.quad .LC6
.quad 20
C11:
.quad C6
.quad 0
.quad __go_td_Fe
.quad C10
.quad 0
.quad __go_td_Fe
__go_tdn_main.XInterface:
.byte 20
.byte 8
.byte 8
.zero 5
.quad 16
.long -39681621
.zero 4
.quad runtime.interhash$descriptor
.quad runtime.interequal$descriptor
.quad __go_td_I19_AnotherLongFunctionFe20_VeryLongFunctionNameFee$gc
.quad C0
.quad C4
.quad __go_td_pN15_main.XInterface
.quad C11
.quad 2
.quad 2
__go_td_S7_.main.aN3_int7_.main.bS7_.main.cN3_intee$gc:
.quad 16
.quad 0
.LC7:
.ascii "\tmain\tmain.Test"
.zero 1
C12:
.quad .LC7
.quad 15
.LC8:
.ascii "Test"
.zero 1
C13:
.quad .LC8
.quad 4
C14:
.quad .LC2
.quad 4
C15:
.quad .LC4
.quad 19
__go_td_FpN9_main.Testee$gc:
.quad 8
.quad 2
.quad 0
.quad 0
.LC9:
.ascii "func(\tmain\tmain.Test)"
.zero 1
C16:
.quad .LC9
.quad 21
C17:
.quad __go_tdn_main.Test
C18:
__go_td_FpN9_main.Testee:
.byte 19
.byte 8
.byte 8
.zero 5
.quad 8
.long 949002824
.zero 4
.quad 0
.quad 0
.quad __go_td_FpN9_main.Testee$gc
.quad C16
.quad 0
.quad 0
.byte 0
.zero 7
.quad C17
.quad 1
.quad 1
.quad C18
.quad 0
.quad 0
C19:
.quad .LC6
.quad 20
C20:
.quad C15
.quad 0
.quad __go_td_Fe
.quad __go_td_FpN9_main.Testee
.quad main.AnotherLongFunction.N9_main.Test
.quad C19
.quad 0
.quad __go_td_Fe
.quad __go_td_FpN9_main.Testee
.quad main.VeryLongFunctionName.N9_main.Test
C21:
.quad C13
.quad C14
.quad C20
.quad 2
.quad 2
__go_td_pN9_main.Test$gc:
.quad 8
.quad 2
.quad 0
.quad 0
.LC10:
.ascii "*\tmain\tmain.Test"
.zero 1
C22:
.quad .LC10
.quad 16
C23:
.quad .LC4
.quad 19
__go_td_FppN9_main.Testee$gc:
.quad 8
.quad 2
.quad 0
.quad 0
.LC11:
.ascii "func(*\tmain\tmain.Test)"
.zero 1
C24:
.quad .LC11
.quad 22
C25:
.quad __go_td_pN9_main.Test
C26:
__go_td_FppN9_main.Testee:
.byte 19
.byte 8
.byte 8
.zero 5
.quad 8
.long -1995823832
.zero 4
.quad 0
.quad 0
.quad __go_td_FppN9_main.Testee$gc
.quad C24
.quad 0
.quad 0
.byte 0
.zero 7
.quad C25
.quad 1
.quad 1
.quad C26
.quad 0
.quad 0
C27:
.quad .LC6
.quad 20
C28:
.quad C23
.quad 0
.quad __go_td_Fe
.quad __go_td_FppN9_main.Testee
.quad main.AnotherLongFunction.N9_main.Test
.quad C27
.quad 0
.quad __go_td_Fe
.quad __go_td_FppN9_main.Testee
.quad main.VeryLongFunctionName.N9_main.Test
C29:
.quad 0
.quad 0
.quad C28
.quad 2
.quad 2
__go_td_ppN9_main.Test$gc:
.quad 8
.quad 1
.quad 0
.quad __go_td_pN9_main.Test$gc
.quad 0
.LC12:
.ascii "**\tmain\tmain.Test"
.zero 1
C30:
.quad .LC12
.quad 17
__go_td_ppN9_main.Test:
.byte 54
.byte 8
.byte 8
.zero 5
.quad 8
.long -997911911
.zero 4
.quad runtime.memhash64$descriptor
.quad runtime.memequal64$descriptor
.quad __go_td_ppN9_main.Test$gc
.quad C30
.quad 0
.quad 0
.quad __go_td_pN9_main.Test
__go_td_pN9_main.Test:
.byte 54
.byte 8
.byte 8
.zero 5
.quad 8
.long -1672982231
.zero 4
.quad runtime.memhash64$descriptor
.quad runtime.memequal64$descriptor
.quad __go_td_pN9_main.Test$gc
.quad C22
.quad C29
.quad __go_td_ppN9_main.Test
.quad __go_tdn_main.Test
.LC13:
.ascii "a"
.zero 1
C31:
.quad .LC13
.quad 1
C32:
.quad .LC2
.quad 4
__go_td_i64e$gc:
.quad 8
.quad 0
.LC14:
.ascii "int"
.zero 1
C33:
.quad .LC14
.quad 3
C34:
.quad .LC14
.quad 3
C35:
C36:
.quad C34
.quad 0
.quad C35
.quad 0
.quad 0
__go_td_pN3_int$gc:
.quad 8
.quad 2
.quad 0
.quad 0
.LC15:
.ascii "*int"
.zero 1
C37:
.quad .LC15
.quad 4
__go_td_pN3_int:
.byte 54
.byte 8
.byte 8
.zero 5
.quad 8
.long 1142362665
.zero 4
.quad runtime.memhash64$descriptor
.quad runtime.memequal64$descriptor
.quad __go_td_pN3_int$gc
.quad C37
.quad 0
.quad 0
.quad __go_tdn_int
__go_tdn_int:
.byte -126
.byte 8
.byte 8
.zero 5
.quad 8
.long 876704034
.zero 4
.quad runtime.memhash64$descriptor
.quad runtime.memequal64$descriptor
.quad __go_td_i64e$gc
.quad C33
.quad C36
.quad __go_td_pN3_int
.LC16:
.ascii "b"
.zero 1
C38:
.quad .LC16
.quad 1
C39:
.quad .LC2
.quad 4
__go_td_S7_.main.cN3_inte$gc:
.quad 8
.quad 0
.LC17:
.ascii "struct { c int }"
.zero 1
C40:
.quad .LC17
.quad 16
.LC18:
.ascii "c"
.zero 1
C41:
.quad .LC18
.quad 1
C42:
.quad .LC2
.quad 4
C43:
.quad C41
.quad C42
.quad __go_tdn_int
.quad 0
.quad 0
__go_td_S7_.main.cN3_inte:
.byte -103
.byte 8
.byte 8
.zero 5
.quad 8
.long -788151148
.zero 4
.quad runtime.memhash64$descriptor
.quad runtime.memequal64$descriptor
.quad __go_td_S7_.main.cN3_inte$gc
.quad C40
.quad 0
.quad 0
.quad C43
.quad 1
.quad 1
C44:
.quad C31
.quad C32
.quad __go_tdn_int
.quad 0
.quad 0
.quad C38
.quad C39
.quad __go_td_S7_.main.cN3_inte
.quad 0
.quad 8
__go_tdn_main.Test:
.byte -103
.byte 8
.byte 8
.zero 5
.quad 16
.long 432309522
.zero 4
.quad runtime.memhash128$descriptor
.quad runtime.memequal128$descriptor
.quad __go_td_S7_.main.aN3_int7_.main.bS7_.main.cN3_intee$gc
.quad C12
.quad C21
.quad __go_td_pN9_main.Test
.quad C44
.quad 2
.quad 2
__go_tdn_main.Test$gc:
.quad 16
.quad 0
main.Wrap$hash$descriptor:
.quad main.Wrap$hash
main.Wrap$equal$descriptor:
.quad main.Wrap$equal
__go_td_S7_.main.xN3_int7_.main.yIe7_.main.zN15_main.XInterfacee$gc:
.quad 40
.quad 8
.quad 8
.quad 9
.quad 24
.quad 0
.LC19:
.ascii "\tmain\tmain.Wrap"
.zero 1
C45:
.quad .LC19
.quad 15
.LC20:
.ascii "Wrap"
.zero 1
C46:
.quad .LC20
.quad 4
C47:
.quad .LC2
.quad 4
C48:
C49:
.quad C46
.quad C47
.quad C48
.quad 0
.quad 0
__go_tdn_main.Wrap$gc:
.quad 40
.quad 8
.quad 8
.quad 9
.quad 24
.quad 0
__go_td_pN9_main.Wrap$gc:
.quad 8
.quad 1
.quad 0
.quad __go_tdn_main.Wrap$gc
.quad 0
.LC21:
.ascii "*\tmain\tmain.Wrap"
.zero 1
C50:
.quad .LC21
.quad 16
__go_td_pN9_main.Wrap:
.byte 54
.byte 8
.byte 8
.zero 5
.quad 8
.long 1633990697
.zero 4
.quad runtime.memhash64$descriptor
.quad runtime.memequal64$descriptor
.quad __go_td_pN9_main.Wrap$gc
.quad C50
.quad 0
.quad 0
.quad __go_tdn_main.Wrap
.LC22:
.ascii "x"
.zero 1
C51:
.quad .LC22
.quad 1
C52:
.quad .LC2
.quad 4
.LC23:
.ascii "y"
.zero 1
C53:
.quad .LC23
.quad 1
C54:
.quad .LC2
.quad 4
__go_td_Ie$gc:
.quad 16
.quad 8
.quad 0
.quad 0
.LC24:
.ascii "interface {}"
.zero 1
C55:
.quad .LC24
.quad 12
C56:
__go_td_Ie:
.byte 20
.byte 8
.byte 8
.zero 5
.quad 16
.long 16
.zero 4
.quad runtime.nilinterhash$descriptor
.quad runtime.nilinterequal$descriptor
.quad __go_td_Ie$gc
.quad C55
.quad 0
.quad 0
.quad C56
.quad 0
.quad 0
.LC25:
.ascii "z"
.zero 1
C57:
.quad .LC25
.quad 1
C58:
.quad .LC2
.quad 4
C59:
.quad C51
.quad C52
.quad __go_tdn_int
.quad 0
.quad 0
.quad C53
.quad C54
.quad __go_td_Ie
.quad 0
.quad 8
.quad C57
.quad C58
.quad __go_tdn_main.XInterface
.quad 0
.quad 24
__go_tdn_main.Wrap:
.byte 25
.byte 8
.byte 8
.zero 5
.quad 40
.long -1240052862
.zero 4
.quad main.Wrap$hash$descriptor
.quad main.Wrap$equal$descriptor
.quad __go_td_S7_.main.xN3_int7_.main.yIe7_.main.zN15_main.XInterfacee$gc
.quad C45
.quad C49
.quad __go_td_pN9_main.Wrap
.quad C59
.quad 3
.quad 3
__go_imt_I19_AnotherLongFunctionFe20_VeryLongFunctionNameFee__N9_main.Test:
.quad __go_tdn_main.Test
.quad main.AnotherLongFunction.N9_main.Test
.quad main.VeryLongFunctionName.N9_main.Test
__go_pimt__I19_AnotherLongFunctionFe20_VeryLongFunctionNameFee__N9_main.Test:
.quad __go_td_pN9_main.Test
.quad main.AnotherLongFunction.N9_main.Test
.quad main.VeryLongFunctionName.N9_main.Test
main.Call$descriptor:
.quad main.Call
main.CallEmpty$descriptor:
.quad main.CallEmpty
main.AN7_uintptr32e$hash$descriptor:
.quad main.AN7_uintptr32e$hash
main.AN7_uintptr32e$equal$descriptor:
.quad main.AN7_uintptr32e$equal
main.AN6_uint64256e$hash$descriptor:
.quad main.AN6_uint64256e$hash
main.AN6_uint64256e$equal$descriptor:
.quad main.AN6_uint64256e$equal
main.AS4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e61e$hash$descriptor:
.quad main.AS4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e61e$hash
main.AS4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e61e$equal$descriptor:
.quad main.AS4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e61e$equal
main.S4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e$hash$descriptor:
.quad main.S4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e$hash
main.S4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e$equal$descriptor:
.quad main.S4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e$equal
main.VeryLongFunctionName.N9_main.Test:
cmp rsp, QWORD PTR %fs:112
jnb .L2
mov r10d, 8
mov r11d, 0
call __morestack
ret
.L2:
push rbp
mov rbp, rsp
mov QWORD PTR [rbp-24], rdi
mov rax, QWORD PTR [rbp-24]
mov rdx, QWORD PTR [rax+8]
mov rax, QWORD PTR [rax]
mov QWORD PTR [rbp-16], rax
mov QWORD PTR [rbp-8], rdx
pop rbp
ret
main.AnotherLongFunction.N9_main.Test:
cmp rsp, QWORD PTR %fs:112
jnb .L4
mov r10d, 8
mov r11d, 0
call __morestack
ret
.L4:
push rbp
mov rbp, rsp
mov QWORD PTR [rbp-24], rdi
mov rax, QWORD PTR [rbp-24]
mov rdx, QWORD PTR [rax+8]
mov rax, QWORD PTR [rax]
mov QWORD PTR [rbp-16], rax
mov QWORD PTR [rbp-8], rdx
pop rbp
ret
main.main:
cmp rsp, QWORD PTR %fs:112
jnb .L6
mov r10d, 72
mov r11d, 0
call __morestack
ret
.L6:
push rbp
mov rbp, rsp
sub rsp, 64
mov esi, 16
mov edi, OFFSET FLAT:__go_tdn_main.Test
call __go_new
mov QWORD PTR [rax], 0
mov QWORD PTR [rax+8], 0
mov QWORD PTR [rbp-8], rax
mov esi, 40
mov edi, OFFSET FLAT:__go_tdn_main.Wrap
call __go_new
mov QWORD PTR [rax], 0
mov QWORD PTR [rax+8], 0
mov QWORD PTR [rax+16], 0
mov QWORD PTR [rax+24], 0
mov QWORD PTR [rax+32], 0
mov QWORD PTR [rbp-16], rax
mov rax, QWORD PTR [rbp-16]
mov QWORD PTR [rax], 12345678
mov esi, 16
mov edi, OFFSET FLAT:__go_tdn_main.Test
call __go_new
mov QWORD PTR [rbp-40], rax
mov rcx, QWORD PTR [rbp-40]
mov rax, QWORD PTR [rbp-8]
mov rdx, QWORD PTR [rax+8]
mov rax, QWORD PTR [rax]
mov QWORD PTR [rcx], rax
mov QWORD PTR [rcx+8], rdx
mov rdx, QWORD PTR [rbp-40]
mov rax, QWORD PTR [rbp-16]
mov QWORD PTR [rax+8], OFFSET FLAT:__go_tdn_main.Test
mov rax, QWORD PTR [rbp-16]
mov QWORD PTR [rax+16], rdx
mov esi, 16
mov edi, OFFSET FLAT:__go_tdn_main.Test
call __go_new
mov QWORD PTR [rbp-32], rax
mov rcx, QWORD PTR [rbp-32]
mov rax, QWORD PTR [rbp-8]
mov rdx, QWORD PTR [rax+8]
mov rax, QWORD PTR [rax]
mov QWORD PTR [rcx], rax
mov QWORD PTR [rcx+8], rdx
mov rdx, QWORD PTR [rbp-32]
mov rax, QWORD PTR [rbp-16]
mov QWORD PTR [rax+24], OFFSET FLAT:__go_imt_I19_AnotherLongFunctionFe20_VeryLongFunctionNameFee__N9_main.Test
mov rax, QWORD PTR [rbp-16]
mov QWORD PTR [rax+32], rdx
mov rax, QWORD PTR [rbp-16]
mov rdi, rax
call main.Call
mov esi, 40
mov edi, OFFSET FLAT:__go_tdn_main.Wrap
call __go_new
mov QWORD PTR [rax], 0
mov QWORD PTR [rax+8], 0
mov QWORD PTR [rax+16], 0
mov QWORD PTR [rax+24], 0
mov QWORD PTR [rax+32], 0
mov QWORD PTR [rbp-24], rax
mov rax, QWORD PTR [rbp-24]
mov QWORD PTR [rax], 87654321
mov rax, QWORD PTR [rbp-24]
mov QWORD PTR [rax+8], OFFSET FLAT:__go_td_pN9_main.Test
mov rax, QWORD PTR [rbp-24]
mov rdx, QWORD PTR [rbp-8]
mov QWORD PTR [rax+16], rdx
mov rax, QWORD PTR [rbp-24]
mov QWORD PTR [rax+24], OFFSET FLAT:__go_pimt__I19_AnotherLongFunctionFe20_VeryLongFunctionNameFee__N9_main.Test
mov rax, QWORD PTR [rbp-24]
mov rdx, QWORD PTR [rbp-8]
mov QWORD PTR [rax+32], rdx
mov rax, QWORD PTR [rbp-24]
mov rdi, rax
call main.Call
mov rax, QWORD PTR [rbp-16]
mov rdx, QWORD PTR [rax+16]
mov rax, QWORD PTR [rax+8]
mov QWORD PTR [rbp-64], rax
mov QWORD PTR [rbp-56], rdx
mov rdx, QWORD PTR [rbp-64]
mov rax, QWORD PTR [rbp-56]
mov rdi, rdx
mov rsi, rax
call main.CallEmpty
leave
ret
main.Call:
cmp rsp, QWORD PTR %fs:112
jnb .L11
mov r10d, 152
mov r11d, 0
call __morestack
ret
.L11:
push rbp
mov rbp, rsp
sub rsp, 144
mov QWORD PTR [rbp-136], rdi
mov QWORD PTR [rbp-128], 0
mov QWORD PTR [rbp-120], 0
mov BYTE PTR [rbp-1], 0
lea rdi, [rbp-64]
mov rax, QWORD PTR [rbp-136]
mov rdx, QWORD PTR [rax+16]
mov rax, QWORD PTR [rax+8]
mov rcx, rdx
mov rdx, rax
mov esi, OFFSET FLAT:__go_tdn_main.XInterface
call runtime.ifaceE2I2
mov rax, QWORD PTR [rbp-64]
mov rdx, QWORD PTR [rbp-56]
mov QWORD PTR [rbp-112], rax
mov QWORD PTR [rbp-104], rdx
mov rax, QWORD PTR [rbp-48]
mov QWORD PTR [rbp-96], rax
movzx ecx, BYTE PTR [rbp-96]
mov rax, QWORD PTR [rbp-112]
mov rdx, QWORD PTR [rbp-104]
mov QWORD PTR [rbp-128], rax
mov QWORD PTR [rbp-120], rdx
mov BYTE PTR [rbp-1], cl
cmp BYTE PTR [rbp-1], 0
je .L8
mov rax, QWORD PTR [rbp-128]
mov rax, QWORD PTR [rax+16]
mov rdx, QWORD PTR [rbp-120]
mov rdi, rdx
call rax
.L8:
mov esi, 16
mov edi, OFFSET FLAT:__go_tdn_main.Test
call __go_new
mov QWORD PTR [rbp-16], rax
mov BYTE PTR [rbp-17], 0
lea rcx, [rbp-80]
mov rax, QWORD PTR [rbp-136]
mov rdx, QWORD PTR [rax+8]
mov rax, QWORD PTR [rax+16]
mov rsi, rdx
mov rdx, rax
mov edi, OFFSET FLAT:__go_tdn_main.Test
call runtime.ifaceE2T2
mov BYTE PTR [rbp-17], al
mov rcx, QWORD PTR [rbp-16]
mov rax, QWORD PTR [rbp-80]
mov rdx, QWORD PTR [rbp-72]
mov QWORD PTR [rcx], rax
mov QWORD PTR [rcx+8], rdx
cmp BYTE PTR [rbp-17], 0
je .L9
mov rax, QWORD PTR [rbp-16]
mov rdi, rax
call main.VeryLongFunctionName.N9_main.Test
.L9:
mov QWORD PTR [rbp-32], 0
mov rax, QWORD PTR [rbp-136]
mov rdx, QWORD PTR [rax+8]
mov rax, QWORD PTR [rax+16]
mov rsi, rdx
mov rdx, rax
mov edi, OFFSET FLAT:__go_td_pN9_main.Test
call runtime.ifaceE2T2P
mov ecx, edx
mov QWORD PTR [rbp-32], rax
mov BYTE PTR [rbp-17], cl
cmp BYTE PTR [rbp-17], 0
je .L7
mov rax, QWORD PTR [rbp-32]
mov rdi, rax
call main.VeryLongFunctionName.N9_main.Test
.L7:
leave
ret
main.CallEmpty:
cmp rsp, QWORD PTR %fs:112
jnb .L13
mov r10d, 8
mov r11d, 0
call __morestack
ret
.L13:
push rbp
mov rbp, rsp
mov rax, rdi
mov rcx, rsi
mov rdx, rcx
mov QWORD PTR [rbp-16], rax
mov QWORD PTR [rbp-8], rdx
pop rbp
ret
main.Wrap$hash:
cmp rsp, QWORD PTR %fs:112
jnb .L16
mov r10d, 56
mov r11d, 0
call __morestack
ret
.L16:
push rbp
mov rbp, rsp
push rbx
sub rsp, 40
mov QWORD PTR [rbp-40], rdi
mov QWORD PTR [rbp-48], rsi
mov QWORD PTR [rbp-24], 0
mov rax, QWORD PTR [rbp-48]
mov rbx, QWORD PTR [rbp-40]
mov rdx, rbx
mov rsi, rax
mov rdi, rdx
call runtime.memhash64
mov rdx, rax
lea rax, [rbx+8]
mov rsi, rdx
mov rdi, rax
call runtime.nilinterhash
mov rdx, rax
lea rax, [rbx+24]
mov rsi, rdx
mov rdi, rax
call runtime.interhash
mov QWORD PTR [rbp-24], rax
mov rax, QWORD PTR [rbp-24]
add rsp, 40
pop rbx
pop rbp
ret
main.Wrap$equal:
cmp rsp, QWORD PTR %fs:112
jnb .L22
mov r10d, 56
mov r11d, 0
call __morestack
ret
.L22:
push rbp
mov rbp, rsp
push r12
push rbx
sub rsp, 32
mov QWORD PTR [rbp-40], rdi
mov QWORD PTR [rbp-48], rsi
mov BYTE PTR [rbp-17], 0
mov rbx, QWORD PTR [rbp-40]
mov r12, QWORD PTR [rbp-48]
mov rdx, QWORD PTR [rbx]
mov rax, QWORD PTR [r12]
cmp rdx, rax
je .L18
mov BYTE PTR [rbp-17], 0
movzx eax, BYTE PTR [rbp-17]
jmp .L19
.L18:
mov rax, QWORD PTR [r12+8]
mov rdx, QWORD PTR [r12+16]
mov rdi, QWORD PTR [rbx+8]
mov rsi, QWORD PTR [rbx+16]
mov rcx, rdx
mov rdx, rax
call runtime.efaceeq
xor eax, 1
test al, al
je .L20
mov BYTE PTR [rbp-17], 0
movzx eax, BYTE PTR [rbp-17]
jmp .L19
.L20:
mov rax, QWORD PTR [r12+24]
mov rdx, QWORD PTR [r12+32]
mov rdi, QWORD PTR [rbx+24]
mov rsi, QWORD PTR [rbx+32]
mov rcx, rdx
mov rdx, rax
call runtime.ifaceeq
xor eax, 1
test al, al
je .L21
mov BYTE PTR [rbp-17], 0
movzx eax, BYTE PTR [rbp-17]
jmp .L19
.L21:
mov BYTE PTR [rbp-17], 1
movzx eax, BYTE PTR [rbp-17]
.L19:
add rsp, 32
pop rbx
pop r12
pop rbp
ret
main.AN7_uintptr32e$hash:
cmp rsp, QWORD PTR %fs:112
jnb .L25
mov r10d, 40
mov r11d, 0
call __morestack
ret
.L25:
push rbp
mov rbp, rsp
sub rsp, 32
mov QWORD PTR [rbp-24], rdi
mov QWORD PTR [rbp-32], rsi
mov QWORD PTR [rbp-8], 0
mov rcx, QWORD PTR [rbp-32]
mov rax, QWORD PTR [rbp-24]
mov edx, 256
mov rsi, rcx
mov rdi, rax
call runtime.memhash
mov QWORD PTR [rbp-8], rax
mov rax, QWORD PTR [rbp-8]
leave
ret
main.AN7_uintptr32e$equal:
cmp rsp, QWORD PTR %fs:112
jnb .L28
mov r10d, 40
mov r11d, 0
call __morestack
ret
.L28:
push rbp
mov rbp, rsp
sub rsp, 32
mov QWORD PTR [rbp-24], rdi
mov QWORD PTR [rbp-32], rsi
mov BYTE PTR [rbp-1], 0
mov rcx, QWORD PTR [rbp-32]
mov rax, QWORD PTR [rbp-24]
mov edx, 256
mov rsi, rcx
mov rdi, rax
call runtime.memequal
mov BYTE PTR [rbp-1], al
movzx eax, BYTE PTR [rbp-1]
leave
ret
main.AN6_uint64256e$hash:
cmp rsp, QWORD PTR %fs:112
jnb .L31
mov r10d, 40
mov r11d, 0
call __morestack
ret
.L31:
push rbp
mov rbp, rsp
sub rsp, 32
mov QWORD PTR [rbp-24], rdi
mov QWORD PTR [rbp-32], rsi
mov QWORD PTR [rbp-8], 0
mov rcx, QWORD PTR [rbp-32]
mov rax, QWORD PTR [rbp-24]
mov edx, 2048
mov rsi, rcx
mov rdi, rax
call runtime.memhash
mov QWORD PTR [rbp-8], rax
mov rax, QWORD PTR [rbp-8]
leave
ret
main.AN6_uint64256e$equal:
cmp rsp, QWORD PTR %fs:112
jnb .L34
mov r10d, 40
mov r11d, 0
call __morestack
ret
.L34:
push rbp
mov rbp, rsp
sub rsp, 32
mov QWORD PTR [rbp-24], rdi
mov QWORD PTR [rbp-32], rsi
mov BYTE PTR [rbp-1], 0
mov rcx, QWORD PTR [rbp-32]
mov rax, QWORD PTR [rbp-24]
mov edx, 2048
mov rsi, rcx
mov rdi, rax
call runtime.memequal
mov BYTE PTR [rbp-1], al
movzx eax, BYTE PTR [rbp-1]
leave
ret
main.AS4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e61e$hash:
cmp rsp, QWORD PTR %fs:112
jnb .L42
mov r10d, 72
mov r11d, 0
call __morestack
ret
.L42:
push rbp
mov rbp, rsp
push r13
push r12
push rbx
sub rsp, 40
mov QWORD PTR [rbp-56], rdi
mov QWORD PTR [rbp-64], rsi
mov QWORD PTR [rbp-40], 0
mov rax, QWORD PTR [rbp-64]
mov r12, QWORD PTR [rbp-56]
mov r13d, 61
mov ebx, 0
jmp .L36
.L41:
nop
mov rdx, r12
mov rsi, rax
mov rdi, rdx
call main.S4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e$hash
add rbx, 1
.L36:
cmp rbx, r13
jl .L41
mov QWORD PTR [rbp-40], rax
mov rax, QWORD PTR [rbp-40]
add rsp, 40
pop rbx
pop r12
pop r13
pop rbp
ret
main.AS4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e61e$equal:
cmp rsp, QWORD PTR %fs:112
jnb .L58
mov r10d, 152
mov r11d, 0
call __morestack
ret
.L58:
push rbp
mov rbp, rsp
push r15
push r14
push r13
push r12
push rbx
sub rsp, 104
mov QWORD PTR [rbp-120], rdi
mov QWORD PTR [rbp-128], rsi
mov BYTE PTR [rbp-49], 0
mov r14, QWORD PTR [rbp-120]
mov r15, QWORD PTR [rbp-128]
mov QWORD PTR [rbp-144], 61
mov ebx, 0
jmp .L44
.L57:
nop
cmp rbx, 60
jg .L45
test rbx, rbx
jns .L46
.L45:
mov edi, 1
call __go_runtime_error
jmp .L47
.L46:
mov r12, rbx
.L47:
mov rax, r12
add rax, rax
add rax, r12
sal rax, 3
lea rcx, [r14+rax]
mov rax, QWORD PTR [rcx]
mov rdx, QWORD PTR [rcx+8]
mov QWORD PTR [rbp-112], rax
mov QWORD PTR [rbp-104], rdx
mov rax, QWORD PTR [rcx+16]
mov QWORD PTR [rbp-96], rax
mov eax, DWORD PTR [rbp-112]
mov DWORD PTR [rbp-132], eax
cmp rbx, 60
jg .L48
test rbx, rbx
jns .L49
.L48:
mov edi, 1
call __go_runtime_error
jmp .L50
.L49:
mov r13, rbx
.L50:
mov rax, r13
add rax, rax
add rax, r13
sal rax, 3
lea rcx, [r15+rax]
mov rax, QWORD PTR [rcx]
mov rdx, QWORD PTR [rcx+8]
mov QWORD PTR [rbp-80], rax
mov QWORD PTR [rbp-72], rdx
mov rax, QWORD PTR [rcx+16]
mov QWORD PTR [rbp-64], rax
mov eax, DWORD PTR [rbp-80]
cmp DWORD PTR [rbp-132], eax
jne .L51
mov rdx, QWORD PTR [rbp-104]
mov rax, QWORD PTR [rbp-72]
cmp rdx, rax
jne .L51
mov rdx, QWORD PTR [rbp-96]
mov rax, QWORD PTR [rbp-64]
cmp rdx, rax
je .L52
.L51:
mov BYTE PTR [rbp-49], 0
movzx eax, BYTE PTR [rbp-49]
jmp .L53
.L52:
add rbx, 1
.L44:
cmp rbx, QWORD PTR [rbp-144]
jl .L57
mov BYTE PTR [rbp-49], 1
movzx eax, BYTE PTR [rbp-49]
.L53:
add rsp, 104
pop rbx
pop r12
pop r13
pop r14
pop r15
pop rbp
ret
main.S4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e$hash:
cmp rsp, QWORD PTR %fs:112
jnb .L61
mov r10d, 56
mov r11d, 0
call __morestack
ret
.L61:
push rbp
mov rbp, rsp
push rbx
sub rsp, 40
mov QWORD PTR [rbp-40], rdi
mov QWORD PTR [rbp-48], rsi
mov QWORD PTR [rbp-24], 0
mov rax, QWORD PTR [rbp-48]
mov rbx, QWORD PTR [rbp-40]
mov rdx, rbx
mov rsi, rax
mov rdi, rdx
call runtime.memhash32
mov rdx, rax
lea rax, [rbx+8]
mov rsi, rdx
mov rdi, rax
call runtime.memhash64
mov rdx, rax
lea rax, [rbx+16]
mov rsi, rdx
mov rdi, rax
call runtime.memhash64
mov QWORD PTR [rbp-24], rax
mov rax, QWORD PTR [rbp-24]
add rsp, 40
pop rbx
pop rbp
ret
main.S4_SizeN6_uint327_MallocsN6_uint645_FreesN6_uint64e$equal:
cmp rsp, QWORD PTR %fs:112
jnb .L67
mov r10d, 8
mov r11d, 0
call __morestack
ret
.L67:
push rbp
mov rbp, rsp
mov QWORD PTR [rbp-24], rdi
mov QWORD PTR [rbp-32], rsi
mov BYTE PTR [rbp-1], 0
mov rdx, QWORD PTR [rbp-24]
mov rax, QWORD PTR [rbp-32]
mov esi, DWORD PTR [rdx]
mov ecx, DWORD PTR [rax]
cmp esi, ecx
je .L63
mov BYTE PTR [rbp-1], 0
movzx eax, BYTE PTR [rbp-1]
jmp .L64
.L63:
mov rsi, QWORD PTR [rdx+8]
mov rcx, QWORD PTR [rax+8]
cmp rsi, rcx
je .L65
mov BYTE PTR [rbp-1], 0
movzx eax, BYTE PTR [rbp-1]
jmp .L64
.L65:
mov rdx, QWORD PTR [rdx+16]
mov rax, QWORD PTR [rax+16]
cmp rdx, rax
je .L66
mov BYTE PTR [rbp-1], 0
movzx eax, BYTE PTR [rbp-1]
jmp .L64
.L66:
mov BYTE PTR [rbp-1], 1
movzx eax, BYTE PTR [rbp-1]
.L64:
pop rbp
ret
__go_init_main:
cmp rsp, QWORD PTR %fs:112
jnb .L69
mov r10d, 8
mov r11d, 0
call __morestack
ret
.L69:
push rbp
mov rbp, rsp
call runtime..import
pop rbp
ret
|
src/keystore-passwords.adb | ALPHA-60/ada-keystore | 0 | 10554 | <reponame>ALPHA-60/ada-keystore<filename>src/keystore-passwords.adb
-----------------------------------------------------------------------
-- keystore-passwords -- Password provider
-- 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.
-----------------------------------------------------------------------
package body Keystore.Passwords is
procedure To_Provider (Secret : in Secret_Key;
Process : not null access procedure (P : in out Provider'Class)) is
type Secret_Provider is new Provider with null record;
overriding
procedure Get_Password (From : in Secret_Provider;
Getter : not null access procedure (Password : in Secret_Key));
overriding
procedure Get_Password (From : in Secret_Provider;
Getter : not null access procedure (Password : in Secret_Key)) is
pragma Unreferenced (From);
begin
Getter (Secret);
end Get_Password;
P : Secret_Provider;
begin
Process (P);
end To_Provider;
end Keystore.Passwords;
|
display.applescript | Rolias/applescripts | 1 | 3133 |
tell application "System Preferences"
activate
set the current pane to pane "com.apple.preference.displays"
end tell
tell application "System Events"
tell process "System Preferences"
set frontmost to true
repeat until exists tab group 1 of window "ASUS PB278 (1)"
end repeat
tell tab group 1 of window "ASUS PB278 (1)"
click radio button "Display"
click radio button "Scaled"
select row 2 of table 1 of scroll area 1
end tell
-- Now the layout of the pane is changed - so we get to the same radio buttons a new way
repeat until exists tab group 1 of group 1 of window "ASUS PB278 (1)"
end repeat
tell tab group 1 of group 1 of window "ASUS PB278 (1)"
click radio button "Default for display"
end tell
tell window "ASUS PB278 (1)"
-- get UI elements -- don't forget about using this for exploring names
repeat until exists group 1 of group 1 of toolbar 1
end repeat
tell group 1 of group 1 of toolbar 1
click button 1 -- click the back button
end tell
end tell
end tell
end tell
tell application "System Preferences"
quit
end tell
|
programs/oeis/135/A135231.asm | karttu/loda | 0 | 245972 | <reponame>karttu/loda
; A135231: Row sums of triangle A135230.
; 1,2,4,6,12,22,44,86,172,342,684,1366,2732,5462,10924,21846,43692,87382,174764,349526,699052,1398102,2796204,5592406,11184812,22369622,44739244,89478486,178956972,357913942,715827884,1431655766,2863311532,5726623062,11453246124,22906492246,45812984492,91625968982,183251937964,366503875926,733007751852,1466015503702,2932031007404,5864062014806,11728124029612,23456248059222,46912496118444,93824992236886,187649984473772,375299968947542,750599937895084,1501199875790166,3002399751580332,6004799503160662
mov $2,2
pow $2,$0
div $2,3
lpb $0,1
mul $2,2
add $2,1
div $0,$2
lpe
add $0,$2
mov $1,$0
add $1,1
|
src/grammar/GpslLexer.g4 | morioka22/gpsl | 0 | 4842 | <filename>src/grammar/GpslLexer.g4
lexer grammar GpslLexer;
WS
: [ \t\r\n]
-> skip
;
ADD: '+' ;
SUB: '-' ;
MUL: '*' ;
DIV: '/' ;
CONJ: '&&' ;
AND: '&' ;
EQ: '=' ;
EQEQ: '==' ;
NE: '!=' ;
BE: '>=' ;
LE: '<=' ;
BT: '>' ;
LT: '<' ;
SEMICOLON: ';' ;
COLON: ':' ;
COMMA: ',' ;
DOT: '.' ;
QUOTE: '"' ;
ADD_ASSIGNMENT: '+=' ;
SUB_ASSIGNMENT: '-=' ;
MUL_ASSIGNMENT: '*=' ;
DIV_ASSIGNMENT: '/=' ;
LPAREN: '(' ;
RPAREN: ')' ;
LCURL: '{' ;
RCURL: '}' ;
ARROW: '->' ;
FN: 'fn' ;
FOR: 'for' ;
WHILE: 'while' ;
IF: 'if' ;
ELSE: 'else' ;
LET: 'let' ;
RETURN: 'return' ;
NUM: [1-9] [0-9]* ;
TEXT: QUOTE [a-zA-Z0-9_-]* QUOTE ;
IDENT: [a-zA-Z_]+ ; |
programs/oeis/057/A057721.asm | jmorken/loda | 1 | 176520 | ; A057721: a(n) = n^4 + 3*n^2 + 1.
; 1,5,29,109,305,701,1405,2549,4289,6805,10301,15005,21169,29069,39005,51301,66305,84389,105949,131405,161201,195805,235709,281429,333505,392501,459005,533629,617009,709805,812701,926405,1051649,1189189,1339805,1504301,1683505,1878269,2089469,2318005,2564801,2830805,3116989,3424349,3753905,4106701,4483805,4886309,5315329,5772005,6257501,6773005,7319729,7898909,8511805,9159701,9843905,10565749,11326589,12127805,12970801,13857005,14787869,15764869,16789505,17863301,18987805,20164589,21395249,22681405,24024701,25426805,26889409,28414229,30003005,31657501,33379505,35170829,37033309,38968805,40979201,43066405,45232349,47478989,49808305,52222301,54723005,57312469,59992769,62766005,65634301,68599805,71664689,74831149,78101405,81477701,84962305,88557509,92265629,96089005,100030001,104091005,108274429,112582709,117018305,121583701,126281405,131113949,136083889,141193805,146446301,151844005,157389569,163085669,168935005,174940301,181104305,187429789,193919549,200576405,207403201,214402805,221578109,228932029,236467505,244187501,252095005,260193029,268484609,276972805,285660701,294551405,303648049,312953789,322471805,332205301,342157505,352331669,362731069,373359005,384218801,395313805,406647389,418222949,430043905,442113701,454435805,467013709,479850929,492951005,506317501,519954005,533864129,548051509,562519805,577272701,592313905,607647149,623276189,639204805,655436801,671976005,688826269,705991469,723475505,741282301,759415805,777879989,796678849,815816405,835296701,855123805,875301809,895834829,916727005,937982501,959605505,981600229,1003970909,1026721805,1049857201,1073381405,1097298749,1121613589,1146330305,1171453301,1196987005,1222935869,1249304369,1276097005,1303318301,1330972805,1359065089,1387599749,1416581405,1446014701,1475904305,1506254909,1537071229,1568358005,1600120001,1632362005,1665088829,1698305309,1732016305,1766226701,1800941405,1836165349,1871903489,1908160805,1944942301,1982253005,2020097969,2058482269,2097411005,2136889301,2176922305,2217515189,2258673149,2300401405,2342705201,2385589805,2429060509,2473122629,2517781505,2563042501,2608911005,2655392429,2702492209,2750215805,2798568701,2847556405,2897184449,2947458389,2998383805,3049966301,3102211505,3155125069,3208712669,3262980005,3317932801,3373576805,3429917789,3486961549,3544713905,3603180701,3662367805,3722281109,3782926529,3844310005
pow $0,2
mov $1,$0
add $1,1
pow $1,2
add $1,$0
|
Code/CustomControl/SpreadSheet/SprShtDLL/SprCompile.asm | CherryDT/FbEditMOD | 11 | 179624 | .data
Function db TPE_SUMFUNCTION, 'Sum(',0
db TPE_CNTFUNCTION, 'Cnt(',0
db TPE_AVGFUNCTION, 'Avg(',0
db TPE_MINFUNCTION, 'Min(',0
db TPE_MAXFUNCTION, 'Max(',0
db TPE_VARFUNCTION, 'Var(',0
db TPE_STDFUNCTION, 'Std(',0
db TPE_SQTFUNCTION, 'Sqt(',0
db TPE_SINFUNCTION, 'Sin(',0
db TPE_COSFUNCTION, 'Cos(',0
db TPE_TANFUNCTION, 'Tan(',0
db TPE_RADFUNCTION, 'Rad(',0
db TPE_PIFUNCTION, 'PI()',0
db TPE_IIFFUNCTION, 'IIf(',0
db TPE_ONFUNCTION, 'On(',0
db TPE_ABSFUNCTION, 'Abs(',0
db TPE_SGNFUNCTION, 'Sgn(',0
db TPE_INTFUNCTION, 'Int(',0
db TPE_LOGFUNCTION, 'Log(',0
db TPE_LNFUNCTION, 'Ln(',0
db TPE_EFUNCTION, 'e()',0
db TPE_ASINFUNCTION, 'Asin(',0
db TPE_ACOSFUNCTION, 'Acos(',0
db TPE_ATANFUNCTION, 'Atan(',0
db TPE_GRDFUNCTION, 'Grd(',0
db TPE_RGBFUNCTION, 'Rgb(',0
db TPE_XFUNCTION, 'x()',0
db TPE_CDATEFUNCTION, 'CDate(',0
db TPE_GRPFUNCTION, 'Grp(',0
db TPE_GRPTFUNCTION, 'T(',0
db TPE_GRPXFUNCTION, 'X(',0
db TPE_GRPYFUNCTION, 'Y(',0
db TPE_GRPGXFUNCTION, 'gx(',0
db TPE_GRPFXFUNCTION, 'fx(',0
db 0
.code
IsMath proc uses eax,lpStr:DWORD
mov ecx,lpStr
mov dl,[ecx]
.if dl=='+' || dl=='-' || dl=='*' || dl=='/' || dl=='^' || dl=='(' || dl==')' || dl==':' || dl==',' || dl==0
add ecx,1
xor dh,dh
.else
mov dx,[ecx]
.if dx=='><'
add ecx,2
mov dl,TPE_NOTEQU
xor dh,dh
.elseif dx=='=>'
add ecx,2
mov dl,TPE_GTOREQU
xor dh,dh
.elseif dx=='=<'
add ecx,2
mov dl,TPE_LEOREQU
xor dh,dh
.elseif dl=='>'
add ecx,1
mov dl,TPE_GT
xor dh,dh
.elseif dl=='='
add ecx,1
mov dl,TPE_EQU
xor dh,dh
.elseif dl=='<'
add ecx,1
mov dl,TPE_LE
xor dh,dh
.else
mov edx,[ecx]
mov al,[ecx+4]
and edx,5F5F5FFFh
.if edx=='DNA ' && al==' '
add ecx,5
mov dl,TPE_AND
xor dh,dh
.elseif edx=='ROX ' && al==' '
add ecx,5
mov dl,TPE_XOR
xor dh,dh
.else
mov edx,[ecx]
and edx,0FF5F5FFFh
.if edx==' RO '
add ecx,4
mov dl,TPE_OR
xor dh,dh
.else
xor dh,dh
inc dh
.endif
.endif
.endif
.endif
ret
IsMath endp
IsDate proc uses ebx esi edi,lpSheet:DWORD,lpStr:DWORD
LOCAL stime:SYSTEMTIME
LOCAL ftime:FILETIME
LOCAL buffer[32]:BYTE
LOCAL val1:DWORD
LOCAL val2:DWORD
LOCAL val3:DWORD
LOCAL sep[32]:BYTE
mov ebx,lpSheet
lea ecx,[ebx].SHEET.szDateFormat
lea edx,sep
xor eax,eax
.while byte ptr [ecx]
mov al,[ecx]
.if al!='d' && al!='M' && al!='y'
mov [edx],ax
inc edx
.endif
inc ecx
.endw
mov esi,lpStr
mov dl,[esi]
.if dl>='0' && dl<='9'
invoke lstrcpyn,addr buffer,lpStr,sizeof buffer
lea esi,buffer
xor ecx,ecx
xor edx,edx
.while byte ptr [esi+ecx]
mov al,[esi+ecx]
.if al<'0' || al>'9'
.if al!=sep[edx]
jmp NotDate
.endif
inc edx
mov byte ptr [esi+ecx],0
.endif
inc ecx
.endw
.if edx==2
invoke AsciiToDw,esi
mov val1,eax
invoke StrLen,esi
lea esi,[esi+eax+1]
invoke AsciiToDw,esi
mov val2,eax
invoke StrLen,esi
lea esi,[esi+eax+1]
invoke AsciiToDw,esi
mov val3,eax
.else
jmp NotDate
.endif
lea ecx,[ebx].SHEET.szDateFormat
mov edx,dword ptr [ecx]
mov eax,val1
.if dx=='dd'
mov stime.wDay,ax
add ecx,3
.elseif dx=='MM'
mov stime.wMonth,ax
add ecx,3
.elseif edx=='yyyy'
.if eax<30
add eax,2000
.elseif eax<100
add eax,1900
.endif
mov stime.wYear,ax
add ecx,5
.elseif dx=='yy'
.if eax<30
add eax,2000
.elseif eax<100
add eax,1900
.endif
mov stime.wYear,ax
add ecx,3
.else
jmp NotDate
.endif
mov edx,dword ptr [ecx]
mov eax,val2
.if dx=='dd'
mov stime.wDay,ax
add ecx,3
.elseif dx=='MM'
mov stime.wMonth,ax
add ecx,3
.elseif edx=='yyyy'
.if eax<30
add eax,2000
.elseif eax<100
add eax,1900
.endif
mov stime.wYear,ax
add ecx,5
.elseif dx=='yy'
.if eax<30
add eax,2000
.elseif eax<100
add eax,1900
.endif
mov stime.wYear,ax
add ecx,3
.else
jmp NotDate
.endif
mov edx,dword ptr [ecx]
mov eax,val3
.if dx=='dd'
mov stime.wDay,ax
add ecx,3
.elseif dx=='MM'
mov stime.wMonth,ax
add ecx,3
.elseif edx=='yyyy'
.if eax<30
add eax,2000
.elseif eax<100
add eax,1900
.endif
mov stime.wYear,ax
add ecx,5
.elseif dx=='yy'
.if eax<30
add eax,2000
.elseif eax<100
add eax,1900
.endif
mov stime.wYear,ax
add ecx,3
.else
jmp NotDate
.endif
xor eax,eax
mov stime.wDayOfWeek,ax
mov stime.wHour,ax
mov stime.wMinute,ax
mov stime.wSecond,ax
mov stime.wMilliseconds,ax
invoke SystemTimeToFileTime,addr stime,addr ftime
or eax,eax
je NotDate
;Convert to days since 01.01.1601
mov ecx,10*1000*1000
mov eax,ftime.dwHighDateTime
xor edx,edx
div ecx
mov ftime.dwHighDateTime,eax
mov eax,ftime.dwLowDateTime
div ecx
mov ftime.dwLowDateTime,eax
mov ecx,24*60*60
mov edx,ftime.dwHighDateTime
mov eax,ftime.dwLowDateTime
div ecx
xor dh,dh
ret
.endif
NotDate:
mov ecx,lpStr
mov dl,[ecx]
xor dh,dh
inc dh
ret
IsDate endp
IsInteger proc lpStr:DWORD
mov ecx,lpStr
mov dl,[ecx]
.if dl=='-' || (dl>='0' && dl<='9')
invoke AsciiToDw,ecx
jc NotInt
push ecx
invoke IsMath,ecx
pop ecx
jne NotInt
xor dh,dh
ret
.endif
NotInt:
mov ecx,lpStr
mov dl,[ecx]
xor dh,dh
inc dh
ret
IsInteger endp
IsFloat proc lpStr:DWORD
mov ecx,lpStr
mov dl,[ecx]
.if dl=='-' || (dl>='0' && dl<='9')
invoke AsciiToFp,ecx,offset acmltr0
jc NotFloat
mov ecx,eax
push ecx
invoke IsMath,ecx
pop ecx
jne NotFloat
mov eax,offset acmltr0
xor dh,dh
ret
.endif
NotFloat:
mov ecx,lpStr
mov dl,[ecx]
xor dh,dh
inc dh
ret
IsFloat endp
IsCellRef proc lpStr:DWORD
mov ecx,lpStr
mov dl,[ecx]
.if (dl>='A' && dl<='Z') || (dl>='a' && dl<='z')
mov dl,[ecx+1]
.if (dl>='A' && dl<='Z') || (dl>='a' && dl<='z')
movzx eax,byte ptr [ecx]
and al,5Fh
sub al,'A'
mov edx,26
mul edx
movzx edx,byte ptr [ecx+1]
and dl,5Fh
sub dl,'@'
add eax,edx
push eax
add ecx,2
invoke IsInteger,ecx
pop edx
jne NotCellRef
shl eax,16
add eax,edx
push eax
push ecx
invoke IsMath,ecx
pop ecx
pop eax
jne NotCellRef
xor dh,dh
ret
.endif
.endif
ret
NotCellRef:
mov ecx,lpStr
mov dl,[ecx]
xor dh,dh
inc dh
ret
IsCellRef endp
IsRelCellRef proc lpStr:DWORD
LOCAL val:DWORD
mov ecx,lpStr
mov dx,[ecx]
.if dx=='(@'
add ecx,2
invoke IsInteger,ecx
jne NotRelCellRef
movzx eax,ax
mov val,eax
mov dl,[ecx]
cmp dl,','
jne NotRelCellRef
inc ecx
invoke IsInteger,ecx
jne NotRelCellRef
mov dl,[ecx]
cmp dl,')'
jne NotRelCellRef
shl eax,16
add eax,val
inc ecx
xor dh,dh
ret
.endif
ret
NotRelCellRef:
mov ecx,lpStr
mov dl,[ecx]
xor dh,dh
inc dh
ret
IsRelCellRef endp
IsFunction proc uses edi,lpStr:DWORD
mov edi,offset Function
mov ecx,lpStr
.while byte ptr [edi]
xor dh,dh
mov dl,[edi]
inc edi
@@:
mov al,[edi]
.break .if !al
call ConvChr
mov ah,al
mov al,[ecx]
call ConvChr
.if al==ah
inc edi
inc ecx
jmp @b
.endif
@@:
mov dl,[edi]
inc edi
or dl,dl
jne @b
dec dh
mov ecx,lpStr
.endw
or dh,dh
ret
ConvChr:
.if al>='a' && al<='z'
and al,5Fh
.endif
retn
IsFunction endp
CompileFormula proc lpStr:DWORD,lpOut:DWORD,nPara:DWORD
LOCAL espsave:DWORD
mov espsave,esp
mov esi,lpStr
mov edi,lpOut
Nxt:
call CompNum
jne String
NxtM:
invoke IsMath,esi
jne String
mov [edi],dl
inc edi
or dl,dl
je ExFormula
mov esi,ecx
cmp dl,','
je ExFormula
cmp dl,')'
jne Nxt
@@:
cmp nPara,0
je ExFormula
dec nPara
jmp NxtM
String:
mov eax,TPE_TEXT
ExNum:
mov esp,espsave
ret
ExFormula:
.if nPara
jmp String
.endif
mov eax,TPE_FORMULA
mov esp,espsave
ret
CompNum:
mov al,[esi]
cmp al,'('
jne @f
mov [edi],al
inc esi
inc edi
inc nPara
jmp CompNum
@@:
invoke IsInteger,esi
jne @f
mov esi,ecx
mov byte ptr [edi],TPE_INTEGER
inc edi
mov [edi],eax
add edi,4
xor eax,eax
retn
@@:
invoke IsFloat,esi
jne @f
mov esi,ecx
mov byte ptr [edi],TPE_FLOAT
inc edi
mov eax,dword ptr [acmltr0]
mov [edi],eax
mov eax,dword ptr [acmltr0+4]
mov [edi+4],eax
mov ax,word ptr [acmltr0+8]
mov [edi+8],ax
add edi,10
xor eax,eax
retn
@@:
invoke IsCellRef,esi
jne @f
mov esi,ecx
mov byte ptr [edi],TPE_CELLREF
inc edi
mov [edi],eax
add edi,4
xor eax,eax
retn
@@:
invoke IsRelCellRef,esi
jne @f
mov esi,ecx
mov byte ptr [edi],TPE_RELCELLREF
inc edi
mov [edi],eax
add edi,4
xor eax,eax
retn
@@:
invoke IsFunction,esi
jne Ex
mov esi,ecx
mov [edi],dl
inc edi
.if dl>=TPE_SUMFUNCTION && dl<=TPE_STDFUNCTION
invoke IsRelCellRef,esi
mov dl,TPE_RELCELLREF
je @f
invoke IsCellRef,esi
jne String
mov dl,TPE_CELLREF
@@:
mov [edi],dl
inc edi
mov esi,ecx
mov [edi],eax
add edi,4
mov al,[esi]
cmp al,':'
jne String
inc esi
invoke IsRelCellRef,esi
mov dl,TPE_RELCELLREF
je @f
invoke IsCellRef,esi
jne String
mov dl,TPE_CELLREF
@@:
mov [edi],dl
inc edi
mov esi,ecx
mov dl,[esi]
cmp dl,')'
jne String
inc esi
; mov ecx,[edi-5]
; .if eax<ecx
; xchg eax,ecx
; .endif
; .if ax<cx
; xchg ax,cx
; .endif
; mov [edi-5],ecx
mov [edi],eax
add edi,4
xor eax,eax
retn
.elseif dl==TPE_PIFUNCTION || dl==TPE_EFUNCTION || dl==TPE_XFUNCTION; || dl==TPE_CDATEFUNCTION
xor eax,eax
retn
.else
inc nPara
.if dl==TPE_IIFFUNCTION
invoke CompileFormula,esi,edi,0
cmp eax,TPE_FORMULA
jne String
cmp dl,','
jne String
invoke CompileFormula,esi,edi,0
cmp eax,TPE_FORMULA
jne String
cmp dl,','
jne String
invoke CompileFormula,esi,edi,0
.elseif dl==TPE_ONFUNCTION
invoke CompileFormula,esi,edi,0
cmp eax,TPE_FORMULA
jne String
cmp dl,','
jne String
NxtOn:
invoke CompileFormula,esi,edi,0
cmp eax,TPE_FORMULA
jne String
cmp dl,','
je NxtOn
.elseif dl==TPE_RGBFUNCTION
invoke CompileFormula,esi,edi,0
cmp eax,TPE_FORMULA
jne String
cmp dl,','
jne String
invoke CompileFormula,esi,edi,0
cmp eax,TPE_FORMULA
jne String
cmp dl,','
jne String
invoke CompileFormula,esi,edi,0
cmp eax,TPE_FORMULA
jne String
.elseif dl==TPE_CDATEFUNCTION
.if byte ptr [esi]=='"'
inc esi
mov byte ptr [edi],TPE_STRING
inc edi
mov edx,edi
inc edi
.while byte ptr [esi] && byte ptr [esi]!='"'
mov al,[esi]
mov [edi],al
inc esi
inc edi
.endw
.if byte ptr [esi]!='"'
jmp String
.endif
inc esi
mov byte ptr [edi],0
inc edi
mov eax,edi
sub eax,edx
mov [edx],al
mov dl,[esi]
inc esi
mov eax,TPE_FORMULA
.else
invoke CompileFormula,esi,edi,0
.endif
.else
invoke CompileFormula,esi,edi,0
.endif
cmp eax,TPE_FORMULA
jne String
cmp dl,')'
jne String
dec nPara
xor eax,eax
retn
.endif
Ex:
xor eax,eax
dec eax
retn
CompileFormula endp
CompileGraph proc lpStr:DWORD,lpOut:DWORD
LOCAL espsave:DWORD
mov espsave,esp
mov esi,lpStr
mov edi,lpOut
invoke IsFunction,esi
jne NotGraph
cmp dl,TPE_GRPFUNCTION
jne NotGraph
mov [edi],dl
inc edi
mov esi,ecx
@@:
invoke IsFunction,esi
jne NotGraph
cmp dl,TPE_GRPTFUNCTION
jne @f
call StoreT
jne NotGraph
mov dl,[esi]
cmp dl,','
jne NotGraph
mov [edi],dl
inc edi
inc esi
jmp @b
@@:
invoke IsFunction,esi
jne NotGraph
cmp dl,TPE_GRPXFUNCTION
jne NotGraph
call StoreXY
jne NotGraph
mov dl,[esi]
cmp dl,','
jne NotGraph
mov [edi],dl
inc edi
inc esi
invoke IsFunction,esi
jne NotGraph
cmp dl,TPE_GRPYFUNCTION
jne NotGraph
call StoreXY
jne NotGraph
mov dl,[esi]
cmp dl,','
jne NotGraph
mov [edi],dl
inc edi
inc esi
CompileGraph1:
invoke IsFunction,esi
jne NotGraph
cmp dl,TPE_GRPGXFUNCTION
jne @f
call StoreGX
jne NotGraph
mov dl,[esi]
cmp dl,','
jne CompileGraph2
mov [edi],dl
inc esi
inc edi
jmp CompileGraph1
@@:
cmp dl,TPE_GRPFXFUNCTION
jne NotGraph
call StoreFX
jne NotGraph
mov dl,[esi]
cmp dl,','
jne CompileGraph2
mov [edi],dl
inc esi
inc edi
jmp CompileGraph1
CompileGraph2:
mov dl,[esi]
cmp dl,')'
jne NotGraph
mov [edi],dl
inc edi
mov byte ptr [edi],0
inc edi
inc esi
mov esp,espsave
mov eax,TPE_GRAPH
ret
NotGraph:
mov esp,espsave
xor eax,eax
dec eax
ret
StoreT:
mov [edi],dl
inc edi
mov esi,ecx
call StoreNum ;X
jne NotT
call StoreNum ;Y
jne NotT
call StoreNum ;Rotate
jne NotT
call StoreNum ;Color
jne NotT
call StoreString ;Text
jne NotT
cmp dl,')'
jne NotT
xor eax,eax
retn
NotT:
xor eax,eax
dec eax
retn
StoreXY:
mov [edi],dl
inc edi
mov esi,ecx
call StoreNum ;X-Min
jne NotXY
call StoreNum ;X-Max
jne NotXY
call StoreNum ;X-Origo
jne NotXY
call StoreNum ;X-Tick
jne NotXY
call StoreNum ;X-Color
jne NotXY
.if byte ptr [esi]!='"'
call StoreNum ;X-TickVal
jne NotXY
.endif
call StoreString ;X-Caption
jne NotXY
cmp dl,')'
jne NotXY
xor eax,eax
retn
NotXY:
xor eax,eax
dec eax
retn
StoreGX:
mov [edi],dl
inc edi
mov esi,ecx
mov byte ptr [edi],TPE_AREAREF
inc edi
invoke IsCellRef,esi
jne NotGX
mov byte ptr [edi],TPE_CELLREF
inc edi
mov [edi],eax
add edi,4
mov esi,ecx
mov dl,[esi]
cmp dl,':'
jne NotGX
inc esi
invoke IsCellRef,esi
jne NotGX
mov byte ptr [edi],TPE_CELLREF
inc edi
mov [edi],eax
add edi,4
mov esi,ecx
mov dl,[esi]
cmp dl,','
jne NotGX
mov [edi],dl
inc esi
inc edi
call StoreNum ;Color
jne NotGX
call StoreString ;Caption
jne NotGX
cmp dl,')'
jne NotGX
xor eax,eax
retn
NotGX:
xor eax,eax
dec eax
retn
StoreFX:
mov [edi],dl
inc edi
mov esi,ecx
call StoreNum ;Function
jne NotFX
call StoreNum ;Step
jne NotFX
call StoreNum ;Color
jne NotFX
call StoreString ;Caption
jne NotFX
cmp dl,')'
jne NotFX
xor eax,eax
retn
NotFX:
xor eax,eax
dec eax
retn
StoreNum:
invoke CompileFormula,esi,edi,0
cmp eax,TPE_FORMULA
jne NotNum
cmp dl,','
jne NotNum
xor eax,eax
retn
NotNum:
xor eax,eax
dec eax
retn
StoreString:
mov byte ptr [edi],TPE_STRING
inc edi
mov edx,edi
inc edi
mov al,[esi]
cmp al,'"'
jne NotString
inc esi
@@:
mov al,[esi]
or al,al
je NotString
inc esi
cmp al,'"'
je @f
mov [edi],al
inc edi
jmp @b
@@:
mov byte ptr [edi],0
inc edi
mov eax,edi
sub eax,edx
mov [edx],al
mov dl,[esi]
cmp dl,','
je @f
cmp dl,')'
jne NotString
@@:
mov [edi],dl
inc esi
inc edi
xor eax,eax
retn
NotString:
xor eax,eax
dec eax
retn
CompileGraph endp
Compile Proc uses esi edi,lpSheet:DWORD,lpStr:DWORD,lpOut:DWORD
mov esi,lpStr
mov edi,lpOut
mov eax,TPE_EMPTY
mov dl,[esi]
or dl,dl
je Ex
invoke IsDate,lpSheet,esi
jne @f
mov [edi],eax
mov eax,TPE_INTEGER or TPE_DATE
jmp Ex
@@:
invoke IsInteger,esi
jne @f
or dl,dl
jne @f
mov [edi],eax
mov eax,TPE_INTEGER
jmp Ex
@@:
invoke IsFloat,esi
jne @f
or dl,dl
jne @f
mov eax,dword ptr [acmltr0]
mov [edi],eax
mov eax,dword ptr [acmltr0+4]
mov [edi+4],eax
mov ax,word ptr [acmltr0+8]
mov [edi+8],ax
mov eax,TPE_FLOAT
jmp Ex
@@:
mov esi,lpStr
mov edi,lpOut
xor eax,eax
mov [edi],eax
add edi,4
invoke CompileGraph,esi,edi
cmp eax,TPE_GRAPH
je Ex
mov esi,lpStr
mov edi,lpOut
xor eax,eax
mov [edi],eax
mov [edi+4],eax
mov [edi+8],ax
add edi,10
invoke CompileFormula,esi,edi,0
.if eax==TPE_TEXT || dl
invoke StrCpy,lpOut,lpStr
mov eax,TPE_TEXT
.endif
Ex:
ret
Compile endp
|
src/runtime.asm | jvns/puddle | 122 | 170750 | <reponame>jvns/puddle<filename>src/runtime.asm
use32
global _GLOBAL_OFFSET_TABLE_
global __morestack
global abort
global memcmp
global memcpy
global malloc
global free
global start
extern main
start:
; rust functions compare esp against [gs:0x30] as a sort of stack guard thing
; as long as we set [gs:0x30] to dword 0, it should be ok
mov [gs:0x30], dword 0
; jump into rust
call main
jmp $
_GLOBAL_OFFSET_TABLE_:
__morestack:
|
A6 - Sub-Rotinas parte 1/e1b.asm | ZePaiva/ACI | 0 | 89363 | <reponame>ZePaiva/ACI
.data
string: .asciiz "Arquitetura de computadores I"
str0: .asciiz "String: "
str1: .asciiz "String length: "
str2: .asciiz "\n"
.eqv print_int10, 1
.eqv print_string, 4
.eqv func, $v0
.eqv arg0, $a0
.eqv arg1, $a1
.eqv len, $t0
.eqv strp, $t1
.eqv char, $t2
.eqv
.text
.globl main
main:
la arg0, str0
li func, print_string
syscall
la arg0, string
syscall
la arg0, str2
syscall
la arg0, str1
li func, print_string
syscall
la arg0, string
sw $ra, ($sp) # guarda o endere?o de retorno da main
jal strlen # chama a funcao
lw $ra, ($sp) # repoe o ender?o de retorno da main
move arg0, func
li func, print_int10
syscall
la arg0, str2
li func, print_string
syscall
jr $ra
strlen: # string length
li len, 0
move strp, arg0
while: lb char, (strp)
beq char, '\0', endWhile
addi len, len, 1
addi strp, strp, 1
j while
endWhile:
move func, len
jr $ra |
src/CF/Syntax/Hoisted.agda | ajrouvoet/jvm.agda | 6 | 14274 | {-# OPTIONS --safe #-}
module CF.Syntax.Hoisted where
open import Level
open import Data.List
open import Relation.Unary hiding (_⊢_)
open import Relation.Ternary.Core
open import Relation.Ternary.Structures
open import Relation.Ternary.Structures.Syntax
open import CF.Types
open import CF.Contexts.Lexical
open import CF.Syntax using (module Statements)
open import CF.Syntax using (Exp) public
mutual
Stmt = Statements.Statement Block
{- This is Bigstar, but Agda cannot termination check that -}
data Block (r : Ty) : Pred Ctx 0ℓ where
nil : ε[ Block r ]
cons : ∀[ Stmt r ✴ Block r ⇒ Block r ]
open import Relation.Unary.PredicateTransformer hiding (_⍮_)
open import Data.Product
-- make constructors visible
open Exp public
open Statements Block public
open CoDeBruijn public
open import CF.Contexts.Lexical using (_⊢_) public
|
Categories/Object/Exponentiating.agda | copumpkin/categories | 98 | 1574 | <reponame>copumpkin/categories<gh_stars>10-100
{-# OPTIONS --universe-polymorphism #-}
open import Categories.Category
open import Categories.Object.BinaryProducts
module Categories.Object.Exponentiating {o ℓ e}
(C : Category o ℓ e)
(binary : BinaryProducts C) where
open Category C
open BinaryProducts binary
import Categories.Object.Product
open Categories.Object.Product C
import Categories.Object.Product.Morphisms
open Categories.Object.Product.Morphisms C
open import Categories.Square
open GlueSquares C
import Categories.Object.Exponential
open Categories.Object.Exponential C
hiding (repack)
renaming (λ-distrib to λ-distrib′)
open import Level
record Exponentiating Σ : Set (o ⊔ ℓ ⊔ e) where
field
exponential : ∀{A} → Exponential A Σ
module Σ↑ (X : Obj) = Exponential (exponential {X})
infixr 6 Σ↑_ Σ²_
Σ↑_ : Obj → Obj
Σ↑_ X = Σ↑.B^A X
{-
Γ ; x : A ⊢ f x : Σ
────────────────────────────────────── λ-abs A f
Γ ⊢ (λ (x : A) → f x) : Σ↑ A
-}
λ-abs : ∀ {Γ} A → (Γ × A) ⇒ Σ → Γ ⇒ Σ↑ A
λ-abs {Γ} A f = Σ↑.λg A product f
{-
───────────────────────────── eval
f : Σ↑ A ; x : A ⊢ (f x) : Σ
-}
eval : {A : Obj} → (Σ↑ A × A) ⇒ Σ
eval {A} = Σ↑.eval A ∘ repack product (Σ↑.product A)
{-
x : A ⊢ f x : B
───────────────────────────────────────── [Σ↑_]
k : Σ↑ B ⊢ (λ (x : A) → k (f x)) : Σ↑ A
-}
[Σ↑_] : ∀ {A B} → A ⇒ B → Σ↑ B ⇒ Σ↑ A
[Σ↑_] {A}{B} f = λ-abs A (eval {B} ∘ second f)
Σ²_ : Obj → Obj
Σ²_ X = Σ↑ (Σ↑ X)
[Σ²_] : ∀ {X Y} → X ⇒ Y → Σ² X ⇒ Σ² Y
[Σ² f ] = [Σ↑ [Σ↑ f ] ]
flip : ∀ {A B} → A ⇒ Σ↑ B → B ⇒ Σ↑ A
flip {A}{B} f = λ-abs {B} A (eval {B} ∘ swap ∘ second f)
-- not sure this is the best name... "partial-apply" might be better
curry : ∀ {X Y} → (Σ↑ (X × Y) × X) ⇒ Σ↑ Y
curry {X}{Y} = λ-abs Y (eval {X × Y} ∘ assocˡ)
-- some lemmas from Exponential specialized to C's chosen products
open Equiv
open HomReasoning
private
.repack∘first : ∀ {A X}{f : X ⇒ Σ↑ A}
→ repack product (Σ↑.product A) ∘ first f
≡ [ product ⇒ Σ↑.product A ]first f
repack∘first {A} = [ product ⇒ product ⇒ Σ↑.product A ]repack∘⁂
.β : ∀{A X} {g : (X × A) ⇒ Σ}
→ eval {A} ∘ first (λ-abs A g) ≡ g
β {A}{X}{g} =
begin
(Σ↑.eval A ∘ repack product (Σ↑.product A)) ∘ first (Σ↑.λg A product g)
↓⟨ pullʳ repack∘first ⟩
Σ↑.eval A ∘ [ product ⇒ Σ↑.product A ]first (Σ↑.λg A product g)
↓⟨ Σ↑.β A product ⟩
g
∎
.λ-unique : ∀{A X} {g : (X × A) ⇒ Σ} {h : X ⇒ Σ↑ A}
→ (eval ∘ first h ≡ g)
→ (h ≡ λ-abs A g)
λ-unique {A}{X}{g}{h} commutes
= Σ↑.λ-unique A product commutes′
where
commutes′ : Σ↑.eval A ∘ [ product ⇒ Σ↑.product A ]first h ≡ g
commutes′ =
begin
Σ↑.eval A ∘ [ product ⇒ Σ↑.product A ]first h
↑⟨ pullʳ repack∘first ⟩
(Σ↑.eval A ∘ repack product (Σ↑.product A)) ∘ first h
↓⟨ commutes ⟩
g
∎
.λ-η : ∀ {A X}{f : X ⇒ Σ↑ A }
→ λ-abs A (eval ∘ first f) ≡ f
λ-η {A}{X}{f} = sym (λ-unique refl)
.λ-cong : ∀{A B : Obj}{f g : (B × A) ⇒ Σ}
→ (f ≡ g)
→ (λ-abs A f ≡ λ-abs A g)
λ-cong {A} f≡g = Σ↑.λ-cong A product f≡g
.subst : ∀ {A C D} {f : (D × A) ⇒ Σ} {g : C ⇒ D}
→ λ-abs {D} A f ∘ g
≡ λ-abs {C} A (f ∘ first g)
subst {A} = Σ↑.subst A product product
.λ-η-id : ∀ {A} → λ-abs A eval ≡ id
λ-η-id {A} =
begin
Σ↑.λg A product (Σ↑.eval A ∘ repack product (Σ↑.product A))
↓⟨ Σ↑.λ-cong A product (∘-resp-≡ʳ (repack≡id⁂id product (Σ↑.product A))) ⟩
Σ↑.λg A product (Σ↑.eval A ∘ [ product ⇒ Σ↑.product A ]first id)
↓⟨ Σ↑.η A product ⟩
id
∎
.λ-distrib : ∀ {A B C}{f : A ⇒ B}{g : (C × B) ⇒ Σ}
→ λ-abs A (g ∘ second f)
≡ [Σ↑ f ] ∘ λ-abs B g
λ-distrib {A}{B}{C}{f}{g} =
begin
Σ↑.λg A product (g ∘ second f)
↓⟨ λ-distrib′ exponential exponential product product product ⟩
Σ↑.λg A product (Σ↑.eval B ∘ [ product ⇒ Σ↑.product B ]second f)
∘ Σ↑.λg B product g
↑⟨ λ-cong (pullʳ [ product ⇒ product ⇒ Σ↑.product B ]repack∘⁂) ⟩∘⟨ refl ⟩
Σ↑.λg A product ((Σ↑.eval B ∘ repack product (Σ↑.product B)) ∘ second f)
∘ Σ↑.λg B product g
∎
.flip² : ∀{A B}{f : A ⇒ Σ↑ B} → flip (flip f) ≡ f
flip² {A}{B}{f} =
begin
λ-abs {A} B (eval {A} ∘ swap ∘ second (flip f))
↓⟨ λ-cong lem₁ ⟩
λ-abs {A} B (eval {B} ∘ first f)
↓⟨ λ-η ⟩
f
∎
where
lem₁ : eval {A} ∘ swap ∘ second (flip f) ≡ eval {B} ∘ first f
lem₁ =
begin
eval {A} ∘ swap ∘ second (flip f)
↑⟨ assoc ⟩
(eval {A} ∘ swap) ∘ second (flip f)
↓⟨ glue β swap∘⁂ ⟩
eval {B} ∘ (swap ∘ second f) ∘ swap
↓⟨ refl ⟩∘⟨ swap∘⁂ ⟩∘⟨ refl ⟩
eval {B} ∘ (first f ∘ swap) ∘ swap
↓⟨ refl ⟩∘⟨ cancelRight swap∘swap ⟩
eval {B} ∘ first f
∎
|
Transynther/x86/_processed/US/_ht_st_zr_un_/i7-8650U_0xd2.log_3944_1527.asm | ljhsiun2/medusa | 9 | 86826 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x133, %rdi
nop
add $23918, %rbx
mov (%rdi), %si
nop
nop
nop
and $50419, %rdi
lea addresses_normal_ht+0x807, %r9
add %rbp, %rbp
movw $0x6162, (%r9)
nop
nop
nop
add $53860, %rdi
lea addresses_WC_ht+0x13133, %rsi
nop
add $58011, %r11
mov (%rsi), %di
nop
nop
inc %rsi
lea addresses_normal_ht+0x1d4f3, %rsi
lea addresses_normal_ht+0x1bdb3, %rdi
nop
xor %rbp, %rbp
mov $58, %rcx
rep movsl
nop
nop
nop
nop
nop
cmp $23038, %rdi
lea addresses_normal_ht+0x2d33, %r12
nop
nop
nop
and %r9, %r9
mov (%r12), %rcx
cmp %rcx, %rcx
lea addresses_A_ht+0x4333, %rsi
lea addresses_A_ht+0x8d33, %rdi
nop
nop
nop
nop
add $18860, %r12
mov $95, %rcx
rep movsl
nop
nop
sub %rbx, %rbx
lea addresses_A_ht+0x17f73, %rsi
lea addresses_UC_ht+0x4e0e, %rdi
clflush (%rdi)
nop
cmp $34300, %rbp
mov $33, %rcx
rep movsq
sub $30006, %rcx
lea addresses_UC_ht+0x17733, %rsi
lea addresses_A_ht+0x19533, %rdi
nop
nop
nop
nop
nop
xor $32616, %rbx
mov $9, %rcx
rep movsw
nop
nop
nop
xor %r9, %r9
lea addresses_A_ht+0x5e83, %rbx
nop
nop
nop
nop
xor $34643, %r11
movb $0x61, (%rbx)
nop
nop
nop
nop
nop
xor $45761, %rsi
lea addresses_WT_ht+0x16a33, %rdi
nop
nop
nop
nop
cmp %r11, %r11
movw $0x6162, (%rdi)
nop
and %rcx, %rcx
lea addresses_UC_ht+0x1ef33, %r9
nop
nop
xor $21485, %rbp
mov (%r9), %rcx
nop
cmp %rbx, %rbx
lea addresses_normal_ht+0x1933, %rsi
nop
nop
nop
nop
sub %rdi, %rdi
and $0xffffffffffffffc0, %rsi
vmovntdqa (%rsi), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %r9
nop
nop
nop
nop
nop
and %r12, %r12
lea addresses_UC_ht+0x69b3, %rsi
lea addresses_D_ht+0x16d33, %rdi
nop
nop
xor %rbp, %rbp
mov $99, %rcx
rep movsb
nop
nop
nop
nop
add %r11, %r11
lea addresses_WC_ht+0x16adf, %rbp
nop
nop
sub $29670, %rdi
vmovups (%rbp), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rcx
and %rsi, %rsi
lea addresses_normal_ht+0x12dc3, %rsi
lea addresses_WT_ht+0x14d33, %rdi
nop
inc %r9
mov $46, %rcx
rep movsl
nop
nop
nop
inc %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %rax
push %rbx
push %rcx
// Faulty Load
lea addresses_US+0xfd33, %rax
inc %rcx
vmovups (%rax), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %r10
lea oracles, %r12
and $0xff, %r10
shlq $12, %r10
mov (%r12,%r10,1), %r10
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 2, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'00': 3453, '44': 346, 'ff': 96, '45': 5, '7f': 2, '47': 19, '10': 13, '20': 5, '24': 4, '30': 1}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 ff 00 44 00 00 00 45 44 00 00 00 00 00 ff 00 00 44 00 00 00 ff 44 44 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 44 00 00 00 00 00 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 47 00 00 00 00 00 00 00 00 00 00 00 44 ff 00 00 00 00 ff 00 00 00 00 00 00 44 00 00 00 00 00 44 44 00 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 44 ff 44 00 ff 00 47 00 00 00 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 47 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 44 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 44 00 00 00 ff 00 10 00 00 44 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 44 00 00 00 00 44 00 00 00 ff 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 ff 00 44 00 44 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 ff 00 10 44 00 00 00 00 ff 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 44 00 00 00 44 47 00 44 00 00 00 44 00 00 00 00 44 00 00 44 00 00 00 00 00 00 44 00 00 44 00 00 00 00 00 00 44 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 44 00 44 00 00 00 47 00 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 44 00 00 47 00 44 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 ff 00 00 00 00 44 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 47 00 00 00 44 00 00 00 44 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 44 00 00 00 00 00 00 00 00 44 44 00 00 00 00 00 00 00 00 00 ff 44 00 ff 00 00 00 00 ff 00 00 00 44 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 44 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 44 00 00 44 00 00 00 ff 00 00 00 00 00 00 00 00 00
*/
|
ordinary/runge_pc_2.adb | jscparker/math_packages | 30 | 20165 | <filename>ordinary/runge_pc_2.adb
-----------------------------------------------------------------------
-- package body Runge_pc_2, Runge-Kutta integrator.
-- Copyright (C) 2008-2018 <NAME>.
--
-- Permission to use, copy, modify, and/or 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.
-----------------------------------------------------------------------
with runge_coeffs_pd_8;
package body Runge_pc_2 is
package Coeffs is new Runge_Coeffs_pd_8 (Real);
use Coeffs;
type K_type1 is array (RK_Range) of Real;
type K_type2 is array (Dyn_Index) of K_type1;
type K_type is array (0..1) of K_type2;
type RK_Dynamical_Variable is array (0..1) of Dynamical_Variable;
procedure Runge_Sum
(Y : in RK_Dynamical_Variable;
Next_Y : out RK_Dynamical_Variable;
Stage : in Stages;
K : in K_type)
is
Stage2 : Stages;
Sum : Real;
begin
Stage2 := Stage;
for j in 0..1 loop
for l in Dyn_Index loop
Sum := 0.0;
for n in RK_Range range 0..Stage2-1 loop
Sum := Sum + A(Stage2)(n) * K(j)(l)(n);
end loop;
Next_Y(j)(l) := Y(j)(l) + Sum;
end loop;
end loop;
end Runge_Sum;
pragma Inline (Runge_Sum);
function F1
(Time : Real;
Y1 : RK_Dynamical_Variable)
return RK_Dynamical_Variable
is
Result : RK_Dynamical_Variable;
begin
Result(0) := Y1(1);
Result(1) := F (Time, Y1(0));
return Result;
end F1;
-- Integrate to eighth order using RKPD
procedure Integrate
(Final_Y : out Dynamical_Variable;
Final_deriv_Of_Y : out Dynamical_Variable;
Final_Time : in Real;
Initial_Y : in Dynamical_Variable;
Initial_deriv_Of_Y : in Dynamical_Variable;
Initial_Time : in Real;
No_of_Steps : in Real)
is
Delta_t : constant Real := (Final_Time - Initial_Time) / No_of_Steps;
Present_t : Real;
Y : RK_Dynamical_Variable;
K : K_type;
-- Increments of Independent variable
-- so K(13) = Delta_t*F (Time + Dt(13), Y + SUM (A(13), K))
Dt : Coefficient;
-- function to Sum Series For Delta Y efficiently
function Seventh_Order_Delta_Y return RK_Dynamical_Variable is
Result : RK_Dynamical_Variable;
begin
for j in 0..1 loop
for l in Dyn_Index loop
Result(j)(l) :=
B7(0) * K(j)(l)(0) + B7(5) * K(j)(l)(5) +
B7(6) * K(j)(l)(6) + B7(7) * K(j)(l)(7) +
B7(8) * K(j)(l)(8) + B7(9) * K(j)(l)(9) +
B7(10) * K(j)(l)(10) + B7(11) * K(j)(l)(11);
end loop;
end loop;
return Result;
end Seventh_Order_Delta_Y;
-- function to Sum Series For Delta Y efficiently
function Eighth_Order_Delta_Y return RK_Dynamical_Variable is
Result : RK_Dynamical_Variable;
begin
for j in 0..1 loop
for l in Dyn_Index loop
Result(j)(l) :=
B8(0) * K(j)(l)(0) + B8(5) * K(j)(l)(5) +
B8(6) * K(j)(l)(6) + B8(7) * K(j)(l)(7) +
B8(8) * K(j)(l)(8) + B8(9) * K(j)(l)(9) +
B8(10) * K(j)(l)(10) + B8(11) * K(j)(l)(11) +
B8(12) * K(j)(l)(12);
end loop;
end loop;
return Result;
end Eighth_Order_Delta_Y;
-- function to Sum Series For Delta Y efficiently
procedure Get_New_Y_to_Seventh_Order
(Y : in out RK_Dynamical_Variable)
is
begin
for j in 0..1 loop
for l in Dyn_Index loop
Y(j)(l) := Y(j)(l) +
B7(0) * K(j)(l)(0) + B7(5) * K(j)(l)(5) +
B7(6) * K(j)(l)(6) + B7(7) * K(j)(l)(7) +
B7(8) * K(j)(l)(8) + B7(9) * K(j)(l)(9) +
B7(10) * K(j)(l)(10) + B7(11) * K(j)(l)(11);
end loop;
end loop;
end Get_New_Y_to_Seventh_Order;
procedure Get_New_Y_to_Eighth_Order
(Y : in out RK_Dynamical_Variable) is
begin
for j in 0..1 loop
for l in Dyn_Index loop
Y(j)(l) := Y(j)(l) +
B8(0) * K(j)(l)(0) + B8(5) * K(j)(l)(5) +
B8(6) * K(j)(l)(6) + B8(7) * K(j)(l)(7) +
B8(8) * K(j)(l)(8) + B8(9) * K(j)(l)(9) +
B8(10) * K(j)(l)(10) + B8(11) * K(j)(l)(11) +
B8(12) * K(j)(l)(12);
end loop;
end loop;
end Get_New_Y_to_Eighth_Order;
begin
Y(0) := Initial_Y;
Y(1) := Initial_deriv_Of_Y;
Present_t := Initial_Time;
for i in Stages Loop
Dt(i) := Delta_t * C(i);
end loop;
Time_Steps:
for step in 1 .. Integer(No_Of_Steps) loop
-- First get DeltaY to 8th Order by calculating the
-- Runge-Kutta corrections K.
--
-- K(Stages'First) := Delta_t * F (Time, Y);
-- for Stage in Stages'First+1 .. Stages'Last loop
-- K(Stage) := Delta_t * F (Time + Dt(Stage), Y + Sum (Stage));
-- end loop;
Make_New_Corrections_K:
declare
Next_t : Real := Present_t;
Next_Deriv, Next_Y : RK_Dynamical_Variable;
begin
Next_Deriv := F1 (Next_t, Y);
for j in 0..1 loop
for l in Dyn_Index loop
K(j)(l)(Stages'First) := Delta_t * Next_Deriv(j)(l);
end loop;
end loop;
for Stage in Stages'First+1 .. Stages'Last loop
Runge_Sum (Y, Next_Y, Stage, K);
Next_t := Present_t + Dt(Stage);
Next_Deriv := F1 (Next_t, Next_Y);
for j in 0..1 loop
for l in Dyn_Index loop
K(j)(l)(Stage) := Delta_t * Next_Deriv(j)(l);
end loop;
end loop;
end loop;
end Make_New_Corrections_K;
-- use globally updated K to get new Y:
Get_New_Y_to_Eighth_Order (Y);
--Get_New_Y_to_Seventh_Order (Y);
Present_t := Present_t + Delta_t; -- new time
end loop Time_Steps;
Final_Y := Y(0);
Final_deriv_Of_Y := Y(1);
end Integrate;
end Runge_pc_2;
|
Variables and Properties/set var to value as type/as type.applescript | looking-for-a-job/applescript-examples | 1 | 4633 | #!/usr/bin/osascript
set intVal to "123" as integer |
hudi-spark-datasource/hudi-spark/src/main/antlr4/org/apache/hudi/spark/sql/parser/HoodieSqlCommon.g4 | huberylee/hudi | 0 | 7266 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
grammar HoodieSqlCommon;
@lexer::members {
/**
* Verify whether current token is a valid decimal token (which contains dot).
* Returns true if the character that follows the token is not a digit or letter or underscore.
*
* For example:
* For char stream "2.3", "2." is not a valid decimal token, because it is followed by digit '3'.
* For char stream "2.3_", "2.3" is not a valid decimal token, because it is followed by '_'.
* For char stream "2.3W", "2.3" is not a valid decimal token, because it is followed by 'W'.
* For char stream "12.0D 34.E2+0.12 " 12.0D is a valid decimal token because it is followed
* by a space. 34.E2 is a valid decimal token because it is followed by symbol '+'
* which is not a digit or letter or underscore.
*/
public boolean isValidDecimal() {
int nextChar = _input.LA(1);
if (nextChar >= 'A' && nextChar <= 'Z' || nextChar >= '0' && nextChar <= '9' ||
nextChar == '_') {
return false;
} else {
return true;
}
}
}
singleStatement
: statement EOF
;
statement
: compactionStatement #compactionCommand
| CALL multipartIdentifier '(' (callArgument (',' callArgument)*)? ')' #call
| CREATE INDEX (IF NOT EXISTS)? identifier ON TABLE?
tableIdentifier (USING indexType=identifier)?
LEFT_PAREN columns=multipartIdentifierPropertyList RIGHT_PAREN
(OPTIONS indexOptions=propertyList)? #createIndex
| DROP INDEX (IF EXISTS)? identifier ON TABLE? tableIdentifier #dropIndex
| SHOW INDEXES (FROM | IN) TABLE? tableIdentifier #showIndexes
| REFRESH INDEX identifier ON TABLE? tableIdentifier #refreshIndex
| .*? #passThrough
;
compactionStatement
: operation = (RUN | SCHEDULE) COMPACTION ON tableIdentifier (AT instantTimestamp = INTEGER_VALUE)? #compactionOnTable
| operation = (RUN | SCHEDULE) COMPACTION ON path = STRING (AT instantTimestamp = INTEGER_VALUE)? #compactionOnPath
| SHOW COMPACTION ON tableIdentifier (LIMIT limit = INTEGER_VALUE)? #showCompactionOnTable
| SHOW COMPACTION ON path = STRING (LIMIT limit = INTEGER_VALUE)? #showCompactionOnPath
;
tableIdentifier
: (db=IDENTIFIER '.')? table=IDENTIFIER
;
callArgument
: expression #positionalArgument
| identifier '=>' expression #namedArgument
;
expression
: constant
| stringMap
;
constant
: number #numericLiteral
| booleanValue #booleanLiteral
| STRING+ #stringLiteral
| identifier STRING #typeConstructor
;
stringMap
: MAP '(' constant (',' constant)* ')'
;
booleanValue
: TRUE | FALSE
;
number
: MINUS? EXPONENT_VALUE #exponentLiteral
| MINUS? DECIMAL_VALUE #decimalLiteral
| MINUS? INTEGER_VALUE #integerLiteral
| MINUS? BIGINT_LITERAL #bigIntLiteral
| MINUS? SMALLINT_LITERAL #smallIntLiteral
| MINUS? TINYINT_LITERAL #tinyIntLiteral
| MINUS? DOUBLE_LITERAL #doubleLiteral
| MINUS? FLOAT_LITERAL #floatLiteral
| MINUS? BIGDECIMAL_LITERAL #bigDecimalLiteral
;
multipartIdentifierPropertyList
: multipartIdentifierProperty (COMMA multipartIdentifierProperty)*
;
multipartIdentifierProperty
: multipartIdentifier (OPTIONS options=propertyList)?
;
multipartIdentifier
: parts+=identifier ('.' parts+=identifier)*
;
identifier
: IDENTIFIER #unquotedIdentifier
| quotedIdentifier #quotedIdentifierAlternative
| nonReserved #unquotedIdentifier
;
quotedIdentifier
: BACKQUOTED_IDENTIFIER
;
nonReserved
: CALL
| COMPACTION
| CREATE
| DROP
| EXISTS
| FROM
| IN
| INDEX
| INDEXES
| IF
| LIMIT
| NOT
| ON
| OPTIONS
| REFRESH
| RUN
| SCHEDULE
| SHOW
| TABLE
| USING
;
propertyList
: LEFT_PAREN property (COMMA property)* RIGHT_PAREN
;
property
: key=propertyKey (EQ? value=propertyValue)?
;
propertyKey
: identifier (DOT identifier)*
| STRING
;
propertyValue
: INTEGER_VALUE
| DECIMAL_VALUE
| booleanValue
| STRING
;
LEFT_PAREN: '(';
RIGHT_PAREN: ')';
COMMA: ',';
DOT: '.';
ALL: 'ALL';
AT: 'AT';
CALL: 'CALL';
COMPACTION: 'COMPACTION';
RUN: 'RUN';
SCHEDULE: 'SCHEDULE';
ON: 'ON';
SHOW: 'SHOW';
LIMIT: 'LIMIT';
MAP: 'MAP';
NULL: 'NULL';
TRUE: 'TRUE';
FALSE: 'FALSE';
INTERVAL: 'INTERVAL';
TO: 'TO';
CREATE: 'CREATE';
INDEX: 'INDEX';
INDEXES: 'INDEXES';
IF: 'IF';
NOT: 'NOT';
EXISTS: 'EXISTS';
TABLE: 'TABLE';
USING: 'USING';
OPTIONS: 'OPTIONS';
DROP: 'DROP';
FROM: 'FROM';
IN: 'IN';
REFRESH: 'REFRESH';
EQ: '=' | '==';
PLUS: '+';
MINUS: '-';
STRING
: '\'' ( ~('\''|'\\') | ('\\' .) )* '\''
| '"' ( ~('"'|'\\') | ('\\' .) )* '"'
;
BIGINT_LITERAL
: DIGIT+ 'L'
;
SMALLINT_LITERAL
: DIGIT+ 'S'
;
TINYINT_LITERAL
: DIGIT+ 'Y'
;
INTEGER_VALUE
: DIGIT+
;
EXPONENT_VALUE
: DIGIT+ EXPONENT
| DECIMAL_DIGITS EXPONENT {isValidDecimal()}?
;
DECIMAL_VALUE
: DECIMAL_DIGITS {isValidDecimal()}?
;
FLOAT_LITERAL
: DIGIT+ EXPONENT? 'F'
| DECIMAL_DIGITS EXPONENT? 'F' {isValidDecimal()}?
;
DOUBLE_LITERAL
: DIGIT+ EXPONENT? 'D'
| DECIMAL_DIGITS EXPONENT? 'D' {isValidDecimal()}?
;
BIGDECIMAL_LITERAL
: DIGIT+ EXPONENT? 'BD'
| DECIMAL_DIGITS EXPONENT? 'BD' {isValidDecimal()}?
;
IDENTIFIER
: (LETTER | DIGIT | '_')+
;
BACKQUOTED_IDENTIFIER
: '`' ( ~'`' | '``' )* '`'
;
fragment DECIMAL_DIGITS
: DIGIT+ '.' DIGIT*
| '.' DIGIT+
;
fragment EXPONENT
: 'E' [+-]? DIGIT+
;
fragment DIGIT
: [0-9]
;
fragment LETTER
: [A-Z]
;
SIMPLE_COMMENT
: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN)
;
BRACKETED_COMMENT
: '/*' .*? '*/' -> channel(HIDDEN)
;
WS : [ \r\n\t]+ -> channel(HIDDEN)
;
// Catch-all for anything we can't recognize.
// We use this to be able to ignore and recover all the text
// when splitting statements with DelimiterLexer
UNRECOGNIZED
: .
;
|
Benchmark/gcd2.asm | DW0RKiN/M4_FORTH | 2 | 86280 | <reponame>DW0RKiN/M4_FORTH<gh_stars>1-10
ORG 32768
; === b e g i n ===
ld (Stop+1), SP ; 4:20 init storing the original SP value when the "bye" word is used
ld L, 0x1A ; 2:7 init Upper screen
call 0x1605 ; 3:17 init Open channel
ld HL, 60000 ; 3:10 init Init Return address stack
exx ; 1:4 init
call gcd2_bench ; 3:17 call ( -- ret ) R:( -- )
Stop: ; stop
ld SP, 0x0000 ; 3:10 stop restoring the original SP value when the "bye" word is used
ld HL, 0x2758 ; 3:10 stop
exx ; 1:4 stop
ret ; 1:10 stop
; ===== e n d =====
; --- the beginning of a non-recursive function ---
gcd2: ; ( a b -- gcd )
pop BC ; 1:10 : ret
ld (gcd2_end+1),BC ; 4:20 : ( ret -- ) R:( -- )
ld A, H ; 1:4 2dup D0= if
or L ; 1:4 2dup D0= if
or D ; 1:4 2dup D0= if
or E ; 1:4 2dup D0= if
jp nz, else101 ; 3:10 2dup D0= if
pop DE ; 1:10 2drop 1
ld HL, 1 ; 3:10 2drop 1
jp gcd2_end ; 3:10 exit
else101 EQU $ ; = endif
endif101:
ld A, H ; 1:4 dup 0= if
or L ; 1:4 dup 0= if
jp nz, else102 ; 3:10 dup 0= if
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
jp gcd2_end ; 3:10 exit
else102 EQU $ ; = endif
endif102:
ex DE, HL ; 1:4 swap ( b a -- a b )
ld A, H ; 1:4 dup 0= if
or L ; 1:4 dup 0= if
jp nz, else103 ; 3:10 dup 0= if
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
jp gcd2_end ; 3:10 exit
else103 EQU $ ; = endif
endif103:
begin101: ; begin 101
ld A, E ; 1:4 2dup <> while 101
sub L ; 1:4 2dup <> while 101
jr nz, $+7 ; 2:7/12 2dup <> while 101
ld A, D ; 1:4 2dup <> while 101
sub H ; 1:4 2dup <> while 101
jp z, break101 ; 3:10 2dup <> while 101
ld A, E ; 1:4 2dup < if DE<HL --> DE-HL<0 --> carry if true
sub L ; 1:4 2dup < if DE<HL --> DE-HL<0 --> carry if true
ld A, D ; 1:4 2dup < if DE<HL --> DE-HL<0 --> carry if true
sbc A, H ; 1:4 2dup < if DE<HL --> DE-HL<0 --> carry if true
rra ; 1:4 2dup < if
xor D ; 1:4 2dup < if
xor H ; 1:4 2dup < if
jp p, else104 ; 3:10 2dup < if
or A ; 1:4 over -
sbc HL, DE ; 2:15 over -
jp endif104 ; 3:10 else
else104:
ex DE, HL ; 1:4 swap ( b a -- a b )
or A ; 1:4 over -
sbc HL, DE ; 2:15 over - ; swap
endif104:
jp begin101 ; 3:10 repeat 101
break101: ; repeat 101
pop DE ; 1:10 nip ( b a -- a )
gcd2_end:
jp 0x0000 ; 3:10 ;
; --------- end of non-recursive function ---------
; --- the beginning of a non-recursive function ---
gcd2_bench: ; ( -- )
pop BC ; 1:10 : ret
ld (gcd2_bench_end+1),BC; 4:20 : ( ret -- ) R:( -- )
ld BC, 0 ; 3:10 xdo(100,0) 101
xdo101save: ; xdo(100,0) 101
ld (idx101),BC ; 4:20 xdo(100,0) 101
xdo101: ; xdo(100,0) 101
ld BC, 0 ; 3:10 xdo(100,0) 102
xdo102save: ; xdo(100,0) 102
ld (idx102),BC ; 4:20 xdo(100,0) 102
xdo102: ; xdo(100,0) 102
push DE ; 1:11 index(101) xj
ex DE, HL ; 1:4 index(101) xj
ld HL, (idx101) ; 3:16 index(101) xj idx always points to a 16-bit index
push DE ; 1:11 index(102) xi
ex DE, HL ; 1:4 index(102) xi
ld HL, (idx102) ; 3:16 index(102) xi idx always points to a 16-bit index
call gcd2 ; 3:17 call ( -- ret ) R:( -- )
ex DE, HL ; 1:4 drop
pop DE ; 1:10 drop ( a -- )
;[12:45] xloop 102 variant +1.B: 0 <= index < stop <= 256, run 100x
idx102 EQU $+1 ; xloop 102 idx always points to a 16-bit index
ld A, 0 ; 2:7 xloop 102 0.. +1 ..(100), real_stop:0x0064
nop ; 1:4 xloop 102 hi(index) = 0 = nop -> idx always points to a 16-bit index.
inc A ; 1:4 xloop 102 index++
ld (idx102),A ; 3:13 xloop 102
xor 0x64 ; 2:7 xloop 102 lo(real_stop)
jp nz, xdo102 ; 3:10 xloop 102 index-stop
xleave102: ; xloop 102
xexit102: ; xloop 102
;[12:45] xloop 101 variant +1.B: 0 <= index < stop <= 256, run 100x
idx101 EQU $+1 ; xloop 101 idx always points to a 16-bit index
ld A, 0 ; 2:7 xloop 101 0.. +1 ..(100), real_stop:0x0064
nop ; 1:4 xloop 101 hi(index) = 0 = nop -> idx always points to a 16-bit index.
inc A ; 1:4 xloop 101 index++
ld (idx101),A ; 3:13 xloop 101
xor 0x64 ; 2:7 xloop 101 lo(real_stop)
jp nz, xdo101 ; 3:10 xloop 101 index-stop
xleave101: ; xloop 101
xexit101: ; xloop 101
gcd2_bench_end:
jp 0x0000 ; 3:10 ;
; --------- end of non-recursive function ---------
|
ibm_8b_10b_encoder.ads | silentTeee/IBM-8b-10b-encoder | 0 | 7849 | --Copyright (c) 2019 <NAME> under the MIT License
package IBM_8b_10b_Encoder is
type Byte is mod 2**8;
type Ten_Bits is mod 2**10;
type Running_Disp is (Neg_1, Pos_1);
procedure Encode( B: in Byte;
T: out Ten_Bits;
RD: in out Running_Disp);
--To verify that Running Disparity is being preserved, use this version
procedure Decode( T: in Ten_Bits;
B: out Byte;
RD: in out Running_Disp;
Success: out Boolean);
procedure Decode( T: in Ten_Bits;
B: out Byte;
Success: out Boolean);
end IBM_8b_10b_Encoder;
|
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_18186_1381.asm | ljhsiun2/medusa | 9 | 89113 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x8c2a, %rsi
nop
nop
nop
inc %rdx
mov (%rsi), %r12d
nop
nop
nop
nop
add %rdx, %rdx
lea addresses_A_ht+0x15f0a, %r9
nop
nop
nop
cmp %rsi, %rsi
vmovups (%r9), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %r8
inc %r9
lea addresses_WC_ht+0x1b82a, %rsi
lea addresses_A_ht+0x1e8aa, %rdi
add %r9, %r9
mov $38, %rcx
rep movsl
nop
nop
and $34518, %r12
lea addresses_UC_ht+0x3062, %rdi
xor $54601, %r12
movb $0x61, (%rdi)
nop
nop
nop
nop
nop
cmp $56000, %rdx
lea addresses_WC_ht+0x73ce, %r8
nop
nop
inc %rdi
mov $0x6162636465666768, %rcx
movq %rcx, %xmm0
and $0xffffffffffffffc0, %r8
movntdq %xmm0, (%r8)
nop
nop
nop
nop
xor %r9, %r9
lea addresses_normal_ht+0xaa2a, %r9
nop
cmp $49651, %rdx
movw $0x6162, (%r9)
sub $52713, %r8
lea addresses_UC_ht+0x13e72, %r9
nop
and %r12, %r12
mov (%r9), %si
sub %r12, %r12
lea addresses_A_ht+0x1742a, %r9
xor $30513, %rcx
movw $0x6162, (%r9)
nop
nop
xor %rdi, %rdi
lea addresses_WC_ht+0x1a928, %r12
nop
nop
add %rcx, %rcx
mov $0x6162636465666768, %r9
movq %r9, (%r12)
nop
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_D_ht+0x16faa, %r12
nop
nop
cmp $42298, %r9
mov (%r12), %rdi
nop
nop
sub %rsi, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %rbx
push %rdx
push %rsi
// Faulty Load
lea addresses_WT+0x6c2a, %rdx
nop
inc %r11
mov (%rdx), %ebx
lea oracles, %rsi
and $0xff, %rbx
shlq $12, %rbx
mov (%rsi,%rbx,1), %rbx
pop %rsi
pop %rdx
pop %rbx
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'00': 18186}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
models/amalgam/tests/test_sb_both_ways.als | transclosure/Amalgam | 4 | 5323 | <reponame>transclosure/Amalgam<gh_stars>1-10
sig Node { edges: set Node }
// no immediate self loops
run { no edges & iden } for exactly 2 Node expect 0
run { no edges & iden } for exactly 2 Node expect 1
|
aai-traversal/src/main/resources/antlr4/org/onap/aai/dsl/v2/AAIDsl.g4 | onap/aai-traversal | 3 | 2862 | /**
* Define a parser grammar called AAIDsl
*/
grammar AAIDsl;
aaiquery: startStatement limit?;
startStatement: (vertex|unionVertex ) (traversal)* ;
nestedStatement: (traversal)+ ;
vertex: label store? (filter)?;
//traversal: ( vertex|unionVertex edge);
traversal: (edge* (vertex|unionVertex));
filter: (selectFilter)* (propertyFilter)* whereFilter*;
propertyFilter: (not? '(' key (',' (key | num | bool))* ')');
selectFilter: ( '{' key (',' key)* '}');
bool: BOOL;
whereFilter: (not? '(' nestedStatement ')' );
//unionVertex: '[' ( nestedStatement ( comma (nestedStatement))*) ']' store?;
unionVertex: '[' ( (edgeFilter)* nestedStatement ( comma ( (edgeFilter)* nestedStatement))*) ']' store?;
comma: ',';
edge: ( TRAVERSE|DIRTRAVERSE) (edgeFilter)?;
edgeFilter: '(' key (',' key )* ')';
num: NUM;
limit: LIMIT num;
label: (ID | NUM )+;
key: KEY;
store: STORE | selectFilter;
not: NOT;
BOOL: 'true'|'TRUE'|'false'|'FALSE';
LIMIT: 'LIMIT'|'limit';
NUM: (DIGIT)+;
/*NODE: (ID | NUM )+;*/
fragment ESCAPED_QUOTE : '\\' '\'';
KEY : '\'' (ESCAPED_QUOTE | ~[\r\n] )*? '\'';
AND: [&];
STORE: [*];
OR: [|];
DIRTRAVERSE: '>>' | '<<' ;
TRAVERSE: '>' ;
EQUAL: [=];
NOT: [!];
fragment LOWERCASE : [a-z] ;
fragment UPPERCASE : [A-Z] ;
fragment DIGIT : [0-9] ;
fragment ESC : '\\' . ;
fragment ID_SPECIALS: [-:_];
ID
: ( LOWERCASE | UPPERCASE | DIGIT | ID_SPECIALS)
;
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
|
stage2/graphics_line_test_boundaries.asm | amrwc/8086-graphics | 5 | 86495 | ; Prevent drawing beyond boundaries.
;
; Input:
; x0: [bp + 12] -> [bp + x0]
; y0: [bp + 10] -> [bp + y0]
; x1: [bp + 8] -> [bp + x1]
; y1: [bp + 6] -> [bp + y1]
Graphics_Line_Test_Boundaries:
;is_x0_negative:
cmp [bp + x0], word 0
jg is_x0_over_319
je is_x1_negative
mov [bp + x0], word 0
jmp is_x1_negative
is_x0_over_319:
cmp [bp + x0], word 319d
jle is_x1_negative
mov [bp + x0], word 319d
;____________________
is_x1_negative:
cmp [bp + x1], word 0
jg is_x1_over_319
je is_y0_negative
mov [bp + x1], word 0
jmp is_y0_negative
is_x1_over_319:
cmp [bp + x1], word 319d
jle is_y0_negative
mov [bp + x1], word 319d
;____________________
is_y0_negative:
cmp [bp + y0], word 0
jg is_y0_over_199
je is_y1_negative
mov [bp + y0], word 0
jmp is_y1_negative
is_y0_over_199:
cmp [bp + y0], word 199d
jle is_y1_negative
mov [bp + y0], word 199d
;____________________
is_y1_negative:
cmp [bp + y1], word 0
jg is_y1_over_199
je end_test_boundaries
mov [bp + y1], word 0
jmp end_test_boundaries
is_y1_over_199:
cmp [bp + y1], word 199d
jle end_test_boundaries
mov [bp + y1], word 199d
end_test_boundaries:
ret |
alloy4fun_models/trashltl/models/17/ybAk2MjKGwJzJ9ZYL.als | Kaixi26/org.alloytools.alloy | 0 | 559 | <gh_stars>0
open main
pred idybAk2MjKGwJzJ9ZYL_prop18 {
always (
all f : File | f in Protected and f not in Protected' implies f in Trash'
)
}
pred __repair { idybAk2MjKGwJzJ9ZYL_prop18 }
check __repair { idybAk2MjKGwJzJ9ZYL_prop18 <=> prop18o } |
oeis/333/A333991.asm | neoneye/loda-programs | 11 | 4778 | ; A333991: a(n) = Sum_{k=0..n} (-n)^k * binomial(2*n,2*k).
; Submitted by <NAME>
; 1,0,-7,64,-527,3776,-7199,-712704,28545857,-881543168,25615822601,-733594255360,20859188600881,-580152163418112,15048530008948913,-311489672222081024,713562283940993281,511135051171610230784,-48010258775057340355559,3439412411849176925601792,-225582738598174372090499599,14287793594759744654493614080,-892798617012330503809464487807,55544942675575678038695286407168,-3450545745824481476692664137952447,213714581018468204949697378570469376,-13119297271454084960681543683470094039
add $0,1
mov $2,1
mov $3,$0
sub $3,1
mul $3,4
lpb $3
add $1,$2
sub $2,$1
mul $2,$0
add $2,$1
sub $3,2
lpe
mov $0,$2
|
savefile/maps/1F7A_Deliria.asm | stranck/fools2018-1 | 35 | 163150 | <filename>savefile/maps/1F7A_Deliria.asm
SECTION "Map_1F7A", ROM0[$B800]
Map_1F7A_Header:
hdr_tileset 8
hdr_dimensions 4, 4
hdr_pointers_a Map_1F7A_Blocks, Map_1F7A_TextPointers
hdr_pointers_b Map_1F7A_Script, Map_1F7A_Objects
hdr_pointers_c Map_1F7A_InitScript, Map_1F7A_RAMScript
hdr_palette $06
hdr_music MUSIC_PALLET_TOWN, AUDIO_1
hdr_connection NORTH, $0000, 0, 0
hdr_connection SOUTH, $0000, 0, 0
hdr_connection WEST, $0000, 0, 0
hdr_connection EAST, $0000, 0, 0
Map_1F7A_Objects:
hdr_border $0a
hdr_warp_count 2
hdr_warp 3, 7, 5, 4, $1F3A
hdr_warp 2, 7, 5, 4, $1F3A
hdr_sign_count 0
hdr_object_count 2
hdr_object SPRITE_GUARD, 5, 3, STAY, LEFT, $02
hdr_object SPRITE_GUARD, 2, 4, STAY, RIGHT, $01
Map_1F7A_RAMScript:
rs_end
Map_1F7A_Blocks:
db $04,$0e,$05,$09
db $0f,$01,$02,$0f
db $0f,$0c,$0d,$0f
db $06,$0b,$0f,$07
Map_1F7A_TextPointers:
dw Map_1F7A_TX1
dw Map_1F7A_TX2
Map_1F7A_InitScript:
ret
Map_1F7A_Script:
ret
Map_1F7A_TX1:
TX_ASM
jp EnhancedTextOnly
text "Hello. We're in charge of"
next "controlling and monitoring"
cont "the behavior of Deliria's"
cont "inhabitants."
para "If you spend just a few"
next "minutes with them, you'll"
cont "understand that they can't"
cont "be left unattended."
done
Map_1F7A_TX2:
TX_ASM
jp EnhancedTextOnly
text "Because of the mediocre"
next "living conditions in this"
cont "area, many people try to"
cont "escape from Deliria."
para "I'm responsible for"
next "preventing just that."
done
|
src/README.asm | rahlk/MAPGen | 18 | 26380 | # -*- mode: org -*-
#+Title: Automated Evolutionary repair of ASM
1. install oprofile and gdb using your package manager, these are used
to sample execution traces
2. follow the general instillation instructions in README.txt to
install OCaml CIL etc...
3. build the .s assembly file with something like
: gcc -S program.c
4. start oprofile (pass the --no-vmlinux option if needed)
: sudo opcontrol --start
5. repair is run in the same manner as with C level repairs, the
contents of an example configuration file are included below
#+begin_example asm.conf
--program program.s
--pos-tests 5
--neg-tests 1
--allow-coverage-fail
--search ga
--keep-source
--promut 1
--popsize 100
--generations 10
--asm-sample-runs 1000
#+end_example
|
scripts/repeatOff.scpt | BMFirman/j-tunes | 2 | 188 | <filename>scripts/repeatOff.scpt
tell application "iTunes"
set song repeat to off
end |
Transynther/x86/_processed/NONE/_ht_zr_/i9-9900K_12_0xa0_notsx.log_7_1246.asm | ljhsiun2/medusa | 9 | 173917 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x1cf0c, %rsi
lea addresses_D_ht+0x163ec, %rdi
clflush (%rdi)
nop
nop
and $57071, %rdx
mov $46, %rcx
rep movsw
nop
nop
nop
inc %rsi
lea addresses_UC_ht+0x16424, %r10
nop
nop
add $52889, %rcx
mov (%r10), %r12
and $63566, %r12
lea addresses_WT_ht+0x1c48c, %rcx
nop
nop
cmp $9727, %rax
mov $0x6162636465666768, %r12
movq %r12, %xmm2
movups %xmm2, (%rcx)
nop
add $58589, %r12
lea addresses_UC_ht+0x6fcc, %r10
nop
nop
nop
nop
nop
add %rdi, %rdi
mov $0x6162636465666768, %r12
movq %r12, (%r10)
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_normal_ht+0xd88c, %r12
nop
nop
nop
nop
add $28411, %rsi
movups (%r12), %xmm6
vpextrq $1, %xmm6, %rdi
nop
cmp $5232, %r12
lea addresses_WT_ht+0x1c48c, %rax
nop
nop
add %r10, %r10
vmovups (%rax), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r12
nop
xor $5798, %rsi
lea addresses_WT_ht+0x11b8c, %rsi
nop
nop
nop
nop
nop
inc %rcx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
movups %xmm3, (%rsi)
nop
nop
nop
nop
nop
xor $30324, %rsi
lea addresses_D_ht+0x908c, %rsi
add $60138, %rax
movw $0x6162, (%rsi)
nop
nop
nop
nop
nop
sub $30371, %rsi
lea addresses_normal_ht+0x1629c, %rsi
lea addresses_WT_ht+0x1c08c, %rdi
cmp %r12, %r12
mov $122, %rcx
rep movsb
nop
nop
nop
add $57615, %rdi
lea addresses_A_ht+0x19d4c, %rax
nop
nop
cmp %r10, %r10
movups (%rax), %xmm0
vpextrq $1, %xmm0, %r12
nop
nop
sub %r10, %r10
lea addresses_D_ht+0x18954, %rsi
lea addresses_WC_ht+0x100be, %rdi
nop
and %rdx, %rdx
mov $111, %rcx
rep movsq
nop
nop
cmp %r10, %r10
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r15
push %r8
push %rax
push %rsi
// Store
lea addresses_D+0xd88c, %r15
nop
nop
nop
xor $10871, %r8
movb $0x51, (%r15)
nop
nop
nop
nop
and $2690, %r15
// Store
lea addresses_A+0xd88c, %r11
nop
cmp %r13, %r13
movw $0x5152, (%r11)
nop
nop
nop
add %r15, %r15
// Store
mov $0x5e815500000008b0, %rax
nop
nop
nop
nop
sub %r8, %r8
mov $0x5152535455565758, %r15
movq %r15, %xmm6
vmovaps %ymm6, (%rax)
nop
nop
xor $29486, %r8
// Store
lea addresses_WT+0x1988c, %r13
nop
nop
nop
nop
nop
add $20071, %r11
movl $0x51525354, (%r13)
and $13360, %rsi
// Store
lea addresses_RW+0x2122, %rsi
nop
dec %r11
movl $0x51525354, (%rsi)
sub %r14, %r14
// Faulty Load
lea addresses_A+0x208c, %rsi
add %r15, %r15
movups (%rsi), %xmm4
vpextrq $1, %xmm4, %r11
lea oracles, %r8
and $0xff, %r11
shlq $12, %r11
mov (%r8,%r11,1), %r11
pop %rsi
pop %rax
pop %r8
pop %r15
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 1}}
[Faulty Load]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}}
{'46': 1, '44': 4, '00': 2}
44 00 46 44 44 44 00
*/
|
programs/oeis/051/A051201.asm | neoneye/loda | 22 | 173542 | <filename>programs/oeis/051/A051201.asm
; A051201: Sum of elements of the set { [ n/k ] : 1 <= k <= n }.
; 1,3,4,7,8,12,13,15,19,21,22,28,29,31,33,39,40,43,44,51,53,55,56,60,66,68,70,73,74,83,84,87,89,91,93,103,104,106,108,112,113,123,124,127,130,132,133,138,146,149,151,154,155,159,161,172,174,176,177,183,184,186
add $0,1
mov $2,$0
mov $5,$0
lpb $0
mov $3,$2
mov $4,$0
cmp $4,0
add $0,$4
mov $2,$5
div $2,$0
sub $2,1
cmp $3,$2
cmp $3,0
mul $3,$0
sub $0,1
add $1,$3
lpe
mov $0,$1
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-wchstw.ads | orb-zhuchen/Orb | 0 | 12239 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . W C H _ S T W --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the routine used to convert strings to wide (wide)
-- strings for use by wide (wide) image attribute.
with System.WCh_Con;
package System.WCh_StW is
pragma Pure;
procedure String_To_Wide_String
(S : String;
R : out Wide_String;
L : out Natural;
EM : System.WCh_Con.WC_Encoding_Method);
-- This routine simply takes its argument and converts it to wide string
-- format, storing the result in R (1 .. L), with L being set appropriately
-- on return. The caller guarantees that R is long enough to accommodate
-- the result. This is used in the context of the Wide_Image attribute,
-- where the argument is the corresponding 'Image attribute. Any wide
-- character escape sequences in the string are converted to the
-- corresponding wide character value. No syntax checks are made, it is
-- assumed that any such sequences are validly formed (this must be assured
-- by the caller), and results from the fact that Wide_Image is only used
-- on strings that have been built by the compiler, such as images of
-- enumeration literals. If the method for encoding is a shift-in,
-- shift-out convention, then it is assumed that normal (non-wide
-- character) mode holds at the start and end of the argument string. EM
-- indicates the wide character encoding method.
-- Note: in the WCEM_Brackets case, the brackets escape sequence is used
-- only for codes greater than 16#FF#.
procedure String_To_Wide_Wide_String
(S : String;
R : out Wide_Wide_String;
L : out Natural;
EM : System.WCh_Con.WC_Encoding_Method);
-- Same function with Wide_Wide_String output
end System.WCh_StW;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.