[After I originally posted this, I realized the complexity inherent in having one template run another, with the callee able to return to the caller. So I don’t expect a positive answer to my subject line’s question. But I’m leaving the question here because I think it might generate some useful discussion.]
The built-in help Running Templates At An Offset tells how to do this when a template is run interactively.
Is it possible programmatically to do the equivalent, as if there were a RunTemplateAtOffset() function?
Motivation (I hope this makes some kind of sense.)
I’m building a template, or a set of several templates, for an object file format that is created by an assembler.
I’m considering which it would be better to create:
- One large template (perhaps using
#include
statements to pull in the code for each kind of record), or, - A “main template” that, based on the value of each record’s type byte, invokes the appropriate “sub-template” for that template.
Modules aren’t records themselves, but are a notionally higher-level “object” (not in any formal sense of the word) built from a series of records.
Each of these record types is identifiable by the value in its initial record type byte. (Specific values omitted here for simplicity.)
-
A Module is a:
- Module Header Record, then,
- Zero or more Definition Records, then,
- Zero or more Data/Debug “Objects”, then
- Module End record
-
A Definition Record can be either:
- A Segment Definitions Record [details omitted], or,
- A Public Definitions Record [details omitted]
-
A Data/Debug “Object” is either:
- A Data Section “Object”, or,
- A Debug Record [details omitted]
-
A Data Section “Object” is:
- A Content Record [details omitted], followed by,
- Zero or more Fixup Records [details omitted]
[Peripherally, I’d like to both:
- See the usual template output, and,
- Produce a formatted text file that’s easier to understand for the non-010 “initiate”.]
If, as I suspect, it’s not possible to do what this post’s Subject line asks, do any other ways of dealing with this kind of