/** * Higher timeframe and other instrument reads, `compiled-program.md` 2.16. * * A read is the one thing in the language whose value is not computed from the * bars the program is running on. Everything else an engine needs it can work * out from this chart: a read needs another series entirely, and an expression * evaluated over it. * * So a read compiles to two halves, and the split is the same one a `plot` * makes. The fixed half is an entry here: which instrument, which timeframe, * which of the three readings of `stdlib.md` 15.3, and the expression itself as * a body over the requested bars. The per-bar half is a register, which the * engine fills with the read's value for the bar about to run, exactly as it * fills a bar register from the host's bar. * * **A register rather than a slot**, because a slot belongs to one frame (3.2) * and a read may be written inside a `fn`; and because a register has history, * so `dayHigh[1]` is the previous bar's reading with no further machinery. * * The body gets an emitter of its own. Its registers, cells and state regions * are counted from zero over the requested bars, and a pass that reached into * the parent's would put this chart's history behind another chart's name. What * the two share is the constant pool and the library manifest, because nothing * in either depends on a bar. */ import type { Call, Expression } from '../ast/index.js'; import type { CheckedCall } from '../check/index.js'; import type { Emitter, Frame } from './context.js'; /** The two reads of `stdlib.md` 15.1, and the two that ask after one. */ export declare const REQUEST_CALLS: Set; export declare const REQUEST_STATUS_CALLS: Set; /** * A read, as a value on this bar: the register the engine filled for it. * * One request per call written in the source, however many call paths reach it. * A body emitted twice, which 2.12 does for a function reached two ways, asks * the host the same question twice otherwise, and the host's ceiling on * outstanding requests counts both. */ export declare function emitRequestRead(e: Emitter, f: Frame, call: Call, checked: CheckedCall): void; /** * The request a status call names, for `req.isReady` and `req.error`. * * Both name a read rather than taking its value, and a value on a bar cannot * say which request produced it, so the compiler resolves the argument to the * request's id and passes that. It is the same resolution `fill` does on a plot * handle (2.8), and the reason is the same: the argument is a compile-time * identity wearing the clothes of a value. * * **A read written inline is registered here and not only resolved**, which is * the whole of the second half of this function. The checker gives every read * in the file an id whether or not anything else in the file uses its value, and * an id on its own names nothing an engine was handed: the compiled program * would carry no request under it, the host would never be asked, and * `req.error` would answer the empty string for a read the host refused. That is * the one answer this pair of calls exists to make impossible, and it held only * for the form written as a name. So the inline form emits its request the same * way the value form does, and asks the host the same question. */ export declare function requestIdFor(e: Emitter, expression: Expression): number | undefined; /** * Which name holds which read, before a statement is emitted. * * `req.isReady(dayHigh)` is resolved against this, and the call may be written * above the line that declares the name it asks about, so the links are made * before any of them is needed rather than as each declaration is met. */ export declare function linkRequestNames(e: Emitter): void; //# sourceMappingURL=requests.d.ts.map