With this snippet:
import macros
...
macro interproc(interruptVector, name, wrapper) = quote do:
proc `name`() {.exportc, asmNoStackFrame.} =
asm """
pushq `interruptVector`
jmp `wrapper`
"""
interruptProcedures[`interruptVector`] = cast[uint64](`name`)
for iv in 0..<32:
var wrapperProcName: string = if iv in erroringVectors:
"errorInterruptWrapper" else: "genericInterruptWrapper"
var procname: string = "vectorPusher" & $iv
interproc(iv, procname, wrapperProcName)
Run
I get the following result:
kernel/idt.nim(114, 12) template/generic instantiation of `interproc` from
here
kernel/idt.nim(103, 51) Error: redefinition of 'procname'; previous
declaration here: kernel/idt.nim(113, 7)
Run
Line 103 is the macro prototype, line 113 is the procname declaration, line 114
is the macro call.