librarycode
本頁內容尚未翻譯。
cfamily.LibraryCode.node
Section titled “cfamily.LibraryCode.node”def LibraryCode.node (n : String) : NodeIdA node of the library’s code.
cfamily.LibraryCode.variable
Section titled “cfamily.LibraryCode.variable”def LibraryCode.variable (n : String) (x : String) : ExprA variable of the library’s code.
cfamily.LibraryCode.number
Section titled “cfamily.LibraryCode.number”def LibraryCode.number (n : String) (v : Int) : ExprAn integer constant of the library’s code.
cfamily.LibraryCode.call
Section titled “cfamily.LibraryCode.call”def LibraryCode.call (n : String) (f : String) (args : List Expr) : ExprA call in the library’s code.
cfamily.LibraryCode.declare
Section titled “cfamily.LibraryCode.declare”def LibraryCode.declare (n : String) (x : String) (t : TypeSyntax) (e : Expr) : StmtA declaration with an initializer in the library’s code.
cfamily.LibraryCode.parameter
Section titled “cfamily.LibraryCode.parameter”def LibraryCode.parameter (x : String) (t : TypeSyntax) : ParamA parameter of the library’s code.
cfamily.LibraryCode.comparator
Section titled “cfamily.LibraryCode.comparator”def LibraryCode.comparator : TypeSyntaxThe comparator’s type: int (*)(const void *, const void *).
cfamily.LibraryCode.checkArray
Section titled “cfamily.LibraryCode.checkArray”def LibraryCode.checkArray (n : String) (k : String) (base : String * String) (count : String * String) (size : String * String) : StmtThe checks of qsort’s and bsearch’s array (C11 7.22.5p1), at node n with the base, count and size variables.
cfamily.LibraryCode.hold
Section titled “cfamily.LibraryCode.hold”def LibraryCode.hold (n : String) (base : String) (count : String) (size : String) : StmtHolding an array while the comparator runs (__qhold, C11 7.22.5p3: a write that alters it stops the run).
cfamily.LibraryCode.release
Section titled “cfamily.LibraryCode.release”def LibraryCode.release (n : String) : StmtLetting go of the held array (__qrelease).
cfamily.LibraryCode.qsortOutOfOrder
Section titled “cfamily.LibraryCode.qsortOutOfOrder”def LibraryCode.qsortOutOfOrder : Exprqsort’s test whether the j-th element is below the one before it.
cfamily.LibraryCode.qsortInner
Section titled “cfamily.LibraryCode.qsortInner”def LibraryCode.qsortInner : Stmtqsort’s inner loop: while j > 0 and the j-th is out of order, swap it with the one before.
cfamily.LibraryCode.qsortOuter
Section titled “cfamily.LibraryCode.qsortOuter”def LibraryCode.qsortOuter : Stmtqsort’s outer loop over i from 1.
cfamily.LibraryCode.element
Section titled “cfamily.LibraryCode.element”def LibraryCode.element (n : String) (base : String) (index : Expr) : ExprThe element of an array at an index.
cfamily.LibraryCode.compare
Section titled “cfamily.LibraryCode.compare”def LibraryCode.compare (n : String) (comparator : String) (a : Expr) (b : Expr) : ExprA call of a comparator variable.
cfamily.LibraryCode.step
Section titled “cfamily.LibraryCode.step”def LibraryCode.step (n : String) (op : BinaryOp) (x : String) : ExprAn index plus or minus 1.
cfamily.LibraryCode.isQuiet
Section titled “cfamily.LibraryCode.isQuiet”def LibraryCode.isQuiet (n : String) (comparator : String) (quiet : List String) : ExprWhether a comparator variable is one of the quiet functions: cmp == f || ..., 0 for none.
cfamily.LibraryCode.compareElements
Section titled “cfamily.LibraryCode.compareElements”def LibraryCode.compareElements (n : String) (comparator : String) (base : String) (a : Expr) (b : Expr) : ExprA comparison of the elements of an array at two indices.
cfamily.LibraryCode.isZero
Section titled “cfamily.LibraryCode.isZero”def LibraryCode.isZero (n : String) (e : Expr) : ExprWhether an expression is 0.
cfamily.LibraryCode.upTo
Section titled “cfamily.LibraryCode.upTo”def LibraryCode.upTo (n : String) (x : String) (start : Expr) (bound : String) (body : Stmt) : Stmtfor (unsigned long x = start; x < bound; x++) body.
cfamily.LibraryCode.when
Section titled “cfamily.LibraryCode.when”def LibraryCode.when (n : String) (c : Expr) (body : Stmt) : Stmtif (c) body.
cfamily.LibraryCode.qsortPair
Section titled “cfamily.LibraryCode.qsortPair”def LibraryCode.qsortPair : Stmtqsort’s check of the i-th and j-th elements of the sorted array (i before j, __qorder): the two comparisons, and
whether every neighbour from the i-th to the j-th compares equal (qrun carries it along the row: for neighbours,
whether they compare equal; further on, whether it held up to the one before the j-th and the one before equals the
j-th). Three calls of the comparator for each pair.
cfamily.LibraryCode.qsortOrderCheck
Section titled “cfamily.LibraryCode.qsortOrderCheck”def LibraryCode.qsortOrderCheck (quiet : List String) : Stmtqsort’s check of the sorted array (C11 7.22.5p4), every pair once, when the comparator is quiet.
cfamily.LibraryCode.qsort
Section titled “cfamily.LibraryCode.qsort”def LibraryCode.qsort (quiet : List String) : FunctionDefinitionqsort: an insertion sort through the comparator, after the checks of the array (C11 7.22.5.2), then the check of its results when the comparator is quiet; the array is held while it runs.
cfamily.LibraryCode.bsearchMiddle
Section titled “cfamily.LibraryCode.bsearchMiddle”def LibraryCode.bsearchMiddle : Stmtbsearch’s middle index: lo + (hi - lo) / 2.
cfamily.LibraryCode.bsearchCompare
Section titled “cfamily.LibraryCode.bsearchCompare”def LibraryCode.bsearchCompare : Stmtbsearch’s comparison of the key with the middle element.
cfamily.LibraryCode.bsearchFound
Section titled “cfamily.LibraryCode.bsearchFound”def LibraryCode.bsearchFound : Stmtbsearch’s return of the middle element when it equals the key, letting go of the held array first.
cfamily.LibraryCode.bsearchNarrow
Section titled “cfamily.LibraryCode.bsearchNarrow”def LibraryCode.bsearchNarrow : Stmtbsearch’s halving: the lower half when the key is below the middle, else the upper.
cfamily.LibraryCode.bsearchSorted
Section titled “cfamily.LibraryCode.bsearchSorted”def LibraryCode.bsearchSorted (quiet : List String) : Stmtbsearch’s check that the array is sorted by the key (C11 7.22.5.1p2), each element with the one before, when the
comparator is quiet (__qsorted).
cfamily.LibraryCode.bsearch
Section titled “cfamily.LibraryCode.bsearch”def LibraryCode.bsearch (quiet : List String) : FunctionDefinitionbsearch: a binary search through the comparator, after the checks of the array (C11 7.22.5.1) and, when the comparator is quiet, that the array is sorted; the array is held while it runs.
cfamily.LibraryCode.functions
Section titled “cfamily.LibraryCode.functions”def LibraryCode.functions (quiet : List String) : List FunctionDefinitionThe library’s functions written in C, with the quiet comparators.
cfamily.TypeSyntax.isInt
Section titled “cfamily.TypeSyntax.isInt”def TypeSyntax.isInt (t : TypeSyntax) : BoolWhether a type is int.
cfamily.TypeSyntax.isConstVoidPointer
Section titled “cfamily.TypeSyntax.isConstVoidPointer”def TypeSyntax.isConstVoidPointer (t : TypeSyntax) : BoolWhether a type is const void *.
cfamily.Param.isConstVoidPointer
Section titled “cfamily.Param.isConstVoidPointer”def Param.isConstVoidPointer (p : Param) : BoolWhether a parameter is const void *.
cfamily.FunctionDefinition.isComparator
Section titled “cfamily.FunctionDefinition.isComparator”def FunctionDefinition.isComparator (f : FunctionDefinition) : BoolWhether a function has the comparator’s type, int (const void *, const void *).
cfamily.Effects.isQuiet
Section titled “cfamily.Effects.isQuiet”def Effects.isQuiet (e : Effects) : BoolWhether calling a function changes nothing a run shows: no input or output, no writes but to its own locals.
cfamily.LibraryCode.quietComparators
Section titled “cfamily.LibraryCode.quietComparators”def LibraryCode.quietComparators (effects : EffectTable) (items : List Item) : List StringThe program’s functions of the comparator’s type whose calls change nothing a run shows.
cfamily.FunctionDefinition.body
Section titled “cfamily.FunctionDefinition.body”def FunctionDefinition.body (f : FunctionDefinition) : StmtA function’s body.
cfamily.Expr.names
Section titled “cfamily.Expr.names”def Expr.names (f : String) (e : Expr) : BoolWhether an expression calls or names a function.
cfamily.Item.functions
Section titled “cfamily.Item.functions”def Item.functions (items : List Item) : List FunctionDefinitionThe functions of the items, in order.
cfamily.Item.uses
Section titled “cfamily.Item.uses”def Item.uses (items : List Item) (f : String) : BoolWhether the items’ functions call or name a function.
cfamily.LibraryCode.isNeeded
Section titled “cfamily.LibraryCode.isNeeded”def LibraryCode.isNeeded (items : List Item) (d : FunctionDefinition) : BoolWhether the program needs one of the library’s C functions: it uses the function and does not define it.
cfamily.LibraryCode.anyNeeded
Section titled “cfamily.LibraryCode.anyNeeded”def LibraryCode.anyNeeded (items : List Item) : BoolWhether the program needs any of the library’s C functions.
cfamily.Item.withLibraryCode
Section titled “cfamily.Item.withLibraryCode”def Item.withLibraryCode (quiet : List String) (items : List Item) : List ItemThe items with the library’s C functions the program uses and does not define, checking the comparators named quiet.