implemented 'emit' pragma

This commit is contained in:
Araq 2011-01-07 00:17:18 +01:00
commit e008630838
10 changed files with 108 additions and 74 deletions

View file

@ -19,6 +19,7 @@ tconstr2.nim;69
tcontinuexc.nim;ECcaught
tcopy.nim;TEMP=C:\Programs\xyz\bin
tcurrncy.nim;25
temit.nim;509
texcsub.nim;caught!
texplicitgeneric1.nim;Key: 12 value: 12Key: 13 value: 13 Key: A value: 12 Key: B value: 13
tfinally.nim;came here 3

1 tack.nim 125
19 tcontinuexc.nim ECcaught
20 tcopy.nim TEMP=C:\Programs\xyz\bin
21 tcurrncy.nim 25
22 temit.nim 509
23 texcsub.nim caught!
24 texplicitgeneric1.nim Key: 12 value: 12Key: 13 value: 13 Key: A value: 12 Key: B value: 13
25 tfinally.nim came here 3

View file

@ -0,0 +1,14 @@
# Test the new ``emit`` pragma:
{.emit: """
static int cvariable = 420;
""".}
proc embedsC() {.pure.} =
var nimrodVar = 89
{.emit: """fprintf(stdout, "%d\n", cvariable + (int)`nimrodVar`);""".}
embedsC()