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 |
|---|---|---|---|---|
libsrc/_DEVELOPMENT/math/float/math48/c/sdcc_ix/cm48_sdccix_log10.asm | meesokim/z88dk | 0 | 22086 | <reponame>meesokim/z88dk<gh_stars>0
; float log10(float x)
SECTION code_fp_math48
PUBLIC cm48_sdccix_log10
EXTERN cm48_sdccix_log10_fastcall
cm48_sdccix_log10:
pop af
pop hl
pop de
push de
push hl
push af
jp cm48_sdccix_log10_fastcall
|
oeis/180/A180969.asm | neoneye/loda-programs | 11 | 162127 | <filename>oeis/180/A180969.asm<gh_stars>10-100
; A180969: Array read by antidiagonals: a(k,n) = natural numbers each repeated 2^k times.
; Submitted by <NAME>(s2)
; 0,1,0,2,0,0,3,1,0,0,4,1,0,0,0,5,2,0,0,0,0,6,2,1,0,0,0,0,7,3,1,0,0,0,0,0,8,3,1,0,0,0,0,0,0,9,4,1,0,0,0,0,0,0,0,10,4,2,0,0,0,0,0,0,0,0,11,5,2,1,0,0,0,0,0,0,0,0,12,5,2,1,0,0,0,0,0,0,0,0,0,13,6,2,1,0,0,0,0,0
lpb $0
add $1,1
sub $0,$1
lpe
sub $1,$0
lpb $0
sub $0,1
div $1,2
lpe
mov $0,$1
|
theorems/cw/cohomology/TipGrid.agda | mikeshulman/HoTT-Agda | 0 | 2211 | <reponame>mikeshulman/HoTT-Agda<gh_stars>0
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import cohomology.Theory
open import groups.Cokernel
open import groups.Exactness
open import groups.HomSequence
open import groups.ExactSequence
open import cw.CW
module cw.cohomology.TipGrid {i} (OT : OrdinaryTheory i)
(⊙skel : ⊙Skeleton {i} 1) (ac : ⊙has-cells-with-choice 0 ⊙skel i) where
open OrdinaryTheory OT
open import cw.cohomology.Descending OT
open import cw.cohomology.WedgeOfCells OT ⊙skel
open import cw.cohomology.TipAndAugment OT (⊙cw-init ⊙skel)
open import cw.cohomology.TipCoboundary OT ⊙skel
import cohomology.LongExactSequence
{-
X₀ --> X₁
| |
v v
1 -> X₁/X₀
-}
private
module LES n = cohomology.LongExactSequence cohomology-theory n (⊙cw-incl-last ⊙skel)
Ker-cw-co∂-head' : C 0 ⊙⟦ ⊙skel ⟧ ≃ᴳ Ker cw-co∂-head'
Ker-cw-co∂-head' = Exact2.G-trivial-implies-H-iso-ker
(exact-seq-index 2 $ LES.C-cofiber-exact-seq -1)
(exact-seq-index 0 $ LES.C-cofiber-exact-seq 0)
(CXₙ/Xₙ₋₁-<-is-trivial ltS ac)
{- NOT USED
Ker-cw-co∂-head : G ×ᴳ C 0 ⊙⟦ ⊙skel ⟧ ≃ᴳ Ker cw-co∂-head
Ker-cw-co∂-head = lemma ∘eᴳ ×ᴳ-emap (idiso G) Ker-cw-co∂-head' where
lemma : G ×ᴳ Ker.grp cw-co∂-head' ≃ᴳ Ker.grp cw-co∂-head
lemma = group-hom (λ{(g , (h , is-ker)) → ((g , h) , is-ker)})
(λ _ _ → Subtype=-out (Ker.subEl-prop cw-co∂-head) idp) ,
is-eq _ (λ{((g , h) , is-ker) → (g , (h , is-ker))}) (λ _ → idp) (λ _ → idp)
-}
private
-- separate lemmas to speed up the type checking
abstract
lemma-exact₀ : is-exact (C-fmap 1 (⊙cfcod' (⊙cw-incl-last ⊙skel)))
(C-fmap 1 (⊙cw-incl-last ⊙skel))
lemma-exact₀ = exact-seq-index 2 $ LES.C-cofiber-exact-seq 0
lemma-trivial : is-trivialᴳ (C 1 (⊙cw-head ⊙skel))
lemma-trivial = CX₀-≠-is-trivial (pos-≠ (ℕ-S≠O 0))
(⊙init-has-cells-with-choice ⊙skel ac)
Coker-cw-co∂-head : CokerCo∂Head.grp ≃ᴳ C 1 ⊙⟦ ⊙skel ⟧
Coker-cw-co∂-head = Exact2.L-trivial-implies-coker-iso-K
co∂-head-incl-exact lemma-exact₀ CX₁/X₀-is-abelian lemma-trivial
|
src/vms_fortran/parser/FortranParser.g4 | GitMensch/vms-ide | 0 | 1351 | <reponame>GitMensch/vms-ide<filename>src/vms_fortran/parser/FortranParser.g4<gh_stars>0
parser grammar FortranParser;
options
{ tokenVocab = FortranLexer; }
program
: eos? programUnit+
;
programUnit
: mainProgram
| functionSubprogram
| subroutineSubprogram
| moduleBlock
| blockDataSubprogramBlock
| optionsStatement
;
optionsStatement
: OPTIONS (DIV identifier (TO_ASSIGN identifier)?)+ eos
;
mainProgram
: programStatement? mainRange
;
mainRange
: body (endProgramStatement | EOF)
| endProgramStatement
;
bodyConstruct
: specificationPartConstruct
| executableConstruct
| internalSubprogramPart
;
body
: bodyConstruct+
;
specificationPartConstruct
: implicitStatement
| parameterStatement
| formatStatement
| entryStatement
| declarationConstruct
| includeStatement
| dictionaryStatement
| useStatement
;
declarationConstruct
: typeDeclarationStatement
| specificationStatement
| derivedTypeDef
| interfaceBlock
| structureBlock
| recordBlock
| unionBlock
;
executionPartConstruct
: executableConstruct
| formatStatement
| dataStatement
| entryStatement
;
specificationStatement
: accessStatement
| allocatableStatement
| commonStatement
| dataStatement
| dimensionStatement
| equivalenceStatement
| externalStatement
| intrinsicStatement
| saveStatement
| intentStatement
| namelistStatement
| optionalStatement
| pointerStatement
| targetStatement
;
internalSubprogram
: functionSubprogram
| subroutineSubprogram
;
internalSubprogramPart
: containsStatement internalSubprogram+
;
executableConstruct
: actionStatement
| doConstruct
| ifConstruct
| caseConstruct
| whereConstruct
| endDoStatement
| execSqlStatement
;
actionStatement
: allocateStatement
| cycleStatement
| deallocateStatement
| exitStatement
| nullifyStatement
| pointerAssignmentStatement
| whereStatement
| arithmeticIfStatement
| assignmentStatement
| assignStatement
| backspaceStatement
| callStatement
| closeStatement
| continueStatement
| endfileStatement
| defineFileStatement
| gotoStatement
| computedGotoStatement
| assignedGotoStatement
| ifStatement
| inquireStatement
| openStatement
| pauseStatement
| printStatement
| readStatement
| returnStatement
| rewindStatement
| stmtFunctionStatement
| stopStatement
| writeStatement
| deleteStatement
| acceptStatement
| encodeDecodeStatement
| findStatement
;
definedOperator
: powerOp
| multOp
| addOp
| concatOp
| relOp
| notOp
| andOp
| orOp
| equivOp
;
eos
: EOS+
;
intConst
: I_CONST
;
label
: I_CONST
;
identifier
: IDENTIFIER
| IN
| OUT
| STAT
| LOGICAL
| KIND
| LEN
| FMT
| NML
| REC
| ADVANCE
| SIZE
| EOR
| UNIT
| ERR
| IOSTAT
| LET
| PRECISION
| IOSTART
| SEQUENTIAL
| DIRECT
| FILE
| STATUS
| ACCESS
| POSITION
| ACTION
| DELIM
| PAD
| FORM
| RECL
| BLANK
| EXIST
| OPENED
| NUMBER
| NAMED
| NAME
| TITLE
| FORMATTED
| UNFORMATTED
| NEXTREC
| READWRITE
| IOLENGTH
| ASSOCIATEVARIABLE
| BLOCKSIZE
| BUFFERCOUNT
| BUFFERED
| CARRIAGECONTROL
| CONVERT
| DEFAULTFILE
| DISPOSE
| DISP
| EXTENDSIZE
| INITIALSIZE
| KEY
| KEYID
| KEYEQ
| KEYGE
| KEYLE
| KEYGT
| KEYLT
| KEYNXT
| KEYNXTNE
| ASCENDING
| DESCENDING
| KEYED
| MAXREC
| NOSPANBLOCKS
| ORGANIZATION
| RECORDTYPE
| SHARED
// | PROGRAM
// | MODULE
// | INCLUDE
// | DICTIONARY
// | USE
| ONLY
| ENTRY
| TYPE
// | STRUCTURE
| RECORD
| PRIVATE
| PUBLIC
| SEQUENCE
// | FUNCTION
// | BLOCK
// | SUBROUTINE
// | PROCEDURE
// | END
| DIMENSION
| REAL
| EQUIVALENCE
| OPERATOR
| ASSIGNMENT
| ALLOCATE
| DEALLOCATE
| NULLIFY
// | COMMON
| POINTER
// | INTEGER
// | BYTE
| IMPLICIT
| NONE
| NAMELIST
// | CHARACTER
| PARAMETER
| ALLOCATABLE
| INTENT
| OPTIONAL
| EXTERNAL
| INTRINSIC
| INTERFACE
| SAVE
| TARGET
| DATA
| ASSIGN
// | GO
// | TO
// | GOTO
// | WHERE
// | ELSEWHERE
// | SELECT
// | CASE
// | SELECTCASE
// | DEFAULT
// | IF
// | THEN
// | ELSE
// | ENDIF
// | ELSEIF
// | DO
// | WHILE
| CYCLE
| EXIT
// | CONTINUE
// | STOP
// | ENDDO
// | PAUSE
// | WRITE
// | REWRITE
// | READ
// | PRINT
// | OPEN
| FORMAT
//| CALL
| CONTAINS
| RESULT
| RECURSIVE
//| RETURN
//| CLOSE
// | DOUBLE
// | COMPLEX
| INQUIRE
| BACKSPACE
| ENDFILE
| REWIND
| DELETE
| UNLOCK
| DESCR
| REF
| VAL
| LOC
;
formatStatement
: label? FORMAT LPAREN formatItemList? RPAREN eos
;
formatItemList
: formatItem (COMMA formatItem)*
;
formatItem
: formatEdit
| formatsep
| formatsep formatEdit
| formatItem formatsep
| formatItem formatsep formatEdit
| formatEdit LPAREN formatItemList RPAREN
;
formatEdit
: editElement
| I_CONST editElement
| X_CONST
| P_CONST
| P_CONST editElement
| P_CONST I_CONST editElement
| BACKSLASH
;
editElement
: F_CONST
| mislexedFcon
| S_CONST
| H_CONST
| identifier
| LPAREN formatItemList RPAREN
;
mislexedFcon
: R_CONST R_CONST //% 2E15 .5
| identifier R_CONST // % E15 .5
;
formatsep
: DIV | CONCAT | COLON
;
programStatement
: label? PROGRAM programName eos
;
endProgramStatement
: label? END eos
| label? END PROGRAM endName? eos
;
moduleBlock
: moduleStatement moduleBody endModuleStatement
| moduleStatement endModuleStatement
;
moduleBody
: specificationPartConstruct
| internalSubprogramPart
| moduleBody specificationPartConstruct
| moduleBody internalSubprogramPart
;
moduleStatement
: label? MODULE moduleName eos
;
name
: identifier
;
letterName
: identifier
;
arrayName
: identifier
;
componentName
: identifier
;
genericName
: identifier
;
namelistGroupName
: identifier
;
typeName
: identifier
;
endName
: identifier
;
commonBlockName
: identifier
;
dummyArgName
: identifier
;
entryName
: identifier
;
externalName
: (STAR)? identifier
;
functionName
: identifier
;
impliedDoVariable
: identifier
;
intrinsicProcedureName
: identifier
;
objectName
: identifier
| FILL
;
programName
: identifier
;
sFDummyArgName
: identifier
;
subroutineName
: identifier
;
subroutineNameUse
: identifier
;
procedureName
: identifier
;
variableName
: identifier
;
moduleName
: identifier
;
useName
: identifier
;
blockDataName
: identifier
;
namedConstant
: identifier
;
namedConstantUse
: identifier
;
ifConstructName
: identifier
;
endModuleStatement
: label? END eos
| label? END MODULE endName? eos
;
includeStatement
: INCLUDE S_CONST eos
;
dictionaryStatement
: DICTIONARY S_CONST eos
;
useStatement
: label? USE name ( COMMA renameList )? eos
| label? USE name COMMA ONLY COLON onlyList? eos
;
renameList
: rename (COMMA rename)*
;
onlyList
: only (COMMA only)*
;
rename
: identifier ARROW useName
;
only
: genericSpec
| ( identifier ARROW )? useName
;
blockDataSubprogramBlock
: blockDataStatement blockDataBody endBlockDataStatement
| blockDataStatement endBlockDataStatement
;
blockDataBody
: blockDataBodyConstruct+
;
blockDataBodyConstruct
: specificationPartConstruct
;
blockDataStatement
: label? BLOCK DATA blockDataName? eos
;
endBlockDataStatement
: label? END BLOCK DATA endName? eos
| label? END eos
;
interfaceBlock
: interfaceStatement interfaceBlockPart+ endInterfaceStatement
;
interfaceBlockPart
: interfaceBody
| moduleProcedureStatement
;
interfaceStatement
: label? INTERFACE genericName eos
| label? INTERFACE genericSpec eos
| label? INTERFACE eos
;
endInterfaceStatement
: label? END INTERFACE eos
;
interfaceBody
: label? functionPrefix functionName functionInterfaceRange
| label? SUBROUTINE subroutineName subroutineInterfaceRange
;
functionInterfaceRange
: functionParList eos subprogramInterfaceBody endFunctionStatement
| functionParList eos endFunctionStatement
;
subroutineInterfaceRange
: subroutineParList eos subprogramInterfaceBody endSubroutineStatement
| subroutineParList eos endSubroutineStatement
;
subprogramInterfaceBody
: specificationPartConstruct
| subprogramInterfaceBody specificationPartConstruct
;
structureBlock
: structureStatement structureBlockPart+ endStructureStatement
;
structureBlockPart
: structureBody
;
structureStatement
: label? STRUCTURE DIV genericName DIV (typeStatementName)? eos
;
typeStatementName
: identifier
| arrayDeclarator
;
endStructureStatement
: label? END STRUCTURE eos
;
structureBody
: declarationConstruct
;
recordBlock
: recordStatement
;
recordStatement
: label? RECORD DIV genericName DIV (typeStatementName (COMMA typeStatementName)*) eos
;
unionBlock
: unionStatement unionBlockPart+ endUnionStatement
;
unionStatement
: label? UNION eos
;
unionBlockPart
: mapBlock
;
endUnionStatement
: label? END UNION eos
;
mapBlock
: mapStatement mapBlockPart+ endMapStatement
;
mapStatement
: label? MAP eos
;
mapBlockPart
: typeDeclarationStatement
| specificationStatement
| derivedTypeDef
| interfaceBlock
| structureBlock
| recordBlock
;
endMapStatement
: label? END MAP eos
;
moduleProcedureStatement
: label? MODULE PROCEDURE procedureNameList eos
;
procedureNameList
: procedureName (COMMA procedureName)*
;
genericSpec
: OPERATOR LPAREN definedOperator RPAREN
| ASSIGNMENT LPAREN TO_ASSIGN RPAREN
;
externalStatement
: label? EXTERNAL externalName (COMMA externalName)* eos
;
intrinsicStatement
: label? INTRINSIC intrinsicProcedureName (COMMA intrinsicProcedureName)* eos
;
functionReference
: name LPAREN functionArgList? RPAREN
;
callStatement
: label? CALL subroutineNameUse eos
| label? CALL subroutineNameUse LPAREN (actualArg? (COMMA actualArg?)*) RPAREN eos
;
actualArg
: (name TO_ASSIGN)? expr
| (name TO_ASSIGN)? STAR lblRef
;
functionArgList
: functionArg
| functionArgList COMMA functionArg
| sectionSubscriptList COMMA functionArg
;
functionArg
: name TO_ASSIGN expr
;
functionSubprogram
: label? functionDeclaration eos functionBody
;
functionDeclaration
: functionPrefix functionName functionParList
| functionPrefix functionName functionParList RESULT LPAREN name RPAREN
;
functionBody
: body? endFunctionStatement
;
functionPrefix
: RECURSIVE FUNCTION
| RECURSIVE typeSpec FUNCTION
| typeSpec RECURSIVE FUNCTION
| typeSpec? FUNCTION
;
endFunctionStatement
: label? END eos
| label? END FUNCTION endName? eos
;
subroutineSubprogram
: label? subroutineDeclaration eos subroutineBody
;
subroutineDeclaration
: RECURSIVE? SUBROUTINE subroutineName subroutineParList?
;
subroutineBody
: body? endSubroutineStatement
;
subroutineStatement
: label? SUBROUTINE name subroutineParList? eos
;
subroutineParList
: LPAREN (subroutinePar (COMMA subroutinePar)*)? RPAREN
;
subroutinePar
: dummyArgName
| STAR
;
functionParList
: (LPAREN (functionPar (COMMA functionPar)*)? RPAREN)?
;
functionPar
: dummyArgName
| STAR
;
endSubroutineStatement
: label? END SUBROUTINE endName? eos
| label? END eos
;
entryStatement
: label? ENTRY entryName (subroutineParList)? eos
| label? ENTRY entryName (subroutineParList)? RESULT LPAREN name RPAREN eos
;
returnStatement
: label? RETURN expr? eos
;
containsStatement
: label? CONTAINS eos
;
// %% statement-functions are obsolete in fortran 95.
// %% FOO(NOARG) = IN2-IN3
stmtFunctionStatement
: label? name LPAREN sFDummyArgNameList? RPAREN TO_ASSIGN expr eos
;
sFDummyArgNameList
: sFDummyArgName (COMMA sFDummyArgName)*
;
unsignedArithmeticConstant
: intConst DOWN_LINE kindParam
| R_CONST DOWN_LINE kindParam
| intConst
| R_CONST
| complexConst
;
kindParam
: intConst
| namedConstantUse
;
constant
: namedConstantUse
| unsignedArithmeticConstant
| PLUS unsignedArithmeticConstant
| MINUS unsignedArithmeticConstant
| S_CONST
| logicalConstant
| intConst DOWN_LINE S_CONST
| namedConstantUse DOWN_LINE S_CONST
| structureConstructor
| bozLiteralConstant
| H_CONST
;
bozLiteralConstant
: B_CONST
| O_CONST
| Z_CONST
;
logicalConstant
: TRUE DOWN_LINE kindParam
| FALSE DOWN_LINE kindParam
| TRUE | FALSE
;
derivedTypeDef
: derivedTypeStatement derivedTypeBody+ endTypeStatement
;
derivedTypeBody
: privateSequenceStatement
| componentDefStatement
;
privateSequenceStatement
: label? PRIVATE eos
| label? SEQUENCE eos
;
derivedTypeStatement
: label? TYPE typeName eos
| label? TYPE COLON COLON typeName eos
| label? TYPE COMMA accessSpec COLON COLON typeName eos
;
endTypeStatement
: label? END TYPE typeName? eos
;
componentDefStatement
: label? typeSpec ( COMMA componentAttrSpecList )? COLON COLON componentDeclList eos
| label? typeSpec componentDeclList eos
;
componentAttrSpecList
: componentAttrSpec (COMMA componentAttrSpec)*
;
componentAttrSpec
: POINTER
| DIMENSION LPAREN componentArraySpec RPAREN
;
componentArraySpec
: explicitShapeSpecList
| deferredShapeSpecList
| intConst
;
componentDecl
: componentName (LPAREN componentArraySpec RPAREN)? (STAR charLength)?
| pointerAssignmentItem
;
componentDeclList
: componentDecl (COMMA componentDecl)*
;
structureConstructor
: typeName LPAREN (expr (COMMA expr)*)? RPAREN
;
arrayConstructor
: LPAREN DIV acValueList DIV RPAREN
;
acValue
: expr
| acImpliedDo
;
acValueList
: acValue (COMMA acValue)*
;
acImpliedDo
: LPAREN expr COMMA impliedDoVariable TO_ASSIGN expr COMMA expr RPAREN
| LPAREN expr COMMA impliedDoVariable TO_ASSIGN expr COMMA expr COMMA expr RPAREN
| LPAREN acImpliedDo COMMA impliedDoVariable TO_ASSIGN expr COMMA expr RPAREN
| LPAREN acImpliedDo COMMA impliedDoVariable TO_ASSIGN expr COMMA expr COMMA expr RPAREN
;
typeDeclarationStatement
: label? typeSpec (COMMA attrSpec)* COLON COLON entityDecl (COMMA entityDecl)* eos
| label? typeSpec entityDecl (COMMA entityDecl)* eos
;
typeSpec
: INTEGER kindSelector?
| REAL kindSelector?
| BYTE
| DOUBLE PRECISION
| DOUBLE COMPLEX
| COMPLEX kindSelector?
| CHARACTER charSelector?
| LOGICAL kindSelector?
| TYPE LPAREN typeName RPAREN
| CHARACTER lengthSelector
| VARCHAR kindSelector?
;
attrSpec
: PARAMETER
| accessSpec
| ALLOCATABLE
| DIMENSION LPAREN arraySpec RPAREN
| EXTERNAL
| INTENT LPAREN intentSpec RPAREN
| INTRINSIC
| OPTIONAL
| POINTER
| SAVE
| TARGET
;
entityDecl
: objectName TO_ASSIGN expr
| objectName DIV expr DIV
| objectName LPAREN arraySpec RPAREN TO_ASSIGN expr
| objectName STAR charLength TO_ASSIGN expr
| objectName STAR charLength LPAREN arraySpec RPAREN TO_ASSIGN expr
| objectName
| objectName STAR charLength
| objectName LPAREN arraySpec RPAREN
| objectName LPAREN arraySpec RPAREN STAR charLength
| objectName LPAREN arraySpec RPAREN DIV expr (COMMA expr)* DIV
| pointerAssignmentItem
;
kindSelector
: LPAREN (TARGET TO_ASSIGN)? expr RPAREN
| STAR intConst
;
charSelector
: LPAREN LEN TO_ASSIGN typeParamValue COMMA TARGET TO_ASSIGN expr RPAREN
| LPAREN LEN TO_ASSIGN typeParamValue COMMA expr RPAREN
| LPAREN LEN TO_ASSIGN typeParamValue RPAREN
| LPAREN (TARGET TO_ASSIGN)? expr RPAREN
;
lengthSelector
: LPAREN typeParamValue RPAREN
| STAR charLength
;
charLength
: LPAREN typeParamValue RPAREN
| intConst
;
typeParamValue
: specificationExpr | STAR
;
accessSpec
: PUBLIC
| PRIVATE
;
intentSpec
: IN
| OUT
| IN OUT
;
arraySpec
: assumedShapeSpecList
| deferredShapeSpecList
| explicitShapeSpecList
| assumedSizeSpec
| intConst
;
explicitShapeSpecList
: explicitShapeSpec (COMMA explicitShapeSpec)*
;
explicitShapeSpec
: (lowerBound COLON)? upperBound
;
lowerBound
: specificationExpr
;
upperBound
: specificationExpr
;
assumedShapeSpec
: lowerBound? COLON
;
assumedShapeSpecList
: lowerBound COLON
| deferredShapeSpecList COMMA lowerBound COLON
| assumedShapeSpecList COMMA assumedShapeSpec
;
deferredShapeSpecList
: deferredShapeSpec (COMMA deferredShapeSpec)*
;
deferredShapeSpec
: COLON
;
assumedSizeSpec
: (lowerBound COLON)? STAR
| explicitShapeSpecList COMMA STAR
| explicitShapeSpecList COMMA lowerBound COLON STAR
;
intentStatement
: label? INTENT LPAREN intentSpec RPAREN COLON COLON intentParList eos
| label? INTENT LPAREN intentSpec RPAREN intentParList eos
;
intentParList
: intentPar (COMMA intentPar)*
;
intentPar
: dummyArgName
;
optionalStatement
: label? OPTIONAL COLON COLON optionalParList eos
| label? OPTIONAL optionalParList eos
;
optionalParList
: optionalPar (COMMA optionalPar)*
;
optionalPar
: dummyArgName
;
accessStatement
: label? accessSpec COLON COLON accessIdList eos
| label? accessSpec accessIdList? eos
;
accessIdList
: accessId (COMMA accessId)*
;
accessId
: genericName
| genericSpec
;
saveStatement
: label? SAVE COLON COLON savedEntityList eos
| label? SAVE savedEntityList? eos
;
savedEntityList
: savedEntity (COMMA savedEntity)*
;
savedEntity
: variableName
| DIV commonBlockName DIV
;
dimensionStatement
: label? (DIMENSION | VIRTUAL) COLON COLON arrayDeclaratorList eos
| label? (DIMENSION | VIRTUAL) arrayDeclaratorList eos
;
arrayDeclaratorList
: arrayDeclarator (COMMA arrayDeclarator)*
;
arrayDeclarator
: variableName LPAREN arraySpec RPAREN
;
allocatableStatement
: label? ALLOCATABLE COLON COLON arrayAllocationList eos
| label? ALLOCATABLE arrayAllocationList eos
;
arrayAllocationList
: arrayAllocation (COMMA arrayAllocation)*
;
arrayAllocation
: arrayName ( LPAREN deferredShapeSpecList RPAREN )?
;
pointerStatement
: label? POINTER COLON COLON pointerStatementObjectList eos
| label? POINTER pointerStatementObjectList eos
;
pointerStatementObjectList
: pointerStatementObject (COMMA pointerStatementObject)*
;
pointerStatementObject
: objectName
| objectName LPAREN deferredShapeSpecList RPAREN
| pointerAssignmentItem
| LPAREN objectName COMMA objectName RPAREN
;
targetStatement
: label? TARGET COLON COLON targetObjectList eos
| label? TARGET targetObjectList eos
;
targetObjectList
: targetObject (COMMA targetObject)*
;
targetObject
: objectName
| objectName LPAREN arraySpec RPAREN
;
dataStatement
: label? DATA datalist eos
;
datalist
: dataStatementSet (COMMA dataStatementSet)*
;
dataStatementSet
: dataStatementObjectList DIV dataStatementValueList DIV
;
dataStatementObjectList
: dataStatementObject (COMMA dataStatementObject)*
;
dataStatementObject
: variable
| dataImpliedDo
;
dataStatementValueList
: dataStatementValue (COMMA dataStatementValue)*
;
dataStatementValue
: constant
| namedConstantUse STAR constant
| constant STAR constant
;
dataImpliedDo
: LPAREN dataIDoObjectList COMMA impliedDoVariable TO_ASSIGN expr COMMA expr (COMMA expr)? RPAREN
;
dataIDoObjectList
: dataIDoObject (COMMA dataIDoObject)*
;
dataIDoObject
: arrayElement
| dataImpliedDo
| structureComponent
;
parameterStatement
: label? PARAMETER LPAREN namedConstantDefList RPAREN eos
| label? PARAMETER namedConstantDefList eos
;
namedConstantDefList
: namedConstantDef (COMMA namedConstantDef)*
;
namedConstantDef
: namedConstant TO_ASSIGN expr
;
implicitStatement
: label? implicitBody eos
;
implicitBody
: IMPLICIT NONE
| IMPLICIT implicitSpec (COMMA implicitSpec)*
;
implicitSpec
: typeSpec LPAREN letterSpec (COMMA letterSpec)* RPAREN
;
letterSpec
: letterName ( MINUS letterName )?
;
// %% todo: Use SDF notation.
// %% label? NAMELIST NamelistGroups eos -> NamelistStatement
// %% DIV namelistGroupName DIV NamelistGroupObject -> NamelistGroups
// %% NamelistGroups COMMA? DIV namelistGroupName DIV NamelistGroupObject -> NamelistGroups
// %% NamelistGroups COMMA NamelistGroupObject -> NamelistGroups
namelistStatement
: label? NAMELIST namelistGroup ( COMMA? namelistGroup)* eos
;
namelistGroup
: DIV namelistGroupName DIV namelistGroupObject (COMMA namelistGroupObject)*
;
namelistGroupObject
: variableName
;
equivalenceStatement
: label? EQUIVALENCE equivalenceSetList eos
;
equivalenceSetList
: equivalenceSet (COMMA equivalenceSet)*
;
equivalenceSet
: LPAREN equivalenceObject (COMMA equivalenceObject)* RPAREN
;
equivalenceObject
: arrayName
| variable
;
commonStatement
: label? COMMON comblock? commonBlockObjectList (COMMA? comblock commonBlockObjectList)* eos
;
comblock
: DIV commonBlockName? DIV
;
commonBlockObject
: variableName
| arrayDeclarator
;
commonBlockObjectList
: commonBlockObject (COMMA commonBlockObject)*
;
scalarVariable
: variableName | arrayElement
;
variable
: variableName
| variableName LPAREN subscript (COMMA subscript)* RPAREN
| variableName substringRange
| variableName LPAREN subscript (COMMA subscript)* RPAREN substringRange
;
subscript
: expr
;
dataRef
: name (PERCENT | DOT) name
| dataRef (PERCENT | DOT) name
| name LPAREN sectionSubscriptList RPAREN
| dataRef LPAREN sectionSubscriptList RPAREN
;
sectionSubscriptList
: sectionSubscript? (COMMA sectionSubscript?)*
;
sectionSubscript
: expr
| subscriptTriplet
;
substringRange
: LPAREN subscriptTriplet RPAREN
;
structureComponent
: variableName fieldSelector
| structureComponent fieldSelector
;
fieldSelector
: LPAREN sectionSubscriptList RPAREN (PERCENT | DOT) name
| (PERCENT | DOT) name
;
arrayElement
: structureComponent LPAREN sectionSubscriptList RPAREN
| variableName LPAREN sectionSubscriptList RPAREN
;
subscriptTriplet
: expr? COLON expr? (COLON expr)?
;
allocateStatement
: label? ALLOCATE LPAREN allocationList COMMA STAT TO_ASSIGN variable RPAREN eos
| label? ALLOCATE LPAREN allocationList RPAREN eos
;
allocationList
: allocation (COMMA allocation)*
;
allocation
: allocateObject allocatedShape?
;
allocatedShape
: LPAREN sectionSubscriptList RPAREN
;
allocateObjectList
: allocateObject (COMMA allocateObject)*
;
allocateObject
: variableName
| allocateObject fieldSelector
;
allocateShapeSpec
: (expr COLON)+
;
nullifyStatement
: label? NULLIFY LPAREN pointerObjectList RPAREN eos
;
pointerObjectList
: pointerObject (COMMA pointerObject)*
;
pointerObject
: name
| pointerField
;
pointerField
: name LPAREN sFExprList RPAREN (PERCENT | DOT) name
| name LPAREN sFDummyArgNameList RPAREN (PERCENT | DOT) name
| name (PERCENT | DOT) name
| pointerField fieldSelector
;
deallocateStatement
: label? DEALLOCATE LPAREN allocateObjectList COMMA STAT TO_ASSIGN variable RPAREN eos
| label? DEALLOCATE LPAREN allocateObjectList RPAREN eos
;
uFExpr
: uFTerm
| sign uFTerm
| uFExpr addOp uFTerm
;
uFTerm
: uFFactor
| uFTerm multOp uFFactor
| uFTerm concatOp uFPrimary
;
uFFactor
: uFPrimary
| uFPrimary powerOp uFFactor
;
uFPrimary
: intConst
| S_CONST
| H_CONST
| name
| functionReference
| dataRef
| LPAREN uFExpr RPAREN
;
cExpr
: cPrimary (concatOp cPrimary)?
;
cPrimary
: cOperand
| LPAREN cExpr RPAREN
;
cOperand
: S_CONST
| name
| dataRef
| functionReference
| H_CONST
;
complexConst
: LPAREN expr COMMA expr RPAREN
;
primary
: arrayConstructor
| unsignedArithmeticConstant
| name
| dataRef
| functionReference
| LPAREN expr RPAREN
| S_CONST
| logicalConstant
| H_CONST
| constant
;
level1Expr
: primary
;
multOperand
: level1Expr (powerOp multOperand)?
;
addOperand
: multOperand (multOp multOperand)*
;
level2Expr
: sign? addOperand (addOp addOperand)*
;
powerOp
: POWER
;
multOp
: STAR | DIV
;
addOp
: PLUS | MINUS
;
sign
: PLUS | MINUS
;
level3Expr
: level2Expr (concatOp level2Expr)*
;
concatOp
: CONCAT
;
level4Expr
: level3Expr (relOp level3Expr)*
;
relOp
: EQUAL | NOT_EQUAL | LESS | LESS_EQUAL | MORE_ | MORE_EQUAL
| EQ | NE | LT | LE | GT | GE
;
andOperand
: notOp? level4Expr
;
orOperand
: andOperand (andOp andOperand)*
;
equivOperand
: orOperand (orOp orOperand)*
;
level5Expr
: equivOperand (equivOp equivOperand)*
;
notOp
: LNOT
;
andOp
: LAND
;
orOp
: LOR
;
equivOp
: EQV | NEQV
;
expr
: level5Expr
;
specificationExpr
: expr
;
assignmentStatement
: label? name (PERCENT | DOT) name TO_ASSIGN expr eos
| label? name (PERCENT | DOT) dataRef TO_ASSIGN expr eos
| label? name LPAREN sFExprList RPAREN (PERCENT | DOT) name TO_ASSIGN expr eos
| label? name LPAREN sFExprList RPAREN (PERCENT | DOT) dataRef TO_ASSIGN expr eos
| label? name LPAREN sFDummyArgNameList RPAREN (PERCENT | DOT) name TO_ASSIGN expr eos
| label? name LPAREN sFDummyArgNameList RPAREN (PERCENT | DOT) dataRef TO_ASSIGN expr eos
| label? name TO_ASSIGN expr eos
| label? name LPAREN sFExprList RPAREN TO_ASSIGN expr eos
| label? name LPAREN sFExprList RPAREN substringRange TO_ASSIGN expr eos
;
sFExprList
: sFExpr COLON expr COLON expr
| sFExpr COLON COLON expr
| COLON expr COLON expr
| COLON COLON expr
| COLON
| COLON expr
| sFExpr
| sFExpr COLON
| sFExpr COLON expr
| sFExprList COMMA sectionSubscript
| sFDummyArgNameList COMMA COLON
| sFDummyArgNameList COMMA COLON expr
| sFDummyArgNameList COMMA sFExpr COLON
| sFDummyArgNameList COMMA sFExpr COLON expr
;
sFExpr
: sFTerm
| sign addOperand
| sFExpr addOp addOperand
;
sFTerm
: sFFactor
| sFTerm multOp multOperand
;
sFFactor
: sFPrimary
| sFPrimary powerOp multOperand
;
sFPrimary
: intConst
| arrayConstructor
| name
| dataRef
| functionReference
| LPAREN expr RPAREN
;
pointerAssignmentStatement
: pointerAssignmentItem eos
;
pointerAssignmentItem
: label? name ARROW target
| label? name (PERCENT | DOT) name ARROW target
| label? name (PERCENT | DOT) dataRef ARROW target
| label? name LPAREN sFExprList RPAREN (PERCENT | DOT) name ARROW target
| label? name LPAREN sFExprList RPAREN (PERCENT | DOT) dataRef ARROW target
| label? name LPAREN sFDummyArgNameList RPAREN (PERCENT | DOT) name ARROW target
| label? name LPAREN sFDummyArgNameList RPAREN (PERCENT | DOT) dataRef ARROW target
;
target
: expr
;
whereStatement
: label? WHERE LPAREN maskExpr RPAREN assignmentStatement
;
// %%R739
// %% todo: sdf-fy
// %% Where EndWhereStatement -> WhereConstruct
// %% ElseWhere EndWhereStatement -> WhereConstruct
// %% WhereConstructStatement -> Where
// %% Where assignmentStatement -> Where
// %% Where ElsewhereStatement -> ElseWhere
// %% ElseWhere assignmentStatement -> ElseWhere
whereConstruct
: whereConstructStatement assignmentStatement* (elsewhereStatement assignmentStatement*)? endWhereStatement
;
whereConstructStatement
: label? WHERE LPAREN maskExpr RPAREN eos
;
maskExpr
: expr
;
elsewhereStatement
: label? ELSEWHERE eos
;
endWhereStatement
: label? END WHERE eos
;
ifConstruct
: ifThenStatement executionPartConstruct*
(elseIfStatement executionPartConstruct*)*
(elseStatement executionPartConstruct*)?
endIfStatement
;
ifThenStatement
: label? (ifConstructName COLON)? IF LPAREN scalarLogicalExpr RPAREN THEN eos
;
elseIfStatement
: label? (ELSE IF | ELSEIF) LPAREN scalarLogicalExpr RPAREN THEN ifConstructName? eos
;
elseStatement
: label? ELSE ifConstructName? eos
;
endIfStatement
: label? (END IF | ENDIF) ifConstructName? eos
;
ifStatement
: label? IF LPAREN scalarLogicalExpr RPAREN actionStatement
;
scalarLogicalExpr
: expr
;
caseConstruct
: label? name COLON (SELECT CASE | SELECTCASE) LPAREN expr RPAREN eos selectCaseRange
| label? (SELECT CASE | SELECTCASE) LPAREN expr RPAREN eos selectCaseRange
;
selectCaseRange
: selectCaseBody endSelectStatement
| endSelectStatement
|
;
selectCaseBody
: caseBodyConstruct+
;
caseBodyConstruct
: caseStatement
| executionPartConstruct
;
caseStatement
: label? CASE caseSelector name? eos
;
endSelectStatement
: label? END SELECT endName? eos
;
caseSelector
: LPAREN caseValueRange (COMMA caseValueRange)* RPAREN
| DEFAULT
|
;
caseValueRange
: expr
| expr COLON
| COLON expr
| expr COLON expr
;
doConstruct
: blockDoConstruct
| labelDoStatement
;
// %%R817
// %%* Block DO constructs cannot be recognized syntactically because there is
// %% * no requirement that there is an end do statement. (A do loop may use label+continue construct)
// %% DoStatement Block EndDoStatement -> BlockDoConstruct
// %% DoStatement Block -> BlockDoConstruct
// %% JD: endo IS compulsory in cases where lblRef is missing. Can we use this to locate Do-blocks?
blockDoConstruct
: label? DO lblRef eos
| label? DO loopControl eos
| label? DO eos
| label? name COLON DO lblRef loopControl eos
| label? name COLON DO lblRef eos
| label? name COLON DO loopControl eos
| label? name COLON DO eos
;
labelDoStatement
: label? DO lblRef COMMA? loopControl eos
;
loopControl
: WHILE LPAREN expr RPAREN
| variableName TO_ASSIGN int_Real_Dp_Expression COMMA int_Real_Dp_Expression (COMMA int_Real_Dp_Expression)?
;
int_Real_Dp_Expression
: expr
;
endDoStatement
: label? (END DO | ENDDO) name? eos
;
execSqlStatement
: label? SQL_STATEMENT eos
;
cycleStatement
: label? CYCLE endName? eos
;
exitStatement
: label? EXIT endName? eos
;
goToKw
: GO TO
| GOTO
;
gotoStatement
: label? goToKw lblRef eos
;
computedGotoStatement
: label? goToKw LPAREN lblRef (COMMA lblRef)* RPAREN COMMA? scalarIntExpr eos
;
lblRef
: intConst
;
scalarIntExpr
: expr
;
assignStatement
: label? ASSIGN lblRef TO variableName eos
;
assignedGotoStatement
: label? goToKw variableName eos
| label? goToKw variableName COMMA? LPAREN lblRef (COMMA lblRef)* RPAREN eos
;
arithmeticIfStatement
: label? IF LPAREN scalarNumericExpr RPAREN lblRef COMMA lblRef COMMA lblRef eos
;
scalarNumericExpr
: expr
;
continueStatement
: label? CONTINUE eos
;
stopStatement
: label? STOP (intConst | S_CONST)? eos
;
pauseStatement
: label? PAUSE (intConst | S_CONST)? eos
;
unitIdentifier
: uFExpr | STAR
;
openStatement
: label? OPEN LPAREN connectSpecList RPAREN eos
;
connectSpecList
: connectSpec (COMMA connectSpec)*
;
connectSpec
: unitIdentifier
| UNIT TO_ASSIGN unitIdentifier
| IOSTAT TO_ASSIGN scalarVariable
| ERR TO_ASSIGN lblRef
| FILE TO_ASSIGN cExpr
| NAME TO_ASSIGN cExpr
| TITLE TO_ASSIGN cExpr
| STATUS TO_ASSIGN cExpr
| TYPE TO_ASSIGN cExpr
| ACCESS TO_ASSIGN cExpr
| FORM TO_ASSIGN cExpr
| RECL TO_ASSIGN expr
| RECORDSIZE TO_ASSIGN expr
| BLANK TO_ASSIGN cExpr
| POSITION TO_ASSIGN cExpr
| ACTION TO_ASSIGN cExpr
| DELIM TO_ASSIGN cExpr
| PAD TO_ASSIGN cExpr
| ASSOCIATEVARIABLE TO_ASSIGN scalarVariable
| BLOCKSIZE TO_ASSIGN expr
| BUFFERCOUNT TO_ASSIGN expr
| BUFFERED TO_ASSIGN cExpr
| CARRIAGECONTROL TO_ASSIGN cExpr
| CONVERT TO_ASSIGN cExpr
| DEFAULTFILE TO_ASSIGN cExpr
| DISPOSE TO_ASSIGN cExpr
| DISP TO_ASSIGN cExpr
| EXTENDSIZE TO_ASSIGN expr
| INITIALSIZE TO_ASSIGN expr
| KEY TO_ASSIGN LPAREN I_CONST COLON I_CONST (COLON (INTEGER | CHARACTER) (COLON (ASCENDING | DESCENDING))?)? RPAREN
| MAXREC TO_ASSIGN expr
| NOSPANBLOCKS
| ORGANIZATION TO_ASSIGN cExpr
| RECORDTYPE TO_ASSIGN cExpr
| SHARED
;
closeStatement
: label? CLOSE LPAREN closeSpecList RPAREN eos
;
closeSpecList
: closeSpec(COMMA closeSpec)*
;
closeSpec
: unitIdentifier
| UNIT TO_ASSIGN unitIdentifier
| IOSTAT TO_ASSIGN scalarVariable
| ERR TO_ASSIGN lblRef
| STATUS TO_ASSIGN cExpr
| DISPOSE TO_ASSIGN cExpr
| DISP TO_ASSIGN cExpr
;
readStatement
: label? READ rdCtlSpec COMMA? inputItemList? eos
| label? READ rdFmtId eos
| label? READ rdFmtId COMMA inputItemList eos
;
writeStatement
: label? (WRITE | REWRITE) LPAREN ioControlSpecList RPAREN COMMA? outputItemList? eos
;
printStatement
: label? (PRINT | TYPE) formatIdentifier ( COMMA outputItemList )? eos
;
encodeDecodeStatement
: label? (ENCODE | DECODE) LPAREN encodeDecodeSpecList RPAREN outputItemList? eos
;
encodeDecodeSpecList
: encodeDecodeSpec(COMMA encodeDecodeSpec)*
;
encodeDecodeSpec
: unitIdentifier
| IOSTAT TO_ASSIGN scalarVariable
| ERR TO_ASSIGN lblRef
;
findStatement
: label? FIND LPAREN findSpecList RPAREN eos
;
findSpecList
: (UNIT TO_ASSIGN)? unitIdentifier COMMA REC TO_ASSIGN expr (COMMA ERR TO_ASSIGN lblRef)? (COMMA IOSTAT TO_ASSIGN scalarVariable)?
;
ioControlSpec
: UNIT TO_ASSIGN unitIdentifier
| FMT TO_ASSIGN formatIdentifier
| NML TO_ASSIGN namelistGroupName
| REC TO_ASSIGN expr
| IOSTAT TO_ASSIGN scalarVariable
| ERR TO_ASSIGN lblRef
| END TO_ASSIGN lblRef
| ADVANCE TO_ASSIGN cExpr
| SIZE TO_ASSIGN variable
| EOR TO_ASSIGN lblRef
| KEYID TO_ASSIGN lblRef
| KEYEQ TO_ASSIGN expr
| KEYGE TO_ASSIGN expr
| KEYLE TO_ASSIGN expr
| KEYGT TO_ASSIGN expr
| KEYLT TO_ASSIGN expr
| KEYNXT TO_ASSIGN expr
| KEYNXTNE TO_ASSIGN expr
;
ioControlSpecList
: unitIdentifier (COMMA formatIdentifier)?
| unitIdentifier COMMA ioControlSpec
| ioControlSpec
| ioControlSpecList COMMA ioControlSpec
;
rdCtlSpec
: rdUnitId
| LPAREN rdIoCtlSpecList RPAREN
;
rdUnitId
: LPAREN uFExpr RPAREN
| LPAREN STAR RPAREN
;
rdIoCtlSpecList
: unitIdentifier COMMA ioControlSpec
| unitIdentifier COMMA formatIdentifier
| ioControlSpec
| rdIoCtlSpecList COMMA ioControlSpec
;
rdFmtId
: lblRef
| STAR
| cOperand
| cOperand concatOp cPrimary
| rdFmtIdExpr concatOp cPrimary
;
rdFmtIdExpr
: LPAREN uFExpr RPAREN
;
formatIdentifier
: lblRef | cExpr | STAR
;
inputItem
: name
| dataRef
| inputImpliedDo
;
inputItemList
: inputItem (COMMA inputItem)*
;
outputItem
: expr
| outputImpliedDo
;
outputItemList
: outputItem (COMMA outputItem)*
;
inputImpliedDo
: LPAREN inputItemList COMMA impliedDoVariable TO_ASSIGN expr COMMA expr RPAREN
| LPAREN inputItemList COMMA impliedDoVariable TO_ASSIGN expr COMMA expr COMMA expr RPAREN
;
outputImpliedDo
: LPAREN outputItemList COMMA impliedDoVariable TO_ASSIGN expr COMMA expr RPAREN
| LPAREN outputItemList COMMA impliedDoVariable TO_ASSIGN expr COMMA expr COMMA expr RPAREN
;
backspaceStatement
: label? BACKSPACE unitIdentifier eos
| label? BACKSPACE LPAREN positionSpec (COMMA positionSpec)* RPAREN eos
;
endfileStatement
: label? (END FILE | ENDFILE | UNLOCK) unitIdentifier eos
| label? (END FILE | ENDFILE | UNLOCK) LPAREN positionSpec (COMMA positionSpec)* RPAREN eos
;
defineFileStatement
: label? DEFINE FILE defineFileSpec LPAREN defineFileList RPAREN (COMMA defineFileSpec LPAREN defineFileList RPAREN)* eos
;
defineFileList
: defineFileSpec COMMA defineFileSpec COMMA variableName COMMA defineFileSpec
;
defineFileSpec
: (intConst | variableName)
;
rewindStatement
: label? REWIND unitIdentifier eos
| label? REWIND LPAREN positionSpec (COMMA positionSpec)* RPAREN eos
;
deleteStatement
: label? DELETE LPAREN deleteSpec (COMMA deleteSpec)* RPAREN eos
;
acceptStatement
: label? ACCEPT (label | STAR) (COMMA outputItemList)? eos
| label? ACCEPT outputItemList eos
;
positionSpec
: (UNIT TO_ASSIGN)? unitIdentifier
| IOSTAT TO_ASSIGN scalarVariable
| ERR TO_ASSIGN lblRef
;
deleteSpec
: positionSpec
| REC TO_ASSIGN expr
;
inquireStatement
: label? INQUIRE LPAREN inquireSpecList RPAREN eos
| label? INQUIRE LPAREN IOLENGTH TO_ASSIGN scalarVariable RPAREN outputItemList eos
;
inquireSpec
: UNIT TO_ASSIGN unitIdentifier
| FILE TO_ASSIGN cExpr
| IOSTAT TO_ASSIGN scalarVariable
| ERR TO_ASSIGN lblRef
| EXIST TO_ASSIGN scalarVariable
| OPENED TO_ASSIGN scalarVariable
| NUMBER TO_ASSIGN scalarVariable
| NAMED TO_ASSIGN scalarVariable
| NAME TO_ASSIGN scalarVariable
| ACCESS TO_ASSIGN scalarVariable
| SEQUENTIAL TO_ASSIGN scalarVariable
| DIRECT TO_ASSIGN scalarVariable
| FORM TO_ASSIGN scalarVariable
| FORMATTED TO_ASSIGN scalarVariable
| UNFORMATTED TO_ASSIGN scalarVariable
| RECL TO_ASSIGN expr
| NEXTREC TO_ASSIGN scalarVariable
| BLANK TO_ASSIGN scalarVariable
| POSITION TO_ASSIGN scalarVariable
| ACTION TO_ASSIGN scalarVariable
| READ TO_ASSIGN scalarVariable
| WRITE TO_ASSIGN scalarVariable
| READWRITE TO_ASSIGN scalarVariable
| DELIM TO_ASSIGN scalarVariable
| PAD TO_ASSIGN scalarVariable
| BLOCKSIZE TO_ASSIGN expr
| BUFFERED TO_ASSIGN cExpr
| CARRIAGECONTROL TO_ASSIGN cExpr
| CONVERT TO_ASSIGN cExpr
| KEYED TO_ASSIGN cExpr
| ORGANIZATION TO_ASSIGN cExpr
| RECORDTYPE TO_ASSIGN cExpr
;
inquireSpecList
: unitIdentifier COMMA inquireSpec (COMMA inquireSpec)*
| inquireSpec (COMMA inquireSpec)*
; |
Kernel/src/Arch/x86_64/Lock.asm | adi-g15/LemonOS | 685 | 242334 | global acquireLock
global releaseLock
acquireLock:
lock bts dword [rdi], 0 ; Acquire lock
jc .spin
ret
.spin: ; If lock not available, spin
pause
test dword [rdi], 1
jnz .spin
jmp acquireLock
releaseLock:
mov dword [rdi], 0
ret |
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/interface3.adb | best08618/asylo | 7 | 18497 | -- { dg-do run }
procedure interface3 is
--
package Pkg is
type Foo is interface;
subtype Element_Type is Foo'Class;
--
type Element_Access is access Element_Type;
type Elements_Type is array (1 .. 1) of Element_Access;
type Elements_Access is access Elements_Type;
--
type Vector is tagged record
Elements : Elements_Access;
end record;
--
procedure Test (Obj : Vector);
end;
--
package body Pkg is
procedure Test (Obj : Vector) is
Elements : Elements_Access := new Elements_Type;
--
begin
Elements (1) := new Element_Type'(Obj.Elements (1).all);
end;
end;
--
begin
null;
end;
|
programs/oeis/033/A033691.asm | neoneye/loda | 22 | 19835 | <reponame>neoneye/loda<filename>programs/oeis/033/A033691.asm<gh_stars>10-100
; A033691: Minimal number of vertices in 1-1 deficient regular graph where minimal degree is 1 and maximal degree is n.
; 4,8,12,20,24,32,40,52,60,72,84,100,112,128,144,164,180,200,220,244,264,288,312,340,364,392,420,452,480,512,544,580,612,648,684,724,760,800,840,884,924,968,1012,1060,1104,1152,1200,1252,1300,1352,1404,1460,1512,1568,1624,1684,1740,1800,1860,1924,1984,2048,2112,2180,2244,2312,2380,2452,2520,2592,2664,2740,2812,2888,2964,3044,3120,3200,3280,3364,3444,3528,3612,3700,3784,3872,3960,4052,4140,4232,4324,4420,4512,4608,4704,4804,4900,5000,5100,5204
add $0,3
pow $0,2
div $0,4
add $0,1
div $0,2
mul $0,4
|
Agda/AML.agda | Brethland/LEARNING-STUFF | 2 | 17146 | module AML where
open import Level
open import Data.Product
data satisfied (a : Set) (m : Set → Set) : Set where
s : m a → satisfied a m
data reachability (m₀ : Set → Set) (m : Set → Set) : Set where
tt : reachability m₀ m
data necessarity (m₀ : Set → Set) (a : Set) : Set₁ where
n : ∀ m → (reachability m₀ m) → satisfied a m → necessarity m₀ a
□_ : Set → Set₁
□_ = necessarity {!!}
data posibility (m₀ : Set → Set) (a : Set) : Set₁ where
p : ∃[ m ](reachability m₀ m → satisfied a m) → posibility m₀ a
◇_ : Set → Set₁
◇_ = posibility {!!}
|
_anim/Plasma Balls.asm | kodishmediacenter/msu-md-sonic | 9 | 104270 | <reponame>kodishmediacenter/msu-md-sonic
; ---------------------------------------------------------------------------
; Animation script - energy balls (FZ)
; ---------------------------------------------------------------------------
Ani_Plasma: dc.w @full-Ani_Plasma
dc.w @short-Ani_Plasma
@full: dc.b 1, 0, $A, 8, $A, 1, $A, 9, $A, 6, $A, 7, $A, 0, $A
dc.b 8, $A, 1, $A, 9, $A, 6, $A, 7, $A, 2, $A, 3, $A, 4
dc.b $A, 5, afEnd
even
@short: dc.b 0, 6, 5, 1, 5, 7, 5, 1, 5, afEnd
even |
AP1/kernel.asm | KilnerJhow/ihs | 1 | 4582 | org 0x7e00
jmp start
buffer: times 64 db 0
memory: times 240 db 0
tableOccuped: times 5 db 0
cheio: db 'Banco de dados cheio', 0xA, 0xD, 0
poslivre: db 'Pos livre achada', 0xA, 0xD, 0
chamada: db 'func chamada', 0xA, 0xD, 0
insertNumConta: db 'Insira o num da conta: ', 0xA, 0xD, 0
noAcc: db 'Conta nao encontrada no banco de dados ', 0xA, 0xD, 0
err: db '|Erro, opcao invalida |', 0xA, 0xD, 0
;debug string
naoigual: db 'Nao igual', 0xA, 0xD, 0
igual: db 'Igual', 0xA, 0xD, 0
ocupada: db 'Ocupada', 0xA, 0xD, 0
rodando: db 'rodando', 0xA, 0xD, 0
compara: db 'comparando', 0xA, 0xD, 0
comparaDepois: db 'Compara depois', 0xA, 0xD, 0
start:
mov ax, 0
mov ds, ax
mov es, ax
mov di, tableOccuped
mov al, '1'
stosb
stosb
stosb
mov di, memory
add di, 32
mov al, '1'
stosb
mov al, '1'
stosb
mov al, '1'
stosb
mov al, 0
stosb
mov di, memory
add di, 80
mov al, '1'
stosb
mov al, '0'
stosb
mov al, '0'
stosb
mov al, 0
stosb
mov di, memory
add di, 128
mov al, '1'
stosb
mov al, '0'
stosb
mov al, '1'
stosb
mov al, 0
stosb
call findAcc
jmp exit
findAcc:
push di
push si
push ax
push cx
mov si, insertNumConta
call printString
mov di, buffer
call getConta
mov cl, 0
mov si, tableOccuped
.loop:
cmp cl, 4
je .erro
lodsb
cmp al, '1'
je .occupied
push si
mov si, rodando
call printString
pop si
inc cl
jmp .loop
.occupied:
push si
; mov si, ocupada
; call printString
mov al, 48
mul cl
add ax, 32
pop si
.compare:
push si
mov di, buffer
; mov si, compara
; call printString
mov di, buffer
mov si, memory
add si, ax
call strcmp
jc .igual
.n_igual:
mov si, naoigual
call printString
pop si
jmp .loop
.igual:
mov si, igual
call printString
jmp .exit
.erro:
call new_line
mov si, noAcc
call printString
call waitEnter
.exit:
jmp .exit
pop cx
pop ax
pop si
pop di
ret
printString:
push ax ;empilha reg para salva os valores anteriores
push ds
push cx
mov cl, 0
.loop:
lodsb ;carregamos em ax um byte, word ou dword apontado por DS:SI, (Data Segment):(Source Index), SI incrementa/decrementa automaticamente
cmp cl, al ;comparamos cl com al, seta flag ZF (Zero flag) para 1 caso operando iguais, 0 caso contrário
jz .exit ;caso al seja 0, chegamos ao final da string e podemos retornar
mov ah, 0xE ;função para printar um caracter na tela
int 0x10 ;interrupção para printar um caracter na tela
jmp .loop
.exit:
pop cx
pop ds
pop ax
ret
getConta:
push di
push cx
mov cl, 0
.loop:
mov ah, 0 ;função para pegar um dígito do teclado
int 0x16
cmp al, 0x0D ; valor do enter
je .done ; (je - Faz um jump caso o ZF = 1)
cmp al, 0x08 ;valor do backspace
je .backspace ;trata o backspace
cmp cl, 0x05 ; Lê 5 caracteres para a conta
je .loop ; Caso a opção tenha sido escolhida, espera o enter ou backspace
mov ah, 0x0E ;função de printar um número na tela
int 0x10
stosb
inc cl ;incrementa a quantidade de teclas digitadas
jmp .loop
.backspace:
cmp cl, 0
je .loop
dec di
mov byte[di], 0
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
mov al, ' '
mov ah, 0x0E
int 0x10
mov ah, 3
int 0x10
dec dl ;usado para especificar a linha para remoção
mov ah, 2
int 0x10
dec cl
jmp .loop
.done:
mov al, 0 ;salvar terminador de string
stosb ;salvamos o terminador de string na última posição apontada por di
mov ah, 0x0E
mov al, 0xA ;nova linha e carriage return
int 10h
mov al, 0xD
int 10h
.exit:
pop cx
pop di
ret
waitEnter:
.loop:
mov ah, 0 ;função para pegar um dígito do teclado
int 0x16
cmp al, 0x0D ; valor do enter
je .done ; (je - Faz um jump caso o ZF = 1)
jmp .loop
.done:
ret
strcmp:
push ax
push bx
push di
push si
.loop:
mov al, [si] ; grab a byte from SI
mov bl, [di] ; grab a byte from DI
cmp al, bl ; are they equal?
jne .notequal ; nope, we're done.
cmp al, 0 ; are both bytes (they were equal before) null?
je .done ; yes, we're done.
inc di ; increment DI
inc si ; increment SI
jmp .loop ; loop!
.notequal:
clc ; not equal, clear the carry flag
jmp .exit
.done:
stc ; equal, set the carry flag
.exit:
pop si
pop di
pop bx
pop ax
ret
new_line:
mov ah, 0x0E
mov al, 0xA
int 10h
mov al, 0xD
int 10h
ret
exit:
jmp exit
|
programs/oeis/113/A113805.asm | neoneye/loda | 22 | 18118 | <filename>programs/oeis/113/A113805.asm
; A113805: Numbers that are congruent to {5, 9} mod 14.
; 5,9,19,23,33,37,47,51,61,65,75,79,89,93,103,107,117,121,131,135,145,149,159,163,173,177,187,191,201,205,215,219,229,233,243,247,257,261,271,275,285,289,299,303,313,317,327,331,341,345,355,359,369
mul $0,3
div $0,2
mul $0,14
div $0,3
add $0,5
|
notes/FOT/FOTC/Data/Nat/PredTotality.agda | asr/fotc | 11 | 4772 | <reponame>asr/fotc
------------------------------------------------------------------------------
-- Totality of predecessor function
------------------------------------------------------------------------------
{-# OPTIONS --allow-unsolved-metas #-}
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOT.FOTC.Data.Nat.PredTotality where
open import FOTC.Base
data N : D → Set where
nzero : N zero
nsucc : ∀ {n} → N n → N (succ₁ n)
-- Induction principle generated by Coq 8.4pl4 when we define the data
-- type N in Prop.
N-ind₁ : (A : D → Set) →
A zero →
(∀ {n} → N n → A n → A (succ₁ n)) →
∀ {n} → N n → A n
N-ind₁ A A0 h nzero = A0
N-ind₁ A A0 h (nsucc Nn) = h Nn (N-ind₁ A A0 h Nn)
-- The induction principle removing the hypothesis N n from the
-- inductive step.
N-ind₂ : (A : D → Set) →
A zero →
(∀ {n} → A n → A (succ₁ n)) →
∀ {n} → N n → A n
N-ind₂ A A0 h nzero = A0
N-ind₂ A A0 h (nsucc Nn) = h (N-ind₂ A A0 h Nn)
-- Proof by pattern matching.
pred-N : ∀ {n} → N n → N (pred₁ n)
pred-N nzero = subst N (sym pred-0) nzero
pred-N (nsucc {n} Nn) = subst N (sym (pred-S n)) Nn
-- Proof using N-ind₁.
pred-N₁ : ∀ {n} → N n → N (pred₁ n)
pred-N₁ = N-ind₁ A A0 is
where
A : D → Set
A i = N (pred₁ i)
A0 : A zero
A0 = subst N (sym pred-0) nzero
is : ∀ {i} → N i → A i → A (succ₁ i)
is {i} Ni Ai = subst N (sym (pred-S i)) Ni
-- Proof using N-ind₂.
-- pred-N₂ : ∀ {n} → N n → N (pred₁ n)
-- pred-N₂ = N-ind₂ A A0 is
-- where
-- A : D → Set
-- A i = N (pred₁ i)
-- A0 : A zero
-- A0 = subst N (sym pred-0) nzero
-- is : ∀ {i} → A i → A (succ₁ i)
-- is {i} Ai = {!!}
|
solutions/52 - The Mode Code/size-32-speed-110.asm | michaelgundlach/7billionhumans | 45 | 18281 | <gh_stars>10-100
-- 7 Billion Humans (2053) --
-- 52: The Mode Code --
-- Author: Tiza59
-- Size: 32
-- Speed: 110
mem4 = nearest datacube
a:
if w == worker:
mem1 = calc mem1 + 1
step w
jump a
endif
step nw
step n
b:
c:
if c == mem1 or
e == mem1:
if c == mem1 and
e == mem1:
mem2 = calc mem2 + 2
else:
mem2 = calc mem2 + 1
endif
endif
if n == datacube:
step n
jump b
endif
step e
step e
step e
d:
if c == mem1 or
w == mem1:
if c == mem1 and
w == mem1:
mem2 = calc mem2 + 2
else:
mem2 = calc mem2 + 1
endif
endif
if s == datacube:
step s
jump d
endif
if e != nothing:
step e
jump c
endif
pickup mem4
write mem2
drop
|
Base/Rel.agda | DDOtten/M-types | 0 | 11118 | {-# OPTIONS --without-K #-}
open import M-types.Base.Core
open import M-types.Base.Sum
open import M-types.Base.Prod
open import M-types.Base.Eq
open import M-types.Base.Equi
open import M-types.Base.Axiom
module M-types.Base.Rel where
SpanRel : Ty ℓ → Ty (ℓ-suc ℓ)
SpanRel {ℓ} X = ∑[ ty ∈ Ty ℓ ] (ty → X) × (ty → X)
ρ₀ : {X : Ty ℓ₀} {Y Z : X → Ty ℓ₁} →
∏[ s ∈ ∑[ x ∈ X ] (Y x × Z x) ] Y (pr₀ s)
ρ₀ = pr₀ ∘ pr₁
ρ₁ : {X : Ty ℓ₀} {Y Z : X → Ty ℓ₁} →
∏[ s ∈ ∑[ x ∈ X ] (Y x × Z x) ] Z (pr₀ s)
ρ₁ = pr₁ ∘ pr₁
SpanRel-syntax : {X : Ty ℓ} →
∏[ ∼ ∈ SpanRel X ] ∏[ x₀ ∈ X ] ∏[ x₁ ∈ X ] Ty ℓ
SpanRel-syntax ∼ x₀ x₁ = ∑[ s ∈ (ty ∼) ] ((ρ₀ ∼ s ≡ x₀) × (ρ₁ ∼ s ≡ x₁))
syntax SpanRel-syntax ∼ x₀ x₁ = x₀ ⟨ ∼ ⟩ x₁
≡-spanRel : {X : Ty ℓ} →
SpanRel X
≡-spanRel {_} {X} = (X , id , id)
SpanRelMor : {X : Ty ℓ} →
SpanRel X → SpanRel X → Ty ℓ
SpanRelMor {_} {X} ∼ ≈ =
∑[ fun ∈ (ty ∼ → ty ≈) ]
(ρ₀ ≈ ∘ fun ≡ ρ₀ ∼) × (ρ₁ ≈ ∘ fun ≡ ρ₁ ∼)
com₀ : {X : Ty ℓ₀} {Y Z : X → Ty ℓ₁} →
∏[ s ∈ ∑[ x ∈ X ] (Y x × Z x) ] Y (pr₀ s)
com₀ = pr₀ ∘ pr₁
com₁ : {X : Ty ℓ₀} {Y Z : X → Ty ℓ₁} →
∏[ s ∈ ∑[ x ∈ X ] (Y x × Z x) ] Z (pr₀ s)
com₁ = pr₁ ∘ pr₁
id-spanRel : {X : Ty ℓ} {∼ : SpanRel X} →
SpanRelMor ∼ ∼
id-spanRel {_} {X} {∼} = (id , refl , refl)
infixr 9 _∘-spanRel_
_∘-spanRel_ : {X : Ty ℓ} {∼₀ ∼₁ ∼₂ : SpanRel X} →
SpanRelMor ∼₁ ∼₂ → SpanRelMor ∼₀ ∼₁ → SpanRelMor ∼₀ ∼₂
g ∘-spanRel f =
(
fun g ∘ fun f ,
ap (λ k → k ∘ fun f) (com₀ g) · com₀ f ,
ap (λ k → k ∘ fun f) (com₁ g) · com₁ f
)
DepRel : Ty ℓ → Ty (ℓ-suc ℓ)
DepRel {ℓ} X = X → X → Ty ℓ
DepRel-syntax : {X : Ty ℓ} →
∏[ ∼ ∈ DepRel X ] ∏[ x₀ ∈ X ] ∏[ x₁ ∈ X ] Ty ℓ
DepRel-syntax ∼ x₀ x₁ = ∼ x₀ x₁
syntax DepRel-syntax ∼ x₀ x₁ = x₀ [ ∼ ] x₁
≡-depRel : {X : Ty ℓ} →
DepRel X
≡-depRel = λ x₀ → λ x₁ → x₀ ≡ x₁
DepRelMor : {X : Ty ℓ} →
DepRel X → DepRel X → Ty ℓ
DepRelMor {_} {X} ∼ ≈ =
∏[ x₀ ∈ X ] ∏[ x₁ ∈ X ]
(x₀ [ ∼ ] x₁ → x₀ [ ≈ ] x₁)
id-depRel : {X : Ty ℓ} {∼ : DepRel X} →
DepRelMor ∼ ∼
id-depRel {_} {X} {∼} = λ x₀ → λ x₁ → id
infixr 9 _∘-depRel_
_∘-depRel_ : {X : Ty ℓ} {∼₀ ∼₁ ∼₂ : DepRel X} →
DepRelMor ∼₁ ∼₂ → DepRelMor ∼₀ ∼₁ → DepRelMor ∼₀ ∼₂
g ∘-depRel f = λ x₀ → λ x₁ → g x₀ x₁ ∘ f x₀ x₁
SpanRel→DepRel : {X : Ty ℓ} →
SpanRel X → DepRel X
SpanRel→DepRel {_} {X} ∼ = λ x₀ → λ x₁ → x₀ ⟨ ∼ ⟩ x₁
DepRel→SpanRel : {X : Ty ℓ} →
DepRel X → SpanRel X
DepRel→SpanRel {_} {X} ∼ =
(
(∑[ x₀ ∈ X ] ∑[ x₁ ∈ X ] x₀ [ ∼ ] x₁) ,
pr₀ ,
pr₀ ∘ pr₁
)
SpanRel→DepRel-pres : {X : Ty ℓ} →
∏[ ∼ ∈ SpanRel X ] ∏[ x₀ ∈ X ] ∏[ x₁ ∈ X ]
(x₀ [ SpanRel→DepRel ∼ ] x₁) ≡ (x₀ ⟨ ∼ ⟩ x₁)
SpanRel→DepRel-pres ∼ x₀ x₁ = refl
DepRel→SpanRel-pres : {X : Ty ℓ} →
∏[ ∼ ∈ DepRel X ] ∏[ x₀ ∈ X ] ∏[ x₁ ∈ X ]
(x₀ ⟨ DepRel→SpanRel ∼ ⟩ x₁) ≃ (x₀ [ ∼ ] x₁)
DepRel→SpanRel-pres ∼ x₀ x₁ =
(
(λ ((y₀ , y₁ , s) , p₀ , p₁) →
tra (λ x → x [ ∼ ] x₁) p₀ (tra (λ y → y₀ [ ∼ ] y) p₁ s)
) ,
Qinv→IsEqui (
(λ s → ((x₀ , x₁ , s) , refl , refl)) ,
(λ {((x₀ , x₁ , s) , refl , refl) → refl}) ,
(λ s → refl)
)
)
SpanRel→SpanRel-mor : {X : Ty ℓ} →
∏[ ∼ ∈ SpanRel X ] SpanRelMor ∼ (DepRel→SpanRel (SpanRel→DepRel ∼))
SpanRel→SpanRel-mor ∼ =
(
(λ s → (ρ₀ ∼ s , ρ₁ ∼ s , (s , refl , refl))) ,
refl ,
refl
)
DepRel→DepRel-mor : {X : Ty ℓ} →
∏[ ∼ ∈ DepRel X ] DepRelMor ∼ (SpanRel→DepRel (DepRel→SpanRel ∼))
DepRel→DepRel-mor ∼ = λ x₀ → λ x₁ → λ s → ((x₀ , x₁ , s) , refl , refl)
≡-SpanRel→DepRel-mor : {X : Ty ℓ} →
DepRelMor {ℓ} {X} (SpanRel→DepRel ≡-spanRel) ≡-depRel
≡-SpanRel→DepRel-mor = λ x₀ → λ x₁ → λ(s , p₀ , p₁) → p₀ ⁻¹ · p₁
≡-DepRel→SpanRel-mor : {X : Ty ℓ} →
SpanRelMor {ℓ} {X} (DepRel→SpanRel ≡-depRel) ≡-spanRel
≡-DepRel→SpanRel-mor =
(
(λ (x₀ , x₁ , p) → x₀) ,
refl ,
funext (λ (x₀ , x₁ , p) → p)
)
SpanRelMor→DepRelMor : {X : Ty ℓ} {∼ ≈ : SpanRel X} →
SpanRelMor ∼ ≈ → DepRelMor (SpanRel→DepRel ∼) (SpanRel→DepRel ≈)
SpanRelMor→DepRelMor (fun , refl , refl) x₀ x₁ (s , refl , refl) =
(
fun s ,
refl ,
refl
)
DepRelMor→SpanRelMor : {X : Ty ℓ} {∼ ≈ : DepRel X} →
DepRelMor ∼ ≈ → SpanRelMor (DepRel→SpanRel ∼) (DepRel→SpanRel ≈)
DepRelMor→SpanRelMor f =
(
(λ (x₀ , x₁ , s) → (x₀ , x₁ , f x₀ x₁ s)) ,
refl {_} {_} {pr₀} ,
refl
)
|
Typinator/typinator/Includes/Scripts/SafariURL.applescript | mbroski/config | 0 | 4652 | -- Version 1.0, (C) <NAME>, 2012-01-19
-- Feel free to modify the script for your own use, but leave the copyright notice intact.
tell application "System Events"
if (name of processes) does not contain "Safari" then return "--"
end tell
tell application "Safari"
try
return URL of document 1
on error
return "--"
end try
end tell |
oeis/081/A081267.asm | neoneye/loda-programs | 11 | 11401 | ; A081267: Diagonal of triangular spiral in A051682.
; 1,9,26,52,87,131,184,246,317,397,486,584,691,807,932,1066,1209,1361,1522,1692,1871,2059,2256,2462,2677,2901,3134,3376,3627,3887,4156,4434,4721,5017,5322,5636,5959,6291,6632,6982,7341,7709,8086,8472,8867,9271,9684,10106,10537,10977,11426,11884,12351,12827,13312,13806,14309,14821,15342,15872,16411,16959,17516,18082,18657,19241,19834,20436,21047,21667,22296,22934,23581,24237,24902,25576,26259,26951,27652,28362,29081,29809,30546,31292,32047,32811,33584,34366,35157,35957,36766,37584,38411,39247
mul $0,9
add $0,4
bin $0,2
div $0,9
add $0,1
|
source/program_structure/adam-library_unit-renaming_declaration.ads | charlie5/aIDE | 3 | 23844 | with
Ada.Containers.Vectors,
Ada.Streams;
private
with
AdaM.Declaration.of_renaming.a_subprogram,
AdaM.Declaration.of_renaming.a_package,
AdaM.Declaration.of_renaming.a_generic;
package AdaM.library_Unit.renaming_declaration
is
type Item is new library_Unit.item with private;
-- View
--
type View is access all Item'Class;
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View);
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View);
for View'write use View_write;
for View'read use View_read;
-- Vector
--
package Vectors is new ada.Containers.Vectors (Positive, View);
subtype Vector is Vectors.Vector;
-- Forge
--
function new_Subprogram return library_Unit.renaming_declaration.view;
procedure free (Self : in out library_Unit.renaming_declaration.view);
overriding
procedure destruct (Self : in out library_Unit.renaming_declaration.item);
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id;
private
type Kind is ( package_renaming_Declaration,
generic_renaming_Declaration,
subprogram_renaming_Declaration);
type a_Declaration (Kind : renaming_declaration.Kind := package_renaming_Declaration) is
record
case Kind
is
when package_renaming_Declaration =>
of_package_Renaming : AdaM.Declaration.of_renaming.a_package.view;
when generic_renaming_Declaration =>
of_generic_Renaming : AdaM.Declaration.of_renaming.a_generic.view;
when subprogram_renaming_Declaration =>
of_subprogram_Renaming : AdaM.Declaration.of_renaming.a_subprogram.view;
end case;
end record;
type Item is new library_Unit.item with
record
Declaration : a_Declaration;
end record;
end AdaM.library_Unit.renaming_declaration;
|
Task/Sorting-algorithms-Heapsort/Ada/sorting-algorithms-heapsort-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 30841 | generic
type Element_Type is private;
type Index_Type is (<>);
type Collection is array(Index_Type range <>) of Element_Type;
with function "<" (Left, right : element_type) return boolean is <>;
procedure Generic_Heapsort(Item : in out Collection);
|
sw/552tests/inst_tests/xori_0.asm | JPShen-UWM/ThreadKraken | 1 | 170000 | // Original test: ./rbatterm/hw4/problem6/xori_0.asm
// Author: rbatterm
// Test source code follows
// test all zero's
lbi r2, 0 //00000
xori r1, r2, 0 //00000
halt //= 00000
|
chap15/ex19/vblendps_transpose.asm | JamesType/optimization-manual | 374 | 177194 | <reponame>JamesType/optimization-manual<filename>chap15/ex19/vblendps_transpose.asm
;
; Copyright (C) 2021 by Intel Corporation
;
; Permission to use, copy, modify, and/or distribute this software for any
; purpose with or without fee is hereby granted.
;
; 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.
;
; .globl vblendps_transpose
; void vblendps_transpose(float *in[8], float *out[8], size_t len)
; On entry:
; rcx = in
; rdx = out
; r8 = len
.code
vblendps_transpose PROC public
sub rsp, 168
vmovaps xmmword ptr[rsp], xmm6
vmovaps xmmword ptr[rsp+16], xmm7
vmovaps xmmword ptr[rsp+32], xmm8
vmovaps xmmword ptr[rsp+48], xmm9
vmovaps xmmword ptr[rsp+64], xmm10
vmovaps xmmword ptr[rsp+80], xmm11
vmovaps xmmword ptr[rsp+96], xmm12
vmovaps xmmword ptr[rsp+112], xmm13
vmovaps xmmword ptr[rsp+128], xmm14
vmovaps xmmword ptr[rsp+144], xmm15
mov rcx, rcx ; movrcx, inpBuf
mov r10, r8 ; movr10, NumOfLoops
mov r8, rdx ; movrdx, outBuf
loop1:
vmovaps ymm9, [rcx]
vmovaps ymm10, [rcx+32]
vmovaps ymm11, [rcx+64]
vmovaps ymm12, [rcx+96]
vmovaps ymm13, [rcx+128]
vmovaps ymm14, [rcx+160]
vmovaps ymm15, [rcx+192]
vmovaps ymm2, [rcx+224]
vunpcklps ymm6, ymm9, ymm10
vunpcklps ymm1, ymm11, ymm12
vunpckhps ymm8, ymm9, ymm10
vunpcklps ymm0, ymm13, ymm14
vunpcklps ymm9, ymm15, ymm2
vshufps ymm3, ymm6, ymm1, 4Eh
vblendps ymm10, ymm6, ymm3, 0CCh
vshufps ymm6, ymm0, ymm9, 4Eh
vunpckhps ymm7, ymm11, ymm12
vblendps ymm11, ymm0, ymm6, 0CCh
vblendps ymm12, ymm3, ymm1, 0CCh
vperm2f128 ymm3, ymm10, ymm11, 20h
vmovaps [r8], ymm3
vunpckhps ymm5, ymm13, ymm14
vblendps ymm13, ymm6, ymm9, 0CCh
vunpckhps ymm4, ymm15, ymm2
vperm2f128 ymm2, ymm12, ymm13, 20h
vmovaps 32[r8], ymm2
vshufps ymm14, ymm8, ymm7, 4Eh
vblendps ymm15, ymm14, ymm7, 0CCh
vshufps ymm7, ymm5, ymm4, 4Eh
vblendps ymm8, ymm8, ymm14, 0CCh
vblendps ymm5, ymm5, ymm7, 0CCh
vperm2f128 ymm6, ymm8, ymm5, 20h
vmovaps 64[r8], ymm6
vblendps ymm4, ymm7, ymm4, 0CCh
vperm2f128 ymm7, ymm15, ymm4, 20h
vmovaps 96[r8], ymm7
vperm2f128 ymm1, ymm10, ymm11, 31h
vperm2f128 ymm0, ymm12, ymm13, 31h
vmovaps 128[r8], ymm1
vperm2f128 ymm5, ymm8, ymm5, 31h
vperm2f128 ymm4, ymm15, ymm4, 31h
vmovaps 160[r8], ymm0
vmovaps 192[r8], ymm5
vmovaps 224[r8], ymm4
dec r10
jnz loop1
vzeroupper
vmovaps xmm6, xmmword ptr[rsp]
vmovaps xmm7, xmmword ptr[rsp+16]
vmovaps xmm8, xmmword ptr[rsp+32]
vmovaps xmm9, xmmword ptr[rsp+48]
vmovaps xmm10, xmmword ptr[rsp+64]
vmovaps xmm11, xmmword ptr[rsp+80]
vmovaps xmm12, xmmword ptr[rsp+96]
vmovaps xmm13, xmmword ptr[rsp+112]
vmovaps xmm14, xmmword ptr[rsp+128]
vmovaps xmm15, xmmword ptr[rsp+144]
add rsp, 168
ret
vblendps_transpose ENDP
end |
src/clear_screen.asm | I8087/libm | 13 | 417 | global _clear_screen
_clear_screen:
push bp
mov bp, sp
call os_clear_screen
pop bp
ret
|
de.peeeq.wurstscript/parserspec/Jurst.g4 | Crigges/WurstScript | 0 | 4892 | grammar Jurst;
compilationUnit : NL* decls+=topLevelDeclaration*;
topLevelDeclaration:
wpackage
| jassTopLevelDeclaration
;
jassTopLevelDeclaration:
jassGlobalsBlock
| jassFuncDef
| jassTypeDecl
| jassNativeDecl
;
jassGlobalsBlock:
'globals' NL vars+=jassGlobalDecl* 'endglobals' NL
;
jassGlobalDecl:
constant='constant'? typeExpr name=id ('=' initial=expr)? NL
;
jassFuncDef:
constant='constant'? 'function' jassFuncSignature NL
(jassLocals+=jassLocal)*
jassStatements
'endfunction' NL
;
jassLocal: 'local' typeExpr name=id ('=' initial=expr)? NL;
jassStatements: stmts+=jassStatement*;
jassStatement:
jassStatementIf
| jassStatementLoop
| jassStatementExithwhen
| jassStatementReturn
| jassStatementSet
| jassStatementCall
;
jassStatementIf:
'if' cond=expr 'then' NL thenStatements=jassStatements jassElseIfs
;
jassElseIfs:
'elseif' cond=expr 'then' NL thenStatements=jassStatements jassElseIfs
| 'else' NL elseStmts=jassStatements 'endif' NL
| 'endif' NL
;
jassStatementLoop:
'loop' NL jassStatements 'endloop' NL
;
jassStatementExithwhen:
'exitwhen' cond=expr NL
;
jassStatementReturn:
'return' expr NL
;
jassStatementSet:
'set' left=exprAssignable '=' right=expr NL
;
jassStatementCall:
'call' exprFunctionCall NL
;
jassNativeDecl:
constant='constant'? 'native' jassFuncSignature NL
;
jassFuncSignature:
name=id 'takes' ('nothing' | args+=formalParameter (',' args+=formalParameter)*)
'returns' ('nothing'|returnType=typeExpr)
;
jassTypeDecl: 'type' name=id 'extends' extended=typeExpr NL;
wpackage: ('package'|'library'|'scope') name=id
('initializer' initializer=id)?
(('uses'|'requires'|'needs') 'optional'? requires+=id (',' 'optional'? requires+=id)*)?
NL
imports+=wImport* entities+=entity*
('endpackage'|'endlibrary'|'endscope'|'end') NL
;
wImport:
'import' isPublic='public'? isInitLater='initlater'? importedPackage=id NL
;
entity:
nativeType
| funcDef
| functionInterfaceDef
| globalsBlock
| initBlock
| nativeDef
| classDef
| enumDef
| moduleDef
| interfaceDef
| tupleDef
| extensionFuncDef
| varDef
;
globalsBlock: 'globals' NL vars+=varDef* ('endglobals' | 'end') NL;
interfaceDef:
modifiersWithDoc 'interface' name=id typeParams
('extends' extended+=typeExpr (',' extended+=typeExpr)*)?
NL
classSlots
('end'|'endinterface') NL
;
classDef:
modifiersWithDoc ('class'|'struct') name=id typeParams
('extends' (extended=typeExpr | 'array'))?
('implements' implemented+=typeExpr (',' implemented+=typeExpr)*)?
NL
classSlots
('end'|'endclass'|'endstruct') NL
;
enumDef: modifiersWithDoc 'enum' name=id NL
(enumMembers+=id NL)*
('end'|'endenum') NL
;
moduleDef:
modifiersWithDoc 'module' name=id typeParams
NL
classSlots
('end'|'endmodule') NL
;
classSlots: slots+=classSlot*;
classSlot:
constructorDef
| moduleUse
| ondestroyDef
| varDef
| funcDef
;
constructorDef:
modifiersWithDoc 'construct' formalParameters NL
('super' '(' superArgs=exprList ')' NL)?
stmts+=statement*
('end'|'endconstruct') NL
;
moduleUse:
modifiersWithDoc ('use'|'implement') optional='optional'? moduleName=id typeArgs NL
;
ondestroyDef:
'ondestroy' NL statementsBlock ('end'|'endondestroy') NL
;
funcDef:
modifiersWithDoc ('function'|'method') funcSignature
(
NL statementsBlock ('end'|'endfunction'|'endmethod')
| 'defaults' (defaultExpr=expr|defaultsNothing='nothing')
)?
NL
;
functionInterfaceDef:
modifiersWithDoc 'function' 'interface' funcSignature NL
;
modifiersWithDoc:
(hotdocComment NL)?
(modifiers+=modifier NL?)*
;
modifier:
modType=(
'public'
| 'private'
| 'protected'
| 'publicread'
| 'readonly'
| 'static'
| 'override'
| 'abstract'
| 'constant'
| 'delegate'
| 'stub'
)
| annotation
;
annotation: ANNOTATION;
hotdocComment: HOTDOC_COMMENT;
funcSignature:
name=id typeParams formalParameters ('returns' ('nothing' | returnType=typeExpr))?
;
formalParameters:
'(' (params+=formalParameter (',' params+=formalParameter)*)? ')'
| 'takes' 'nothing'
| 'takes' params+=formalParameter (',' params+=formalParameter)*
;
formalParameter:
typeExpr name=id
;
typeExpr:
thistype='thistype'
| typeName=ID typeArgs
| typeExpr 'array' ('[' arraySizes+=expr ']')*
;
varDef:
modifiersWithDoc
('var'|constant='constant' varType=typeExpr?|constant='let'|varType=typeExpr)
name=id ('[' arraySizes+=expr ']')* ('=' initial=expr)? NL
;
statements: statement*;
statementsBlock: statement*;
statement:
stmtIf
| stmtLoop
| stmtExitwhen
| stmtWhile
| localVarDef
| stmtSet
| stmtCall
| stmtReturn
| stmtForLoop
| stmtBreak
| stmtSkip
| stmtSwitch
;
stmtLoop: 'loop' NL statementsBlock ('end'|'endloop') NL;
stmtExitwhen: 'exitwhen' expr NL;
exprDestroy:
'destroy' expr
| expr '.' 'destroy' ('(' ')')?
;
stmtReturn:
'return' expr NL
;
stmtIf:
isStatic='static'? 'if' cond=expr 'then'? NL
thenStatements=statementsBlock
elseStatements
;
elseStatements:
'elseif' cond=expr 'then'? NL
thenStatements=statementsBlock
elseStatements
| 'else' NL statementsBlock ('endif'|'end') NL
| ('endif'|'end') NL
;
stmtSwitch:
'switch' expr NL
switchCase*
switchDefaultCase?
('end'|'endswitch')
;
switchCase:
'case' expr NL statementsBlock
;
switchDefaultCase:
'default' NL statementsBlock
;
stmtWhile:
'while' cond=expr NL statementsBlock
('end'|'endwhile')
;
localVarDef:
(var='var'|let='let'|'local'? type=typeExpr)
name=id ('=' initial=expr)? NL
;
localVarDefInline:
typeExpr? name=id
;
stmtSet:
'set'? left=exprAssignable
(assignOp=('='|'+='|'-='|'*='|'/=') right=expr
| incOp='++'
| decOp='--'
)
NL
;
exprAssignable:
exprMemberVar
| exprVarAccess
;
exprMemberVar:
expr dots=('.'|'..') varname=id indexes*
;
exprVarAccess:
varname=id indexes*
;
indexes:
'[' expr ']'
;
stmtCall: 'call'?
(
exprMemberMethod
| exprFunctionCall
| exprNewObject
| exprDestroy
) NL
;
exprMemberMethod:
receiver=expr dots=('.'|'..') funcName=id? typeArgs ('(' exprList ')')?
;
expr:
exprPrimary
| left=expr 'castTo' castToType=typeExpr
| left=expr 'instanceof' instaneofType=typeExpr
| receiver=expr dotsCall=('.'|'..') funcName=id? typeArgs '(' exprList ')'
| receiver=expr dotsVar=('.'|'..') varName=id? indexes*
| 'destroy' destroyedObject=expr
| destroyedObject=expr '.' 'destroy' '(' ')'
| left=expr op=('*'|'/'|'%'|'div'|'mod') right=expr
| op='-' right=expr // TODO move unary minus one up to be compatible with Java etc.
// currently it is here to be backwards compatible with the old wurst parser
| left=expr op=('+'|'-') right=expr
| left=expr op=('<='|'<'|'>'|'>=') right=expr
| left=expr op=('=='|'!=') right=expr
| op='not' right=expr
| left=expr op='and' right=expr
| left=expr op='or' right=expr
|
;
exprPrimary:
exprFunctionCall
| exprNewObject
| exprClosure
| exprStatementsBlock
| atom=(INT
| REAL
| STRING
| 'null'
| 'true'
| 'false'
| 'this'
| 'super')
| exprFuncRef
| varname=id indexes*
| '(' expr ')'
;
exprFuncRef: 'function' (scopeName=id '.')? funcName=id;
exprStatementsBlock:
'begin' NL statementsBlock 'end'
;
exprFunctionCall:
funcName=id typeArgs '(' exprList ')'
;
exprNewObject:'new' className=id typeArgs ('(' exprList ')')?;
exprClosure: formalParameters '->' expr;
typeParams: ('<' (params+=typeParam (',' params+=typeParam)*)? '>')?;
typeParam: name=id;
stmtForLoop:
forRangeLoop
| forIteratorLoop
;
forRangeLoop:
'for' loopVar=localVarDefInline '=' start=expr direction=('to'|'downto') end=expr ('step' step=expr)? NL
statementsBlock
('end'|'endfor')
;
forIteratorLoop:
'for' loopVar=localVarDefInline iterStyle=('in'|'from') iteratorExpr=expr NL
statementsBlock
('end'|'endfor')
;
stmtBreak:'break' NL;
stmtSkip:'skip' NL;
typeArgs: ('<' (args+=typeExpr (',' args+=typeExpr)*)? '>')?;
exprList : exprs+=expr (',' exprs+=expr)*;
nativeType: 'type' name=id ('extends' extended=id)? NL;
initBlock: 'init' NL
statementsBlock
('end'|'endinit') NL;
nativeDef: modifiersWithDoc 'native' funcSignature NL;
tupleDef: modifiersWithDoc 'tuple' name=id formalParameters NL;
extensionFuncDef: modifiersWithDoc 'function' receiverType=typeExpr '.' funcSignature NL
statementsBlock
('end'|'endfunction');
// some keywords are also valid identifiers for backwards compatibility reasons
id: ID|'end'|'init'|'this'|'new'|'destroy'|'it'|'to'|'from'|'class'|'thistype';
// Lexer:
CLASS: 'class';
RETURN: 'return';
IF: 'if';
ELSE: 'else';
WHILE: 'while';
FOR: 'for';
IN: 'in';
BREAK: 'break';
NEW: 'new';
NULL: 'null';
PACKAGE: 'package';
ENDPACKAGE: 'endpackage';
FUNCTION: 'function';
RETURNS: 'returns';
PUBLIC: 'public';
PULBICREAD: 'publicread';
READONLY: 'readonly';
DELEGATE: 'delegate';
STUB: 'stub';
PRIVATE: 'private';
PROTECTED: 'protected';
IMPORT: 'import';
INITLATER: 'initlater';
NATIVE: 'native';
NATIVETYPE: 'nativetype';
EXTENDS: 'extends';
INTERFACE: 'interface';
IMPLEMENTS: 'implements';
MODULE: 'module';
USE: 'use';
ABSTRACT: 'abstract';
STATIC: 'static';
THISTYPE: 'thistype';
OVERRIDE: 'override';
IMMUTABLE: 'immutable';
IT: 'it';
ARRAY: 'array';
AND: 'and';
OR: 'or';
NOT: 'not';
THIS: 'this';
CONSTRUCT: 'construct';
ONDESTROY: 'ondestroy';
DESTROY: 'destroy';
TYPE: 'type';
CONSTANT: 'constant';
ENDFUNCTION: 'endfunction';
NOTHING: 'nothing';
INIT: 'init';
CASTTO: 'castTo';
TUPLE: 'tuple';
DIV: 'div';
MOD: 'mod';
LET: 'let';
FROM: 'from';
TO: 'to';
DOWNTO: 'downto';
STEP: 'step';
SKIP: 'skip';
TRUE: 'true';
FALSE: 'false';
VAR: 'var';
INSTANCEOF: 'instanceof';
SUPER: 'super';
ENUM: 'enum';
SWITCH: 'switch';
CASE: 'case';
DEFAULT: 'default';
BEGIN: 'begin';
END: 'end';
LIBRARY: 'library';
ENDLIBRARY: 'endlibrary';
SCOPE: 'scope';
ENDSCOPE: 'endscope';
REQUIRES: 'requires';
USES: 'uses';
NEEDS: 'needs';
STRUCT: 'struct';
ENDSTRUCT: 'endstruct';
THEN: 'then';
ENDIF: 'endif';
LOOP: 'loop';
EXITHWHEN: 'exithwhen';
ENDLOOP: 'endloop';
METHOD: 'method';
TAKES: 'takes';
ENDMETHOD: 'endmethod';
SET: 'set';
CALL: 'call';
EXITWHEN: 'exitwhen';
INITIALIZER: 'initializer';
ENDINTERFACE: 'endinterface';
ENDCLASS: 'endclass';
ENDENUM: 'endenum';
ENDMODULE: 'endmodule';
ENDCONSTRUCT: 'endconstruct';
IMPLEMENT: 'implement';
ENDONDESTROY: 'endondestroy';
ENDSWITCH: 'endswitch';
ENDWHILE: 'endwhile';
ENDFOR: 'endfor';
ENDINIT: 'endinit';
COMMA: ',';
PLUS: '+';
PLUSPLUS: '++';
MINUS: '-';
MINUSMINUS: '--';
MULT: '*';
DIV_REAL: '/';
MOD_REAL: '%';
DOT: '.';
DOTDOT: '..';
PAREN_LEFT: '(';
PAREN_RIGHT: ')';
BRACKET_LEFT: '[';
BRACKET_RIGHT: ']';
EQ: '=';
EQEQ: '==';
NOT_EQ: '!=';
LESS: '<';
LESS_EQ: '<=';
GREATER: '>';
GREATER_EQ: '>=';
PLUS_EQ: '+=';
MINUS_EQ: '-=';
MULT_EQ: '*=';
DIV_EQ: '/=';
ARROW: '->';
INVALID:[];
JASS_GLOBALS: 'globals';
JASS_ENDGLOBALS: 'endglobals';
JASS_LOCAL: 'local';
JASS_ELSEIF: 'elseif';
NL: [\r\n]+;
ID: [a-zA-Z_][a-zA-Z0-9_]* ;
ANNOTATION: '@' [a-zA-Z0-9_]+;
STRING: '"' ( EscapeSequence | ~('\\'|'"'|'\r'|'\n') )* '"';
REAL: [0-9]+ '.' [0-9]* | '.'[0-9]+;
INT: [0-9]+ | '0x' [0-9a-fA-F]+ | '\'' . . . . '\'' | '\'' . '\'';
fragment EscapeSequence: '\\' [abfnrtvz"'\\];
DEBUG: 'debug' -> skip;
WS : [ \t]+ -> skip ;
HOTDOC_COMMENT: '/**' .*? '*/';
ML_COMMENT: '/*' .*? '*/' -> skip;
LINE_COMMENT: '//' ~[\r\n]* -> skip;
|
examples/utils/sdl/guiddef_h.ads | Fabien-Chouteau/GESTE | 13 | 24081 | <reponame>Fabien-Chouteau/GESTE<filename>examples/utils/sdl/guiddef_h.ads<gh_stars>10-100
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with System;
package guiddef_h is
-- unsupported macro: IID_NULL GUID_NULL
-- unsupported macro: CLSID_NULL GUID_NULL
-- unsupported macro: FMTID_NULL GUID_NULL
-- arg-macro: procedure IsEqualFMTID (rfmtid1, rfmtidIsEqualGUID(rfmtid1,rfmtid2)
-- IsEqualGUID(rfmtid1,rfmtid2)
-- unsupported macro: REFGUID const GUID &
-- unsupported macro: REFIID const IID &
-- unsupported macro: REFCLSID const IID &
-- unsupported macro: REFFMTID const IID &
-- arg-macro: procedure IsEqualIID (riid1, riid2)
-- IsEqualGUID(riid1,riid2)
-- arg-macro: procedure IsEqualCLSID (rclsid1, rclsidIsEqualGUID(rclsid1,rclsid2)
-- IsEqualGUID(rclsid1,rclsid2)
-- arg-macro: procedure DEFINE_GUID (name, l, w1, w2EXTERN_C const GUID name
-- EXTERN_C const GUID name
-- arg-macro: procedure DEFINE_OLEGUID (name, l, w1, w2DEFINE_GUID(name,l,w1,w2,16#C0#,0,0,0,0,0,0,16#46#)
-- DEFINE_GUID(name,l,w1,w2,16#C0#,0,0,0,0,0,0,16#46#)
type u_GUID_Data4_array is array (0 .. 7) of aliased unsigned_char;
type u_GUID is record
Data1 : aliased unsigned_long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:9
Data2 : aliased unsigned_short; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:10
Data3 : aliased unsigned_short; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:11
Data4 : aliased u_GUID_Data4_array; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:12
end record;
pragma Convention (C_Pass_By_Copy, u_GUID); -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:8
subtype GUID is u_GUID;
type LPGUID is access all GUID; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:59
type LPCGUID is access constant GUID; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:64
subtype IID is u_GUID;
type LPIID is access all IID; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:71
subtype CLSID is u_GUID;
type LPCLSID is access all CLSID; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:80
subtype FMTID is u_GUID;
type LPFMTID is access all FMTID; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:85
function InlineIsEqualGUID (rguid1 : System.Address; rguid2 : System.Address) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:138
pragma Import (C, InlineIsEqualGUID, "InlineIsEqualGUID");
function IsEqualGUID (rguid1 : System.Address; rguid2 : System.Address) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:142
pragma Import (C, IsEqualGUID, "IsEqualGUID");
function operator_eq (guidOne : System.Address; guidOther : System.Address) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:159
pragma Import (CPP, operator_eq, "_Zeq");
function operator_ne (guidOne : System.Address; guidOther : System.Address) return int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/guiddef.h:160
pragma Import (CPP, operator_ne, "_Zne");
end guiddef_h;
|
Test/test02.asm | KennardWang/Single-Cycle-Processor | 1 | 16776 | add $t0, $zero, $zero
addi $t1, $zero, 5
loop:
beq $t0, $t1, quit
addi $t0, $t0, 1
j loop
quit:
addi $t1, $t1, 1
|
Languages/Comb.agda | hbasold/Sandbox | 0 | 7105 | <filename>Languages/Comb.agda
{-# OPTIONS --copatterns --sized-types #-}
open import Level
open import Algebra.Structures
open import Relation.Binary
open import Algebra.FunctionProperties
module Comb (K : Set) (_≈_ : Rel K zero)
(_+_ _⋆_ : Op₂ K) (-_ : Op₁ K) (0# 1# : K)
(isRing : IsRing _≈_ _+_ _⋆_ -_ 0# 1#) where
open import Size
open import Function hiding (const)
open import Relation.Nullary
open import Stream
open import Data.Nat renaming (_+_ to _+ℕ_)
open import Data.Fin hiding (_+_)
open import Data.Product hiding (_×_)
open import Data.Empty
open import Relation.Binary.PropositionalEquality as P
using (_≡_) --; refl; sym; trans; cong; module ≡-Reasoning)
K-setoid : Setoid _ _
K-setoid = record { Carrier = K
; _≈_ = _≈_
; isEquivalence = IsRing.isEquivalence isRing }
open Bisim K-setoid
import Relation.Binary.EqReasoning as EqR
open EqR (K-setoid) public hiding (_≡⟨_⟩_)
--open IsEquivalence (IsRing.isEquivalence isRing)
open ∼-Reasoning renaming (begin_ to begin∼_; _∎ to _∎∼)
open IsRing isRing -- using (+-cong ; +-identity)
+-identityˡ = proj₁ +-identity
+-identityʳ = proj₂ +-identity
-- zeroʳ : RightZero 0# _⋆_
-- zeroʳ = ?
----------------------
--- Basic operators --
----------------------
const : ∀ {A} → A → Str A
hd (const x) = x
tl (const x) = const x
-- | Point-wise unary operations
pw₁ : ∀ {A i} → Op₁ A → Op₁ (Str {i} A)
hd (pw₁ f σ) = f (hd σ)
tl (pw₁ f σ) = pw₁ f (tl σ)
-- | Point-wise binary operations
pw₂ : ∀ {A i} → Op₂ A → Op₂ (Str {i} A)
hd (pw₂ f σ τ) = f (hd σ) (hd τ)
tl (pw₂ f σ τ) = pw₂ f (tl σ) (tl τ)
[_] : K → Str K
hd [ r ] = r
tl [ r ] = [ 0# ]
-- | Can, in conjunction with _×_, delay stream.
X : Str K
hd X = 0#
tl X = [ 1# ]
_⊕_ : ∀{i} → Str {i} K → Str {i} K → Str {i} K
_⊕_ = pw₂ _+_
⊝_ : ∀{i} → Str {i} K → Str {i} K
⊝_ = pw₁ (-_)
_×_ : ∀ {i} → Str {i} K → Str {i} K → Str {i} K
hd (σ × τ) = hd σ ⋆ hd τ
tl (σ × τ) = (tl σ × τ) ⊕ ([ hd σ ] × tl τ)
-- | We restrict attention to the case where the head is 1,
-- which is trivially invertible in any ring.
hasInv : ∀ {i} → Str {i} K → Set
hasInv σ = hd σ ≈ 1#
-- | Construct convolution inverse, if it exists.
inv : ∀ {i} → (σ : Str {i} K) → hasInv σ → Str {i} K
hd (inv σ p) = hd σ
tl (inv σ p) = ⊝ (tl σ × inv σ p)
-- | Powers of delay stream
X^_ : ℕ → Str K
X^ 0 = [ 1# ]
X^ (suc k) = X × (X^ k)
{-
record Summable (σ : Str (Str K)) : Set where
coinductive
field
hd-smble : ∃ λ n → δ n (hd σ) ∼ [ 0# ]
tl-smble : Summable (tl σ)
open Summable
-}
SummableDiag : {A : Set} (f : A → K) → Set
SummableDiag {A} f =
∃ λ n →
Σ (Fin n → A) (λ g →
(a : A) → ¬ ((f a) ≈ 0#) → ∃ λ i → a ≡ g i)
record Summable {A : Set} (f : A → Str K) : Set where
coinductive
field
hd-smble : SummableDiag (hd ∘ f)
tl-smble : Summable (tl' ∘ f)
open Summable
-- | Sum a finitely indexed family of elements of K.
-- This relies on commutativity etc. of addition in K.
sum : {n : ℕ} → (Fin n → K) → K
sum {ℕ.zero} f = 0#
sum {ℕ.suc n} f = f Fin.zero + sum (f ∘ Fin.suc)
-- | Sum a family of streams.
∑ : ∀ {A} → (f : A → Str K) → Summable f → Str K
hd (∑ f p) =
let (_ , g , _) = hd-smble p
in sum (hd ∘ f ∘ g)
tl (∑ f p) = ∑ (tl' ∘ f) (tl-smble p)
-- | Constant family of zero streams is summable
zero-summable : Summable {ℕ} (λ n → [ 0# ])
hd-smble zero-summable
= (0 , f , q)
where
f : Fin 0 → ℕ
f ()
q : (n : ℕ) → ¬ (hd [ 0# ] ≈ 0#) → ∃ λ i → n ≡ f i
q n p = ⊥-elim (p (IsRing.refl isRing))
tl-smble zero-summable = zero-summable
polySeq : ∀{i} → Str {i} (Str K) → Str {i} (Str K)
hd (polySeq σ) = hd σ × (X^ 0)
tl (polySeq σ) = pw₂ _×_ (polySeq (tl σ)) (const X)
polySeq₁ : Str (Str K) → (ℕ → Str K)
polySeq₁ σ = _at_ (polySeq σ)
polySeq₂ : (ℕ → Str K) → (ℕ → Str K)
polySeq₂ f = polySeq₁ (toStr f)
polySeq-summable : (σ : Str (Str K)) → Summable (polySeq₁ σ)
hd-smble (polySeq-summable σ) = q
where
q : SummableDiag (hd ∘ polySeq₁ σ)
q = {!!}
tl-smble (polySeq-summable σ) = {!!}
{-
polySeq-expl : (σ : Str (Str K)) → (i : ℕ) → (polySeq σ at i) ≡ (σ at i) × (X^ i)
polySeq-expl σ zero = refl
polySeq-expl σ (suc i) =
polySeq σ at (ℕ.suc i)
≡⟨ ? ⟩
(σ at (ℕ.suc i)) × (X × (X^ i))
∎
-}
-- lem : {f : ℕ → Str K} {k n : ℕ} → ¬ (polySeq f k at n) ≈ 0# → k ≡ n
-- lem = {!!}
{-
polySeq-summable-aux : {f : ℕ → Str K} →
(n : ℕ) → (g : ℕ → Str K) → Summable (polySeq f)
hd-smble (polySeq-summable-aux f n) = (1 , supp , {!!})
where
p = polySeq f
supp : Fin 1 → ℕ
supp Fin.zero = n
supp (Fin.suc ())
is-supp : (k : ℕ) → ¬ (hd (p k) ≈ 0#) → ∃ λ i → k ≡ supp i
is-supp k q = (Fin.zero , {!!})
tl-smble (polySeq-summable-aux f n) = {!!}
-}
hd-delay-zero : (σ : Str K) → hd (X × σ) ≈ 0#
hd-delay-zero σ = zeroˡ (hd σ)
where
open IsNearSemiring (IsRing.isNearSemiring isRing)
⊕-cong : ∀ {i s t u v} → s ∼[ i ] t → u ∼[ i ] v → (s ⊕ u) ∼[ i ] (t ⊕ v)
hd≈ (⊕-cong s~t u~v) = +-cong (hd≈ s~t) (hd≈ u~v)
tl∼ (⊕-cong s~t u~v) = ⊕-cong (tl∼ s~t) (tl∼ u~v)
⊕-unitˡ : ∀ {i} → LeftIdentity (_∼_ {i}) [ 0# ] _⊕_
hd≈ (⊕-unitˡ s) = proj₁ +-identity (hd s)
tl∼ (⊕-unitˡ s) = ⊕-unitˡ (tl s)
⊕-comm : ∀ {i} → Commutative (_∼_ {i}) _⊕_
hd≈ (⊕-comm s t) = +-comm (hd s) (hd t)
tl∼ (⊕-comm s t) = ⊕-comm (tl s) (tl t)
⊕-unitʳ : ∀ {i} → RightIdentity (_∼_ {i}) [ 0# ] _⊕_
⊕-unitʳ s =
s-bisim-trans
(⊕-comm s [ 0# ])
(⊕-unitˡ s)
×-zeroˡ : ∀ {i} → LeftZero (_∼_ {i}) [ 0# ] _×_
hd≈ (×-zeroˡ s) = zeroˡ (hd s)
where
open IsNearSemiring (IsRing.isNearSemiring isRing)
tl∼ (×-zeroˡ s) {j} =
s-bisim-trans
(⊕-cong {j} (×-zeroˡ s) (×-zeroˡ (tl s)))
(⊕-unitˡ [ 0# ])
×-unitˡ : ∀ {i} → LeftIdentity (_∼_ {i}) [ 1# ] _×_
hd≈ (×-unitˡ s) = proj₁ *-identity (hd s)
tl∼ (×-unitˡ s) {j} =
s-bisim-trans
(⊕-cong {j} (×-zeroˡ s) (×-unitˡ (tl s)))
(⊕-unitˡ (tl s))
tl-delay-id : (σ : Str K) → tl (X × σ) ∼ σ
tl-delay-id σ =
begin∼
tl (X × σ)
∼⟨ S.refl ⟩
(tl X × σ) ⊕ ([ hd X ] × tl σ)
∼⟨ S.refl ⟩
([ 1# ] × σ) ⊕ ([ 0# ] × tl σ)
∼⟨ ⊕-cong (×-unitˡ σ) (×-zeroˡ (tl σ)) ⟩
σ ⊕ [ 0# ]
∼⟨ ⊕-unitʳ σ ⟩
σ
∎∼
where
module S = Setoid stream-setoid
-- | The analogue of the fundamental theorem
decomp-str : (σ : Str K) → σ ∼ ([ hd σ ] ⊕ (X × tl σ))
hd≈ (decomp-str σ) =
begin
hd σ
≈⟨ sym (+-identityʳ (hd σ)) ⟩
hd σ + 0#
≈⟨ sym (+-cong refl (hd-delay-zero (tl σ))) ⟩
hd [ hd σ ] + hd (X × tl σ)
≈⟨ refl ⟩
hd ([ hd σ ] ⊕ (X × tl σ))
∎
tl∼ (decomp-str σ) =
begin∼
tl σ
∼⟨ S.sym (tl-delay-id (tl σ)) ⟩
tl (X × tl σ)
∼⟨ S.sym (⊕-unitˡ (tl (X × tl σ))) ⟩
[ 0# ] ⊕ tl (X × tl σ)
∼⟨ S.refl ⟩
tl ([ hd σ ] ⊕ (X × tl σ))
∎∼
where
module S = Setoid stream-setoid
|
oeis/042/A042511.asm | neoneye/loda-programs | 11 | 162487 | <reponame>neoneye/loda-programs
; A042511: Denominators of continued fraction convergents to sqrt(783).
; Submitted by <NAME>
; 1,1,55,56,3079,3135,172369,175504,9649585,9825089,540204391,550029480,30241796311,30791825791,1693000389025,1723792214816,94777779989089,96501572203905,5305862678999959,5402364251203864,297033532244008615,302435896495212479,16628571942985482481,16931007839480694960,930902995274943010321,947834003114423705281,52113939163453823095495,53061773166568246800776,2917449690158139150337399,2970511463324707397138175,163325068709692338595798849,166295580173017045992937024,9143286398052612822214398145
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
dif $2,9
mul $2,9
dif $2,6
mul $2,3
add $3,$2
lpe
mov $0,$2
div $0,27
|
Math/NumberTheory/Summation/Generic/Properties/Lemma.agda | rei1024/agda-misc | 3 | 22 | <filename>Math/NumberTheory/Summation/Generic/Properties/Lemma.agda
{-# OPTIONS --without-K --safe #-}
module Math.NumberTheory.Summation.Generic.Properties.Lemma where
-- agda-stdlib
open import Data.Nat
open import Data.Nat.Properties
open import Data.Nat.Solver
open import Relation.Binary.PropositionalEquality
open import Function.Base
lemma₁ : ∀ m n → 2 + m + n ≡ suc m + suc n
lemma₁ = solve 2 (λ m n → con 2 :+ m :+ n := con 1 :+ m :+ (con 1 :+ n)) refl
where open +-*-Solver
|
src/sdl-versions.ads | Fabien-Chouteau/sdlada | 1 | 30682 | <reponame>Fabien-Chouteau/sdlada<gh_stars>1-10
--------------------------------------------------------------------------------------------------------------------
-- 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.Versions
--
-- Library version information.
--------------------------------------------------------------------------------------------------------------------
package SDL.Versions is
type Version_Level is mod 2 ** 8 with
Size => 8,
Convention => C;
-- TODO: Check this against the library, as they use an int.
type Revision_Level is mod 2 ** 32;
type Version is
record
Major : Version_Level;
Minor : Version_Level;
Patch : Version_Level;
end record with
Convention => C;
-- These allow the user to determine which version of SDLAda they compiled with.
Compiled_Major : constant Version_Level with
Import => True,
Convention => C,
External_Name => "SDL_Ada_Major_Version";
Compiled_Minor : constant Version_Level with
Import => True,
Convention => C,
External_Name => "SDL_Ada_Minor_Version";
Compiled_Patch : constant Version_Level with
Import => True,
Convention => C,
External_Name => "SDL_Ada_Patch_Version";
Compiled : constant Version := (Major => Compiled_Major, Minor => Compiled_Minor, Patch => Compiled_Patch);
function Revision return String with
Inline => True;
function Revision return Revision_Level;
procedure Linked_With (Info : in out Version);
end SDL.Versions;
|
base/agda/Base/Free/Instance/Maybe.agda | FreeProving/free-compiler | 36 | 9715 | <gh_stars>10-100
module Base.Free.Instance.Maybe where
open import Data.Unit using (⊤; tt)
open import Data.Empty using (⊥)
open import Base.Free using (Free; pure; impure)
open import Base.Partial using (Partial)
open Partial
-- Representation of the `Maybe` monad using Free.
Shape : Set
Shape = ⊤
Position : Shape → Set
Position _ = ⊥
Maybe : Set → Set
Maybe = Free Shape Position
Nothing : ∀ {A} → Maybe A
Nothing = impure tt λ()
Just : ∀ {A} → A → Maybe A
Just x = pure x
instance
maybePartial : Partial Shape Position
undefined maybePartial = Nothing
error maybePartial _ = Nothing
|
oeis/262/A262183.asm | neoneye/loda-programs | 11 | 1271 | <filename>oeis/262/A262183.asm
; A262183: a(0) = 0, a(n) = 10*a(n-1) + n*(n+1)*(n+2)/6.
; 0,1,14,150,1520,15235,152406,1524144,15241560,152415765,1524157870,15241578986,152415790224,1524157902695,15241579027510,152415790275780,1524157902758616,15241579027587129,152415790275872430,1524157902758725630,15241579027587257840,152415790275872580171,1524157902758725803734,15241579027587258039640,152415790275872580399000,1524157902758725803992925,15241579027587258039932526,152415790275872580399328914,1524157902758725803993293200,15241579027587258039932936495,152415790275872580399329369910
lpb $0
mov $2,$0
sub $0,1
seq $2,52262 ; Partial sums of A014824.
mul $2,2
add $3,$2
lpe
mov $0,$3
div $0,2
|
test/asset/agda-stdlib-1.0/Data/List/Relation/Unary/First.agda | omega12345/agda-mode | 0 | 9602 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- First generalizes the idea that an element is the first in a list to
-- satisfy a predicate.
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.List.Relation.Unary.First {a} {A : Set a} where
open import Level using (_⊔_)
open import Data.Empty
open import Data.Fin as Fin using (Fin; zero; suc)
open import Data.List.Base as List using (List; []; _∷_)
open import Data.List.Relation.Unary.All as All using (All; []; _∷_)
open import Data.List.Relation.Unary.Any as Any using (Any; here; there)
open import Data.Product as Prod using (∃; -,_; _,_)
open import Data.Sum as Sum using (_⊎_; inj₁; inj₂)
open import Function
open import Relation.Unary
open import Relation.Nullary
-----------------------------------------------------------------------
-- Basic type.
module _ {p q} (P : Pred A p) (Q : Pred A q) where
data First : Pred (List A) (a ⊔ p ⊔ q) where
[_] : ∀ {x xs} → Q x → First (x ∷ xs)
_∷_ : ∀ {x xs} → P x → First xs → First (x ∷ xs)
data FirstView : Pred (List A) (a ⊔ p ⊔ q) where
_++_∷_ : ∀ {xs y} → All P xs → Q y → ∀ ys → FirstView (xs List.++ y ∷ ys)
------------------------------------------------------------------------
-- map
module _ {p q r s} {P : Pred A p} {Q : Pred A q} {R : Pred A r} {S : Pred A s} where
map : P ⊆ R → Q ⊆ S → First P Q ⊆ First R S
map p⇒r q⇒r [ qx ] = [ q⇒r qx ]
map p⇒r q⇒r (px ∷ pqxs) = p⇒r px ∷ map p⇒r q⇒r pqxs
module _ {p q r} {P : Pred A p} {Q : Pred A q} {R : Pred A r} where
map₁ : P ⊆ R → First P Q ⊆ First R Q
map₁ p⇒r = map p⇒r id
map₂ : Q ⊆ R → First P Q ⊆ First P R
map₂ = map id
refine : P ⊆ Q ∪ R → First P Q ⊆ First R Q
refine f [ qx ] = [ qx ]
refine f (px ∷ pqxs) with f px
... | inj₁ qx = [ qx ]
... | inj₂ rx = rx ∷ refine f pqxs
module _ {p q} {P : Pred A p} {Q : Pred A q} where
------------------------------------------------------------------------
-- Operations
empty : ¬ First P Q []
empty ()
tail : ∀ {x xs} → ¬ Q x → First P Q (x ∷ xs) → First P Q xs
tail ¬qx [ qx ] = ⊥-elim (¬qx qx)
tail ¬qx (px ∷ pqxs) = pqxs
index : First P Q ⊆ (Fin ∘′ List.length)
index [ qx ] = zero
index (_ ∷ pqxs) = suc (index pqxs)
index-satisfied : ∀ {xs} (pqxs : First P Q xs) → Q (List.lookup xs (index pqxs))
index-satisfied [ qx ] = qx
index-satisfied (_ ∷ pqxs) = index-satisfied pqxs
satisfied : ∀ {xs} → First P Q xs → ∃ Q
satisfied pqxs = -, index-satisfied pqxs
satisfiable : Satisfiable Q → Satisfiable (First P Q)
satisfiable (x , qx) = List.[ x ] , [ qx ]
------------------------------------------------------------------------
-- Decidability results
first : Π[ P ∪ Q ] → Π[ First P Q ∪ All P ]
first p⊎q [] = inj₂ []
first p⊎q (x ∷ xs) with p⊎q x
... | inj₁ px = Sum.map (px ∷_) (px ∷_) (first p⊎q xs)
... | inj₂ qx = inj₁ [ qx ]
------------------------------------------------------------------------
-- Relationship with Any
module _ {q} {Q : Pred A q} where
fromAny : Any Q ⊆ First U Q
fromAny (here qx) = [ qx ]
fromAny (there any) = _ ∷ fromAny any
toAny : ∀ {p} {P : Pred A p} → First P Q ⊆ Any Q
toAny [ qx ] = here qx
toAny (_ ∷ pqxs) = there (toAny pqxs)
|
source/distributed/required/s-shasto.adb | ytomino/drake | 33 | 30784 | <filename>source/distributed/required/s-shasto.adb
pragma Check_Policy (Trace => Ignore);
package body System.Shared_Storage is
procedure Shared_Var_Lock (Var : String) is
begin
pragma Check (Trace, Ada.Debug.Put (Var));
Lock_Hook (Var);
end Shared_Var_Lock;
procedure Shared_Var_Unlock (Var : String) is
begin
pragma Check (Trace, Ada.Debug.Put (Var));
Unlock_Hook (Var);
end Shared_Var_Unlock;
package body Shared_Var_Procs is
procedure Read is
pragma Check (Trace, Ada.Debug.Put (Full_Name));
Stream : constant access Ada.Streams.Root_Stream_Type'Class :=
Read_Hook (Full_Name);
begin
if Stream /= null then
Typ'Read (Stream, V);
end if;
end Read;
procedure Write is
pragma Check (Trace, Ada.Debug.Put (Full_Name));
Stream : constant access Ada.Streams.Root_Stream_Type'Class :=
Write_Hook (Full_Name);
begin
if Stream /= null then
Typ'Write (Stream, V);
end if;
end Write;
end Shared_Var_Procs;
end System.Shared_Storage;
|
asm/echo.asm | mjan-cea/lipsi | 1 | 81926 | #
# Echo IO
# read input, add 1, write to output
#
loop:
io 0x0
addi 0x01
br loop
|
source/asis/spec/ada-strings-wide_unbounded.ads | faelys/gela-asis | 4 | 14637 | ------------------------------------------------------------------------------
-- A d a r u n - t i m e s p e c i f i c a t i o n --
-- ASIS implementation for Gela project, a portable Ada compiler --
-- http://gela.ada-ru.org --
-- - - - - - - - - - - - - - - - --
-- Read copyright and license at the end of ada.ads file --
------------------------------------------------------------------------------
-- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $
with Ada.Strings.Wide_Maps;
package Ada.Strings.Wide_Unbounded is
pragma Preelaborate (Wide_Unbounded);
type Unbounded_Wide_String is private;
pragma Preelaborable_Initialization (Unbounded_Wide_String);
Null_Unbounded_Wide_String : constant Unbounded_Wide_String;
function Length (Source : in Unbounded_Wide_String) return Natural;
type Wide_String_Access is access all Wide_String;
procedure Free (X : in out Wide_String_Access);
-- Conversion, Concatenation, and Selection functions
function To_Unbounded_Wide_String (Source : in Wide_String)
return Unbounded_Wide_String;
function To_Unbounded_Wide_String (Length : in Natural)
return Unbounded_Wide_String;
function To_Wide_String (Source : in Unbounded_Wide_String)
return Wide_String;
procedure Set_Unbounded_Wide_String
(Target : out Unbounded_Wide_String;
Source : in Wide_String);
procedure Append (Source : in out Unbounded_Wide_String;
New_Item : in Unbounded_Wide_String);
procedure Append (Source : in out Unbounded_Wide_String;
New_Item : in Wide_String);
procedure Append (Source : in out Unbounded_Wide_String;
New_Item : in Wide_Character);
function "&" (Left, Right : in Unbounded_Wide_String)
return Unbounded_Wide_String;
function "&" (Left : in Unbounded_Wide_String;
Right : in Wide_String)
return Unbounded_Wide_String;
function "&" (Left : in Wide_String;
Right : in Unbounded_Wide_String)
return Unbounded_Wide_String;
function "&" (Left : in Unbounded_Wide_String;
Right : in Wide_Character)
return Unbounded_Wide_String;
function "&" (Left : in Wide_Character;
Right : in Unbounded_Wide_String)
return Unbounded_Wide_String;
function Element (Source : in Unbounded_Wide_String;
Index : in Positive)
return Wide_Character;
procedure Replace_Element (Source : in out Unbounded_Wide_String;
Index : in Positive;
By : in Wide_Character);
function Slice (Source : in Unbounded_Wide_String;
Low : in Positive;
High : in Natural)
return Wide_String;
function Unbounded_Slice
(Source : in Unbounded_Wide_String;
Low : in Positive;
High : in Natural)
return Unbounded_Wide_String;
procedure Unbounded_Slice
(Source : in Unbounded_Wide_String;
Target : out Unbounded_Wide_String;
Low : in Positive;
High : in Natural);
function "=" (Left, Right : in Unbounded_Wide_String) return Boolean;
function "=" (Left : in Unbounded_Wide_String;
Right : in Wide_String)
return Boolean;
function "=" (Left : in Wide_String;
Right : in Unbounded_Wide_String)
return Boolean;
function "<" (Left, Right : in Unbounded_Wide_String) return Boolean;
function "<" (Left : in Unbounded_Wide_String;
Right : in Wide_String)
return Boolean;
function "<" (Left : in Wide_String;
Right : in Unbounded_Wide_String)
return Boolean;
function "<=" (Left, Right : in Unbounded_Wide_String) return Boolean;
function "<=" (Left : in Unbounded_Wide_String;
Right : in Wide_String)
return Boolean;
function "<=" (Left : in Wide_String;
Right : in Unbounded_Wide_String)
return Boolean;
function ">" (Left, Right : in Unbounded_Wide_String) return Boolean;
function ">" (Left : in Unbounded_Wide_String;
Right : in Wide_String)
return Boolean;
function ">" (Left : in Wide_String;
Right : in Unbounded_Wide_String)
return Boolean;
function ">=" (Left, Right : in Unbounded_Wide_String) return Boolean;
function ">=" (Left : in Unbounded_Wide_String; Right : in Wide_String)
return Boolean;
function ">=" (Left : in Wide_String;
Right : in Unbounded_Wide_String)
return Boolean;
-- Search subprograms
function Index (Source : in Unbounded_Wide_String;
Pattern : in Wide_String;
From : in Positive;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping
:= Wide_Maps.Identity)
return Natural;
function Index (Source : in Unbounded_Wide_String;
Pattern : in Wide_String;
From : in Positive;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural;
function Index (Source : in Unbounded_Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping
:= Wide_Maps.Identity)
return Natural;
function Index (Source : in Unbounded_Wide_String;
Pattern : in Wide_String;
Going : in Direction := Forward;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural;
function Index (Source : in Unbounded_Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
From : in Positive;
Test : in Membership := Inside;
Going : in Direction := Forward)
return Natural;
function Index (Source : in Unbounded_Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership := Inside;
Going : in Direction := Forward) return Natural;
function Index_Non_Blank (Source : in Unbounded_Wide_String;
From : in Positive;
Going : in Direction := Forward)
return Natural;
function Index_Non_Blank (Source : in Unbounded_Wide_String;
Going : in Direction := Forward)
return Natural;
function Count (Source : in Unbounded_Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping
:= Wide_Maps.Identity)
return Natural;
function Count (Source : in Unbounded_Wide_String;
Pattern : in Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Natural;
function Count (Source : in Unbounded_Wide_String;
Set : in Wide_Maps.Wide_Character_Set)
return Natural;
procedure Find_Token (Source : in Unbounded_Wide_String;
Set : in Wide_Maps.Wide_Character_Set;
Test : in Membership;
First : out Positive;
Last : out Natural);
-- Wide_String translation subprograms
function Translate (Source : in Unbounded_Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping)
return Unbounded_Wide_String;
procedure Translate (Source : in out Unbounded_Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping);
function Translate (Source : in Unbounded_Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function)
return Unbounded_Wide_String;
procedure Translate
(Source : in out Unbounded_Wide_String;
Mapping : in Wide_Maps.Wide_Character_Mapping_Function);
-- Wide_String transformation subprograms
function Replace_Slice (Source : in Unbounded_Wide_String;
Low : in Positive;
High : in Natural;
By : in Wide_String)
return Unbounded_Wide_String;
procedure Replace_Slice (Source : in out Unbounded_Wide_String;
Low : in Positive;
High : in Natural;
By : in Wide_String);
function Insert (Source : in Unbounded_Wide_String;
Before : in Positive;
New_Item : in Wide_String)
return Unbounded_Wide_String;
procedure Insert (Source : in out Unbounded_Wide_String;
Before : in Positive;
New_Item : in Wide_String);
function Overwrite (Source : in Unbounded_Wide_String;
Position : in Positive;
New_Item : in Wide_String)
return Unbounded_Wide_String;
procedure Overwrite (Source : in out Unbounded_Wide_String;
Position : in Positive;
New_Item : in Wide_String);
function Delete (Source : in Unbounded_Wide_String;
From : in Positive;
Through : in Natural)
return Unbounded_Wide_String;
procedure Delete (Source : in out Unbounded_Wide_String;
From : in Positive;
Through : in Natural);
function Trim (Source : in Unbounded_Wide_String;
Side : in Trim_End)
return Unbounded_Wide_String;
procedure Trim (Source : in out Unbounded_Wide_String;
Side : in Trim_End);
function Trim (Source : in Unbounded_Wide_String;
Left : in Wide_Maps.Wide_Character_Set;
Right : in Wide_Maps.Wide_Character_Set)
return Unbounded_Wide_String;
procedure Trim (Source : in out Unbounded_Wide_String;
Left : in Wide_Maps.Wide_Character_Set;
Right : in Wide_Maps.Wide_Character_Set);
function Head (Source : in Unbounded_Wide_String;
Count : in Natural;
Pad : in Wide_Character := Wide_Space)
return Unbounded_Wide_String;
procedure Head (Source : in out Unbounded_Wide_String;
Count : in Natural;
Pad : in Wide_Character := Wide_Space);
function Tail (Source : in Unbounded_Wide_String;
Count : in Natural;
Pad : in Wide_Character := Wide_Space)
return Unbounded_Wide_String;
procedure Tail (Source : in out Unbounded_Wide_String;
Count : in Natural;
Pad : in Wide_Character := Wide_Space);
function "*" (Left : in Natural;
Right : in Wide_Character)
return Unbounded_Wide_String;
function "*" (Left : in Natural;
Right : in Wide_String)
return Unbounded_Wide_String;
function "*" (Left : in Natural;
Right : in Unbounded_Wide_String)
return Unbounded_Wide_String;
private
pragma Import (Ada, Unbounded_Wide_String);
pragma Import (Ada, Null_Unbounded_Wide_String);
end Ada.Strings.Wide_Unbounded;
|
libsrc/_DEVELOPMENT/math/float/math32/lm32/z80/asm_mul2f.asm | jpoikela/z88dk | 0 | 90796 | <gh_stars>0
; float _mul2f (float number) __z88dk_fastcall
SECTION code_clib
SECTION code_fp_math32
PUBLIC asm_mul2f
EXTERN m32_mul2_fastcall
; Multiply a float by 2
;
; enter : stack = ret
; DEHL = sccz80_float number
;
; exit : DEHL = |sccz80_float|
;
; uses : de, hl
defc asm_mul2f = m32_mul2_fastcall
|
llvm-gcc-4.2-2.9/gcc/ada/s-exnllf.adb | vidkidz/crossbridge | 1 | 2865 | <reponame>vidkidz/crossbridge
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . E X N _ L L F --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-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. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body System.Exn_LLF is
-------------------------
-- Exn_Long_Long_Float --
-------------------------
function Exn_Long_Long_Float
(Left : Long_Long_Float;
Right : Integer)
return Long_Long_Float
is
Result : Long_Long_Float := 1.0;
Factor : Long_Long_Float := Left;
Exp : Integer := Right;
begin
-- We use the standard logarithmic approach, Exp gets shifted right
-- testing successive low order bits and Factor is the value of the
-- base raised to the next power of 2. If the low order bit or Exp is
-- set, multiply the result by this factor. For negative exponents,
-- invert result upon return.
if Exp >= 0 then
loop
if Exp rem 2 /= 0 then
Result := Result * Factor;
end if;
Exp := Exp / 2;
exit when Exp = 0;
Factor := Factor * Factor;
end loop;
return Result;
-- Here we have a negative exponent, and we compute the result as:
-- 1.0 / (Left ** (-Right))
-- Note that the case of Left being zero is not special, it will
-- simply result in a division by zero at the end, yielding a
-- correctly signed infinity, or possibly generating an overflow.
-- Note on overflow: The coding of this routine assumes that the
-- target generates infinities with standard IEEE semantics. If this
-- is not the case, then the code below may raise Constraint_Error.
-- This follows the implementation permission given in RM 4.5.6(12).
else
begin
loop
if Exp rem 2 /= 0 then
Result := Result * Factor;
end if;
Exp := Exp / 2;
exit when Exp = 0;
Factor := Factor * Factor;
end loop;
return 1.0 / Result;
end;
end if;
end Exn_Long_Long_Float;
end System.Exn_LLF;
|
src/adabots_lua_dispatcher.ads | TamaMcGlinn/AdaBots | 5 | 17424 | <reponame>TamaMcGlinn/AdaBots
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Finalization;
package Adabots_Lua_Dispatcher is
type Lua_Dispatcher is new Ada.Finalization.Limited_Controlled with private;
function Create_Lua_Dispatcher return Lua_Dispatcher;
function Create_Lua_Dispatcher (Port : Integer) return Lua_Dispatcher;
function Raw_Function (T : Lua_Dispatcher; Lua_Code : String) return String;
function Boolean_Function
(T : Lua_Dispatcher; Lua_Code : String) return Boolean;
procedure Raw_Procedure (T : Lua_Dispatcher; Lua_Code : String);
private
task type Command_Server (Port : Integer) is
entry Schedule_Command (Command : String);
entry Fetch_Command (Command : out Unbounded_String);
entry Push_Return_Value (Return_Value : String);
entry Get_Result (Result : out Unbounded_String);
entry Shutdown;
end Command_Server;
type Access_Command_Server is access Command_Server;
type Lua_Dispatcher is new Ada.Finalization.Limited_Controlled with record
Server : Access_Command_Server;
end record;
overriding procedure Finalize (T : in out Lua_Dispatcher);
end Adabots_Lua_Dispatcher;
|
src/005/animals-humans.ads | xeenta/learning-ada | 0 | 10964 | with Ada.Strings.Unbounded;
package Animals.Humans is
type Human is new Animals.Animal with private;
type Sex_Type is (Male, Female);
function Make
(Name : String;
Sex : Sex_Type)
return Human;
function Get_Name (H : Human) return Ada.Strings.Unbounded.Unbounded_String;
function Get_Sex (H : Human) return Sex_Type;
overriding
procedure Add_Wings (A : in out Human;
N : Positive);
private
type Human is new Animals.Animal with
record
Name : Ada.Strings.Unbounded.Unbounded_String;
Sex : Sex_Type;
end record;
end Animals.Humans;
|
src/numerics-sparse_matrices-direct_sum.adb | sciencylab/lagrangian-solver | 0 | 28969 | <reponame>sciencylab/lagrangian-solver
separate (Numerics.Sparse_Matrices)
function Direct_Sum (A, B : in Sparse_Matrix) return Sparse_Matrix is
C : Sparse_Matrix;
NRow : constant Pos := A.N_Row;
NP : constant Pos := A.P (A.N_Col + 1);
use Ada.Containers;
begin
pragma Assert (A.Format = CSC and B.Format = CSC);
C.Format := CSC;
C.N_Col := A.N_Col + B.N_Col;
C.N_Row := A.N_Row + B.N_Row;
C.X.Reserve_Capacity (A.X.Length + B.X.Length);
C.I.Reserve_Capacity (A.I.Length + B.I.Length);
C.P.Reserve_Capacity (A.P.Length + B.P.Length - 1);
-- left matrix
for J in 1 .. Pos (A.I.Length) loop
C.X.Append (A.X (J));
end loop;
for J in 1 .. Pos (A.I.Length) loop
C.I.Append (A.I (J));
end loop;
for J in 1 .. Pos (A.P.Length) loop
C.P.Append (A.P (J));
end loop;
-- right matrix
for J in 1 .. Pos (B.I.Length) loop
C.X.Append (B.X (J));
end loop;
for J in 1 .. Pos (B.I.Length) loop
C.I.Append (NRow + B.I (J));
end loop;
for J in 2 .. Pos (B.P.Length) loop
C.P.Append (NP + B.P (J) - 1);
end loop;
return C;
end Direct_Sum;
|
programs/oeis/195/A195042.asm | karttu/loda | 0 | 2818 | <reponame>karttu/loda
; A195042: Concentric 9-gonal numbers.
; 0,1,9,19,36,55,81,109,144,181,225,271,324,379,441,505,576,649,729,811,900,991,1089,1189,1296,1405,1521,1639,1764,1891,2025,2161,2304,2449,2601,2755,2916,3079,3249,3421,3600,3781,3969,4159,4356,4555,4761,4969,5184,5401,5625,5851,6084,6319,6561,6805,7056,7309,7569,7831,8100,8371,8649,8929,9216,9505,9801,10099,10404,10711,11025,11341,11664,11989,12321,12655,12996,13339,13689,14041,14400,14761,15129,15499,15876,16255,16641,17029,17424,17821,18225,18631,19044,19459,19881,20305,20736,21169,21609,22051,22500,22951,23409,23869,24336,24805,25281,25759,26244,26731,27225,27721,28224,28729,29241,29755,30276,30799,31329,31861,32400,32941,33489,34039,34596,35155,35721,36289,36864,37441,38025,38611,39204,39799,40401,41005,41616,42229,42849,43471,44100,44731,45369,46009,46656,47305,47961,48619,49284,49951,50625,51301,51984,52669,53361,54055,54756,55459,56169,56881,57600,58321,59049,59779,60516,61255,62001,62749,63504,64261,65025,65791,66564,67339,68121,68905,69696,70489,71289,72091,72900,73711,74529,75349,76176,77005,77841,78679,79524,80371,81225,82081,82944,83809,84681,85555,86436,87319,88209,89101,90000,90901,91809,92719,93636,94555,95481,96409,97344,98281,99225,100171,101124,102079,103041,104005,104976,105949,106929,107911,108900,109891,110889,111889,112896,113905,114921,115939,116964,117991,119025,120061,121104,122149,123201,124255,125316,126379,127449,128521,129600,130681,131769,132859,133956,135055,136161,137269,138384,139501
pow $0,2
mov $1,$0
mov $2,$0
div $2,4
mul $2,5
add $1,$2
|
agda/Categories/Pushout.agda | oisdk/combinatorics-paper | 6 | 7773 | {-# OPTIONS --cubical --safe #-}
open import Prelude hiding (A; B)
open import Categories
module Categories.Pushout {ℓ₁ ℓ₂} (C : Category ℓ₁ ℓ₂) where
open Category C
private
variable
A B : Ob
h₁ h₂ j : A ⟶ B
record Pushout (f : X ⟶ Y) (g : X ⟶ Z) : Type (ℓ₁ ℓ⊔ ℓ₂) where
field
{Q} : Ob
i₁ : Y ⟶ Q
i₂ : Z ⟶ Q
commute : i₁ · f ≡ i₂ · g
universal : h₁ · f ≡ h₂ · g → Q ⟶ Codomain h₁
unique : ∀ {eq : h₁ · f ≡ h₂ · g} →
j · i₁ ≡ h₁ → j · i₂ ≡ h₂ →
j ≡ universal eq
universal·i₁≡h₁ : ∀ {eq : h₁ · f ≡ h₂ · g} →
universal eq · i₁ ≡ h₁
universal·i₂≡h₂ : ∀ {eq : h₁ · f ≡ h₂ · g} →
universal eq · i₂ ≡ h₂
HasPushouts : Type (ℓ₁ ℓ⊔ ℓ₂)
HasPushouts = ∀ {X Y Z} → (f : X ⟶ Y) → (g : X ⟶ Z) → Pushout f g
|
Working Disassembly/Levels/HCZ/Misc Object Data/Map - Water Rush.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 5 | 97856 | Map_22E60C_: dc.w Frame_22E684-Map_22E60C_
dc.w Frame_22E6F8-Map_22E60C_
dc.w Frame_22E614-Map_22E60C_
dc.w Frame_22E646-Map_22E60C_
Frame_22E614: dc.w 8
dc.b $E0, 7, 0,$20,$FF,$E0
dc.b $E0, $F, 0,$18,$FF,$F0
dc.b $E0, $F, 0,$18, 0,$10
dc.b $E0, $F, 0,$18, 0,$30
dc.b 0, $F, 0,$30,$FF,$E0
dc.b 0, $F, 0,$30, 0, 0
dc.b 0, $F, 0,$30, 0,$20
dc.b 0, 7, 0,$30, 0,$40
Frame_22E646: dc.w $A
dc.b $E0, 7, 0,$20,$FF,$E0
dc.b $E0, $F, 0,$18,$FF,$F0
dc.b $E0, $F, 0,$18, 0,$10
dc.b $E0, $F, 0,$18, 0,$30
dc.b 0, $F, 0, 0,$FF,$C0
dc.b 0, 7, 0,$48,$FF,$E0
dc.b 0, 7, 0,$38,$FF,$F0
dc.b 0, $F, 0,$30, 0, 0
dc.b 0, $F, 0,$30, 0,$20
dc.b 0, 7, 0,$30, 0,$40
Frame_22E684: dc.w $13
dc.b $E0, $F, 0, 0,$FF,$C0
dc.b $E0, 7, 0,$10,$FF,$E0
dc.b $E0, $F, 0,$18,$FF,$F0
dc.b $E0, $F, 0,$18, 0,$10
dc.b $E0, $F, 0,$18, 0,$30
dc.b $E0, $F, 0,$18, 0,$50
dc.b $E0, 7, 0,$18, 0,$70
dc.b 0, $F, 0, 0,$FF,$D0
dc.b 0, 7, 0,$28,$FF,$F0
dc.b 0, $F, 0,$30, 0, 0
dc.b 0, $F, 0,$30, 0,$20
dc.b 0, $F, 0,$30, 0,$40
dc.b 0, $F, 0,$30, 0,$60
dc.b $20, $F, 0, 0,$FF,$E0
dc.b $20, 7, 0,$28, 0, 0
dc.b $20, $F, 0,$30, 0,$10
dc.b $20, $F, 0,$30, 0,$30
dc.b $20, $F, 0,$30, 0,$50
dc.b $20, 7, 0,$30, 0,$70
Frame_22E6F8: dc.w $13
dc.b $E0, $F, 0, 0,$FF,$D0
dc.b $E0, 7, 0,$40,$FF,$F0
dc.b $E0, 7, 0,$20, 0, 0
dc.b $E0, $F, 0,$18, 0,$10
dc.b $E0, $F, 0,$18, 0,$30
dc.b $E0, $F, 0,$18, 0,$50
dc.b $E0, 7, 0,$18, 0,$70
dc.b 0, $F, 0, 0,$FF,$E0
dc.b 0, 7, 0,$48, 0, 0
dc.b 0, 7, 0,$38, 0,$10
dc.b 0, $F, 0,$30, 0,$20
dc.b 0, $F, 0,$30, 0,$40
dc.b 0, $F, 0,$30, 0,$60
dc.b $20, $F, 0, 0,$FF,$F0
dc.b $20, 7, 0,$48, 0,$10
dc.b $20, 7, 0,$38, 0,$20
dc.b $20, $F, 0,$30, 0,$30
dc.b $20, $F, 0,$30, 0,$50
dc.b $20, 7, 0,$30, 0,$70
|
src/annotation_processor/implementation/yaml-transformator-annotation-for_loop.ads | robdaemon/AdaYaml | 32 | 24817 | <filename>src/annotation_processor/implementation/yaml-transformator-annotation-for_loop.ads
-- part of AdaYaml, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "copying.txt"
private with Yaml.Events.Store;
package Yaml.Transformator.Annotation.For_Loop is
type Instance is limited new Transformator.Instance with private;
overriding procedure Put (Object : in out Instance; E : Event);
overriding function Has_Next (Object : Instance) return Boolean;
overriding function Next (Object : in out Instance) return Event;
function New_For_Loop (Pool : Text.Pool.Reference;
Node_Context : Node_Context_Type;
Processor_Context : Events.Context.Reference;
Swallows_Previous : out Boolean)
return not null Pointer;
private
type State_Type is not null access procedure (Object : in out Instance;
E : Event);
procedure Initial (Object : in out Instance; E : Event);
procedure After_Annotation_Start (Object : in out Instance; E : Event);
procedure After_Variable_Name (Object : in out Instance; E : Event);
procedure In_Sequence_Parameter (Object : in out Instance; E : Event);
procedure After_Sequence_Parameter (Object : in out Instance; E : Event);
procedure After_Annotation_End (Object : in out Instance; E : Event);
procedure In_Body (Object : in out Instance; E : Event);
procedure Emitting (Object : in out Instance; E : Event);
type Emitting_State_Type is (Emit_Sequence_Start, Emit_Sequence_Body_Start,
Emit_Sequence_Body, Emit_Sequence_End,
Emitting_Finished);
type Instance is limited new Transformator.Instance with record
Node_Properties : Properties;
Context : Events.Context.Reference;
Depth : Natural := 0;
State : State_Type := Initial'Access;
Emitting_State : Emitting_State_Type := Emit_Sequence_Start;
Loop_Variable : Events.Context.Symbol_Cursor;
Loop_Variable_Store, Body_Store : Events.Store.Optional_Reference;
Loop_Variable_Target, Body_Start, Next_Event :
Events.Store.Element_Cursor;
Header_Locals, Body_Locals : Events.Context.Local_Scope_Cursor;
end record;
overriding procedure Finalize (Object : in out Instance);
end Yaml.Transformator.Annotation.For_Loop;
|
oeis/026/A026616.asm | neoneye/loda-programs | 11 | 165453 | ; A026616: T(2n,n), T given by A026615.
; Submitted by <NAME>
; 1,3,10,34,120,434,1596,5940,22308,84370,320892,1226108,4702880,18097044,69832600,270118440,1047043260,4066132050,15816664380,61615392300,240347793840,938669220060,3669940053000
mov $3,2
mov $5,$0
lpb $3
sub $3,1
add $0,$3
sub $0,1
mov $6,2
lpb $6
mov $4,$0
mul $4,2
bin $4,$0
sub $6,2
lpe
mov $2,$3
sub $4,$1
mul $2,$4
add $1,$2
lpe
min $5,1
mul $5,$4
sub $1,$5
mov $0,$1
|
tests/tk-ttkwidget-ttk_widget_options_test_data.ads | thindil/tashy2 | 2 | 22932 | <filename>tests/tk-ttkwidget-ttk_widget_options_test_data.ads
-- This package is intended to set up and tear down the test environment.
-- Once created by GNATtest, this package will never be overwritten
-- automatically. Contents of this package can be modified in any way
-- except for sections surrounded by a 'read only' marker.
with Tk.Widget.Widget_Options_Test_Data.Widget_Options_Tests;
with GNATtest_Generated;
package Tk.TtkWidget.Ttk_Widget_Options_Test_Data is
-- begin read only
type Test_Ttk_Widget_Options is abstract new GNATtest_Generated
.GNATtest_Standard
.Tk
.Widget
.Widget_Options_Test_Data
.Widget_Options_Tests
.Test_Widget_Options
-- end read only
with
null record;
end Tk.TtkWidget.Ttk_Widget_Options_Test_Data;
|
oeis/037/A037711.asm | neoneye/loda-programs | 11 | 165420 | <reponame>neoneye/loda-programs
; A037711: Base 6 digits are, in order, the first n terms of the periodic sequence with initial period 1,3,2,0.
; Submitted by <NAME>(s1.)
; 1,9,56,336,2017,12105,72632,435792,2614753,15688521,94131128,564786768,3388720609,20332323657,121993941944,731963651664,4391781909985,26350691459913,158104148759480,948624892556880,5691749355341281
add $0,1
mov $2,1
lpb $0
mov $3,$2
lpb $3
add $2,1
mod $3,5
div $4,7
cmp $4,0
sub $3,$4
add $5,1
lpe
sub $0,1
add $2,1
mul $5,6
lpe
mov $0,$5
div $0,6
|
src/execute-leds.adb | hgrodriguez/embedded-dashboard-console | 0 | 4556 | --
-- Copyright 2021 (C) <NAME>
--
-- SPDX-License-Identifier: BSD-3-Clause
--
with LED_Control;
package body Execute.LEDs is
--------------------------------------------------------------------------
-- definition of the look up table for the procedures to execute
-- based on the command given
--------------------------------------------------------------------------
type LED_Execute is access procedure;
type LED_Execute_Map is array (LED_Commands) of LED_Execute;
LED_Execute_Mapper : constant LED_Execute_Map
:= (
------------------------------
-- Red LED operation mappings
------------------------------
Red_Off => LED_Control.LED_0_Red_Off'Access,
Red_On => LED_Control.LED_0_Red_On'Access,
Red_Toggle => LED_Control.LED_0_Red_Toggle'Access,
--------------------------------
-- Amber LED operation mappings
--------------------------------
Amber_Off => LED_Control.LED_0_Amber_Off'Access,
Amber_On => LED_Control.LED_0_Amber_On'Access,
Amber_Toggle => LED_Control.LED_0_Amber_Toggle'Access,
--------------------------------
-- Green LED operation mappings
--------------------------------
Green_Off => LED_Control.LED_0_Green_Off'Access,
Green_On => LED_Control.LED_0_Green_On'Access,
Green_Toggle => LED_Control.LED_0_Green_Toggle'Access,
--------------------------------
-- White LED operation mappings
--------------------------------
White_Off => LED_Control.LED_0_White_Off'Access,
White_On => LED_Control.LED_0_White_On'Access,
White_Toggle => LED_Control.LED_0_White_Toggle'Access,
--------------------------------
-- Blue LED operation mappings
--------------------------------
Blue_Off => LED_Control.LED_0_Blue_Off'Access,
Blue_On => LED_Control.LED_0_Blue_On'Access,
Blue_Toggle => LED_Control.LED_0_Blue_Toggle'Access
);
--------------------------------------------------------------------------
-- see .ads
--------------------------------------------------------------------------
procedure Execute (Cmd : LED_Commands) is
begin
LED_Execute_Mapper (Cmd).all;
end Execute;
end Execute.LEDs;
|
Pure64 v0.5.0 Distribution/src/fat16.asm | svilerino/intel_multicore | 1 | 18726 | ; =============================================================================
; Pure64 -- a 64-bit OS loader written in Assembly for x86-64 systems
; Copyright (C) 2008-2012 Return Infinity -- see LICENSE.TXT
;
; FAT16 functions
; =============================================================================
; -----------------------------------------------------------------------------
; readcluster -- Read a cluster from the FAT16 partition
; IN: AX - (cluster)
; RDI - (memory location to store at least 32KB)
; OUT: AX - (next cluster)
; RDI - points one byte after the last byte read
readcluster:
push rsi
push rdx
push rcx
push rbx
and rax, 0x000000000000FFFF ; Clear the top 48 bits
mov rbx, rax ; Save the cluster number to be used later
cmp ax, 2 ; If less than 2 then bail out...
jl near readcluster_bailout ; as clusters start at 2
; Calculate the LBA address --- startingsector = (cluster-2) * clustersize + data_start
xor rcx, rcx
mov cl, byte [fat16_SectorsPerCluster]
push rcx ; Save the number of sectors per cluster
sub ax, 2
imul cx ; EAX now holds starting sector
add eax, dword [fat16_DataStart] ; EAX now holds the sector where our cluster starts
add eax, [fat16_PartitionOffset] ; Add the offset to the partition
pop rcx ; Restore the number of sectors per cluster
call readsectors ; Read one cluster of sectors
cmp rcx, 0
je readcluster_error
; Calculate the next cluster
; Psuedo-code
; tint1 = Cluster / 256 <- Dump the remainder
; sector_to_read = tint1 + ReservedSectors
; tint2 = (Cluster - (tint1 * 256)) * 2
push rdi
mov rdi, hdbuffer1 ; Read to this temporary buffer
mov rsi, rdi ; Copy buffer address to RSI
push rbx ; Save the original cluster value
shr rbx, 8 ; Divide the cluster value by 256. Keep no remainder
movzx ax, [fat16_ReservedSectors] ; First sector of the first FAT
add eax, [fat16_PartitionOffset] ; Add the offset to the partition
add rax, rbx ; Add the sector offset
mov rcx, 1
call readsectors
cmp rcx, 0
je readcluster_error
pop rax ; Get our original cluster value back
shl rbx, 8 ; Quick multiply by 256 (RBX was the sector offset in the FAT)
sub rax, rbx ; RAX is now pointed to the offset within the sector
shl rax, 1 ; Quickly multiply by 2 (since entries are 16-bit)
add rsi, rax
lodsw ; AX now holds the next cluster
pop rdi
jmp readcluster_end
readcluster_bailout:
xor ax, ax
readcluster_end:
pop rbx
pop rcx
pop rdx
pop rsi
ret
readcluster_error:
mov rsi, readcluster_err_msg
call os_print_string
jmp exception_gate_halt
; -----------------------------------------------------------------------------
; -----------------------------------------------------------------------------
; findfile --
; IN: RSI(Pointer to file name, must be in 'FILENAMEEXT" format)
; OUT: AX(Staring cluster), 0x0 if not found
; Notes: Only searches the root sector.. not the following sectors.
findfile:
push rsi
push rdi
push rdx
push rcx
push rbx
clc ; Clear carry
xor rax, rax
mov eax, [fat16_RootStart] ; eax points to the first sector of the root
add eax, [fat16_PartitionOffset] ; Add the offset to the partition
mov rdx, rax ; Save the sector value
os_fat16_find_file_read_sector:
mov rdi, hdbuffer1
push rdi
mov rcx, 1
call readsectors
cmp rcx, 0
je os_fat16_find_file_error
pop rdi
mov rbx, 16 ; Each record is 32 bytes. 512 (bytes per sector) / 32 = 16
os_fat16_find_file_next_entry:
cmp byte [rdi], 0x00 ; end of records
je os_fat16_find_file_notfound
mov rcx, 11
push rsi
repe cmpsb
pop rsi
mov ax, [rdi+15] ; AX now holds the starting cluster # of the file we just looked at
jz os_fat16_find_file_done ; The file was found. Note that rdi now is at dirent+11
add rdi, byte 0x20
and rdi, byte -0x20
dec rbx
cmp rbx, 0
jne os_fat16_find_file_next_entry
; At this point we have read though one sector of file names. We have not found the file we are looking for and have not reached the end of the table. Load the next sector.
add rdx, 1
mov rax, rdx
jmp os_fat16_find_file_read_sector
os_fat16_find_file_notfound:
stc ; Set carry
xor rax, rax
os_fat16_find_file_done:
cmp ax, 0x0000 ; BUG HERE
jne wut ; Carry is not being set properly in this function
stc
wut:
pop rbx
pop rcx
pop rdx
pop rdi
pop rsi
ret
os_fat16_find_file_error:
mov rsi, findfile_err_msg
call os_print_string
jmp exception_gate_halt
; -----------------------------------------------------------------------------
readcluster_err_msg: db 'Error reading cluster', 0
findfile_err_msg: db 'Error finding file', 0
; =============================================================================
; EOF
|
libsrc/target/zx/if1/if1_checksum.asm | jpoikela/z88dk | 38 | 242605 | <gh_stars>10-100
;
; ZX IF1 & Microdrive functions
;
; if1_checksum (internal routine)
;
; check BC bytes starting from HL
; and compare with the following byte
;
; $Id: if1_checksum.asm,v 1.3 2016-07-01 22:08:20 dom Exp $
;
SECTION code_clib
PUBLIC if1_checksum
if1_checksum:
push hl
ld e,0
nxt_byte:
ld a,e
add (hl)
inc hl
adc 1
jr z,noround
dec a
noround: ld e,a
dec bc
ld a,b
or c
jr nz,nxt_byte
ld a,e
cp (hl)
pop hl
ret
|
3-mid/opengl/source/platform/egl/opengl-display.adb | charlie5/lace | 20 | 22908 | <filename>3-mid/opengl/source/platform/egl/opengl-display.adb
with eGL.Binding,
eGL.Pointers,
System;
package body openGL.Display
is
use eGL,
eGL.Binding,
eGL.Pointers;
function Default return Item
is
use type System.Address, eGL.EGLBoolean;
the_Display : Display.item;
Success : EGLBoolean;
Status : EGLBoolean;
begin
the_Display.Thin := eglGetDisplay (Display_Pointer (EGL_DEFAULT_DISPLAY));
if the_Display.Thin = egl_NO_DISPLAY then
raise openGL.Error with "Failed to open the default Display with eGL.";
end if;
Success := eglInitialize (the_Display.Thin, the_Display.Version_major'Unchecked_Access,
the_Display.Version_minor'Unchecked_Access);
if Success = egl_False then
raise openGL.Error with "Failed to initialise eGL using the default Display.";
end if;
Status := eglBindAPI (EGL_OPENGL_ES_API);
return the_Display;
end Default;
end openGL.Display;
|
course-project/course-project-PSpiceFiles/SCHEMATIC3/SCHEMATIC3.als | nikolaystanishev/tu-te | 0 | 4190 | <reponame>nikolaystanishev/tu-te
.ALIASES
R_R R(1=N04353 2=N04365 ) CN @COURSE-PROJECT.SCHEMATIC3(sch_1):INS4331@ANALOG.R.Normal(chips)
V_E1 E1(+=N04353 -=0 ) CN @COURSE-PROJECT.SCHEMATIC3(sch_1):<EMAIL>(chips)
C_C C(1=0 2=N04369 ) CN @COURSE-PROJECT.SCHEMATIC3(sch_1):INS440<EMAIL>.<EMAIL>(chips)
L_L L(1=N04365 2=N04369 ) CN @COURSE-PROJECT.SCHEMATIC3(sch_1):<EMAIL>459@<EMAIL>(chips)
.ENDALIASES
|
_build/dispatcher/jmp_ippsSub_BN_b126ef33.asm | zyktrcn/ippcp | 1 | 20684 | <filename>_build/dispatcher/jmp_ippsSub_BN_b126ef33.asm
extern m7_ippsSub_BN:function
extern n8_ippsSub_BN:function
extern y8_ippsSub_BN:function
extern e9_ippsSub_BN:function
extern l9_ippsSub_BN:function
extern n0_ippsSub_BN:function
extern k0_ippsSub_BN:function
extern ippcpJumpIndexForMergedLibs
extern ippcpSafeInit:function
segment .data
align 8
dq .Lin_ippsSub_BN
.Larraddr_ippsSub_BN:
dq m7_ippsSub_BN
dq n8_ippsSub_BN
dq y8_ippsSub_BN
dq e9_ippsSub_BN
dq l9_ippsSub_BN
dq n0_ippsSub_BN
dq k0_ippsSub_BN
segment .text
global ippsSub_BN:function (ippsSub_BN.LEndippsSub_BN - ippsSub_BN)
.Lin_ippsSub_BN:
db 0xf3, 0x0f, 0x1e, 0xfa
call ippcpSafeInit wrt ..plt
align 16
ippsSub_BN:
db 0xf3, 0x0f, 0x1e, 0xfa
mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc]
movsxd rax, dword [rax]
lea r11, [rel .Larraddr_ippsSub_BN]
mov r11, qword [r11+rax*8]
jmp r11
.LEndippsSub_BN:
|
src/paradrop.asm | mvdhout1992/ts-patches | 33 | 27180 | %include "TiberianSun.inc"
%include "macros/patch.inc"
%include "macros/datatypes.inc"
;; Dropships need to have ammo in order to paradrop their cargo
;; This sets ammo count to cargo/5 rounded up.
hack 0x00408A1F, 0x00408A25
push ebx
mov eax, [esi+0xA0] ; Cargo Count
add eax, 4 ; Round up
cdq
mov ebx, 5
idiv ebx
pop ebx
mov [esi+0x134], eax ; Ammo
jmp hackend
@SET 0x00408A0C, { mov byte[esi+0x1FA], 0 }
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/access3.ads | best08618/asylo | 7 | 26452 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/access3.ads
package access3 is
type IT is limited interface;
type T is limited new IT with null record;
type T2 is tagged limited null record;
procedure Op
(Obj_T2 : in out T2;
Obj_IT : not null access IT'Class);
end access3;
|
test/succeed/Issue423.agda | asr/agda-kanso | 1 | 9117 | <reponame>asr/agda-kanso<gh_stars>1-10
-- submitted by Nisse, 2011-06-21
module Issue423 where
------------------------------------------------------------------------
-- Prelude
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
record Σ (A : Set) (B : A → Set) : Set where
constructor _,_
field
proj₁ : A
proj₂ : B proj₁
-- Andreas: changed lhs variables to lambda-abstractions
-- This should be done automatically (internally).
curry : {A C : Set} {B : A → Set} →
(Σ A B → C) → ((x : A) → B x → C)
curry f = \ x y -> f (x , y)
uncurry : {A C : Set} {B : A → Set} →
((x : A) → (y : B x) → C) → (Σ A B → C)
uncurry f = \ p -> f (Σ.proj₁ p) (Σ.proj₂ p)
------------------------------------------------------------------------
-- Preliminaries
postulate
U : Set
El : U → Set
mutual
data Ctxt : Set where
_▻_ : (Γ : Ctxt) (σ : Type Γ) → Ctxt
Type : Ctxt → Set
Type Γ = Env Γ → U
Env : Ctxt → Set
Env (Γ ▻ σ) = Σ (Env Γ) λ γ → El (σ γ)
postulate
Γ : Ctxt
σ : Type Γ
------------------------------------------------------------------------
-- Problem
-- The following equality holds definitionally.
equal : (τ : (γ : Env Γ) → El (σ γ) → U) →
curry (uncurry τ) ≡ τ
equal τ = refl
-- Bug was:
-- However, the two sides behave differently.
works : (τ₁ τ₂ : (γ : Env Γ) → El (σ γ) → U) →
τ₁ ≡ τ₂ → Set₁
works τ .τ refl = Set
works′ : (τ₁ τ₂ : (γ : Env Γ) → El (σ γ) → U) →
curry (uncurry τ₁) ≡ τ₂ → Set₁
works′ τ .τ refl = Set
fails : (τ₁ τ₂ : (γ : Env Γ) → El (σ γ) → U) →
τ₁ ≡ curry (uncurry τ₂) → Set₁
fails τ .τ refl = Set
fails′ : (τ₁ τ₂ : (γ : Env Γ) → El (σ γ) → U) →
curry (uncurry τ₁) ≡ curry (uncurry τ₂) → Set₁
fails′ τ .τ refl = Set
-- Bug was:
-- I find it interesting that works′ works, whereas the symmetric
-- variant fails fails.
|
Source Codes Testing/sub2.asm | aravindvnair99/emu8086 | 11 | 16252 | ;Adding N single byte numbers stored as a array with num as starting memory location
.MODEL small
.STACK
.DATA ; variable declaration section
N db 4h
num db 5h,3h,2h,4h
; code section
.CODE
.STARTUP
mov cx,00h
mov cl,N
mov bx, offset num
addition: sub al,[bx]
inc bx
loop addition
.EXIT
END ; end of the program
|
beep.asm | arfat01850/Assembly_Program | 1 | 85836 | <reponame>arfat01850/Assembly_Program
.MODEL SMALL
.STACK 100H
.CODE
MAIN PROC
MOV AH,2
MOV DL,07
INT 21H |
src/play/backdrop.asm | endstation/golf | 1 | 247340 | ; Top-hole Golf
; Copyright 2020-2021 <NAME>
bdrop_c_BEGIN = *
; *****************
; *** CONSTANTS ***
; *****************
bdrop_c_MAX_TILES = 48
bdrop_c_MAX_DISTANT_OBJECTS = 5
bdrop_c_PATTERN_BLOCK_SIZE = 288
bdrop_c_MAX_VISIBLE_DISTANT_OBJECTS = 3
; NOTE: assume object is 1000yds away.
; Rotate vector by PI/32 radians each time from 12 o'clock (cw and ccw). This
; table represents where the point is projected onto the x-axis.
bdrop_l_POSITIONS_X
!byte (-2),0,3,6,8,10,12,14,15,16,17,18
!byte 20
!byte 21,22,23,24,25,27,29,31,33,36,38,39
bdrop_l_SPRITE_POSITIONS_X_LO
!byte <8,<24,<48,<72,<88,<104,<120,<136,<144,<152,<160,<168
!byte <184
!byte <192,<200,<208,<216,<224,<240,<256,<272,<288,<312,<328,<336
bdrop_l_SPRITE_POSITIONS_X_HI
!byte >8,>24,>48,>72,>88,>104,>120,>136,>144,>152,>160,>168
!byte >184
!byte >192,>200,>208,>216,>224,>240,>256,>272,>288,>312,>328,>336
; Lookup table for tiles.
bdrop_l_TILES_ADDR_LO
!for i,bdrop_c_MAX_TILES {
!byte <bdrop_v_tiles+((i-1)*8)
} ; !for
bdrop_l_TILES_ADDR_HI
!for i,bdrop_c_MAX_TILES {
!byte >bdrop_v_tiles+((i-1)*8)
} ; !for
bdrop_l_AVAILABLE_HW_SPRITES !byte 0,4,3
bdrop_l_AVAILABLE_SW_SPRITES !byte 11,12,13
bdrop_c_ANIM_LOOP = 0
bdrop_c_ANIM_PINGPONG = 1
; *****************
; *** VARIABLES ***
; *****************
bdrop_v_data_filename !pet "b00.prg",0
bdrop_v_num_distant_objects !byte 0
; List terminated by (-1). At which columns should we draw the repeating
; backdrop pattern? Minimum width of that pattern is 8 (chars) - must be
; a multiple of 40.
bdrop_v_columns !fill ((40/8) + 1)
bdrop_v_pattern_start_rows !fill bdrop_c_MAX_DISTANT_OBJECTS+1
bdrop_v_tiles !fill bdrop_c_MAX_TILES*8
bdrop_v_repeating_pattern_addr_lo !byte 0
bdrop_v_repeating_pattern_addr_hi !byte 0
; These addresses for the distant object patterns...
bdrop_l_patterns_addr_lo !fill bdrop_c_MAX_DISTANT_OBJECTS
bdrop_l_patterns_addr_hi !fill bdrop_c_MAX_DISTANT_OBJECTS
bdrop_v_patterns !fill bdrop_c_PATTERN_BLOCK_SIZE
bdrop_v_angles !fill bdrop_c_MAX_DISTANT_OBJECTS
; NOTE: which patterns are we to draw at the above angles?
; This does not include the repeating 'base' backdrop pattern, so indices will
; start at 1.
bdrop_v_pattern_indices !fill bdrop_c_MAX_DISTANT_OBJECTS
; Arrays holding information about any accompanying sprites...
; These will also be loaded in by file per course.
bdrop_v_spr_y !fill bdrop_c_MAX_DISTANT_OBJECTS
bdrop_v_spr_x_offset_lo !fill bdrop_c_MAX_DISTANT_OBJECTS
bdrop_v_spr_x_offset_hi !fill bdrop_c_MAX_DISTANT_OBJECTS
bdrop_v_spr_ptr_from !fill bdrop_c_MAX_DISTANT_OBJECTS
bdrop_v_spr_ptr_to !fill bdrop_c_MAX_DISTANT_OBJECTS
; If this is set to zero, the sprite is treated as a static image:
bdrop_v_spr_framerate !fill bdrop_c_MAX_DISTANT_OBJECTS
bdrop_v_spr_hires !fill bdrop_c_MAX_DISTANT_OBJECTS
bdrop_v_spr_color !fill bdrop_c_MAX_DISTANT_OBJECTS
bdrop_v_spr_anim_type !fill bdrop_c_MAX_DISTANT_OBJECTS
; These arrays should be indexed by the distant object number, not the pattern
; number as above!
bdrop_v_spr_active !fill bdrop_c_MAX_DISTANT_OBJECTS,0
bdrop_v_spr_sw_num !fill bdrop_c_MAX_DISTANT_OBJECTS
bdrop_v_spr_hw_num !fill bdrop_c_MAX_DISTANT_OBJECTS
; NOTE: use this for when drawing accompanying sprite. Position (index) of
; current distant object temporarily stored here.
bdrop_v_current_position !byte 0
bdrop_v_golfer_angle !byte 0
; Index into the available h/w and s/w sprite numbers:
bdrop_v_current_sprite_slot !byte 0
; *******************
; ****** MACROS *****
; *******************
; *******************
; *** SUBROUTINES ***
; *******************
!zone {
.PETSCII_B = 66
.PETSCII_S = 83
.PETSCII_T = 84
bdrop_s_init
; Need to load in the data file. Filename determined by course index.
lda shared_v_course_index
; TODO: only one course at the moment!!!
lda #1
sta P0
lda #0
sta P1
jsr utils_s_16bit_hex_to_dec
; Result in utils_v_dec_digits. We need to look at the first two bytes only.
lda utils_v_dec_digits
clc
adc #SCR_CODE_0
sta bdrop_v_data_filename+2
lda utils_v_dec_digits+1
clc
adc #SCR_CODE_0
sta bdrop_v_data_filename+1
; Load in the 'backdrop' file.
lda #.PETSCII_B
sta bdrop_v_data_filename
ldx #<bdrop_v_data_filename
ldy #>bdrop_v_data_filename
jsr CB_LOADFILE_EXOMIZER
; And the sprite file...
lda #.PETSCII_S
sta bdrop_v_data_filename
ldx #<bdrop_v_data_filename
ldy #>bdrop_v_data_filename
jsr CB_LOADFILE_EXOMIZER
; And the trees file... ???!!!
lda #.PETSCII_T
sta bdrop_v_data_filename
ldx #<bdrop_v_data_filename
ldy #>bdrop_v_data_filename
jsr CB_LOADFILE_EXOMIZER
+utils_m_turn_on_supercpu
rts
; end sub bdrop_s_init
} ; !zone
; **************************************************
!zone {
.COLUMN_ITER = CURSOR_POS_LO
bdrop_s_draw_bg
ldx #0
.loop
stx .COLUMN_ITER
lda bdrop_v_columns,x
bmi .end
sta P1
lda bdrop_v_pattern_start_rows
sta P0
lda bdrop_v_repeating_pattern_addr_lo
sta P4
lda bdrop_v_repeating_pattern_addr_hi
sta P5
jsr ingm_s_draw_tile_pattern
ldx .COLUMN_ITER
inx
bne .loop
.end
rts
; end sub bdrop_s_draw_bg
} ; !zone
; **************************************************
; INPUT: X = object index
; OUTPUT: C flag clear if visible (and MATHS0 holds index); else set.
; NOTE: initial value of X is preserved.
!zone {
.distant_object_angle !byte 0
.SIGNED_DIFF = MATHS0
bdrop_s_check_rotation
; NOTE: a negative value indicates that there is no distant object for
; this 'slot'.
lda bdrop_v_angles,x
bmi .not_visible
sta .distant_object_angle
lda bdrop_v_golfer_angle
sec
sbc .distant_object_angle
sta .SIGNED_DIFF
; Comparison with absolute value.
bpl +
+nega
+
cmp #33
bcc .check_difference
; Difference is > 32, so adjustment is necessary.
lda .SIGNED_DIFF
bpl +
; Negative so ADD 64.
clc
adc #64
jmp ++
+
; Positive so SUBTRACT 64.
sec
sbc #64
++
sta .SIGNED_DIFF
; Put absolute value into the accumulator.
bpl +
+nega
+
.check_difference
; NOTE: absolute difference is in the accumulator...
cmp #13
bcs .not_visible
; Add 12 to the signed difference so it can be used as an index.
; Index will then be in the range [0,25).
lda .SIGNED_DIFF
clc
adc #12
sta .SIGNED_DIFF
; C flag clear indicates that distant object is visible.
clc
rts ; EXIT POINT.
.not_visible
sec
rts
; end sub bdrop_s_check_rotation
} ; !zone
; **************************************************
!zone {
;.iter !byte 0
.MATHS0_16bit = $000a
.CURRENT_PATTERN_I = CURSOR_POS_HI
.ITER = CURSOR_POS_SR_LO
bdrop_s_draw_distant_objects
jsr bdrop_s_deactivate_sprites
; NOTE: only do this once each 'scene'.
ldx #3
-
lda golfer_v_direction_x_lo,x
sta .MATHS0_16bit,x
dex
bpl -
jsr maths_s_atan2
stx bdrop_v_golfer_angle
ldx #0
-
stx .ITER
jsr bdrop_s_check_rotation
bcs .next
; Visible, so draw this one.
lda bdrop_v_pattern_indices,x
sta .CURRENT_PATTERN_I
sta P0
ldx MATHS0
stx bdrop_v_current_position
lda bdrop_l_POSITIONS_X,x
sta P1
jsr bdrop_s_draw_pattern
; Is there a sprite associated with this object?
ldx .CURRENT_PATTERN_I
lda bdrop_v_spr_y,x
beq .next
jsr bdrop_s_init_sprite
.next
ldx .ITER
inx
cpx #bdrop_c_MAX_DISTANT_OBJECTS ;bdrop_v_num_distant_objects
bne -
rts
; end sub bdrop_s_draw_distant_objects
} ; !zone
; **************************************************
; INPUTS: P0 = pattern type, P1 = column
!zone {
bdrop_s_draw_pattern
ldx P0
lda bdrop_l_patterns_addr_lo,x
sta P4
lda bdrop_l_patterns_addr_hi,x
sta P5
lda bdrop_v_pattern_start_rows+1,x
sta P0
jsr ingm_s_draw_tile_pattern
rts
; end sub bdrop_s_draw_pattern
} ; !zone
; **************************************************
!zone {
bdrop_s_prepare_draw
lda #<ingm_s_default_draw_tile
sta ingm_mod0
lda #>ingm_s_default_draw_tile
sta ingm_mod0+1
rts
; end sub bdrop_s_prepare_draw
} ; !zone
; **************************************************
!zone {
bdrop_s_deactivate_sprites
ldx #bdrop_c_MAX_DISTANT_OBJECTS-1
lda #0
sta bdrop_v_current_sprite_slot
-
sta bdrop_v_spr_active,x
dex
bpl -
rts
; end sub bdrop_s_deactivate_sprites
} ; !zone
; **************************************************
; INPUTS: CURSOR_POS_HI = pattern index in range [0,5),
; CURSOR_POS_LO = distant object index.
!zone {
.PATTERN_I = CURSOR_POS_HI
.DOBJ_I = CURSOR_POS_SR_LO
bdrop_s_init_sprite
; Activate the sprite.
ldx .DOBJ_I
inc bdrop_v_spr_active,x
; Select the h/w and s/w sprite numbers from next available.
ldy bdrop_v_current_sprite_slot
inc bdrop_v_current_sprite_slot
lda bdrop_l_AVAILABLE_HW_SPRITES,y
sta bdrop_v_spr_hw_num,x
lda bdrop_l_AVAILABLE_SW_SPRITES,y
sta bdrop_v_spr_sw_num,x
; S/W number into Y for following...
tay
; Now we're copying from pattern's sprite spec to this particular
; distant object's s/w sprite details.
ldx .PATTERN_I
; Y-position - a simple lookup.
lda bdrop_v_spr_y,x
sta spr_v_y,y
lda bdrop_v_spr_hires,x
sta spr_v_hires,y
lda bdrop_v_spr_color,x
sta spr_v_color,y
; Animation setup.
lda bdrop_v_spr_ptr_from,x
sta spr_v_current_ptr,y
sta spr_v_anim_start_ptr,y
lda bdrop_v_spr_ptr_to,x
sta spr_v_anim_end_ptr,y
lda bdrop_v_spr_framerate,x
sta spr_v_anim_timer,y
sta spr_v_framerate,y
lda #0
sta spr_v_yxpand,y
sta spr_v_xxpand,y
lda #1
sta spr_v_bg_priority,y
sta spr_v_anim_seq_inc,y
; X-position - also a lookup...
lda bdrop_v_spr_x_offset_lo,x
sta MATHS0
lda bdrop_v_spr_x_offset_hi,x
sta MATHS1
ldx bdrop_v_current_position
lda bdrop_l_SPRITE_POSITIONS_X_LO,x
clc
adc MATHS0
sta spr_v_x_lo,y
lda bdrop_l_SPRITE_POSITIONS_X_HI,x
adc MATHS1
sta spr_v_x_hi,y
rts
; end sub bdrop_s_init_sprite
} ; !zone
; **************************************************
!zone {
.ITER = MATHS0
bdrop_s_update
; Which distant objects are currently visible?
ldx #0
-
stx .ITER
lda bdrop_v_spr_active,x
beq .next
; Make sure sprite is enabled.
ldy bdrop_v_spr_hw_num,x
lda utils_l_BIT_LOOKUP,y
ora SPENA
sta SPENA
lda bdrop_v_spr_sw_num,x
pha
; Does this object's pattern have an animated sprite?
ldy bdrop_v_pattern_indices,x
lda bdrop_v_spr_framerate,y
bne .animated
; Sprite is static. Put s/w spr# in Y and then jump over animation
; routine.
pla
tay
bne +
.animated
lda bdrop_v_spr_anim_type,y
beq .loop
; So it's pingpong.
pla
tax
tay
jsr spr_s_animate_pingpong
jmp ++
.loop
pla
tax
tay
; 'spr_animate_loop' wants s/w number in X.
jsr spr_animate_loop
++
ldx .ITER
+
lda bdrop_v_spr_hw_num,x
tax
; 'spr_s_write_to_vic_ii' wants s/w num in Y, h/w num in X.
jsr spr_s_write_to_vic_ii
ldx .ITER
.next
inx
; NOTE: we must check all slots here as there will often be wraparound.
cpx #bdrop_c_MAX_DISTANT_OBJECTS
bne -
rts
; end sub bdrop_s_update
} ; !zone
; **************************************************
; OUTPUT: MATHS0 = active h/w sprites have relevant bit set.
!zone {
bdrop_s_find_active_hw_sprites
ldx #bdrop_c_MAX_DISTANT_OBJECTS-1
lda #0
sta MATHS0
.loop
lda bdrop_v_spr_active,x
beq .next
ldy bdrop_v_spr_hw_num,x
lda utils_l_BIT_LOOKUP,y
ora MATHS0
sta MATHS0
.next
dex
bpl .loop
rts
; end sub bdrop_s_find_active_hw_sprites
} ; !zone
; **************************************************
!zone {
.DELTA = 3
bdrop_s_rotate_objects
ldx #0
-
lda bdrop_v_angles,x
clc
adc #.DELTA
cmp #64
bcc +
sec
sbc #64
+
sta bdrop_v_angles,x
inx
cpx #bdrop_c_MAX_DISTANT_OBJECTS
bne -
rts
; end sub bdrop_s_rotate_objects
} ; !zone
; **************************************************
; NOTE: this goes here because there's not enough room for it in the 'core'
; section.
; FIXME: but maybe there is now?!
; X = sprite number (0-15).
!zone {
spr_s_animate_pingpong
dec spr_v_anim_timer,x
bne .end
lda spr_v_framerate,x
sta spr_v_anim_timer,x
lda spr_v_anim_seq_inc,x
beq .decrease
; Increment sprite data pointer.
inc spr_v_current_ptr,x
lda spr_v_current_ptr,x
cmp spr_v_anim_end_ptr,x
bne .end
lda #0
sta spr_v_anim_seq_inc,x
beq .end
.decrease
dec spr_v_current_ptr,x
lda spr_v_current_ptr,x
cmp spr_v_anim_start_ptr,x
bne .end
lda #1
sta spr_v_anim_seq_inc,x
.end
rts
; end sub spr_s_animate_pingpong
} ; !zone
; **************************************************
!zone {
bdrop_s_draw_all
jsr bdrop_s_prepare_draw
jsr bdrop_s_draw_distant_objects
jsr bdrop_s_draw_bg
rts
; end sub bdrop_s_draw_all
} ; !zone
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
bdrop_c_SIZE = *-bdrop_c_BEGIN
|
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_net_gstnettimepacket_h.ads | persan/A-gst | 1 | 23967 | <reponame>persan/A-gst
pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
with glib;
with glib.Values;
with System;
-- with GStreamer.GST_Low_Level.bits_socket_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_net_gstnettimepacket_h is
GST_NET_TIME_PACKET_SIZE : constant := 16; -- gst/net/gstnettimepacket.h:50
-- GStreamer
-- * Copyright (C) 2005 <NAME> <<EMAIL>>
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
--*
-- * GST_NET_TIME_PACKET_SIZE:
-- *
-- * The size of the packets sent between network clocks.
--
type GstNetTimePacket;
--subtype GstNetTimePacket is u_GstNetTimePacket; -- gst/net/gstnettimepacket.h:52
--*
-- * GstNetTimePacket:
-- * @local_time: the local time when this packet was sent
-- * @remote_time: the remote time observation
-- *
-- * Content of a #GstNetTimePacket.
--
type GstNetTimePacket is record
local_time : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime; -- gst/net/gstnettimepacket.h:62
remote_time : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime; -- gst/net/gstnettimepacket.h:63
end record;
pragma Convention (C_Pass_By_Copy, GstNetTimePacket); -- gst/net/gstnettimepacket.h:61
function gst_net_time_packet_new (buffer : access GLIB.guint8) return access GstNetTimePacket; -- gst/net/gstnettimepacket.h:66
pragma Import (C, gst_net_time_packet_new, "gst_net_time_packet_new");
function gst_net_time_packet_serialize (packet : access constant GstNetTimePacket) return access GLIB.guint8; -- gst/net/gstnettimepacket.h:67
pragma Import (C, gst_net_time_packet_serialize, "gst_net_time_packet_serialize");
function gst_net_time_packet_receive
(fd : GLIB.gint;
addr : access GStreamer.GST_Low_Level.bits_socket_h.sockaddr;
len : access GStreamer.GST_Low_Level.bits_socket_h.socklen_t) return access GstNetTimePacket; -- gst/net/gstnettimepacket.h:69
pragma Import (C, gst_net_time_packet_receive, "gst_net_time_packet_receive");
function gst_net_time_packet_send
(packet : access constant GstNetTimePacket;
fd : GLIB.gint;
addr : access GStreamer.GST_Low_Level.bits_socket_h.sockaddr;
len : GStreamer.GST_Low_Level.bits_socket_h.socklen_t) return GLIB.gint; -- gst/net/gstnettimepacket.h:71
pragma Import (C, gst_net_time_packet_send, "gst_net_time_packet_send");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_net_gstnettimepacket_h;
|
src/006/steps_5.adb | xeenta/learning-ada | 0 | 27092 | <filename>src/006/steps_5.adb
with Ada.Text_IO; use Ada.Text_IO;
procedure Steps_5 is
task Step_By_Step is
entry Step_One;
entry Step_Two;
end Step_By_Step;
task body Step_By_Step is
begin
loop
select
accept Step_One do
Put_Line ("1");
end Step_One;
or
accept Step_Two do
Put_Line ("2");
end Step_Two;
or
terminate;
end select;
Put_Line ("Again?!");
end loop;
Put_Line ("Never been here");
end Step_By_Step;
begin
Put_Line ("the world is a vampire");
delay 3.2;
Put_Line ("We don't even know");
Step_By_Step.Step_Two;
delay 1.0;
Put_Line ("Gone now");
Step_By_Step.Step_One;
delay 1.0;
Put_Line ("The End");
end;
|
src/even.agda | shinji-kono/automaton-in-agda | 0 | 2468 | <gh_stars>0
module even where
open import Data.Nat
open import Data.Nat.Properties
open import Data.Empty
open import Data.Unit using (⊤ ; tt)
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Relation.Binary.Definitions
open import nat
open import logic
even : (n : ℕ ) → Set
even zero = ⊤
even (suc zero) = ⊥
even (suc (suc n)) = even n
even? : (n : ℕ ) → Dec ( even n )
even? zero = yes tt
even? (suc zero) = no (λ ())
even? (suc (suc n)) = even? n
n+even : {n m : ℕ } → even n → even m → even ( n + m )
n+even {zero} {zero} tt tt = tt
n+even {zero} {suc m} tt em = em
n+even {suc (suc n)} {m} en em = n+even {n} {m} en em
n*even : {m n : ℕ } → even n → even ( m * n )
n*even {zero} {n} en = tt
n*even {suc m} {n} en = n+even {n} {m * n} en (n*even {m} {n} en)
even*n : {n m : ℕ } → even n → even ( n * m )
even*n {n} {m} en = subst even (*-comm m n) (n*even {m} {n} en)
record Even (i : ℕ) : Set where
field
j : ℕ
is-twice : i ≡ 2 * j
e2 : (i : ℕ) → even i → Even i
e2 zero en = record { j = 0 ; is-twice = refl }
e2 (suc (suc i)) en = record { j = suc (Even.j (e2 i en )) ; is-twice = e21 } where
e21 : suc (suc i) ≡ 2 * suc (Even.j (e2 i en))
e21 = begin
suc (suc i) ≡⟨ cong (λ k → suc (suc k)) (Even.is-twice (e2 i en)) ⟩
suc (suc (2 * Even.j (e2 i en))) ≡⟨ sym (*-distribˡ-+ 2 1 _) ⟩
2 * suc (Even.j (e2 i en)) ∎ where open ≡-Reasoning
record Odd (i : ℕ) : Set where
field
j : ℕ
is-twice : i ≡ suc (2 * j )
odd2 : (i : ℕ) → ¬ even i → even (suc i)
odd2 zero ne = ⊥-elim ( ne tt )
odd2 (suc zero) ne = tt
odd2 (suc (suc i)) ne = odd2 i ne
odd3 : (i : ℕ) → ¬ even i → Odd i
odd3 zero ne = ⊥-elim ( ne tt )
odd3 (suc zero) ne = record { j = 0 ; is-twice = refl }
odd3 (suc (suc i)) ne = record { j = Even.j (e2 (suc i) (odd2 i ne)) ; is-twice = odd31 } where
odd31 : suc (suc i) ≡ suc (2 * Even.j (e2 (suc i) (odd2 i ne)))
odd31 = begin
suc (suc i) ≡⟨ cong suc (Even.is-twice (e2 (suc i) (odd2 i ne))) ⟩
suc (2 * (Even.j (e2 (suc i) (odd2 i ne)))) ∎ where open ≡-Reasoning
odd4 : (i : ℕ) → even i → ¬ even ( suc i )
odd4 (suc (suc i)) en en1 = odd4 i en en1
|
child_processes-platform.adb | annexi-strayline/AURA | 13 | 9796 | <filename>child_processes-platform.adb<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- ANNEXI-STRAYLINE Reference Implementation --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- POSIX
with Interfaces.C.Strings;
with Ada.Strings.Fixed;
with Ada.Containers.Vectors;
package body Child_Processes.Platform is
pragma Assert (Stream_Element'Size = 8);
-- Assumption for read/write system calls which take a void *, and
-- a "nbytes" argument
pragma Linker_Options ("-lc");
pragma Linker_Options ("child_processes-platform-binding.o");
use Interfaces.C;
function fork_and_exec (path: in char_array;
args: in Interfaces.C.Strings.chars_ptr_array;
wdir: in char_array;
pid : out Process_ID;
stdin: out Stream_Handle;
stdout: out Stream_Handle;
stderr: out Stream_Handle)
return int
with
Import => True,
Convention => C,
External_Name => "__chldproc_platform_fork_and_exec";
-- 1. Creates new pipes for stdio
-- 2. Forks
-- 3. Parent sets read pipes to non-blocking,
-- and sets the relevent out parameters.
-- -1 is returned if the fork itself fails
-- 4. Child attaches pipes to stdio
-- 5. Child sets workding directory to wdir, then execv's path
function wait_pid_terminate (pid: Process_ID) return int with
Import => True,
Convention => C,
External_Name => "__chldproc_platform_wait_pid_terminate";
-- Waits for pid to terminate, and returns the exit_value.
-- If the wait system call fails, SIGTERM is sent to pid, and exit_value is
-- set to -1
procedure sigterm_kill (pid: in Process_ID) with
Import => True,
Convention => C,
External_Name => "__chldproc_platform_sigterm_kill";
procedure sigkill_kill (pid: in Process_ID) with
Import => True,
Convention => C,
External_Name => "__chldproc_platform_sigkill_kill";
function wait_read (fd: in Stream_Handle; wait: access timeval)
return int
with
Import => True,
Convention => C,
External_Name => "__chldproc_platform_wait_read";
function wait_write (fd: in Stream_Handle; wait: access timeval)
return int
with
Import => True,
Convention => C,
External_Name => "__chldproc_platform_wait_write";
-- Returns 1 iff fd is available for reading resp. writing
-- libc direct calls
function read (fd : Stream_Handle;
buf : not null access Stream_Element;
nbytes: size_t)
return ssize_t
with
Import => True,
Convention => C,
External_Name => "read";
function write (fd : Stream_Handle;
buf : not null access constant Stream_Element;
nbytes: size_t)
return ssize_t
with
Import => True,
Convention => C,
External_Name => "write";
function close (fd: Stream_Handle) return int with
Import => True,
Convention => C,
External_Name => "close";
--
-- Timeval Coversion
--
----------------
-- To_Timeval --
----------------
function To_Timeval (T: Duration) return timeval is
Microsecond: constant := 0.000001;
begin
return tv: timeval do
tv.tv_sec := time_t (Float'Floor(Float(T)));
tv.tv_usec := suseconds_t ((T - Duration(tv.tv_sec)) / Microsecond);
end return;
end To_Timeval;
--
-- Argument Processing
--
package C_String_Vectors is new Ada.Containers.Vectors
(Index_Type => Natural,
Element_Type => Interfaces.C.Strings.chars_ptr,
"=" => Interfaces.C.Strings."=");
function Parse_Arguments (Path : in String;
Arguments: in String)
return C_String_Vectors.Vector;
-- Parses Path to derrive the "command name", by selecting a slice from the
-- end of path up to the first '/'. This "command name" is then assigned to
-- a newloy allocated chars_ptr (char *), which is then added to the first
-- index of a new vector.
--
-- Arguments are then parsed with each argument allocated a chars_ptr and
-- appended to the vector.
--
-- Finally a chars_ptr is appended with the Null_Ptr value.
--
-- The resulting Vector is thus a null-terminated vector of chars_ptr's,
-- that can be copied into an chars_ptr_array, (char **), and passed into
-- fork_and_exec
procedure Free_Vector (V: in out C_String_Vectors.Vector);
-- Frees each chars_ptr of the vector, replacing each element with
-- a Null_Ptr
---------------------
-- Parse_Arguments --
---------------------
function Parse_Arguments (Path : in String;
Arguments: in String)
return C_String_Vectors.Vector
is
use Interfaces.C.Strings;
use Ada.Strings;
use Ada.Strings.Fixed;
Arg_V: C_String_Vectors.Vector;
begin
-- Get the "command name"
declare
First: Natural;
Command_Name: chars_ptr;
begin
First := Index (Source => Path,
Pattern => "/",
From => Path'Last,
Going => Backward);
if First < Path'First then
First := Path'First;
else
First := First + 1;
end if;
Command_Name := New_String (Path (First .. Path'Last));
Arg_V.Append (Command_Name);
end;
-- Parse the arguments
declare
First: Natural := Arguments'First;
Last : Natural := First - 1;
Single_Argument: chars_ptr;
begin
while Last < Arguments'Last loop
Last := Last + 1;
First := Index_Non_Blank (Source => Arguments,
From => Last);
Last := Index (Source => Arguments,
Pattern => " ",
From => First);
if Last < Arguments'First then
Last := Arguments'Last;
else
Last := Last - 1;
end if;
Single_Argument := New_String (Arguments (First .. Last));
Arg_V.Append (Single_Argument);
end loop;
end;
Arg_V.Append (Null_Ptr);
return Arg_V;
end Parse_Arguments;
-----------------
-- Free_Vector --
-----------------
procedure Free_Vector (V: in out C_String_Vectors.Vector) is
use C_String_Vectors;
begin
for E of V loop
Interfaces.C.Strings.Free (E);
end loop;
end Free_Vector;
--------------------
-- Create_Process --
--------------------
procedure Create_Process (Image_Path : in String;
Arguments : in String;
Working_Directory: in String;
ID : out Process_ID;
Standard_Input : out Stream_Handle;
Standard_Output : out Stream_Handle;
Standard_Error : out Stream_Handle)
is
argv_Vector: C_String_Vectors.Vector
:= Parse_Arguments (Path => Image_Path, Arguments => Arguments);
argv: Interfaces.C.Strings.chars_ptr_array
(size_t(argv_Vector.First_Index) .. size_t(argv_Vector.Last_Index));
Fork_Result: int;
begin
for I in argv'Range loop
argv(I) := argv_Vector(Natural(I));
end loop;
Fork_Result := fork_and_exec
(path => To_C (Image_Path),
args => argv,
wdir => To_C (Working_Directory),
pid => ID,
stdin => Standard_Input,
stdout => Standard_Output,
stderr => Standard_Error);
Free_Vector (argv_Vector);
if Fork_Result /= 0 then
raise Spawn_Failure with "Unable to fork new process";
end if;
end Create_Process;
----------------------
-- Wait_Termination --
----------------------
procedure Wait_Termination (ID : in Process_ID;
Exit_Code: out Exit_Status)
is
Return_Code: int;
begin
Return_Code := wait_pid_terminate (ID);
if Return_Code = 0 then
Exit_Code := Success;
else
Exit_Code := Failure;
end if;
end Wait_Termination;
----------
-- Kill --
----------
procedure Kill (ID: in Process_ID) is
begin
sigterm_kill (ID);
end Kill;
----------
-- Nuke --
----------
procedure Nuke (ID: in Process_ID) is
begin
sigkill_kill (ID);
end Nuke;
-----------------
-- Read_Buffer --
-----------------
procedure Read_Buffer (Stream: in Stream_Handle;
Buffer: out Stream_Element_Array;
Last : out Stream_Element_Offset)
is
Bytes_Read: ssize_t;
begin
Bytes_Read := read (fd => Stream,
buf => Buffer(Buffer'First)'Access,
nbytes => Buffer'Length);
if Bytes_Read < 0 then
Last := Buffer'First - 1;
else
Last := Buffer'First
+ Stream_Element_Offset (Bytes_Read)
- 1;
end if;
pragma Assert (Last <= Buffer'Last);
end Read_Buffer;
------------------
-- Write_Buffer --
------------------
procedure Write_Buffer (Stream: in Stream_Handle;
Buffer: in Stream_Element_Array;
Last : out Stream_Element_Offset)
is
Bytes_Written: ssize_t;
begin
Bytes_Written := write (fd => Stream,
buf => Buffer(Buffer'First)'Access,
nbytes => Buffer'Length);
if Bytes_Written < 0 then
Last := Buffer'First - 1;
else
Last := Buffer'First
+ Stream_Element_Offset (Bytes_Written)
- 1;
end if;
pragma Assert (Last <= Buffer'Last);
end Write_Buffer;
-------------------
-- Wait_Can_Read --
-------------------
procedure Wait_Can_Read (Stream : in Stream_Handle;
Timeout : in Duration;
Timed_Out: out Boolean)
is
TO: aliased timeval := To_Timeval (Timeout);
Result: int;
begin
Result := wait_read (fd => Stream,
wait => (if Timeout > 0.0 then
TO'Access
else
null));
if Result > 0 then
Timed_Out := False;
else
Timed_Out := True;
end if;
end Wait_Can_Read;
--------------------
-- Wait_Can_Write --
--------------------
procedure Wait_Can_Write (Stream : in Stream_Handle;
Timeout : in Duration;
Timed_Out: out Boolean)
is
TO: aliased timeval := To_Timeval (Timeout);
Result: int;
begin
Result := wait_write (fd => Stream,
wait => (if Timeout > 0.0 then
TO'Access
else
null));
if Result > 0 then
Timed_Out := False;
else
Timed_Out := True;
end if;
end Wait_Can_Write;
------------------
-- Close_Stream --
------------------
procedure Close_Stream (Handle: in Stream_Handle) is
Discard: int;
begin
Discard := close (Handle);
end Close_Stream;
end Child_Processes.Platform;
|
Ada95/samples/sample-text_io_demo.adb | arc-aosp/external_libncurses | 35 | 19183 | <reponame>arc-aosp/external_libncurses
------------------------------------------------------------------------------
-- --
-- GNAT ncurses Binding Samples --
-- --
-- Sample.Text_IO_Demo --
-- --
-- B O D Y --
-- --
------------------------------------------------------------------------------
-- Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
-- "Software"), to deal in the Software without restriction, including --
-- without limitation the rights to use, copy, modify, merge, publish, --
-- distribute, distribute with modifications, sublicense, and/or sell --
-- copies of the Software, and to permit persons to whom the Software is --
-- furnished to do so, subject to the following conditions: --
-- --
-- The above copyright notice and this permission notice shall be included --
-- in all copies or substantial portions of the Software. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
-- Except as contained in this notice, the name(s) of the above copyright --
-- holders shall not be used in advertising or otherwise to promote the --
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
------------------------------------------------------------------------------
-- Author: <NAME>, 1996
-- Version Control
-- $Revision: 1.16 $
-- $Date: 2006/06/25 14:30:22 $
-- Binding Version 01.00
------------------------------------------------------------------------------
with Ada.Numerics.Generic_Elementary_Functions;
with Ada.Numerics.Complex_Types;
use Ada.Numerics.Complex_Types;
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
with Terminal_Interface.Curses.Text_IO;
use Terminal_Interface.Curses.Text_IO;
with Terminal_Interface.Curses.Text_IO.Integer_IO;
with Terminal_Interface.Curses.Text_IO.Float_IO;
with Terminal_Interface.Curses.Text_IO.Enumeration_IO;
with Terminal_Interface.Curses.Text_IO.Complex_IO;
with Terminal_Interface.Curses.Text_IO.Fixed_IO;
with Terminal_Interface.Curses.Text_IO.Decimal_IO;
with Terminal_Interface.Curses.Text_IO.Modular_IO;
with Sample.Manifest; use Sample.Manifest;
with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
with Sample.Keyboard_Handler; use Sample.Keyboard_Handler;
with Sample.Explanation; use Sample.Explanation;
package body Sample.Text_IO_Demo is
type Weekday is (Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday);
type Fix is delta 0.1 range 0.0 .. 4.0;
type Dec is delta 0.01 digits 5 range 0.0 .. 4.0;
type Md is mod 5;
package Math is new
Ada.Numerics.Generic_Elementary_Functions (Float);
package Int_IO is new
Terminal_Interface.Curses.Text_IO.Integer_IO (Integer);
use Int_IO;
package Real_IO is new
Terminal_Interface.Curses.Text_IO.Float_IO (Float);
use Real_IO;
package Enum_IO is new
Terminal_Interface.Curses.Text_IO.Enumeration_IO (Weekday);
use Enum_IO;
package C_IO is new
Terminal_Interface.Curses.Text_IO.Complex_IO (Ada.Numerics.Complex_Types);
use C_IO;
package F_IO is new
Terminal_Interface.Curses.Text_IO.Fixed_IO (Fix);
use F_IO;
package D_IO is new
Terminal_Interface.Curses.Text_IO.Decimal_IO (Dec);
use D_IO;
package M_IO is new
Terminal_Interface.Curses.Text_IO.Modular_IO (Md);
use M_IO;
procedure Demo
is
W : Window;
P : Panel := Create (Standard_Window);
K : Real_Key_Code;
Im : constant Complex := (0.0, 1.0);
Fx : constant Dec := 3.14;
Dc : constant Dec := 2.72;
L : Md;
begin
Push_Environment ("TEXTIO");
Default_Labels;
Notepad ("TEXTIO-PAD00");
Set_Echo_Mode (False);
Set_Meta_Mode;
Set_KeyPad_Mode;
W := Sub_Window (Standard_Window, Lines - 2, Columns - 2, 1, 1);
Box;
Refresh_Without_Update;
Set_Meta_Mode (W);
Set_KeyPad_Mode (W);
Immediate_Update_Mode (W, True);
Set_Window (W);
for I in 1 .. 10 loop
Put ("Square root of ");
Put (Item => I, Width => 5);
Put (" is ");
Put (Item => Math.Sqrt (Float (I)), Exp => 0, Aft => 7);
New_Line;
end loop;
for W in Weekday loop
Put (Item => W); Put (' ');
end loop;
New_Line;
L := Md'First;
for I in 1 .. 2 loop
for J in Md'Range loop
Put (L); Put (' ');
L := L + 1;
end loop;
end loop;
New_Line;
Put (Im); New_Line;
Put (Fx); New_Line;
Put (Dc); New_Line;
loop
K := Get_Key;
if K in Special_Key_Code'Range then
case K is
when QUIT_CODE => exit;
when HELP_CODE => Explain_Context;
when EXPLAIN_CODE => Explain ("TEXTIOKEYS");
when others => null;
end case;
end if;
end loop;
Set_Window (Null_Window);
Erase; Refresh_Without_Update;
Delete (P);
Delete (W);
Pop_Environment;
end Demo;
end Sample.Text_IO_Demo;
|
problems/040/a040.adb | melwyncarlo/ProjectEuler | 0 | 5307 | <gh_stars>0
with Ada.Strings.Fixed;
with Ada.Integer_Text_IO;
-- Copyright 2021 <NAME>
procedure A040 is
use Ada.Strings.Fixed;
use Ada.Integer_Text_IO;
Max_E : constant Integer := 7; -- 1E+x
N : constant array (Integer range 1 .. Max_E) of Integer :=
(1, 10, 100, 1000, 10000, 100000, 1000000);
Indices : array (Integer range 1 .. Max_E) of Integer;
Product_Val : Integer := 1;
J, Num, Index_Val : Integer;
begin
Indices (1) := 1;
for I in 2 .. Max_E loop
Indices (I) := Indices (I - 1) + (9 * (I - 1) * Integer (10 ** (I - 2)));
end loop;
for I in 1 .. Max_E loop
J := 1;
while J <= Max_E loop
if N (I) < Indices (J) then
exit;
end if;
J := J + 1;
end loop;
J := J - 2;
Num := Integer (10 ** J) + Integer ((N (I) - Indices (J + 1)) / (J + 1));
Index_Val := ((N (I) - Indices (J + 1)) mod (J + 1)) + 1;
Product_Val := Product_Val * (Character'Pos (
Trim (Integer'Image (Num), Ada.Strings.Both) (Index_Val))
- Character'Pos ('0'));
end loop;
Put (Product_Val, Width => 0);
end A040;
|
data/baseStats_original/togetic.asm | adhi-thirumala/EvoYellow | 16 | 14602 | ;TogeticBaseStats: ; 38582 (e:4582)
db DEX_TOGETIC ; pokedex id
db 55 ; base hp
db 40 ; base attack
db 85 ; base defense
db 40 ; base speed
db 105 ; base special
db FAIRY ; species type 1
db FLYING ; species type 2
db 58 ; catch rate, dire hit item
db 114 ; base exp yield
INCBIN "pic/ymon/togetic.pic",0,1 ; 55, sprite dimensions
dw TogeticPicFront
dw TogeticPicBack
;moves
db METRONOME
db DOUBLESLAP
db WING_ATTACK
db GROWL
db 3 ; growth rate
; learnset
tmlearn 4,6,8
tmlearn 9,10,15
tmlearn 22,23
tmlearn 29,30,31,32
tmlearn 34,37,38,39,40
tmlearn 41,42,44,45,46
tmlearn 49,50,52
db BANK(TogeticPicFront) |
Blob_Lib/assimp-5.2.3/assimp/contrib/zlib/contrib/ada/zlib-streams.adb | antholuo/Blob_Traffic | 0 | 30607 | <filename>Blob_Lib/assimp-5.2.3/assimp/contrib/zlib/contrib/ada/zlib-streams.adb
version https://git-lfs.github.com/spec/v1
oid sha256:f45988e2bac76eb25a0dc981f46576e7432c35dde1790bbc2b650f0090b7fa72
size 5996
|
aom_ports/emms.asm | hanbing204/aom | 4 | 88683 | ;
; Copyright (c) 2016, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
; was not distributed with this source code in the LICENSE file, you can
; obtain it at www.aomedia.org/license/software. If the Alliance for Open
; Media Patent License 1.0 was not distributed with this source code in the
; PATENTS file, you can obtain it at www.aomedia.org/license/patent.
;
;
%include "aom_ports/x86_abi_support.asm"
section .text
globalsym(aom_reset_mmx_state)
sym(aom_reset_mmx_state):
emms
ret
%if LIBAOM_YASM_WIN64
globalsym(aom_winx64_fldcw)
sym(aom_winx64_fldcw):
sub rsp, 8
mov [rsp], rcx ; win x64 specific
fldcw [rsp]
add rsp, 8
ret
globalsym(aom_winx64_fstcw)
sym(aom_winx64_fstcw):
sub rsp, 8
fstcw [rsp]
mov rax, [rsp]
add rsp, 8
ret
%endif
|
Assignement4.97521441/Assignment4/AssignmentStAss4.g4 | fc79/IUSTCompiler | 0 | 2083 | <reponame>fc79/IUSTCompiler
grammar AssignmentStAss4;
program returns [value_attr = str(), type_attr = str()]:
mainClass ( classDeclare )* EOF
;
mainClass returns [value_attr = str(), type_attr = str()]: 'class' mainClassDeclare ;
mainClassDeclare returns [value_attr = str(), type_attr = str()]:
identifier '{' mainMethodDecl '}'
;
mainMethodDecl returns [value_attr = str(), type_attr = str()]:
Public Static Void Main '(' String '[' ']' identifier ')' mainMethodBody
;
mainMethodBody returns [value_attr = str(), type_attr = str()]:
'{'
statement
'}'
;
classDeclare returns [value_attr = str(), type_attr = str()]:
'class' identifier ('extend' identifier)?
'{'
varDeclation* methodDecl*
'}'
;
varDeclation returns [value_attr = str(), type_attr = str()]:
type identifier ';'
;
methodDecl returns [value_attr = str(), type_attr = str()]:
'public' type identifier '(' (type identifier (',' type Identifier)*)? ')' methodBody
;
methodBody returns [value_attr = str(), type_attr = str()]:
'{'
varDeclation* statement* 'return' exp ';'
'}'
;
type returns [value_attr = str(), type_attr = str()]:
identifier
|IntType '[' ']'
| BoolType
| IntType
;
statement returns [value_attr = str(), type_attr = str()]:
ifst #statement_if
|'{' statement* '}' #statement_lb
| 'while' '(' exp ')' statement #statement_while
| 'System.out.println' '(' exp ')' ';' #statement_system
| identifier '[' exp ']' '=' exp ';' #statement_equalwithbra
| identifier '=' exp ';' #statement_equal
;
ifst returns [value_attr = str(), type_attr = str()] : 'if' '(' exp ')' statement 'else' statement
;
exp returns [value_attr = str(), type_attr = str()]:
exp '<' exp #exp_gt
|exp ( binOperator ) exp #exp_binaryop
| exp '+' exp #exp_sum
| exp '-' exp #exp_minus
| exp '*' exp #exp_multi
|exp '&&' exp #exp_and
| exp '[' exp ']' #exp_lb
| exp '.' 'length' #exp_Dot
| exp '.' identifier '(' ( exp ( ',' exp )* )? ')' #exp_di
| identifier #exp_id
| Integer #exp_in
| 'true' #exp_tru
| 'false' #exp_false
| 'this' #exp_this
| New IntType '[' exp ']' #exp_exp
| New identifier '(' ')' #exp_ide
| '!' exp #exp_exclamation
| '(' exp ')' #exp_pran
;
identifier returns [value_attr = str(), type_attr = str()]: Identifier;
binOperator returns [value_attr = str(), type_attr = str()]: BinaryOperator;
Public: 'public';
Static: 'static';
Void: 'void';
Main: 'main';
Else: 'else';
This: 'this';
New: 'new';
IntType: 'int';
String: 'String';
BoolType: 'bool';
BinaryOperator: '&&'|'<'|'+'|'-'|'*';
Integer: [0-9]+;
Identifier: Letter LetterOrDigit*;
fragment LetterOrDigit
: Letter
| [0-9]
;
fragment Letter
: [a-zA-Z$_]
| [\uD800-\uDBFF] [\uDC00-\uDFFF]
| ~[\u0000-\u007F\uD800-\uDBFF]
;
WS: [ \t\r\n\u000C]+ -> channel(HIDDEN);
COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT: '//' ~[\r\n]* -> channel(HIDDEN); |
src/compiler-parser.adb | GLADORG/template-compiler | 0 | 1769 | pragma Ada_2012;
with Brackelib.Stacks;
with Ada.Characters.Conversions;
package body Compiler.Parser is
type State is
(State_Start, State_Inside_Handlebars, State_Inside_Component_Declaration,
State_Inside_Complex_Comment, State_Inside_Simple_Comment);
package State_Stacks is new Brackelib.Stacks (T => State);
Parse_Error : exception;
procedure Raise_Error (TheNode : Node) is
Message : constant Wide_Wide_String :=
TheNode.TheToken'Wide_Wide_Image & " " & To_String (TheNode.TheValue);
Message2 : constant String :=
Ada.Characters.Conversions.To_String (Message);
begin
raise Parse_Error with Message2;
end Raise_Error;
-----------
-- Parse --
-----------
function Parse (AST_IN : List) return List is
State_Stack : State_Stacks.Stack;
Current_State : State := State_Start;
Current_Node : Node;
AST_Out : List;
procedure Restore_State is
Old_State : constant State := Current_State;
begin
if State_Stacks.Is_Empty (State_Stack) then
Current_State := State_Start;
else
Current_State := State_Stacks.Pop (State_Stack);
if Old_State = Current_State then
Current_State := State_Stacks.Pop (State_Stack);
else
null; --Raise_Error();
end if;
end if;
exception
when State_Stacks.Stack_Empty =>
Current_State := State_Start;
end Restore_State;
Inside_Comment_And_Not_Closing : Boolean := false;
begin
for E of AST_In loop
if Current_State = State_Inside_Complex_Comment and then
E.TheToken = Keyword_Complex_Comment_End then
Restore_State;
elsif Current_State = State_Inside_Simple_Comment
and then E.TheToken = Keyword_Identifier_Closing then
Restore_State;
else
case E.TheToken is
when Keyword_Web =>
AST_Out.Append (E);
when Keyword_Identifier_Opening =>
AST_Out.Append (E);
Current_Node := E;
Current_Node.Component := False;
State_Stacks.Push (State_Stack, State_Inside_Handlebars);
Current_State := State_Inside_Handlebars;
when Keyword_Tag_Start =>
AST_Out.Append (E);
State_Stacks.Push (State_Stack, State_Inside_Component_Declaration);
Current_Node := E;
Current_Node.Component := True;
Current_State := State_Inside_Component_Declaration;
when Keyword_Complex_Comment_Start =>
if Current_State = State_Inside_Handlebars then
AST_Out.Delete_Last;
State_Stacks.Push (State_Stack, State_Inside_Complex_Comment);
Current_State := State_Inside_Complex_Comment;
else
-- error
null;
end if;
when Keyword_Simple_Comment_Start =>
if Current_State = State_Inside_Handlebars then
AST_Out.Delete_Last;
State_Stacks.Push (State_Stack, State_Inside_Simple_Comment);
Current_State := State_Inside_Simple_Comment;
else
-- error
null;
end if;
when Attribute_Symbol =>
AST_Out.Append (E);
when Assignment_Symbol =>
AST_Out.Append (E);
when Quotation_Symbol =>
AST_Out.Append (E);
when Blockparam_Symbol =>
AST_Out.Append (E);
when Identifier =>
if Current_Node.TheToken /= No_Token and then Current_Node.TheName.Length = 0 then
Current_Node.TheName := E.TheValue;
else
AST_Out.Append (E);
end if;
when Keyword_Block_Start =>
if Current_Node.TheToken /= No_Token then
Current_Node.Block := true;
end if;
when Keyword_Identifier_Closing =>
if Current_Node.TheToken /= No_Token then
if not Current_Node.Block then
-- not a block helper - there is no need to remember state
Restore_State;
end if;
else
-- error
null;
end if;
Current_Node.TheToken := No_Token;
AST_Out.Append (E);
when Keyword_Tag_Closing_End =>
if Current_Node.TheToken /= No_Token then
-- Tag is closed - there is no need to remember state
Restore_State;
else
-- error
null;
end if;
AST_Out.Append (E);
when Keyword_Tag_Close =>
if Current_Node.TheToken /= No_Token then
Current_Node.Closing := True;
else
-- error
null;
end if;
when Keyword_Tag_End =>
if Current_Node.TheToken /= No_Token then
if not Current_Node.Component then
-- error
null;
end if;
end if;
Current_Node.TheToken := No_Token;
AST_Out.Append (E);
when KEYWORD_BLOCK_CLOSE =>
if Current_Node.TheToken /= No_Token then
Current_Node.BlockClosing := True;
else
-- error
null;
end if;
when KEYWORD_COMPLEX_COMMENT_END => null;
when Keyword_Comment => null;
when others =>
Raise_Error (E);
end case;
end if;
end loop;
return AST_Out;
end Parse;
end Compiler.Parser;
|
Take Home Test/Kamal_Faheem_Code/Kamal_Faheem_2.32.asm | FaheemAKamal/CS342Projects | 0 | 92802 | .data
h: .word 25
A: .word 0-100
size: .word 100
.text
lw $s2, h
#initializing A[8] to 200
li $t1, 200
la $s3, A
sw $t1, 32($s3)
#A[12] = h + A[8]
lw $t0, 32($s3)
add $t0, $s2, $t0
sw $t0, 48($s3) |
Transynther/x86/_processed/AVXALIGN/_st_4k_/i3-7100_9_0x84_notsx.log_3528_1717.asm | ljhsiun2/medusa | 9 | 178927 | <filename>Transynther/x86/_processed/AVXALIGN/_st_4k_/i3-7100_9_0x84_notsx.log_3528_1717.asm
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r15
push %rbx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_normal+0x16aff, %r10
xor %rdx, %rdx
mov $0x5152535455565758, %r11
movq %r11, %xmm0
vmovups %ymm0, (%r10)
nop
nop
nop
lfence
// Store
lea addresses_PSE+0x18f2f, %r10
sub %rdx, %rdx
mov $0x5152535455565758, %r15
movq %r15, %xmm2
movups %xmm2, (%r10)
// Exception!!!
nop
mov (0), %r11
and $30455, %r10
// Store
lea addresses_WC+0x8fbf, %rsi
nop
nop
xor %rbx, %rbx
movw $0x5152, (%rsi)
nop
nop
nop
nop
xor %r11, %r11
// Faulty Load
lea addresses_A+0x8fbf, %rdx
clflush (%rdx)
nop
nop
nop
inc %rdi
movb (%rdx), %r15b
lea oracles, %r11
and $0xff, %r15
shlq $12, %r15
mov (%r11,%r15,1), %r15
pop %rsi
pop %rdx
pop %rdi
pop %rbx
pop %r15
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 1, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'52': 3528}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
user/wc.asm | zhangxu0329/6.S081 | 0 | 26418 | <gh_stars>0
user/_wc: file format elf64-littleriscv
Disassembly of section .text:
0000000000000000 <wc>:
char buf[512];
void
wc(int fd, char *name)
{
0: 7119 addi sp,sp,-128
2: fc86 sd ra,120(sp)
4: f8a2 sd s0,112(sp)
6: f4a6 sd s1,104(sp)
8: f0ca sd s2,96(sp)
a: ecce sd s3,88(sp)
c: e8d2 sd s4,80(sp)
e: e4d6 sd s5,72(sp)
10: e0da sd s6,64(sp)
12: fc5e sd s7,56(sp)
14: f862 sd s8,48(sp)
16: f466 sd s9,40(sp)
18: f06a sd s10,32(sp)
1a: ec6e sd s11,24(sp)
1c: 0100 addi s0,sp,128
1e: f8a43423 sd a0,-120(s0)
22: f8b43023 sd a1,-128(s0)
int i, n;
int l, w, c, inword;
l = w = c = 0;
inword = 0;
26: 4981 li s3,0
l = w = c = 0;
28: 4c81 li s9,0
2a: 4c01 li s8,0
2c: 4b81 li s7,0
2e: 00001d97 auipc s11,0x1
32: 973d8d93 addi s11,s11,-1677 # 9a1 <buf+0x1>
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i=0; i<n; i++){
c++;
if(buf[i] == '\n')
36: 4aa9 li s5,10
l++;
if(strchr(" \r\t\n\v", buf[i]))
38: 00001a17 auipc s4,0x1
3c: 8f8a0a13 addi s4,s4,-1800 # 930 <malloc+0xe6>
inword = 0;
40: 4b01 li s6,0
while((n = read(fd, buf, sizeof(buf))) > 0){
42: a805 j 72 <wc+0x72>
if(strchr(" \r\t\n\v", buf[i]))
44: 8552 mv a0,s4
46: 00000097 auipc ra,0x0
4a: 1e4080e7 jalr 484(ra) # 22a <strchr>
4e: c919 beqz a0,64 <wc+0x64>
inword = 0;
50: 89da mv s3,s6
for(i=0; i<n; i++){
52: 0485 addi s1,s1,1
54: 01248d63 beq s1,s2,6e <wc+0x6e>
if(buf[i] == '\n')
58: 0004c583 lbu a1,0(s1)
5c: ff5594e3 bne a1,s5,44 <wc+0x44>
l++;
60: 2b85 addiw s7,s7,1
62: b7cd j 44 <wc+0x44>
else if(!inword){
64: fe0997e3 bnez s3,52 <wc+0x52>
w++;
68: 2c05 addiw s8,s8,1
inword = 1;
6a: 4985 li s3,1
6c: b7dd j 52 <wc+0x52>
c++;
6e: 01ac8cbb addw s9,s9,s10
while((n = read(fd, buf, sizeof(buf))) > 0){
72: 20000613 li a2,512
76: 00001597 auipc a1,0x1
7a: 92a58593 addi a1,a1,-1750 # 9a0 <buf>
7e: f8843503 ld a0,-120(s0)
82: 00000097 auipc ra,0x0
86: 39a080e7 jalr 922(ra) # 41c <read>
8a: 00a05f63 blez a0,a8 <wc+0xa8>
for(i=0; i<n; i++){
8e: 00001497 auipc s1,0x1
92: 91248493 addi s1,s1,-1774 # 9a0 <buf>
96: 00050d1b sext.w s10,a0
9a: fff5091b addiw s2,a0,-1
9e: 1902 slli s2,s2,0x20
a0: 02095913 srli s2,s2,0x20
a4: 996e add s2,s2,s11
a6: bf4d j 58 <wc+0x58>
}
}
}
if(n < 0){
a8: 02054e63 bltz a0,e4 <wc+0xe4>
printf("wc: read error\n");
exit(1);
}
printf("%d %d %d %s\n", l, w, c, name);
ac: f8043703 ld a4,-128(s0)
b0: 86e6 mv a3,s9
b2: 8662 mv a2,s8
b4: 85de mv a1,s7
b6: 00001517 auipc a0,0x1
ba: 89250513 addi a0,a0,-1902 # 948 <malloc+0xfe>
be: 00000097 auipc ra,0x0
c2: 6ce080e7 jalr 1742(ra) # 78c <printf>
}
c6: 70e6 ld ra,120(sp)
c8: 7446 ld s0,112(sp)
ca: 74a6 ld s1,104(sp)
cc: 7906 ld s2,96(sp)
ce: 69e6 ld s3,88(sp)
d0: 6a46 ld s4,80(sp)
d2: 6aa6 ld s5,72(sp)
d4: 6b06 ld s6,64(sp)
d6: 7be2 ld s7,56(sp)
d8: 7c42 ld s8,48(sp)
da: 7ca2 ld s9,40(sp)
dc: 7d02 ld s10,32(sp)
de: 6de2 ld s11,24(sp)
e0: 6109 addi sp,sp,128
e2: 8082 ret
printf("wc: read error\n");
e4: 00001517 auipc a0,0x1
e8: 85450513 addi a0,a0,-1964 # 938 <malloc+0xee>
ec: 00000097 auipc ra,0x0
f0: 6a0080e7 jalr 1696(ra) # 78c <printf>
exit(1);
f4: 4505 li a0,1
f6: 00000097 auipc ra,0x0
fa: 30e080e7 jalr 782(ra) # 404 <exit>
00000000000000fe <main>:
int
main(int argc, char *argv[])
{
fe: 7179 addi sp,sp,-48
100: f406 sd ra,40(sp)
102: f022 sd s0,32(sp)
104: ec26 sd s1,24(sp)
106: e84a sd s2,16(sp)
108: e44e sd s3,8(sp)
10a: e052 sd s4,0(sp)
10c: 1800 addi s0,sp,48
int fd, i;
if(argc <= 1){
10e: 4785 li a5,1
110: 04a7d763 bge a5,a0,15e <main+0x60>
114: 00858493 addi s1,a1,8
118: ffe5099b addiw s3,a0,-2
11c: 02099793 slli a5,s3,0x20
120: 01d7d993 srli s3,a5,0x1d
124: 05c1 addi a1,a1,16
126: 99ae add s3,s3,a1
wc(0, "");
exit(0);
}
for(i = 1; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
128: 4581 li a1,0
12a: 6088 ld a0,0(s1)
12c: 00000097 auipc ra,0x0
130: 318080e7 jalr 792(ra) # 444 <open>
134: 892a mv s2,a0
136: 04054263 bltz a0,17a <main+0x7c>
printf("wc: cannot open %s\n", argv[i]);
exit(1);
}
wc(fd, argv[i]);
13a: 608c ld a1,0(s1)
13c: 00000097 auipc ra,0x0
140: ec4080e7 jalr -316(ra) # 0 <wc>
close(fd);
144: 854a mv a0,s2
146: 00000097 auipc ra,0x0
14a: 2e6080e7 jalr 742(ra) # 42c <close>
for(i = 1; i < argc; i++){
14e: 04a1 addi s1,s1,8
150: fd349ce3 bne s1,s3,128 <main+0x2a>
}
exit(0);
154: 4501 li a0,0
156: 00000097 auipc ra,0x0
15a: 2ae080e7 jalr 686(ra) # 404 <exit>
wc(0, "");
15e: 00000597 auipc a1,0x0
162: 7fa58593 addi a1,a1,2042 # 958 <malloc+0x10e>
166: 4501 li a0,0
168: 00000097 auipc ra,0x0
16c: e98080e7 jalr -360(ra) # 0 <wc>
exit(0);
170: 4501 li a0,0
172: 00000097 auipc ra,0x0
176: 292080e7 jalr 658(ra) # 404 <exit>
printf("wc: cannot open %s\n", argv[i]);
17a: 608c ld a1,0(s1)
17c: 00000517 auipc a0,0x0
180: 7e450513 addi a0,a0,2020 # 960 <malloc+0x116>
184: 00000097 auipc ra,0x0
188: 608080e7 jalr 1544(ra) # 78c <printf>
exit(1);
18c: 4505 li a0,1
18e: 00000097 auipc ra,0x0
192: 276080e7 jalr 630(ra) # 404 <exit>
0000000000000196 <strcpy>:
#include "kernel/fcntl.h"
#include "user/user.h"
char*
strcpy(char *s, const char *t)
{
196: 1141 addi sp,sp,-16
198: e422 sd s0,8(sp)
19a: 0800 addi s0,sp,16
char *os;
os = s;
while((*s++ = *t++) != 0)
19c: 87aa mv a5,a0
19e: 0585 addi a1,a1,1
1a0: 0785 addi a5,a5,1
1a2: fff5c703 lbu a4,-1(a1)
1a6: fee78fa3 sb a4,-1(a5)
1aa: fb75 bnez a4,19e <strcpy+0x8>
;
return os;
}
1ac: 6422 ld s0,8(sp)
1ae: 0141 addi sp,sp,16
1b0: 8082 ret
00000000000001b2 <strcmp>:
int
strcmp(const char *p, const char *q)
{
1b2: 1141 addi sp,sp,-16
1b4: e422 sd s0,8(sp)
1b6: 0800 addi s0,sp,16
while(*p && *p == *q)
1b8: 00054783 lbu a5,0(a0)
1bc: cb91 beqz a5,1d0 <strcmp+0x1e>
1be: 0005c703 lbu a4,0(a1)
1c2: 00f71763 bne a4,a5,1d0 <strcmp+0x1e>
p++, q++;
1c6: 0505 addi a0,a0,1
1c8: 0585 addi a1,a1,1
while(*p && *p == *q)
1ca: 00054783 lbu a5,0(a0)
1ce: fbe5 bnez a5,1be <strcmp+0xc>
return (uchar)*p - (uchar)*q;
1d0: 0005c503 lbu a0,0(a1)
}
1d4: 40a7853b subw a0,a5,a0
1d8: 6422 ld s0,8(sp)
1da: 0141 addi sp,sp,16
1dc: 8082 ret
00000000000001de <strlen>:
uint
strlen(const char *s)
{
1de: 1141 addi sp,sp,-16
1e0: e422 sd s0,8(sp)
1e2: 0800 addi s0,sp,16
int n;
for(n = 0; s[n]; n++)
1e4: 00054783 lbu a5,0(a0)
1e8: cf91 beqz a5,204 <strlen+0x26>
1ea: 0505 addi a0,a0,1
1ec: 87aa mv a5,a0
1ee: 4685 li a3,1
1f0: 9e89 subw a3,a3,a0
1f2: 00f6853b addw a0,a3,a5
1f6: 0785 addi a5,a5,1
1f8: fff7c703 lbu a4,-1(a5)
1fc: fb7d bnez a4,1f2 <strlen+0x14>
;
return n;
}
1fe: 6422 ld s0,8(sp)
200: 0141 addi sp,sp,16
202: 8082 ret
for(n = 0; s[n]; n++)
204: 4501 li a0,0
206: bfe5 j 1fe <strlen+0x20>
0000000000000208 <memset>:
void*
memset(void *dst, int c, uint n)
{
208: 1141 addi sp,sp,-16
20a: e422 sd s0,8(sp)
20c: 0800 addi s0,sp,16
char *cdst = (char *) dst;
int i;
for(i = 0; i < n; i++){
20e: ca19 beqz a2,224 <memset+0x1c>
210: 87aa mv a5,a0
212: 1602 slli a2,a2,0x20
214: 9201 srli a2,a2,0x20
216: 00a60733 add a4,a2,a0
cdst[i] = c;
21a: 00b78023 sb a1,0(a5)
for(i = 0; i < n; i++){
21e: 0785 addi a5,a5,1
220: fee79de3 bne a5,a4,21a <memset+0x12>
}
return dst;
}
224: 6422 ld s0,8(sp)
226: 0141 addi sp,sp,16
228: 8082 ret
000000000000022a <strchr>:
char*
strchr(const char *s, char c)
{
22a: 1141 addi sp,sp,-16
22c: e422 sd s0,8(sp)
22e: 0800 addi s0,sp,16
for(; *s; s++)
230: 00054783 lbu a5,0(a0)
234: cb99 beqz a5,24a <strchr+0x20>
if(*s == c)
236: 00f58763 beq a1,a5,244 <strchr+0x1a>
for(; *s; s++)
23a: 0505 addi a0,a0,1
23c: 00054783 lbu a5,0(a0)
240: fbfd bnez a5,236 <strchr+0xc>
return (char*)s;
return 0;
242: 4501 li a0,0
}
244: 6422 ld s0,8(sp)
246: 0141 addi sp,sp,16
248: 8082 ret
return 0;
24a: 4501 li a0,0
24c: bfe5 j 244 <strchr+0x1a>
000000000000024e <gets>:
char*
gets(char *buf, int max)
{
24e: 711d addi sp,sp,-96
250: ec86 sd ra,88(sp)
252: e8a2 sd s0,80(sp)
254: e4a6 sd s1,72(sp)
256: e0ca sd s2,64(sp)
258: fc4e sd s3,56(sp)
25a: f852 sd s4,48(sp)
25c: f456 sd s5,40(sp)
25e: f05a sd s6,32(sp)
260: ec5e sd s7,24(sp)
262: 1080 addi s0,sp,96
264: 8baa mv s7,a0
266: 8a2e mv s4,a1
int i, cc;
char c;
for(i=0; i+1 < max; ){
268: 892a mv s2,a0
26a: 4481 li s1,0
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
26c: 4aa9 li s5,10
26e: 4b35 li s6,13
for(i=0; i+1 < max; ){
270: 89a6 mv s3,s1
272: 2485 addiw s1,s1,1
274: 0344d863 bge s1,s4,2a4 <gets+0x56>
cc = read(0, &c, 1);
278: 4605 li a2,1
27a: faf40593 addi a1,s0,-81
27e: 4501 li a0,0
280: 00000097 auipc ra,0x0
284: 19c080e7 jalr 412(ra) # 41c <read>
if(cc < 1)
288: 00a05e63 blez a0,2a4 <gets+0x56>
buf[i++] = c;
28c: faf44783 lbu a5,-81(s0)
290: 00f90023 sb a5,0(s2)
if(c == '\n' || c == '\r')
294: 01578763 beq a5,s5,2a2 <gets+0x54>
298: 0905 addi s2,s2,1
29a: fd679be3 bne a5,s6,270 <gets+0x22>
for(i=0; i+1 < max; ){
29e: 89a6 mv s3,s1
2a0: a011 j 2a4 <gets+0x56>
2a2: 89a6 mv s3,s1
break;
}
buf[i] = '\0';
2a4: 99de add s3,s3,s7
2a6: 00098023 sb zero,0(s3)
return buf;
}
2aa: 855e mv a0,s7
2ac: 60e6 ld ra,88(sp)
2ae: 6446 ld s0,80(sp)
2b0: 64a6 ld s1,72(sp)
2b2: 6906 ld s2,64(sp)
2b4: 79e2 ld s3,56(sp)
2b6: 7a42 ld s4,48(sp)
2b8: 7aa2 ld s5,40(sp)
2ba: 7b02 ld s6,32(sp)
2bc: 6be2 ld s7,24(sp)
2be: 6125 addi sp,sp,96
2c0: 8082 ret
00000000000002c2 <stat>:
int
stat(const char *n, struct stat *st)
{
2c2: 1101 addi sp,sp,-32
2c4: ec06 sd ra,24(sp)
2c6: e822 sd s0,16(sp)
2c8: e426 sd s1,8(sp)
2ca: e04a sd s2,0(sp)
2cc: 1000 addi s0,sp,32
2ce: 892e mv s2,a1
int fd;
int r;
fd = open(n, O_RDONLY);
2d0: 4581 li a1,0
2d2: 00000097 auipc ra,0x0
2d6: 172080e7 jalr 370(ra) # 444 <open>
if(fd < 0)
2da: 02054563 bltz a0,304 <stat+0x42>
2de: 84aa mv s1,a0
return -1;
r = fstat(fd, st);
2e0: 85ca mv a1,s2
2e2: 00000097 auipc ra,0x0
2e6: 17a080e7 jalr 378(ra) # 45c <fstat>
2ea: 892a mv s2,a0
close(fd);
2ec: 8526 mv a0,s1
2ee: 00000097 auipc ra,0x0
2f2: 13e080e7 jalr 318(ra) # 42c <close>
return r;
}
2f6: 854a mv a0,s2
2f8: 60e2 ld ra,24(sp)
2fa: 6442 ld s0,16(sp)
2fc: 64a2 ld s1,8(sp)
2fe: 6902 ld s2,0(sp)
300: 6105 addi sp,sp,32
302: 8082 ret
return -1;
304: 597d li s2,-1
306: bfc5 j 2f6 <stat+0x34>
0000000000000308 <atoi>:
int
atoi(const char *s)
{
308: 1141 addi sp,sp,-16
30a: e422 sd s0,8(sp)
30c: 0800 addi s0,sp,16
int n;
n = 0;
while('0' <= *s && *s <= '9')
30e: 00054603 lbu a2,0(a0)
312: fd06079b addiw a5,a2,-48
316: 0ff7f793 andi a5,a5,255
31a: 4725 li a4,9
31c: 02f76963 bltu a4,a5,34e <atoi+0x46>
320: 86aa mv a3,a0
n = 0;
322: 4501 li a0,0
while('0' <= *s && *s <= '9')
324: 45a5 li a1,9
n = n*10 + *s++ - '0';
326: 0685 addi a3,a3,1
328: 0025179b slliw a5,a0,0x2
32c: 9fa9 addw a5,a5,a0
32e: 0017979b slliw a5,a5,0x1
332: 9fb1 addw a5,a5,a2
334: fd07851b addiw a0,a5,-48
while('0' <= *s && *s <= '9')
338: 0006c603 lbu a2,0(a3)
33c: fd06071b addiw a4,a2,-48
340: 0ff77713 andi a4,a4,255
344: fee5f1e3 bgeu a1,a4,326 <atoi+0x1e>
return n;
}
348: 6422 ld s0,8(sp)
34a: 0141 addi sp,sp,16
34c: 8082 ret
n = 0;
34e: 4501 li a0,0
350: bfe5 j 348 <atoi+0x40>
0000000000000352 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
352: 1141 addi sp,sp,-16
354: e422 sd s0,8(sp)
356: 0800 addi s0,sp,16
char *dst;
const char *src;
dst = vdst;
src = vsrc;
if (src > dst) {
358: 02b57463 bgeu a0,a1,380 <memmove+0x2e>
while(n-- > 0)
35c: 00c05f63 blez a2,37a <memmove+0x28>
360: 1602 slli a2,a2,0x20
362: 9201 srli a2,a2,0x20
364: 00c507b3 add a5,a0,a2
dst = vdst;
368: 872a mv a4,a0
*dst++ = *src++;
36a: 0585 addi a1,a1,1
36c: 0705 addi a4,a4,1
36e: fff5c683 lbu a3,-1(a1)
372: fed70fa3 sb a3,-1(a4)
while(n-- > 0)
376: fee79ae3 bne a5,a4,36a <memmove+0x18>
src += n;
while(n-- > 0)
*--dst = *--src;
}
return vdst;
}
37a: 6422 ld s0,8(sp)
37c: 0141 addi sp,sp,16
37e: 8082 ret
dst += n;
380: 00c50733 add a4,a0,a2
src += n;
384: 95b2 add a1,a1,a2
while(n-- > 0)
386: fec05ae3 blez a2,37a <memmove+0x28>
38a: fff6079b addiw a5,a2,-1
38e: 1782 slli a5,a5,0x20
390: 9381 srli a5,a5,0x20
392: fff7c793 not a5,a5
396: 97ba add a5,a5,a4
*--dst = *--src;
398: 15fd addi a1,a1,-1
39a: 177d addi a4,a4,-1
39c: 0005c683 lbu a3,0(a1)
3a0: 00d70023 sb a3,0(a4)
while(n-- > 0)
3a4: fee79ae3 bne a5,a4,398 <memmove+0x46>
3a8: bfc9 j 37a <memmove+0x28>
00000000000003aa <memcmp>:
int
memcmp(const void *s1, const void *s2, uint n)
{
3aa: 1141 addi sp,sp,-16
3ac: e422 sd s0,8(sp)
3ae: 0800 addi s0,sp,16
const char *p1 = s1, *p2 = s2;
while (n-- > 0) {
3b0: ca05 beqz a2,3e0 <memcmp+0x36>
3b2: fff6069b addiw a3,a2,-1
3b6: 1682 slli a3,a3,0x20
3b8: 9281 srli a3,a3,0x20
3ba: 0685 addi a3,a3,1
3bc: 96aa add a3,a3,a0
if (*p1 != *p2) {
3be: 00054783 lbu a5,0(a0)
3c2: 0005c703 lbu a4,0(a1)
3c6: 00e79863 bne a5,a4,3d6 <memcmp+0x2c>
return *p1 - *p2;
}
p1++;
3ca: 0505 addi a0,a0,1
p2++;
3cc: 0585 addi a1,a1,1
while (n-- > 0) {
3ce: fed518e3 bne a0,a3,3be <memcmp+0x14>
}
return 0;
3d2: 4501 li a0,0
3d4: a019 j 3da <memcmp+0x30>
return *p1 - *p2;
3d6: 40e7853b subw a0,a5,a4
}
3da: 6422 ld s0,8(sp)
3dc: 0141 addi sp,sp,16
3de: 8082 ret
return 0;
3e0: 4501 li a0,0
3e2: bfe5 j 3da <memcmp+0x30>
00000000000003e4 <memcpy>:
void *
memcpy(void *dst, const void *src, uint n)
{
3e4: 1141 addi sp,sp,-16
3e6: e406 sd ra,8(sp)
3e8: e022 sd s0,0(sp)
3ea: 0800 addi s0,sp,16
return memmove(dst, src, n);
3ec: 00000097 auipc ra,0x0
3f0: f66080e7 jalr -154(ra) # 352 <memmove>
}
3f4: 60a2 ld ra,8(sp)
3f6: 6402 ld s0,0(sp)
3f8: 0141 addi sp,sp,16
3fa: 8082 ret
00000000000003fc <fork>:
# generated by usys.pl - do not edit
#include "kernel/syscall.h"
.global fork
fork:
li a7, SYS_fork
3fc: 4885 li a7,1
ecall
3fe: 00000073 ecall
ret
402: 8082 ret
0000000000000404 <exit>:
.global exit
exit:
li a7, SYS_exit
404: 4889 li a7,2
ecall
406: 00000073 ecall
ret
40a: 8082 ret
000000000000040c <wait>:
.global wait
wait:
li a7, SYS_wait
40c: 488d li a7,3
ecall
40e: 00000073 ecall
ret
412: 8082 ret
0000000000000414 <pipe>:
.global pipe
pipe:
li a7, SYS_pipe
414: 4891 li a7,4
ecall
416: 00000073 ecall
ret
41a: 8082 ret
000000000000041c <read>:
.global read
read:
li a7, SYS_read
41c: 4895 li a7,5
ecall
41e: 00000073 ecall
ret
422: 8082 ret
0000000000000424 <write>:
.global write
write:
li a7, SYS_write
424: 48c1 li a7,16
ecall
426: 00000073 ecall
ret
42a: 8082 ret
000000000000042c <close>:
.global close
close:
li a7, SYS_close
42c: 48d5 li a7,21
ecall
42e: 00000073 ecall
ret
432: 8082 ret
0000000000000434 <kill>:
.global kill
kill:
li a7, SYS_kill
434: 4899 li a7,6
ecall
436: 00000073 ecall
ret
43a: 8082 ret
000000000000043c <exec>:
.global exec
exec:
li a7, SYS_exec
43c: 489d li a7,7
ecall
43e: 00000073 ecall
ret
442: 8082 ret
0000000000000444 <open>:
.global open
open:
li a7, SYS_open
444: 48bd li a7,15
ecall
446: 00000073 ecall
ret
44a: 8082 ret
000000000000044c <mknod>:
.global mknod
mknod:
li a7, SYS_mknod
44c: 48c5 li a7,17
ecall
44e: 00000073 ecall
ret
452: 8082 ret
0000000000000454 <unlink>:
.global unlink
unlink:
li a7, SYS_unlink
454: 48c9 li a7,18
ecall
456: 00000073 ecall
ret
45a: 8082 ret
000000000000045c <fstat>:
.global fstat
fstat:
li a7, SYS_fstat
45c: 48a1 li a7,8
ecall
45e: 00000073 ecall
ret
462: 8082 ret
0000000000000464 <link>:
.global link
link:
li a7, SYS_link
464: 48cd li a7,19
ecall
466: 00000073 ecall
ret
46a: 8082 ret
000000000000046c <mkdir>:
.global mkdir
mkdir:
li a7, SYS_mkdir
46c: 48d1 li a7,20
ecall
46e: 00000073 ecall
ret
472: 8082 ret
0000000000000474 <chdir>:
.global chdir
chdir:
li a7, SYS_chdir
474: 48a5 li a7,9
ecall
476: 00000073 ecall
ret
47a: 8082 ret
000000000000047c <dup>:
.global dup
dup:
li a7, SYS_dup
47c: 48a9 li a7,10
ecall
47e: 00000073 ecall
ret
482: 8082 ret
0000000000000484 <getpid>:
.global getpid
getpid:
li a7, SYS_getpid
484: 48ad li a7,11
ecall
486: 00000073 ecall
ret
48a: 8082 ret
000000000000048c <sbrk>:
.global sbrk
sbrk:
li a7, SYS_sbrk
48c: 48b1 li a7,12
ecall
48e: 00000073 ecall
ret
492: 8082 ret
0000000000000494 <sleep>:
.global sleep
sleep:
li a7, SYS_sleep
494: 48b5 li a7,13
ecall
496: 00000073 ecall
ret
49a: 8082 ret
000000000000049c <uptime>:
.global uptime
uptime:
li a7, SYS_uptime
49c: 48b9 li a7,14
ecall
49e: 00000073 ecall
ret
4a2: 8082 ret
00000000000004a4 <sigalarm>:
.global sigalarm
sigalarm:
li a7, SYS_sigalarm
4a4: 48d9 li a7,22
ecall
4a6: 00000073 ecall
ret
4aa: 8082 ret
00000000000004ac <sigreturn>:
.global sigreturn
sigreturn:
li a7, SYS_sigreturn
4ac: 48dd li a7,23
ecall
4ae: 00000073 ecall
ret
4b2: 8082 ret
00000000000004b4 <putc>:
static char digits[] = "0123456789ABCDEF";
static void
putc(int fd, char c)
{
4b4: 1101 addi sp,sp,-32
4b6: ec06 sd ra,24(sp)
4b8: e822 sd s0,16(sp)
4ba: 1000 addi s0,sp,32
4bc: feb407a3 sb a1,-17(s0)
write(fd, &c, 1);
4c0: 4605 li a2,1
4c2: fef40593 addi a1,s0,-17
4c6: 00000097 auipc ra,0x0
4ca: f5e080e7 jalr -162(ra) # 424 <write>
}
4ce: 60e2 ld ra,24(sp)
4d0: 6442 ld s0,16(sp)
4d2: 6105 addi sp,sp,32
4d4: 8082 ret
00000000000004d6 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
4d6: 7139 addi sp,sp,-64
4d8: fc06 sd ra,56(sp)
4da: f822 sd s0,48(sp)
4dc: f426 sd s1,40(sp)
4de: f04a sd s2,32(sp)
4e0: ec4e sd s3,24(sp)
4e2: 0080 addi s0,sp,64
4e4: 84aa mv s1,a0
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
4e6: c299 beqz a3,4ec <printint+0x16>
4e8: 0805c863 bltz a1,578 <printint+0xa2>
neg = 1;
x = -xx;
} else {
x = xx;
4ec: 2581 sext.w a1,a1
neg = 0;
4ee: 4881 li a7,0
4f0: fc040693 addi a3,s0,-64
}
i = 0;
4f4: 4701 li a4,0
do{
buf[i++] = digits[x % base];
4f6: 2601 sext.w a2,a2
4f8: 00000517 auipc a0,0x0
4fc: 48850513 addi a0,a0,1160 # 980 <digits>
500: 883a mv a6,a4
502: 2705 addiw a4,a4,1
504: 02c5f7bb remuw a5,a1,a2
508: 1782 slli a5,a5,0x20
50a: 9381 srli a5,a5,0x20
50c: 97aa add a5,a5,a0
50e: 0007c783 lbu a5,0(a5)
512: 00f68023 sb a5,0(a3)
}while((x /= base) != 0);
516: 0005879b sext.w a5,a1
51a: 02c5d5bb divuw a1,a1,a2
51e: 0685 addi a3,a3,1
520: fec7f0e3 bgeu a5,a2,500 <printint+0x2a>
if(neg)
524: 00088b63 beqz a7,53a <printint+0x64>
buf[i++] = '-';
528: fd040793 addi a5,s0,-48
52c: 973e add a4,a4,a5
52e: 02d00793 li a5,45
532: fef70823 sb a5,-16(a4)
536: 0028071b addiw a4,a6,2
while(--i >= 0)
53a: 02e05863 blez a4,56a <printint+0x94>
53e: fc040793 addi a5,s0,-64
542: 00e78933 add s2,a5,a4
546: fff78993 addi s3,a5,-1
54a: 99ba add s3,s3,a4
54c: 377d addiw a4,a4,-1
54e: 1702 slli a4,a4,0x20
550: 9301 srli a4,a4,0x20
552: 40e989b3 sub s3,s3,a4
putc(fd, buf[i]);
556: fff94583 lbu a1,-1(s2)
55a: 8526 mv a0,s1
55c: 00000097 auipc ra,0x0
560: f58080e7 jalr -168(ra) # 4b4 <putc>
while(--i >= 0)
564: 197d addi s2,s2,-1
566: ff3918e3 bne s2,s3,556 <printint+0x80>
}
56a: 70e2 ld ra,56(sp)
56c: 7442 ld s0,48(sp)
56e: 74a2 ld s1,40(sp)
570: 7902 ld s2,32(sp)
572: 69e2 ld s3,24(sp)
574: 6121 addi sp,sp,64
576: 8082 ret
x = -xx;
578: 40b005bb negw a1,a1
neg = 1;
57c: 4885 li a7,1
x = -xx;
57e: bf8d j 4f0 <printint+0x1a>
0000000000000580 <vprintf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
vprintf(int fd, const char *fmt, va_list ap)
{
580: 7119 addi sp,sp,-128
582: fc86 sd ra,120(sp)
584: f8a2 sd s0,112(sp)
586: f4a6 sd s1,104(sp)
588: f0ca sd s2,96(sp)
58a: ecce sd s3,88(sp)
58c: e8d2 sd s4,80(sp)
58e: e4d6 sd s5,72(sp)
590: e0da sd s6,64(sp)
592: fc5e sd s7,56(sp)
594: f862 sd s8,48(sp)
596: f466 sd s9,40(sp)
598: f06a sd s10,32(sp)
59a: ec6e sd s11,24(sp)
59c: 0100 addi s0,sp,128
char *s;
int c, i, state;
state = 0;
for(i = 0; fmt[i]; i++){
59e: 0005c903 lbu s2,0(a1)
5a2: 18090f63 beqz s2,740 <vprintf+0x1c0>
5a6: 8aaa mv s5,a0
5a8: 8b32 mv s6,a2
5aa: 00158493 addi s1,a1,1
state = 0;
5ae: 4981 li s3,0
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
5b0: 02500a13 li s4,37
if(c == 'd'){
5b4: 06400c13 li s8,100
printint(fd, va_arg(ap, int), 10, 1);
} else if(c == 'l') {
5b8: 06c00c93 li s9,108
printint(fd, va_arg(ap, uint64), 10, 0);
} else if(c == 'x') {
5bc: 07800d13 li s10,120
printint(fd, va_arg(ap, int), 16, 0);
} else if(c == 'p') {
5c0: 07000d93 li s11,112
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
5c4: 00000b97 auipc s7,0x0
5c8: 3bcb8b93 addi s7,s7,956 # 980 <digits>
5cc: a839 j 5ea <vprintf+0x6a>
putc(fd, c);
5ce: 85ca mv a1,s2
5d0: 8556 mv a0,s5
5d2: 00000097 auipc ra,0x0
5d6: ee2080e7 jalr -286(ra) # 4b4 <putc>
5da: a019 j 5e0 <vprintf+0x60>
} else if(state == '%'){
5dc: 01498f63 beq s3,s4,5fa <vprintf+0x7a>
for(i = 0; fmt[i]; i++){
5e0: 0485 addi s1,s1,1
5e2: fff4c903 lbu s2,-1(s1)
5e6: 14090d63 beqz s2,740 <vprintf+0x1c0>
c = fmt[i] & 0xff;
5ea: 0009079b sext.w a5,s2
if(state == 0){
5ee: fe0997e3 bnez s3,5dc <vprintf+0x5c>
if(c == '%'){
5f2: fd479ee3 bne a5,s4,5ce <vprintf+0x4e>
state = '%';
5f6: 89be mv s3,a5
5f8: b7e5 j 5e0 <vprintf+0x60>
if(c == 'd'){
5fa: 05878063 beq a5,s8,63a <vprintf+0xba>
} else if(c == 'l') {
5fe: 05978c63 beq a5,s9,656 <vprintf+0xd6>
} else if(c == 'x') {
602: 07a78863 beq a5,s10,672 <vprintf+0xf2>
} else if(c == 'p') {
606: 09b78463 beq a5,s11,68e <vprintf+0x10e>
printptr(fd, va_arg(ap, uint64));
} else if(c == 's'){
60a: 07300713 li a4,115
60e: 0ce78663 beq a5,a4,6da <vprintf+0x15a>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
612: 06300713 li a4,99
616: 0ee78e63 beq a5,a4,712 <vprintf+0x192>
putc(fd, va_arg(ap, uint));
} else if(c == '%'){
61a: 11478863 beq a5,s4,72a <vprintf+0x1aa>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
61e: 85d2 mv a1,s4
620: 8556 mv a0,s5
622: 00000097 auipc ra,0x0
626: e92080e7 jalr -366(ra) # 4b4 <putc>
putc(fd, c);
62a: 85ca mv a1,s2
62c: 8556 mv a0,s5
62e: 00000097 auipc ra,0x0
632: e86080e7 jalr -378(ra) # 4b4 <putc>
}
state = 0;
636: 4981 li s3,0
638: b765 j 5e0 <vprintf+0x60>
printint(fd, va_arg(ap, int), 10, 1);
63a: 008b0913 addi s2,s6,8
63e: 4685 li a3,1
640: 4629 li a2,10
642: 000b2583 lw a1,0(s6)
646: 8556 mv a0,s5
648: 00000097 auipc ra,0x0
64c: e8e080e7 jalr -370(ra) # 4d6 <printint>
650: 8b4a mv s6,s2
state = 0;
652: 4981 li s3,0
654: b771 j 5e0 <vprintf+0x60>
printint(fd, va_arg(ap, uint64), 10, 0);
656: 008b0913 addi s2,s6,8
65a: 4681 li a3,0
65c: 4629 li a2,10
65e: 000b2583 lw a1,0(s6)
662: 8556 mv a0,s5
664: 00000097 auipc ra,0x0
668: e72080e7 jalr -398(ra) # 4d6 <printint>
66c: 8b4a mv s6,s2
state = 0;
66e: 4981 li s3,0
670: bf85 j 5e0 <vprintf+0x60>
printint(fd, va_arg(ap, int), 16, 0);
672: 008b0913 addi s2,s6,8
676: 4681 li a3,0
678: 4641 li a2,16
67a: 000b2583 lw a1,0(s6)
67e: 8556 mv a0,s5
680: 00000097 auipc ra,0x0
684: e56080e7 jalr -426(ra) # 4d6 <printint>
688: 8b4a mv s6,s2
state = 0;
68a: 4981 li s3,0
68c: bf91 j 5e0 <vprintf+0x60>
printptr(fd, va_arg(ap, uint64));
68e: 008b0793 addi a5,s6,8
692: f8f43423 sd a5,-120(s0)
696: 000b3983 ld s3,0(s6)
putc(fd, '0');
69a: 03000593 li a1,48
69e: 8556 mv a0,s5
6a0: 00000097 auipc ra,0x0
6a4: e14080e7 jalr -492(ra) # 4b4 <putc>
putc(fd, 'x');
6a8: 85ea mv a1,s10
6aa: 8556 mv a0,s5
6ac: 00000097 auipc ra,0x0
6b0: e08080e7 jalr -504(ra) # 4b4 <putc>
6b4: 4941 li s2,16
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
6b6: 03c9d793 srli a5,s3,0x3c
6ba: 97de add a5,a5,s7
6bc: 0007c583 lbu a1,0(a5)
6c0: 8556 mv a0,s5
6c2: 00000097 auipc ra,0x0
6c6: df2080e7 jalr -526(ra) # 4b4 <putc>
for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4)
6ca: 0992 slli s3,s3,0x4
6cc: 397d addiw s2,s2,-1
6ce: fe0914e3 bnez s2,6b6 <vprintf+0x136>
printptr(fd, va_arg(ap, uint64));
6d2: f8843b03 ld s6,-120(s0)
state = 0;
6d6: 4981 li s3,0
6d8: b721 j 5e0 <vprintf+0x60>
s = va_arg(ap, char*);
6da: 008b0993 addi s3,s6,8
6de: 000b3903 ld s2,0(s6)
if(s == 0)
6e2: 02090163 beqz s2,704 <vprintf+0x184>
while(*s != 0){
6e6: 00094583 lbu a1,0(s2)
6ea: c9a1 beqz a1,73a <vprintf+0x1ba>
putc(fd, *s);
6ec: 8556 mv a0,s5
6ee: 00000097 auipc ra,0x0
6f2: dc6080e7 jalr -570(ra) # 4b4 <putc>
s++;
6f6: 0905 addi s2,s2,1
while(*s != 0){
6f8: 00094583 lbu a1,0(s2)
6fc: f9e5 bnez a1,6ec <vprintf+0x16c>
s = va_arg(ap, char*);
6fe: 8b4e mv s6,s3
state = 0;
700: 4981 li s3,0
702: bdf9 j 5e0 <vprintf+0x60>
s = "(null)";
704: 00000917 auipc s2,0x0
708: 27490913 addi s2,s2,628 # 978 <malloc+0x12e>
while(*s != 0){
70c: 02800593 li a1,40
710: bff1 j 6ec <vprintf+0x16c>
putc(fd, va_arg(ap, uint));
712: 008b0913 addi s2,s6,8
716: 000b4583 lbu a1,0(s6)
71a: 8556 mv a0,s5
71c: 00000097 auipc ra,0x0
720: d98080e7 jalr -616(ra) # 4b4 <putc>
724: 8b4a mv s6,s2
state = 0;
726: 4981 li s3,0
728: bd65 j 5e0 <vprintf+0x60>
putc(fd, c);
72a: 85d2 mv a1,s4
72c: 8556 mv a0,s5
72e: 00000097 auipc ra,0x0
732: d86080e7 jalr -634(ra) # 4b4 <putc>
state = 0;
736: 4981 li s3,0
738: b565 j 5e0 <vprintf+0x60>
s = va_arg(ap, char*);
73a: 8b4e mv s6,s3
state = 0;
73c: 4981 li s3,0
73e: b54d j 5e0 <vprintf+0x60>
}
}
}
740: 70e6 ld ra,120(sp)
742: 7446 ld s0,112(sp)
744: 74a6 ld s1,104(sp)
746: 7906 ld s2,96(sp)
748: 69e6 ld s3,88(sp)
74a: 6a46 ld s4,80(sp)
74c: 6aa6 ld s5,72(sp)
74e: 6b06 ld s6,64(sp)
750: 7be2 ld s7,56(sp)
752: 7c42 ld s8,48(sp)
754: 7ca2 ld s9,40(sp)
756: 7d02 ld s10,32(sp)
758: 6de2 ld s11,24(sp)
75a: 6109 addi sp,sp,128
75c: 8082 ret
000000000000075e <fprintf>:
void
fprintf(int fd, const char *fmt, ...)
{
75e: 715d addi sp,sp,-80
760: ec06 sd ra,24(sp)
762: e822 sd s0,16(sp)
764: 1000 addi s0,sp,32
766: e010 sd a2,0(s0)
768: e414 sd a3,8(s0)
76a: e818 sd a4,16(s0)
76c: ec1c sd a5,24(s0)
76e: 03043023 sd a6,32(s0)
772: 03143423 sd a7,40(s0)
va_list ap;
va_start(ap, fmt);
776: fe843423 sd s0,-24(s0)
vprintf(fd, fmt, ap);
77a: 8622 mv a2,s0
77c: 00000097 auipc ra,0x0
780: e04080e7 jalr -508(ra) # 580 <vprintf>
}
784: 60e2 ld ra,24(sp)
786: 6442 ld s0,16(sp)
788: 6161 addi sp,sp,80
78a: 8082 ret
000000000000078c <printf>:
void
printf(const char *fmt, ...)
{
78c: 711d addi sp,sp,-96
78e: ec06 sd ra,24(sp)
790: e822 sd s0,16(sp)
792: 1000 addi s0,sp,32
794: e40c sd a1,8(s0)
796: e810 sd a2,16(s0)
798: ec14 sd a3,24(s0)
79a: f018 sd a4,32(s0)
79c: f41c sd a5,40(s0)
79e: 03043823 sd a6,48(s0)
7a2: 03143c23 sd a7,56(s0)
va_list ap;
va_start(ap, fmt);
7a6: 00840613 addi a2,s0,8
7aa: fec43423 sd a2,-24(s0)
vprintf(1, fmt, ap);
7ae: 85aa mv a1,a0
7b0: 4505 li a0,1
7b2: 00000097 auipc ra,0x0
7b6: dce080e7 jalr -562(ra) # 580 <vprintf>
}
7ba: 60e2 ld ra,24(sp)
7bc: 6442 ld s0,16(sp)
7be: 6125 addi sp,sp,96
7c0: 8082 ret
00000000000007c2 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
7c2: 1141 addi sp,sp,-16
7c4: e422 sd s0,8(sp)
7c6: 0800 addi s0,sp,16
Header *bp, *p;
bp = (Header*)ap - 1;
7c8: ff050693 addi a3,a0,-16
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7cc: 00000797 auipc a5,0x0
7d0: 1cc7b783 ld a5,460(a5) # 998 <freep>
7d4: a805 j 804 <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;
7d6: 4618 lw a4,8(a2)
7d8: 9db9 addw a1,a1,a4
7da: feb52c23 sw a1,-8(a0)
bp->s.ptr = p->s.ptr->s.ptr;
7de: 6398 ld a4,0(a5)
7e0: 6318 ld a4,0(a4)
7e2: fee53823 sd a4,-16(a0)
7e6: a091 j 82a <free+0x68>
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
7e8: ff852703 lw a4,-8(a0)
7ec: 9e39 addw a2,a2,a4
7ee: c790 sw a2,8(a5)
p->s.ptr = bp->s.ptr;
7f0: ff053703 ld a4,-16(a0)
7f4: e398 sd a4,0(a5)
7f6: a099 j 83c <free+0x7a>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7f8: 6398 ld a4,0(a5)
7fa: 00e7e463 bltu a5,a4,802 <free+0x40>
7fe: 00e6ea63 bltu a3,a4,812 <free+0x50>
{
802: 87ba mv a5,a4
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
804: fed7fae3 bgeu a5,a3,7f8 <free+0x36>
808: 6398 ld a4,0(a5)
80a: 00e6e463 bltu a3,a4,812 <free+0x50>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
80e: fee7eae3 bltu a5,a4,802 <free+0x40>
if(bp + bp->s.size == p->s.ptr){
812: ff852583 lw a1,-8(a0)
816: 6390 ld a2,0(a5)
818: 02059813 slli a6,a1,0x20
81c: 01c85713 srli a4,a6,0x1c
820: 9736 add a4,a4,a3
822: fae60ae3 beq a2,a4,7d6 <free+0x14>
bp->s.ptr = p->s.ptr;
826: fec53823 sd a2,-16(a0)
if(p + p->s.size == bp){
82a: 4790 lw a2,8(a5)
82c: 02061593 slli a1,a2,0x20
830: 01c5d713 srli a4,a1,0x1c
834: 973e add a4,a4,a5
836: fae689e3 beq a3,a4,7e8 <free+0x26>
} else
p->s.ptr = bp;
83a: e394 sd a3,0(a5)
freep = p;
83c: 00000717 auipc a4,0x0
840: 14f73e23 sd a5,348(a4) # 998 <freep>
}
844: 6422 ld s0,8(sp)
846: 0141 addi sp,sp,16
848: 8082 ret
000000000000084a <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
84a: 7139 addi sp,sp,-64
84c: fc06 sd ra,56(sp)
84e: f822 sd s0,48(sp)
850: f426 sd s1,40(sp)
852: f04a sd s2,32(sp)
854: ec4e sd s3,24(sp)
856: e852 sd s4,16(sp)
858: e456 sd s5,8(sp)
85a: e05a sd s6,0(sp)
85c: 0080 addi s0,sp,64
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
85e: 02051493 slli s1,a0,0x20
862: 9081 srli s1,s1,0x20
864: 04bd addi s1,s1,15
866: 8091 srli s1,s1,0x4
868: 0014899b addiw s3,s1,1
86c: 0485 addi s1,s1,1
if((prevp = freep) == 0){
86e: 00000517 auipc a0,0x0
872: 12a53503 ld a0,298(a0) # 998 <freep>
876: c515 beqz a0,8a2 <malloc+0x58>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
878: 611c ld a5,0(a0)
if(p->s.size >= nunits){
87a: 4798 lw a4,8(a5)
87c: 02977f63 bgeu a4,s1,8ba <malloc+0x70>
880: 8a4e mv s4,s3
882: 0009871b sext.w a4,s3
886: 6685 lui a3,0x1
888: 00d77363 bgeu a4,a3,88e <malloc+0x44>
88c: 6a05 lui s4,0x1
88e: 000a0b1b sext.w s6,s4
p = sbrk(nu * sizeof(Header));
892: 004a1a1b slliw s4,s4,0x4
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
896: 00000917 auipc s2,0x0
89a: 10290913 addi s2,s2,258 # 998 <freep>
if(p == (char*)-1)
89e: 5afd li s5,-1
8a0: a895 j 914 <malloc+0xca>
base.s.ptr = freep = prevp = &base;
8a2: 00000797 auipc a5,0x0
8a6: 2fe78793 addi a5,a5,766 # ba0 <base>
8aa: 00000717 auipc a4,0x0
8ae: 0ef73723 sd a5,238(a4) # 998 <freep>
8b2: e39c sd a5,0(a5)
base.s.size = 0;
8b4: 0007a423 sw zero,8(a5)
if(p->s.size >= nunits){
8b8: b7e1 j 880 <malloc+0x36>
if(p->s.size == nunits)
8ba: 02e48c63 beq s1,a4,8f2 <malloc+0xa8>
p->s.size -= nunits;
8be: 4137073b subw a4,a4,s3
8c2: c798 sw a4,8(a5)
p += p->s.size;
8c4: 02071693 slli a3,a4,0x20
8c8: 01c6d713 srli a4,a3,0x1c
8cc: 97ba add a5,a5,a4
p->s.size = nunits;
8ce: 0137a423 sw s3,8(a5)
freep = prevp;
8d2: 00000717 auipc a4,0x0
8d6: 0ca73323 sd a0,198(a4) # 998 <freep>
return (void*)(p + 1);
8da: 01078513 addi a0,a5,16
if((p = morecore(nunits)) == 0)
return 0;
}
}
8de: 70e2 ld ra,56(sp)
8e0: 7442 ld s0,48(sp)
8e2: 74a2 ld s1,40(sp)
8e4: 7902 ld s2,32(sp)
8e6: 69e2 ld s3,24(sp)
8e8: 6a42 ld s4,16(sp)
8ea: 6aa2 ld s5,8(sp)
8ec: 6b02 ld s6,0(sp)
8ee: 6121 addi sp,sp,64
8f0: 8082 ret
prevp->s.ptr = p->s.ptr;
8f2: 6398 ld a4,0(a5)
8f4: e118 sd a4,0(a0)
8f6: bff1 j 8d2 <malloc+0x88>
hp->s.size = nu;
8f8: 01652423 sw s6,8(a0)
free((void*)(hp + 1));
8fc: 0541 addi a0,a0,16
8fe: 00000097 auipc ra,0x0
902: ec4080e7 jalr -316(ra) # 7c2 <free>
return freep;
906: 00093503 ld a0,0(s2)
if((p = morecore(nunits)) == 0)
90a: d971 beqz a0,8de <malloc+0x94>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
90c: 611c ld a5,0(a0)
if(p->s.size >= nunits){
90e: 4798 lw a4,8(a5)
910: fa9775e3 bgeu a4,s1,8ba <malloc+0x70>
if(p == freep)
914: 00093703 ld a4,0(s2)
918: 853e mv a0,a5
91a: fef719e3 bne a4,a5,90c <malloc+0xc2>
p = sbrk(nu * sizeof(Header));
91e: 8552 mv a0,s4
920: 00000097 auipc ra,0x0
924: b6c080e7 jalr -1172(ra) # 48c <sbrk>
if(p == (char*)-1)
928: fd5518e3 bne a0,s5,8f8 <malloc+0xae>
return 0;
92c: 4501 li a0,0
92e: bf45 j 8de <malloc+0x94>
|
polynomial/spline/tridiag_tst_1.adb | jscparker/math_packages | 30 | 983 | <reponame>jscparker/math_packages
with Tridiagonal_LU;
With Text_IO; use Text_IO;
procedure tridiag_tst_1 is
type Real is digits 15;
package rio is new Text_IO.Float_IO(Real);
use rio;
Type Index is range 1..40;
Package Tri is new Tridiagonal_LU (Real, Index);
use Tri;
SolutionVector : Column;
D : Matrix := (others => (others => 0.0));
A : Matrix;
UnitVector : Column;
ZeroVector : constant Column := (others => 0.0);
Index_First : Index := Index'First;
Index_Last : Index := Index'Last;
RealMaxIndex : Real;
Test : Real;
begin
Put("Input First Index Of Matrix To Invert. (e.g. 2)"); New_Line;
get(RealMaxIndex);
Index_First := Index (RealMaxIndex);
Put("Input Last Index Of Matrix To Invert. (e.g. 8)"); New_Line;
get(RealMaxIndex);
Index_Last := Index (RealMaxIndex);
-- if Banded_Matrix_Desired then
-- Construct a banded matrix:
for I in Index loop
D(0)(I) := 0.3;
end loop;
for Row in Index'First..Index'Last loop
D(1)(Row) := 0.9;
end loop;
for Row in Index'First..Index'Last loop
D(-1)(Row) := 0.5;
end loop;
A := D;
LU_Decompose (A, Index_First, Index_Last);
-- Get Nth column of the inverse matrix
-- Col := N;
Put("Output should be the Identity matrix."); new_Line;
for Col in Index range Index_First..Index_Last loop
UnitVector := ZeroVector;
UnitVector(Col) := 1.0;
Solve (SolutionVector, A, UnitVector, Index_First, Index_Last);
New_Line;
-- Multiply SolutionVector times tridiagonal D:
for Row in Index_First..Index_Last loop
Test := 0.0;
if Row > Index_First then
Test := Test + D(-1)(Row) * SolutionVector(Row-1);
end if;
Test := Test + D(0)(Row) * SolutionVector(Row);
if Row < Index_Last then
Test := Test + D(1)(Row) * SolutionVector(Row+1);
end if;
Put (Test, 2, 3, 3); Put (" ");
end loop;
end loop;
end;
|
3-mid/opengl/source/lean/opengl-camera.adb | charlie5/lace | 20 | 14041 | <filename>3-mid/opengl/source/lean/opengl-camera.adb
with
ada.Text_IO,
ada.Exceptions;
package body openGL.Camera
is
use math.Algebra.linear,
math.Algebra.linear.d3,
ada.Text_IO;
---------
-- Forge
--
procedure define (Self : in out Item)
is
begin
Self.Culler .define;
Self.Impostorer.define;
Self.world_Transform := Identity_4x4;
Self. view_Transform := Identity_4x4;
Self.Viewport := (Min => (0, 0),
Max => (0, 0));
end define;
procedure destroy (Self : in out Item)
is
begin
Self.cull_Engine.stop;
end destroy;
--------------
-- Attributes
--
function to_World_Site (Self : in Item'Class; Window_Site : in math.Vector_3) return math.Vector_3
is
perspective_Transform : constant math.Matrix_4x4 := to_Perspective (FoVy => 60.0,
Aspect => Self.Aspect,
zNear => Self.near_Plane_Distance,
zFar => Self. far_Plane_Distance);
Viewport : constant Rectangle := Self.Viewport;
Position_window_space : constant Vector_3 := (Window_Site (1),
Real (Viewport.Max (2)) - Window_Site (2),
Window_Site (3));
Site_world_space : constant Vector_3 := unProject (Position_window_space,
Model => Self.view_Transform,
Projection => perspective_Transform,
Viewport => Viewport);
begin
return Site_world_space;
end to_World_Site;
procedure Site_is (Self : in out Item'Class; now : in math.Vector_3)
is
begin
Self.world_Transform := to_transform_Matrix ((Self.Spin,
now));
Self.update_View_Transform;
end Site_is;
function Site (Self : in Item'Class) return math.Vector_3
is
begin
return get_Translation (Self.world_Transform);
end Site;
procedure Position_is (Self : in out Item'Class; Site : in math.Vector_3;
Spin : in math.Matrix_3x3)
is
begin
Self.world_Transform := to_transform_Matrix ((Spin,
Site));
Self.update_View_Transform;
end Position_is;
procedure Spin_is (Self : in out Item'Class; now : in math.Matrix_3x3)
is
begin
set_Rotation (Self.world_Transform, to => now);
Self.update_View_Transform;
end Spin_is;
function Spin (Self : in Item'Class) return math.Matrix_3x3
is
begin
return get_Rotation (Self.world_Transform);
end Spin;
function World_Transform (Self : in Item) return math.Matrix_4x4
is
begin
return Self.world_Transform;
end World_Transform;
function FoVy (Self : in Item'Class) return math.Degrees
is
begin
return Self.FoVy;
end FOVy;
function Aspect (Self : in Item'Class) return math.Real
is
begin
return Self.Aspect;
end Aspect;
procedure Aspect_is (Self : in out Item'Class; now : in math.Real)
is
begin
Self.Aspect := now;
end Aspect_is;
function near_Plane_Distance (Self : in Item'Class) return math.Real
is
begin
return Self.near_Plane_Distance;
end near_Plane_Distance;
procedure near_Plane_Distance_is (Self : in out Item'Class; now : in math.Real)
is
begin
Self.near_Plane_Distance := now;
end near_Plane_Distance_is;
function far_Plane_Distance (Self : in Item'Class) return math.Real
is
begin
return Self.far_Plane_Distance;
end far_Plane_Distance;
procedure far_Plane_Distance_is (Self : in out Item'Class; now : in math.Real)
is
begin
Self.far_Plane_Distance := now;
end far_Plane_Distance_is;
function view_Transform (Self : in Item'Class) return math.Matrix_4x4
is
begin
return Self.view_Transform;
end view_Transform;
function projection_Transform (Self : in Item'Class) return math.Matrix_4x4
is
begin
return Self.projection_Transform;
end projection_Transform;
procedure Viewport_is (Self : in out Item'Class; Width, Height : in Positive)
is
use real_Functions;
half_FoV_max : Radians := to_Radians (0.5 * Self.FoVy);
Tan_of_half_FoV_max : constant Real := Tan (half_FoV_max);
begin
Self.Viewport.Min (1) := 0;
Self.Viewport.Min (2) := 0;
Self.Viewport.Max (1) := Width - 1;
Self.Viewport.Max (2) := Height - 1;
Self.Aspect := Real (Width) / Real (Height);
Self.near_plane_Height := Self.near_plane_Distance * Tan_of_half_FoV_max;
Self.near_plane_Width := Self.near_plane_Height * Self.Aspect;
Self.far_plane_Height := Self.far_plane_Distance * Tan_of_half_FoV_max;
Self.far_plane_Width := Self.far_plane_Height * Self.Aspect;
if Self.Aspect > 1.0
then -- X side angle broader than y side angle.
half_FoV_max := arcTan (Self.aspect * Tan_of_half_FoV_max); -- TODO: 'half_FoV_max' is not used after here. Why is it set ?
end if;
Self.projection_Transform := to_Perspective (FoVy => Self.FoVy,
Aspect => Self.Aspect,
zNear => Self.near_Plane_Distance,
zFar => Self. far_Plane_Distance);
end Viewport_is;
function Viewport (Self : in Item) return linear_Algebra_3d.Rectangle
is
begin
return Self.Viewport;
end Viewport;
procedure Renderer_is (Self : in out Item'Class; now : in Renderer.lean.view)
is
begin
Self.Renderer := now;
end Renderer_is;
function cull_completed (Self : in Item) return Boolean
is
begin
return Boolean (Self.cull_Completed);
end cull_completed;
procedure disable_cull (Self : in out Item)
is
begin
Self.is_Culling := False;
end disable_cull;
function vanish_Point_Size_min (Self : in Item'Class) return Real
is
begin
return Self.Culler.vanish_Point_Size_min;
end vanish_Point_Size_min;
procedure vanish_Point_Size_min_is (Self : in out Item'Class; now : in Real)
is
begin
Self.Culler.vanish_Point_Size_min_is (now);
end vanish_Point_Size_min_is;
-- Impostors
--
function Impostor_Size_min (Self : in Item) return Real
is
begin
return Self.Impostorer.Impostor_Size_min;
end Impostor_Size_min;
procedure Impostor_Size_min_is (Self : in out Item; now : in Real)
is
begin
Self.Impostorer.Impostor_Size_min_is (now);
end Impostor_Size_min_is;
procedure allow_Impostors (Self : in out Item; now : in Boolean := True)
is
begin
Self.Impostors_allowed := now;
end allow_Impostors;
----------
-- Engine
--
task body cull_Engine
is
Done : Boolean := False;
culling : Boolean;
all_Visuals : openGL.Visual.views (1 .. 20_000);
all_Visuals_last : Natural;
begin
loop
select
accept stop
do
Done := True;
end stop;
or
accept cull (the_Visuals : in Visual.views; do_cull : in Boolean)
do
all_Visuals (the_Visuals'Range) := the_Visuals;
all_visuals_Last := the_Visuals'Last;
culling := do_cull;
Self.Cull_completed := False;
end cull;
end select;
exit when Done;
declare
function get_Visuals return Visual.views
is
begin
if culling
then
return Self.Culler.cull (the_Visuals => all_Visuals (1 .. all_Visuals_last),
Camera_Frustum => Self.current_Planes,
Camera_Site => Self.Site);
else
return all_Visuals (1 .. all_visuals_Last);
end if;
end get_Visuals;
the_Visuals : Visual.views := get_Visuals;
begin
if Self.Impostors_allowed
then
Self.Impostorer.Renderer_is (Self.Renderer);
Self.Impostorer.substitute (the_Visuals,
Camera => Self);
end if;
Self.Renderer.queue_Visuals (the_Visuals, Self);
Self.Cull_completed := True;
end;
end loop;
Self.Impostorer.destruct;
exception
when E : others =>
new_Line;
put_Line ("Unhandled exception in openGL camera Cull engine.");
put_Line (ada.Exceptions.Exception_Information (E));
end cull_Engine;
--------------
-- Operations
--
procedure render (Self : in out Item; Visuals : in Visual.views;
to : in Surface.view := null)
is
pragma Unreferenced (To); -- TODO: Finish using surfaces.
begin
Self.cull_Engine.cull (Visuals, do_cull => Self.is_Culling);
end render;
function current_Planes (Self : in Item) return openGL.Frustum.Plane_array
is
use openGL.Frustum;
the_Planes : Frustum.Plane_array;
Projection : constant Matrix_4x4 := Self.projection_Transform;
Model : constant Matrix_4x4 := Self.view_Transform;
Clip : constant Matrix_4x4 := Model * Projection;
begin
-- Extract the Right plane.
--
the_Planes (Right)(1) := clip (1,4) - clip (1,1);
the_Planes (Right)(2) := clip (2,4) - clip (2,1);
the_Planes (Right)(3) := clip (3,4) - clip (3,1);
the_Planes (Right)(4) := clip (4,4) - clip (4,1);
-- Extract the Left plane.
--
the_Planes (Left)(1) := clip (1,4) + clip (1,1);
the_Planes (Left)(2) := clip (2,4) + clip (2,1);
the_Planes (Left)(3) := clip (3,4) + clip (3,1);
the_Planes (Left)(4) := clip (4,4) + clip (4,1);
-- Extract the Low plane.
--
the_Planes (Low)(1) := clip (1,4) + clip (1,2);
the_Planes (Low)(2) := clip (2,4) + clip (2,2);
the_Planes (Low)(3) := clip (3,4) + clip (3,2);
the_Planes (Low)(4) := clip (4,4) + clip (4,2);
-- Extract the High plane.
--
the_Planes (High)(1) := clip (1,4) - clip (1,2);
the_Planes (High)(2) := clip (2,4) - clip (2,2);
the_Planes (High)(3) := clip (3,4) - clip (3,2);
the_Planes (High)(4) := clip (4,4) - clip (4,2);
-- Extract the Far plane.
--
the_Planes (Far)(1) := clip (1,4) - clip (1,3);
the_Planes (Far)(2) := clip (2,4) - clip (2,3);
the_Planes (Far)(3) := clip (3,4) - clip (3,3);
the_Planes (Far)(4) := clip (4,4) - clip (4,3);
-- Extract the Near plane.
--
the_Planes (Near)(1) := clip (1,4) + clip (1,3);
the_Planes (Near)(2) := clip (2,4) + clip (2,3);
the_Planes (Near)(3) := clip (3,4) + clip (3,3);
the_Planes (Near)(4) := clip (4,4) + clip (4,3);
normalise (the_Planes);
return the_Planes;
end current_Planes;
procedure update_View_Transform (Self : in out Item)
is
begin
Self.view_Transform := inverse_Transform (Self.world_Transform);
end update_View_Transform;
end openGL.Camera;
|
src/Internals/protypo-tokens.adb | fintatarta/protypo | 0 | 12170 | <gh_stars>0
package body Protypo.Tokens is
----------------
-- Make_Token --
----------------
function Make_Token (Builder : in out Token_Builder;
Class : Valued_Token;
Value : String)
return Token
is
Result : constant Token := Token'(Class => Class,
Value => To_Unbounded_String (Value),
Position => Builder.Position);
begin
Builder.Clear_Position;
return Result;
end Make_Token;
----------------
-- Make_Token --
----------------
function Make_Token (Builder : in out Token_Builder;
Class : Unvalued_Token)
return Token
is
Result : constant Token := Token'(Class => Class,
Value => Null_Unbounded_String,
Position => Builder.Position);
begin
Builder.Clear_Position;
return Result;
end Make_Token;
function Is_Position_Set (Builder : Token_Builder) return Boolean
is (Builder.Has_Position);
------------------
-- Set_Position --
------------------
procedure Set_Position (Builder : in out Token_Builder;
Position : Token_Position)
is
begin
if Builder.Has_Position then
raise Constraint_Error;
else
Builder.Has_Position := True;
Builder.Position := Position;
end if;
end Set_Position;
--------------------
-- Clear_Position --
--------------------
procedure Clear_Position (Builder : in out Token_Builder)
is
begin
if not Builder.Has_Position then
raise Constraint_Error;
else
Builder.Has_Position := False;
end if;
end Clear_Position;
end Protypo.Tokens;
|
src/asm/define_music.asm | h1romas4/z88dk-msx-template | 5 | 28 | <reponame>h1romas4/z88dk-msx-template<gh_stars>1-10
; license:MIT License
; copyright-holders:<NAME>
; rodata_user
; https://github.com/z88dk/z88dk/blob/master/doc/overview.md#a-quick-note-for-asm-code
; rodata_user if for constant data
; kept in rom if program is in rom
SECTION rodata_user
PUBLIC _music_title, _music_main, _music_game_over, _sound_extend, _sound_get
include "../resources/music_title.asm"
include "../resources/music_main.asm"
include "../resources/music_game_over.asm"
include "../resources/sound_extend.asm"
include "../resources/sound_get.asm"
|
libsrc/_DEVELOPMENT/ctype/c/sccz80/isdigit.asm | teknoplop/z88dk | 8 | 2637 | <filename>libsrc/_DEVELOPMENT/ctype/c/sccz80/isdigit.asm
; int isdigit(int c)
SECTION code_clib
SECTION code_ctype
PUBLIC isdigit
EXTERN asm_isdigit, error_zc
isdigit:
inc h
dec h
jp nz, error_zc
ld a,l
call asm_isdigit
ld l,h
ret c
inc l
ret
|
day08/src/main.adb | jwarwick/aoc_2020 | 3 | 20387 | <reponame>jwarwick/aoc_2020
-- AOC 2020, Day 8
with Ada.Text_IO; use Ada.Text_IO;
with Day; use Day;
procedure main is
acc : constant Integer := acc_before_repeat("input.txt");
h : constant Integer := acc_after_terminate("input.txt");
begin
put_line("Part 1: " & Integer'Image(acc));
put_line("Part 2: " & Integer'Image(h));
end main;
|
Z80tests/tape1.asm | rickard-von-essen/QtSpecem | 2 | 98384 | <filename>Z80tests/tape1.asm
; EXAMPLE SAVE AND LOAD ; BLOCKS WITHOUT HEADERS
ORG 50000
LD A,2 ; upper screen
CALL 5633 ; open channel
LD IX,TAPE_TXT1
CALL PRINT_STRING
CALL WAIT_KEY
CALL FILL_SCREEN
CALL SAVE_SCREEN
CALL CLEAR_SCREEN
LD IX,TAPE_TXT2
CALL PRINT_STRING
CALL WAIT_KEY
CALL LOAD_SCREEN
LD A,1 ; lower screen
CALL 5633 ; open channel
JP WAIT_KEY
; RET
FILL_SCREEN:
LD HL,$4000 ; SCREEN START
LOOP: LD (HL),A
INC HL
LD A,H
CP $58 ; TEST FOR ATTR AREA
JR NZ,LOOP
RET
CLEAR_SCREEN:
LD HL,$4000 ; SCREEN START
LOOP2: XOR A
LD (HL),A
INC HL
LD A,H
CP $58 ; TEST FOR ATTR AREA
JR NZ,LOOP2
RET
SAVE_SCREEN:
LD A,$FF ; DATA BLOCK
LD IX,$4000 ; grava a partir de 16384
LD DE,$1B00 ; 6912 bytes
JP $04C2 ; call SA_BYTES
LOAD_SCREEN:
LD A,$FF ; DATA BLOCK
LD IX,$4000
LD DE,$1B00
SCF ; LOAD
JP $0556 ; call LD_BYTES
; PRINT A NULL TERMINATED STRING
; IX = STRING
;
PRINT_STRING:
LD A,(IX)
CP 0
RET Z
RST $10
INC IX
JR PRINT_STRING
WAIT_KEY:
ld hl,23560 ; LAST K system variable.
ld (hl),0 ; put null value there.
NOKEY:
ld a,(hl) ; new value of LAST K.
cp 0 ; is it still zero?
jr z,NOKEY ; yes, so no key pressed.
ret ; key was pressed.
TAPE_TXT1:
DB "Press any key when ready for saving"
DB 0
TAPE_TXT2:
DB "Go backwards on tape"
DB $0D
DB "Press any key when ready"
DB 0
END 50000
|
Transynther/x86/_processed/P/_zr_/i7-7700_9_0x48_notsx.log_1_553.asm | ljhsiun2/medusa | 9 | 242965 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %rax
push %rbx
push %rdx
push %rsi
lea addresses_WC_ht+0x1cb76, %rsi
nop
nop
nop
cmp $8707, %r13
mov (%rsi), %rbx
nop
nop
nop
sub %rax, %rax
lea addresses_UC_ht+0xa9f6, %r12
nop
nop
sub %rdx, %rdx
mov $0x6162636465666768, %r11
movq %r11, %xmm2
vmovups %ymm2, (%r12)
nop
mfence
lea addresses_UC_ht+0x19ff6, %rsi
nop
nop
and %rax, %rax
mov $0x6162636465666768, %r13
movq %r13, %xmm0
vmovups %ymm0, (%rsi)
nop
nop
nop
cmp %r13, %r13
lea addresses_WC_ht+0xd156, %r11
sub %rdx, %rdx
mov (%r11), %r13w
nop
nop
nop
cmp $1301, %rax
lea addresses_A_ht+0x79f6, %rax
nop
nop
add $40237, %rbx
mov $0x6162636465666768, %r11
movq %r11, (%rax)
nop
nop
nop
nop
nop
and %rdx, %rdx
lea addresses_UC_ht+0x1cef6, %rsi
nop
nop
nop
sub %rax, %rax
mov (%rsi), %edx
nop
nop
nop
nop
and $50169, %rsi
lea addresses_WC_ht+0x56f6, %rbx
nop
nop
nop
nop
and $50445, %r11
and $0xffffffffffffffc0, %rbx
movntdqa (%rbx), %xmm2
vpextrq $0, %xmm2, %r13
nop
nop
nop
nop
add $59940, %rdx
lea addresses_WT_ht+0x2b6, %r12
nop
sub $29037, %r11
movl $0x61626364, (%r12)
nop
nop
nop
inc %r13
pop %rsi
pop %rdx
pop %rbx
pop %rax
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r15
push %r8
push %rax
push %rdi
// Store
lea addresses_normal+0xb9f6, %r10
nop
nop
inc %r15
movw $0x5152, (%r10)
nop
nop
add %r14, %r14
// Faulty Load
mov $0x9f6, %r10
nop
nop
cmp %rdi, %rdi
movb (%r10), %r15b
lea oracles, %r8
and $0xff, %r15
shlq $12, %r15
mov (%r8,%r15,1), %r15
pop %rdi
pop %rax
pop %r8
pop %r15
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_P', 'congruent': 0}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal', 'congruent': 11}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_P', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC_ht', 'congruent': 6}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 9}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WC_ht', 'congruent': 5}}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 11}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC_ht', 'congruent': 8}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT_ht', 'congruent': 5}, 'OP': 'STOR'}
{'00': 1}
00
*/
|
smsq/ioa/frmt.asm | olifink/smsqe | 0 | 1255 | ; SMSQ Format device V2.00 1986 <NAME> QJUMP
section ioa
xdef ioa_frmt
xref ioa_ffsd ; find filing system device
xref sms_rte
include dev8_keys_iod
;+++
; d0 r error return 0, or not found
; a0 c s device_medium name
; a6 c p base of system variables
;
; all other registers preserved
;---
ioa_frmt
reglist reg d3-d6/a1-a4
movem.l reglist,-(sp)
move.l a0,a1 ; for ffsd
bsr.l ioa_ffsd ; find filing system device
bne.s ifm_exit
move.l a0,a1 ; for format
move.l a2,a4
move.l d5,d1 ; drive number
move.l iod_frmt(a3),a2
jsr (a2) ; and format it
ifm_exit
movem.l (sp)+,reglist
bra.l sms_rte
end
|
Maths/Utilities/MoveShip5-MVS5.asm | ped7g/EliteNext | 9 | 3625 | ; T = x hi usigned /2
; RS = inwkx (strip sign)
; so RS -= (xhi /2)
;PA = unkxhi[y] (strip sign)
; T = sign bit inkxhy[y]
MoveShip5:
ld bc,(regX) ; b = regY, c = regX
MoveShip5regBC:
MVS5: ; Moveship5, small rotation in matrix (1-1/2/256 = cos 1/16 = sine)
ld hl,UBnKxhi ; hl - INWK1
.IndexX:
ld a,c ;
add hl,a ;
ld a,(hl) ; INWK+1,X
ld e,a ; save a copy in e for later
and SignMask8Bit ; hi7
srl a ; hi7/2
ld d,a ; repurpose d as var
; ld (varT),a ; T repuposed d to hold sign bit
dec hl
push hl ; we will want this again right at the end
ld a,(hl) ; INWK+0,X
scf ; lo
sbc a,d ; a = a - (varT + carry bit)
ld (varR),a ; R \ Xindex one is 1-1/512
ld a,e ; restore copy of INWK+1,X
sbc a,0 ; hi
ld (varS),a ; S, TODO could we simplify this by loading xlohi into hl and subtracting 1?
ld hl,UBnKxlo ; hl = INWK+0
.IndexY:
ld a,b ;
add hl,a ;
ld a,(hl) ; INWK+0,Y
ld d,a ; use d as a working copy of p
inc hl ;
ld a,(hl) ; INWK+1,Y
ld e,a ; save a copy in e for later
and $80 ; sign bit
ld (varT),a ; T
ld a,e ; restore copy of INWK+1,Y
and SignMask8Bit ; hi7 bits
srl a ; hui7/2
rr d ; P local copy
srl a ; hui7/2
rr d ; P local copy
srl a ; hui7/2
rr d ; P local copy
ld (varP),a ; P is Yindex one divided by 16
or e ; or a with copy of T from e
ld e,a ; now we have done with T so can junk it
ld a,(RAT2)
ld d,a
ld a,e ; bit of juggling so a = varP or T d = RAT2
xor d ; a = varP or T xor RAT2
push hl ; save hl as INWK+1[y]
push bc ; save X and Y (we wont use Q) \ protect Xindex
call XAequPAaddRSfast ; ADD \ X.A = P.A + R.S
ld (varK),de ; as fast add also returns result in de we can just 16 bit load
pop bc ; restore Xindex (also Y index)
pop hl ; restore hl as INWK+1[y]
ld a,(hl) ; INWK+1,Y
and SignMask8Bit ;
srl a ; hi7/2
ld e,a ; use e as varT
dec hl
ld a,(hl) ; INWK+0,Y
scf
sbc a,e ; a = a -t + 1 (t == reg e)
ld (varR),a ; R \ Yindex one is 1-1/512
dec hl
ld a,(hl) ; INWK+1,Y
sbc a,0 ; subtract carry flag
ld (varS),a ; S
pop hl ; get back INWK+0[x]
ld a,(hl) ; INWK+0,X
push bc ; we may need BC later
ld b,a ; save P to work with in b rather than memory for now
inc hl
ld a,(hl) ; INWK+1,X
ld e,a ; save it for a bit
and $80 ; sign bit
ld d,a ; use d as varT
ld a,e ; restore INWK+1,X
and SignMask8Bit ; hi7
srl a
rr b
srl a
rr b
srl a
rr b
ex af,af'
ld a,b
ld (varP),a ; now commit P as p /16
ex af,af'
or e ; T \ sign bit
xor $80 ; flip sign
ld hl,RAT2
xor (hl) ;RAT2 \ rot sign
call XAequPAaddRSfast ; ADD \ X.A = P.A + R.S, note we still have bc on stack
pop bc ; now we have x and y restored
ld hl,UBnKxhi ;
ld a,b
add hl,a ; hl = UBnKxhi[y]
ld (hl),d
dec hl ; hl = UBnKxhi[y]
ld (hl),e ; as XA is in DE also we can just write that Yindex one now updated by 1/16th of a radian rotation
ld hl,UBnKxhi
ld a,c
add hl,a ; hl = INKW+1[X]
ld de,varKp1 ; de = variable k hi
ex de,hl ; swap
ldi
ldi ; load 2 bytes
ret
|
alloy4fun_models/trashltl/models/7/sFjrHB2xfpyT9oGKd.als | Kaixi26/org.alloytools.alloy | 0 | 620 | open main
pred idsFjrHB2xfpyT9oGKd_prop8 {
all f:File| eventually f.^link in Trash
}
pred __repair { idsFjrHB2xfpyT9oGKd_prop8 }
check __repair { idsFjrHB2xfpyT9oGKd_prop8 <=> prop8o } |
src/ada/AeonFlux/Parser/TokenValue.ads | marcello-s/AeonFlux | 0 | 5698 | <filename>src/ada/AeonFlux/Parser/TokenValue.ads
-- Copyright (c) 2015-2019 <NAME>
-- for details see License.txt
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Position; use Position;
with Tokens; use Tokens;
package TokenValue is
type Object is record
SourcePosition : Position.Object;
TokenId : Token;
Literal : Unbounded_String;
Message : Unbounded_String;
end record;
end TokenValue;
|
MIPS/DeleteLetters.asm | WorkingFen/ExamplesARKO | 1 | 81959 | <reponame>WorkingFen/ExamplesARKO
.data #data segment
prompt: .asciiz "Enter string with numbers: \n" #string
buf: .space 100 #buffer for user string
.text #text segment
.globl main #visible outside
main:
li $v0, 4 #print string
la $a0, prompt #from this
syscall
li $v0, 8 #read string
la $a0, buf #to this
li $a1, 100 #max length
syscall
la $t0, buf #first local -> address of buffer
la $t1, ($t0) #second local -> address of first local
lbu $t2, ($t0) #third local -> load byte from first element of buffer
beqz $t2, end #check if equal zero then go to label "end"
loop:
blt $t2, '0', del #check if first lesser than second then go to label "del"
bgt $t2, '9', del #check if first greater than second then go to label "del"
sb $t2, ($t1) #save byte to address of second
sb $zero, ($t0) #save byte zero to address of second
addi $t0, $t0, 1 #next element of buffer
addi $t1, $t1, 1 #next address
lbu $t2, ($t0) #load byte from second
bnez $t2, loop #check if not equal zero then go to label "loop"
beqz $t2, end #check if equal zero then go to label "end"
del:
sb $zero, ($t0) #save byte zero to address of second
addi $t0, $t0, 1 #next element of buffer
lbu $t2, ($t0) #load byte from second
bnez $t2, loop #check if not equal zero then go to label "loop"
end:
li $v0, 4 #print string
la $a0, buf #from this
syscall
li $v0, 10 #terminate execution
syscall
|
ada/original_2008/ada-gui/agar-gui-style.ads | auzkok/libagar | 286 | 12738 | <gh_stars>100-1000
with agar.core.types;
with agar.gui.rect;
with agar.gui.widget;
with agar.gui.window;
with interfaces.c.strings;
package agar.gui.style is
package cs renames interfaces.c.strings;
type version_t is record
major : c.int;
minor : c.int;
end record;
type version_access_t is access all version_t;
pragma convention (c, version_t);
pragma convention (c, version_access_t);
type style_t;
type style_access_t is access all style_t;
type style_t is record
name : cs.chars_ptr;
version : version_t;
init : access procedure (style : style_access_t);
destroy : access procedure (style : style_access_t);
window : access procedure (window : agar.gui.window.window_access_t);
titlebar_background : access procedure
(widget : agar.gui.widget.widget_access_t;
is_pressed : c.int;
is_focused : c.int);
button_background : access procedure
(widget : agar.gui.widget.widget_access_t;
is_pressed : c.int);
button_text_offset : access procedure
(widget : agar.gui.widget.widget_access_t;
is_pressed : c.int;
x : access c.int;
y : access c.int);
box_frame : access procedure
(widget : agar.gui.widget.widget_access_t;
depth : c.int);
checkbox_button : access procedure
(widget : agar.gui.widget.widget_access_t;
state : c.int);
console_background : access procedure
(widget : agar.gui.widget.widget_access_t;
bg : agar.core.types.uint32_t);
fixed_plotter_background : access procedure
(widget : agar.gui.widget.widget_access_t;
show_axis : c.int;
y_offset : agar.core.types.uint32_t);
menu_root_background : access procedure
(widget : agar.gui.widget.widget_access_t);
menu_root_selected_item_background : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t);
menu_background : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t);
menu_item_background : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t;
x_icon : c.int;
icon_obj : agar.gui.widget.widget_access_t;
icon : c.int;
is_selected : c.int;
bool_state : c.int);
menu_item_separator : access procedure
(widget : agar.gui.widget.widget_access_t;
x1 : c.int;
x2 : c.int;
y : c.int;
h : c.int);
notebook_background : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t);
notebook_tab_background : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t;
index : c.int;
is_selected : c.int);
pane_horizontal_divider : access procedure
(widget : agar.gui.widget.widget_access_t;
x : c.int;
y : c.int;
w : c.int;
h : c.int;
is_moving : c.int);
pane_vertical_divider : access procedure
(widget : agar.gui.widget.widget_access_t;
x : c.int;
y : c.int;
w : c.int;
h : c.int;
is_moving : c.int);
radio_group_background : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t);
radio_button : access procedure
(widget : agar.gui.widget.widget_access_t; -- XXX: AG_Radio *
x : c.int;
y : c.int;
selected : c.int;
over : c.int);
progress_bar_background : access procedure
(widget : agar.gui.widget.widget_access_t);
scrollbar_vertical : access procedure
(widget : agar.gui.widget.widget_access_t; -- XXX: AG_Scrollbar *
y : c.int;
h : c.int);
scrollbar_horizontal : access procedure
(widget : agar.gui.widget.widget_access_t; -- XXX: AG_Scrollbar *
x : c.int;
w : c.int);
slider_background_horizontal : access procedure
(widget : agar.gui.widget.widget_access_t);
slider_background_vertical : access procedure
(widget : agar.gui.widget.widget_access_t);
slider_control_horizontal : access procedure
(widget : agar.gui.widget.widget_access_t;
x : c.int;
y : c.int);
slider_control_vertical : access procedure
(widget : agar.gui.widget.widget_access_t;
y : c.int;
h : c.int);
separator_horizontal : access procedure
(widget : agar.gui.widget.widget_access_t); -- XXX: AG_Separator *
separator_vertical : access procedure
(widget : agar.gui.widget.widget_access_t); -- XXX: AG_Separator *
socket_background : access procedure
(widget : agar.gui.widget.widget_access_t); -- XXX: AG_Socket *
socket_overlay : access procedure
(widget : agar.gui.widget.widget_access_t; -- XXX: AG_Socket *
highlight : c.int);
table_background : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t);
table_column_header_background : access procedure
(widget : agar.gui.widget.widget_access_t;
index : c.int;
rect : agar.gui.rect.rect_t;
is_selected : c.int);
table_selected_column_background : access procedure
(widget : agar.gui.widget.widget_access_t;
index : c.int;
rect : agar.gui.rect.rect_t);
table_row_background : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t;
is_selected : c.int);
textbox_background : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t;
is_combo : c.int);
list_background : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t);
list_item_background : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t;
is_selected : c.int);
tree_subnode_indicator : access procedure
(widget : agar.gui.widget.widget_access_t;
rect : agar.gui.rect.rect_t;
is_expanded : c.int);
end record;
pragma convention (c, style_t);
pragma convention (c, style_access_t);
procedure set_style
(widget : agar.gui.widget.widget_access_t;
style : style_access_t);
procedure set_style
(widget : agar.gui.window.window_access_t;
style : style_access_t);
pragma import (c, set_style, "AG_SetStyle");
end agar.gui.style;
|
libsrc/_DEVELOPMENT/arch/sms/SMSlib/c/sccz80/SMS_VRAMmemcpy_brief_callee.asm | jpoikela/z88dk | 640 | 244766 | ; void SMS_VRAMmemcpy_brief(unsigned int dst,void *src,unsigned char size)
SECTION code_clib
SECTION code_SMSlib
PUBLIC SMS_VRAMmemcpy_brief_callee
EXTERN asm_SMSlib_VRAMmemcpy_brief
SMS_VRAMmemcpy_brief_callee:
pop hl
pop bc
pop de
ex (sp),hl
ld b,c
jp asm_SMSlib_VRAMmemcpy_brief
|
src/fmt-generic_float_argument.ads | likai3g/afmt | 0 | 30418 | <reponame>likai3g/afmt
generic
type Float_Type is digits <>;
package Fmt.Generic_Float_Argument is
-- float to string
-- https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf
-- https://github.com/jk-jeon/dragonbox/blob/master/other_files/Dragonbox.pdf
-- Edit format
-- "w=" width
-- "a=" width after decimal point
-- "e=" width of exponent
-- "f=" width before decimal point
function To_Argument (X : Float_Type) return Argument_Type'Class
with Inline;
function "&" (Args : Arguments; X : Float_Type) return Arguments
with Inline;
private
type Float_Argument_Type is new Argument_Type with record
Value : Float_Type;
Width : Natural;
Fore : Natural := 2;
Aft : Natural := Float_Type'Digits - 1;
Exp : Natural := 3;
end record;
overriding
procedure Parse (Self : in out Float_Argument_Type; Edit : String);
overriding
function Get_Length (Self : in out Float_Argument_Type) return Natural;
overriding
procedure Put (
Self : in out Float_Argument_Type;
Edit : String;
To : in out String);
end Fmt.Generic_Float_Argument;
|
libsrc/_DEVELOPMENT/arch/ts2068/display/c/sdcc/tshc_py2saddr.asm | jpoikela/z88dk | 640 | 15839 | <gh_stars>100-1000
; void *tshc_py2saddr(uchar y)
SECTION code_clib
SECTION code_arch
PUBLIC _tshc_py2saddr
EXTERN _zx_py2saddr
defc _tshc_py2saddr = _zx_py2saddr
|
Thesis/ANormalUntyped.agda | inc-lc/ilc-agda | 10 | 4846 | <reponame>inc-lc/ilc-agda
{-# OPTIONS --allow-unsolved-metas #-}
module Thesis.ANormalUntyped where
open import Agda.Primitive
open import Data.Empty
open import Data.Unit using (⊤)
open import Data.Product
open import Data.Nat
import Data.Integer.Base as I
open I using (ℤ)
open import Data.Integer.Base using (ℤ)
open import Relation.Binary.PropositionalEquality
{- Typed deBruijn indexes for untyped languages. -}
-- Using a record gives an eta rule saying that all types are equal.
record Type : Set where
constructor Uni
record DType : Set where
constructor DUni
open import Base.Syntax.Context Type public
import Base.Syntax.Context DType as DC
data Term (Γ : Context) : Set where
var : (x : Var Γ Uni) →
Term Γ
lett : (f : Var Γ Uni) → (x : Var Γ Uni) → Term (Uni • Γ) → Term Γ
ΔΔ : Context → DC.Context
ΔΔ ∅ = ∅
ΔΔ (τ • Γ) = DUni • ΔΔ Γ
derive-dvar : ∀ {Δ} → (x : Var Δ Uni) → DC.Var (ΔΔ Δ) DUni
derive-dvar this = DC.this
derive-dvar (that x) = DC.that (derive-dvar x)
data DTerm : (Δ : Context) → Set where
dvar : ∀ {Δ} (x : DC.Var (ΔΔ Δ) DUni) →
DTerm Δ
dlett : ∀ {Δ} →
(f : Var Δ Uni) →
(x : Var Δ Uni) →
(t : Term (Uni • Δ)) →
(df : DC.Var (ΔΔ Δ) DUni) →
(dx : DC.Var (ΔΔ Δ) DUni) →
(dt : DTerm (Uni • Δ)) →
DTerm Δ
derive-dterm : ∀ {Δ} → (t : Term Δ) → DTerm Δ
derive-dterm (var x) = dvar (derive-dvar x)
derive-dterm (lett f x t) =
dlett f x t (derive-dvar f) (derive-dvar x) (derive-dterm t)
{-
deriveC Δ (lett f x t) = dlett df x dx
-}
-- data ΔCTerm (Γ : Context) (τ : Type) (Δ : Context) : Set where
-- data ΔCTerm (Γ : Context) (τ : Type) (Δ : Context) : Set where
-- cvar : (x : Var Γ τ) Δ →
-- ΔCTerm Γ τ Δ
-- clett : ∀ {σ τ₁ κ} → (f : Var Γ (σ ⇒ τ₁)) → (x : Var Γ σ) →
-- ΔCTerm (τ₁ • Γ) τ (? • Δ) →
-- ΔCTerm Γ τ Δ
weaken-term : ∀ {Γ₁ Γ₂} →
(Γ₁≼Γ₂ : Γ₁ ≼ Γ₂) →
Term Γ₁ →
Term Γ₂
weaken-term Γ₁≼Γ₂ (var x) = var (weaken-var Γ₁≼Γ₂ x)
weaken-term Γ₁≼Γ₂ (lett f x t) = lett (weaken-var Γ₁≼Γ₂ f) (weaken-var Γ₁≼Γ₂ x) (weaken-term (keep _ • Γ₁≼Γ₂) t)
-- I don't necessarily recommend having a separate syntactic category for
-- functions, but we should prove a fundamental lemma for them too, somehow.
-- I'll probably end up with some ANF allowing lambdas to do the semantics.
data Fun (Γ : Context) : Set where
term : Term Γ → Fun Γ
abs : ∀ {σ} → Fun (σ • Γ) → Fun Γ
data DFun (Δ : Context) : Set where
dterm : DTerm Δ → DFun Δ
dabs : DFun (Uni • Δ) → DFun Δ
derive-dfun : ∀ {Δ} → (t : Fun Δ) → DFun Δ
derive-dfun (term t) = dterm (derive-dterm t)
derive-dfun (abs f) = dabs (derive-dfun f)
weaken-fun : ∀ {Γ₁ Γ₂} →
(Γ₁≼Γ₂ : Γ₁ ≼ Γ₂) →
Fun Γ₁ →
Fun Γ₂
weaken-fun Γ₁≼Γ₂ (term x) = term (weaken-term Γ₁≼Γ₂ x)
weaken-fun Γ₁≼Γ₂ (abs f) = abs (weaken-fun (keep _ • Γ₁≼Γ₂) f)
data Val : Type → Set
data DVal : DType → Set
-- data Val (τ : Type) : Set
open import Base.Denotation.Environment Type Val public
open import Base.Data.DependentList public
import Base.Denotation.Environment DType DVal as D
-- data Val (τ : Type) where
data Val where
closure : ∀ {Γ} → (t : Fun (Uni • Γ)) → (ρ : ⟦ Γ ⟧Context) → Val Uni
intV : ∀ (n : ℕ) → Val Uni
data DVal where
dclosure : ∀ {Γ} → (dt : DFun (Uni • Γ)) → (ρ : ⟦ Γ ⟧Context) → (dρ : D.⟦ ΔΔ Γ ⟧Context) → DVal DUni
dintV : ∀ (n : ℤ) → DVal DUni
ChΔ : ∀ (Δ : Context) → Set
ChΔ Δ = D.⟦ ΔΔ Δ ⟧Context
-- ⟦_⟧Term : ∀ {Γ τ} → Term Γ τ → ⟦ Γ ⟧Context → ⟦ τ ⟧Type
-- ⟦ var x ⟧Term ρ = ⟦ x ⟧Var ρ
-- ⟦ lett f x t ⟧Term ρ = ⟦ t ⟧Term (⟦ f ⟧Var ρ (⟦ x ⟧Var ρ) • ρ)
-- XXX separate syntax is a bit dangerous. Also, do I want to be so accurate relative to the original model?
data _⊢_↓[_]_ {Γ} (ρ : ⟦ Γ ⟧Context) : Term Γ → ℕ → Val Uni → Set
data _F⊢_↓[_]_ {Γ} (ρ : ⟦ Γ ⟧Context) : Fun Γ → ℕ → Val Uni → Set where
abs : ∀ {t : Fun (Uni • Γ)} →
ρ F⊢ abs t ↓[ 0 ] closure t ρ
term : ∀ {v} n (t : Term Γ) →
ρ ⊢ t ↓[ n ] v →
ρ F⊢ term t ↓[ n ] v
data _⊢_↓[_]_ {Γ} (ρ : ⟦ Γ ⟧Context) where
var : ∀ (x : Var Γ Uni) →
ρ ⊢ var x ↓[ 0 ] (⟦ x ⟧Var ρ)
lett : ∀ n1 n2 {Γ' ρ′ v1 v2 v3} {f x t t'} →
ρ ⊢ var f ↓[ 0 ] closure {Γ'} t' ρ′ →
ρ ⊢ var x ↓[ 0 ] v1 →
(v1 • ρ′) F⊢ t' ↓[ n1 ] v2 →
(v2 • ρ) ⊢ t ↓[ n2 ] v3 →
ρ ⊢ lett f x t ↓[ suc (suc (n1 + n2)) ] v3
-- lit : ∀ n →
-- ρ ⊢ const (lit n) ↓[ 0 ] intV n
-- data _D_⊢_↓[_]_ {Γ} (ρ : ⟦ Γ ⟧Context) (dρ : D.⟦ ΔΔ Γ ⟧Context) : DTerm Γ → ℕ → DVal DUni → Set where
-- dvar : ∀ (x : DC.Var (ΔΔ Γ) DUni) →
-- ρ D dρ ⊢ dvar x ↓[ 0 ] (D.⟦ x ⟧Var dρ)
-- dlett : ∀ n1 n2 n3 n4 {Γ' ρ′ ρ'' dρ' v1 v2 v3 dv1 dv2 dv3} {f x t df dx dt t' dt'} →
-- ρ ⊢ var f ↓[ 0 ] closure {Γ'} t' ρ′ →
-- ρ ⊢ var x ↓[ 0 ] v1 →
-- (v1 • ρ′) F⊢ t' ↓[ n1 ] v2 →
-- (v2 • ρ) ⊢ t ↓[ n2 ] v3 →
-- -- With a valid input ρ' and ρ'' coincide? Varies among plausible validity
-- -- definitions.
-- ρ D dρ ⊢ dvar df ↓[ 0 ] dclosure {Γ'} dt' ρ'' dρ' →
-- ρ D dρ ⊢ dvar dx ↓[ 0 ] dv1 →
-- (v1 • ρ'') D (dv1 • dρ') F⊢ dt' ↓[ n3 ] dv2 →
-- (v2 • ρ) D (dv2 • dρ) ⊢ dt ↓[ n4 ] dv3 →
-- ρ D dρ ⊢ dlett f x t df dx dt ↓[ suc (suc (n1 + n2)) ] dv3
-- Do I need to damn count steps here? No.
data _D_⊢_↓_ {Γ} (ρ : ⟦ Γ ⟧Context) (dρ : ChΔ Γ) : DTerm Γ → DVal DUni → Set
data _D_F⊢_↓_ {Γ} (ρ : ⟦ Γ ⟧Context) (dρ : ChΔ Γ) : DFun Γ → DVal DUni → Set where
dabs : ∀ {dt : DFun (Uni • Γ)} →
ρ D dρ F⊢ dabs dt ↓ dclosure dt ρ dρ
dterm : ∀ {dv} (dt : DTerm Γ) →
ρ D dρ ⊢ dt ↓ dv →
ρ D dρ F⊢ dterm dt ↓ dv
data _D_⊢_↓_ {Γ} (ρ : ⟦ Γ ⟧Context) (dρ : ChΔ Γ) where
dvar : ∀ (x : DC.Var (ΔΔ Γ) DUni) →
ρ D dρ ⊢ dvar x ↓ (D.⟦ x ⟧Var dρ)
dlett : ∀ n1 n2 {Γ' ρ′ ρ'' dρ' v1 v2 v3 dv1 dv2 dv3} {f x t df dx dt t' dt'} →
ρ ⊢ var f ↓[ 0 ] closure {Γ'} t' ρ′ →
ρ ⊢ var x ↓[ 0 ] v1 →
(v1 • ρ′) F⊢ t' ↓[ n1 ] v2 →
(v2 • ρ) ⊢ t ↓[ n2 ] v3 →
-- With a valid input ρ' and ρ'' coincide? Varies among plausible validity
-- definitions.
ρ D dρ ⊢ dvar df ↓ dclosure {Γ'} dt' ρ'' dρ' →
ρ D dρ ⊢ dvar dx ↓ dv1 →
(v1 • ρ'') D (dv1 • dρ') F⊢ dt' ↓ dv2 →
(v2 • ρ) D (dv2 • dρ) ⊢ dt ↓ dv3 →
ρ D dρ ⊢ dlett f x t df dx dt ↓ dv3
open import Data.Nat.Properties
open import Data.Nat.Properties.Simple
open import Relation.Binary hiding (_⇒_)
suc∸ : ∀ m n → n ≤ m → suc (m ∸ n) ≡ suc m ∸ n
suc∸ m zero z≤n = refl
suc∸ (suc m) (suc n) (s≤s n≤m) = suc∸ m n n≤m
suc∸suc : ∀ m n → n < m → suc (m ∸ suc n) ≡ m ∸ n
suc∸suc (suc m) zero (s≤s n<m) = refl
suc∸suc (suc m) (suc n) (s≤s n<m) = suc∸suc m n n<m
lemlt : ∀ j k → suc j < k → k ∸ suc j < k
lemlt j (suc k) (s≤s j<k) = s≤s (∸-mono {k} {k} {j} {0} ≤-refl z≤n)
lemlt′ : ∀ j k → suc j <′ k → k ∸ suc j <′ k
lemlt′ j k j<′k = ≤⇒≤′ (lemlt j k (≤′⇒≤ j<′k))
open import Induction.WellFounded
open import Induction.Nat
rrelT3-Type : ℕ → Set₁
rrelT3-Type n =
∀ {Γ} → (t1 : Fun Γ) (dt : DFun Γ) (t2 : Fun Γ)
(ρ1 : ⟦ Γ ⟧Context) (dρ : ChΔ Γ) (ρ2 : ⟦ Γ ⟧Context) → Set
rrelV3-Type : ℕ → Set₁
rrelV3-Type n = ∀ (v1 : Val Uni) (dv : DVal DUni) (v2 : Val Uni) → Set
rrelTV3-Type : ℕ → Set₁
rrelTV3-Type n = rrelT3-Type n × rrelV3-Type n
-- The type of the function availalbe for recursive calls.
rrelTV3-recSubCallsT : ℕ → Set₁
rrelTV3-recSubCallsT n = (k : ℕ) → k < n → rrelTV3-Type k
mutual
-- Assemble together
rrelTV3-step : ∀ n → rrelTV3-recSubCallsT n → rrelTV3-Type n
rrelTV3-step n rec-rrelTV3 =
let rrelV3-n = rrelV3-step n rec-rrelTV3
in rrelT3-step n rec-rrelTV3 rrelV3-n , rrelV3-n
rrelTV3 = <-rec rrelTV3-Type rrelTV3-step
rrelT3 : ∀ n → rrelT3-Type n
rrelT3 n = proj₁ (rrelTV3 n)
rrelV3 : ∀ n → rrelV3-Type n
rrelV3 n = proj₂ (rrelTV3 n)
s-rrelV3 :
∀ k → rrelTV3-recSubCallsT k → rrelV3-Type k →
∀ j → j < k → rrelV3-Type (k ∸ j)
s-rrelV3 k rec-rrelTV3 rrelV3-k 0 _ = rrelV3-k
s-rrelV3 k rec-rrelTV3 rrelV3-k (suc j) sucj<k = proj₂ (rec-rrelTV3 (k ∸ suc j) (lemlt j k sucj<k))
-- Have the same context for t1, dt and t2? Yeah, good, that's what we want in the end...
-- Though we might want more flexibility till when we have replacement
-- changes.
rrelT3-step : ∀ k → rrelTV3-recSubCallsT k →
rrelV3-Type k →
-- rrelV3-Type n
∀ {Γ} → (t1 : Fun Γ) (dt : DFun Γ) (t2 : Fun Γ)
(ρ1 : ⟦ Γ ⟧Context) (dρ : ChΔ Γ) (ρ2 : ⟦ Γ ⟧Context) → Set
rrelT3-step k rec-rrelTV3 rrelV3-k =
λ t1 dt t2 ρ1 dρ ρ2 →
∀ j (j<k : j < k) n2 →
(v1 v2 : Val Uni) →
(ρ1⊢t1↓[j]v1 : ρ1 F⊢ t1 ↓[ j ] v1) →
(ρ2⊢t2↓[n2]v2 : ρ2 F⊢ t2 ↓[ n2 ] v2) →
Σ[ dv ∈ DVal DUni ] Σ[ dn ∈ ℕ ]
ρ1 D dρ F⊢ dt ↓ dv ×
s-rrelV3 k rec-rrelTV3 rrelV3-k j j<k v1 dv v2
-- where
-- s-rrelV3 : ∀ j → j <′ k → rrelV3-Type (k ∸ j)
-- -- If j = 0, we can't do a recursive call on (k - j) because that's not
-- -- well-founded. Luckily, we don't need to, just use relV as defined at
-- -- the same level.
-- -- Yet, this will be a pain in proofs.
-- s-rrelV3 0 _ = rrelV3-k
-- s-rrelV3 (suc j) sucj<′k = proj₂ (rec-rrelTV3 (k ∸ suc j) (lemlt′ j k sucj<′k))
rrelV3-step : ∀ n → rrelTV3-recSubCallsT n →
-- rrelV3-Type n
∀ (v1 : Val Uni) (dv : DVal DUni) (v2 : Val Uni) → Set
rrelV3-step n rec-rrelTV3 (intV v1) (dintV dv) (intV v2) = dv I.+ (I.+ v1) ≡ (I.+ v2)
rrelV3-step n rec-rrelTV3 (intV v1) (dintV n₁) (closure t ρ) = ⊥
rrelV3-step n rec-rrelTV3 (intV v1) (dclosure dt ρ dρ) c = ⊥
rrelV3-step n rec-rrelTV3 (closure {Γ1} t1 ρ1) (dclosure {ΔΓ} dt ρ' dρ) (closure {Γ2} t2 ρ2) =
-- Require a proof that the two contexts match:
Σ ((Γ1 ≡ Γ2) × (Γ1 ≡ ΔΓ)) λ { (refl , refl) →
∀ (k : ℕ) (k<n : k < n) v1 dv v2 →
proj₂ (rec-rrelTV3 k k<n) v1 dv v2 →
proj₁ (rec-rrelTV3 k k<n)
t1
dt
t2
(v1 • ρ1)
(dv • dρ)
(v2 • ρ2)
}
rrelV3-step n rec-rrelTV3 (closure t ρ) (dclosure dt ρ₁ dρ) (intV n₁) = ⊥
rrelV3-step n rec-rrelTV3 (closure t ρ) (dintV n₁) c = ⊥
open import Postulate.Extensionality
mutual
rrelT3-equiv : ∀ k {Γ} {t1 : Fun Γ} {dt t2 ρ1 dρ ρ2} →
rrelT3 k t1 dt t2 ρ1 dρ ρ2 ≡
∀ j (j<k : j < k) n2 →
∀ (v1 v2 : Val Uni) →
(ρ1⊢t1↓[j]v1 : ρ1 F⊢ t1 ↓[ j ] v1) →
(ρ2⊢t2↓[n2]v2 : ρ2 F⊢ t2 ↓[ n2 ] v2) →
Σ[ dv ∈ DVal DUni ] Σ[ dn ∈ ℕ ]
ρ1 D dρ F⊢ dt ↓ dv ×
rrelV3 j v1 dv v2
rrelT3-equiv k {Γ} {t1} {dt} {t2} {ρ1} {dρ} {ρ2} =
cong (λ □ → ∀ j → □ j) (ext
λ {
zero -> cong {lsuc lzero} {lsuc lzero} {{!!}} {{!!}} {!!} {{!!}} {{! !}} {!cong!}
-- cong {{!!}} {{!!}}
-- (λ (□ : zero < k → ∀ (n2 : ℕ) (v1 v2 : Val Uni) (ρ1⊢t1↓[j]v1 : ρ1 F⊢ t1 ↓[ zero ] v1) → {!(ρ2⊢t2↓[n2]v2 : ρ2 F⊢ t2 ↓[ n2 ] v2) → ? !})→
-- ∀ (j<k : zero < k) n2 →
-- (v1 v2 : Val Uni) →
-- (ρ1⊢t1↓[j]v1 : ρ1 F⊢ t1 ↓[ zero ] v1) →
-- (ρ2⊢t2↓[n2]v2 : ρ2 F⊢ t2 ↓[ n2 ] v2) →
-- Σ-syntax (DVal DUni)
-- λ dv → Σ-syntax ℕ λ dn → (ρ1 D dρ F⊢ dt ↓ dv) × □ j<k n2 v1 v2 ρ1⊢t1↓[j]v1 ρ2⊢t2↓[n2]v2)
-- {!!}
;
(suc j') -> {!!}})
-- cong (λ □ →
-- (j : ℕ) (j<k : j < k) (n2 : ℕ)
-- (v1 v2 : Val Uni) →
-- (ρ1⊢t1↓[j]v1 : ρ1 F⊢ t1 ↓[ j ] v1) →
-- -- (ρ2⊢t2↓[n2]v2 : ρ2 F⊢ t2 ↓[ n2 ] v2) →
-- □ j j<k n2 v1 v2 ρ1⊢t1↓[j]v1
-- -- □ j<k n2 v1 v2 ρ1⊢t1↓[j]v1 ρ2⊢t2↓[n2]v2
-- ) (ext³ λ j j<k n2 → {!ext³!})
rrelV3-equiv : ∀ n {Γ1 Γ2 ΔΓ t1 dt t2 ρ1 ρ' dρ ρ2} →
rrelV3 n (closure {Γ1} t1 ρ1) (dclosure {ΔΓ} dt ρ' dρ) (closure {Γ2} t2 ρ2) ≡ Σ ((Γ1 ≡ Γ2) × (Γ1 ≡ ΔΓ)) λ { (refl , refl) →
∀ (k : ℕ) (k<n : k <′ n) v1 dv v2 →
rrelV3 k v1 dv v2 →
rrelT3 k
t1
dt
t2
(v1 • ρ1)
(dv • dρ)
(v2 • ρ2)
}
rrelV3-equiv n = cong (λ □ → Σ (_ ≡ _ × _ ≡ _) □) (ext (λ { (eq1 , eq2) →
cong
(λ □ →
(λ { (refl , refl)
→ ∀ (k : ℕ) (k<n : k <′ n) v1 dv v2 → □ k k<n v1 dv v2
})
eq1 eq2)
(ext (λ x → ext {!!}))}))
--
-- cong (λ □ → ∀ k → (k<n : k <′ n) → □ k k<n)
-- rrelV3-equiv k
rrelρ3 : ℕ → ∀ Γ (ρ1 : ⟦ Γ ⟧Context) (dρ : ChΔ Γ) (ρ2 : ⟦ Γ ⟧Context) → Set
rrelρ3 n ∅ ∅ ∅ ∅ = ⊤
rrelρ3 n (Uni • Γ) (v1 • ρ1) (dv • dρ) (v2 • ρ2) = rrelV3 n v1 dv v2 × rrelρ3 n Γ ρ1 dρ ρ2
--
rfundamental3 : ∀ {Γ} (t : Fun Γ) → ∀ k ρ1 dρ ρ2 → (ρρ : rrelρ3 k Γ ρ1 dρ ρ2) → rrelT3 k t (derive-dfun t) t ρ1 dρ ρ2
rfundamental3 (term x) k ρ1 dρ ρ2 ρρ j j<k n2 v1 v2 ρ1⊢t1↓[j]v1 ρ2⊢t2↓[n2]v2 = {!!}
rfundamental3 {Γ} (abs t) k ρ1 dρ ρ2 ρρ .0 j<k .0 (closure .t .ρ1) (closure .t .ρ2) abs abs = dclosure (derive-dfun t) ρ1 dρ , 0 , dabs , (refl , refl) , {!body !}
where
body1 : ∀ k₁ (k₁<k : k₁ <′ k) → (v1 : Val Uni) (dv : DVal DUni) (v2 : Val Uni) → rrelV3 k₁ v1 dv v2 → rrelT3 k₁ t (derive-dfun t) t (v1 • ρ1) (dv • dρ) (v2 • ρ2)
body1 = λ k₁ k₁<k v1 dv v2 x v3 v4 j n2 j<k₁ ρ1⊢t1↓[j]v1 ρ2⊢t2↓[n2]v2 → {!
rfundamental3 {Uni • Γ} t k₁ (v1 • ρ1) (dv • dρ) (v2 • ρ2) ({!vv!} , {!ρρ!}) v3 v4 0 n2 {!j<k₁ !} {! ρ1⊢t1↓[j]v1 !} ρ2⊢t2↓[n2]v2
!}
-- λ
-- { k₁ k<n v1 dv v2 vv v3 v4 0 n2 j<k₁ ρ1⊢t1↓[j]v1 ρ2⊢t2↓[n2]v2 → {!
-- rfundamental3 {Uni • Γ} t k₁ (v1 • ρ1) (dv • dρ) (v2 • ρ2) ({!vv!} , {!ρρ!}) v3 v4 0 n2 {!j<k₁ !} {! ρ1⊢t1↓[j]v1 !} ρ2⊢t2↓[n2]v2
-- !}
-- -- (Some.wfRec-builder rrelTV3-Type rrelTV3-step k₁
-- -- (<-well-founded′ k k₁ k<n))
-- -- All.wfRec-builder <-well-founded _ rrelTV3-Type rrelTV3-step k k₁ k<n : rrelTV3-Type k₁
-- --
-- ; k₁ k<n v1 dv v2 vv v3 v4 (suc j) n2 j<k₁ ρ1⊢t1↓[j]v1 ρ2⊢t2↓[n2]v2 → {!
-- !}
-- -- rfundamental3 t k₁ (v1 • ρ1) (dv • dρ) (v2 • ρ2) ({!vv!} , {!ρρ!}) v3 v4 {!suc j !} n2 {!j<k₁ !} {! ρ1⊢t1↓[j]v1 !} ρ2⊢t2↓[n2]v2
-- }
-- -- ∀ k → rrelTV3-recSubCallsT k → rrelV3-Type k →
-- -- ∀ j → j <′ k → rrelV3-Type (k ∸ j)
-- foo : s-rrelV3 k
-- (All.wfRec-builder <-well-founded _ rrelTV3-Type rrelTV3-step k)
-- (rrelV3-step k (All.wfRec-builder <-well-founded _ rrelTV3-Type rrelTV3-step k))
-- j j<k v1 (dclosure (derive-dfun t) ρ1 dρ) v2
-- foo with j
-- ... | s = {!!}
|
ga_ref_impl/src/metric.adb | rogermc2/GA_Ada | 3 | 13473 | <filename>ga_ref_impl/src/metric.adb<gh_stars>1-10
with Ada.Text_IO; use Ada.Text_IO;
package body Metric is
C3_M : constant GA_Maths.Float_Matrix (1 .. 5, 1 .. 5) :=
((0.0, 0.0, 0.0, 0.0, -1.0),
(0.0, 1.0, 0.0, 0.0, 0.0),
(0.0, 0.0, 1.0, 0.0, 0.0),
(0.0, 0.0, 0.0, 1.0, 0.0),
(-1.0, 0.0, 0.0, 0.0, 0.0));
E3_M : constant GA_Maths.Float_Matrix (1 .. 3, 1 .. 3) :=
((1.0, 0.0, 0.0),
(0.0, 1.0, 0.0),
(0.0, 0.0, 1.0));
Metric_C3 : Metric_Record (C3_M'Length(1));
Metric_E3 : Metric_Record (E3_M'Length(1));
-- --------------------------------------------------------------------
function C3_Eigen_Matrix return Metric_Matrix is
begin
return Metric_C3.Matrix;
end C3_Eigen_Matrix;
-- --------------------------------------------------------------------
function C3_Inv_Eigen_Matrix return Metric_Matrix is
begin
return Metric_C3.Inv_Eigen_Matrix;
end C3_Inv_Eigen_Matrix;
-- --------------------------------------------------------------------
function E3_Eigen_Matrix return Metric_Matrix is
begin
return Metric_E3.Matrix;
end E3_Eigen_Matrix;
-- --------------------------------------------------------------------
function E3_Inv_Eigen_Matrix return Metric_Matrix is
begin
return Metric_E3.Inv_Eigen_Matrix;
end E3_Inv_Eigen_Matrix;
-- --------------------------------------------------------------------
function Eigen_Values (Met : Metric_Record) return Real_Vector is
begin
return Met.Eigen_Values;
end Eigen_Values;
-- --------------------------------------------------------------------
function Eigen_Vectors (Met : Metric_Record) return Metric_Matrix is
begin
return Met.Eigen_Vectors;
end Eigen_Vectors;
-- --------------------------------------------------------------------
function Inv_Eigen_Matrix (Met : Metric_Record) return Metric_Matrix is
begin
return Met.Inv_Eigen_Matrix;
end Inv_Eigen_Matrix;
-- --------------------------------------------------------------------
function Is_Anti_Euclidean (Met : Metric_Record) return Boolean is
begin
return Met.Anti_Euclidean;
end Is_Anti_Euclidean;
-- --------------------------------------------------------------------
function Is_Diagonal (Met : Metric_Record) return Boolean is
begin
return Met.Diagonal;
end Is_Diagonal;
-- --------------------------------------------------------------------
function Is_Euclidean (Met : Metric_Record) return Boolean is
begin
return Met.Euclidean;
end Is_Euclidean;
-- --------------------------------------------------------------------
function Matrix (Met : Metric_Record) return Metric_Matrix is
begin
return Met.Matrix;
end Matrix;
-- --------------------------------------------------------------------
function C3_Metric return Metric_Record is
begin
return Metric_C3;
end C3_Metric;
-- --------------------------------------------------------------------
function E3_Metric return Metric_Record is
begin
return Metric_E3;
end E3_Metric;
-- --------------------------------------------------------------------
function New_Metric (Dimension : Integer) return Metric_Matrix is
theMetric : constant Metric_Matrix (1 .. Dimension, 1 .. Dimension) :=
(others => (others => 0.0));
begin
return theMetric;
end New_Metric;
-- ------------------------------------------------------------------------
function New_Metric (Dimension : Integer; Data : Metric_Data)
return Metric_Matrix is
theMetric : Metric_Matrix (1 .. Dimension, 1 .. Dimension) :=
(others => (others => 0.0));
begin
for Index in 1 .. Dimension loop
theMetric (Index, Index) := Data (Index);
end loop;
return theMetric;
end New_Metric;
-- ------------------------------------------------------------------------
function New_Metric (Met : Metric_Matrix) return Metric_Record is
use GA_Maths;
Values : Real_Vector (Met'Range); -- m_eigenMetric
Vectors : Float_Matrix (Met'Range, Met'Range);
aVector : Real_Vector (Met'Range);
State : Metric_Record (Met'Length (1));
begin
if not Is_Symetric (Met) then
raise Metric_Exception with
"Metric.New_Metric cannot process non-symmetric matrices.";
else
Eigensystem (Real_Matrix (Met), Values, Vectors); -- m_eig
State.Eigen_Values := Values;
-- Columns of Eigen_Vectors are the eigenvectors
State.Inv_Eigen_Matrix := Metric_Matrix (Vectors);
State.Eigen_Vectors := Metric_Matrix (Transpose (Vectors));
For col in 1 .. State.Eigen_Vectors'Length(2) loop
For row in 1 .. State.Eigen_Vectors'Length(1) loop
aVector(row) := State.Eigen_Vectors (row, col);
end loop;
aVector := aVector / abs(aVector);
For row in 1 .. State.Eigen_Vectors'Length(1) loop
State.Eigen_Vectors (row, col) := aVector(row);
end loop;
end loop;
State.Matrix := Met;
State.Diagonal := Is_Diagonal (Met);
if not State.Diagonal then
State.Euclidean := False;
State.Anti_Euclidean := False;
else
State.Euclidean := True;
State.Anti_Euclidean := True;
For col in Met'Range (2) loop
if Met (col, col) /= 1.0 then
State.Euclidean := False;
end if;
if Met (col, col) /= -1.0 then
State.Anti_Euclidean := False;
end if;
end loop;
end if;
end if;
return State;
exception
when others =>
Put_Line ("An exception occurred in Metric.New_Metric 4");
raise;
end New_Metric;
begin
Metric_C3 := New_Metric (C3_M);
Metric_E3 := New_Metric (E3_M);
end Metric;
|
Borland/CBuilder5/Source/RTL/source/math/ctrl87.asm | TrevorDArcyEvans/DivingMagpieSoftware | 1 | 10747 | ;[]-----------------------------------------------------------------[]
;| CTRL87.ASM -- access floating-point control word |
;[]-----------------------------------------------------------------[]
;
; C/C++ Run Time Library - Version 10.0
;
; Copyright (c) 1991, 2000 by Inprise Corporation
; All Rights Reserved.
;
; $Revision: 9.2 $
include RULES.ASI
; Segments Definitions
Header@
;----------------------------------------------------------------------
; External variables
Data_Seg@
ExtSym@ _default87, dword, cdecl ; default x87 control word
Data_EndS@
;---------------------------------------------------------------------
;
;Name _control87 - access floating-point control word
;
;Usage unsigned int _control87(unsigned int new, unsigned int mask);
;
;Prototype in float.h
;
;Description This function is used to retrieve or change the floating-
; point control word.
;
; For every bit that is on in mask, the corresponding bit
; in the floating-point control word is set to the value
; of that bit in new.
;
;Return value The new floating-point control word value is returned.
;
;Notes:
;The Denormal exception is always trapped on the 8087 and 80287, but
;never on the 80387. The emulator never generates it.
;
;The Invalid exception is always trapped, as FPU stack overflows and
;underflows can sometimes be repaired transparently, but sometimes
;also cause nonrecoverable fatal errors.
;
;Caution:
;The control word should not be changed directly, unless you wish
;to bypass the RTL trap handling.
;
;It is dangerous to unmask an exception unless the status bit is already
;clear. To be safe, call _clear87() first.
;
;---------------------------------------------------------------------
Code_seg@
Func@ _control87, _EXPFUNC, _RTLENTRY, <int new>, <int cwmask>
Locals@ <int Control>
Link@
fstcw Control ; get current control word
mov eax, new ; get new value of CW
mov ecx, cwmask ; get mask
jecxz skip_clobber ; don't clobber default87 if
; not modifying the cw.
mov _default87@, eax ; update the RTLs default so that
; fpreset uses this new CW
skip_clobber:
and eax, ecx ; apply mask to new value
not ecx ; invert the mask
fwait
movzx edx, word ptr Control ; get the current CW (zero high word)
and edx, ecx ; clear bits that were 1 in mask
or eax, edx ; insert bits from new value
mov Control, ax ; save low word in memory
fldcw Control ; then load it into the x87
Unlink@
Return@
EndFunc@ _control87
Code_EndS@
end
|
com/netfx/src/clr/vbhelper/vbhelper.asm | npocmaka/Windows-Server-2003 | 17 | 15014 | ; ==++==
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
; ==--==
.namespace System
.class VBHelper
######################################################################
#This method will take in a RefAny and return a Variant...
.staticmethod value class System.Variant TypedByRefToVariant(refany)
.localsSig(value class System.Variant)
ldloca 0x0
ldarga 0x1
call void System.Variant::TypedByRefToVariant(value class System.Variant&, int32)
ldloc 0x0
ret
.endmethod
######################################################################
# old style version. Remove after 7/30/99
.staticmethod void TypedByRefToVariant(value class System.Variant&, refany)
ldarg 0x0
ldarga 0x1
call void System.Variant::TypedByRefToVariant(value class System.Variant&, int32)
ret
.endmethod
######################################################################
.staticmethod void VariantToTypedByRef(refany, value class System.Variant)
ldarga 0x0
ldarga 0x1
ldobj System.Variant
call void System.Variant::VariantToTypedByRef(int32,value class System.Variant)
ret
.endmethod
.end
|
FormalAnalyzer/models/apps/AEONPowerStripBinder.als | Mohannadcse/IoTCOM_BehavioralRuleExtractor | 0 | 3401 | <filename>FormalAnalyzer/models/apps/AEONPowerStripBinder.als
module app_AEONPowerStripBinder
open IoTBottomUp as base
open cap_runIn
open cap_now
open cap_switch
open cap_switch
open cap_switch
open cap_switch
open cap_switch
one sig app_AEONPowerStripBinder extends IoTApp {
strip : one cap_switch,
switch1 : one cap_switch,
switch2 : one cap_switch,
switch3 : one cap_switch,
switch4 : one cap_switch,
} {
rules = r
//capabilities = strip + switch1 + switch2 + switch3 + switch4
}
abstract sig r extends Rule {}
one sig r0 extends r {}{
triggers = r0_trig
conditions = r0_cond
commands = r0_comm
}
abstract sig r0_trig extends Trigger {}
one sig r0_trig0 extends r0_trig {} {
capabilities = app_AEONPowerStripBinder.switch4
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
abstract sig r0_cond extends Condition {}
abstract sig r0_comm extends Command {}
one sig r0_comm0 extends r0_comm {} {
capability = app_AEONPowerStripBinder.strip
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r1 extends r {}{
triggers = r1_trig
conditions = r1_cond
commands = r1_comm
}
abstract sig r1_trig extends Trigger {}
one sig r1_trig0 extends r1_trig {} {
capabilities = app_AEONPowerStripBinder.switch1
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
abstract sig r1_cond extends Condition {}
abstract sig r1_comm extends Command {}
one sig r1_comm0 extends r1_comm {} {
capability = app_AEONPowerStripBinder.strip
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r2 extends r {}{
triggers = r2_trig
conditions = r2_cond
commands = r2_comm
}
abstract sig r2_trig extends Trigger {}
one sig r2_trig0 extends r2_trig {} {
capabilities = app_AEONPowerStripBinder.switch3
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
abstract sig r2_cond extends Condition {}
abstract sig r2_comm extends Command {}
one sig r2_comm0 extends r2_comm {} {
capability = app_AEONPowerStripBinder.strip
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
one sig r3 extends r {}{
triggers = r3_trig
conditions = r3_cond
commands = r3_comm
}
abstract sig r3_trig extends Trigger {}
one sig r3_trig0 extends r3_trig {} {
capabilities = app_AEONPowerStripBinder.switch2
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
abstract sig r3_cond extends Condition {}
abstract sig r3_comm extends Command {}
one sig r3_comm0 extends r3_comm {} {
capability = app_AEONPowerStripBinder.strip
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
one sig r4 extends r {}{
triggers = r4_trig
conditions = r4_cond
commands = r4_comm
}
abstract sig r4_trig extends Trigger {}
one sig r4_trig0 extends r4_trig {} {
capabilities = app_AEONPowerStripBinder.switch3
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
abstract sig r4_cond extends Condition {}
abstract sig r4_comm extends Command {}
one sig r4_comm0 extends r4_comm {} {
capability = app_AEONPowerStripBinder.strip
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r5 extends r {}{
triggers = r5_trig
conditions = r5_cond
commands = r5_comm
}
abstract sig r5_trig extends Trigger {}
one sig r5_trig0 extends r5_trig {} {
capabilities = app_AEONPowerStripBinder.switch4
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
abstract sig r5_cond extends Condition {}
abstract sig r5_comm extends Command {}
one sig r5_comm0 extends r5_comm {} {
capability = app_AEONPowerStripBinder.strip
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
one sig r6 extends r {}{
triggers = r6_trig
conditions = r6_cond
commands = r6_comm
}
abstract sig r6_trig extends Trigger {}
one sig r6_trig0 extends r6_trig {} {
capabilities = app_AEONPowerStripBinder.switch2
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
abstract sig r6_cond extends Condition {}
abstract sig r6_comm extends Command {}
one sig r6_comm0 extends r6_comm {} {
capability = app_AEONPowerStripBinder.strip
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_off
}
one sig r7 extends r {}{
triggers = r7_trig
conditions = r7_cond
commands = r7_comm
}
abstract sig r7_trig extends Trigger {}
one sig r7_trig0 extends r7_trig {} {
capabilities = app_AEONPowerStripBinder.switch1
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
abstract sig r7_cond extends Condition {}
abstract sig r7_comm extends Command {}
one sig r7_comm0 extends r7_comm {} {
capability = app_AEONPowerStripBinder.strip
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
|
third_party/antlr_grammars_v4/edif300/EDIF300.g4 | mikhan808/rsyntaxtextarea-antlr4-extension | 4 | 3139 | <reponame>mikhan808/rsyntaxtextarea-antlr4-extension
/*
* [The "BSD license"]
*
* Copyright (c) 2014-2017 THALES GLOBAL SERVICES. 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.
*/
grammar EDIF300;
goal : edif;
absolute : '(absolute'
integerExpression
')';
acLoad : '(acLoad'
capacitanceValue
')';
acLoadDisplay : '(acLoadDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
acLoadFactorCapacitance : capacitanceValue;
acLoadFactorTime : timeValue;
addDisplay : '(addDisplay'
( display )*
')';
ampere : '(ampere'
unitExponent
')';
and_ : '(and'
( booleanExpression )*
')';
angleValue : numberValue;
annotate : '(annotate'
stringValue
( display )*
')';
approvedDate : '(approvedDate'
date
')';
approvedDateDisplay : '(approvedDateDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
arc : '(arc'
startPoint
throughPoint
endPoint
')';
ascii : '(ascii'
')';
associatedInterconnectNameDisplay : '(associatedInterconnectNameDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
attachmentPoint : pointValue;
author : '(author'
stringToken
')';
backgroundColor : '(backgroundColor'
color
')';
baselineJustify : '(baselineJustify'
')';
becomes : '(becomes'
( logicNameRef | logicList | logicOneOf )
')';
behaviorView : '(behaviorView'
viewNameDef
( comment | nameInformation | userData
)*
')';
bidirectional : '(bidirectional'
')';
bidirectionalPort : '(bidirectionalPort'
( bidirectionalPortAttributes )?
')';
bidirectionalPortAttributes : '(bidirectionalPortAttributes'
( dcFanInLoad | dcFanOutLoad | dcMaxFanIn | dcMaxFanOut )*
')';
bitOrder : '(bitOrder'
( lsbToMsb | msbToLsb )
')';
blue : scaledInteger;
boldStyle : '(boldStyle'
')';
eboolean : '(boolean'
booleanExpression
')';
booleanConstant : '(booleanConstant'
constantNameDef
booleanToken
')';
booleanConstantRef : '(booleanConstantRef'
constantNameRef
')';
booleanExpression : ( and_ | booleanParameterRef | booleanToken | stringEqual | integerEqual | lessThan | lessThanOrEqual | not_ | or_ | xor_ | booleanConstantRef )
;
booleanMap : '(booleanMap'
booleanValue
')';
booleanParameter : '(booleanParameter'
parameterNameDef
( eboolean | nameInformation )*
')';
booleanParameterAssign : '(booleanParameterAssign'
parameterNameRef
booleanExpression
')';
booleanParameterRef : '(booleanParameterRef'
parameterNameRef
')';
booleanToken : ( efalse | etrue );
booleanValue : booleanToken;
borderPattern : '(borderPattern'
pixelPattern
')';
borderPatternVisible : '(borderPatternVisible'
booleanValue
')';
borderWidth : '(borderWidth'
( lengthValue | minimalWidth )
')';
bottomJustify : '(bottomJustify'
')';
calculated : '(calculated'
')';
candela : '(candela'
unitExponent
')';
capacitanceValue : miNoMaxValue;
caplineJustify : '(caplineJustify'
')';
cell : '(cell'
libraryObjectNameDef
cellHeader
( cluster | comment | userData | viewGroup )*
')';
cellHeader : '(cellHeader'
( documentation | nameInformation | property | status )*
')';
cellNameDisplay : '(cellNameDisplay'
( display | displayNameOverride )*
')';
cellPropertyDisplay : '(cellPropertyDisplay'
propertyNameRef
( display | propertyNameDisplay )*
')';
cellPropertyDisplayOverride : '(cellPropertyDisplayOverride'
propertyNameRef
( addDisplay | replaceDisplay | removeDisplay )
( propertyNameDisplay )?
')';
cellPropertyOverride : '(cellPropertyOverride'
propertyNameRef
( typedValue | untyped )
( comment | fixed | propertyOverride )*
')';
cellRef : '(cellRef'
libraryObjectNameRef
( libraryRef )?
')';
celsius : '(celsius'
unitExponent
')';
centerJustify : '(centerJustify'
')';
characterEncoding : '(characterEncoding'
( ascii | iso8859 | jisx0201 | jisx0208 )
')';
checkDate : '(checkDate'
date
')';
checkDateDisplay : '(checkDateDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
circle : '(circle'
pt1
pt2
')';
cluster : '(cluster'
clusterNameDef
einterface
clusterHeader
( schematicSymbol | schematicView | behaviorView | clusterConfiguration | comment | connectivityView | defaultClusterConfiguration | userData | logicModelView | maskLayoutView | pcbLayoutView | symbolicLayoutView )*
')';
clusterConfiguration : '(clusterConfiguration'
clusterConfigurationNameDef
( viewRef | leaf | unconfigured )
( comment | frameConfiguration | globalPortScope | nameInformation | instanceConfiguration | property | userData )*
')';
clusterConfigurationNameCaseSensitive : '(clusterConfigurationNameCaseSensitive'
booleanToken
')';
clusterConfigurationNameDef : nameDef;
clusterConfigurationNameRef : nameRef;
clusterConfigurationRef : '(clusterConfigurationRef'
clusterConfigurationNameRef
')';
clusterHeader : '(clusterHeader'
( documentation | nameInformation | property | status )*
')';
clusterNameCaseSensitive : '(clusterNameCaseSensitive'
booleanToken
')';
clusterNameDef : nameDef;
clusterNameRef : nameRef;
clusterPropertyDisplay : '(clusterPropertyDisplay'
propertyNameRef
( display | propertyNameDisplay )*
')';
clusterPropertyDisplayOverride : '(clusterPropertyDisplayOverride'
propertyNameRef
( addDisplay | replaceDisplay | removeDisplay )
( propertyNameDisplay )?
')';
clusterPropertyOverride : '(clusterPropertyOverride'
propertyNameRef
( typedValue | untyped )
( comment | fixed | propertyOverride )*
')';
clusterRef : '(clusterRef'
clusterNameRef
( cellRef )?
')';
color : '(color'
red
green
blue
')';
comment : '(comment'
( stringToken )*
')';
commentGraphics : '(commentGraphics'
( annotate | comment | figure | originalBoundingBox | propertyDisplay | userData )*
')';
companyName : '(companyName'
stringToken
')';
companyNameDisplay : '(companyNameDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
complementedName : '(complementedName'
( complementedNamePart | nameDimension | namePartSeparator | simpleName )*
')';
complementedNamePart : '(complementedNamePart'
( complementedNamePart | namePartSeparator | simpleName )*
')';
complexGeometry : '(complexGeometry'
geometryMacroRef
transform
')';
complexName : '(complexName'
( complementedNamePart | nameDimension | namePartSeparator | simpleName )*
')';
compound : '(compound'
( logicNameRef )*
')';
condition : '(condition'
booleanExpression
')';
conditionDisplay : '(conditionDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
connectedSignalIndexGenerator : '(connectedSignalIndexGenerator'
integerExpression
')';
connectedSignalIndexGeneratorDisplay : '(connectedSignalIndexGeneratorDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
connectivityBus : '(connectivityBus'
interconnectNameDef
signalGroupRef
interconnectHeader
connectivityBusJoined
( comment | connectivityBusSlice | connectivitySubBus | userData )*
')';
connectivityBusJoined : '(connectivityBusJoined'
portJoined
( connectivityRipperRef )*
')';
connectivityBusSlice : '(connectivityBusSlice'
interconnectNameDef
signalGroupRef
interconnectHeader
connectivityBusJoined
( comment | connectivityBusSlice | connectivitySubBus | userData )*
')';
connectivityFrameStructure : '(connectivityFrameStructure'
connectivityFrameStructureNameDef
frameRef
( comment | connectivityBus | connectivityFrameStructure | connectivityNet | connectivityRipper | timing | userData )*
')';
connectivityFrameStructureNameDef : nameDef;
connectivityNet : '(connectivityNet'
interconnectNameDef
signalRef
interconnectHeader
connectivityNetJoined
( comment | connectivitySubNet | userData )*
')';
connectivityNetJoined : '(connectivityNetJoined'
( portJoined | joinedAsSignal )
( connectivityRipperRef )*
')';
connectivityRipper : '(connectivityRipper'
connectivityRipperNameDef
')';
connectivityRipperNameDef : nameDef;
connectivityRipperNameRef : nameRef;
connectivityRipperRef : '(connectivityRipperRef'
connectivityRipperNameRef
')';
connectivityStructure : '(connectivityStructure'
( comment | connectivityBus | connectivityFrameStructure | connectivityNet | connectivityRipper | localPortGroup | timing | userData )*
')';
connectivitySubBus : '(connectivitySubBus'
interconnectNameDef
interconnectHeader
connectivityBusJoined
( comment | connectivityBusSlice | connectivitySubBus | userData )*
')';
connectivitySubNet : '(connectivitySubNet'
interconnectNameDef
interconnectHeader
connectivityNetJoined
( comment | connectivitySubNet | userData )*
')';
connectivityTagGenerator : '(connectivityTagGenerator'
stringExpression
')';
connectivityTagGeneratorDisplay : '(connectivityTagGeneratorDisplay'
( display )*
')';
connectivityUnits : '(connectivityUnits'
( setCapacitance | setTime )?
')';
connectivityView : '(connectivityView'
viewNameDef
connectivityViewHeader
logicalConnectivity
connectivityStructure
( comment | userData )*
')';
connectivityViewHeader : '(connectivityViewHeader'
connectivityUnits
( derivedFrom | documentation | nameInformation | previousVersion | property | status )*
')';
constantNameDef : nameDef;
constantNameRef : nameRef;
constantValues : '(constantValues'
( booleanConstant | integerConstant | stringConstant )*
')';
contract : '(contract'
stringToken
')';
contractDisplay : '(contractDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
copyright : '(copyright'
year
( stringToken )*
')';
copyrightDisplay : '(copyrightDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
cornerType : '(cornerType'
( truncate | round | extend )
')';
coulomb : '(coulomb'
unitExponent
')';
criticality : '(criticality'
integerValue
')';
criticalityDisplay : '(criticalityDisplay'
( display )*
')';
currentMap : '(currentMap'
currentValue
')';
currentValue : miNoMaxValue;
curve : '(curve'
( arc | pointValue )*
')';
dataOrigin : '(dataOrigin'
stringToken
( version )?
')';
date : '(date'
yearNumber
monthNumber
dayNumber
')';
dayNumber : integerToken;
dcFanInLoad : '(dcFanInLoad'
numberValue
')';
dcFanInLoadDisplay : '(dcFanInLoadDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
dcFanOutLoad : '(dcFanOutLoad'
numberValue
')';
dcFanOutLoadDisplay : '(dcFanOutLoadDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
dcMaxFanIn : '(dcMaxFanIn'
numberValue
')';
dcMaxFanInDisplay : '(dcMaxFanInDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
dcMaxFanOut : '(dcMaxFanOut'
numberValue
')';
dcMaxFanOutDisplay : '(dcMaxFanOutDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
decimalToString : '(decimalToString'
integerExpression
( minimumStringLength )?
')';
defaultClusterConfiguration : '(defaultClusterConfiguration'
clusterConfigurationNameRef
')';
defaultConnection : '(defaultConnection'
globalPortRef
')';
degree : '(degree'
unitExponent
')';
delay : '(delay'
timeDelay
')';
denominator : integerValue;
derivation : ( calculated | measured | required );
derivedFrom : '(derivedFrom'
viewRef
( reason )?
')';
design : '(design'
designNameDef
cellRef
designHeader
( comment | designHierarchy | userData )*
')';
designator : '(designator'
stringValue
')';
designatorDisplay : '(designatorDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
designHeader : '(designHeader'
designUnits
( documentation | nameInformation | property | status )*
')';
designHierarchy : '(designHierarchy'
designHierarchyNameDef
clusterRef
clusterConfigurationRef
designHierarchyHeader
( occurrenceHierarchyAnnotate )?
')';
designHierarchyHeader : '(designHierarchyHeader'
( booleanParameterAssign | integerParameterAssign | nameInformation | numberParameterAssign | property | stringParameterAssign )*
')';
designHierarchyNameCaseSensitive : '(designHierarchyNameCaseSensitive'
booleanToken
')';
designHierarchyNameDef : nameDef;
designNameCaseSensitive : '(designNameCaseSensitive'
booleanToken
')';
designNameDef : nameDef;
designUnits : '(designUnits'
( setCapacitance | setTime )*
')';
diagram : '(diagram'
diagramNameDef
( annotate | comment | figure | userData )*
')';
diagramNameDef : nameDef;
directionalPortAttributeOverride : '(directionalPortAttributeOverride'
( inputPortAttributes | outputPortAttributes | bidirectionalPortAttributes )
')';
display : '(display'
( figureGroupNameRef | figureGroupOverride )*
transform
')';
displayAttributes : '(displayAttributes'
( borderPattern | borderPatternVisible | borderWidth | color | fillPattern | fillPatternVisible | fontRef | horizontalJustification | textHeight | verticalJustification | visible )*
')';
displayName : '(displayName'
stringToken
')';
displayNameOverride : '(displayNameOverride'
stringToken
( addDisplay | replaceDisplay | removeDisplay )
')';
distanceValue : integerValue;
dividend : integerExpression;
divisor : integerExpression;
documentation : '(documentation'
documentationNameDef
documentationHeader
( section )*
')';
documentationHeader : '(documentationHeader'
documentationUnits
( backgroundColor | nameInformation | status )*
')';
documentationNameCaseSensitive : '(documentationNameCaseSensitive'
booleanToken
')';
documentationNameDef : nameDef;
documentationUnits : '(documentationUnits'
( setAngle | setDistance )*
')';
dominates : '(dominates'
( logicNameRef )*
')';
dot : '(dot'
pointValue
')';
drawingDescription : '(drawingDescription'
stringToken
')';
drawingDescriptionDisplay : '(drawingDescriptionDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
drawingIdentification : '(drawingIdentification'
stringToken
')';
drawingIdentificationDisplay : '(drawingIdentificationDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
drawingSize : '(drawingSize'
stringToken
')';
drawingSizeDisplay : '(drawingSizeDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
duration : '(duration'
timeValue
')';
e : '(e'
mantissa
exponent
')';
edif : '(edif'
edifNameDef
edifVersion
edifHeader
( library | design | comment | external | userData )*
')';
edifHeader : '(edifHeader'
edifLevel
keywordMap
unitDefinitions
fontDefinitions
physicalDefaults
( characterEncoding | constantValues | documentation | globalPortDefinitions | nameCaseSensitivity | nameInformation | physicalScaling | property | status )*
')';
edifLevel : '(edifLevel'
edifLevelValue
')';
edifLevelValue : integerToken;
edifNameDef : nameDef;
edifVersion : '(edifVersion'
mark
issue
subIssue
')';
endPoint : pointValue;
endType : '(endType'
( truncate | round | extend )
')';
engineeringDate : '(engineeringDate'
date
')';
engineeringDateDisplay : '(engineeringDateDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
event : '(event'
( portRef | portList | portSet | interconnectRef | interconnectSet )
( becomes | transition )*
')';
exponent : integerToken;
extend : '(extend'
')';
extendForFrameMemberDef : forFrameMemberRef;
extendFrameDef : frameNameRef;
extendInstanceDef : instanceNameRef;
extendInstanceMemberDef : instanceMemberRef;
extendInterconnectDef : interconnectNameRef;
extendPageDef : pageNameRef;
extendPortDef : portNameRef;
extendPortMemberDef : portMemberRef;
extendSignalDef : signalNameRef;
extendSignalGroupDef : signalGroupNameRef;
extendSignalMemberDef : signalMemberRef;
external : '(external'
libraryNameDef
libraryHeader
( cell | comment | geometryMacro | pageBorderTemplate | pageTitleBlockTemplate | schematicFigureMacro | schematicForFrameBorderTemplate | schematicGlobalPortTemplate | schematicIfFrameBorderTemplate | schematicInterconnectTerminatorTemplate | schematicJunctionTemplate | schematicMasterPortTemplate | schematicOffPageConnectorTemplate | schematicOnPageConnectorTemplate | schematicOtherwiseFrameBorderTemplate | schematicRipperTemplate | schematicSymbolBorderTemplate | schematicSymbolPortTemplate | userData )*
')';
fahrenheit : '(fahrenheit'
unitExponent
')';
efalse : '(false'
')';
farad : '(farad'
unitExponent
')';
figure : '(figure'
( figureGroupNameRef | figureGroupOverride )
( circle | comment | complexGeometry | dot | openShape | path | polygon | rectangle | shape | userData )*
')';
figureGroup : '(figureGroup'
figureGroupNameDef
( comment | cornerType | displayAttributes | endType | nameInformation | pathWidth | property | userData )*
')';
figureGroupNameCaseSensitive : '(figureGroupNameCaseSensitive'
booleanToken
')';
figureGroupNameDef : nameDef;
figureGroupNameRef : nameRef;
figureGroupOverride : '(figureGroupOverride'
figureGroupNameRef
( comment | cornerType | displayAttributes | endType | pathWidth | propertyOverride )*
')';
fillPattern : '(fillPattern'
pixelPattern
')';
fillPatternVisible : '(fillPatternVisible'
booleanValue
')';
firstIntegerExpression : integerExpression;
firstStringExpression : stringExpression;
fixed : '(fixed'
')';
font : '(font'
fontNameDef
typeface
fontProportions
( boldStyle | italicStyle | property | proportionalFont | userData )*
')';
fontCapitalHeight : '(fontCapitalHeight'
lengthValue
')';
fontDefinitions : '(fontDefinitions'
( fonts )?
')';
fontDescent : '(fontDescent'
lengthValue
')';
fontFamily : stringToken;
fontHeight : '(fontHeight'
lengthValue
')';
fontNameDef : nameDef;
fontNameRef : nameRef;
fontProportions : '(fontProportions'
fontHeight
fontDescent
fontCapitalHeight
fontWidth
')';
fontRef : '(fontRef'
fontNameRef
')';
fonts : '(fonts'
setDistance
( font )*
')';
fontWidth : '(fontWidth'
lengthValue
')';
forbiddenEvent : '(forbiddenEvent'
timeInterval
( event )*
')';
forFrame : '(forFrame'
frameNameDef
repetitionCount
forFrameIndex
logicalConnectivity
( comment | documentation | nameInformation | property | userData )*
')';
forFrameAnnotate : '(forFrameAnnotate'
extendForFrameMemberDef
( comment | forFrameAnnotate | ifFrameAnnotate | interconnectAnnotate | leafOccurrenceAnnotate | occurrenceAnnotate | otherwiseFrameAnnotate )*
')';
forFrameIndex : '(forFrameIndex'
indexNameDef
( indexStart | indexStep | nameInformation )*
')';
forFrameIndexDisplay : '(forFrameIndexDisplay'
( indexEndDisplay | indexNameDisplay | indexStartDisplay | indexStepDisplay )*
')';
forFrameIndexNameCaseSensitive : '(forFrameIndexNameCaseSensitive'
booleanToken
')';
forFrameIndexRef : '(forFrameIndexRef'
indexNameRef
')';
forFrameMemberRef : '(forFrameMemberRef'
frameNameRef
indexValue
')';
forFrameRef : '(forFrameRef'
frameNameRef
')';
frameConfiguration : '(frameConfiguration'
frameNameRef
( frameConfiguration | instanceConfiguration )*
')';
frameNameCaseSensitive : '(frameNameCaseSensitive'
booleanToken
')';
frameNameDef : nameDef;
frameNameRef : nameRef;
frameRef : '(frameRef'
frameNameRef
')';
frequencyValue : miNoMaxValue;
fromBottom : '(fromBottom'
')';
fromInteger : integerToken;
fromLeft : '(fromLeft'
')';
fromRight : '(fromRight'
')';
fromTop : '(fromTop'
')';
generated : '(generated'
')';
geometryMacro : '(geometryMacro'
libraryObjectNameDef
geometryMacroHeader
( circle | comment | complexGeometry | dot | openShape | path | polygon | rectangle | shape | userData )*
')';
geometryMacroHeader : '(geometryMacroHeader'
geometryMacroUnits
( backgroundColor | documentation | nameInformation | originalBoundingBox | property | status )*
')';
geometryMacroRef : '(geometryMacroRef'
libraryObjectNameRef
( libraryRef )?
')';
geometryMacroUnits : '(geometryMacroUnits'
( setAngle )?
')';
globalPort : '(globalPort'
globalPortNameDef
( comment | nameInformation | property | schematicGlobalPortAttributes | userData )*
')';
globalPortBundle : '(globalPortBundle'
globalPortNameDef
globalPortList
( comment | nameInformation | property | userData )*
')';
globalPortDefinitions : '(globalPortDefinitions'
( globalPort | globalPortBundle )*
')';
globalPortList : '(globalPortList'
( globalPortRef )*
')';
globalPortNameCaseSensitive : '(globalPortNameCaseSensitive'
booleanToken
')';
globalPortNameDef : nameDef;
globalPortNameDisplay : '(globalPortNameDisplay'
( display | displayNameOverride )*
')';
globalPortNameRef : nameRef;
globalPortPropertyDisplay : '(globalPortPropertyDisplay'
propertyNameRef
( display | propertyNameDisplay )*
')';
globalPortRef : '(globalPortRef'
globalPortNameRef
')';
globalPortScope : '(globalPortScope'
globalPortNameRef
')';
green : scaledInteger;
henry : '(henry'
unitExponent
')';
hertz : '(hertz'
unitExponent
')';
horizontalJustification : '(horizontalJustification'
( leftJustify | centerJustify | rightJustify )
')';
hotspot : '(hotspot'
pointValue
( hotspotConnectDirection | hotspotNameDisplay | nameInformation | schematicWireAffinity )*
')';
hotspotConnectDirection : '(hotspotConnectDirection'
( fromBottom | fromLeft | fromRight | fromTop )*
')';
hotspotGrid : '(hotspotGrid'
lengthValue
')';
hotspotNameCaseSensitive : '(hotspotNameCaseSensitive'
booleanToken
')';
hotspotNameDef : nameDef;
hotspotNameDisplay : '(hotspotNameDisplay'
( display | displayNameOverride )*
')';
hotspotNameRef : nameRef;
hourNumber : integerToken;
ieeeDesignation : stringToken;
ieeeSection : '(ieeeSection'
( integerToken )*
')';
ieeeStandard : '(ieeeStandard'
ieeeDesignation
year
( comment |ieeeSection )*
')';
ifFrame : '(ifFrame'
frameNameDef
condition
logicalConnectivity
( comment | nameInformation | documentation | property | userData )*
')';
ifFrameAnnotate : '(ifFrameAnnotate'
extendFrameDef
( comment | forFrameAnnotate | ifFrameAnnotate | interconnectAnnotate | leafOccurrenceAnnotate | occurrenceAnnotate | otherwiseFrameAnnotate | propertyOverride )*
')';
ifFrameRef : '(ifFrameRef'
frameNameRef
')';
ifFrameSet : '(ifFrameSet'
( ifFrameRef )*
')';
ignore : '(ignore'
')';
implementationNameCaseSensitive : '(implementationNameCaseSensitive'
booleanToken
')';
implementationNameDef : nameDef;
implementationNameDisplay : '(implementationNameDisplay'
( display | displayNameOverride )*
')';
implementationNameRef : nameRef;
indexEndDisplay : '(indexEndDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
indexNameDef : nameDef;
indexNameDisplay : '(indexNameDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
indexNameRef : nameRef;
indexStart : '(indexStart'
integerExpression
')';
indexStartDisplay : '(indexStartDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
indexStep : '(indexStep'
integerExpression
')';
indexStepDisplay : '(indexStepDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
indexValue : '(indexValue'
integerToken
')';
input : '(input'
')';
inputPort : '(inputPort'
( inputPortAttributes )?
')';
inputPortAttributes : '(inputPortAttributes'
( dcFanOutLoad | dcMaxFanIn )*
')';
instance : '(instance'
instanceNameDef
clusterRef
( booleanParameterAssign | cellPropertyOverride | clusterPropertyOverride | comment | designator | instanceNameGenerator | instancePortAttributes | instanceWidth | integerParameterAssign | nameInformation | numberParameterAssign | property | stringParameterAssign | timing | userData )*
')';
instanceConfiguration : '(instanceConfiguration'
instanceNameRef
clusterConfigurationRef
')';
instanceIndexValue : '(instanceIndexValue'
')';
instanceMemberRef : '(instanceMemberRef'
instanceNameRef
indexValue
')';
instanceNameCaseSensitive : '(instanceNameCaseSensitive'
booleanToken
')';
instanceNameDef : nameDef;
instanceNameDisplay : '(instanceNameDisplay'
( display | displayNameOverride )*
')';
instanceNameGenerator : '(instanceNameGenerator'
stringExpression
')';
instanceNameGeneratorDisplay : '(instanceNameGeneratorDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
instanceNameRef : nameRef;
instancePortAttributeDisplay : '(instancePortAttributeDisplay'
symbolPortImplementationNameRef
portRef
( portPropertyDisplayOverride | portAttributeDisplay )*
')';
instancePortAttributes : '(instancePortAttributes'
extendPortDef
( acLoad | comment | connectedSignalIndexGenerator | designator | directionalPortAttributeOverride | portDelay | portDelayOverride | portLoadDelay | portLoadDelayOverride | portPropertyOverride | property | unused )*
')';
instancePropertyDisplay : '(instancePropertyDisplay'
propertyNameRef
( display )*
( propertyNameDisplay )?
( display )*
')';
instancePropertyOverride : '(instancePropertyOverride'
propertyNameRef
( typedValue | untyped )
( comment | fixed | propertyOverride )*
')';
instanceRef : '(instanceRef'
instanceNameRef
')';
instanceWidth : '(instanceWidth'
integerExpression
')';
instanceWidthDisplay : '(instanceWidthDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
integer : '(integer'
integerExpression
')';
integerConstant : '(integerConstant'
constantNameDef
integerToken
')';
integerConstantRef : '(integerConstantRef'
constantNameRef
')';
integerEqual : '(integerEqual'
firstIntegerExpression
secondIntegerExpression
')';
integerExpression : ( integerParameterRef | integerToken | integerProduct | integerSubtract | integerSum | integerRemainder | integerQuotient | stringLength | integerConstantRef | forFrameIndexRef | portIndexValue | signalIndexValue | absolute | instanceIndexValue )
;
integerParameter : '(integerParameter'
parameterNameDef
( integer | nameInformation )*
')';
integerParameterAssign : '(integerParameterAssign'
parameterNameRef
integerExpression
')';
integerParameterRef : '(integerParameterRef'
parameterNameRef
')';
integerProduct : '(integerProduct'
( integerExpression )*
')';
integerQuotient : '(integerQuotient'
dividend
divisor
')';
integerRemainder : '(integerRemainder'
dividend
divisor
')';
integerSubtract : '(integerSubtract'
minuend
subtrahend
')';
integerSum : '(integerSum'
( integerExpression )*
')';
integerValue : integerToken;
interconnectAnnotate : '(interconnectAnnotate'
extendInterconnectDef
( comment | interconnectAnnotate | criticality | interconnectDelay | property | propertyOverride )*
')';
interconnectAttachedText : '(interconnectAttachedText'
attachmentPoint
( annotate | connectivityTagGeneratorDisplay | criticalityDisplay | interconnectDelayDisplay | interconnectNameDisplay | interconnectPropertyDisplay )*
')';
interconnectDelay : '(interconnectDelay'
interconnectDelayNameDef
derivation
delay
( becomes | transition )*
')';
interconnectDelayDisplay : '(interconnectDelayDisplay'
interconnectDelayNameRef
( display )*
')';
interconnectDelayNameDef : nameDef;
interconnectDelayNameRef : nameRef;
interconnectHeader : '(interconnectHeader'
( criticality | documentation | interconnectDelay | nameInformation | property )*
')';
interconnectNameCaseSensitive : '(interconnectNameCaseSensitive'
booleanToken
')';
interconnectNameDef : nameDef;
interconnectNameDisplay : '(interconnectNameDisplay'
( display | displayNameOverride )*
')';
interconnectNameRef : nameRef;
interconnectPropertyDisplay : '(interconnectPropertyDisplay'
propertyNameRef
( display )*
( propertyNameDisplay )?
( display )*
')';
interconnectRef : '(interconnectRef'
interconnectNameRef
( pageRef )?
')';
interconnectSet : '(interconnectSet'
( interconnectRef )*
')';
einterface : '(interface'
interfaceUnits
( designator | booleanParameter | integerParameter | interfaceJoined | mustJoin | numberParameter | permutable | port | portBundle | stringParameter | timing | weakJoined )*
')';
interfaceJoined : '(interfaceJoined'
( portRef )*
')';
interfaceUnits : '(interfaceUnits'
( setCapacitance | setTime )*
')';
iso8859 : '(iso8859'
iso8859Part
')';
iso8859Part : integerToken;
isolated : '(isolated'
')';
issue : integerToken;
italicStyle : '(italicStyle'
')';
jisx0201 : '(jisx0201'
')';
jisx0208 : '(jisx0208'
')';
joinedAsSignal : '(joinedAsSignal'
')';
joule : '(joule'
unitExponent
')';
k0KeywordLevel : '(k0KeywordLevel'
')';
k1KeywordAlias : '(k1KeywordAlias'
k1KeywordNameDef
k1KeywordNameRef
')';
k1KeywordLevel : '(k1KeywordLevel'
( k1KeywordAlias )*
')';
k1KeywordNameDef : IDENTIFIER;
k1KeywordNameRef : IDENTIFIER;
k2Actual : '(k2Actual'
k2FormalNameRef
')';
k2Build : '(k2Build'
k1KeywordNameRef
( comment | k2Actual | k2Build | k2Literal )*
')';
k2Formal : '(k2Formal'
k2FormalNameDef
( k2Optional | k2Required )
')';
k2FormalNameDef : IDENTIFIER;
k2FormalNameRef : IDENTIFIER;
k2Generate : '(k2Generate'
( comment | k2Actual | k2Build | k2Literal )*
')';
k2KeywordDefine : '(k2KeywordDefine'
k1KeywordNameDef
k2KeywordParameters
k2Generate
')';
k2KeywordLevel : '(k2KeywordLevel'
( k1KeywordAlias | k2KeywordDefine )*
')';
k2KeywordParameters : '(k2KeywordParameters'
( k2Formal )*
')';
k2Literal : '(k2Literal'
( IDENTIFIER | integerToken | stringToken )*
')';
k2Optional : '(k2Optional'
( k2Literal | k2Actual | k2Build )
')';
k2Required : '(k2Required'
')';
k3Build : '(k3Build'
k1KeywordNameRef
( comment | k2Actual | k2Literal | k3Build | k3ForEach )*
')';
k3Collector : '(k3Collector'
')';
k3ForEach : '(k3ForEach'
( k2FormalNameRef | k3FormalList )
( comment | k2Actual | k2Literal | k3Build | k3ForEach )*
')';
k3Formal : '(k3Formal'
k2FormalNameDef
( k2Optional | k2Required | k3Collector )
')';
k3FormalList : '(k3FormalList'
( k2FormalNameRef )*
')';
k3Generate : '(k3Generate'
( comment | k2Actual | k2Build | k2Literal | k3ForEach )*
')';
k3KeywordDefine : '(k3KeywordDefine'
k1KeywordNameDef
k3KeywordParameters
k3Generate
')';
k3KeywordLevel : '(k3KeywordLevel'
( k1KeywordAlias | k3KeywordDefine )*
')';
k3KeywordParameters : '(k3KeywordParameters'
( k3Formal )*
')';
kelvin : '(kelvin'
unitExponent
')';
keywordMap : '(keywordMap'
( k0KeywordLevel | k1KeywordLevel | k2KeywordLevel | k3KeywordLevel )
( comment )*
')';
kilogram : '(kilogram'
unitExponent
')';
leaf : '(leaf'
')';
leafOccurrenceAnnotate : '(leafOccurrenceAnnotate'
( extendInstanceDef | extendInstanceMemberDef )
( cellPropertyOverride | clusterPropertyOverride | comment | designator | instancePropertyOverride | portAnnotate | property )*
')';
leftJustify : '(leftJustify'
')';
lengthValue : distanceValue;
lessThan : '(lessThan'
( integerExpression )*
')';
lessThanOrEqual : '(lessThanOrEqual'
( integerExpression )*
')';
library : '(library'
libraryNameDef
libraryHeader
( cell | schematicInterconnectTerminatorTemplate | schematicJunctionTemplate | schematicGlobalPortTemplate | schematicMasterPortTemplate | schematicOffPageConnectorTemplate | schematicOnPageConnectorTemplate | schematicRipperTemplate | schematicSymbolBorderTemplate | schematicSymbolPortTemplate | pageBorderTemplate | pageTitleBlockTemplate | comment | geometryMacro | schematicFigureMacro | schematicForFrameBorderTemplate | schematicIfFrameBorderTemplate | schematicOtherwiseFrameBorderTemplate | userData )*
')';
libraryHeader : '(libraryHeader'
edifLevel
nameCaseSensitivity
technology
( backgroundColor | documentation | nameInformation | property | status )*
')';
libraryNameCaseSensitive : '(libraryNameCaseSensitive'
booleanToken
')';
libraryNameDef : nameDef;
libraryNameRef : nameRef;
libraryObjectNameCaseSensitive : '(libraryObjectNameCaseSensitive'
booleanToken
')';
libraryObjectNameDef : nameDef;
libraryObjectNameRef : nameRef;
libraryRef : '(libraryRef'
libraryNameRef
')';
loadDelay : '(loadDelay'
acLoadFactorTime
acLoadFactorCapacitance
')';
localPortGroup : '(localPortGroup'
localPortGroupNameDef
portList
( comment | nameInformation | property | userData )*
')';
localPortGroupNameCaseSensitive : '(localPortGroupNameCaseSensitive'
booleanToken
')';
localPortGroupNameDef : nameDef;
localPortGroupNameRef : nameRef;
localPortGroupRef : '(localPortGroupRef'
localPortGroupNameRef
')';
logicalConnectivity : '(logicalConnectivity'
( comment | forFrame | ifFrame | instance | otherwiseFrame | signal | signalGroup | userData )*
')';
logicDefinitions : '(logicDefinitions'
setVoltage
setCurrent
( comment | logicValue )*
')';
logicList : '(logicList'
( ignore | logicNameRef | logicOneOf )*
')';
logicMapInput : '(logicMapInput'
( logicRef )*
')';
logicMapOutput : '(logicMapOutput'
( logicRef )*
')';
logicModelUnits : '(logicModelUnits'
( setCapacitance | setTime )*
')';
logicModelView : '(logicModelView'
viewNameDef
( comment | nameInformation | userData )*
')';
logicNameDef : nameDef;
logicNameRef : nameRef;
logicOneOf : '(logicOneOf'
( logicList | logicNameRef )*
')';
logicRef : '(logicRef'
logicNameRef
( libraryRef )?
')';
logicValue : '(logicValue'
logicNameDef
( booleanMap | comment | compound | currentMap | dominates | isolated | logicMapInput | logicMapOutput | nameInformation | property | resolves | strong | voltageMap | weak )*
')';
lsbToMsb : '(lsbToMsb'
')';
mantissa : integerToken;
mark : integerToken;
maskLayoutUnits : '(maskLayoutUnits'
( setAngle | setCapacitance | setDistance | setTime )*
')';
maskLayoutView : '(maskLayoutView'
viewNameDef
( comment | nameInformation | userData )*
')';
measured : '(measured'
')';
meter : '(meter'
unitExponent
')';
middleJustify : '(middleJustify'
')';
minimalWidth : '(minimalWidth'
')';
minimumStringLength : '(minimumStringLength'
substringLength
')';
miNoMax : '(miNoMax'
miNoMaxValue
')';
miNoMaxValue : ( numberValue | mnm );
minuend : integerExpression;
minuteNumber : integerToken;
mixedDirection : '(mixedDirection'
')';
mnm : '(mnm'
( numberValue | undefined | unconstrained )
( numberValue | undefined | unconstrained )
( numberValue | undefined | unconstrained )
')';
mole : '(mole'
unitExponent
')';
monthNumber : integerToken;
msbToLsb : '(msbToLsb'
')';
mustJoin : '(mustJoin'
( interfaceJoined | portRef | weakJoined )*
')';
nameAlias : '(nameAlias'
originalName
( displayName | generated | nameStructure )*
')';
nameCaseSensitivity : '(nameCaseSensitivity'
( clusterConfigurationNameCaseSensitive | clusterNameCaseSensitive | designHierarchyNameCaseSensitive | designNameCaseSensitive | documentationNameCaseSensitive | figureGroupNameCaseSensitive | forFrameIndexNameCaseSensitive | frameNameCaseSensitive | globalPortNameCaseSensitive | hotspotNameCaseSensitive | implementationNameCaseSensitive | instanceNameCaseSensitive | interconnectNameCaseSensitive | libraryNameCaseSensitive | libraryObjectNameCaseSensitive | localPortGroupNameCaseSensitive | pageNameCaseSensitive | parameterNameCaseSensitive | portNameCaseSensitive | propertyNameCaseSensitive | signalGroupNameCaseSensitive | signalNameCaseSensitive | viewGroupNameCaseSensitive | viewNameCaseSensitive )*
')';
nameDef : IDENTIFIER;
nameDimension : '(nameDimension'
nameDimensionStructure
( bitOrder )?
')';
nameDimensionStructure : '(nameDimensionStructure'
( complementedName | complexName | integerValue | sequence | simpleName )*
')';
nameInformation : '(nameInformation'
primaryName
( nameAlias )*
')';
namePartSeparator : '(namePartSeparator'
stringToken
')';
nameRef : IDENTIFIER;
nameStructure : '(nameStructure'
( simpleName | complexName | complementedName )
')';
narrowPort : '(narrowPort'
')';
narrowWire : '(narrowWire'
')';
noHotspotGrid : '(noHotspotGrid'
')';
nominalHotspotGrid : '(nominalHotspotGrid'
lengthValue
')';
nonPermutable : '(nonPermutable'
( permutable | portRef )*
')';
not_ : '(not'
booleanExpression
')';
notInherited : '(notInherited'
')';
number : '(number'
numberExpression
')';
numberExpression : ( numberValue | numberParameterRef );
numberOfBasicUnits : scaledInteger;
numberOfNewUnits : scaledInteger;
numberParameter : '(numberParameter'
parameterNameDef
( nameInformation | number )*
')';
numberParameterAssign : '(numberParameterAssign'
parameterNameRef
numberExpression
')';
numberParameterRef : '(numberParameterRef'
parameterNameRef
')';
numberPoint : '(numberPoint'
xNumberValue
yNumberValue
')';
numberValue : scaledInteger;
numerator : integerValue;
occurrenceAnnotate : '(occurrenceAnnotate'
( extendInstanceDef | extendInstanceMemberDef )
( cellPropertyOverride | clusterPropertyOverride | comment | designator | forFrameAnnotate | ifFrameAnnotate | instancePropertyOverride | interconnectAnnotate | leafOccurrenceAnnotate | occurrenceAnnotate | otherwiseFrameAnnotate | pageAnnotate | portAnnotate | property | signalAnnotate | signalGroupAnnotate | timing | viewPropertyOverride )*
')';
occurrenceHierarchyAnnotate : '(occurrenceHierarchyAnnotate'
( cellPropertyOverride | clusterPropertyOverride | comment | forFrameAnnotate | ifFrameAnnotate | interconnectAnnotate | leafOccurrenceAnnotate | occurrenceAnnotate | otherwiseFrameAnnotate | pageAnnotate | portAnnotate | signalAnnotate | signalGroupAnnotate | timing | viewPropertyOverride )*
')';
offsetEvent : '(offsetEvent'
event
numberValue
')';
ohm : '(ohm'
unitExponent
')';
openShape : '(openShape'
curve
')';
or_ : '(or'
( booleanExpression )*
')';
origin : '(origin'
pointValue
')';
originalBoundingBox : '(originalBoundingBox'
rectangle
')';
originalDrawingDate : '(originalDrawingDate'
date
')';
originalDrawingDateDisplay : '(originalDrawingDateDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
originalName : stringToken;
otherwiseFrame : '(otherwiseFrame'
frameNameDef
ifFrameSet
logicalConnectivity
( comment | documentation | nameInformation | property | userData )*
')';
otherwiseFrameAnnotate : '(otherwiseFrameAnnotate'
extendFrameDef
( comment | forFrameAnnotate | ifFrameAnnotate | interconnectAnnotate | leafOccurrenceAnnotate | occurrenceAnnotate | otherwiseFrameAnnotate | propertyOverride )*
')';
otherwiseFrameRef : '(otherwiseFrameRef'
frameNameRef
')';
output : '(output'
')';
outputPort : '(outputPort'
( outputPortAttributes )?
')';
outputPortAttributes : '(outputPortAttributes'
( dcFanInLoad | dcMaxFanOut )*
')';
owner : '(owner'
stringValue
')';
page : '(page'
pageNameDef
pageHeader
( cellPropertyDisplay | clusterPropertyDisplay | comment | localPortGroup | pageCommentGraphics | pageTitleBlock | propertyDisplay | schematicBus | schematicForFrameImplementation | schematicGlobalPortImplementation | schematicIfFrameImplementation | schematicInstanceImplementation | schematicMasterPortImplementation | schematicNet | schematicOffPageConnectorImplementation | schematicOnPageConnectorImplementation | schematicOtherwiseFrameImplementation | schematicRipperImplementation | userData | viewPropertyDisplay )*
')';
pageAnnotate : '(pageAnnotate'
extendPageDef
( interconnectAnnotate )*
')';
pageBorder : '(pageBorder'
pageBorderTemplateRef
transform
( propertyDisplayOverride | propertyOverride )*
')';
pageBorderTemplate : '(pageBorderTemplate'
libraryObjectNameDef
schematicTemplateHeader
usableArea
( annotate | commentGraphics | figure | propertyDisplay | schematicComplexFigure )*
')';
pageBorderTemplateRef : '(pageBorderTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
pageCommentGraphics : '(pageCommentGraphics'
( annotate | comment | figure | schematicComplexFigure | userData )*
')';
pageHeader : '(pageHeader'
( backgroundColor | documentation | nameInformation | originalBoundingBox | pageBorder | pageSize | property | status )*
')';
pageIdentification : '(pageIdentification'
stringToken
')';
pageIdentificationDisplay : '(pageIdentificationDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
pageNameCaseSensitive : '(pageNameCaseSensitive'
booleanToken
')';
pageNameDef : nameDef;
pageNameRef : nameRef;
pagePropertyDisplay : '(pagePropertyDisplay'
propertyNameRef
( display | propertyNameDisplay)*
')';
pageRef : '(pageRef'
pageNameRef
')';
pageSize : '(pageSize'
rectangle
')';
pageTitle : '(pageTitle'
stringToken
')';
pageTitleBlock : '(pageTitleBlock'
implementationNameDef
pageTitleBlockTemplateRef
transform
( nameInformation | pagePropertyDisplay | pageTitleBlockAttributeDisplay | pageTitleBlockAttributes | property | propertyDisplay | propertyDisplayOverride | propertyOverride )*
')';
pageTitleBlockAttributeDisplay : '(pageTitleBlockAttributeDisplay'
( approvedDateDisplay | checkDateDisplay | companyNameDisplay | contractDisplay | copyrightDisplay | drawingDescriptionDisplay | drawingIdentificationDisplay | drawingSizeDisplay | engineeringDateDisplay | originalDrawingDateDisplay | pageIdentificationDisplay | pageTitleDisplay | revisionDisplay | totalPagesDisplay )*
')';
pageTitleBlockAttributes : '(pageTitleBlockAttributes'
( approvedDate | checkDate | companyName | contract | drawingDescription | drawingIdentification | drawingSize | engineeringDate | originalDrawingDate | pageIdentification | pageTitle | revision )*
')';
pageTitleBlockTemplate : '(pageTitleBlockTemplate'
libraryObjectNameDef
schematicTemplateHeader
( annotate | commentGraphics | figure | pageTitleBlockAttributeDisplay | pageTitleBlockAttributes | propertyDisplay | schematicComplexFigure )*
')';
pageTitleBlockTemplateRef : '(pageTitleBlockTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
pageTitleDisplay : '(pageTitleDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
parameterDisplay : '(parameterDisplay'
parameterNameRef
( addDisplay | replaceDisplay | removeDisplay )
( parameterNameDisplay )?
')';
parameterNameCaseSensitive : '(parameterNameCaseSensitive'
booleanToken
')';
parameterNameDef : nameDef;
parameterNameDisplay : '(parameterNameDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
parameterNameRef : nameRef;
path : '(path'
pointList
')';
pathDelay : '(pathDelay'
delay
( event )*
')';
pathWidth : '(pathWidth'
( lengthValue | minimalWidth )
')';
pcbLayoutUnits : '(pcbLayoutUnits'
( setAngle | setCapacitance | setDistance | setTime )*
')';
pcbLayoutView : '(pcbLayoutView'
viewNameDef
( comment | nameInformation | userData )*
')';
permutable : '(permutable'
( nonPermutable | permutable | portRef )*
')';
physicalDefaults : '(physicalDefaults'
( schematicRequiredDefaults )?
')';
physicalScaling : '(physicalScaling'
( comment | connectivityUnits | documentationUnits | geometryMacroUnits | interfaceUnits | logicModelUnits | maskLayoutUnits | pcbLayoutUnits | schematicUnits | symbolicLayoutUnits )*
')';
pixelPattern : '(pixelPattern'
rowSize
( pixelRow )*
')';
pixelRow : '(pixelRow'
( booleanToken )*
')';
point : '(point'
pointValue
')';
pointList : '(pointList'
( pointValue )*
')';
pointValue : pt;
polygon : '(polygon'
pointList
')';
port : '(port'
portNameDef?
portDirection?
( acLoad | comment | defaultConnection | designator | nameInformation | portDelay | portLoadDelay | portNameGenerator | portWidth | property | schematicPortAttributes | unused | userData )*
')';
portAnnotate : '(portAnnotate'
( extendPortDef | extendPortMemberDef )
( acLoad | comment | designator | directionalPortAttributeOverride | portDelay | portDelayOverride | portLoadDelay | portLoadDelayOverride | portPropertyOverride | property )*
')';
portAttributeDisplay : '(portAttributeDisplay'
( acLoadDisplay | connectedSignalIndexGeneratorDisplay | dcFanInLoadDisplay | dcFanOutLoadDisplay | dcMaxFanInDisplay | dcMaxFanOutDisplay | designatorDisplay | portDelayDisplay | portLoadDelayDisplay | portNameDisplay | portNameGeneratorDisplay | portPropertyDisplay )*
')';
portBundle : '(portBundle'
portNameDef
portList
( comment | nameInformation | property | userData | designator)*
')';
portDelay : '(portDelay'
portDelayNameDef
derivation
delay
( becomes | transition )*
')';
portDelayDisplay : '(portDelayDisplay'
portDelayNameRef
( display )*
')';
portDelayNameDef : nameDef;
portDelayNameRef : nameRef;
portDelayOverride : '(portDelayOverride'
portDelayNameRef
derivation
delay
( becomes | transition )*
')';
portDirection : ( inputPort | outputPort | bidirectionalPort | unspecifiedDirectionPort );
portDirectionIndicator : ( input | output | bidirectional | unspecified | unrestricted | mixedDirection );
portIndexValue : '(portIndexValue'
')';
portInstanceRef : '(portInstanceRef'
( portNameRef | portMemberRef )
( instanceRef | instanceMemberRef )
')';
portJoined : '(portJoined'
( globalPortRef | localPortGroupRef | portInstanceRef | portRef )*
')';
portList : '(portList'
( portRef )*
')';
portLoadDelay : '(portLoadDelay'
portLoadDelayNameDef
derivation
loadDelay
( becomes | transition )*
')';
portLoadDelayDisplay : '(portLoadDelayDisplay'
portLoadDelayNameRef
( display )*
')';
portLoadDelayNameDef : nameDef;
portLoadDelayNameRef : nameRef;
portLoadDelayOverride : '(portLoadDelayOverride'
portLoadDelayNameRef
derivation
loadDelay
( becomes | transition )*
')';
portMemberRef : '(portMemberRef'
portNameRef
indexValue
')';
portNameCaseSensitive : '(portNameCaseSensitive'
booleanToken
')';
portNameDef : nameDef;
portNameDisplay : '(portNameDisplay'
( display | displayNameOverride )*
')';
portNameGenerator : '(portNameGenerator'
stringExpression
')';
portNameGeneratorDisplay : '(portNameGeneratorDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
portNameRef : nameRef;
portPropertyDisplay : '(portPropertyDisplay'
propertyNameRef
( display | propertyNameDisplay )*
')';
portPropertyDisplayOverride : '(portPropertyDisplayOverride'
propertyNameRef
( addDisplay | replaceDisplay | removeDisplay )
( propertyNameDisplay )?
')';
portPropertyOverride : '(portPropertyOverride'
propertyNameRef
( typedValue | untyped )
( comment | fixed | propertyOverride )*
')';
portRef : '(portRef'
portNameRef
')';
portSet : '(portSet'
( portRef )*
')';
portWidth : '(portWidth'
integerExpression
')';
presentLogicValue : ( logicNameRef | logicList | logicOneOf );
previousLogicValue : ( logicNameRef | logicList | logicOneOf );
previousVersion : '(previousVersion'
viewRef
( reason )?
')';
primaryName : '(primaryName'
originalName
( displayName | generated | nameStructure )*
')';
program : '(program'
stringValue
( version )?
')';
property : '(property'
propertyNameDef
( typedValue | untyped )
( comment | nameInformation | owner | property | propertyInheritanceControl | unitRef )*
')';
propertyDisplay : '(propertyDisplay'
propertyNameRef
( display | propertyNameDisplay )*
')';
propertyDisplayOverride : '(propertyDisplayOverride'
propertyNameRef
( addDisplay | replaceDisplay | removeDisplay )
( propertyNameDisplay )?
')';
propertyInheritanceControl : '(propertyInheritanceControl'
( fixed | notInherited )
')';
propertyNameCaseSensitive : '(propertyNameCaseSensitive'
booleanToken
')';
propertyNameDef : nameDef;
propertyNameDisplay : '(propertyNameDisplay'
( display | displayNameOverride )*
')';
propertyNameRef : nameRef;
propertyOverride : '(propertyOverride'
propertyNameRef
( typedValue | untyped )
( comment | fixed | propertyOverride )*
')';
proportionalFont : '(proportionalFont'
')';
pt : '(pt'
xCoordinate
yCoordinate
')';
pt1 : pointValue;
pt2 : pointValue;
radian : '(radian'
unitExponent
')';
reason : '(reason'
stringToken
')';
rectangle : '(rectangle'
pt1
pt2
')';
red : scaledInteger;
removeDisplay : '(removeDisplay'
')';
repetitionCount : '(repetitionCount'
integerExpression
')';
repetitionCountDisplay : '(repetitionCountDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
replaceDisplay : '(replaceDisplay'
( display )*
')';
required : '(required'
')';
resolves : '(resolves'
( logicNameRef )*
')';
revision : '(revision'
stringToken
')';
revisionDisplay : '(revisionDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
rightJustify : '(rightJustify'
')';
ripperHotspot : '(ripperHotspot'
hotspotNameDef
hotspot
')';
ripperHotspotRef : '(ripperHotspotRef'
hotspotNameRef
schematicRipperImplementationRef
')';
rotation : '(rotation'
angleValue
')';
round : '(round'
')';
rowSize : integerToken;
scaledInteger : ( integerToken | e );
scaleX : '(scaleX'
numerator
denominator
')';
scaleY : '(scaleY'
numerator
denominator
')';
schematicBus : '(schematicBus'
interconnectNameDef
signalGroupRef
schematicInterconnectHeader
schematicBusJoined
( comment | schematicBusDetails | schematicBusSlice | schematicInterconnectAttributeDisplay | userData )*
')';
schematicBusDetails : '(schematicBusDetails'
( schematicBusGraphics | schematicSubBusSet )
')';
schematicBusGraphics : '(schematicBusGraphics'
( comment | figure | schematicComplexFigure | userData )*
')';
schematicBusJoined : '(schematicBusJoined'
(portJoined | ripperHotspotRef | schematicGlobalPortImplementationRef | schematicInterconnectTerminatorImplementationRef | schematicJunctionImplementationRef | schematicMasterPortImplementationRef | schematicOffPageConnectorImplementationRef | schematicOnPageConnectorImplementationRef | schematicSymbolPortImplementationRef )*
')';
schematicBusSlice : '(schematicBusSlice'
interconnectNameDef
signalGroupRef
schematicInterconnectHeader
schematicBusJoined
( comment | schematicBusDetails | schematicBusSlice | schematicInterconnectAttributeDisplay | userData )*
')';
schematicComplexFigure : '(schematicComplexFigure'
schematicFigureMacroRef
transform
( propertyDisplayOverride | propertyOverride )*
')';
schematicFigureMacro : '(schematicFigureMacro'
libraryObjectNameDef
schematicTemplateHeader
( annotate | comment | commentGraphics | figure | propertyDisplay | schematicComplexFigure | userData )*
')';
schematicFigureMacroRef : '(schematicFigureMacroRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicForFrameBorder : '(schematicForFrameBorder'
schematicForFrameBorderTemplateRef
transform
( forFrameIndexDisplay | propertyDisplayOverride | propertyOverride | repetitionCountDisplay )*
')';
schematicForFrameBorderTemplate : '(schematicForFrameBorderTemplate'
libraryObjectNameDef
schematicTemplateHeader
usableArea
( annotate | commentGraphics | figure | forFrameIndexDisplay | propertyDisplay | repetitionCountDisplay | schematicComplexFigure )*
')';
schematicForFrameBorderTemplateRef : '(schematicForFrameBorderTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicForFrameImplementation : '(schematicForFrameImplementation'
implementationNameDef
forFrameRef
schematicForFrameImplementationHeader
schematicFrameImplementationDetails
')';
schematicForFrameImplementationHeader : '(schematicForFrameImplementationHeader'
( schematicForFrameBorder )?
')';
schematicFrameImplementationDetails : '(schematicFrameImplementationDetails'
( cellPropertyDisplay | clusterPropertyDisplay | comment | commentGraphics | propertyDisplay | schematicBus | schematicForFrameImplementation | schematicGlobalPortImplementation | schematicIfFrameImplementation | schematicInstanceImplementation | schematicMasterPortImplementation | schematicNet | schematicOffPageConnectorImplementation | schematicOnPageConnectorImplementation | schematicOtherwiseFrameImplementation | schematicRipperImplementation | userData | viewPropertyDisplay )*
')';
schematicGlobalPortAttributes : '(schematicGlobalPortAttributes'
( ieeeStandard | schematicPortAcPower | schematicPortAnalog | schematicPortChassisGround | schematicPortClock | schematicPortDcPower | schematicPortEarthGround | schematicPortGround | schematicPortNonLogical | schematicPortOpenCollector | schematicPortOpenEmitter | schematicPortPower | schematicPortThreeState )*
')';
schematicGlobalPortImplementation : '(schematicGlobalPortImplementation'
implementationNameDef
schematicGlobalPortTemplateRef
globalPortRef
transform
( globalPortNameDisplay | globalPortPropertyDisplay | implementationNameDisplay | nameInformation | propertyDisplayOverride | propertyOverride )*
')';
schematicGlobalPortImplementationRef : '(schematicGlobalPortImplementationRef'
implementationNameRef
')';
schematicGlobalPortTemplate : '(schematicGlobalPortTemplate'
libraryObjectNameDef
schematicTemplateHeader
(hotspot)?
( annotate | commentGraphics | figure | globalPortNameDisplay | implementationNameDisplay | propertyDisplay | schematicComplexFigure | schematicGlobalPortAttributes )*
(hotspot)?
')';
schematicGlobalPortTemplateRef : '(schematicGlobalPortTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicIfFrameBorder : '(schematicIfFrameBorder'
schematicIfFrameBorderTemplateRef
transform
( conditionDisplay | propertyDisplayOverride | propertyOverride )*
')';
schematicIfFrameBorderTemplate : '(schematicIfFrameBorderTemplate'
libraryObjectNameDef
schematicTemplateHeader
usableArea
( annotate | commentGraphics | conditionDisplay | figure | propertyDisplay | schematicComplexFigure )*
')';
schematicIfFrameBorderTemplateRef : '(schematicIfFrameBorderTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicIfFrameImplementation : '(schematicIfFrameImplementation'
implementationNameDef
ifFrameRef
schematicIfFrameImplementationHeader
schematicFrameImplementationDetails
')';
schematicIfFrameImplementationHeader : '(schematicIfFrameImplementationHeader'
( schematicIfFrameBorder )?
')';
schematicImplementation : '(schematicImplementation'
( page | totalPages )*
')';
schematicInstanceImplementation : '(schematicInstanceImplementation'
implementationNameDef
instanceRef
schematicSymbolRef
transform
( cellNameDisplay | cellPropertyDisplayOverride | clusterPropertyDisplayOverride | designatorDisplay | implementationNameDisplay | instanceNameDisplay | instanceNameGeneratorDisplay | instancePortAttributeDisplay | instancePropertyDisplay | instanceWidthDisplay | nameInformation | pageCommentGraphics | parameterDisplay | propertyDisplayOverride | propertyOverride | timingDisplay | viewNameDisplay )*
')';
schematicInstanceImplementationRef : '(schematicInstanceImplementationRef'
implementationNameRef
')';
schematicInterconnectAttributeDisplay : '(schematicInterconnectAttributeDisplay'
( connectivityTagGeneratorDisplay | criticalityDisplay | interconnectAttachedText | interconnectDelayDisplay | interconnectNameDisplay | interconnectPropertyDisplay )*
')';
schematicInterconnectHeader : '(schematicInterconnectHeader'
( criticality | documentation | interconnectDelay | nameInformation | property | schematicInterconnectTerminatorImplementation | schematicJunctionImplementation | schematicWireStyle )*
')';
schematicInterconnectTerminatorImplementation : '(schematicInterconnectTerminatorImplementation'
implementationNameDef
schematicInterconnectTerminatorTemplateRef
transform
( implementationNameDisplay | nameInformation | propertyDisplayOverride | propertyOverride )*
')';
schematicInterconnectTerminatorImplementationRef : '(schematicInterconnectTerminatorImplementationRef'
implementationNameRef
')';
schematicInterconnectTerminatorTemplate : '(schematicInterconnectTerminatorTemplate'
libraryObjectNameDef
schematicTemplateHeader
hotspot
( commentGraphics | figure | implementationNameDisplay | propertyDisplay | schematicComplexFigure )*
')';
schematicInterconnectTerminatorTemplateRef : '(schematicInterconnectTerminatorTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicJunctionImplementation : '(schematicJunctionImplementation'
implementationNameDef
schematicJunctionTemplateRef
transform
( implementationNameDisplay | nameInformation | propertyDisplayOverride | propertyOverride )*
')';
schematicJunctionImplementationRef : '(schematicJunctionImplementationRef'
implementationNameRef
')';
schematicJunctionTemplate : '(schematicJunctionTemplate'
libraryObjectNameDef
schematicTemplateHeader
hotspot
( commentGraphics | figure | implementationNameDisplay | propertyDisplay | schematicComplexFigure )*
')';
schematicJunctionTemplateRef : '(schematicJunctionTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicMasterPortImplementation : '(schematicMasterPortImplementation'
implementationNameDef
schematicMasterPortTemplateRef
( portRef | localPortGroupRef )
transform
( implementationNameDisplay | nameInformation | portAttributeDisplay | propertyDisplayOverride | propertyOverride )*
')';
schematicMasterPortImplementationRef : '(schematicMasterPortImplementationRef'
implementationNameRef
')';
schematicMasterPortTemplate : '(schematicMasterPortTemplate'
libraryObjectNameDef
schematicTemplateHeader
hotspot
portDirectionIndicator
( annotate | commentGraphics | figure | implementationNameDisplay | portAttributeDisplay | propertyDisplay | schematicComplexFigure | schematicPortStyle )*
')';
schematicMasterPortTemplateRef : '(schematicMasterPortTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicMetric : '(schematicMetric'
setDistance
( hotspotGrid | noHotspotGrid )
( nominalHotspotGrid )?
')';
schematicNet : '(schematicNet'
interconnectNameDef
signalRef
schematicInterconnectHeader
schematicNetJoined
( comment | schematicInterconnectAttributeDisplay | schematicNetDetails | userData )*
')';
schematicNetDetails : '(schematicNetDetails'
( schematicNetGraphics | schematicSubNetSet )
')';
schematicNetGraphics : '(schematicNetGraphics'
( comment | figure | schematicComplexFigure | userData )*
')';
schematicNetJoined : '(schematicNetJoined'
( portJoined | joinedAsSignal )?
( ripperHotspotRef | schematicGlobalPortImplementationRef | schematicInterconnectTerminatorImplementationRef | schematicJunctionImplementationRef | schematicMasterPortImplementationRef | schematicOffPageConnectorImplementationRef | schematicOnPageConnectorImplementationRef | schematicSymbolPortImplementationRef )*
( portJoined | joinedAsSignal )?
( ripperHotspotRef | schematicGlobalPortImplementationRef | schematicInterconnectTerminatorImplementationRef | schematicJunctionImplementationRef | schematicMasterPortImplementationRef | schematicOffPageConnectorImplementationRef | schematicOnPageConnectorImplementationRef | schematicSymbolPortImplementationRef )*
')';
schematicOffPageConnectorImplementation : '(schematicOffPageConnectorImplementation'
implementationNameDef
schematicOffPageConnectorTemplateRef
transform
( associatedInterconnectNameDisplay | implementationNameDisplay | nameInformation | property | propertyDisplay | propertyDisplayOverride | propertyOverride )*
')';
schematicOffPageConnectorImplementationRef : '(schematicOffPageConnectorImplementationRef'
implementationNameRef
')';
schematicOffPageConnectorTemplate : '(schematicOffPageConnectorTemplate'
libraryObjectNameDef
schematicTemplateHeader
hotspot
( annotate | associatedInterconnectNameDisplay | commentGraphics | figure | implementationNameDisplay | propertyDisplay | schematicComplexFigure )*
')';
schematicOffPageConnectorTemplateRef : '(schematicOffPageConnectorTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicOnPageConnectorImplementation : '(schematicOnPageConnectorImplementation'
implementationNameDef
schematicOnPageConnectorTemplateRef
transform
( associatedInterconnectNameDisplay | implementationNameDisplay | nameInformation | property | propertyDisplay | propertyDisplayOverride | propertyOverride )*
')';
schematicOnPageConnectorImplementationRef : '(schematicOnPageConnectorImplementationRef'
implementationNameRef
')';
schematicOnPageConnectorTemplate : '(schematicOnPageConnectorTemplate'
libraryObjectNameDef
schematicTemplateHeader
hotspot
( annotate | associatedInterconnectNameDisplay | commentGraphics | figure | implementationNameDisplay | propertyDisplay | schematicComplexFigure )*
')';
schematicOnPageConnectorTemplateRef : '(schematicOnPageConnectorTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicOtherwiseFrameBorder : '(schematicOtherwiseFrameBorder'
schematicOtherwiseFrameBorderTemplateRef
transform
( propertyDisplayOverride | propertyOverride )*
')';
schematicOtherwiseFrameBorderTemplate : '(schematicOtherwiseFrameBorderTemplate'
libraryObjectNameDef
schematicTemplateHeader
usableArea
( annotate | commentGraphics | figure | propertyDisplay | schematicComplexFigure )*
')';
schematicOtherwiseFrameBorderTemplateRef : '(schematicOtherwiseFrameBorderTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicOtherwiseFrameImplementation : '(schematicOtherwiseFrameImplementation'
implementationNameDef
otherwiseFrameRef
schematicOtherwiseFrameImplementationHeader
schematicFrameImplementationDetails
')';
schematicOtherwiseFrameImplementationHeader : '(schematicOtherwiseFrameImplementationHeader'
( schematicOtherwiseFrameBorder )?
')';
schematicPortAcPower : '(schematicPortAcPower'
( schematicPortAcPowerRecommendedFrequency | schematicPortAcPowerRecommendedVoltageRms )*
')';
schematicPortAcPowerRecommendedFrequency : '(schematicPortAcPowerRecommendedFrequency'
frequencyValue
')';
schematicPortAcPowerRecommendedVoltageRms : '(schematicPortAcPowerRecommendedVoltageRms'
voltageValue
')';
schematicPortAnalog : '(schematicPortAnalog'
')';
schematicPortAttributes : '(schematicPortAttributes'
( ieeeStandard | schematicPortAcPower | schematicPortAnalog | schematicPortChassisGround | schematicPortClock | schematicPortDcPower | schematicPortEarthGround | schematicPortGround | schematicPortNonLogical | schematicPortOpenCollector | schematicPortOpenEmitter | schematicPortPower | schematicPortThreeState )*
')';
schematicPortChassisGround : '(schematicPortChassisGround'
( schematicPortAnalog )?
')';
schematicPortClock : '(schematicPortClock'
( ieeeStandard )?
')';
schematicPortDcPower : '(schematicPortDcPower'
( schematicPortAnalog | schematicPortDcPowerRecommendedVoltage )*
')';
schematicPortDcPowerRecommendedVoltage : '(schematicPortDcPowerRecommendedVoltage'
voltageValue
')';
schematicPortEarthGround : '(schematicPortEarthGround'
( schematicPortAnalog )?
')';
schematicPortGround : '(schematicPortGround'
( schematicPortAnalog )?
')';
schematicPortNonLogical : '(schematicPortNonLogical'
')';
schematicPortOpenCollector : '(schematicPortOpenCollector'
')';
schematicPortOpenEmitter : '(schematicPortOpenEmitter'
')';
schematicPortPower : '(schematicPortPower'
')';
schematicPortStyle : '(schematicPortStyle'
( narrowPort | widePort )
')';
schematicPortThreeState : '(schematicPortThreeState'
')';
schematicRequiredDefaults : '(schematicRequiredDefaults'
schematicMetric
fontRef
textHeight
')';
schematicRipperImplementation : '(schematicRipperImplementation'
implementationNameDef
schematicRipperTemplateRef
transform
( implementationNameDisplay | nameInformation | property | propertyDisplay | propertyDisplayOverride | propertyOverride )*
')';
schematicRipperImplementationRef : '(schematicRipperImplementationRef'
implementationNameRef
')';
schematicRipperTemplate : '(schematicRipperTemplate'
libraryObjectNameDef
schematicTemplateHeader
( annotate | commentGraphics | figure | implementationNameDisplay | propertyDisplay | ripperHotspot | schematicComplexFigure )*
')';
schematicRipperTemplateRef : '(schematicRipperTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicSubBus : '(schematicSubBus'
interconnectNameDef
schematicSubInterconnectHeader
schematicBusJoined
( comment | schematicBusDetails | schematicBusSlice | schematicInterconnectAttributeDisplay | userData )*
')';
schematicSubBusSet : '(schematicSubBusSet'
( schematicSubBus )*
')';
schematicSubInterconnectHeader : '(schematicSubInterconnectHeader'
( criticality | documentation | interconnectDelay | nameInformation | property )*
')';
schematicSubNet : '(schematicSubNet'
interconnectNameDef
schematicSubInterconnectHeader
schematicNetJoined
( comment | schematicInterconnectAttributeDisplay | schematicNetDetails | userData )*
')';
schematicSubNetSet : '(schematicSubNetSet'
( schematicSubNet )*
')';
schematicSymbol : '(schematicSymbol'
viewNameDef
schematicSymbolHeader
( annotate | cellNameDisplay | cellPropertyDisplay | clusterPropertyDisplay | comment | commentGraphics | designatorDisplay | figure | implementationNameDisplay | instanceNameDisplay | instanceNameGeneratorDisplay | instanceWidthDisplay | parameterDisplay | propertyDisplay | schematicComplexFigure | schematicSymbolPortImplementation | userData | viewNameDisplay )*
')';
schematicSymbolBorder : '(schematicSymbolBorder'
schematicSymbolBorderTemplateRef
transform
( propertyDisplayOverride | propertyOverride )*
')';
schematicSymbolBorderTemplate : '(schematicSymbolBorderTemplate'
libraryObjectNameDef
schematicTemplateHeader
usableArea
( annotate | commentGraphics | figure | propertyDisplay | schematicComplexFigure )*
')';
schematicSymbolBorderTemplateRef : '(schematicSymbolBorderTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicSymbolHeader : '(schematicSymbolHeader'
schematicUnits
( backgroundColor | derivedFrom | documentation | nameInformation | originalBoundingBox | pageSize | previousVersion | property | schematicSymbolBorder | status )*
')';
schematicSymbolPortImplementation : '(schematicSymbolPortImplementation'
symbolPortImplementationNameDef
portRef
schematicSymbolPortTemplateRef
transform
( portAttributeDisplay | propertyDisplayOverride | propertyOverride )*
')';
schematicSymbolPortImplementationRef : '(schematicSymbolPortImplementationRef'
symbolPortImplementationNameRef
schematicInstanceImplementationRef
')';
schematicSymbolPortTemplate : '(schematicSymbolPortTemplate'
libraryObjectNameDef
schematicTemplateHeader
hotspot
portDirectionIndicator
( annotate | commentGraphics | figure | implementationNameDisplay | portAttributeDisplay | propertyDisplay | schematicComplexFigure | schematicPortAttributes | schematicPortStyle )*
')';
schematicSymbolPortTemplateRef : '(schematicSymbolPortTemplateRef'
libraryObjectNameRef
( libraryRef )?
')';
schematicSymbolRef : '(schematicSymbolRef'
viewNameRef
')';
schematicTemplateHeader : '(schematicTemplateHeader'
schematicUnits
( backgroundColor | documentation | nameInformation | originalBoundingBox | property | status )*
')';
schematicUnits : '(schematicUnits'
( schematicMetric | setAngle | setCapacitance | setFrequency | setTime | setVoltage )*
')';
schematicView : '(schematicView'
viewNameDef
schematicViewHeader
logicalConnectivity
schematicImplementation
( comment | userData )*
')';
schematicViewHeader : '(schematicViewHeader'
schematicUnits
( derivedFrom | documentation | nameInformation | previousVersion | property | status )*
')';
schematicWireAffinity : '(schematicWireAffinity'
( narrowWire | wideWire | unrestricted )
')';
schematicWireStyle : '(schematicWireStyle'
( narrowWire | wideWire )
')';
second : '(second'
unitExponent
')';
secondIntegerExpression : integerExpression;
secondNumber : integerToken;
secondStringExpression : stringExpression;
section : '(section'
sectionNameDef
sectionTitle
( diagram | section | stringValue )*
')';
sectionNameDef : nameDef;
sectionTitle : '(sectionTitle'
stringToken
')';
sequence : '(sequence'
fromInteger
toInteger
( step )?
')';
setAngle : '(setAngle'
unitRef
')';
setCapacitance : '(setCapacitance'
unitRef
')';
setCurrent : '(setCurrent'
unitRef
')';
setDistance : '(setDistance'
unitRef
')';
setFrequency : '(setFrequency'
unitRef
')';
setTime : '(setTime'
unitRef
')';
setVoltage : '(setVoltage'
unitRef
')';
shape : '(shape'
curve
')';
siemens : '(siemens'
unitExponent
')';
signal : '(signal'
signalNameDef
signalJoined
( connectivityTagGenerator | nameInformation | property | signalWidth )*
')';
signalAnnotate : '(signalAnnotate'
( extendSignalDef | extendSignalMemberDef )
( comment | property | propertyOverride )*
')';
signalGroup : '(signalGroup'
signalGroupNameDef
signalList
( property | nameInformation )*
')';
signalGroupAnnotate : '(signalGroupAnnotate'
extendSignalGroupDef
( comment | property | propertyOverride )*
')';
signalGroupNameCaseSensitive : '(signalGroupNameCaseSensitive'
booleanToken
')';
signalGroupNameDef : nameDef;
signalGroupNameRef : nameRef;
signalGroupRef : '(signalGroupRef'
signalGroupNameRef
')';
signalIndexValue : '(signalIndexValue'
')';
signalJoined : '(signalJoined'
( globalPortRef | portInstanceRef | portMemberRef | portRef )*
')';
signalList : '(signalList'
( signalGroupRef | signalRef )*
')';
signalMemberRef : '(signalMemberRef'
signalNameRef
indexValue
')';
signalNameCaseSensitive : '(signalNameCaseSensitive'
booleanToken
')';
signalNameDef : nameDef;
signalNameRef : nameRef;
signalRef : '(signalRef'
signalNameRef
')';
signalWidth : '(signalWidth'
integerExpression
')';
simpleName : stringToken;
startPoint : pointValue;
status : '(status'
( comment | copyright | userData | written )*
')';
step : '(step'
integerValue
')';
string : '(string'
stringExpression
')';
stringConcatenate : '(stringConcatenate'
( stringExpression )*
')';
stringConstant : '(stringConstant'
constantNameDef
stringToken
')';
stringConstantRef : '(stringConstantRef'
constantNameRef
')';
stringEqual : '(stringEqual'
firstStringExpression
secondStringExpression
')';
stringExpression : ( stringParameterRef | stringToken | stringConstantRef | stringConcatenate | substring | decimalToString | stringPrefix | stringSuffix )
;
stringLength : '(stringLength'
stringExpression
')';
stringParameter : '(stringParameter'
parameterNameDef
( nameInformation | string )*
')';
stringParameterAssign : '(stringParameterAssign'
parameterNameRef
stringExpression
')';
stringParameterRef : '(stringParameterRef'
parameterNameRef
')';
stringPrefix : '(stringPrefix'
stringExpression
substringLength
')';
stringSuffix : '(stringSuffix'
stringExpression
substringOffset
')';
stringValue : stringToken;
strong : '(strong'
logicNameRef
')';
subIssue : integerToken;
substring : '(substring'
stringExpression
substringLength
substringOffset
')';
substringLength : integerExpression;
substringOffset : integerExpression;
subtrahend : integerExpression;
symbolicLayoutUnits : '(symbolicLayoutUnits'
( setAngle | setCapacitance | setDistance | setTime )*
')';
symbolicLayoutView : '(symbolicLayoutView'
viewNameDef
( comment | userData )*
( nameInformation )?
( comment | userData )*
')';
symbolPortImplementationNameDef : nameDef;
symbolPortImplementationNameRef : nameRef;
technology : '(technology'
physicalScaling
( comment | figureGroup | logicDefinitions | userData )*
')';
textHeight : '(textHeight'
lengthValue
')';
throughPoint : numberPoint;
time : '(time'
hourNumber
minuteNumber
secondNumber
')';
timeDelay : timeValue;
timeInterval : '(timeInterval'
( event | offsetEvent )
( event | offsetEvent | duration )
')';
timeStamp : '(timeStamp'
date
time
')';
timeValue : miNoMaxValue;
timing : '(timing'
timingNameDef
derivation
( comment | forbiddenEvent | pathDelay | property | userData )*
')';
timingDisplay : '(timingDisplay'
timingNameRef
( display )*
')';
timingNameDef : nameDef;
timingNameRef : nameRef;
toInteger : integerToken;
topJustify : '(topJustify'
')';
totalPages : '(totalPages'
integerToken
')';
totalPagesDisplay : '(totalPagesDisplay'
( addDisplay | replaceDisplay | removeDisplay )
')';
transform : '(transform'
( origin | rotation | scaleX | scaleY )*
')';
transition : '(transition'
previousLogicValue
presentLogicValue
')';
etrue : '(true'
')';
truncate : '(truncate'
')';
typedValue : ( eboolean | integer | miNoMax | number | point | string );
typeface : '(typeface'
fontFamily
( typefaceSuffix )?
')';
typefaceSuffix : '(typefaceSuffix'
stringToken
')';
unconfigured : '(unconfigured'
')';
unconstrained : '(unconstrained'
')';
undefined : '(undefined'
')';
unit : '(unit'
unitNameDef
numberOfNewUnits
numberOfBasicUnits
( ampere | candela | celsius | coulomb | degree | fahrenheit | farad | henry | hertz | joule | kelvin | kilogram | meter | mole | ohm | radian | second | siemens | volt | watt | weber )*
')';
unitDefinitions : '(unitDefinitions'
( unit )*
')';
unitExponent : scaledInteger;
unitNameDef : nameDef;
unitNameRef : nameRef;
unitRef : '(unitRef'
unitNameRef
')';
unrestricted : '(unrestricted'
')';
unspecified : '(unspecified'
')';
unspecifiedDirectionPort : '(unspecifiedDirectionPort'
')';
untyped : '(untyped'
')';
unused : '(unused'
')';
usableArea : '(usableArea'
( rectangle )*
')';
userData : '(userData'
userDataTag
( IDENTIFIER | integerToken | stringToken | userData )*
')';
userDataTag : IDENTIFIER;
version : '(version'
stringValue
')';
verticalJustification : '(verticalJustification'
( bottomJustify | baselineJustify | middleJustify | caplineJustify | topJustify )
')';
viewGroup : '(viewGroup'
viewGroupNameDef
viewGroupHeader
( comment | userData | viewGroupRef | viewRef )*
')';
viewGroupHeader : '(viewGroupHeader'
( documentation | nameInformation | property | reason )*
')';
viewGroupNameCaseSensitive : '(viewGroupNameCaseSensitive'
booleanToken
')';
viewGroupNameDef : nameDef;
viewGroupNameRef : nameRef;
viewGroupRef : '(viewGroupRef'
viewGroupNameRef
')';
viewNameCaseSensitive : '(viewNameCaseSensitive'
booleanToken
')';
viewNameDef : nameDef;
viewNameDisplay : '(viewNameDisplay'
( display | displayNameOverride )*
')';
viewNameRef : nameRef;
viewPropertyDisplay : '(viewPropertyDisplay'
propertyNameRef
( display | propertyNameDisplay )*
')';
viewPropertyOverride : '(viewPropertyOverride'
propertyNameRef
( typedValue | untyped )
( comment | fixed | propertyOverride )*
')';
viewRef : '(viewRef'
viewNameRef
( clusterRef )?
')';
visible : '(visible'
booleanValue
')';
volt : '(volt'
unitExponent
')';
voltageMap : '(voltageMap'
voltageValue
')';
voltageValue : miNoMaxValue;
watt : '(watt'
unitExponent
')';
weak : '(weak'
logicNameRef
')';
weakJoined : '(weakJoined'
( interfaceJoined | portRef )*
')';
weber : '(weber'
unitExponent
')';
widePort : '(widePort'
')';
wideWire : '(wideWire'
')';
written : '(written'
timeStamp
( author | comment | dataOrigin | program | userData )*
')';
xCoordinate : integerValue;
xNumberValue : numberValue;
xor_ : '(xor'
( booleanExpression )*
')';
yCoordinate : integerValue;
year : '(year'
( yearNumber )*
')';
yearNumber : integerToken;
yNumberValue : numberValue;
integerToken :DECIMAL_LITERAL;
stringToken :STRING_LITERAL;
IDENTIFIER : (SPECIAL)* (DIG)* (LETTER|'&'|UNDERLINE) ( LETTER | DIG | UNDERLINE |SPECIAL)* ;
STRING_LITERAL : '"' (~'"')* '"' ;
DECIMAL_LITERAL : INTEGER ( '.' INTEGER* )? ;
fragment
INTEGER : ('-'|'+')? DIG (DIG)* ;
fragment
LETTER : UPCASE |LOWCASE ;
fragment
UPCASE: [A-Z];
fragment
LOWCASE: [a-z];
fragment
DIG: [0-9];
fragment
UNDERLINE : '_';
fragment
SPECIAL: '!' | '#' | '$' | '&'| '*'| '+' | ',' | '-' | '.' | '/' | ':' | ';' |
'<' | '=' | '>' | '?' | '@' | '[' | ']'| '^' | '`' | '{' | '|' | '}' | '~'| '\\' ;
WS : [ \t\r\n]+ -> skip;
|
src/dw1000-ranging.ads | SALLYPEMDAS/DW1000 | 9 | 12886 | -------------------------------------------------------------------------------
-- Copyright (c) 2016 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------------
with DW1000.Driver;
with DW1000.System_Time; use DW1000.System_Time;
package DW1000.Ranging
with SPARK_Mode => On
is
Air_Refractive_Index : constant := 1.0003;
Speed_Of_Light_In_Vacuum : constant := 299_792_458.0; -- meters per second
Speed_Of_Light_In_Air : constant
:= Speed_Of_Light_In_Vacuum / Air_Refractive_Index; -- meters per second
type Meters is delta 0.001 range 0.0 .. 30_000.0;
-- Distance in meters with a resolution of 1 mm.
--
-- This type is constrained to a maximum range of 30 km, which is more than
-- enough since the operational range of the DW1000 is limited to 300 m.
type Biased_Distance is new Meters;
-- Type for distance measurements (in meters) which includes a ranging bias.
--
-- The bias is influenced by the UWB channel and pulse repetition frequency
-- (PRF) that was used to perform the measurement. This bias must be removed
-- for a more accurate ranging measurement.
function Remove_Ranging_Bias
(Measured_Distance : in Biased_Distance;
Channel : in DW1000.Driver.Channel_Number;
PRF : in DW1000.Driver.PRF_Type) return Meters
with Global => null;
-- Remove the ranging bias from a distance measurement.
--
-- The distance calculated using the DW1000 contains a bias based on the
-- channel and PRF configuration used during the measurement. This bias
-- must be removed to achieve a more accurate ranging measurement.
--
-- @param Measured_Distance The distance measurement which includes the
-- ranging bias.
--
-- @param Channel The UWB channel which was used to measure the distance.
--
-- @param PRF The PRF which was used to measure the distance.
--
-- @return The corrected distance, with the bias removed.
end DW1000.Ranging;
|
oeis/328/A328352.asm | neoneye/loda-programs | 11 | 18091 | <gh_stars>10-100
; A328352: Similar to A328350, but for 5 digits rather then 3.
; 0,1,56,2831,141706,7086081,354307956,17715417331,885770964206,44288548698581,2214427437370456,110721371880729831,5536068594097526706,276803429705181511081,13840171485260601432956,692008574263037701042331,34600428713151923199089206,1730021435657596350689323581,86501071782879818488140495456,4325053589143990929175396354831,216252679457199546482611675651706,10812633972859977324249793072136081,540631698642998866213085700054557956,27031584932149943310657265234966667331
lpb $0
mov $2,$0
sub $0,1
seq $2,86578 ; a(n) = 7*(10^n - 1).
add $3,$2
mul $3,5
lpe
mov $0,$3
div $0,315
|
Labs/Lab8_C-Assembly-Interaction/9-max-assembly-calls/main.asm | CristianCotovanu/IOCLA | 0 | 83279 | BITS 64
extern printf
extern get_max
section .data
arr: dd 19, 7, 129, 87, 54, 218, 67, 12, 19, 99
len: equ $-arr
print_format: db "max: %u", 13, 10, 0
section .text
global main
main:
push rbp
mov rbp, rsp
; Compute length in eax.
; Divide by 4 (we are using integer data type of 4 bytes) by
; using shr 2 (shift right with 2 bits).
mov eax, len
shr eax, 2
push rax
push arr
call get_max
add esp, 8
; Print max.
push rax
push print_format
call printf
add esp, 8
leave
ret
|
courses/fundamentals_of_ada/labs/prompts/135_visibility/types-strings.adb | AdaCore/training_material | 15 | 14977 | <gh_stars>10-100
with Ada.Text_IO; use Ada.Text_IO;
package body Types.Strings is
package Io is new Ada.Text_IO.Float_IO (Float);
function To_String
(Value : Float)
return String is
begin
-- Use IO package to convert number to a string
-- Use global objects from spec to control formatting
return "";
end To_String;
-- Implement
function To_String
(Value : Miles_T)
return String is
begin
return To_String (Float (Value));
end To_String;
function To_String
(Value : Hours_T)
return String is
begin
return To_String (Float (Value));
end To_String;
-- Implement functions to convert your types to strings
end Types.Strings;
|
oeis/022/A022395.asm | neoneye/loda-programs | 11 | 91047 | ; A022395: Fibonacci sequence beginning 1, 25.
; Submitted by <NAME>(s4)
; 1,25,26,51,77,128,205,333,538,871,1409,2280,3689,5969,9658,15627,25285,40912,66197,107109,173306,280415,453721,734136,1187857,1921993,3109850,5031843,8141693,13173536,21315229,34488765,55803994,90292759,146096753,236389512,382486265,618875777,1001362042,1620237819,2621599861,4241837680,6863437541,11105275221,17968712762,29073987983,47042700745,76116688728,123159389473,199276078201,322435467674,521711545875,844147013549,1365858559424,2210005572973,3575864132397,5785869705370,9361733837767
mov $1,1
mov $2,24
lpb $0
sub $0,1
mov $3,$2
mov $2,$1
add $1,$3
lpe
mov $0,$1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.