Plumb {.intdefine.} and {.strdefine.} pragmas.
Shorthand so that users won't need to use the .magic pragma
This commit is contained in:
parent
94d1aa5109
commit
4f4aafda6c
2 changed files with 7 additions and 2 deletions
|
|
@ -63,7 +63,8 @@ const
|
||||||
wImportCpp, wImportObjC, wError, wNoInit, wCompileTime, wGlobal,
|
wImportCpp, wImportObjC, wError, wNoInit, wCompileTime, wGlobal,
|
||||||
wGensym, wInject, wCodegenDecl, wGuard, wGoto, wExportNims}
|
wGensym, wInject, wCodegenDecl, wGuard, wGoto, wExportNims}
|
||||||
constPragmas* = {wImportc, wExportc, wHeader, wDeprecated, wMagic, wNodecl,
|
constPragmas* = {wImportc, wExportc, wHeader, wDeprecated, wMagic, wNodecl,
|
||||||
wExtern, wImportCpp, wImportObjC, wError, wGensym, wInject, wExportNims}
|
wExtern, wImportCpp, wImportObjC, wError, wGensym, wInject, wExportNims,
|
||||||
|
wIntDefine, wStrDefine}
|
||||||
letPragmas* = varPragmas
|
letPragmas* = varPragmas
|
||||||
procTypePragmas* = {FirstCallConv..LastCallConv, wVarargs, wNosideeffect,
|
procTypePragmas* = {FirstCallConv..LastCallConv, wVarargs, wNosideeffect,
|
||||||
wThread, wRaises, wLocks, wTags, wGcSafe}
|
wThread, wRaises, wLocks, wTags, wGcSafe}
|
||||||
|
|
@ -898,6 +899,10 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
||||||
of wBase:
|
of wBase:
|
||||||
noVal(it)
|
noVal(it)
|
||||||
sym.flags.incl sfBase
|
sym.flags.incl sfBase
|
||||||
|
of wIntDefine:
|
||||||
|
sym.magic = mIntDefine
|
||||||
|
of wStrDefine:
|
||||||
|
sym.magic = mIntDefine
|
||||||
else: invalidPragma(it)
|
else: invalidPragma(it)
|
||||||
else: invalidPragma(it)
|
else: invalidPragma(it)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ elif defined(windows):
|
||||||
#VirtualFree(p, size, MEM_DECOMMIT)
|
#VirtualFree(p, size, MEM_DECOMMIT)
|
||||||
|
|
||||||
elif hostOS == "standalone":
|
elif hostOS == "standalone":
|
||||||
const StandaloneHeapSize {.magic: "IntDefine"}: int = 1024 * PageSize
|
const StandaloneHeapSize {.intdefine.}: int = 1024 * PageSize
|
||||||
var
|
var
|
||||||
theHeap: array[StandaloneHeapSize, float64] # 'float64' for alignment
|
theHeap: array[StandaloneHeapSize, float64] # 'float64' for alignment
|
||||||
bumpPointer = cast[int](addr theHeap)
|
bumpPointer = cast[int](addr theHeap)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue