Created
May 30, 2013 18:30
-
-
Save fowlmouth/5680007 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import macros | |
from strutils import format | |
macro constStr* (name; str: expr[string]): stmt {.immediate.}= | |
##need a check for top level statement?? | |
result = """{.emit: "prog_char $1_data[] PROGMEM = \"$2\"; ".} | |
var $1_data {.importc, nodecl.}: array[$3, char] | |
template $1: cstring = $1_data[0].addr""".format(name, str, str.strval.len).parseStmt | |
result.repr.echo | |
constStr string_0, "String 0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment