- adhoc: Lean.Name → Lean.ExternEntry
- inline: Lean.Name → String → Lean.ExternEntry
- standard: Lean.Name → String → Lean.ExternEntry
- foreign: Lean.Name → String → Lean.ExternEntry
Instances For
@[extern]
encoding:.entries = [adhoc `all]
@[extern "level_hash"]
encoding:.entries = [standard `all "levelHash"]
@[extern cpp "lean::string_size" llvm "lean_str_size"]
encoding:.entries = [standard `cpp "lean::string_size", standard `llvm "leanStrSize"]
@[extern cpp inline "#1 + #2"]
encoding:.entries = [inline `cpp "#1 + #2"]
@[extern cpp "foo" llvm adhoc]
encoding:.entries = [standard `cpp "foo", adhoc `llvm]
@[extern 2 cpp "io_prim_println"]
encoding:.arity? = 2, .entries = [standard `cpp "ioPrimPrintln"]
- entries : List Lean.ExternEntry
Instances For
Equations
- Lean.instInhabitedExternAttrData = { default := { arity? := default, entries := default } }
@[extern lean_add_extern]
@[export lean_get_extern_attr_data]
Equations
- Lean.getExternAttrData? env n = Lean.externAttr.getParam? env n
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Lean.expandExternPatternAux args 0 x✝ x = x
Instances For
Equations
- Lean.expandExternPattern pattern args = Lean.expandExternPatternAux args pattern.length pattern.mkIterator ""
Instances For
Equations
- Lean.mkSimpleFnCall fn args = fn ++ "(" ++ List.foldl (fun (x1 x2 : String) => x1 ++ x2) "" (List.intersperse ", " args) ++ ")"
Instances For
Equations
- (Lean.ExternEntry.adhoc n).backend = n
- (Lean.ExternEntry.inline n pattern).backend = n
- (Lean.ExternEntry.standard n fn).backend = n
- (Lean.ExternEntry.foreign n fn).backend = n
Instances For
Equations
- Lean.getExternEntryForAux backend [] = none
- Lean.getExternEntryForAux backend (e :: es) = if (e.backend == `all) = true then some e else if (e.backend == backend) = true then some e else Lean.getExternEntryForAux backend es
Instances For
Equations
- Lean.getExternEntryFor d backend = Lean.getExternEntryForAux backend d.entries
Instances For
Equations
- Lean.isExtern env fn = (Lean.getExternAttrData? env fn).isSome
Instances For
We say a Lean function marked as [extern "<c_fn_nane>"]
is for all backends, and it is implemented using extern "C"
.
Thus, there is no name mangling.
Equations
- Lean.isExternC env fn = match Lean.getExternAttrData? env fn with | some { arity? := arity?, entries := [Lean.ExternEntry.standard `all fn] } => true | x => false
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[export lean_get_extern_const_arity]
Equations
- One or more equations did not get rendered due to their size.